]>
Commit | Line | Data |
---|---|---|
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 | 7 | void runCaloEt(bool submit = false, // true or false |
f6e609f6 | 8 | const char *dataType="simPbPb", // "sim" or "real" etc. |
9 | const char *pluginRunMode="full", // "test" or "full" or "terminate" | |
10 | const char *det = "EMCAL") // "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 | ||
f6e609f6 | 62 | TString detStr(det); |
63 | TString dataStr(dataType); | |
64 | if ( detStr.Contains("PHOS") ) { | |
65 | gSystem->CopyFile("calocorrections.PHOS.root","calocorrections.root",kTRUE); | |
66 | if ( dataStr.Contains("sim") ) { | |
67 | gSystem->CopyFile("ConfigEtMonteCarlo.PHOS.C","ConfigEtMonteCarlo.C",kTRUE); | |
68 | } | |
69 | else{ | |
70 | gSystem->CopyFile("ConfigEtMonteCarlo.PHOS.data.C","ConfigEtMonteCarlo.C",kTRUE); | |
71 | } | |
72 | } | |
73 | else{ | |
74 | gSystem->CopyFile("calocorrections.EMCAL.root","calocorrections.root",kTRUE); | |
75 | if ( dataStr.Contains("sim") ) { | |
76 | gSystem->CopyFile("ConfigEtMonteCarlo.EMCAL.C","ConfigEtMonteCarlo.C",kTRUE); | |
77 | } | |
78 | else{ | |
79 | gSystem->CopyFile("ConfigEtMonteCarlo.EMCAL.data.C","ConfigEtMonteCarlo.C",kTRUE); | |
80 | } | |
81 | } | |
82 | ||
4cb06159 | 83 | |
8df12228 | 84 | char *kTreeName = "esdTree" ; |
85 | TChain * chain = new TChain(kTreeName,"myESDTree") ; | |
86 | ||
87 | if(submit){ | |
88 | gSystem->Load("libNetx") ; | |
89 | gSystem->Load("libgapiUI"); | |
90 | gSystem->Load("libRAliEn"); | |
91 | TGrid::Connect("alien://") ; | |
92 | } | |
93 | ||
94 | // Make the analysis manager | |
95 | AliAnalysisManager *mgr = new AliAnalysisManager("TotEtManager"); | |
96 | ||
8df12228 | 97 | TString taskName = "TaskTotEt" + detStr; |
8df12228 | 98 | TString dataStrName(dataType); |
99 | dataStrName.ReplaceAll("/","."); | |
100 | TString outputName = "Et.ESD." + dataStrName + "." + detStr + ".root"; | |
f6e609f6 | 101 | TString outputDir = "totEt" + dataStr + detStr; |
8df12228 | 102 | |
103 | cout << " taskName " << taskName | |
104 | << " outputName " << outputName | |
105 | << " outputDir (alien) " << outputDir << endl; | |
1a331f88 | 106 | mgr->SetCommonFileName(outputName.Data()); |
107 | AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("out1", TList::Class(), AliAnalysisManager::kOutputContainer, outputName); | |
8df12228 | 108 | if (submit) { |
109 | gROOT->LoadMacro("CreateAlienHandlerCaloEtSim.C"); | |
110 | AliAnalysisGrid *alienHandler = CreateAlienHandlerCaloEtSim(outputDir, outputName, pluginRunMode); | |
111 | if (!alienHandler) return; | |
112 | mgr->SetGridHandler(alienHandler); | |
113 | } | |
114 | ||
115 | AliVEventHandler* esdH = new AliESDInputHandler; | |
116 | mgr->SetInputEventHandler(esdH); | |
117 | AliMCEventHandler* handler = new AliMCEventHandler; | |
118 | Bool_t isMc = kTRUE; | |
119 | Bool_t isPb = kFALSE; | |
120 | if ( dataStr.Contains("PbPb") ) { isPb = kTRUE;} | |
121 | if ( dataStr.Contains("sim") ) { | |
122 | cout << " MC " << endl; | |
123 | if ( dataStr.Contains("PbPb") ) { // a la: simPbPb/LHC10e18a | |
124 | cout << " PbPb " << endl; | |
f6e609f6 | 125 | TString fileLocation = "/data/LHC10h8/137161/999/AliESDs.root";//"/home/dsilverm/data/E_T/" + dataStr + "/dir/AliESDs.root"; |
8df12228 | 126 | cout << "fileLocation " << fileLocation.Data() << endl; |
127 | chain->Add(fileLocation.Data()); // link to local test file | |
99a6613d | 128 | } |
8df12228 | 129 | else { // pp |
058989e8 | 130 | cout<<"adding pp simulation file"<<endl; |
8df12228 | 131 | chain->Add("/data/LHC10d15/1821/AliESDs.root"); |
132 | //chain->Add("/data/LHC10dpass2/10000126403050.70/AliESDs.root");//data | |
133 | //chain->Add("/home/dsilverm/data/E_T/sim/LHC10d1/117222/100/AliESDs.root"); // link to local test file | |
13b0d3c1 | 134 | } |
8df12228 | 135 | handler->SetReadTR(kFALSE); |
136 | mgr->SetMCtruthEventHandler(handler); | |
137 | } | |
138 | else { // real data | |
139 | isMc = kFALSE; | |
058989e8 | 140 | chain->Add("/data/LHC10dpass2/10000126403050.70/AliESDs.root");//data |
141 | //chain->Add("/home/dsilverm/data/E_T/data/2010/LHC10b/000117222/ESDs/pass2/10000117222021.30/AliESDs.root"); // link to local test file | |
8df12228 | 142 | cout << " not MC " << endl; |
143 | } | |
144 | ||
058989e8 | 145 | |
f6e609f6 | 146 | //if(!isMc && detStr.Contains("EMC")){ |
147 | if(detStr.Contains("EMC")){ | |
058989e8 | 148 | cout<<"You are running over EMCal data and using the tender supply"<<endl; |
149 | gSystem->Load("libTENDER.so"); | |
150 | gSystem->Load("libTENDERSupplies.so"); | |
151 | gROOT->ProcessLine(".include $ALICE_ROOT/Tender/"); | |
152 | gSystem->AddIncludePath("-I$ALICE_ROOT/ANALYSIS "); | |
69008885 | 153 | //this macro is downloaded from the EMCal tender supply twiki |
154 | //hopefully it will be replaced by something checked in to aliroot | |
155 | //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 | |
156 | //I set the defaults to the golden run for PbPb because we are focusing on the golden run, however, this should be thought through!! | |
157 | gROOT->LoadMacro("AddTaskEMCALTenderForEtAnalysis.C"); | |
158 | cout<<"WARNING: YOU ARE USING CALIBRATION FACTORS FROM PbPb RUN 137161!!"<<endl; | |
159 | // // get reco params from grid OCDB | |
160 | // gROOT->LoadMacro("./GetOCDBRecParam.C"); | |
161 | // // run num, data type pp/PbPb, from grid | |
162 | //Gets calibration factors from grid if jobs are to be submitted to the grid | |
f6e609f6 | 163 | // AliEMCALRecParam* pars = GetOCDBRecParam( 137161, "PbPb", submit); |
69008885 | 164 | |
1a331f88 | 165 | AliTender *tender = AddTaskEMCALTender( "EMCAL_COMPLETEV1", 0); |
69008885 | 166 | //this also likely needs modification |
f6e609f6 | 167 | // tender->SelectCollisionCandidates( AliVEvent::kMB | AliVEvent::kEMCEGA | AliVEvent::kEMC1 | AliVEvent::kEMC7 ); |
168 | // if(submit){tender->SetDefaultCDBStorage("raw://");} //uncomment if you work on grid | |
169 | // else{tender->SetDefaultCDBStorage("local://$ALICE_ROOT/OCDB");} //uncomment if you work local | |
69008885 | 170 | |
1a331f88 | 171 | if(submit){ |
172 | cout<<"Setting tender to run on grid"<<endl; | |
173 | tender->SetDefaultCDBStorage("raw://"); //uncomment if you work on grid | |
174 | } | |
175 | else{ | |
176 | cout<<"Setting tender to run locally"<<endl; | |
177 | tender->SetDefaultCDBStorage("local://$ALICE_ROOT/OCDB"); //uncomment if you work local | |
178 | } | |
179 | // one can sellect what collision candidates to use | |
180 | // triggered sample only: L1 = AliVEvent::kEMCEGA, AliVEvent::kEMCEJE; L0 = AliVEvent::kEMC1, AliVEvent::kEMC7 | |
181 | tender->SelectCollisionCandidates( AliVEvent::kAny ); | |
69008885 | 182 | tender->SetDebugLevel(2); |
1a331f88 | 183 | |
184 | //AliAnalysisDataContainer *coutput3 = mgr->CreateContainer("histosTrgContam", TList::Class(), AliAnalysisManager::kOutputContainer,"AnalysisResults.root"); | |
185 | //mgr->ConnectOutput(tender,1,coutput3); | |
186 | cout<<"Output container name "<<AliAnalysisManager::GetCommonFileName()<<endl; | |
058989e8 | 187 | } |
188 | ||
189 | if(isMc) cout<<"I am a MC"<<endl; | |
8df12228 | 190 | gROOT->ProcessLine(".L $ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C"); |
191 | ||
192 | AliPhysicsSelectionTask *physicsSelectionTask = AddTaskPhysicsSelection(isMc);//isMC is true when processing monte carlo | |
193 | if(isPb){ | |
058989e8 | 194 | cout<<"Adding centrality selection task"<<endl; |
50f29788 | 195 | gROOT->ProcessLine(".L $ALICE_ROOT/ANALYSIS/macros/AddTaskCentrality.C"); |
fe71c343 | 196 | //gROOT->ProcessLine(".L AliCentralitySelectionTask.cxx++g"); |
50f29788 | 197 | AliCentralitySelectionTask *centTask = AddTaskCentrality(); |
8df12228 | 198 | } |
199 | ||
058989e8 | 200 | |
201 | ||
202 | AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer(); | |
203 | ||
204 | ||
205 | ||
206 | ||
207 | ||
8df12228 | 208 | AliAnalysisTaskTotEt *task1 = new AliAnalysisTaskTotEt(taskName); |
0adfc269 | 209 | task1->SetMcData(isMc);//necessary to tell the task to basically accept all MC events. |
8df12228 | 210 | mgr->AddTask(task1); |
211 | ||
8df12228 | 212 | |
213 | //____________________________________________// | |
214 | mgr->ConnectInput(task1,0,cinput1); | |
215 | mgr->ConnectOutput(task1,1,coutput1); | |
058989e8 | 216 | |
217 | ||
8df12228 | 218 | |
219 | mgr->SetDebugLevel(0); | |
220 | ||
221 | if (!mgr->InitAnalysis()) return; | |
222 | mgr->PrintStatus(); | |
223 | if(submit){ | |
224 | mgr->StartAnalysis("grid"); | |
225 | } | |
226 | else{ | |
227 | mgr->StartAnalysis("local",chain); | |
228 | } | |
229 | ||
230 | timer.Stop(); | |
231 | timer.Print(); | |
4998bf42 | 232 | } |