3 // Template run macro for AliBasicTask.cxx/.h with example layout of
\r
4 // physics selections and options, in macro and task.
\r
6 // Author: Arvinder Palaha
\r
8 class AliAnalysisGrid;
\r
9 class AliAnalysisTaskBF;
\r
13 Int_t binfirst = 0; //where do we start numbering bins
\r
14 Int_t binlast = 8; //where do we stop numbering bins
\r
15 const Int_t numberOfCentralityBins = 9;
\r
16 Float_t centralityArray[numberOfCentralityBins+1] = {0.,5.,10.,20.,30.,40.,50.,60.,70.,80.}; // in centrality percentile
\r
18 //Systematic studies
\r
19 const Int_t numberOfSyst = 13;
\r
20 Float_t vZ[numberOfSyst] = {10.,12.,6.,8.,10.,10.,10.,10.,10.,10.,10.,10.,10.}; // global Vertex Z cut
\r
21 Float_t DCAxy[numberOfSyst] = {-1.,2.4,2.4,2.4,2.2,2.0,1.8,2.4,2.4,2.4,2.4,2.4,2.4}; // DCA xy cut (afterburner, -1 = w/o additional cut)
\r
22 Float_t DCAz[numberOfSyst] = {-1.,3.2,3.2,3.2,3.0,2.8,2.6,3.2,3.2,3.2,3.2,3.2,3.2}; // DCA z cut (afterburner, -1 = w/o additional cut)
\r
23 Float_t ptMin[numberOfSyst] = {0.3,0.3,0.3,0.3,0.3,0.3,0.3,1.5,5.0,0.3,0.3,0.3,0.3}; // pt cuts
\r
24 Float_t ptMax[numberOfSyst] = {5.,1.5,1.5,1.5,1.5,1.5,1.5,5.0,10.0,10.0,1.5,1.5,1.5}; // pt cuts
\r
25 Float_t etaMin[numberOfSyst] = {-0.8,-0.8,-0.8,-0.8,-0.8,-0.8,-0.8,-0.8,-0.8,-0.8,-1.0,-0.6,-0.4}; // eta cuts
\r
26 Float_t etaMax[numberOfSyst] = {0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,1.0,0.6,0.4}; // eta cuts
\r
28 Bool_t kUsePID = kFALSE;
\r
29 Bool_t kUseHBTCut = kFALSE;
\r
30 Bool_t kUseConversionCut = kFALSE;
\r
32 //______________________________________________________________________________
\r
33 void runBalanceFunctionPsi(
\r
34 const char* runtype = "local", // local, proof or grid
\r
35 const char *gridmode = "test", // Set the run mode (can be "full", "test", "offline", "submit" or "terminate"). Full & Test work for proof
\r
36 const Int_t bunchN = 0,
\r
37 const bool bAOD = 1, // 1 = AOD ANALYSIS, 0 = ESD ANALYSIS
\r
38 const bool bMCtruth = 0, // 1 = MCEvent handler is on (MC truth), 0 = MCEvent handler is off (MC reconstructed/real data)
\r
39 const bool bMCphyssel = 0, // 1 = looking at MC truth or reconstructed, 0 = looking at real data
\r
40 const Long64_t nentries = 50000, // for local and proof mode, ignored in grid mode. Set to 1234567890 for all events.
\r
41 const Long64_t firstentry = 0, // for local and proof mode, ignored in grid mode
\r
42 TString proofdataset = "bunchPROOF", // path to dataset on proof cluster, for proof analysis
\r
43 const char *proofcluster = "miweber@alice-caf.cern.ch", // which proof cluster to use in proof mode
\r
44 const char *taskname = "BF_Syst_Test" // sets name of grid generated macros
\r
48 if(runtype != "local" && runtype != "proof" && runtype != "grid") {
\r
49 Printf("\n\tIncorrect run option, check first argument of run macro");
\r
50 Printf("\tint runtype = local, proof or grid\n");
\r
53 Printf("%s analysis chosen",runtype);
\r
56 gSystem->Load("libCore.so");
\r
57 gSystem->Load("libGeom.so");
\r
58 gSystem->Load("libVMC.so");
\r
59 gSystem->Load("libPhysics.so");
\r
60 gSystem->Load("libTree.so");
\r
61 gSystem->Load("libSTEERBase.so");
\r
62 gSystem->Load("libESD.so");
\r
63 gSystem->Load("libAOD.so");
\r
64 gSystem->Load("libANALYSIS.so");
\r
65 gSystem->Load("libANALYSISalice.so");
\r
66 gSystem->Load("libEventMixing.so");
\r
67 gSystem->Load("libCORRFW.so");
\r
68 gSystem->Load("libPWGTools.so");
\r
69 gSystem->Load("libPWGCFebye.so");
\r
73 // compile standalone stuff
\r
74 //gROOT->LoadMacro("AliBalance.cxx++g");
\r
75 //gROOT->LoadMacro("AliAnalysisTaskBF.cxx++g");
\r
77 // add aliroot indlude path
\r
78 //gROOT->ProcessLine(".include $PWD/.");
\r
79 //gROOT->ProcessLine(Form(".include %s/include",gSystem->ExpandPathName("$ALICE_ROOT")));
\r
81 gROOT->SetStyle("Plain");
\r
84 AliAnalysisManager* mgr = new AliAnalysisManager(Form("%s%i",taskname,bunchN));
\r
86 // create the alien handler and attach it to the manager
\r
87 if(runtype == "grid") {
\r
88 AliAnalysisGrid *plugin = CreateAlienHandler(bAOD,bunchN,Form("%s%i",taskname,bunchN), gridmode, proofcluster, Form("%s_%d.txt",proofdataset.Data(),bunchN));
\r
89 mgr->SetGridHandler(plugin);
\r
91 else if(runtype == "local") {
\r
93 TChain* chain = 0x0;
\r
94 if((!bAOD)&&(!bMCtruth)) {
\r
95 chain = new TChain("esdTree");
\r
96 for(Int_t i = 0; i < 4; i++) {
\r
97 filename = "/data/alice2/pchrist/HeavyIons/Data/2011/Set";
\r
98 filename += i; filename += "/AliESDs.root";
\r
99 chain->Add(filename.Data());
\r
102 else if((bAOD)&&(!bMCtruth)) {
\r
103 chain = new TChain("aodTree");
\r
104 for(Int_t i = 0; i < 4; i++) {
\r
105 filename = "/project/alice/pchrist/Data/2011/Set";
\r
106 filename += i; filename += "/AliAOD.root";
\r
107 chain->Add(filename.Data());
\r
110 else if(bMCtruth) {
\r
111 chain = new TChain("TE");
\r
112 filename = "galice.root";
\r
113 chain->Add(filename.Data());
\r
117 // input handler (ESD or AOD)
\r
118 AliVEventHandler* inputH = NULL;
\r
120 inputH = new AliESDInputHandler();
\r
123 inputH = new AliAODInputHandler();
\r
125 mgr->SetInputEventHandler(inputH);
\r
127 // mc event handler
\r
129 AliMCEventHandler* mchandler = new AliMCEventHandler();
\r
130 // Not reading track references
\r
131 mchandler->SetReadTR(kFALSE);
\r
132 mgr->SetMCtruthEventHandler(mchandler);
\r
135 // AOD output handler
\r
136 //AliAODHandler* aodoutHandler = new AliAODHandler();
\r
137 //aodoutHandler->SetOutputFileName("aod.root");
\r
138 //mgr->SetOutputEventHandler(aodoutHandler);
\r
140 // === Physics Selection Task ===
\r
142 // In SelectCollisionCandidate(), default is kMB, so the task UserExec()
\r
143 // function is only called for these events.
\r
145 // kMB Minimum Bias trigger
\r
146 // kMBNoTRD Minimum bias trigger where the TRD is not read out
\r
147 // kMUON Muon trigger
\r
148 // kHighMult High-Multiplicity Trigger
\r
149 // kUserDefined For manually defined trigger selection
\r
151 // Multiple options possible with the standard AND/OR operators && and ||
\r
152 // These all have the usual offline SPD or V0 selections performed.
\r
154 // With a pointer to the physics selection object using physSelTask->GetPhysicsSelection(),
\r
155 // one can manually set the selected and background classes using:
\r
156 // AddCollisionTriggerClass("+CINT1B-ABCE-NOPF-ALL")
\r
157 // AddBGTriggerClass("+CINT1A-ABCE-NOPF-ALL");
\r
159 // One can also specify multiple classes at once, or require a class to NOT
\r
160 // trigger, for e.g.
\r
161 // AddBGTriggerClass("+CSMBA-ABCE-NOPF-ALL -CSMBB-ABCE-NOPF-ALL");
\r
163 // NOTE that manually setting the physics selection overrides the standard
\r
164 // selection, so it must be done in completeness.
\r
166 // ALTERNATIVELY, one can make the physics selection inside the task
\r
168 // For this case, comment out the task->SelectCol.... line,
\r
169 // and see AliBasicTask.cxx UserExec() function for details on this.
\r
171 //gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C");
\r
172 //AliPhysicsSelectionTask *physSelTask = AddTaskPhysicsSelection(bMCphyssel);
\r
173 //if(!physSelTask) { Printf("no physSelTask"); return; }
\r
174 //AliPhysicsSelection *physSel = physSelTask->GetPhysicsSelection();
\r
175 //physSel->AddCollisionTriggerClass("+CINT1B-ABCE-NOPF-ALL");// #3119 #769");
\r
178 //Add the centrality determination task and the physics selection
\r
179 // (only on ESD level, in AODs centrality is already in header and events are selected)
\r
181 gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskCentrality.C");
\r
182 AliCentralitySelectionTask *taskCentrality = AddTaskCentrality();
\r
184 // Add physics selection task (NOT needed for AODs)
\r
185 gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C");
\r
186 AliPhysicsSelectionTask* physSelTask = AddTaskPhysicsSelection(bMCphyssel);
\r
188 //Add the PID response
\r
190 gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C");
\r
191 AddTaskPIDResponse(bMCphyssel);
\r
195 //Add the VZERO event plane task
\r
196 gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskVZEROEPSelection.C");
\r
197 AliVZEROEPSelectionTask* epSelTask = AddTaskVZEROEPSelection();
\r
199 //Add the BF task (all centralities)
\r
200 gROOT->LoadMacro("AddTaskBalancePsiCentralityTrain.C");
\r
201 AliAnalysisTaskBFPsi *task = AddTaskBalancePsiCentralityTrain(0,100,1,"V0M",vZ[0],DCAxy[0],DCAz[0],ptMin[0],ptMax[0],etaMin[0],etaMax[0],-1,-1,kUseHBTCut,kUseConversionCut,kUsePID);
\r
203 // enable debug printouts
\r
204 //mgr->SetDebugLevel(2);
\r
205 //mgr->SetUseProgressBar(1,100);
\r
206 if (!mgr->InitAnalysis()) return;
\r
207 mgr->PrintStatus();
\r
210 Printf("Starting Analysis....");
\r
211 if(runtype == "local")
\r
212 mgr->StartAnalysis("local",chain);
\r
214 mgr->StartAnalysis(runtype,nentries,firstentry);
\r
217 //______________________________________________________________________________
\r
218 AliAnalysisGrid* CreateAlienHandler(Bool_t bAOD, Int_t bunchN, const char *taskname, const char *gridmode, const char *proofcluster, const char *proofdataset)
\r
220 AliAnalysisAlien *plugin = new AliAnalysisAlien();
\r
221 // Set the run mode (can be "full", "test", "offline", "submit" or "terminate")
\r
222 plugin->SetRunMode(gridmode);
\r
224 // Set versions of used packages
\r
225 plugin->SetAPIVersion("V1.1x");
\r
226 plugin->SetROOTVersion("v5-28-00d");
\r
227 plugin->SetAliROOTVersion("v5-02-05-AN");
\r
229 // Declare input data to be processed.
\r
231 // Method 1: Create automatically XML collections using alien 'find' command.
\r
232 // Define production directory LFN
\r
233 plugin->SetGridDataDir("/alice/data/2010/LHC10h/");
\r
234 // On real reconstructed data:
\r
235 // plugin->SetGridDataDir("/alice/data/2009/LHC09d");
\r
237 // Set data search pattern
\r
238 //plugin->SetDataPattern("*ESDs.root"); // THIS CHOOSES ALL PASSES
\r
239 // Data pattern for reconstructed data
\r
241 plugin->SetDataPattern("*ESDs/pass2/*ESDs.root"); // CHECK LATEST PASS OF DATA SET IN ALIENSH
\r
244 plugin->SetDataPattern("*ESDs/pass2/AOD049/*/AliAOD.root");
\r
247 plugin->SetRunPrefix("000"); // real data
\r
248 // ...then add run numbers to be considered
\r
249 //plugin->SetRunRange(114917,115322);
\r
252 plugin->AddRunNumber(137366);
\r
256 else if(bunchN == 1){
\r
257 plugin->AddRunNumber(139510);
\r
258 plugin->AddRunNumber(139507);
\r
259 plugin->AddRunNumber(139505);
\r
260 plugin->AddRunNumber(139503);
\r
261 plugin->AddRunNumber(139465);
\r
262 plugin->AddRunNumber(139438);
\r
263 plugin->AddRunNumber(139437);
\r
264 plugin->AddRunNumber(139360);
\r
265 plugin->AddRunNumber(139329);
\r
266 plugin->AddRunNumber(139328);
\r
270 else if(bunchN == 2){
\r
271 plugin->AddRunNumber(139314);
\r
272 plugin->AddRunNumber(139310);
\r
273 plugin->AddRunNumber(139309);
\r
274 plugin->AddRunNumber(139173);
\r
275 plugin->AddRunNumber(139107);
\r
276 plugin->AddRunNumber(139105);
\r
277 plugin->AddRunNumber(139038);
\r
278 plugin->AddRunNumber(139037);
\r
279 plugin->AddRunNumber(139036);
\r
280 plugin->AddRunNumber(139029);
\r
281 plugin->AddRunNumber(139028);
\r
282 plugin->AddRunNumber(138872);
\r
283 plugin->AddRunNumber(138871);
\r
284 plugin->AddRunNumber(138870);
\r
285 plugin->AddRunNumber(138837);
\r
286 plugin->AddRunNumber(138732);
\r
287 plugin->AddRunNumber(138730);
\r
288 plugin->AddRunNumber(138666);
\r
289 plugin->AddRunNumber(138662);
\r
290 plugin->AddRunNumber(138653);
\r
293 else if(bunchN == 3){
\r
294 plugin->AddRunNumber(138652);
\r
295 plugin->AddRunNumber(138638);
\r
296 plugin->AddRunNumber(138624);
\r
297 plugin->AddRunNumber(138621);
\r
298 plugin->AddRunNumber(138583);
\r
299 plugin->AddRunNumber(138582);
\r
300 plugin->AddRunNumber(138579);
\r
301 plugin->AddRunNumber(138578);
\r
302 plugin->AddRunNumber(138534);
\r
303 plugin->AddRunNumber(138469);
\r
306 else if(bunchN == 4){
\r
308 plugin->AddRunNumber(138442);
\r
309 plugin->AddRunNumber(138439);
\r
310 plugin->AddRunNumber(138438);
\r
311 plugin->AddRunNumber(138396);
\r
312 plugin->AddRunNumber(138364);
\r
313 plugin->AddRunNumber(138275);
\r
314 plugin->AddRunNumber(138225);
\r
315 plugin->AddRunNumber(138201);
\r
316 plugin->AddRunNumber(138197);
\r
317 plugin->AddRunNumber(138192);
\r
320 else if(bunchN == 5){
\r
322 plugin->AddRunNumber(138190);
\r
323 plugin->AddRunNumber(137848);
\r
324 plugin->AddRunNumber(137844);
\r
325 plugin->AddRunNumber(137752);
\r
326 plugin->AddRunNumber(137751);
\r
327 plugin->AddRunNumber(137724);
\r
328 plugin->AddRunNumber(137722);
\r
329 plugin->AddRunNumber(137718);
\r
330 plugin->AddRunNumber(137704);
\r
331 plugin->AddRunNumber(137693);
\r
334 else if(bunchN == 6){
\r
336 plugin->AddRunNumber(137692);
\r
337 plugin->AddRunNumber(137691);
\r
338 plugin->AddRunNumber(137686);
\r
339 plugin->AddRunNumber(137685);
\r
340 plugin->AddRunNumber(137639);
\r
341 plugin->AddRunNumber(137638);
\r
342 plugin->AddRunNumber(137608);
\r
343 plugin->AddRunNumber(137595);
\r
344 plugin->AddRunNumber(137549);
\r
345 plugin->AddRunNumber(137546);
\r
349 else if(bunchN == 7){
\r
351 plugin->AddRunNumber(137544);
\r
352 plugin->AddRunNumber(137541);
\r
353 plugin->AddRunNumber(137539);
\r
354 plugin->AddRunNumber(137531);
\r
355 plugin->AddRunNumber(137530);
\r
356 plugin->AddRunNumber(137443);
\r
357 plugin->AddRunNumber(137441);
\r
358 plugin->AddRunNumber(137440);
\r
359 plugin->AddRunNumber(137439);
\r
360 plugin->AddRunNumber(137434);
\r
364 else if(bunchN == 8){
\r
366 plugin->AddRunNumber(137432);
\r
367 plugin->AddRunNumber(137431);
\r
368 plugin->AddRunNumber(137430);
\r
369 plugin->AddRunNumber(137366);
\r
370 plugin->AddRunNumber(137243);
\r
371 plugin->AddRunNumber(137236);
\r
372 plugin->AddRunNumber(137235);
\r
373 plugin->AddRunNumber(137232);
\r
374 plugin->AddRunNumber(137231);
\r
375 plugin->AddRunNumber(137162);
\r
376 plugin->AddRunNumber(137161);
\r
381 stderr<<"BUNCH NOT THERE"<<endl;
\r
387 //plugin->AddRunList("139510, 139507, 139505, 139503, 139465, 139438, 139437, 139360, 139329, 139328, 139314, 139310, 139309, 139173, 139107, 139105, 139038, 139037, 139036, 139029, 139028, 138872, 138871, 138870, 138837, 138732, 138730, 138666, 138662, 138653, 138652, 138638, 138624, 138621, 138583, 138582, 138579, 138578, 138534, 138469, 138442, 138439, 138438, 138396, 138364, 138275, 138225, 138201, 138197, 138192, 138190, 137848, 137844, 137752, 137751, 137724, 137722, 137718, 137704, 137693, 137692, 137691, 137686, 137685, 137639, 137638, 137608, 137595, 137549, 137546, 137544, 137541, 137539, 137531, 137530, 137443, 137441, 137440, 137439, 137434, 137432, 137431, 137430, 137366, 137243, 137236, 137235, 137232, 137231, 137162, 137161");
\r
393 plugin->SetNrunsPerMaster(1);
\r
394 plugin->SetOutputToRunNo();
\r
395 // comment out the next line when using the "terminate" option, unless
\r
396 // you want separate merged files for each run
\r
397 plugin->SetMergeViaJDL();
\r
399 // Method 2: Declare existing data files (raw collections, xml collections, root file)
\r
400 // If no path mentioned data is supposed to be in the work directory (see SetGridWorkingDir())
\r
401 // XML collections added via this method can be combined with the first method if
\r
402 // the content is compatible (using or not tags)
\r
403 // plugin->AddDataFile("tag.xml");
\r
404 // plugin->AddDataFile("/alice/data/2008/LHC08c/000057657/raw/Run57657.Merged.RAW.tag.root");
\r
406 // Define alien work directory where all files will be copied. Relative to alien $HOME.
\r
407 plugin->SetGridWorkingDir(taskname);
\r
409 // Declare alien output directory. Relative to working directory.
\r
410 plugin->SetGridOutputDir("out"); // In this case will be $HOME/taskname/out
\r
412 // Declare the analysis source files names separated by blancs. To be compiled runtime
\r
413 // using ACLiC on the worker nodes.
\r
414 plugin->SetAnalysisSource("AliBalance.cxx AliAnalysisTaskBF.cxx");
\r
416 // Declare all libraries (other than the default ones for the framework. These will be
\r
417 // loaded by the generated analysis macro. Add all extra files (task .cxx/.h) here.
\r
418 //plugin->AddIncludePath("-I.");
\r
419 //plugin->SetAdditionalLibs("libPWGCFebye.so");
\r
420 plugin->SetAdditionalLibs("AliBalance.cxx AliBalance.h AliAnalysisTaskBF.cxx AliAnalysisTaskBF.h");
\r
422 // Declare the output file names separated by blancs.
\r
423 // (can be like: file.root or file.root@ALICE::Niham::File)
\r
424 // To only save certain files, use SetDefaultOutputs(kFALSE), and then
\r
425 // SetOutputFiles("list.root other.filename") to choose which files to save
\r
426 plugin->SetDefaultOutputs();
\r
427 //plugin->SetOutputFiles("list.root");
\r
429 // Optionally set a name for the generated analysis macro (default MyAnalysis.C)
\r
430 plugin->SetAnalysisMacro(Form("%s.C",taskname));
\r
432 // Optionally set maximum number of input files/subjob (default 100, put 0 to ignore)
\r
433 plugin->SetSplitMaxInputFileNumber(100);
\r
435 // Optionally modify the executable name (default analysis.sh)
\r
436 plugin->SetExecutable(Form("%s.sh",taskname));
\r
438 // set number of test files to use in "test" mode
\r
439 plugin->SetNtestFiles(1);
\r
441 // Optionally resubmit threshold.
\r
442 plugin->SetMasterResubmitThreshold(90);
\r
444 // Optionally set time to live (default 30000 sec)
\r
445 plugin->SetTTL(90000);
\r
447 // Optionally set input format (default xml-single)
\r
448 plugin->SetInputFormat("xml-single");
\r
450 // Optionally modify the name of the generated JDL (default analysis.jdl)
\r
451 plugin->SetJDLName(Form("%s.jdl",taskname));
\r
453 // Optionally modify job price (default 1)
\r
454 plugin->SetPrice(1);
\r
456 // Optionally modify split mode (default 'se')
\r
457 plugin->SetSplitMode("se");
\r
459 //plugin->SetUseSubmitPolicy();
\r
460 //plugin->SetKeepLogs();
\r
462 //----------------------------------------------------------
\r
463 //--- PROOF MODE SPECIFIC SETTINGS ------------
\r
464 //----------------------------------------------------------
\r
466 plugin->SetProofCluster(proofcluster);
\r
467 // Dataset to be used
\r
468 plugin->SetProofDataSet(proofdataset);
\r
469 // May need to reset proof. Supported modes: 0-no reset, 1-soft, 2-hard
\r
470 plugin->SetProofReset(0);
\r
471 // May limit number of workers
\r
472 plugin->SetNproofWorkers(0);
\r
473 // May limit the number of workers per slave
\r
474 plugin->SetNproofWorkersPerSlave(1);
\r
475 // May use a specific version of root installed in proof
\r
476 plugin->SetRootVersionForProof("current");
\r
477 // May set the aliroot mode. Check http://aaf.cern.ch/node/83
\r
478 plugin->SetAliRootMode("default"); // Loads AF libs by default
\r
479 // May request ClearPackages (individual ClearPackage not supported)
\r
480 plugin->SetClearPackages(kFALSE);
\r
481 // Plugin test mode works only providing a file containing test file locations, used in "local" mode also
\r
482 plugin->SetFileForTestMode("files.txt"); // file should contain path name to a local directory containg *ESDs.root etc
\r
483 // Request connection to alien upon connection to grid
\r
484 plugin->SetProofConnectGrid(kFALSE);
\r