TENDER becomes Tender
[u/mrichter/AliRoot.git] / PWGLF / totEt / macros / runHadEt.C
CommitLineData
4998bf42 1//Create by Christine Nattrass, Rebecca Scott, Irakli Martashvili
2//University of Tennessee at Knoxville
3
4//by default this runs locally
5//With the argument true this submits jobs to the grid
6//As written this requires an xml script tag.xml in the ~/et directory on the grid to submit jobs
a8920098 7void runHadEt(bool submit = false, bool data = false, Int_t dataset = 20100, Int_t test = 1, Int_t material = 0, Bool_t altV0Scale = kFALSE, bool runCompiledVersion = kFALSE, int simflag = 0) {
4998bf42 8 TStopwatch timer;
9 timer.Start();
10 gSystem->Load("libTree.so");
11 gSystem->Load("libGeom.so");
12 gSystem->Load("libVMC.so");
2eca0e87 13 gSystem->Load("libPhysics.so");
4998bf42 14 gSystem->Load("libXMLIO.so");
15
16 gSystem->Load("libSTEERBase.so");
17 gSystem->Load("libESD.so");
18 gSystem->Load("libAOD.so");
19
20 gSystem->Load("libANALYSIS");
2eca0e87 21 gSystem->Load("libOADB.so");
4998bf42 22 gSystem->Load("libANALYSISalice");
2b29a14e 23 gSystem->Load("libPWGUDbase.so");
4998bf42 24
25 gSystem->AddIncludePath("-I$ALICE_ROOT/include");
2b29a14e 26 gSystem->AddIncludePath("-I$ALICE_ROOT/PWGUD/base");
2eca0e87 27 if(runCompiledVersion){
a8920098 28 cout<<"Using compiled version"<<endl;
2eca0e87 29 gSystem->Load("libPWGLFtotEt.so");
30 }
31 else{
a8920098 32 cout<<"Not using compiled version"<<endl;
2eca0e87 33 gROOT->ProcessLine(".L AliAnalysisEtCuts.cxx+g");
34 gROOT->ProcessLine(".L AliAnalysisHadEtCorrections.cxx+g");
35 gROOT->ProcessLine(".L AliAnalysisEtCommon.cxx+g");
36 gROOT->ProcessLine(".L AliAnalysisHadEt.cxx+g");
37 gROOT->ProcessLine(".L AliAnalysisHadEtMonteCarlo.cxx+g");
38 gROOT->ProcessLine(".L AliAnalysisHadEtReconstructed.cxx+g");
2eca0e87 39 gROOT->ProcessLine(".L AliAnalysisTaskTransverseEnergy.cxx+g");
40 gROOT->ProcessLine(".L AliAnalysisTaskHadEt.cxx+g");
41 }
4998bf42 42
43 char *kTreeName = "esdTree" ;
44 TChain * chain = new TChain(kTreeName,"myESDTree") ;
45 if(submit){
46 gSystem->Load("libNetx.so") ;
47 gSystem->Load("libgapiUI.so");
48 gSystem->Load("libRAliEn.so");
49 TGrid::Connect("alien://") ;
50 }
3d658d3b 51 bool PbPb = false;
a8920098 52 if(dataset ==20100 || dataset==2011){
3d658d3b 53 bool PbPb = true;
54 if(data){
55 chain->Add("/data/LHC10h/pass2_rev15/10000137366041.860/AliESDs.root");//Data Pb+Pb
56 chain->Add("/data/LHC10h/pass2_rev15/10000137366041.870/AliESDs.root");//Data Pb+Pb
57 chain->Add("/data/LHC10h/pass2_rev15/10000137366041.880/AliESDs.root");//Data Pb+Pb
58 chain->Add("/data/LHC10h/pass2_rev15/10000137366041.890/AliESDs.root");//Data Pb+Pb
59 chain->Add("/data/LHC10h/pass2_rev15/10000137366041.900/AliESDs.root");//Data Pb+Pb
60 }
61 else{
a8920098 62 //chain->Add("/data/LHC12d3/168464/201/AliESDs.root");//HIJING with embedded signals - works, full acceptance
63 //chain->Add("/data/LHC10h2/137161/001/AliESDs.root");//DPMJET
64 chain->Add("/data/LHC11a9a/137366/001/AliESDs.root");//AMPT
65// chain->Add("/data/LHC10h8/137161/999/AliESDs.root");//Hijing Pb+Pb
66// chain->Add("/data/LHC10h8/137161/111/AliESDs.root");//Hijing Pb+Pb
67// chain->Add("/data/LHC10h8/137161/222/AliESDs.root");//Hijing Pb+Pb
3d658d3b 68 //chain->Add("/data/LHC11a4_bis/137161/999/AliESDs.root");//Hijing Pb+Pb
69 //chain->Add("/data/LHC10h12/999/AliESDs.root");//Hijing Pb+Pb
70 }
71 }
72 else{
70292245 73 if(dataset==2013){//pPb 5 TeV
74 if(data){
75 chain->Add("/data/LHC13b/13000195483082.95/AliESDs.root");
76 }
77 else{
a8920098 78 //cout<<"Yes I am analyzing the correct file"<<endl;
79 //chain->Add("/data/LHC12c1b/111/AliESDs.root");
80 chain->Add("/data/LHC13b3/9999/AliESDs.root");
70292245 81 }
82 }
83 else{
84 if(data){
70292245 85 //chain->Add("/data/LHC10dpass2/10000126403050.70/AliESDs.root");//data
86 //chain->Add("/data/LHC11a/11000146856042.90/AliESDs.root");//data pp 2.76 TeV w/SDD pass 2
87 //chain->Add("/data/LHC11a/11000146860043.90/AliESDs.root");//data pp 2.76 TeV w/SDD pass 3
88 chain->Add("/data/LHC10c/10000120683048.90/AliESDs.root");//Data Pb+Pb
89 }
90 else{
91 cerr<<"Hello I am here 75"<<endl;
92 //chain->Add("/data/LHC10d15/1821/AliESDs.root");//simulation p+p
93 chain->Add("/data/LHC11b10a/001/AliESDs.root");
94 }
95 }
3d658d3b 96 }
4998bf42 97
98 // Make the analysis manager
99 AliAnalysisManager *mgr = new AliAnalysisManager("TotEtManager");
100 if(submit){
71d37ec1 101
102 gROOT->LoadMacro("CreateAlienHandlerHadEt.C");
f1eeb37a 103 AliAnalysisGrid *alienHandler = CreateAlienHandlerHadEt(dataset,data,test,material,altV0Scale,runCompiledVersion,simflag);//integer dataset, boolean isData, bool submit-in-test-mode, bool use alternatve V0 scaling
3d658d3b 104 if (!alienHandler) return;
105 mgr->SetGridHandler(alienHandler);
4998bf42 106 }
107
70292245 108 cerr<<"Hello I am here 91"<<endl;
4998bf42 109 AliVEventHandler* esdH = new AliESDInputHandler;
110 mgr->SetInputEventHandler(esdH);
111 AliMCEventHandler* handler = new AliMCEventHandler;
7d2d1773 112 if(!data){
113 handler->SetReadTR(kFALSE);
114 mgr->SetMCtruthEventHandler(handler);
115 }
50f29788 116
99dbeec6 117
99dbeec6 118 gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C");
d35312c9 119 AliPhysicsSelectionTask *physSelTask = AddTaskPhysicsSelection(!data);
2eca0e87 120 if(!physSelTask) { Printf("no physSelTask"); return; }
121 AliPhysicsSelection *physSel = physSelTask->GetPhysicsSelection();
d35312c9 122 //physSel->AddCollisionTriggerClass("+CINT1B-ABCE-NOPF-ALL");// #3119 #769");
f1eeb37a 123 //physSelTask->AddCollisionTriggerClass("kMB");// #3119 #769");
2eca0e87 124
70292245 125 cerr<<"Hello I am here 108"<<endl;
2eca0e87 126
99dbeec6 127 gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskCentrality.C");
50f29788 128
99dbeec6 129 AliCentralitySelectionTask *centTask;
50f29788 130
d992f900 131 if(PbPb){
99dbeec6 132 AliCentralitySelectionTask *centTask = AddTaskCentrality();
3d658d3b 133 if(!data){
99dbeec6 134 cout<<"Setting up centrality for MC"<<endl;
135 centTask->SetMCInput();
136 }
3d658d3b 137 else{
138 cout<<"Setting up centrality for data"<<endl;
139 }
d992f900 140 }
70292245 141 Int_t pass = 2;
3d658d3b 142 if(dataset==20100){//PbPb 2.76 TeV
a8920098 143 if(simflag==0){
144 if(data){gSystem->CopyFile("rootFiles/corrections/corrections.LHC11a10a_bis.PbPb.ForData.root","corrections.root",kTRUE);}
145 else{gSystem->CopyFile("rootFiles/corrections/corrections.LHC11a10a_bis.PbPb.ForSimulations.root","corrections.root",kTRUE);}
146 if(material==11){//AMPT only available for this run
147 cout<<"Running AMPT"<<endl;
148 gSystem->CopyFile("rootFiles/corrections/corrections.LHC11a10a_bis.PbPb.137366.ForData.root","corrections.root",kTRUE);
149 }
150 }
151 if(simflag==1){
152 if(data){gSystem->CopyFile("rootFiles/corrections/corrections.LHC11a10a_bis.PbPb.Run138442.ForData.root","corrections.root",kTRUE);}
153 else{gSystem->CopyFile("rootFiles/corrections/corrections.LHC11a10a_bis.PbPb.Run138442.ForSimulations.root","corrections.root",kTRUE);}
154 }
155 if(simflag==2){
156 if(data){gSystem->CopyFile("rootFiles/corrections/corrections.LHC11a10a_bis.PbPb.Run138364.ForData.root","corrections.root",kTRUE);}
157 else{gSystem->CopyFile("rootFiles/corrections/corrections.LHC11a10a_bis.PbPb.Run138364.ForSimulations.root","corrections.root",kTRUE);}
158 }
159 if(simflag==3){
160 if(data){gSystem->CopyFile("rootFiles/corrections/corrections.LHC11a10a_bis.PbPb.Run138396.ForData.root","corrections.root",kTRUE);}
161 else{gSystem->CopyFile("rootFiles/corrections/corrections.LHC11a10a_bis.PbPb.Run138396.ForSimulations.root","corrections.root",kTRUE);}
162 }
163 if(simflag==4){
164 if(data){gSystem->CopyFile("rootFiles/corrections/corrections.LHC11a10a_bis.PbPb.Run137722.ForData.root","corrections.root",kTRUE);}
165 else{gSystem->CopyFile("rootFiles/corrections/corrections.LHC11a10a_bis.PbPb.Run137722.ForSimulations.root","corrections.root",kTRUE);}
166 }
167 if(simflag==5){
168 if(data){gSystem->CopyFile("rootFiles/corrections/corrections.LHC11a10a_bis.PbPb.Run137366.ForData.root","corrections.root",kTRUE);}
169 else{gSystem->CopyFile("rootFiles/corrections/corrections.LHC11a10a_bis.PbPb.Run137366.ForSimulations.root","corrections.root",kTRUE);}
170 }
171 if(simflag==6){
172 if(data){gSystem->CopyFile("rootFiles/corrections/corrections.LHC11a10a_bis.PbPb.Run137161.ForData.root","corrections.root",kTRUE);}
173 else{gSystem->CopyFile("rootFiles/corrections/corrections.LHC11a10a_bis.PbPb.Run137161.ForSimulations.root","corrections.root",kTRUE);}
174 }
71d37ec1 175 gSystem->CopyFile("ConfigHadEtMonteCarloPbPb.C","ConfigHadEtMonteCarlo.C",kTRUE);
176 gSystem->CopyFile("ConfigHadEtReconstructedPbPb.C","ConfigHadEtReconstructed.C",kTRUE);
a8920098 177 if(data){gSystem->CopyFile("rootFiles/corrections/corrections.LHC11a10a_bis.PbPb.ForData.root","corrections.root",kTRUE);}
178 else{gSystem->CopyFile("rootFiles/corrections/corrections.LHC11a10a_bis.PbPb.ForSimulations.root","corrections.root",kTRUE);}
70292245 179 pass = 2;
71d37ec1 180 //centTask->SetPass(1);
3d658d3b 181 }
182 else{
a8920098 183 if(dataset==2011){//PbPb 2.76 TeV 2011
184 gSystem->CopyFile("ConfigHadEtMonteCarloPbPb2011.C","ConfigHadEtMonteCarlo.C",kTRUE);
185 gSystem->CopyFile("ConfigHadEtReconstructedPbPb2011.C","ConfigHadEtReconstructed.C",kTRUE);
186 if(data){gSystem->CopyFile("rootFiles/corrections/corrections.LHC13e1abc.PbPb.168464.ForData.root","corrections.root",kTRUE);}
187 else{gSystem->CopyFile("rootFiles/corrections/corrections.LHC13e1abc.PbPb.168464.ForSimulations.root","corrections.root",kTRUE);}
188 }
3d658d3b 189 if(dataset==2009){//pp 900 GeV
71d37ec1 190 gSystem->CopyFile("ConfigHadEtMonteCarlopp900GeV.C","ConfigHadEtMonteCarlo.C",kTRUE);
191 gSystem->CopyFile("ConfigHadEtReconstructedpp900GeV.C","ConfigHadEtReconstructed.C",kTRUE);
192 if(data){gSystem->CopyFile("rootFiles/corrections/corrections.LHC11b1a.pp.ForData.root","corrections.root",kTRUE);}
193 else{gSystem->CopyFile("rootFiles/corrections/corrections.LHC11b1a.pp.ForSimulations.root","corrections.root",kTRUE);}
70292245 194 pass = 3;
71d37ec1 195 }
3d658d3b 196 if(dataset==20111){//pp 2.76 TeV
2b29a14e 197 if(altV0Scale)gSystem->CopyFile("ConfigHadEtMonteCarlopp276TeVAlt.C","ConfigHadEtMonteCarlo.C",kTRUE);
198 else{gSystem->CopyFile("ConfigHadEtMonteCarlopp276TeV.C","ConfigHadEtMonteCarlo.C",kTRUE);}
71d37ec1 199 gSystem->CopyFile("ConfigHadEtReconstructedpp276TeV.C","ConfigHadEtReconstructed.C",kTRUE);
200 if(data){gSystem->CopyFile("rootFiles/corrections/corrections.LHC11b10a.pp.ForData.root","corrections.root",kTRUE);}
201 else{gSystem->CopyFile("rootFiles/corrections/corrections.LHC11b10a.pp.ForSimulations.root","corrections.root",kTRUE);}
70292245 202 pass = 4;
71d37ec1 203 }
204 if(dataset==2010){//pp 7 TeV
205 gSystem->CopyFile("ConfigHadEtMonteCarlopp7TeV.C","ConfigHadEtMonteCarlo.C",kTRUE);
206 gSystem->CopyFile("ConfigHadEtReconstructedpp7TeV.C","ConfigHadEtReconstructed.C",kTRUE);
207 if(data){gSystem->CopyFile("rootFiles/corrections/corrections.LHC10e20.pp.ForData.root","corrections.root",kTRUE);}
208 else{gSystem->CopyFile("rootFiles/corrections/corrections.LHC10e20.pp.ForSimulations.root","corrections.root",kTRUE);}
70292245 209 pass = 2;
210 }
211 if(dataset==2012){//pp 8 TeV
212 gSystem->CopyFile("ConfigHadEtMonteCarlopp8TeV.C","ConfigHadEtMonteCarlo.C",kTRUE);
213 gSystem->CopyFile("ConfigHadEtReconstructedpp8TeV.C","ConfigHadEtReconstructed.C",kTRUE);
214 if(data){gSystem->CopyFile("rootFiles/corrections/corrections.LHC12c1b.pp.ForData.root","corrections.root",kTRUE);}
215 else{gSystem->CopyFile("rootFiles/corrections/corrections.LHC12c1b.pp.ForSimulations.root","corrections.root",kTRUE);}
216 pass = 1;
217 }
218 if(dataset==2013){//pPb 5 TeV
219 gSystem->CopyFile("ConfigHadEtMonteCarlopPb5TeV.C","ConfigHadEtMonteCarlo.C",kTRUE);
220 gSystem->CopyFile("ConfigHadEtReconstructedpPb5TeV.C","ConfigHadEtReconstructed.C",kTRUE);
221 if(data){gSystem->CopyFile("rootFiles/corrections/corrections.LHC13b3.pPb.ForData.root","corrections.root",kTRUE);}
222 else{gSystem->CopyFile("rootFiles/corrections/corrections.LHC13b3.pPb.ForSimulations.root","corrections.root",kTRUE);}
223 pass = 3;
71d37ec1 224 }
3d658d3b 225 }
70292245 226
227
228 gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C");
229 cerr<<"I am adding PID response task 169"<<endl;
9a365626 230 //AliAnalysisTask *AddTaskPIDResponse(Bool_t isMC=kFALSE, Bool_t autoMCesd=kTRUE,
231// Bool_t tuneOnData=kFALSE, Int_t recoPass=2,
232// Bool_t cachePID=kFALSE, TString detResponse="",
233// Bool_t useTPCEtaCorrection = kFALSE);
70292245 234 AliAnalysisTaskPIDResponse *taskPID=AddTaskPIDResponse(!data,kTRUE,kTRUE,pass);
235 //gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDqa.C");
236 //AddTaskPIDqa();
9a365626 237
71d37ec1 238 AliAnalysisTaskHadEt *task2 = new AliAnalysisTaskHadEt("TaskHadEt",!data);//,recoFile,mcFile);
239 if(!data) task2->SetMcData();
2eca0e87 240 //Add thing here to select collision type!!
70292245 241 if(dataset==2013){//pPb 5 TeV
242 //task2->SelectCollisionCandidates(AliVEvent::kAnyINT ) ;
243 task2->SelectCollisionCandidates(AliVEvent::kINT7 ) ;
244 }
245 else{ if(dataset!=20100){task2->SelectCollisionCandidates(AliVEvent::kMB ) ;}}
246 //if(dataset!=20100){task2->SelectCollisionCandidates(AliVEvent::kMB ) ;}
71d37ec1 247 mgr->AddTask(task2);
2eca0e87 248 AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer();
71d37ec1 249 AliAnalysisDataContainer *coutput2 = mgr->CreateContainer("out2", TList::Class(), AliAnalysisManager::kOutputContainer,"Et.ESD.new.sim.root");
2eca0e87 250// mgr->ConnectInput(task2,0,cinput1);
251// mgr->ConnectOutput(task2,1,coutput2);
71d37ec1 252 mgr->ConnectInput(task2,0,cinput1);
253 mgr->ConnectOutput(task2,1,coutput2);
254
4998bf42 255 mgr->SetDebugLevel(0);
256
257 if (!mgr->InitAnalysis()) return;
258 mgr->PrintStatus();
259 if(submit){
260 mgr->StartAnalysis("grid");
261 }
262 else{
263 mgr->StartAnalysis("local",chain);
264 }
265
266 timer.Stop();
267 timer.Print();
268}