1 //Create by Christine Nattrass, Rebecca Scott, Irakli Martashvili
2 //University of Tennessee at Knoxville
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 *dataType="realPbPb", // "sim" or "real" etc.
10 const char *pluginRunMode="test", // "test" or "full" or "terminate"
11 const char *det = "EMCal",
12 int production = 1, Bool_t withtender = kTRUE, Int_t runnum = 0, Bool_t withNonlinearity = kTRUE, Bool_t withReclusterizing = kFALSE, Int_t trackmatchcuts=0) // "PHOS" or "EMCAL" or EMCalDetail
16 gSystem->Load("libTree");
17 gSystem->Load("libGeom");
18 gSystem->Load("libVMC");
19 gSystem->Load("libPhysics");
20 gSystem->Load("libMinuit");
22 gSystem->AddIncludePath("-I$ALICE_ROOT/include");
23 gSystem->AddIncludePath("-I. -I$ALICE_ROOT/EMCAL -I$ALICE_ROOT/ANALYSIS");
25 gSystem->Load("libSTEERBase");
26 gSystem->Load("libESD");
27 gSystem->Load("libAOD");
29 gSystem->Load("libANALYSIS");
30 gSystem->Load("libANALYSISalice");
31 gSystem->Load("libCORRFW");
36 cout << "local - no submitting" << endl;
39 cout << "submitting to grid" << endl;
42 gROOT->ProcessLine(".L AliAnalysisEtCuts.cxx+g");
43 gROOT->ProcessLine(".L AliAnalysisHadEtCorrections.cxx+g");
44 gROOT->ProcessLine(".L AliAnalysisEtCommon.cxx+g");
45 gROOT->ProcessLine(".L AliAnalysisEtSelector.cxx+g");
46 gROOT->ProcessLine(".L AliAnalysisEtSelectorPhos.cxx+g");
47 gROOT->ProcessLine(".L AliAnalysisEtSelectorEmcal.cxx+g");
48 gROOT->ProcessLine(".L AliAnalysisEtTrackMatchCorrections.cxx+g");
49 gROOT->ProcessLine(".L AliAnalysisEtRecEffCorrection.cxx+g");
50 gROOT->ProcessLine(".L AliAnalysisEt.cxx+g");
51 gROOT->ProcessLine(".L AliAnalysisEtMonteCarlo.cxx+g");
52 gROOT->ProcessLine(".L AliAnalysisEtMonteCarloPhos.cxx+g");
53 gROOT->ProcessLine(".L AliAnalysisEtMonteCarloEmcal.cxx+g");
54 gROOT->ProcessLine(".L AliAnalysisEtReconstructed.cxx+g");
55 gROOT->ProcessLine(".L AliAnalysisEtReconstructedPhos.cxx+g");
56 gROOT->ProcessLine(".L AliAnalysisEtReconstructedEmcal.cxx+g");
57 //gROOT->ProcessLine(".L AliAnalysisEtSelectionContainer.cxx+g");
58 //gROOT->ProcessLine(".L AliAnalysisEtSelectionHandler.cxx+g");
59 gROOT->ProcessLine(".L AliAnalysisTaskTransverseEnergy.cxx+g");
60 gROOT->ProcessLine(".L AliAnalysisEmEtMonteCarlo.cxx+g");
61 gROOT->ProcessLine(".L AliAnalysisEmEtReconstructed.cxx+g");
62 gROOT->ProcessLine(".L AliAnalysisTaskTotEt.cxx+g");
65 TString dataStr(dataType);
66 if ( detStr.Contains("PHOS") ) {
67 gSystem->CopyFile("calocorrections.PHOS.root","calocorrections.root",kTRUE);
68 if ( dataStr.Contains("sim") ) {
69 gSystem->CopyFile("ConfigEtMonteCarlo.PHOS.C","ConfigEtMonteCarlo.C",kTRUE);
72 gSystem->CopyFile("ConfigEtMonteCarlo.PHOS.data.C","ConfigEtMonteCarlo.C",kTRUE);
76 gSystem->CopyFile("calocorrections.EMCAL.root","calocorrections.root",kTRUE);
77 if ( dataStr.Contains("sim") ) {
78 gSystem->CopyFile("ConfigEtMonteCarlo.EMCAL.C","ConfigEtMonteCarlo.C",kTRUE);
81 gSystem->CopyFile("ConfigEtMonteCarlo.EMCAL.data.C","ConfigEtMonteCarlo.C",kTRUE);
86 char *kTreeName = "esdTree" ;
87 TChain * chain = new TChain(kTreeName,"myESDTree") ;
90 gSystem->Load("libNetx") ;
91 gSystem->Load("libgapiUI");
92 gSystem->Load("libRAliEn");
93 TGrid::Connect("alien://") ;
96 // Make the analysis manager
97 AliAnalysisManager *mgr = new AliAnalysisManager("TotEtManager");
99 TString taskName = "TaskTotEt" + detStr;
100 TString dataStrName(dataType);
101 dataStrName.ReplaceAll("/",".");
102 Bool_t isPb = kFALSE;
103 if ( dataStr.Contains("PbPb") ) { isPb = kTRUE;}
106 suffix = "WithoutTender";
109 suffix = "pp"+suffix;
111 TString outputName = "Et.ESD." + dataStrName + "." + detStr + ".root";
112 TString outputDir = "totEt" + dataStr + detStr+suffix;
113 if(!withNonlinearity){
114 outputDir +="NoNonlinearity";
116 if(withReclusterizing){
117 outputDir +="WithReclusterizing";
119 if(trackmatchcuts!=0){
120 outputDir +=Form("TrackMatchCut%i",trackmatchcuts);
123 cout << " taskName " << taskName
124 << " outputName " << outputName
125 << " outputDir (alien) " << outputDir << endl;
126 mgr->SetCommonFileName(outputName.Data());
127 AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("out1", TList::Class(), AliAnalysisManager::kOutputContainer, outputName);
128 if(!isPb){ cout<<"I am not PbPb!!"<<endl;}
130 gROOT->LoadMacro("CreateAlienHandlerCaloEtSim.C");
131 AliAnalysisGrid *alienHandler = CreateAlienHandlerCaloEtSim(outputDir, outputName, pluginRunMode, production,detStr.Contains("PHOS"),!isPb,dataStr.Contains("real"),runnum);
132 if (!alienHandler) return;
133 mgr->SetGridHandler(alienHandler);
136 AliVEventHandler* esdH = new AliESDInputHandler;
137 mgr->SetInputEventHandler(esdH);
138 AliMCEventHandler* handler = new AliMCEventHandler;
140 if ( dataStr.Contains("sim") ) {
141 cout << " MC " << endl;
142 if ( dataStr.Contains("PbPb") ) { // a la: simPbPb/LHC10e18a
143 cout << " PbPb " << endl;
144 TString fileLocation = "/data/LHC10h8/137161/999/AliESDs.root";//"/home/dsilverm/data/E_T/" + dataStr + "/dir/AliESDs.root";
145 cout << "fileLocation " << fileLocation.Data() << endl;
146 // chain->Add(fileLocation.Data()); // link to local test file
147 // chain->Add("/data/tmp/3682/AliESDs.root");
148 // chain->Add("/data/tmp/2782/AliESDs.root");
149 // chain->Add("/data/LHC10h8/137161/999/AliESDs.root");//Hijing Pb+Pb
150 // chain->Add("/data/LHC10h8/137161/111/AliESDs.root");//Hijing Pb+Pb
151 // chain->Add("/data/LHC10h8/137161/222/AliESDs.root");//Hijing Pb+Pb
152 chain->Add("/data/LHC11a10a_bis/139465/001/AliESDs.root");
153 chain->Add("/data/LHC11a10a_bis/139465/002/AliESDs.root");
154 chain->Add("/data/LHC11a10a_bis/139465/003/AliESDs.root");
155 chain->Add("/data/LHC11a10a_bis/139465/004/AliESDs.root");
156 chain->Add("/data/LHC11a10a_bis/139465/006/AliESDs.root");
157 chain->Add("/data/LHC11a10a_bis/139465/007/AliESDs.root");
158 chain->Add("/data/LHC11a10a_bis/139465/008/AliESDs.root");
159 chain->Add("/data/LHC11a10a_bis/139465/009/AliESDs.root");
160 chain->Add("/data/LHC11a10a_bis/139465/010/AliESDs.root");
161 // chain->Add("/data/LHC11a10a_bis/139465/011/AliESDs.root");
162 // chain->Add("/data/LHC11a10a_bis/139465/012/AliESDs.root");
163 // chain->Add("/data/LHC11a10a_bis/139465/013/AliESDs.root");
164 // chain->Add("/data/LHC11a10a_bis/139465/014/AliESDs.root");
165 // chain->Add("/data/LHC11a10a_bis/139465/015/AliESDs.root");
166 // chain->Add("/data/LHC11a10a_bis/139465/016/AliESDs.root");
167 // chain->Add("/data/LHC11a10a_bis/139465/017/AliESDs.root");
168 // chain->Add("/data/LHC11a10a_bis/139465/018/AliESDs.root");
169 // chain->Add("/data/LHC11a10a_bis/139465/019/AliESDs.root");
170 // chain->Add("/data/LHC11a10a_bis/139465/020/AliESDs.root");
171 // chain->Add("/data/LHC11a10a_bis/139465/021/AliESDs.root");
172 // chain->Add("/data/LHC11a10a_bis/139465/022/AliESDs.root");
173 // chain->Add("/data/LHC11a10a_bis/139465/023/AliESDs.root");
174 // chain->Add("/data/LHC11a10a_bis/139465/024/AliESDs.root");
175 // chain->Add("/data/LHC11a10a_bis/139465/025/AliESDs.root");
176 // chain->Add("/data/LHC11a10a_bis/139465/026/AliESDs.root");
177 // chain->Add("/data/LHC11a10a_bis/139465/027/AliESDs.root");
178 // chain->Add("/data/LHC11a10a_bis/139465/028/AliESDs.root");
179 // chain->Add("/data/LHC11a10a_bis/139465/029/AliESDs.root");
180 // chain->Add("/data/LHC11a10a_bis/139465/030/AliESDs.root");
181 // chain->Add("/data/LHC11a10a_bis/139465/031/AliESDs.root");
182 // chain->Add("/data/LHC11a10a_bis/139465/032/AliESDs.root");
183 // chain->Add("/data/LHC11a10a_bis/139465/033/AliESDs.root");
184 // chain->Add("/data/LHC11a10a_bis/139465/034/AliESDs.root");
185 // chain->Add("/data/LHC11a10a_bis/139465/035/AliESDs.root");
186 // chain->Add("/data/LHC11a10a_bis/139465/036/AliESDs.root");
187 // chain->Add("/data/LHC11a10a_bis/139465/037/AliESDs.root");
188 // chain->Add("/data/LHC11a10a_bis/139465/038/AliESDs.root");
189 // chain->Add("/data/LHC11a10a_bis/139465/039/AliESDs.root");
190 // chain->Add("/data/LHC11a10a_bis/139465/040/AliESDs.root");
191 // chain->Add("/data/LHC11a10a_bis/139465/041/AliESDs.root");
192 // chain->Add("/data/LHC11a10a_bis/139465/042/AliESDs.root");
193 // chain->Add("/data/LHC11a10a_bis/139465/043/AliESDs.root");
194 // chain->Add("/data/LHC11a10a_bis/139465/044/AliESDs.root");
195 // chain->Add("/data/LHC11a10a_bis/139465/045/AliESDs.root");
196 // chain->Add("/data/LHC11a10a_bis/139465/046/AliESDs.root");
197 // chain->Add("/data/LHC11a10a_bis/139465/047/AliESDs.root");
198 // chain->Add("/data/LHC11a10a_bis/139465/048/AliESDs.root");
199 // chain->Add("/data/LHC11a10a_bis/139465/049/AliESDs.root");
200 // chain->Add("/data/LHC11a10a_bis/139465/050/AliESDs.root");
201 // chain->Add("/data/LHC11a10a_bis/139465/051/AliESDs.root");
202 // chain->Add("/data/LHC11a10a_bis/139465/052/AliESDs.root");
203 // chain->Add("/data/LHC11a10a_bis/139465/053/AliESDs.root");
204 // chain->Add("/data/LHC11a10a_bis/139465/054/AliESDs.root");
205 // chain->Add("/data/LHC11a10a_bis/139465/055/AliESDs.root");
206 // chain->Add("/data/LHC11a10a_bis/139465/056/AliESDs.root");
207 // chain->Add("/data/LHC11a10a_bis/139465/057/AliESDs.root");
208 // chain->Add("/data/LHC11a10a_bis/139465/058/AliESDs.root");
209 // chain->Add("/data/LHC11a10a_bis/139465/059/AliESDs.root");
210 // chain->Add("/data/LHC11a10a_bis/139465/060/AliESDs.root");
211 // chain->Add("/data/LHC11a10a_bis/139465/061/AliESDs.root");
212 // chain->Add("/data/LHC11a10a_bis/139465/062/AliESDs.root");
216 cout<<"adding pp simulation file"<<endl;
217 chain->Add("/data/LHC11b1b/999/AliESDs.root");
218 //chain->Add("/data/LHC11b1a/999/AliESDs.root");
219 //chain->Add("/data/LHC10d15/1821/AliESDs.root");
220 //chain->Add("/data/LHC10dpass2/10000126403050.70/AliESDs.root");//data
221 //chain->Add("/home/dsilverm/data/E_T/sim/LHC10d1/117222/100/AliESDs.root"); // link to local test file
223 handler->SetReadTR(kFALSE);
224 mgr->SetMCtruthEventHandler(handler);
227 cout<<"Hello there! I am data."<<endl;
230 // chain->Add("/data/tmp/10000139465010.600/AliESDs.root");
232 chain->Add("/data/LHC10h/pass2_rev15/10000137366041.860/AliESDs.root");
233 // chain->Add("/data/LHC10h/pass2_rev15/10000137366041.870/AliESDs.root");
234 // chain->Add("/data/LHC10h/pass2_rev15/10000137366041.880/AliESDs.root");
235 // chain->Add("/data/LHC10h/pass2_rev15/10000137366041.890/AliESDs.root");
236 // chain->Add("/data/LHC10h/pass2_rev15/10000137366041.900/AliESDs.root");
237 // chain->Add("/data/LHC10dpass2/10000126403050.70/AliESDs.root");//data
238 //chain->Add("/home/dsilverm/data/E_T/data/2010/LHC10b/000117222/ESDs/pass2/10000117222021.30/AliESDs.root"); // link to local test file
239 cout << " not MC " << endl;
243 //if(!isMc && detStr.Contains("EMC")){
244 if(detStr.Contains("EMC")){
246 cout<<"You are running over EMCal data and using the tender supply"<<endl;
247 gSystem->Load("libTENDER.so");
248 gSystem->Load("libTENDERSupplies.so");
249 gSystem->Load("libPWGTools.so");
250 gSystem->Load("libPWGEMCAL.so");
251 gROOT->ProcessLine(".include $ALICE_ROOT/Tender/");
252 gSystem->AddIncludePath("-I$ALICE_ROOT/ANALYSIS ");
253 //this macro is downloaded from the EMCal tender supply twiki
254 //hopefully it will be replaced by something checked in to aliroot
255 //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
256 //I set the defaults to the golden run for PbPb because we are focusing on the golden run, however, this should be thought through!!
257 //AliEMCALGeometry *geom = AliEMCALGeometry::GetInstance(geoname);
259 gROOT->LoadMacro("$ALICE_ROOT/PWG/EMCAL/macros/AddTaskEmcalSetup.C");
260 AliEmcalSetupTask *setupTask = AddTaskEmcalSetup();
261 setupTask->SetGeoPath("$ALICE_ROOT/OADB/EMCAL");
262 setupTask->SetOcdbPath("");
264 // gROOT->LoadMacro("AddTaskEMCALTenderForEtAnalysis.C");
265 // //cout<<"WARNING: YOU ARE USING CALIBRATION FACTORS FROM PbPb RUN 137161!!"<<endl;
266 // // // get reco params from grid OCDB
267 // // gROOT->LoadMacro("./GetOCDBRecParam.C");
268 // // // run num, data type pp/PbPb, from grid
269 // //Gets calibration factors from grid if jobs are to be submitted to the grid
270 // // AliEMCALRecParam* pars = GetOCDBRecParam( 137161, "PbPb", submit);
271 // //EMCAL_FIRSTYEARV1 F-
272 // //AliTender *tender = AddTaskEMCALTender( "EMCAL_COMPLETEV1", 0,withNonlinearity,withReclusterizing,trackmatchcuts);
273 // AliTender *tender = AddTaskEMCALTender( "EMCAL_FIRSTYEARV1", 0,withNonlinearity,withReclusterizing,trackmatchcuts);
274 // //this also likely needs modification
275 // // tender->SelectCollisionCandidates( AliVEvent::kMB | AliVEvent::kEMCEGA | AliVEvent::kEMC1 | AliVEvent::kEMC7 );
276 // // if(submit){tender->SetDefaultCDBStorage("raw://");} //uncomment if you work on grid
277 // // else{tender->SetDefaultCDBStorage("local://$ALICE_ROOT/OCDB");} //uncomment if you work local
280 // cout<<"Setting tender to run on grid"<<endl;
281 // tender->SetDefaultCDBStorage("raw://"); //uncomment if you work on grid
284 // cout<<"Setting tender to run locally"<<endl;
285 // tender->SetDefaultCDBStorage("local://$ALICE_ROOT/OCDB"); //uncomment if you work local
289 gROOT->LoadMacro("$ALICE_ROOT/PWG/EMCAL/macros/AddTaskEMCALTender.C");//tendertasks
290 TString runPeriod = "LHC10h";
291 Bool_t distBC = kTRUE; //distance to bad channel
292 Bool_t recalibClus = kTRUE; //recalibrate cluster energy
293 Bool_t recalcClusPos = kTRUE; //recalculate cluster position
294 Bool_t nonLinearCorr = kTRUE; //apply non-linearity
295 Bool_t remExotic = kTRUE; //remove exotic cells
296 Bool_t fidRegion = kTRUE; //apply fiducial cuts
297 Bool_t calibEnergy = kTRUE; //calibrate energy
298 Bool_t calibTime = kTRUE; //calibrate timing
299 Bool_t remBC = kTRUE; //remove bad channels
300 UInt_t nonLinFunct = AliEMCALRecoUtils::kBeamTestCorrected;
301 Bool_t reclusterize = kFALSE; //reclusterize
302 Float_t seedthresh = 0.3; //seed threshold
303 Float_t cellthresh = 0.05; //cell threshold
304 UInt_t clusterizer = AliEMCALRecParam::kClusterizerv2;
305 Bool_t trackMatch = kTRUE; //track matching
306 Bool_t updateCellOnly = kFALSE; //only change if you run your own clusterizer task
307 Float_t timeMin = 100e-9; //minimum time of physical signal in a cell/digit (s)
308 Float_t timeMax = 900e-9; //maximum time of physical signal in a cell/digit (s)
309 Float_t timeCut = 50e-9; //maximum time difference between the digits inside EMC cluster (s)
310 AliAnalysisTaskSE *tender = AddTaskEMCALTender(runPeriod.Data(), distBC, recalibClus, recalcClusPos, nonLinearCorr, remExotic,
311 fidRegion, calibEnergy, calibTime, remBC, nonLinFunct, reclusterize, seedthresh,
312 cellthresh, clusterizer, trackMatch, updateCellOnly, timeMin, timeMax, timeCut);
316 // one can sellect what collision candidates to use
317 // triggered sample only: L1 = AliVEvent::kEMCEGA, AliVEvent::kEMCEJE; L0 = AliVEvent::kEMC1, AliVEvent::kEMC7
318 tender->SelectCollisionCandidates( AliVEvent::kAny );
319 tender->SetDebugLevel(2);
321 //AliAnalysisDataContainer *coutput3 = mgr->CreateContainer("histosTrgContam", TList::Class(), AliAnalysisManager::kOutputContainer,"AnalysisResults.root");
322 //mgr->ConnectOutput(tender,1,coutput3);
323 cout<<"Output container name "<<AliAnalysisManager::GetCommonFileName()<<endl;
326 if(isMc) cout<<"I am a MC"<<endl;
327 gROOT->ProcessLine(".L $ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C");
329 AliPhysicsSelectionTask *physicsSelectionTask = AddTaskPhysicsSelection(isMc);//isMC is true when processing monte carlo
331 cout<<"Adding centrality selection task"<<endl;
332 gROOT->ProcessLine(".L $ALICE_ROOT/ANALYSIS/macros/AddTaskCentrality.C");
333 //gROOT->ProcessLine(".L AliCentralitySelectionTask.cxx++g");
334 AliCentralitySelectionTask *centTask = AddTaskCentrality();
336 cout<<"Setting up centrality for MC"<<endl;
337 centTask->SetMCInput();
340 cout<<"Setting up centrality for data"<<endl;
344 gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C");
345 //AliAnalysisTask *AddTaskPIDResponse(Bool_t isMC=kFALSE, Bool_t autoMCesd=kTRUE,
346 // Bool_t tuneOnData=kFALSE, Int_t recoPass=2,
347 // Bool_t cachePID=kFALSE, TString detResponse="",
348 // Bool_t useTPCEtaCorrection = kFALSE);
349 AliAnalysisTaskPIDResponse *taskPID=AddTaskPIDResponse(isMc,kTRUE,kTRUE,2);
350 //gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDqa.C");
353 AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer();
359 AliAnalysisTaskTotEt *task1 = new AliAnalysisTaskTotEt(taskName);
360 task1->SetMcData(isMc);//necessary to tell the task to basically accept all MC events.
361 task1->SelectCollisionCandidates(AliVEvent::kMB ) ;
365 //____________________________________________//
366 mgr->ConnectInput(task1,0,cinput1);
367 mgr->ConnectOutput(task1,1,coutput1);
371 mgr->SetDebugLevel(0);
373 if (!mgr->InitAnalysis()) return;
376 mgr->StartAnalysis("grid");
379 mgr->StartAnalysis("local",chain);