]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGGA/CaloTrackCorrelations/macros/AddTaskCaloTrackCorr.C
Merge branch 'master' of https://git.cern.ch/reps/AliRoot
[u/mrichter/AliRoot.git] / PWGGA / CaloTrackCorrelations / macros / AddTaskCaloTrackCorr.C
1
2 Bool_t  kPrint         = kFALSE;
3 Bool_t  kSimulation    = kFALSE;
4 Bool_t  kUseKinematics = kFALSE;
5 Bool_t  kOutputAOD     = kFALSE;
6 Bool_t  kEventSelection= kFALSE;
7 Bool_t  kExotic        = kTRUE;
8 Bool_t  kNonLinearity  = kFALSE;
9 Int_t   kYears         = 2011;
10 TString kCollisions    = "pp";
11 TString kTrig          = "EMC7" ;
12 TString kClusterArray  = "";
13 TString kData          = ""; // MC or deltaAOD
14 TString kInputDataType = "ESD";
15 TString kCalorimeter   = "EMCAL";
16 Bool_t  kTM            = kTRUE;
17 Bool_t  kRecalTM       = kTRUE;
18 Int_t   kMinCen        = -1;
19 Int_t   kMaxCen        = -1;
20 TString kName          = "";
21 Int_t   kDebug         = -1; 
22 Bool_t  kQA            = kFALSE;
23 Bool_t  kHadronAN      = kFALSE;
24 Bool_t  kCalibE        = kTRUE;
25 Bool_t  kCalibT        = kTRUE;
26 Bool_t  kBadMap        = kTRUE;
27 Bool_t  kTender        = kFALSE;
28 Bool_t  kMix           = kFALSE;
29 Int_t   kRunNumber     = -1;
30
31 AliAnalysisTaskCaloTrackCorrelation *AddTaskCaloTrackCorr(const TString  data          = "",
32                                                           const TString  calorimeter   = "EMCAL", 
33                                                           const Bool_t   simulation    = kFALSE,
34                                                           const Bool_t   eventsel      = kFALSE,
35                                                           const Bool_t   exotic        = kTRUE,
36                                                           const Bool_t   nonlin        = kFALSE,
37                                                           TString        outputfile    = "",
38                                                           const Int_t    year          = 2010,
39                                                           const TString  col           = "pp", 
40                                                           const TString  trigger       = "MB", 
41                                                           const TString  clustersArray = "V1",
42                                                           const Bool_t   mix           = kTRUE,
43                                                           const Bool_t   recaltm       = kTRUE,
44                                                           const Bool_t   tm            = kTRUE,
45                                                           const Int_t    minCen        = -1,
46                                                           const Int_t    maxCen        = -1,
47                                                           const Bool_t   qaan          = kFALSE,
48                                                           const Bool_t   hadronan      = kFALSE,
49                                                           const Bool_t   calibE        = kTRUE,
50                                                           const Bool_t   badmap        = kTRUE,
51                                                           const Bool_t   calibT        = kTRUE,
52                                                           const Bool_t   tender        = kFALSE,
53                                                           const Bool_t   outputAOD     = kFALSE, 
54                                                           const Bool_t   printSettings = kFALSE,
55                                                           const Double_t scaleFactor   = -1, 
56                                                           const Int_t    runNumber     = -1
57                                                           )
58 {
59   // Creates a CaloTrackCorr task, configures it and adds it to the analysis manager.
60   
61   kPrint         = printSettings;
62   kSimulation    = simulation;
63   kYears         = year;
64   kCollisions    = col;
65   kExotic        = exotic;
66   kNonLinearity  = nonlin;
67   kTrig          = trigger;
68   kClusterArray  = clustersArray;
69   kData          = data;
70   kCalorimeter   = calorimeter;
71   kOutputAOD     = outputAOD;
72   kTM            = tm;
73   kRecalTM       = recaltm;
74   kMinCen        = minCen;
75   kMaxCen        = maxCen;
76   kEventSelection= eventsel;
77   kQA            = qaan;
78   kHadronAN      = hadronan;
79   kCalibE        = calibE;
80   kCalibT        = calibT;
81   kBadMap        = badmap;
82   kTender        = tender;
83   kMix           = mix;
84   kRunNumber     = runNumber;
85   
86   // Get the pointer to the existing analysis manager via the static access method.
87   
88   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
89   if (!mgr) 
90   {
91     ::Error("AddTask", "No analysis manager to connect to.");
92     return NULL;
93   }  
94   
95   // Check the analysis type using the event handlers connected to the analysis manager.
96   
97   if (!mgr->GetInputEventHandler()) 
98   {
99     ::Error("AddTask", "This task requires an input event handler");
100     return NULL;
101   }
102
103   // Make sure the B field is enabled for track selection, some cuts need it
104   ((AliInputEventHandler*)mgr->GetInputEventHandler())->SetNeedField(kTRUE);
105   
106   kInputDataType = "AOD";
107   if(!kData.Contains("delta"))
108     kInputDataType = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
109   
110   if(kSimulation) 
111   { 
112     kUseKinematics = (mgr->GetMCtruthEventHandler())?kTRUE:kFALSE; 
113     if (!kUseKinematics && data=="AOD" && kInputDataType != "ESD") kUseKinematics = kTRUE; //AOD primary should be available ... 
114   } 
115   
116   cout<<"********* ACCESS KINE? "<<kUseKinematics<<endl;
117   
118   // Name for containers
119   
120   kName = Form("%s_Trig%s_Cl%s_TM%d",kCalorimeter.Data(), kTrig.Data(),kClusterArray.Data(),kTM);
121
122   if(kCollisions=="PbPb" && kMaxCen>=0) kName+=Form("Cen%d_%d",kMinCen,kMaxCen);
123     
124   printf("<<<< NAME: %s >>>>>\n",kName.Data());
125   
126   // #### Configure analysis ####
127     
128   AliAnaCaloTrackCorrMaker * maker = new AliAnaCaloTrackCorrMaker();
129   
130   maker->SetScaleFactor(scaleFactor); // for MC, negative (not scaled) by default
131   
132   // General frame setting and configuration
133   maker->SetReader   (ConfigureReader()   ); 
134   maker->SetCaloUtils(ConfigureCaloUtils()); 
135   
136   // Analysis tasks setting and configuration
137   Int_t n = 0;//Analysis number, order is important
138
139   // Isolation settings
140   Int_t partInCone = AliIsolationCut::kNeutralAndCharged; // kOnlyCharged;
141   Int_t thresType  = AliIsolationCut::kPtThresIC;//  AliIsolationCut::kSumPtFracIC ; 
142   Float_t cone = -1;
143   Float_t pth  = -1;
144   
145   // Photon analysis
146   
147   maker->AddAnalysis(ConfigurePhotonAnalysis(), n++); // Photon cluster selection
148
149   // Invariant mass analysis Put here to tag selected photons as decay
150   maker->AddAnalysis(ConfigurePi0EbEAnalysis("Pi0", AliAnaPi0EbE::kIMCalo), n++); // Pi0 event by event selection, invariant mass and photon tagging from decay    
151   maker->AddAnalysis(ConfigurePi0EbEAnalysis("Eta", AliAnaPi0EbE::kIMCalo), n++); // Eta event by event selection, invariant mass and photon tagging from decay
152   
153   // Photon analysis
154   maker->AddAnalysis(ConfigureIsolationAnalysis("Photon", partInCone,thresType,cone, pth), n++); // Photon isolation   
155   maker->AddAnalysis(ConfigureHadronCorrelationAnalysis("Photon",kFALSE), n++); // Gamma hadron correlation
156   maker->AddAnalysis(ConfigureHadronCorrelationAnalysis("Photon",kTRUE,partInCone,thresType, cone, pth) , n++); // Isolated gamma hadron correlation
157   //maker->AddAnalysis(ConfigureIsolationAnalysis("Photon", partInCone,thresType,kTRUE), n++); // Photon multi isolation, leave it the last   
158
159   
160   // Split cluster analysis
161   if(kCalorimeter == "EMCAL")
162   {
163     maker->AddAnalysis(ConfigurePi0EbEAnalysis("Pi0", AliAnaPi0EbE::kSSCalo), n++); // Pi0 event by event selection, cluster splitting
164     maker->AddAnalysis(ConfigureIsolationAnalysis("Pi0SS", partInCone,thresType,cone, pth), n++);       // Pi0 isolation, cluster splits
165     maker->AddAnalysis(ConfigureHadronCorrelationAnalysis("Pi0SS" ,kFALSE), n++); // Pi0 hadron correlation
166     maker->AddAnalysis(ConfigureHadronCorrelationAnalysis("Pi0SS" ,kTRUE,partInCone,thresType, cone, pth) , n++); // Isolated pi0 hadron correlation
167     //maker->AddAnalysis(ConfigureIsolationAnalysis("Pi0SS",  partInCone,thresType,kTRUE), n++); // Pi0 multi isolation, split cluster  
168     maker->AddAnalysis(ConfigureInClusterIMAnalysis(kTRUE , kTRUE ), n++);
169   }
170   
171   // Invariant mass analysis
172   maker->AddAnalysis(ConfigurePi0EbEAnalysis("Pi0SideBand", AliAnaPi0EbE::kIMCalo), n++); // Pi0 event by event selection, and photon tagging from decay    
173   maker->AddAnalysis(ConfigureIsolationAnalysis("Pi0", partInCone,thresType,cone, pth), n++);         // Pi0 isolation, invariant mass   
174   maker->AddAnalysis(ConfigureIsolationAnalysis("Pi0SideBand", partInCone,thresType,cone, pth), n++); // Pi0 isolation, side band   
175   maker->AddAnalysis(ConfigureHadronCorrelationAnalysis("Pi0"   ,kFALSE), n++); // Pi0 hadron correlation
176   maker->AddAnalysis(ConfigureHadronCorrelationAnalysis("Pi0"   ,kTRUE,partInCone,thresType, cone, pth) , n++); // Isolated pi0 hadron correlation
177   maker->AddAnalysis(ConfigureHadronCorrelationAnalysis("Pi0SideBand" ,kFALSE), n++); // Pi0 hadron correlation
178   maker->AddAnalysis(ConfigureHadronCorrelationAnalysis("Pi0SideBand" ,kTRUE,partInCone,thresType, cone, pth) , n++); // Isolated pi0 hadron correlation
179   //maker->AddAnalysis(ConfigureIsolationAnalysis("Pi0",    partInCone,thresType,kTRUE), n++); // Pi0 multi isolation, invariant mass, leave it the last   
180
181   if(kHadronAN)
182   {
183     maker->AddAnalysis(ConfigureChargedAnalysis(), n++);                                // track selection
184     maker->AddAnalysis(ConfigureIsolationAnalysis("Hadron",AliIsolationCut::kOnlyCharged,thresType,cone, pth), n++); // track isolation
185     maker->AddAnalysis(ConfigureHadronCorrelationAnalysis("Hadron",kFALSE), n++);       // track-track correlation
186     maker->AddAnalysis(ConfigureHadronCorrelationAnalysis("Hadron",kTRUE,partInCone,thresType, cone, pth) , n++);       // Isolated track-track correlation
187     //maker->AddAnalysis(ConfigureIsolationAnalysis("Hadron",partInCone,thresType,kTRUE), n++);// Hadron multi isolation  
188   }
189   
190   // Analysis with ghost triggers, only for Min Bias like events
191   if( kTrig.Contains("INT") || kTrig.Contains("Central") || kTrig.Contains("MB")  )
192   {
193     maker->AddAnalysis(ConfigureRandomTriggerAnalysis(), n++); 
194     maker->AddAnalysis(ConfigureIsolationAnalysis(Form("RandomTrigger%s",kCalorimeter.Data()), partInCone,thresType,cone, pth), n++); // Ghost trigger isolation   
195     maker->AddAnalysis(ConfigureHadronCorrelationAnalysis(Form("RandomTrigger%s",kCalorimeter.Data()),kFALSE), n++); // Ghost trigger hadron correlation
196     maker->AddAnalysis(ConfigureHadronCorrelationAnalysis(Form("RandomTrigger%s",kCalorimeter.Data()),kTRUE,partInCone,thresType, cone, pth) , n++); // Isolated ghost hadron correlation
197     //maker->AddAnalysis(ConfigureIsolationAnalysis(Form("RandomTrigger%s",kCalorimeter.Data()), partInCone,thresType,kTRUE), n++); // Ghost multi isolation   
198     
199     if(kHadronAN)
200     {
201       maker->AddAnalysis(ConfigureRandomTriggerAnalysis("CTS"), n++);                                // track selection
202       maker->AddAnalysis(ConfigureIsolationAnalysis("RandomTriggerCTS",AliIsolationCut::kOnlyCharged,thresType,cone, pth), n++); // track isolation
203       maker->AddAnalysis(ConfigureHadronCorrelationAnalysis("RandomTriggerCTS",kFALSE), n++);       // track-track correlation
204       maker->AddAnalysis(ConfigureHadronCorrelationAnalysis("RandomTriggerCTS",kTRUE,partInCone,thresType, cone, pth) , n++);       // Isolated track-track correlation
205       //maker->AddAnalysis(ConfigureIsolationAnalysis("RandomTriggerCTS",AliIsolationCut::kOnlyCharged,thresType,kTRUE), n++); // Ghost multi isolation   
206     }
207   }
208   
209   if(kQA)  maker->AddAnalysis(ConfigureQAAnalysis(),n++);
210   
211   maker->SetAnaDebug(kDebug)  ;
212   maker->SwitchOnHistogramsMaker()  ;
213   if(kData.Contains("delta")) maker->SwitchOffAODsMaker() ;
214   else                        maker->SwitchOnAODsMaker()  ;
215   
216   if(kPrint) maker->Print("");
217   
218   if(kSimulation) maker->SwitchOffDataControlHistograms();
219   
220   printf("<< End Configuration of %d analysis for calorimeter %s >>\n",n, kCalorimeter.Data());
221  
222   // Create task
223   
224   AliAnalysisTaskCaloTrackCorrelation * task = new AliAnalysisTaskCaloTrackCorrelation (Form("CaloTrackCorr%s",kName.Data()));
225   task->SetConfigFileName(""); //Don't configure the analysis via configuration file.
226   task->SetDebugLevel(kDebug);
227   task->SetBranches("ESD:AliESDRun.,AliESDHeader"); 
228   task->SetAnalysisMaker(maker);
229   mgr->AddTask(task);
230   
231   //Create containers
232   
233   if(outputfile.Length()==0) outputfile = AliAnalysisManager::GetCommonFileName(); 
234   
235   AliAnalysisDataContainer *cout_pc   = mgr->CreateContainer(kName, TList::Class(), 
236                                                              AliAnalysisManager::kOutputContainer, 
237                                                              Form("%s",outputfile.Data()));
238         
239   AliAnalysisDataContainer *cout_cuts = mgr->CreateContainer(Form("Param_%s",kName.Data()), TList::Class(), 
240                                                              AliAnalysisManager::kParamContainer, 
241                                                              "AnalysisParameters.root");
242   
243   // Create ONLY the output containers for the data produced by the task.
244   // Get and connect other common input/output containers via the manager as below
245   //==============================================================================
246   mgr->ConnectInput  (task, 0, mgr->GetCommonInputContainer());
247   // AOD output slot will be used in a different way in future
248   if(!kData.Contains("delta")   && outputAOD) mgr->ConnectOutput (task, 0, mgr->GetCommonOutputContainer());
249   mgr->ConnectOutput (task, 1, cout_pc);
250   mgr->ConnectOutput (task, 2, cout_cuts);
251   
252   if(!kMix)
253   {    
254     UInt_t mask =  SetTriggerMaskFromName();
255     task->SelectCollisionCandidates(mask);
256   } 
257   
258   return task;
259 }
260
261 //____________________________________
262 AliCaloTrackReader * ConfigureReader()
263 {
264   
265   AliCaloTrackReader * reader = 0;
266   if     (kInputDataType == "ESD"&& kData=="MC" ) 
267     reader = new AliCaloTrackMCReader();
268   else if(kInputDataType=="AOD" || kData.Contains("AOD"))   
269     reader = new AliCaloTrackAODReader();
270   else if(kInputDataType=="ESD")            
271     reader = new AliCaloTrackESDReader();
272   else 
273     printf("AliCaloTrackReader::ConfigureReader() - Data combination not known kData=%s, kInputData=%s\n",kData.Data(),kInputDataType.Data());
274   
275   reader->SetDebug(kDebug);//10 for lots of messages
276   
277   /*
278    if(kSimulation)
279    {
280      // Event rejection cuts for jet-jet simulations
281      reader->SetPtHardAndJetPtComparison(kTRUE);
282      reader->SetPtHardAndJetPtFactor(4);
283    
284      reader->SetPtHardAndClusterPtComparison(kTRUE);
285      reader->SetPtHardAndClusterPtFactor(1.5);
286    }
287    */
288   
289   //Delta AOD?
290   //reader->SetDeltaAODFileName("");
291   if(kOutputAOD) reader->SwitchOnWriteDeltaAOD()  ;
292   
293   // MC settings
294   if(kUseKinematics){
295     if(kInputDataType == "ESD"){
296       reader->SwitchOnStack();          
297       reader->SwitchOffAODMCParticles(); 
298     }
299     else if(kInputDataType == "AOD"){
300       reader->SwitchOffStack();          
301       reader->SwitchOnAODMCParticles(); 
302     }
303   }  
304   
305   //------------------------
306   // Detector input filling
307   //------------------------
308   
309   //Min cluster/track E
310   reader->SetEMCALEMin(0.3); 
311   reader->SetEMCALEMax(1000); 
312   reader->SetPHOSEMin(0.3);
313   reader->SetPHOSEMax(1000);
314   reader->SetCTSPtMin(0.2);
315   reader->SetCTSPtMax(1000);
316
317   // Time cuts
318   if(kSimulation) 
319   {
320     reader->SwitchOffUseTrackTimeCut();
321     reader->SwitchOffUseParametrizedTimeCut();
322     reader->SwitchOffUseEMCALTimeCut();
323     reader->SetEMCALTimeCut(-1e10,1e10); // Open time cut
324   }
325   else
326   {
327     if(kCalibT)
328     { 
329       printf("Set time cut parameters for run %d\n",kRunNumber);
330       reader->SwitchOnUseEMCALTimeCut();
331       reader->SwitchOnUseParametrizedTimeCut();
332       
333       //Absolute window
334       reader->SetEMCALTimeCut(-25,20);
335       
336       //Parametrization
337       if     (kRunNumber >= 151636 && kRunNumber <= 155384 )
338       {
339         printf("Set time parameters for LHC11c");
340         reader->SetEMCALParametrizedMinTimeCut(0,-5  ); reader->SetEMCALParametrizedMinTimeCut(1,-1 ); reader->SetEMCALParametrizedMinTimeCut(2, 1.87); reader->SetEMCALParametrizedMinTimeCut(3, 0.4);   
341         reader->SetEMCALParametrizedMaxTimeCut(0, 3.5); reader->SetEMCALParametrizedMaxTimeCut(1, 50); reader->SetEMCALParametrizedMaxTimeCut(2, 0.15); reader->SetEMCALParametrizedMaxTimeCut(3, 1.6);   
342       }
343       else if(kRunNumber >= 156447 && kRunNumber <= 159635 )
344       {
345         printf("Set time parameters for LHC11d");
346         reader->SetEMCALParametrizedMinTimeCut(0,-5);  reader->SetEMCALParametrizedMinTimeCut(1,-1 );  reader->SetEMCALParametrizedMinTimeCut(2, 3.5 ); reader->SetEMCALParametrizedMinTimeCut(3, 1.  );   
347         reader->SetEMCALParametrizedMaxTimeCut(0, 5);  reader->SetEMCALParametrizedMaxTimeCut(1, 50);  reader->SetEMCALParametrizedMaxTimeCut(2, 0.45); reader->SetEMCALParametrizedMaxTimeCut(3, 1.25);   
348       }
349       else
350       {
351         reader->SwitchOffUseParametrizedTimeCut();
352       }
353     }
354     else
355     {
356       reader->SwitchOffUseParametrizedTimeCut();
357       reader->SwitchOffUseEMCALTimeCut();
358       reader->SetEMCALTimeCut(-1e10,1e10); // Open time cut
359     }
360   }
361   
362   reader->SwitchOnFiducialCut();
363   reader->GetFiducialCut()->SetSimpleCTSFiducialCut(0.8, 0, 360) ;
364
365   // Tracks
366   reader->SwitchOnCTS();
367   reader->SwitchOffRejectNoTrackEvents();
368
369   reader->SwitchOffRecalculateVertexBC();
370   reader->SwitchOffVertexBCEventSelection();
371   
372   reader->SwitchOffUseTrackTimeCut();
373   reader->SetTrackTimeCut(0,50);
374   
375   reader->SwitchOffUseTrackDCACut();
376   //reader->SetTrackDCACut(0,0.0105);
377   //reader->SetTrackDCACut(1,0.035);
378   //reader->SetTrackDCACut(2,1.1);
379   
380   if(kInputDataType=="ESD")
381   {
382     gROOT->LoadMacro("$ALICE_ROOT/PWGJE/macros/CreateTrackCutsPWGJE.C");
383     //AliESDtrackCuts * esdTrackCuts = CreateTrackCutsPWGJE(10041004);
384     //reader->SetTrackCuts(esdTrackCuts);
385     //reader->SwitchOnConstrainTrackToVertex();
386     
387     if(kYears>2010)
388     {
389       //Hybrids 2011
390       AliESDtrackCuts * esdTrackCuts  = CreateTrackCutsPWGJE(10001008);
391       reader->SetTrackCuts(esdTrackCuts);
392       AliESDtrackCuts * esdTrackCuts2 = CreateTrackCutsPWGJE(10011008);
393       reader->SetTrackComplementaryCuts(esdTrackCuts2);
394     }
395     else
396     {
397       //Hybrids 2010
398       AliESDtrackCuts * esdTrackCuts  = CreateTrackCutsPWGJE(10001006);
399       reader->SetTrackCuts(esdTrackCuts);
400       AliESDtrackCuts * esdTrackCuts2 = CreateTrackCutsPWGJE(10041006);
401       reader->SetTrackComplementaryCuts(esdTrackCuts2);
402     }
403   }
404   else if(kInputDataType=="AOD")
405   {
406     //reader->SetTrackFilterMask(128);           // Filter bit, not mask, use if off hybrid
407     reader->SwitchOnAODHybridTrackSelection(); // Check that the AODs have Hybrids!!!!
408     reader->SetTrackStatus(AliVTrack::kITSrefit);
409     //reader->SwitchOnTrackHitSPDSelection();    // Check that the track has at least a hit on the SPD, not much sense to use for hybrid or TPC only tracks
410   }
411   
412   // Calorimeter
413   
414   reader->SetEMCALClusterListName(kClusterArray);
415   if(kClusterArray == "" && !kTender) 
416   {
417     printf("**************** Standard EMCAL clusters branch analysis **************** \n");
418     reader->SwitchOnClusterRecalculation();
419     // Check in ConfigureCaloUtils that the recalibration and bad map are ON 
420   }
421   else 
422   {
423     printf("**************** Input for analysis is Clusterizer %s **************** \n", kClusterArray.Data());
424     reader->SwitchOffClusterRecalculation();
425   }  
426   
427   if(!kNonLinearity) reader->SwitchOffClusterELinearityCorrection();
428   
429   //if(kCalorimeter == "EMCAL") {
430     reader->SwitchOnEMCALCells();  
431     reader->SwitchOnEMCAL();
432   //}
433   //if(kCalorimeter == "PHOS") { 
434     reader->SwitchOnPHOSCells();  
435     reader->SwitchOnPHOS();
436   //}
437   
438   // for case data="deltaAOD", no need to fill the EMCAL/PHOS cluster lists
439   if(kData.Contains("delta"))
440   {
441     reader->SwitchOffEMCAL();
442     reader->SwitchOffPHOS();
443     reader->SwitchOffEMCALCells(); 
444     reader->SwitchOffPHOSCells(); 
445   }
446   
447   //-----------------
448   // Event selection
449   //-----------------
450   
451   //reader->RejectFastClusterEvents()  ;
452
453   // Event triggered selection settings
454   reader->SwitchOnTriggerPatchMatching();
455   reader->SwitchOnBadTriggerEventsRemoval(); // only if SwitchOnTriggerPatchMatching();
456   reader->SwitchOnUnMatchedTriggerEventsRemoval(); // only if SwitchOnBadTriggerEventsRemoval();
457   //reader->SwitchOffTriggerClusterTimeRecal() ;
458
459   reader->SetTriggerPatchTimeWindow(8,9); // L0
460   if     (kRunNumber < 146861) reader->SetEventTriggerL0Threshold(3.);
461   else if(kRunNumber < 154000) reader->SetEventTriggerL0Threshold(4.);
462   else if(kRunNumber < 165000) reader->SetEventTriggerL0Threshold(5.5);
463
464   //redefine for other periods, triggers
465
466   //if(!kUseKinematics) reader->SetFiredTriggerClassName("CEMC7EGA-B-NOPF-CENTNOTRD"); // L1 Gamma
467   
468   // For mixing with AliAnaParticleHadronCorrelation switch it off
469   if(kMix)
470   {
471     reader->SwitchOffEventTriggerAtSE();
472     UInt_t mask =  SetTriggerMaskFromName();
473     reader->SetEventTriggerMask(mask); // Only for mixing and SwitchOffEventTriggerAtSE();
474     //reader->SetMixEventTriggerMask(AliVEvent::kMB); // Careful, not all productions work with kMB, try kINT7, kINT1, kAnyINT
475     reader->SetMixEventTriggerMask(AliVEvent::kAnyINT); // Careful, not all productions work with kMB, try kINT7, kINT1, kAnyINT
476     
477     printf("---Trigger selection done in AliCaloTrackReader!!!\n");
478   }
479   else
480     reader->SwitchOnEventTriggerAtSE();  
481   
482   reader->SetZvertexCut(10.);               // Open cut
483   reader->SwitchOnPrimaryVertexSelection(); // and besides primary vertex
484
485   if(kEventSelection)
486   {
487     reader->SwitchOnEventPileUpRejection(); // remove pileup by default
488     reader->SwitchOnV0ANDSelection() ;      // and besides v0 AND
489   }
490   else 
491   {
492     reader->SwitchOffPileUpEventRejection();// remove pileup by default
493     reader->SwitchOffV0ANDSelection() ;     // and besides v0 AND
494   }
495     
496   if(kCollisions=="PbPb") 
497   {
498     // Centrality
499     reader->SetCentralityClass("V0M");
500     reader->SetCentralityOpt(100);  // 10 (c= 0-10, 10-20 ...), 20  (c= 0-5, 5-10 ...) or 100 (c= 1, 2, 3 ..)
501     reader->SetCentralityBin(kMinCen,kMaxCen); // Accept all events, if not select range
502     
503     // Event plane (only used in Maker and mixing for AliAnaPi0/AliAnaHadronCorrelation for the moment)
504     reader->SetEventPlaneMethod("V0");
505   }
506   
507   if(kPrint) reader->Print("");
508   
509   return reader;
510   
511 }
512
513 //_______________________________________
514 AliCalorimeterUtils* ConfigureCaloUtils()
515 {
516   
517   AliCalorimeterUtils *cu = new AliCalorimeterUtils;
518   cu->SetDebug(kDebug);
519   
520   // Remove clusters close to borders, at least max energy cell is 1 cell away 
521   cu->SetNumberOfCellsFromEMCALBorder(1);
522   cu->SetNumberOfCellsFromPHOSBorder(2);
523   
524   // Search of local maxima in cluster
525   if(kCollisions=="pp")
526   {
527     cu->SetLocalMaximaCutE(0.1);
528     cu->SetLocalMaximaCutEDiff(0.03);
529     if(kName.Contains("150"))
530     {
531       printf("Reclusterize with 150 threshold, set PbPb settings\n");
532       cu->SetLocalMaximaCutE(0.2);
533       cu->SetLocalMaximaCutEDiff(0.03);
534     }
535   }
536   else 
537   {
538     cu->SetLocalMaximaCutE(0.2);
539     cu->SetLocalMaximaCutEDiff(0.03);
540   }
541   
542   cu->SwitchOffClusterPlot();
543
544   if(kRecalTM) cu->SwitchOnRecalculateClusterTrackMatching(); // Done in clusterization
545   else         cu->SwitchOffRecalculateClusterTrackMatching();
546   
547   cu->SwitchOnBadChannelsRemoval() ;
548   
549   //EMCAL settings
550
551   if(!kSimulation)
552     cu->SwitchOnLoadOwnEMCALGeometryMatrices();
553   
554   AliEMCALRecoUtils * recou = cu->GetEMCALRecoUtils();
555   
556   if(!kSimulation)
557   {
558     cu->SwitchOnRecalibration(); // Check the reader if it is taken into account during filtering
559     if(kClusterArray == "" && !kTender) cu->SwitchOnRunDepCorrection();
560   }
561   
562   gROOT->LoadMacro("$ALICE_ROOT/PWGGA/EMCALTasks/macros/ConfigureEMCALRecoUtils.C");
563   ConfigureEMCALRecoUtils(recou,
564                           kSimulation,                             
565                           kExotic,
566                           kTRUE,//kNonLinearity,
567                           kCalibE, 
568                           kBadMap,
569                           kCalibT);
570   //recou->SetExoticCellDiffTimeCut(50.);
571
572   
573   if( kNonLinearity ) 
574   { 
575     printf("ConfigureCaloUtils() - Apply non linearity to EMCAL\n");
576     cu->SwitchOnCorrectClusterLinearity();
577   }
578     
579   printf("ConfigureCaloUtils() - EMCAL Recalibration ON? %d %d\n",recou->IsRecalibrationOn(), cu->IsRecalibrationOn());
580   printf("ConfigureCaloUtils() - EMCAL BadMap        ON? %d %d\n",recou->IsBadChannelsRemovalSwitchedOn(), cu->IsBadChannelsRemovalSwitchedOn());
581   
582   
583   if(kCalorimeter=="PHOS")
584   {
585     if (kYears <  2014) cu->SetNumberOfSuperModulesUsed(3);
586     else                cu->SetNumberOfSuperModulesUsed(4);
587   }
588   else
589   {
590     if      (kYears == 2010) cu->SetNumberOfSuperModulesUsed(4); //EMCAL first year
591     else if (kYears <  2014) cu->SetNumberOfSuperModulesUsed(10);
592     else                     cu->SetNumberOfSuperModulesUsed(20);
593   }
594   
595   // PHOS 
596   cu->SwitchOffLoadOwnPHOSGeometryMatrices();
597     
598   if(kPrint) cu->Print("");
599   
600   return cu;
601   
602 }
603
604 //_____________________________________
605 AliAnaPhoton* ConfigurePhotonAnalysis()
606 {
607   
608   AliAnaPhoton *ana = new AliAnaPhoton();
609   ana->SetDebug(kDebug); //10 for lots of messages
610   
611   // cluster selection cuts
612   
613   ana->SwitchOffFiducialCut();
614
615   ana->SetCalorimeter(kCalorimeter);
616   
617   if(kCalorimeter == "PHOS")
618   {
619     ana->SetNCellCut(2);// At least 3 cells
620     ana->SetMinPt(0.3);
621     ana->SetMinDistanceToBadChannel(2, 4, 5);
622     ana->SetTimeCut(-1e10,1e10); // open cut
623   }
624   else 
625   {//EMCAL
626     ana->SetNCellCut(1);// At least 2 cells
627     ana->SetMinEnergy(0.3); // avoid mip peak at E = 260 MeV
628     ana->SetMaxEnergy(1000); 
629     ana->SetTimeCut(-1e10,1e10); // open cut, usual time window of [425-825] ns if time recalibration is off 
630     // restrict to less than 100 ns when time calibration is on 
631     ana->SetMinDistanceToBadChannel(2, 4, 6); 
632     
633     // NLM cut, used in all, exclude clusters with more than 2 maxima
634     // Not needed if M02 cut is already strong or clusterizer V2
635     ana->SetNLMCut(1, 2) ;
636   }
637   
638   if(kTM)
639   {
640     ana->SwitchOnTrackMatchRejection() ;
641     ana->SwitchOffTMHistoFill() ;
642   }
643   else
644   {
645     ana->SwitchOffTrackMatchRejection() ;
646     ana->SwitchOnTMHistoFill() ;
647   }
648   
649   //PID cuts (shower shape)
650   ana->SwitchOnCaloPID(); // do PID selection, unless specified in GetCaloPID, selection not based on bayesian
651   AliCaloPID* caloPID = ana->GetCaloPID();
652   //Not used in bayesian
653   
654   //EMCAL
655   caloPID->SetEMCALLambda0CutMax(0.27);
656   caloPID->SetEMCALLambda0CutMin(0.10);
657   
658   caloPID->SetEMCALDEtaCut(0.025);
659   caloPID->SetEMCALDPhiCut(0.030);
660     
661   //PHOS
662   caloPID->SetPHOSDispersionCut(2.5);
663   caloPID->SetPHOSRCut(2.);
664   if(kInputData=="AOD") caloPID->SetPHOSRCut(2000.); // Open cut since dX, dZ not stored
665       
666   ana->SwitchOffFillShowerShapeHistograms();  // Filled before photon shower shape selection
667   if(!kSimulation)ana->SwitchOnFillPileUpHistograms();
668   //if(!kSimulation) ana->SwitchOnFillEMCALBCHistograms();
669
670   // Input / output delta AOD settings
671   
672   if(!kData.Contains("delta")) 
673   {
674     ana->SetOutputAODName(Form("Photon%s",kName.Data()));
675     ana->SetOutputAODClassName("AliAODPWG4ParticleCorrelation");
676     //ana->SetOutputAODClassName("AliAODPWG4Particle"); // use if no correlation done
677   }
678   else ana->SetInputAODName(Form("Photon%s",kName.Data()));
679   
680   //Set Histograms name tag, bins and ranges
681   
682   ana->AddToHistogramsName(Form("AnaPhoton_TM%d_",kTM));
683   SetHistoRangeAndNBins(ana->GetHistogramRanges()); // see method below
684   
685   // Number of particle type MC histograms
686   ana->FillNOriginHistograms(20);
687   ana->FillNPrimaryHistograms(20);
688   
689   ana->SwitchOnRealCaloAcceptance(); // primary particle acceptance histograms
690   ConfigureMC(ana);
691   
692   if(kPrint) ana->Print("");
693   
694   return ana;
695   
696 }
697
698 //________________________________________________________________
699 AliAnaEMCALTriggerClusters* ConfigureEMCALTriggerClusterAnalysis()
700 {
701   // For filling all histograms meaninfully, in the reader, time cut must be off
702   // and bad triggered events not rejected, and of course analyze triggered events.
703   
704   AliAnaEMCALTriggerClusters *ana = new AliAnaEMCALTriggerClusters();
705   ana->SetDebug(kDebug); //10 for lots of messages
706   
707   // cluster selection cuts
708   
709   ana->SwitchOffFiducialCut();
710   ana->SetNCellCut(1);// At least 2 cells
711   ana->SetMinEnergy(0.3); // avoid mip peak at E = 260 MeV
712   ana->SetMaxEnergy(1000);
713   ana->SetM02(1, 2) ;
714   ana->SwitchOnTrackMatchRejection() ;
715   
716   ana->AddToHistogramsName("EMCTriggerClusters_");
717   SetHistoRangeAndNBins(ana->GetHistogramRanges()); // see method below
718   
719   if(kPrint) ana->Print("");
720   
721   return ana;
722   
723 }
724
725 //___________________________________________________
726 AliAnaClusterPileUp* ConfigureClusterPileUpAnalysis()
727 {
728   // For filling all histograms meaninfully, in the reader, time cut must be off
729   // and bad triggered events in different BC not rejected
730   
731   AliAnaClusterPileUp *ana = new AliAnaClusterPileUp();
732   ana->SetDebug(kDebug); //10 for lots of messages
733   
734   // cluster selection cuts
735   
736   ana->SwitchOffFiducialCut();
737   ana->SetNCellCut(1);// At least 2 cells
738   ana->SetMinEnergy(0.3); // avoid mip peak at E = 260 MeV
739   ana->SetMaxEnergy(1000);
740   
741   ana->AddToHistogramsName("ClusterPileUp_");
742   SetHistoRangeAndNBins(ana->GetHistogramRanges()); // see method below
743   
744   if(kPrint) ana->Print("");
745   
746   return ana;
747   
748 }
749
750 //________________________________________________________________________________
751 AliAnaElectron* ConfigureElectronAnalysis()
752 {
753   
754   AliAnaElectron *ana = new AliAnaElectron();
755   ana->SetDebug(kDebug); //10 for lots of messages
756     
757   if(kCalorimeter == "PHOS")
758   {
759     ana->SetNCellCut(2);// At least 2 cells
760     ana->SetMinPt(0.3);
761     ana->SetMinDistanceToBadChannel(2, 4, 5);
762   }
763   else 
764   {//EMCAL
765     ana->SetNCellCut(1);// At least 2 cells
766     ana->SetMinPt(0.5); // no effect minium EMCAL cut.
767     ana->SetMaxPt(100); 
768     //ana->SetTimeCut(400,900);// Time window of [400-900] ns
769     ana->SetMinDistanceToBadChannel(2, 4, 6);
770   }
771   
772   //Electron selection cuts with tracks
773   ana->SetEOverP(0.85, 1.2);
774
775   // TO DO, find a more suitable way to set this
776   if     (kRunNumber < 146861) ana->SetdEdxCut(72, 90);
777   else if(kRunNumber < 154000) ana->SetdEdxCut(54, 70);
778   else                         ana->SetdEdxCut(74, 90);
779   
780   if(kSimulation)  ana->SetdEdxCut(80, 100);
781   
782   ana->SetCalorimeter(kCalorimeter);
783   
784   ana->SwitchOnCaloPID();
785   
786   AliCaloPID* caloPID = ana->GetCaloPID();
787   
788   caloPID->SetEMCALLambda0CutMax(0.27);
789   caloPID->SetEMCALLambda0CutMin(0.10);
790
791   ana->SwitchOffFillShowerShapeHistograms();  
792   ana->SwitchOffFillWeightHistograms()  ;
793   ana->SwitchOffFiducialCut();
794   
795   //ana->FillAODWithHadrons();
796   
797   if(!kData.Contains("delta")) 
798   {
799     ana->SetOutputAODName(Form("Electron%s",kName.Data()));
800     ana->SetOutputAODClassName("AliAODPWG4ParticleCorrelation");
801   }
802   else ana->SetInputAODName(Form("Electron%s",kName.Data()));
803   
804   //Set Histograms name tag, bins and ranges
805   
806   ana->AddToHistogramsName(Form("AnaElectron_TM%d_",kTM));
807   SetHistoRangeAndNBins(ana->GetHistogramRanges()); // see method below
808   
809   ConfigureMC(ana);
810   
811   if(kPrint) ana->Print("");
812   
813   return ana ;
814   
815 }
816
817 //__________________________________________________________________________________________
818 AliAnaRandomTrigger* ConfigureRandomTriggerAnalysis(TString detector = "")
819 {
820   
821   AliAnaRandomTrigger *ana = new AliAnaRandomTrigger();
822   ana->SetDebug(kDebug); //10 for lots of messages
823   
824   if(detector=="") detector = kCalorimeter;
825   ana->SetDetector(detector);
826
827   // selection cuts
828   ana->SetMinPt(4.); 
829   ana->SetMaxPt(51.);   
830   
831   if     (detector=="EMCAL")
832   {
833     ana->SetEtaCut(-0.71,0.71);
834     ana->SetPhiCut(100*TMath::DegToRad(), 160*TMath::DegToRad());
835   }
836   else if(detector=="PHOS")
837   {
838     ana->SetEtaCut(-0.13,0.13);
839     ana->SetPhiCut(260*TMath::DegToRad(), 320*TMath::DegToRad());
840   }
841   else if(detector=="CTS")
842   {
843     ana->SetEtaCut(-0.9,0.9);
844     ana->SetPhiCut(0, TMath::TwoPi());
845   }
846   
847   // AOD branch
848   if(!kData.Contains("delta")) 
849   {
850     ana->SetOutputAODName(Form("RandomTrigger%s%s",detector.Data(),kName.Data()));
851     ana->SetOutputAODClassName("AliAODPWG4ParticleCorrelation");
852   }
853   else 
854     ana->SetInputAODName(Form("RandomTrigger%s%s",detector.Data(),kName.Data()));
855   
856   printf("Set RandomTrigger%s%s\n",detector.Data(),kName.Data());
857   
858   //Set Histograms name tag, bins and ranges
859   
860   ana->AddToHistogramsName(Form("AnaRandomTrigger%s_",detector.Data()));
861   
862   SetHistoRangeAndNBins(ana->GetHistogramRanges()); // see method below
863   
864   if(detector=="CTS")
865   {
866     ana->GetHistogramRanges()->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 200) ;
867     ana->GetHistogramRanges()->SetHistoEtaRangeAndNBins(-1.5, 1.5, 300) ;
868   }
869   
870   if(kPrint) ana->Print("");
871   
872   return ana;
873   
874 }
875
876 //__________________________________________________________________________________________
877 AliAnaInsideClusterInvariantMass* ConfigureInClusterIMAnalysis(Bool_t useSS = kTRUE, Bool_t useAsy = kFALSE)
878 {
879   AliAnaInsideClusterInvariantMass *ana = new AliAnaInsideClusterInvariantMass();
880   ana->SetDebug(kDebug); //10 for lots of messages
881   
882   // selection cuts
883   
884   ana->SetMinEnergy(6);
885   ana->SetMaxEnergy(200.);
886   ana->SetMinNCells(6); // check same as in calopid
887   
888   ana->SetCalorimeter(kCalorimeter);
889   ana->SwitchOnSplitClusterDistToBad();
890   
891   ana->SwitchOffFillSSWeightHistograms() ;
892   ana->SetNWeightForShowerShape(0);
893   //ana->SetWeightForShowerShape(0, 4.6);
894   
895   ana->SwitchOnFillNCellHistograms();
896   ana->SwitchOffFillEbinHistograms();
897   if(!useSS && !useAsy) ana->SwitchOnFillEbinHistograms();
898   
899   if(!kTM)
900   {
901     ana->SwitchOnFillTMHistograms();
902     ana->SwitchOnFillTMResidualHistograms();
903   }
904   else
905   {
906     ana->SwitchOffFillTMHistograms();
907     ana->SwitchOffFillTMResidualHistograms();
908   }
909   
910   //printf("Set correction slope for SS weight \n");
911   //ana->SetWCorrectionParameter(0.07);
912   //ana->SetNECellCutForShowerShape(0);
913   //ana->SetECellCutForShowerShape(0, 0.07);
914   //ana->SetECellCutForShowerShape(1, 0.1);
915   //ana->SetECellCutForShowerShape(2, 0.2);
916   
917   if(kSimulation)
918   {
919     ana->SwitchOnFillMCPrimaryHistograms() ;
920     ana->SwitchOffFillMCOverlapHistograms() ; // Off when possible
921     if(!useSS && !useAsy) ana->SwitchOnFillMCOverlapHistograms() ;
922   }
923   
924   AliCaloPID* caloPID = ana->GetCaloPID();
925   caloPID->SetEMCALDEtaCut(0.025);
926   caloPID->SetEMCALDPhiCut(0.030);
927   caloPID->SetClusterSplittingM02Cut(0,100000); // use parametrized cut, not fixed
928   
929   caloPID->SetPi0MassRange(0.11, 0.18);
930   caloPID->SetEtaMassRange(0.40, 0.60);
931   caloPID->SetPhotonMassRange(0.00, 0.08);
932   
933   caloPID->SetSplitWidthSigma(3.); // cut at 3 sigma of the mean pi0 peak.
934   
935   caloPID->SetClusterSplittingMinNCells(6);
936   
937   if(kCollisions=="PbPb" || kName.Contains("150"))
938   {
939     caloPID->SetClusterSplittingMinNCells(4);
940     ana->SetMinNCells(4);
941     caloPID->SetPi0MassShiftHighECell(0.005);
942     if(kCollisions=="PbPb") ana->SwitchOnFillHighMultHistograms();
943   }
944   
945   ana->AddToHistogramsName("AnaInClusterIM_");
946   
947   if(useAsy)
948   {
949     caloPID->SwitchOnSplitAsymmetryCut() ;
950   }
951   else
952   {
953     printf("InClusterIM: Do not apply Asy cut on merged pi0 in cluster analysis \n");
954     caloPID->SwitchOffSplitAsymmetryCut() ;
955     ana->AddToHistogramsName("AnaInClusterIM_OpenAsy_");
956   }
957   
958   if(!useSS)
959   {
960     printf("InClusterIM: Do not apply SS cut on merged pi0 in cluster analysis \n");
961     caloPID->SwitchOffSplitShowerShapeCut() ;
962     ana->AddToHistogramsName("AnaInClusterIM_OpenSS_");
963   }
964   else  caloPID->SwitchOnSplitShowerShapeCut() ;
965   
966   if(!useAsy && !useSS)
967   {
968     printf("InClusterIM: Do not apply SS and Asy cut on merged pi0 in cluster analysis \n");
969     ana->AddToHistogramsName("AnaInClusterIM_OpenSS_OpenAsy_");
970   }
971   
972   SetHistoRangeAndNBins(ana->GetHistogramRanges()); // see method below
973   
974   ConfigureMC(ana);
975   
976   if(kPrint) ana->Print("");
977   
978   return ana;
979   
980 }
981
982 //_______________________________________________
983 AliAnaChargedParticles* ConfigureChargedAnalysis()
984 {
985   
986   AliAnaChargedParticles *ana = new AliAnaChargedParticles();
987   ana->SetDebug(kDebug); //10 for lots of messages
988   
989   // selection cuts
990   
991   ana->SetMinPt(0.5);
992   ana->SwitchOnFiducialCut();
993   ana->GetFiducialCut()->SetSimpleCTSFiducialCut(0.8, 0, 360) ; //more restrictive cut in reader and after in isolation
994   
995   ana->SwitchOnFillVertexBC0Histograms() ;
996   if(!kSimulation) ana->SwitchOnFillPileUpHistograms();
997   
998   // Input / output delta AOD settings
999   
1000   if(!kData.Contains("delta"))
1001   {
1002     ana->SetOutputAODName(Form("Hadron%s",kName.Data()));
1003     ana->SetOutputAODClassName("AliAODPWG4ParticleCorrelation");
1004     //ana->SetOutputAODClassName("AliAODPWG4Particle"); // use if no correlation done
1005   }
1006   else
1007     ana->SetInputAODName(Form("Hadron%s",kName.Data()));
1008   printf("Set Hadron%s\n",kName.Data());
1009   
1010   //Set Histograms name tag, bins and ranges
1011   
1012   ana->AddToHistogramsName("AnaHadrons_");
1013   SetHistoRangeAndNBins(ana->GetHistogramRanges()); // see method below
1014   
1015   ana->GetHistogramRanges()->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 200) ;
1016   ana->GetHistogramRanges()->SetHistoEtaRangeAndNBins(-1.5, 1.5, 300) ;
1017   
1018   ConfigureMC(ana);
1019   
1020   if(kPrint) ana->Print("");
1021   
1022   return ana;
1023   
1024 }
1025
1026
1027 //_____________________________________________________
1028 AliAnaPi0EbE* ConfigurePi0EbEAnalysis(TString particle,
1029                                       Int_t analysis, Bool_t useSS = kTRUE, Bool_t useAsy = kTRUE)
1030 {
1031   
1032   AliAnaPi0EbE *ana = new AliAnaPi0EbE();
1033   ana->SetDebug(kDebug);//10 for lots of messages
1034   
1035   ana->SetAnalysisType(analysis);
1036   TString opt = "";
1037   if(analysis==AliAnaPi0EbE::kIMCaloTracks) opt = "Conv";
1038   if(analysis==AliAnaPi0EbE::kSSCalo)       opt = "SS";
1039   
1040   if(kCollisions=="pp") ana->SetMinPt(0.5);
1041   else                  ana->SetMinPt(1.0);
1042   
1043   if(kCalorimeter=="EMCAL" && !kSimulation) ana->SetPairTimeCut(100);
1044   
1045   ana->SetMinDistanceToBadChannel(2, 4, 6);
1046   ana->SwitchOnSplitClusterDistToBad();
1047
1048   ana->SwitchOnSelectedClusterHistoFill();
1049
1050   ana->SetCalorimeter(kCalorimeter);
1051   ana->SetTimeCut(-1e10,1e10); // Open time cut
1052   
1053   // Input / output delta AOD settings
1054   
1055   ana->SetInputAODName(Form("Photon%s",kName.Data()));
1056   if(!kInputDataType.Contains("delta"))
1057   {
1058     ana->SetOutputAODName(Form("%s%s%s",particle.Data(), opt.Data(), kName.Data()));
1059     ana->SetOutputAODClassName("AliAODPWG4ParticleCorrelation");
1060     
1061   }
1062   else
1063     ana->SetInputAODName(Form("%s%s%s",particle.Data(),opt.Data(),kName.Data()));
1064   
1065   
1066   if(analysis == AliAnaPi0EbE::kIMCaloTracks) ana->SetInputAODGammaConvName("PhotonsCTS");
1067   
1068   //Set Histograms name tag, bins and ranges
1069   
1070   ana->AddToHistogramsName(Form("Ana%s%sEbE_TM%d_",particle.Data(),opt.Data(),kTM));
1071   
1072   if(analysis!=AliAnaPi0EbE::kSSCalo)
1073   {
1074     AliNeutralMesonSelection *nms = ana->GetNeutralMesonSelection();
1075     nms->SetParticle(particle);
1076     
1077     // Tighten a bit mass cut with respect to default window
1078     if(particle=="Pi0") nms->SetInvMassCutRange(0.120,0.150);
1079     if(particle=="Eta") nms->SetInvMassCutRange(0.520,0.580);
1080     
1081     //if(!particle.Contains("SideBand")) nms->SwitchOnAngleSelection();
1082     //else nms->SwitchOnAngleSelection();
1083     
1084     nms->SwitchOffAngleSelection();
1085     if(particle.Contains("Pi0SideBand")) // For pi0, do not consider left band
1086       nms->SetSideBandCutRanges(-1,0,0.180,0.220);
1087     
1088     nms->KeepNeutralMesonSelectionHistos(kTRUE);
1089     //nms->SetAngleMaxParam(2,0.2);
1090     nms->SetHistoERangeAndNBins(0, 20, 80) ;
1091     //nms->SetHistoIMRangeAndNBins(0, 1, 400);
1092   }
1093   else
1094   { // cluster splitting settings
1095     ana->SetMinEnergy(6);
1096     ana->SetMaxEnergy(200.);
1097     
1098     ana->SetNLMMinEnergy(0, 10);
1099     ana->SetNLMMinEnergy(1, 6);
1100     ana->SetNLMMinEnergy(2, 6);
1101     
1102     // NLM cut, used in all, exclude clusters with more than 2 maxima
1103     ana->SetNLMCut(1, 2) ;
1104     
1105     AliCaloPID* caloPID = ana->GetCaloPID();
1106     
1107     caloPID->SetSplitWidthSigma(3.); // cut at 3 sigma of the mean pi0 peak.
1108     
1109     if(!useSS)
1110     {
1111       printf("Do not apply SS cut on merged pi0 analysis \n");
1112       caloPID->SwitchOffSplitShowerShapeCut() ;
1113       ana->AddToHistogramsName(Form("Ana%s%sEbE_OpenSS_TM%d_",particle.Data(),opt.Data(),kTM));
1114       ana->SetOutputAODName(Form("%s%s%s_OpenSS",particle.Data(), opt.Data(), kName.Data()));
1115       caloPID->SetClusterSplittingM02Cut(0.1,10000); 
1116     }
1117     else
1118     {
1119       caloPID->SetClusterSplittingM02Cut(0.3,5); // Do the selection in the analysis class and not in the PID method to fill SS histograms
1120       caloPID->SwitchOnSplitShowerShapeCut() ;
1121     }
1122     
1123     if(useAsy) caloPID->SwitchOnSplitAsymmetryCut() ;
1124     else
1125     {
1126       caloPID->SwitchOffSplitAsymmetryCut() ;
1127       if(!useSS)
1128       {
1129         ana->AddToHistogramsName(Form("Ana%s%sEbE_OpenSS_OpenAsy_TM%d_",particle.Data(),opt.Data(),kTM));
1130         ana->SetOutputAODName(Form("%s%s%s_OpenSS_OpenAsy",particle.Data(), opt.Data(), kName.Data()));
1131       }
1132       else
1133       {
1134         ana->AddToHistogramsName(Form("Ana%s%sEbE_OpenAsy_TM%d_",particle.Data(),opt.Data(),kTM));
1135         ana->SetOutputAODName(Form("%s%s%s_OpenAsy",particle.Data(), opt.Data(), kName.Data()));
1136       }
1137     }
1138     
1139     //For Pi0 only if  SwitchOnSimpleSplitMassCut()
1140     caloPID->SetPi0MassRange(0.10, 0.18);
1141     caloPID->SetEtaMassRange(0.40, 0.60);
1142     caloPID->SetPhotonMassRange(0.00, 0.08);
1143     
1144     caloPID->SetClusterSplittingMinNCells(6);
1145     
1146     //caloPID->SetSplitEnergyFractionMinimum(0, 0.95);
1147     //caloPID->SetSplitEnergyFractionMinimum(1, 0.95);
1148     //caloPID->SetSplitEnergyFractionMinimum(2, 0.8);
1149     
1150     if(kCollisions=="PbPb" || kName.Contains("150"))
1151     {
1152       caloPID->SetClusterSplittingMinNCells(4);
1153       caloPID->SetPi0MassShiftHighECell(0.005);
1154     }
1155   }
1156   
1157   ana->SwitchOffFillWeightHistograms();
1158   if(!kSimulation) ana->SwitchOnFillPileUpHistograms();
1159   
1160   if(kTM)
1161   {
1162     //printf("--->>>REMOVE MATCHED Pi0\n");
1163     ana->SwitchOnTrackMatchRejection() ;
1164     ana->SwitchOffTMHistoFill() ;
1165   }
1166   else
1167   {
1168     //printf("---->>>ACCEPT MATCHED Pi0\n");
1169     ana->SwitchOffTrackMatchRejection() ;
1170     ana->SwitchOnTMHistoFill() ;
1171   }
1172   
1173   SetHistoRangeAndNBins(ana->GetHistogramRanges()); // see method below
1174   
1175   //ana->SwitchOnFillEMCALBCHistograms();
1176   
1177   if(kPrint) ana->Print("");
1178   
1179   ConfigureMC(ana);
1180   
1181   return  ana;
1182   
1183 }
1184
1185 //____________________________________________________________________________________________________
1186 AliAnaParticleIsolation* ConfigureIsolationAnalysis(TString particle="Photon", 
1187                                                     Int_t  partInCone = AliIsolationCut::kOnlyCharged,
1188                                                     Int_t  thresType  = AliIsolationCut::kSumPtFracIC,
1189                                                     Float_t cone = 0.3,
1190                                                     Float_t pth  = 0.3,
1191                                                     Bool_t multi      = kFALSE)
1192 {
1193   
1194   AliAnaParticleIsolation *ana = new AliAnaParticleIsolation();
1195   //ana->SetDebug(kDebug);
1196   ana->SetDebug(kDebug);
1197   
1198   ana->SwitchOnFiducialCut();
1199   //Avoid borders of EMCal
1200   if(kCalorimeter=="EMCAL")
1201     ana->GetFiducialCut()->SetSimpleEMCALFiducialCut(0.6, 86, 174) ;
1202
1203   // Same Eta as EMCal, cut in phi if EMCAL was triggering
1204   if(particle=="Hadron"  || particle.Contains("CTS"))
1205   {
1206    // if(kTrig.Contains("EMC"))
1207    //   ana->GetFiducialCut()->SetSimpleCTSFiducialCut  (0.6, 260, 360) ;
1208    // else
1209       ana->GetFiducialCut()->SetSimpleCTSFiducialCut  (0.6, 0, 360) ;    
1210   }
1211   
1212   ana->SetMinPt(5);
1213   
1214   // Input / output delta AOD settings
1215   
1216   ana->SetInputAODName(Form("%s%s",particle.Data(),kName.Data()));
1217   ana->SetAODObjArrayName(Form("IC%s_%s",particle.Data(),kName.Data())); 
1218   
1219   ana->SetCalorimeter(kCalorimeter);
1220   
1221   if(!kTM)  ana->SwitchOnTMHistoFill();
1222   else      ana->SwitchOffTMHistoFill();
1223   
1224   ana->SwitchOffSSHistoFill();
1225   if(!kSimulation) ana->SwitchOnFillPileUpHistograms();
1226
1227   //Do settings for main isolation cut class
1228   AliIsolationCut * ic =  ana->GetIsolationCut();       
1229   ic->SetDebug(kDebug);
1230   
1231   if(cone >0 && pth > 0)
1232   {
1233     ic->SetPtThreshold(pth);
1234     ic->SetConeSize(cone);
1235   }
1236   else
1237   {
1238     if(kCollisions=="pp") 
1239     {
1240       ic->SetPtThreshold(0.5);
1241       ic->SetConeSize(0.4);
1242     }
1243     if(kCollisions=="PbPb")
1244     {
1245       ic->SetPtThreshold(3.);
1246       //ic->SetPtThreshold(1.);
1247       ic->SetConeSize(0.3);
1248     }
1249   }
1250   
1251   ic->SetPtFraction(0.1);
1252   ic->SetSumPtThreshold(1.0) ;
1253   ic->SetParticleTypeInCone(partInCone);
1254   ic->SetICMethod(thresType);
1255   
1256   //Do or not do isolation with previously produced AODs.
1257   //No effect if use of SwitchOnSeveralIsolation()
1258   ana->SwitchOffReIsolation();
1259   
1260   //Multiple IC
1261   if(multi) 
1262   {
1263     ic->SetConeSize(1.);    // Take all for first iteration
1264     ic->SetPtThreshold(100);// Take all for first iteration
1265     ana->SwitchOnSeveralIsolation() ;
1266     ana->SetAODObjArrayName(Form("MultiIC%sTM%d",particle.Data(),kTM));
1267      
1268     ana->SetNCones(4);
1269     ana->SetNPtThresFrac(4);
1270     ana->SetConeSizes(0,0.3);       ana->SetConeSizes(1,0.4);
1271     ana->SetConeSizes(2,0.5);       ana->SetConeSizes(3,0.6);
1272     ana->SetPtThresholds(0, 0.5);   ana->SetPtThresholds(1, 1);     ana->SetPtThresholds(2, 2);
1273     ana->SetPtFractions (0, 0.05) ; ana->SetPtFractions (1, 0.1);   ana->SetPtFractions (2, 0.2) ;  ana->SetPtFractions (3, 0.3) ;
1274     ana->SetSumPtThresholds(0, 1) ; ana->SetSumPtThresholds(1, 3) ; ana->SetSumPtThresholds(2, 5);  ana->SetSumPtThresholds(3, 7)  ;
1275     
1276     ana->SwitchOffTMHistoFill();
1277     ana->SwitchOffSSHistoFill();
1278   }
1279   else      
1280     ana->SwitchOffSeveralIsolation() ;
1281   
1282   AliCaloPID* caloPID = ana->GetCaloPID();
1283   caloPID->SetEMCALDEtaCut(0.025);
1284   caloPID->SetEMCALDPhiCut(0.030);
1285   
1286   //Set Histograms name tag, bins and ranges
1287   
1288   if(!multi)ana->AddToHistogramsName(Form("AnaIsol%s_TM%d_",particle.Data(),kTM));
1289   else      ana->AddToHistogramsName(Form("AnaMultiIsol%s_TM%d_",particle.Data(),kTM));
1290
1291   SetHistoRangeAndNBins(ana->GetHistogramRanges()); // see method below
1292   
1293   ana->SetHistoPtInConeRangeAndNBins(0, 50 , 250);
1294   ana->SetHistoPtSumRangeAndNBins   (0, 100, 250);
1295   
1296   if(particle=="Hadron"  || particle.Contains("CTS"))
1297   {
1298     ana->GetHistogramRanges()->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 200) ;
1299     ana->GetHistogramRanges()->SetHistoEtaRangeAndNBins(-1.5, 1.5, 300) ;
1300   }
1301   
1302   ana->SwitchOnRealCaloAcceptance(); // primary particle acceptance histograms
1303   ConfigureMC(ana);
1304   
1305   if(kPrint) ic ->Print("");
1306   if(kPrint) ana->Print("");
1307   
1308   return ana;
1309   
1310 }
1311
1312 //___________________________________________________________________________________
1313 AliAnaParticleHadronCorrelation* ConfigureHadronCorrelationAnalysis(TString particle, 
1314                                                                     Bool_t bIsolated,
1315                                                                     Int_t  partInCone = AliIsolationCut::kOnlyCharged,
1316                                                                     Int_t  thresType  = AliIsolationCut::kSumPtFracIC,
1317                                                                     Float_t cone = 0.3,
1318                                                                     Float_t pth  = 0.3)
1319 {
1320   
1321   AliAnaParticleHadronCorrelation *ana = new AliAnaParticleHadronCorrelation();
1322   ana->SetDebug(kDebug);
1323   
1324   ana->SetMinimumTriggerPt(5);
1325   ana->SetAssociatedPtRange(0.2,100); 
1326   ana->SetDeltaPhiCutRange( TMath::Pi()/2,3*TMath::Pi()/2 ); //[90 deg, 270 deg]
1327   
1328   ana->SetNAssocPtBins(9);
1329   
1330   ana->SetAssocPtBinLimit(0, 0.2) ;
1331   ana->SetAssocPtBinLimit(1, 0.5) ;
1332   ana->SetAssocPtBinLimit(2, 1)   ;
1333   ana->SetAssocPtBinLimit(3, 2)   ;
1334   ana->SetAssocPtBinLimit(4, 3)   ;
1335   ana->SetAssocPtBinLimit(5, 4)   ;
1336   ana->SetAssocPtBinLimit(6, 6)   ;
1337   ana->SetAssocPtBinLimit(7, 10)  ;
1338   ana->SetAssocPtBinLimit(8, 30)  ;
1339   ana->SetAssocPtBinLimit(9, 200) ;
1340   
1341   ana->SelectIsolated(bIsolated); // do correlation with isolated photons
1342   
1343   if(bIsolated)
1344   {
1345     //Do settings for main isolation cut class
1346     AliIsolationCut * ic =  ana->GetIsolationCut();     
1347     ic->SetDebug(kDebug);
1348     
1349     if(cone >0 && pth > 0)
1350     {
1351       ic->SetPtThreshold(pth);
1352       ic->SetConeSize(cone);
1353     }
1354     else
1355     {
1356       if(kCollisions=="pp") 
1357       {
1358         ic->SetPtThreshold(0.5);
1359         ic->SetConeSize(0.4);
1360       }
1361       if(kCollisions=="PbPb")
1362       {
1363         ic->SetPtThreshold(3.);
1364         //ic->SetPtThreshold(1.);
1365         ic->SetConeSize(0.3);
1366       }
1367     }
1368     
1369     ic->SetPtFraction(0.1);
1370     ic->SetSumPtThreshold(1.0) ;
1371     ic->SetParticleTypeInCone(partInCone);
1372     ic->SetICMethod(thresType);
1373     
1374   }  
1375   
1376   ana->SwitchOnAbsoluteLeading();  // Select trigger leading particle of all the selected tracks
1377   ana->SwitchOffNearSideLeading(); // Select trigger leading particle of all the particles at +-90 degrees, default
1378   
1379   // Mixing with own pool
1380   if(kMix)
1381   {
1382     ana->SwitchOnOwnMix();
1383     ana->SwitchOnFillNeutralInMixedEvent();
1384   }
1385   else
1386     ana->SwitchOffOwnMix();
1387   
1388   ana->SetNZvertBin(20);
1389   
1390   if(kCollisions=="pp")
1391   {
1392     ana->SetNMaxEvMix(100);    
1393     ana->SwitchOnTrackMultBins();
1394     ana->SetNCentrBin(9); // Fixed track mult values
1395     ana->SetNRPBin(1);
1396   }
1397   else 
1398   {
1399     ana->SetNMaxEvMix(10);    
1400     ana->SwitchOffTrackMultBins(); // centrality bins
1401     ana->SetNCentrBin(3); 
1402     ana->SetNRPBin(3);
1403     if(kName.Contains("60_90"))
1404     {
1405       printf("*** Set mixing for peripheral\n");
1406       ana->SetNMaxEvMix(50);    
1407       ana->SetNCentrBin(2); 
1408     }    
1409   }  
1410   
1411   ana->SwitchOnFiducialCut();
1412   
1413   //Avoid borders of EMCal, same as for isolation
1414   if(kCalorimeter=="EMCAL")
1415     ana->GetFiducialCut()->SetSimpleEMCALFiducialCut(0.6, 86, 174) ;
1416   
1417   // Same Eta as EMCal, cut in phi if EMCAL was triggering
1418   if(particle=="Hadron" || particle.Contains("CTS"))
1419   {
1420     //if(kTrig.Contains("EMC"))
1421     //  ana->GetFiducialCut()->SetSimpleCTSFiducialCut  (0.6, 260, 360) ;
1422     //else
1423       ana->GetFiducialCut()->SetSimpleCTSFiducialCut  (0.6, 0, 360) ;    
1424   }
1425   
1426   // Input / output delta AOD settings
1427   
1428   ana->SetInputAODName(Form("%s%s",particle.Data(),kName.Data()));
1429   ana->SetAODObjArrayName(Form("%sHadronCorrIso%d_%s",particle.Data(),bIsolated,kName.Data())); 
1430   
1431   // Fill extra plots on tagged decay photons
1432   // If trigger is pi0/eta found with invariant mass, get the decays
1433   // If trigger is photon, check if it was tagged as decay previously
1434   if(particle!="Hadron" )
1435   {
1436     if(particle.Contains("Pi0") || particle.Contains("Eta"))
1437     {
1438       ana->SwitchOffPi0TriggerDecayCorr();
1439       ana->SwitchOffDecayTriggerDecayCorr();
1440     }
1441     else
1442     {
1443       ana->SwitchOffPi0TriggerDecayCorr();
1444       ana->SwitchOnDecayTriggerDecayCorr(); // Make sure pi0 decay tagging runs before this task
1445     }
1446   }
1447   else
1448   {
1449     ana->SwitchOffPi0TriggerDecayCorr();
1450     ana->SwitchOffDecayTriggerDecayCorr(); 
1451   }
1452   
1453   if(particle=="Photon")
1454   {
1455     printf("**** SET M02 limits *** \n");
1456     ana->SetM02Cut(0.1,0.27);
1457   }
1458   
1459   // if triggering on PHOS and EMCAL is on
1460   //if(kCalorimeter=="PHOS") ana->SwitchOnNeutralCorr();
1461   ana->SwitchOffNeutralCorr(); // Do only correlation with TPC
1462   
1463   ana->SwitchOffHMPIDCorrelation();
1464   
1465   ana->SwitchOffFillBradHistograms();
1466   
1467   // Underlying event
1468   ana->SwitchOffEventSelection();
1469   ana->SwitchOnSeveralUECalculation();
1470   ana->SetUeDeltaPhiCutRange(TMath::Pi()/3, 2*TMath::Pi()/3);
1471   ana->SetMultiBin(1);
1472   
1473   //Set Histograms name tag, bins and ranges
1474   
1475   ana->AddToHistogramsName(Form("Ana%sHadronCorr_Iso%d_TM%d_",particle.Data(),bIsolated,kTM));
1476   SetHistoRangeAndNBins(ana->GetHistogramRanges()); // see method below
1477   
1478   if(particle=="Hadron"  || particle.Contains("CTS"))
1479   {
1480     ana->GetHistogramRanges()->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 200) ;
1481     ana->GetHistogramRanges()->SetHistoEtaRangeAndNBins(-1.5, 1.5, 300) ;
1482   }  
1483   
1484   ConfigureMC(ana);
1485   
1486   if(kPrint) ana->Print("");  
1487   
1488   return ana;
1489   
1490 }
1491
1492 //________________________________________
1493 AliAnaCalorimeterQA* ConfigureQAAnalysis()
1494 {
1495   
1496   AliAnaCalorimeterQA *ana = new AliAnaCalorimeterQA();
1497   ana->SetDebug(kDebug); //10 for lots of messages
1498   ana->SetCalorimeter(kCalorimeter);
1499   
1500   ana->SetTimeCut(-1e10,1e10); // Open time cut
1501   
1502   // Study inter detector correlation (PHOS, EMCAL, Tracks, V0)
1503   if(kCalorimeter=="PHOS"  && kTrig=="PHOS")
1504     ana->SwitchOnCorrelation(); // make sure you switch in the reader PHOS and EMCAL cells and clusters if option is ON
1505   if(kCalorimeter=="EMCAL" && kClusterArray=="")
1506     ana->SwitchOnCorrelation(); // make sure you switch in the reader PHOS and EMCAL cells and clusters if option is ON
1507   else 
1508     ana->SwitchOffCorrelation();
1509   
1510   // Study exotic clusters PHOS and EMCAL
1511   if(kClusterArray=="") ana->SwitchOnStudyBadClusters() ; 
1512   else                  ana->SwitchOffStudyBadClusters() ;
1513   
1514   
1515   ana->SwitchOffFiducialCut();
1516   ana->SwitchOffFillAllTH3Histogram();
1517   ana->SwitchOffFillAllPositionHistogram();
1518   ana->SwitchOffFillAllPositionHistogram2();
1519   if(!kExotic)ana->SwitchOnStudyBadClusters();
1520   else        ana->SwitchOffStudyBadClusters();
1521   ana->SwitchOffStudyClustersAsymmetry();
1522   ana->SwitchOffStudyWeight();
1523   ana->SwitchOnFillAllTrackMatchingHistogram();
1524   ana->SwitchOnFillAllCellTimeHisto() ;
1525   
1526   ana->AddToHistogramsName("QA_"); //Begining of histograms name
1527   SetHistoRangeAndNBins(ana->GetHistogramRanges()); // see method below
1528   
1529   ConfigureMC(ana);
1530   
1531   if(kPrint) ana->Print("");    
1532   
1533   return ana;
1534   
1535 }
1536
1537 //________________________________________________________
1538 void ConfigureMC(AliAnaCaloTrackCorrBaseClass* ana)
1539 {
1540   if(kSimulation) ana->SwitchOnDataMC() ;//Access MC stack and fill more histograms, AOD MC not implemented yet.
1541   else            ana->SwitchOffDataMC() ;
1542
1543   //Set here generator name, default pythia
1544   //ana->GetMCAnalysisUtils()->SetMCGenerator("");
1545 }  
1546
1547 //________________________________________________________
1548 void SetHistoRangeAndNBins (AliHistogramRanges* histoRanges)
1549 {
1550   // Set common bins for all analysis and MC histograms filling
1551     
1552   histoRanges->SetHistoPtRangeAndNBins(0, 100, 200) ; // Energy and pt histograms
1553   
1554   if(kCalorimeter=="EMCAL")
1555   {
1556     if(kYears==2010)
1557     {
1558       histoRanges->SetHistoPhiRangeAndNBins(78*TMath::DegToRad(), 122*TMath::DegToRad(), 78) ;
1559       histoRanges->SetHistoXRangeAndNBins(-230,90,120); // QA
1560       histoRanges->SetHistoYRangeAndNBins(370,450,40);  // QA
1561     }
1562     else if(kYears==2011)
1563     {           
1564       histoRanges->SetHistoPhiRangeAndNBins(78*TMath::DegToRad(), 182*TMath::DegToRad(), 108) ;
1565       histoRanges->SetHistoXRangeAndNBins(-600,90,200); // QA
1566       histoRanges->SetHistoYRangeAndNBins(100,450,100); // QA
1567     }
1568     else
1569     {
1570       histoRanges->SetHistoPhiRangeAndNBins(78*TMath::DegToRad(), 190*TMath::DegToRad(), 122) ;
1571       histoRanges->SetHistoXRangeAndNBins(-100,90,200); // QA
1572       histoRanges->SetHistoYRangeAndNBins(50,450,100);  // QA
1573     }
1574
1575     histoRanges->SetHistoEtaRangeAndNBins(-0.72, 0.72, 144) ;
1576   }
1577   else
1578   {
1579     histoRanges->SetHistoPhiRangeAndNBins(260*TMath::DegToRad(), 320*TMath::DegToRad(), 60) ;
1580     histoRanges->SetHistoEtaRangeAndNBins(-0.13, 0.13, 130) ;
1581   }
1582   
1583   histoRanges->SetHistoShowerShapeRangeAndNBins(-0.1, 4.9, 500);
1584   
1585   // Invariant mass histoRangeslysis
1586   histoRanges->SetHistoMassRangeAndNBins(0., 1., 200) ;
1587   histoRanges->SetHistoAsymmetryRangeAndNBins(0., 1. , 100) ;
1588   
1589   // check if time calibration is on
1590   histoRanges->SetHistoTimeRangeAndNBins(-1000.,1000,1000);
1591   histoRanges->SetHistoDiffTimeRangeAndNBins(-200, 200, 800);
1592   
1593   // track-cluster residuals
1594   histoRanges->SetHistoTrackResidualEtaRangeAndNBins(-0.15,0.15,300);
1595   histoRanges->SetHistoTrackResidualPhiRangeAndNBins(-0.15,0.15,300);
1596   histoRanges->SetHistodRRangeAndNBins(0.,0.15,150);//QA
1597
1598   // QA, electron, charged
1599   histoRanges->SetHistoPOverERangeAndNBins(0,  2.5 ,500);
1600   histoRanges->SetHistodEdxRangeAndNBins  (0.,250.0,500);
1601   
1602   // QA
1603   histoRanges->SetHistoFinePtRangeAndNBins(0, 10, 200) ; // bining for fhAmpId
1604   histoRanges->SetHistoRatioRangeAndNBins(0.,2.,100);
1605   histoRanges->SetHistoVertexDistRangeAndNBins(0.,500.,500);
1606   histoRanges->SetHistoNClusterCellRangeAndNBins(0,50,50);
1607   histoRanges->SetHistoZRangeAndNBins(-400,400,200);
1608   histoRanges->SetHistoRRangeAndNBins(400,450,25);
1609   histoRanges->SetHistoV0SignalRangeAndNBins(0,5000,500);
1610   histoRanges->SetHistoV0MultiplicityRangeAndNBins(0,5000,500);
1611   histoRanges->SetHistoTrackMultiplicityRangeAndNBins(0,5000,500);
1612   
1613 }
1614
1615 //_____________________________
1616 UInt_t SetTriggerMaskFromName()
1617 {
1618   if(kTrig=="EMC7")
1619   {
1620     printf("CaloTrackCorr trigger EMC7\n");
1621     return AliVEvent::kEMC7;
1622   }
1623   else if (kTrig=="INT7")
1624   {
1625     printf("CaloTrackCorr trigger INT7\n");
1626     return AliVEvent::kINT7;
1627   }
1628   else if(kTrig=="EMC1")
1629   {
1630     printf("CaloTrackCorr trigger EMC1\n");
1631     return AliVEvent::kEMC1;
1632   }
1633   else if(kTrig=="MB")
1634   {
1635     printf("CaloTrackCorr trigger MB\n");
1636     return AliVEvent::kMB;
1637   }  
1638   else if(kTrig=="PHOS")
1639   {
1640     printf("CaloTrackCorr trigger PHOS\n");
1641     return AliVEvent::kPHI7;
1642   }  
1643   else if(kTrig=="PHOSPb")
1644   {
1645     printf("CaloTrackCorr trigger PHOSPb\n");
1646     return AliVEvent::kPHOSPb;
1647   }
1648   else if(kTrig=="AnyINT")
1649   {
1650     printf("CaloTrackCorr trigger AnyINT\n");
1651     return AliVEvent::kAnyINT;
1652   }  
1653   else if(kTrig=="INT")
1654   {
1655     printf("CaloTrackCorr trigger AnyINT\n");
1656     return AliVEvent::kAny;
1657   }
1658   else if(kTrig=="EMCEGA")
1659   {
1660     printf("CaloTrackCorr trigger EMC Gamma\n");
1661     return AliVEvent::kEMCEGA;
1662   } 
1663   else if(kTrig=="EMCEJE")
1664   {
1665     printf("CaloTrackCorr trigger EMC Jet\n");
1666     return AliVEvent::kEMCEJE;
1667   }
1668   else if(kTrig=="Central")
1669   {
1670     printf("CaloTrackCorr trigger Central\n");
1671     return (AliVEvent::kCentral  | AliVEvent::kMB);
1672   }
1673   else if(kTrig=="CentralEGA")
1674   {
1675     printf("CaloTrackCorr trigger Central+EMCEGA\n");
1676     return (AliVEvent::kCentral | AliVEvent::kEMCEGA);
1677   }
1678   else if(kTrig=="SemiCentral")
1679   {
1680     printf("CaloTrackCorr trigger SemiCentral\n");
1681     return (AliVEvent::kSemiCentral | AliVEvent::kMB);
1682   }
1683   else if(kTrig=="SemiOrCentral")
1684   {
1685     printf("CaloTrackCorr trigger SemiCentral Or Central\n");
1686     return (AliVEvent::kSemiCentral | AliVEvent::kCentral  | AliVEvent::kMB);
1687   }
1688 }
1689