]>
Commit | Line | Data |
---|---|---|
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 | |
7 | void runCaloEt(bool submit = false, // true or false | |
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 | |
11 | { | |
12 | TStopwatch timer; | |
13 | timer.Start(); | |
14 | gSystem->Load("libTree"); | |
15 | gSystem->Load("libGeom"); | |
16 | gSystem->Load("libVMC"); | |
17 | gSystem->Load("libPhysics"); | |
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 | ||
31 | ||
32 | ||
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"); | |
43 | gROOT->ProcessLine(".L AliAnalysisEtSelector.cxx+g"); | |
44 | gROOT->ProcessLine(".L AliAnalysisEtSelectorPhos.cxx+g"); | |
45 | gROOT->ProcessLine(".L AliAnalysisEtSelectorEmcal.cxx+g"); | |
46 | gROOT->ProcessLine(".L AliAnalysisEtTrackMatchCorrections.cxx+g"); | |
47 | gROOT->ProcessLine(".L AliAnalysisEtRecEffCorrection.cxx+g"); | |
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"); | |
55 | //gROOT->ProcessLine(".L AliAnalysisEtSelectionContainer.cxx+g"); | |
56 | //gROOT->ProcessLine(".L AliAnalysisEtSelectionHandler.cxx+g"); | |
57 | gROOT->ProcessLine(".L AliAnalysisTaskTransverseEnergy.cxx+g"); | |
58 | gROOT->ProcessLine(".L AliAnalysisEmEtMonteCarlo.cxx+g"); | |
59 | gROOT->ProcessLine(".L AliAnalysisEmEtReconstructed.cxx+g"); | |
60 | gROOT->ProcessLine(".L AliAnalysisTaskTotEt.cxx+g"); | |
61 | ||
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 | ||
83 | ||
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 | ||
97 | TString taskName = "TaskTotEt" + detStr; | |
98 | TString dataStrName(dataType); | |
99 | dataStrName.ReplaceAll("/","."); | |
100 | TString outputName = "Et.ESD." + dataStrName + "." + detStr + ".root"; | |
101 | TString outputDir = "totEt" + dataStr + detStr; | |
102 | ||
103 | cout << " taskName " << taskName | |
104 | << " outputName " << outputName | |
105 | << " outputDir (alien) " << outputDir << endl; | |
106 | mgr->SetCommonFileName(outputName.Data()); | |
107 | AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("out1", TList::Class(), AliAnalysisManager::kOutputContainer, outputName); | |
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; | |
125 | TString fileLocation = "/data/LHC10h8/137161/999/AliESDs.root";//"/home/dsilverm/data/E_T/" + dataStr + "/dir/AliESDs.root"; | |
126 | cout << "fileLocation " << fileLocation.Data() << endl; | |
127 | chain->Add(fileLocation.Data()); // link to local test file | |
128 | } | |
129 | else { // pp | |
130 | cout<<"adding pp simulation file"<<endl; | |
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 | |
134 | } | |
135 | handler->SetReadTR(kFALSE); | |
136 | mgr->SetMCtruthEventHandler(handler); | |
137 | } | |
138 | else { // real data | |
139 | isMc = kFALSE; | |
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 | |
142 | cout << " not MC " << endl; | |
143 | } | |
144 | ||
145 | ||
146 | //if(!isMc && detStr.Contains("EMC")){ | |
147 | if(detStr.Contains("EMC")){ | |
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 "); | |
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 | |
163 | // AliEMCALRecParam* pars = GetOCDBRecParam( 137161, "PbPb", submit); | |
164 | ||
165 | AliTender *tender = AddTaskEMCALTender( "EMCAL_COMPLETEV1", 0); | |
166 | //this also likely needs modification | |
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 | |
170 | ||
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 ); | |
182 | tender->SetDebugLevel(2); | |
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; | |
187 | } | |
188 | ||
189 | if(isMc) cout<<"I am a MC"<<endl; | |
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){ | |
194 | cout<<"Adding centrality selection task"<<endl; | |
195 | gROOT->ProcessLine(".L $ALICE_ROOT/ANALYSIS/macros/AddTaskCentrality.C"); | |
196 | //gROOT->ProcessLine(".L AliCentralitySelectionTask.cxx++g"); | |
197 | AliCentralitySelectionTask *centTask = AddTaskCentrality(); | |
198 | } | |
199 | ||
200 | ||
201 | ||
202 | AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer(); | |
203 | ||
204 | ||
205 | ||
206 | ||
207 | ||
208 | AliAnalysisTaskTotEt *task1 = new AliAnalysisTaskTotEt(taskName); | |
209 | task1->SetMcData(isMc);//necessary to tell the task to basically accept all MC events. | |
210 | mgr->AddTask(task1); | |
211 | ||
212 | ||
213 | //____________________________________________// | |
214 | mgr->ConnectInput(task1,0,cinput1); | |
215 | mgr->ConnectOutput(task1,1,coutput1); | |
216 | ||
217 | ||
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(); | |
232 | } |