Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Fun4All_JetBkgd.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file Fun4All_JetBkgd.C
1 #pragma once
2 #if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0)
3 #include <fun4all/SubsysReco.h>
7 
10 
11 #include <phool/PHRandomSeed.h>
12 #include <phool/recoConsts.h>
13 
15 
18 
19 #include <jetbase/JetReco.h>
20 #include <jetbase/TowerJetInput.h>
21 #include <jetbase/FastJetAlgo.h>
22 
23 #include <HIJetReco.C>
24 
25 #include <jetbkgdsub/JetBkgdSub.h>
26 
27 R__LOAD_LIBRARY(libfun4all.so)
28 R__LOAD_LIBRARY(libg4jets.so)
29 R__LOAD_LIBRARY(libjetbackground.so)
30 R__LOAD_LIBRARY(libjetbase.so)
31 R__LOAD_LIBRARY(libg4centrality.so)
32 R__LOAD_LIBRARY(libg4dst.so)
33 R__LOAD_LIBRARY(libJetBkgdSub.so)
34 
35 
36 
37 #endif
38 
39 
41  const char *filelisttruth = "dst_truth_jet.list",
42  const char *filelistcalo = "dst_calo_cluster.list",
43  const char *filelistglobal = "dst_global.list",
44  const char * outputfile = "output.root",
45  const double jet_parameter = 0.4
46 )
47 {
48 
49  //-----------------------------------
50  // Fun4All server initialization
51  //-----------------------------------
52 
53  // create fun4all server
55  int verbosity = 0;
56  se->Verbosity(verbosity);
58 
59  // centrality
61  cent->Verbosity(0);
62  cent->GetCalibrationParameters().ReadFromFile("centrality", "xml", 0, 0, string(getenv("CALIBRATIONROOT")) + string("/Centrality/"));
63  se->registerSubsystem( cent );
64 
65  // retower CEMC
66  RetowerCEMC *rcemc = new RetowerCEMC();
67  rcemc->Verbosity(verbosity);
68  rcemc->set_towerinfo(true);
69  se->registerSubsystem(rcemc);
70 
71 
72  //-----------------------------------
73  // Jet reco
74  //-----------------------------------
75  // Enable::HIJETS_TRUTH=false;
76  // HIJetReco();
77 
78  // tower jets
79  // create jetreco and jettruth node names
80  string rawname = "AntiKt_Tower_r0" + to_string(int(jet_parameter * 10));
81  JetReco *towerjetreco = new JetReco();
83  towerjetreco->add_input(new TowerJetInput(Jet::HCALIN_TOWERINFO));
85  towerjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, jet_parameter), rawname);
86  towerjetreco->set_algo_node("ANTIKT");
87  towerjetreco->set_input_node("TOWER");
88  towerjetreco->Verbosity(verbosity);
89  se->registerSubsystem(towerjetreco);
90 
91  // ==============
92  // Jet Bkgd Sub
93  // ==============
94  double etamin = -1.1 + jet_parameter;
95  double etamax = 1.1 - jet_parameter;
96  JetBkgdSub *myJetTree = new JetBkgdSub(jet_parameter,outputfile);
100  myJetTree->doIterative(false);
101  myJetTree->doAreaSub(true);
102  myJetTree->doMultSub(true);
103  myJetTree->doTruth(true);
104  myJetTree->setMinRecoPt(5.0); // only sets range for reco jets
105  myJetTree->setEtaRange(etamin, etamax);
106  myJetTree->setPtRange(0, 100); // only sets range for truth jets
107  myJetTree->Verbosity(verbosity);
108  se->registerSubsystem(myJetTree);
109 
110  //-----------------------------------
111  // Input managers
112  //-----------------------------------
113 
114  Fun4AllInputManager *intrue = new Fun4AllDstInputManager("DSTtruth");
115  intrue->AddListFile(filelisttruth,1);
116  se->registerInputManager(intrue);
117 
118  Fun4AllInputManager *in2 = new Fun4AllDstInputManager("DSTcalo");
119  in2->AddListFile(filelistcalo,1);
120  se->registerInputManager(in2);
121 
122  Fun4AllInputManager *in3 = new Fun4AllDstInputManager("DSTglobal");
123  in3->AddListFile(filelistglobal,1);
124  se->registerInputManager(in3);
125 
126  //-----------------------------------
127  // Run the analysis
128  //-----------------------------------
129 
130  se->run(10);
131  se->End();
132 
133  gSystem->Exit(0);
134  return 0;
135 
136 }