]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGLF/totEt/macros/runCaloEt.C
Adding lines to compile new classes
[u/mrichter/AliRoot.git] / PWGLF / totEt / macros / runCaloEt.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
8df12228 7void runCaloEt(bool submit = false, // true or false
69008885 8 const char *dataType="realPbPb", // "sim" or "real" etc.
058989e8 9 const char *pluginRunMode="test", // "test" or "full" or "terminate"
c5b9a3cd 10 const char *det = "EMCalDetail") // "PHOS" or "EMCAL" or EMCalDetail
99a6613d 11{
8df12228 12 TStopwatch timer;
13 timer.Start();
14 gSystem->Load("libTree");
15 gSystem->Load("libGeom");
16 gSystem->Load("libVMC");
17 gSystem->Load("libPhysics");
8df12228 18 gSystem->Load("libMinuit");
19
20 gSystem->AddIncludePath("-I$ALICE_ROOT/include");
21 gSystem->AddIncludePath("-I. -I$ALICE_ROOT/EMCAL -I$ALICE_ROOT/ANALYSIS");
22
23 gSystem->Load("libSTEERBase");
24 gSystem->Load("libESD");
25 gSystem->Load("libAOD");
26
27 gSystem->Load("libANALYSIS");
28 gSystem->Load("libANALYSISalice");
29 gSystem->Load("libCORRFW");
30
058989e8 31
32
8df12228 33 if (!submit) {
34 cout << "local - no submitting" << endl;
35 }
36 else {
37 cout << "submitting to grid" << endl;
38 }
39
40 gROOT->ProcessLine(".L AliAnalysisEtCuts.cxx+g");
41 gROOT->ProcessLine(".L AliAnalysisHadEtCorrections.cxx+g");
42 gROOT->ProcessLine(".L AliAnalysisEtCommon.cxx+g");
fe71c343 43 gROOT->ProcessLine(".L AliAnalysisEtSelector.cxx+g");
44 gROOT->ProcessLine(".L AliAnalysisEtSelectorPhos.cxx+g");
45 gROOT->ProcessLine(".L AliAnalysisEtSelectorEmcal.cxx+g");
c5b9a3cd 46 gROOT->ProcessLine(".L AliAnalysisEtTrackMatchCorrections.cxx+g");
47 gROOT->ProcessLine(".L AliAnalysisEtRecEffCorrection.cxx+g");
8df12228 48 gROOT->ProcessLine(".L AliAnalysisEt.cxx+g");
49 gROOT->ProcessLine(".L AliAnalysisEtMonteCarlo.cxx+g");
50 gROOT->ProcessLine(".L AliAnalysisEtMonteCarloPhos.cxx+g");
51 gROOT->ProcessLine(".L AliAnalysisEtMonteCarloEmcal.cxx+g");
52 gROOT->ProcessLine(".L AliAnalysisEtReconstructed.cxx+g");
53 gROOT->ProcessLine(".L AliAnalysisEtReconstructedPhos.cxx+g");
54 gROOT->ProcessLine(".L AliAnalysisEtReconstructedEmcal.cxx+g");
fe71c343 55 //gROOT->ProcessLine(".L AliAnalysisEtSelectionContainer.cxx+g");
56 //gROOT->ProcessLine(".L AliAnalysisEtSelectionHandler.cxx+g");
8df12228 57 gROOT->ProcessLine(".L AliAnalysisTaskTransverseEnergy.cxx+g");
fe71c343 58 gROOT->ProcessLine(".L AliAnalysisEmEtMonteCarlo.cxx+g");
59 gROOT->ProcessLine(".L AliAnalysisEmEtReconstructed.cxx+g");
8df12228 60 gROOT->ProcessLine(".L AliAnalysisTaskTotEt.cxx+g");
61
4cb06159 62
8df12228 63 char *kTreeName = "esdTree" ;
64 TChain * chain = new TChain(kTreeName,"myESDTree") ;
65
66 if(submit){
67 gSystem->Load("libNetx") ;
68 gSystem->Load("libgapiUI");
69 gSystem->Load("libRAliEn");
70 TGrid::Connect("alien://") ;
71 }
72
73 // Make the analysis manager
74 AliAnalysisManager *mgr = new AliAnalysisManager("TotEtManager");
75
76 TString detStr(det);
77 TString taskName = "TaskTotEt" + detStr;
78 TString dataStr(dataType);
79 TString dataStrName(dataType);
80 dataStrName.ReplaceAll("/",".");
81 TString outputName = "Et.ESD." + dataStrName + "." + detStr + ".root";
82 TString outputDir = "totEt" + dataStr;
83
84 cout << " taskName " << taskName
85 << " outputName " << outputName
86 << " outputDir (alien) " << outputDir << endl;
1a331f88 87 mgr->SetCommonFileName(outputName.Data());
88 AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("out1", TList::Class(), AliAnalysisManager::kOutputContainer, outputName);
8df12228 89 if (submit) {
90 gROOT->LoadMacro("CreateAlienHandlerCaloEtSim.C");
91 AliAnalysisGrid *alienHandler = CreateAlienHandlerCaloEtSim(outputDir, outputName, pluginRunMode);
92 if (!alienHandler) return;
93 mgr->SetGridHandler(alienHandler);
94 }
95
96 AliVEventHandler* esdH = new AliESDInputHandler;
97 mgr->SetInputEventHandler(esdH);
98 AliMCEventHandler* handler = new AliMCEventHandler;
99 Bool_t isMc = kTRUE;
100 Bool_t isPb = kFALSE;
101 if ( dataStr.Contains("PbPb") ) { isPb = kTRUE;}
102 if ( dataStr.Contains("sim") ) {
103 cout << " MC " << endl;
104 if ( dataStr.Contains("PbPb") ) { // a la: simPbPb/LHC10e18a
105 cout << " PbPb " << endl;
106 TString fileLocation = "/home/dsilverm/data/E_T/" + dataStr + "/dir/AliESDs.root";
107 cout << "fileLocation " << fileLocation.Data() << endl;
108 chain->Add(fileLocation.Data()); // link to local test file
99a6613d 109 }
8df12228 110 else { // pp
058989e8 111 cout<<"adding pp simulation file"<<endl;
8df12228 112 chain->Add("/data/LHC10d15/1821/AliESDs.root");
113 //chain->Add("/data/LHC10dpass2/10000126403050.70/AliESDs.root");//data
114 //chain->Add("/home/dsilverm/data/E_T/sim/LHC10d1/117222/100/AliESDs.root"); // link to local test file
13b0d3c1 115 }
8df12228 116 handler->SetReadTR(kFALSE);
117 mgr->SetMCtruthEventHandler(handler);
118 }
119 else { // real data
120 isMc = kFALSE;
058989e8 121 chain->Add("/data/LHC10dpass2/10000126403050.70/AliESDs.root");//data
122 //chain->Add("/home/dsilverm/data/E_T/data/2010/LHC10b/000117222/ESDs/pass2/10000117222021.30/AliESDs.root"); // link to local test file
8df12228 123 cout << " not MC " << endl;
124 }
125
058989e8 126
127 if(!isMc && detStr.Contains("EMC")){
128 cout<<"You are running over EMCal data and using the tender supply"<<endl;
129 gSystem->Load("libTENDER.so");
130 gSystem->Load("libTENDERSupplies.so");
131 gROOT->ProcessLine(".include $ALICE_ROOT/Tender/");
132 gSystem->AddIncludePath("-I$ALICE_ROOT/ANALYSIS ");
1a331f88 133
69008885 134 //this macro is downloaded from the EMCal tender supply twiki
135 //hopefully it will be replaced by something checked in to aliroot
136 //I have added the function from GetOCDBRecParam.C in Jiri's example to this so that we don't add gobs of macros to the code
137 //I set the defaults to the golden run for PbPb because we are focusing on the golden run, however, this should be thought through!!
138 gROOT->LoadMacro("AddTaskEMCALTenderForEtAnalysis.C");
139 cout<<"WARNING: YOU ARE USING CALIBRATION FACTORS FROM PbPb RUN 137161!!"<<endl;
140// // get reco params from grid OCDB
141// gROOT->LoadMacro("./GetOCDBRecParam.C");
142// // run num, data type pp/PbPb, from grid
143//Gets calibration factors from grid if jobs are to be submitted to the grid
144 AliEMCALRecParam* pars = GetOCDBRecParam( 137161, "PbPb", submit);
145
1a331f88 146 AliTender *tender = AddTaskEMCALTender( "EMCAL_COMPLETEV1", 0);
69008885 147 //this also likely needs modification
148 tender->SelectCollisionCandidates( AliVEvent::kMB | AliVEvent::kEMCEGA | AliVEvent::kEMC1 | AliVEvent::kEMC7 );
149 if(submit){tender->SetDefaultCDBStorage("raw://");} //uncomment if you work on grid
150 else{tender->SetDefaultCDBStorage("local://$ALICE_ROOT/OCDB");} //uncomment if you work local
151
1a331f88 152 if(submit){
153 cout<<"Setting tender to run on grid"<<endl;
154 tender->SetDefaultCDBStorage("raw://"); //uncomment if you work on grid
155 }
156 else{
157 cout<<"Setting tender to run locally"<<endl;
158 tender->SetDefaultCDBStorage("local://$ALICE_ROOT/OCDB"); //uncomment if you work local
159 }
160 // one can sellect what collision candidates to use
161 // triggered sample only: L1 = AliVEvent::kEMCEGA, AliVEvent::kEMCEJE; L0 = AliVEvent::kEMC1, AliVEvent::kEMC7
162 tender->SelectCollisionCandidates( AliVEvent::kAny );
69008885 163 tender->SetDebugLevel(2);
1a331f88 164
165 //AliAnalysisDataContainer *coutput3 = mgr->CreateContainer("histosTrgContam", TList::Class(), AliAnalysisManager::kOutputContainer,"AnalysisResults.root");
166 //mgr->ConnectOutput(tender,1,coutput3);
167 cout<<"Output container name "<<AliAnalysisManager::GetCommonFileName()<<endl;
058989e8 168 }
169
170 if(isMc) cout<<"I am a MC"<<endl;
8df12228 171 gROOT->ProcessLine(".L $ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C");
172
173 AliPhysicsSelectionTask *physicsSelectionTask = AddTaskPhysicsSelection(isMc);//isMC is true when processing monte carlo
174 if(isPb){
058989e8 175 cout<<"Adding centrality selection task"<<endl;
50f29788 176 gROOT->ProcessLine(".L $ALICE_ROOT/ANALYSIS/macros/AddTaskCentrality.C");
fe71c343 177 //gROOT->ProcessLine(".L AliCentralitySelectionTask.cxx++g");
50f29788 178 AliCentralitySelectionTask *centTask = AddTaskCentrality();
8df12228 179 }
180
058989e8 181
182
183 AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer();
184
185
186
187
188
8df12228 189 AliAnalysisTaskTotEt *task1 = new AliAnalysisTaskTotEt(taskName);
0adfc269 190 task1->SetMcData(isMc);//necessary to tell the task to basically accept all MC events.
8df12228 191 mgr->AddTask(task1);
192
8df12228 193
194 //____________________________________________//
195 mgr->ConnectInput(task1,0,cinput1);
196 mgr->ConnectOutput(task1,1,coutput1);
058989e8 197
198
8df12228 199
200 mgr->SetDebugLevel(0);
201
202 if (!mgr->InitAnalysis()) return;
203 mgr->PrintStatus();
204 if(submit){
205 mgr->StartAnalysis("grid");
206 }
207 else{
208 mgr->StartAnalysis("local",chain);
209 }
210
211 timer.Stop();
212 timer.Print();
4998bf42 213}