Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Fun4All_EICAnalysis_JPsi.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file Fun4All_EICAnalysis_JPsi.C
1 
3  const int nEvents = 100000,
4  //const char * inputFile = "../data/phpythia6_e20p250_jpsi_jpsi2ee_100k_hepmc.root",
5  //const char * outputFile = "eicmcana_pythia6_e20p250_jpsi_jpsi2ee_100k.root"
6  //const char * inputFile = "../data/phpythia6_e10p250_jpsi_jpsi2ee_100k_hepmc.root",
7  //const char * outputFile = "eicmcana_pythia6_e10p250_jpsi_jpsi2ee_100k.root"
8  //const char * inputFile = "../data/phpythia6_e10p100_jpsi_jpsi2ee_100k_hepmc.root",
9  //const char * outputFile = "eicmcana_pythia6_e10p100_jpsi_jpsi2ee_100k.root"
10  const char * inputFile = "../data/phpythia6_e20p250_ccbar_jpsi2ee_1k_hepmc.root",
11  const char * outputFile = "eicmcana_pythia6_e20p250_ccbar_jpsi2ee_1k.root"
12  )
13 {
14 
15  bool readdst = true;
16  bool readhepmc = false;
17 
18  //---------------
19  // Load libraries
20  //---------------
21 
22  gSystem->Load("libfun4all.so");
23  gSystem->Load("libphhepmc.so");
24  gSystem->Load("libeicana.so");
25 
26  //---------------
27  // Fun4All server
28  //---------------
29 
31  se->Verbosity(0);
32  // just if we set some flags somewhere in this macro
34 
35  // rc->set_FloatFlag("WorldSizex",1000);
36  // rc->set_FloatFlag("WorldSizey",1000);
37  // rc->set_FloatFlag("WorldSizez",1000);
38  // rc->set_CharFlag("WorldShape","G4Tubs");
39 
40 
41  //--------------
42  // Analysis modules
43  //--------------
44 
45  // DISKinematics *disana = new DISKinematics("testdis.root");
46  // se->registerSubsystem( disana );
47 
48  Quarkonia2LeptonsMC *mcana = new Quarkonia2LeptonsMC(outputFile);
49  se->registerSubsystem( mcana );
50 
51  //--------------
52  // IO management
53  //--------------
54 
55  /* Read DST Files */
56  if ( readdst )
57  {
58  Fun4AllInputManager *hitsin = new Fun4AllDstInputManager("DSTin");
59  hitsin->fileopen(inputFile);
60  se->registerInputManager(hitsin);
61  }
62  /* Read HepMC ASCII files */
63  else if ( readhepmc )
64  {
66  se->registerInputManager( in );
67  se->fileopen( in->Name().c_str(), inputFile );
68  }
69 
70 
71  //-----------------
72  // Event processing
73  //-----------------
74  if (nEvents < 0)
75  {
76  return;
77  }
78  // if we run the particle generator and use 0 it'll run forever
79  if (nEvents == 0 && !readhits && !readhepmc)
80  {
81  cout << "using 0 for number of events is a bad idea when using particle generators" << endl;
82  cout << "it will run forever, so I just return without running anything" << endl;
83  return;
84  }
85 
86  se->run(nEvents);
87 
88  //-----
89  // Exit
90  //-----
91 
92  se->End();
93  std::cout << "All done" << std::endl;
94  delete se;
95  gSystem->Exit(0);
96 }