Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Fun4All_Analysis.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file Fun4All_Analysis.C
1 #ifndef MACRO_FUN4ALLANALYSIS_C
2 #define MACRO_FUN4ALLANALYSIS_C
8 
9 #include <g4jets/ClusterJetInput.h>
10 #include <g4jets/FastJetAlgo.h>
11 #include <g4jets/JetReco.h>
12 #include <g4jets/TowerJetInput.h>
13 #include <g4jets/TrackJetInput.h>
14 #include <g4jets/TruthJetInput.h>
15 #include <G4_HIJetReco.C>
16 #include <G4_Jets.C>
17 #include <analysis/analysis.h>
18 
19 R__LOAD_LIBRARY(libfun4all.so)
20 R__LOAD_LIBRARY(libanalysis.so)
21 
22 void Fun4All_Analysis(string inputFile1 = "DST_TRUTH_JET_pythia8_Jet04_3MHz-0000000004-00000.root", string inputFile2 = "DST_CALO_CLUSTER_pythia8_Jet04_3MHz-0000000004-00000.root",string outputfilename = "test.root", const int nEvents = 100)
23 {
25  // Make the Server
28  se->Verbosity(0);
29 
30  //-----------------------------------------------------------------------
31  //Read in a file containing the truth jet information
32  //-----------------------------------------------------------------------
33  Fun4AllInputManager *t_in = new Fun4AllDstInputManager("DSTin");
34  t_in->fileopen(inputFile1);
35  se->registerInputManager(t_in);
36 
37  //---------------------------------------------------------------------------
38  //Read in a file containing the calorimeter information
39  //---------------------------------------------------------------------------
40 
41  Fun4AllInputManager* in = new Fun4AllDstInputManager("DSTCALOCLUSTERS");
42  in->fileopen(inputFile2);
43  se->registerInputManager(in);
44  //----------------------------------------------------------------------------------------------
45  //Perform the jet reconstruction: by default producing 0.2-0.8 jets
46  //----------------------------------------------------------------------------------------------
47 
48  JetReco *towerjetreco = new JetReco("TOWERJETRECO");
49  towerjetreco->add_input(new TowerJetInput(Jet::CEMC_TOWER));
50  towerjetreco->add_input(new TowerJetInput(Jet::HCALIN_TOWER));
51  towerjetreco->add_input(new TowerJetInput(Jet::HCALOUT_TOWER));
52  towerjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.2), "AntiKt_Tower_r02");
53  towerjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.3), "AntiKt_Tower_r03");
54  towerjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.4), "AntiKt_Tower_r04");
55  towerjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.5), "AntiKt_Tower_r05");
56  towerjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.6), "AntiKt_Tower_r06");
57  towerjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.7), "AntiKt_Tower_r07");
58  towerjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.8), "AntiKt_Tower_r08");
59  towerjetreco->set_algo_node("ANTIKT");
60  towerjetreco->set_input_node("TOWER");
61  se->registerSubsystem(towerjetreco);
62 
63 
64  //-----------------------------------------------
65  // register up the analysis module
66  //-----------------------------------------------
67 
68  analysis *myreco = new analysis();
69  myreco->SetOutputFileName(outputfilename);
70  se->registerSubsystem(myreco);
71 
72  if (nEvents <= 0)
73  {
74  return;
75  }
76  cout << endl << "Running over " << nEvents << " Events" << endl;
77  se->run(nEvents);
78  cout << endl << "Calling End in Fun4All_Analysis.C" << endl;
79  se->End();
80  cout << endl << "All done, calling delete Fun4AllServer" << endl;
81  delete se;
82  cout << endl << "gSystem->Exit(0)" << endl;
83  gSystem->Exit(0);
84 }
85 #endif // MACRO_FUN4ALLANALYSIS_C
86