]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWGGA/CaloTrackCorrelations/macros/AddTaskCaloTrackCorr.C
add example of configuration of analysis with AliGeneratorKine
[u/mrichter/AliRoot.git] / PWGGA / CaloTrackCorrelations / macros / AddTaskCaloTrackCorr.C
index acdeaa87fdfd8af77fb6646b4a2f59ebf818d133..1119819a961629e1b7bbc9dacfe51d4539c5cd04 100644 (file)
@@ -26,6 +26,7 @@ Bool_t  kCalibT        = kTRUE;
 Bool_t  kBadMap        = kTRUE;
 Bool_t  kTender        = kFALSE;
 Bool_t  kMix           = kFALSE;
+Int_t   kRunNumber     = -1;
 
 AliAnalysisTaskCaloTrackCorrelation *AddTaskCaloTrackCorr(const TString  data          = "",
                                                           const TString  calorimeter   = "EMCAL", 
@@ -51,7 +52,8 @@ AliAnalysisTaskCaloTrackCorrelation *AddTaskCaloTrackCorr(const TString  data
                                                           const Bool_t   tender        = kFALSE,
                                                           const Bool_t   outputAOD     = kFALSE, 
                                                           const Bool_t   printSettings = kFALSE,
-                                                          const Double_t scaleFactor   = -1
+                                                          const Double_t scaleFactor   = -1, 
+                                                          const Int_t    runNumber     = -1
                                                           )
 {
   // Creates a CaloTrackCorr task, configures it and adds it to the analysis manager.
@@ -79,7 +81,8 @@ AliAnalysisTaskCaloTrackCorrelation *AddTaskCaloTrackCorr(const TString  data
   kBadMap        = badmap;
   kTender        = tender;
   kMix           = mix;
-
+  kRunNumber     = runNumber;
+  
   // Get the pointer to the existing analysis manager via the static access method.
   
   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
@@ -96,6 +99,9 @@ AliAnalysisTaskCaloTrackCorrelation *AddTaskCaloTrackCorr(const TString  data
     ::Error("AddTask", "This task requires an input event handler");
     return NULL;
   }
+
+  // Make sure the B field is enabled for track selection, some cuts need it
+  ((AliInputEventHandler*)mgr->GetInputEventHandler())->SetNeedField(kTRUE);
   
   kInputDataType = "AOD";
   if(!kData.Contains("delta"))
@@ -154,12 +160,12 @@ AliAnalysisTaskCaloTrackCorrelation *AddTaskCaloTrackCorr(const TString  data
   // Split cluster analysis
   if(kCalorimeter == "EMCAL")
   {
-    maker->AddAnalysis(ConfigurePi0EbEAnalysis("Pi0", AliAnaPi0EbE::kSSCalo), n++); // Pi0 event by event selection, cluster splitting   
-    maker->AddAnalysis(ConfigureIsolationAnalysis("Pi0SS", partInCone,thresType,cone, pth), n++);       // Pi0 isolation, cluster splits   
+    maker->AddAnalysis(ConfigurePi0EbEAnalysis("Pi0", AliAnaPi0EbE::kSSCalo), n++); // Pi0 event by event selection, cluster splitting
+    maker->AddAnalysis(ConfigureIsolationAnalysis("Pi0SS", partInCone,thresType,cone, pth), n++);       // Pi0 isolation, cluster splits
     maker->AddAnalysis(ConfigureHadronCorrelationAnalysis("Pi0SS" ,kFALSE), n++); // Pi0 hadron correlation
     maker->AddAnalysis(ConfigureHadronCorrelationAnalysis("Pi0SS" ,kTRUE,partInCone,thresType, cone, pth) , n++); // Isolated pi0 hadron correlation
     //maker->AddAnalysis(ConfigureIsolationAnalysis("Pi0SS",  partInCone,thresType,kTRUE), n++); // Pi0 multi isolation, split cluster  
-    //maker->AddAnalysis(ConfigureInClusterIMAnalysis(0.5,3), n++); 
+    maker->AddAnalysis(ConfigureInClusterIMAnalysis(kTRUE , kTRUE ), n++);
   }
   
   // Invariant mass analysis
@@ -209,6 +215,8 @@ AliAnalysisTaskCaloTrackCorrelation *AddTaskCaloTrackCorr(const TString  data
   
   if(kPrint) maker->Print("");
   
+  if(kSimulation) maker->SwitchOffDataControlHistograms();
+  
   printf("<< End Configuration of %d analysis for calorimeter %s >>\n",n, kCalorimeter.Data());
  
   // Create task
@@ -241,7 +249,11 @@ AliAnalysisTaskCaloTrackCorrelation *AddTaskCaloTrackCorr(const TString  data
   mgr->ConnectOutput (task, 1, cout_pc);
   mgr->ConnectOutput (task, 2, cout_cuts);
   
-  if(!kMix) task->SelectCollisionCandidates(TriggerMask());
+  if(!kMix)
+  {    
+    UInt_t mask =  SetTriggerMaskFromName();
+    task->SelectCollisionCandidates(mask);
+  } 
   
   return task;
 }
@@ -262,6 +274,18 @@ AliCaloTrackReader * ConfigureReader()
   
   reader->SetDebug(kDebug);//10 for lots of messages
   
+  /*
+   if(kSimulation)
+   {
+     // Event rejection cuts for jet-jet simulations
+     reader->SetPtHardAndJetPtComparison(kTRUE);
+     reader->SetPtHardAndJetPtFactor(4);
+   
+     reader->SetPtHardAndClusterPtComparison(kTRUE);
+     reader->SetPtHardAndClusterPtFactor(1.5);
+   }
+   */
+  
   //Delta AOD?
   //reader->SetDeltaAODFileName("");
   if(kOutputAOD) reader->SwitchOnWriteDeltaAOD()  ;
@@ -290,25 +314,99 @@ AliCaloTrackReader * ConfigureReader()
   reader->SetCTSPtMin(0.2);
   reader->SetCTSPtMax(1000);
 
-  if(!kSimulation && kCalibT) reader->SetEMCALTimeCut(-30,30); 
-  else                        reader->SetEMCALTimeCut(-1000,1000); // Open time cut
-
+  // Time cuts
+  if(kSimulation) 
+  {
+    reader->SwitchOffUseTrackTimeCut();
+    reader->SwitchOffUseParametrizedTimeCut();
+    reader->SwitchOffUseEMCALTimeCut();
+    reader->SetEMCALTimeCut(-1e10,1e10); // Open time cut
+  }
+  else
+  {
+    if(kCalibT)
+    { 
+      printf("Set time cut parameters for run %d\n",kRunNumber);
+      reader->SwitchOnUseEMCALTimeCut();
+      reader->SwitchOnUseParametrizedTimeCut();
+      
+      //Absolute window
+      reader->SetEMCALTimeCut(-25,20);
+      
+      //Parametrization
+      if     (kRunNumber >= 151636 && kRunNumber <= 155384 )
+      {
+        printf("Set time parameters for LHC11c");
+        reader->SetEMCALParametrizedMinTimeCut(0,-5  ); reader->SetEMCALParametrizedMinTimeCut(1,-1 ); reader->SetEMCALParametrizedMinTimeCut(2, 1.87); reader->SetEMCALParametrizedMinTimeCut(3, 0.4);   
+        reader->SetEMCALParametrizedMaxTimeCut(0, 3.5); reader->SetEMCALParametrizedMaxTimeCut(1, 50); reader->SetEMCALParametrizedMaxTimeCut(2, 0.15); reader->SetEMCALParametrizedMaxTimeCut(3, 1.6);   
+      }
+      else if(kRunNumber >= 156447 && kRunNumber <= 159635 )
+      {
+        printf("Set time parameters for LHC11d");
+        reader->SetEMCALParametrizedMinTimeCut(0,-5);  reader->SetEMCALParametrizedMinTimeCut(1,-1 );  reader->SetEMCALParametrizedMinTimeCut(2, 3.5 ); reader->SetEMCALParametrizedMinTimeCut(3, 1.  );   
+        reader->SetEMCALParametrizedMaxTimeCut(0, 5);  reader->SetEMCALParametrizedMaxTimeCut(1, 50);  reader->SetEMCALParametrizedMaxTimeCut(2, 0.45); reader->SetEMCALParametrizedMaxTimeCut(3, 1.25);   
+      }
+      else
+      {
+        reader->SwitchOffUseParametrizedTimeCut();
+      }
+    }
+    else
+    {
+      reader->SwitchOffUseParametrizedTimeCut();
+      reader->SwitchOffUseEMCALTimeCut();
+      reader->SetEMCALTimeCut(-1e10,1e10); // Open time cut
+    }
+  }
+  
   reader->SwitchOnFiducialCut();
   reader->GetFiducialCut()->SetSimpleCTSFiducialCut(0.8, 0, 360) ;
 
   // Tracks
   reader->SwitchOnCTS();
+  reader->SwitchOffRejectNoTrackEvents();
+
+  reader->SwitchOffRecalculateVertexBC();
+  reader->SwitchOffVertexBCEventSelection();
+  
+  reader->SwitchOffUseTrackTimeCut();
+  reader->SetTrackTimeCut(0,50);
+  
+  reader->SwitchOffUseTrackDCACut();
+  //reader->SetTrackDCACut(0,0.0105);
+  //reader->SetTrackDCACut(1,0.035);
+  //reader->SetTrackDCACut(2,1.1);
+  
   if(kInputDataType=="ESD")
   {
     gROOT->LoadMacro("$ALICE_ROOT/PWGJE/macros/CreateTrackCutsPWGJE.C");
-    AliESDtrackCuts * esdTrackCuts = CreateTrackCutsPWGJE(10041004);
-    reader->SetTrackCuts(esdTrackCuts);
-    reader->SwitchOnConstrainTrackToVertex();
+    //AliESDtrackCuts * esdTrackCuts = CreateTrackCutsPWGJE(10041004);
+    //reader->SetTrackCuts(esdTrackCuts);
+    //reader->SwitchOnConstrainTrackToVertex();
+    
+    if(kYears>2010)
+    {
+      //Hybrids 2011
+      AliESDtrackCuts * esdTrackCuts  = CreateTrackCutsPWGJE(10001008);
+      reader->SetTrackCuts(esdTrackCuts);
+      AliESDtrackCuts * esdTrackCuts2 = CreateTrackCutsPWGJE(10011008);
+      reader->SetTrackComplementaryCuts(esdTrackCuts2);
+    }
+    else
+    {
+      //Hybrids 2010
+      AliESDtrackCuts * esdTrackCuts  = CreateTrackCutsPWGJE(10001006);
+      reader->SetTrackCuts(esdTrackCuts);
+      AliESDtrackCuts * esdTrackCuts2 = CreateTrackCutsPWGJE(10041006);
+      reader->SetTrackComplementaryCuts(esdTrackCuts2);
+    }
   }
   else if(kInputDataType=="AOD")
   {
-    reader->SwitchOnAODHybridTrackSelection();
-    reader->SetTrackFilterMask(128); // Filter bit, not mask, use if off hybrid
+    //reader->SetTrackFilterMask(128);           // Filter bit, not mask, use if off hybrid
+    reader->SwitchOnAODHybridTrackSelection(); // Check that the AODs have Hybrids!!!!
+    reader->SetTrackStatus(AliVTrack::kITSrefit);
+    //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
   }
   
   // Calorimeter
@@ -326,6 +424,8 @@ AliCaloTrackReader * ConfigureReader()
     reader->SwitchOffClusterRecalculation();
   }  
   
+  if(!kNonLinearity) reader->SwitchOffClusterELinearityCorrection();
+  
   //if(kCalorimeter == "EMCAL") {
     reader->SwitchOnEMCALCells();  
     reader->SwitchOnEMCAL();
@@ -348,46 +448,62 @@ AliCaloTrackReader * ConfigureReader()
   // Event selection
   //-----------------
   
+  //reader->RejectFastClusterEvents()  ;
+
+  // Event triggered selection settings
+  reader->SwitchOnTriggerPatchMatching();
+  reader->SwitchOnBadTriggerEventsRemoval(); // only if SwitchOnTriggerPatchMatching();
+  reader->SwitchOnUnMatchedTriggerEventsRemoval(); // only if SwitchOnBadTriggerEventsRemoval();
+  //reader->SwitchOffTriggerClusterTimeRecal() ;
+
+  reader->SetTriggerPatchTimeWindow(8,9); // L0
+  if     (kRunNumber < 146861) reader->SetEventTriggerL0Threshold(3.);
+  else if(kRunNumber < 154000) reader->SetEventTriggerL0Threshold(4.);
+  else if(kRunNumber < 165000) reader->SetEventTriggerL0Threshold(5.5);
+
+  //redefine for other periods, triggers
+
   //if(!kUseKinematics) reader->SetFiredTriggerClassName("CEMC7EGA-B-NOPF-CENTNOTRD"); // L1 Gamma
   
   // For mixing with AliAnaParticleHadronCorrelation switch it off
   if(kMix)
   {
     reader->SwitchOffEventTriggerAtSE();
-    reader->SetEventTriggerMaks(TriggerMask()); // Only for mixing and SwitchOffEventTriggerAtSE();
-    reader->SetMixEventTriggerMaks(AliVEvent::kMB); // Careful, not all productions work with kMB, try kINT7, kINT1, kAnyINT
+    UInt_t mask =  SetTriggerMaskFromName();
+    reader->SetEventTriggerMask(mask); // Only for mixing and SwitchOffEventTriggerAtSE();
+    //reader->SetMixEventTriggerMask(AliVEvent::kMB); // Careful, not all productions work with kMB, try kINT7, kINT1, kAnyINT
+    reader->SetMixEventTriggerMask(AliVEvent::kAnyINT); // Careful, not all productions work with kMB, try kINT7, kINT1, kAnyINT
     
     printf("---Trigger selection done in AliCaloTrackReader!!!\n");
   }
-  else 
+  else
     reader->SwitchOnEventTriggerAtSE();  
-  reader->SetZvertexCut(10.);                // Open cut
+  
+  reader->SetZvertexCut(10.);               // Open cut
   reader->SwitchOnPrimaryVertexSelection(); // and besides primary vertex
 
   if(kEventSelection)
   {
-    reader->SwitchOnEventSelection();         // remove pileup by default
-    reader->SwitchOnV0ANDSelection() ;        // and besides v0 AND
+    reader->SwitchOnEventPileUpRejection(); // remove pileup by default
+    reader->SwitchOnV0ANDSelection() ;      // and besides v0 AND
   }
   else 
   {
-    reader->SwitchOffEventSelection();         // remove pileup by default
-    reader->SwitchOffV0ANDSelection() ;        // and besides v0 AND
+    reader->SwitchOffPileUpEventRejection();// remove pileup by default
+    reader->SwitchOffV0ANDSelection() ;     // and besides v0 AND
   }
     
   if(kCollisions=="PbPb") 
   {
     // Centrality
     reader->SetCentralityClass("V0M");
-    reader->SetCentralityOpt(10);  // 10 (c= 0-10, 10-20 ...), 20  (c= 0-5, 5-10 ...) or 100 (c= 1, 2, 3 ..)
+    reader->SetCentralityOpt(100);  // 10 (c= 0-10, 10-20 ...), 20  (c= 0-5, 5-10 ...) or 100 (c= 1, 2, 3 ..)
     reader->SetCentralityBin(kMinCen,kMaxCen); // Accept all events, if not select range
     
     // Event plane (only used in Maker and mixing for AliAnaPi0/AliAnaHadronCorrelation for the moment)
     reader->SetEventPlaneMethod("V0");
   }
   
-  reader->SetImportGeometryFromFile(kTRUE);
-  
   if(kPrint) reader->Print("");
   
   return reader;
@@ -410,6 +526,12 @@ AliCalorimeterUtils* ConfigureCaloUtils()
   {
     cu->SetLocalMaximaCutE(0.1);
     cu->SetLocalMaximaCutEDiff(0.03);
+    if(kName.Contains("150"))
+    {
+      printf("Reclusterize with 150 threshold, set PbPb settings\n");
+      cu->SetLocalMaximaCutE(0.2);
+      cu->SetLocalMaximaCutEDiff(0.03);
+    }
   }
   else 
   {
@@ -431,18 +553,22 @@ AliCalorimeterUtils* ConfigureCaloUtils()
   
   AliEMCALRecoUtils * recou = cu->GetEMCALRecoUtils();
   
-
-  cu->SwitchOnRecalibration(); // Check the reader if it is taken into account during filtering
-  cu->SwitchOnRunDepCorrection(); 
+  if(!kSimulation)
+  {
+    cu->SwitchOnRecalibration(); // Check the reader if it is taken into account during filtering
+    if(kClusterArray == "" && !kTender) cu->SwitchOnRunDepCorrection();
+  }
   
   gROOT->LoadMacro("$ALICE_ROOT/PWGGA/EMCALTasks/macros/ConfigureEMCALRecoUtils.C");
   ConfigureEMCALRecoUtils(recou,
                           kSimulation,                             
                           kExotic,
-                          kNonLinearity,
+                          kTRUE,//kNonLinearity,
                           kCalibE, 
                           kBadMap,
-                          kCalibT);   
+                          kCalibT);
+  //recou->SetExoticCellDiffTimeCut(50.);
+
   
   if( kNonLinearity ) 
   { 
@@ -453,7 +579,19 @@ AliCalorimeterUtils* ConfigureCaloUtils()
   printf("ConfigureCaloUtils() - EMCAL Recalibration ON? %d %d\n",recou->IsRecalibrationOn(), cu->IsRecalibrationOn());
   printf("ConfigureCaloUtils() - EMCAL BadMap        ON? %d %d\n",recou->IsBadChannelsRemovalSwitchedOn(), cu->IsBadChannelsRemovalSwitchedOn());
   
-    
+  
+  if(kCalorimeter=="PHOS")
+  {
+    if (kYears <  2014) cu->SetNumberOfSuperModulesUsed(3);
+    else                cu->SetNumberOfSuperModulesUsed(4);
+  }
+  else
+  {
+    if      (kYears == 2010) cu->SetNumberOfSuperModulesUsed(4); //EMCAL first year
+    else if (kYears <  2014) cu->SetNumberOfSuperModulesUsed(10);
+    else                     cu->SetNumberOfSuperModulesUsed(20);
+  }
+  
   // PHOS 
   cu->SwitchOffLoadOwnPHOSGeometryMatrices();
     
@@ -481,16 +619,20 @@ AliAnaPhoton* ConfigurePhotonAnalysis()
     ana->SetNCellCut(2);// At least 3 cells
     ana->SetMinPt(0.3);
     ana->SetMinDistanceToBadChannel(2, 4, 5);
-    ana->SetTimeCut(-2000,2000); // open cut
+    ana->SetTimeCut(-1e10,1e10); // open cut
   }
   else 
   {//EMCAL
     ana->SetNCellCut(1);// At least 2 cells
     ana->SetMinEnergy(0.3); // avoid mip peak at E = 260 MeV
     ana->SetMaxEnergy(1000); 
-    ana->SetTimeCut(-1000,1000); // open cut, usual time window of [425-825] ns if time recalibration is off 
+    ana->SetTimeCut(-1e10,1e10); // open cut, usual time window of [425-825] ns if time recalibration is off 
     // restrict to less than 100 ns when time calibration is on 
     ana->SetMinDistanceToBadChannel(2, 4, 6); 
+    
+    // NLM cut, used in all, exclude clusters with more than 2 maxima
+    // Not needed if M02 cut is already strong or clusterizer V2
+    ana->SetNLMCut(1, 2) ;
   }
   
   if(kTM)
@@ -522,7 +664,9 @@ AliAnaPhoton* ConfigurePhotonAnalysis()
   if(kInputData=="AOD") caloPID->SetPHOSRCut(2000.); // Open cut since dX, dZ not stored
       
   ana->SwitchOffFillShowerShapeHistograms();  // Filled before photon shower shape selection
-  
+  if(!kSimulation)ana->SwitchOnFillPileUpHistograms();
+  //if(!kSimulation) ana->SwitchOnFillEMCALBCHistograms();
+
   // Input / output delta AOD settings
   
   if(!kData.Contains("delta")) 
@@ -542,6 +686,7 @@ AliAnaPhoton* ConfigurePhotonAnalysis()
   ana->FillNOriginHistograms(20);
   ana->FillNPrimaryHistograms(20);
   
+  ana->SwitchOnRealCaloAcceptance(); // primary particle acceptance histograms
   ConfigureMC(ana);
   
   if(kPrint) ana->Print("");
@@ -550,13 +695,69 @@ AliAnaPhoton* ConfigurePhotonAnalysis()
   
 }
 
+//________________________________________________________________
+AliAnaEMCALTriggerClusters* ConfigureEMCALTriggerClusterAnalysis()
+{
+  // For filling all histograms meaninfully, in the reader, time cut must be off
+  // and bad triggered events not rejected, and of course analyze triggered events.
+  
+  AliAnaEMCALTriggerClusters *ana = new AliAnaEMCALTriggerClusters();
+  ana->SetDebug(kDebug); //10 for lots of messages
+  
+  // cluster selection cuts
+  
+  ana->SwitchOffFiducialCut();
+  ana->SetNCellCut(1);// At least 2 cells
+  ana->SetMinEnergy(0.3); // avoid mip peak at E = 260 MeV
+  ana->SetMaxEnergy(1000);
+  ana->SetM02(1, 2) ;
+  ana->SwitchOnTrackMatchRejection() ;
+  
+  ana->AddToHistogramsName("EMCTriggerClusters_");
+  SetHistoRangeAndNBins(ana->GetHistogramRanges()); // see method below
+  
+  if(kPrint) ana->Print("");
+  
+  return ana;
+  
+}
+
+//___________________________________________________
+AliAnaClusterPileUp* ConfigureClusterPileUpAnalysis()
+{
+  // For filling all histograms meaninfully, in the reader, time cut must be off
+  // and bad triggered events in different BC not rejected
+  
+  AliAnaClusterPileUp *ana = new AliAnaClusterPileUp();
+  ana->SetDebug(kDebug); //10 for lots of messages
+  
+  // cluster selection cuts
+  
+  ana->SwitchOffFiducialCut();
+  ana->SetNCellCut(1);// At least 2 cells
+  ana->SetMinEnergy(0.3); // avoid mip peak at E = 260 MeV
+  ana->SetMaxEnergy(1000);
+  
+  ana->AddToHistogramsName("ClusterPileUp_");
+  SetHistoRangeAndNBins(ana->GetHistogramRanges()); // see method below
+  
+  if(kPrint) ana->Print("");
+  
+  return ana;
+  
+}
+
 //________________________________________________________________________________
 AliAnaElectron* ConfigureElectronAnalysis()
 {
   
   AliAnaElectron *ana = new AliAnaElectron();
   ana->SetDebug(kDebug); //10 for lots of messages
-    
+  
+  ana->FillAODWithElectrons();
+  //ana->FillAODWithHadrons();
+  //ana->FillAODWithAny();
+  
   if(kCalorimeter == "PHOS")
   {
     ana->SetNCellCut(2);// At least 2 cells
@@ -574,19 +775,23 @@ AliAnaElectron* ConfigureElectronAnalysis()
   
   //Electron selection cuts with tracks
   ana->SetEOverP(0.85, 1.2);
+
   // TO DO, find a more suitable way to set this
-  if(kSimulation)
-  { // LHC11a
-    ana->SetdEdxCut(76, 85);
-  }
-  else // LHC11c
-  {
-    ana->SetdEdxCut(56, 64);
-  }
+  if     (kRunNumber < 146861) ana->SetdEdxCut(72, 90);
+  else if(kRunNumber < 154000) ana->SetdEdxCut(54, 70);
+  else                         ana->SetdEdxCut(74, 90);
+  
+  if(kSimulation)  ana->SetdEdxCut(80, 100);
   
   ana->SetCalorimeter(kCalorimeter);
   
-  ana->SwitchOffCaloPID();
+  ana->SwitchOnCaloPID();
+  
+  AliCaloPID* caloPID = ana->GetCaloPID();
+  
+  caloPID->SetEMCALLambda0CutMax(0.27);
+  caloPID->SetEMCALLambda0CutMin(0.10);
+
   ana->SwitchOffFillShowerShapeHistograms();  
   ana->SwitchOffFillWeightHistograms()  ;
   ana->SwitchOffFiducialCut();
@@ -671,33 +876,103 @@ AliAnaRandomTrigger* ConfigureRandomTriggerAnalysis(TString detector = "")
 }
 
 //__________________________________________________________________________________________
-AliAnaInsideClusterInvariantMass* ConfigureInClusterIMAnalysis(Float_t l0min, Float_t l0max)
+AliAnaInsideClusterInvariantMass* ConfigureInClusterIMAnalysis(Bool_t useSS = kTRUE, Bool_t useAsy = kFALSE)
 {
   AliAnaInsideClusterInvariantMass *ana = new AliAnaInsideClusterInvariantMass();
   ana->SetDebug(kDebug); //10 for lots of messages
   
   // selection cuts
   
-  ana->SetMinEnergy(5); 
-  ana->SetMaxEnergy(200.);   
-  ana->SetMinNCells(3);
-  ana->SetM02Cut(l0min,l0max);
+  ana->SetMinEnergy(6);
+  ana->SetMaxEnergy(200.);
+  ana->SetMinNCells(6); // check same as in calopid
+  
   ana->SetCalorimeter(kCalorimeter);
+  ana->SwitchOnSplitClusterDistToBad();
+  
+  ana->SwitchOffFillSSWeightHistograms() ;
+  ana->SetNWeightForShowerShape(0);
+  //ana->SetWeightForShowerShape(0, 4.6);
+  
+  ana->SwitchOnFillNCellHistograms();
+  ana->SwitchOffFillEbinHistograms();
+  if(!useSS && !useAsy) ana->SwitchOnFillEbinHistograms();
+  
+  if(!kTM)
+  {
+    ana->SwitchOnFillTMHistograms();
+    ana->SwitchOnFillTMResidualHistograms();
+  }
+  else
+  {
+    ana->SwitchOffFillTMHistograms();
+    ana->SwitchOffFillTMResidualHistograms();
+  }
+  
+  //printf("Set correction slope for SS weight \n");
+  //ana->SetWCorrectionParameter(0.07);
+  //ana->SetNECellCutForShowerShape(0);
+  //ana->SetECellCutForShowerShape(0, 0.07);
+  //ana->SetECellCutForShowerShape(1, 0.1);
+  //ana->SetECellCutForShowerShape(2, 0.2);
+  
+  if(kSimulation)
+  {
+    ana->SwitchOnFillMCPrimaryHistograms() ;
+    ana->SwitchOffFillMCOverlapHistograms() ; // Off when possible
+    if(!useSS && !useAsy) ana->SwitchOnFillMCOverlapHistograms() ;
+  }
   
-  //ana->AddToHistogramsName(Form("AnaInClusterIM_%1.2f_%1.2f_",l0min,l0max));
-  ana->AddToHistogramsName("AnaInClusterIM_");
-
-  SetHistoRangeAndNBins(ana->GetHistogramRanges()); // see method below
-    
   AliCaloPID* caloPID = ana->GetCaloPID();
   caloPID->SetEMCALDEtaCut(0.025);
   caloPID->SetEMCALDPhiCut(0.030);
-  caloPID->SetClusterSplittingM02Cut(0,100); // Do the selection in the analysis class and not in the PID method to fill SS histograms
-
-  caloPID->SetPi0MassRange(0.10, 0.18);
+  caloPID->SetClusterSplittingM02Cut(0,100000); // use parametrized cut, not fixed
+  
+  caloPID->SetPi0MassRange(0.11, 0.18);
   caloPID->SetEtaMassRange(0.40, 0.60);
   caloPID->SetPhotonMassRange(0.00, 0.08);
   
+  caloPID->SetSplitWidthSigma(3.); // cut at 3 sigma of the mean pi0 peak.
+  
+  caloPID->SetClusterSplittingMinNCells(6);
+  
+  if(kCollisions=="PbPb" || kName.Contains("150"))
+  {
+    caloPID->SetClusterSplittingMinNCells(4);
+    ana->SetMinNCells(4);
+    caloPID->SetPi0MassShiftHighECell(0.005);
+    if(kCollisions=="PbPb") ana->SwitchOnFillHighMultHistograms();
+  }
+  
+  ana->AddToHistogramsName("AnaInClusterIM_");
+  
+  if(useAsy)
+  {
+    caloPID->SwitchOnSplitAsymmetryCut() ;
+  }
+  else
+  {
+    printf("InClusterIM: Do not apply Asy cut on merged pi0 in cluster analysis \n");
+    caloPID->SwitchOffSplitAsymmetryCut() ;
+    ana->AddToHistogramsName("AnaInClusterIM_OpenAsy_");
+  }
+  
+  if(!useSS)
+  {
+    printf("InClusterIM: Do not apply SS cut on merged pi0 in cluster analysis \n");
+    caloPID->SwitchOffSplitShowerShapeCut() ;
+    ana->AddToHistogramsName("AnaInClusterIM_OpenSS_");
+  }
+  else  caloPID->SwitchOnSplitShowerShapeCut() ;
+  
+  if(!useAsy && !useSS)
+  {
+    printf("InClusterIM: Do not apply SS and Asy cut on merged pi0 in cluster analysis \n");
+    ana->AddToHistogramsName("AnaInClusterIM_OpenSS_OpenAsy_");
+  }
+  
+  SetHistoRangeAndNBins(ana->GetHistogramRanges()); // see method below
+  
   ConfigureMC(ana);
   
   if(kPrint) ana->Print("");
@@ -718,136 +993,119 @@ AliAnaChargedParticles* ConfigureChargedAnalysis()
   ana->SetMinPt(0.5);
   ana->SwitchOnFiducialCut();
   ana->GetFiducialCut()->SetSimpleCTSFiducialCut(0.8, 0, 360) ; //more restrictive cut in reader and after in isolation
-
+  
+  ana->SwitchOnFillVertexBC0Histograms() ;
+  if(!kSimulation) ana->SwitchOnFillPileUpHistograms();
+  
   // Input / output delta AOD settings
   
-  if(!kData.Contains("delta")) 
+  if(!kData.Contains("delta"))
   {
     ana->SetOutputAODName(Form("Hadron%s",kName.Data()));
     ana->SetOutputAODClassName("AliAODPWG4ParticleCorrelation");
     //ana->SetOutputAODClassName("AliAODPWG4Particle"); // use if no correlation done
   }
-  else 
+  else
     ana->SetInputAODName(Form("Hadron%s",kName.Data()));
   printf("Set Hadron%s\n",kName.Data());
+  
   //Set Histograms name tag, bins and ranges
   
   ana->AddToHistogramsName("AnaHadrons_");
   SetHistoRangeAndNBins(ana->GetHistogramRanges()); // see method below
-
+  
   ana->GetHistogramRanges()->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 200) ;
   ana->GetHistogramRanges()->SetHistoEtaRangeAndNBins(-1.5, 1.5, 300) ;
   
   ConfigureMC(ana);
   
   if(kPrint) ana->Print("");
-   
+  
   return ana;
   
 }
 
 
-//_______________________________
-AliAnaPi0* ConfigurePi0Analysis()
+//_____________________________________________________
+AliAnaPi0EbE* ConfigurePi0EbEAnalysis(TString particle,
+                                      Int_t analysis, Bool_t useSS = kTRUE, Bool_t useAsy = kTRUE)
 {
   
-  AliAnaPi0 *ana = new AliAnaPi0();
-  
+  AliAnaPi0EbE *ana = new AliAnaPi0EbE();
   ana->SetDebug(kDebug);//10 for lots of messages
   
-  // Input delta AOD settings
-  ana->SetInputAODName(Form("Photon%s",kName.Data()));
+  ana->SetAnalysisType(analysis);
+  TString opt = "";
+  if(analysis == AliAnaPi0EbE::kIMCaloTracks) opt = "Conv";
+  if(analysis == AliAnaPi0EbE::kSSCalo)       opt = "SS";
+  
+  if(analysis == AliAnaPi0EbE::kIMCalo && kCalorimeter=="EMCAL" && !kSimulation) ana->SetPairTimeCut(100);
+  if(analysis == AliAnaPi0EbE::kIMCaloTracks) ana->SetInputAODGammaConvName("PhotonsCTS");
+
+  // Common settings for all 3 type of analysis
   
-  // Calorimeter settings
+  ana->SwitchOnSelectedClusterHistoFill();
+
   ana->SetCalorimeter(kCalorimeter);
-  if(kCalorimeter=="PHOS") ana->SetNumberOfModules(3); //PHOS first year
-  else 
-  {                   
-    if     (kYears == 2010) ana->SetNumberOfModules( 4); // EMCAL first year
-    else if(kYears == 2011) ana->SetNumberOfModules(10); // Second year
-    else                    ana->SetNumberOfModules(12);
-  }
   
-  //settings for pp collision mixing
-  ana->SwitchOnOwnMix(); //Off when mixing done with general mixing frame
+  //Set Histograms name tag, bins and ranges
+  ana->AddToHistogramsName(Form("Ana%s%sEbE_TM%d_",particle.Data(),opt.Data(),kTM));
   
-  // Cuts 
-  if(kCalorimeter=="EMCAL") ana->SetPairTimeCut(70);
+  // Specific settings for different type of analysis
   
-  if     (kCollisions=="pp"  ) 
+  ana->SwitchOffFillWeightHistograms();
+  if(!kSimulation) ana->SwitchOnFillPileUpHistograms();
+  
+  if(kTM)
   {
-    ana->SetNCentrBin(1);
-    ana->SetNZvertBin(10);
-    ana->SetNRPBin(1);
-    ana->SetNMaxEvMix(100);    
-    ana->SwitchOnSMCombinations();
+    //printf("--->>>REMOVE MATCHED Pi0\n");
+    ana->SwitchOnTrackMatchRejection() ;
+    ana->SwitchOffTMHistoFill() ;
   }
-  else if(kCollisions=="PbPb") 
+  else
   {
-    ana->SetNCentrBin(10);
-    ana->SetNZvertBin(10);
-    ana->SetNRPBin(4);
-    ana->SetNMaxEvMix(10);
-    ana->SwitchOffSMCombinations();
+    //printf("---->>>ACCEPT MATCHED Pi0\n");
+    ana->SwitchOffTrackMatchRejection() ;
+    ana->SwitchOnTMHistoFill() ;
   }
-
-  ana->SwitchOffMultipleCutAnalysis();
-
-  //Set Histograms name tag, bins and ranges
   
-  ana->AddToHistogramsName(Form("AnaPi0_TM%d_",kTM));
   SetHistoRangeAndNBins(ana->GetHistogramRanges()); // see method below
-
-  ConfigureMC(ana);
   
-  if(kPrint) ana->Print("");
+  //ana->SwitchOnFillEMCALBCHistograms();
   
-  return ana;
+  if(kPrint) ana->Print("");
   
-}
+  ConfigureMC(ana);
 
-//_____________________________________________________
-AliAnaPi0EbE* ConfigurePi0EbEAnalysis(TString particle, 
-                                      Int_t analysis)
-{
-  
-  AliAnaPi0EbE *ana = new AliAnaPi0EbE();
-  ana->SetDebug(kDebug);//10 for lots of messages
-  
-  ana->SetAnalysisType(analysis);
-  TString opt = "";
-  if(analysis==AliAnaPi0EbE::kIMCaloTracks) opt = "Conv";
-  if(analysis==AliAnaPi0EbE::kSSCalo)       opt = "SS";
-  
-  ana->SetMinPt(0.5);
-  
-  if(kCalorimeter=="EMCAL")ana->SetPairTimeCut(15); // More strict than in pi0 inv mass analysis
-  
-  ana->SetCalorimeter(kCalorimeter);
-  
-  // Input / output delta AOD settings
-  
-  ana->SetInputAODName(Form("Photon%s",kName.Data()));
-  if(!kInputDataType.Contains("delta")) 
+  if(!kInputDataType.Contains("delta"))
   {
     ana->SetOutputAODName(Form("%s%s%s",particle.Data(), opt.Data(), kName.Data()));
     ana->SetOutputAODClassName("AliAODPWG4ParticleCorrelation");
+    
   }
-  else  
+  else
     ana->SetInputAODName(Form("%s%s%s",particle.Data(),opt.Data(),kName.Data()));
   
-  if(analysis == AliAnaPi0EbE::kIMCaloTracks) ana->SetInputAODGammaConvName("PhotonsCTS");
-  
   if(analysis!=AliAnaPi0EbE::kSSCalo)
   {
+    // Input / output delta AOD settings
+    
+    ana->SetInputAODName(Form("Photon%s",kName.Data()));
+    
     AliNeutralMesonSelection *nms = ana->GetNeutralMesonSelection();
     nms->SetParticle(particle);
     
     // Tighten a bit mass cut with respect to default window
     if(particle=="Pi0") nms->SetInvMassCutRange(0.120,0.150);
-    if(particle=="Eta") nms->SetInvMassCutRange(0.520,0.580);    
+    if(particle=="Eta") nms->SetInvMassCutRange(0.520,0.580);
+    
+    //if(!particle.Contains("SideBand")) nms->SwitchOnAngleSelection();
+    //else nms->SwitchOnAngleSelection();
+    
+    nms->SwitchOffAngleSelection();
+    if(particle.Contains("Pi0SideBand")) // For pi0, do not consider left band
+      nms->SetSideBandCutRanges(-1,0,0.180,0.220);
     
-    nms->SwitchOnAngleSelection();
     nms->KeepNeutralMesonSelectionHistos(kTRUE);
     //nms->SetAngleMaxParam(2,0.2);
     nms->SetHistoERangeAndNBins(0, 20, 80) ;
@@ -855,29 +1113,73 @@ AliAnaPi0EbE* ConfigurePi0EbEAnalysis(TString particle,
   }
   else
   { // cluster splitting settings
-    ana->SetTimeCut(-1000,1000); // Open time cut
+    ana->SetMinEnergy(6);
+    ana->SetMaxEnergy(200.);
+    
+    ana->SetNLMMinEnergy(0, 10);
+    ana->SetNLMMinEnergy(1, 6);
+    ana->SetNLMMinEnergy(2, 6);
+    
+    ana->SetMinDistanceToBadChannel(2, 4, 6); // only use the first one
+    ana->SwitchOnSplitClusterDistToBad();
+    
+    ana->SetTimeCut(-1e10,1e10); // Open time cut
+
+    // NLM cut, used in all, exclude clusters with more than 2 maxima
+    ana->SetNLMCut(1, 2) ;
+    
     AliCaloPID* caloPID = ana->GetCaloPID();
+    
+    caloPID->SetSplitWidthSigma(3.); // cut at 3 sigma of the mean pi0 peak.
+    
+    if(!useSS)
+    {
+      printf("Do not apply SS cut on merged pi0 analysis \n");
+      caloPID->SwitchOffSplitShowerShapeCut() ;
+      ana->AddToHistogramsName(Form("Ana%s%sEbE_OpenSS_TM%d_",particle.Data(),opt.Data(),kTM));
+      ana->SetOutputAODName(Form("%s%s%s_OpenSS",particle.Data(), opt.Data(), kName.Data()));
+      caloPID->SetClusterSplittingM02Cut(0.1,10000); 
+    }
+    else
+    {
+      caloPID->SetClusterSplittingM02Cut(0.3,5); // Do the selection in the analysis class and not in the PID method to fill SS histograms
+      caloPID->SwitchOnSplitShowerShapeCut() ;
+    }
+    
+    if(useAsy) caloPID->SwitchOnSplitAsymmetryCut() ;
+    else
+    {
+      caloPID->SwitchOffSplitAsymmetryCut() ;
+      if(!useSS)
+      {
+        ana->AddToHistogramsName(Form("Ana%s%sEbE_OpenSS_OpenAsy_TM%d_",particle.Data(),opt.Data(),kTM));
+        ana->SetOutputAODName(Form("%s%s%s_OpenSS_OpenAsy",particle.Data(), opt.Data(), kName.Data()));
+      }
+      else
+      {
+        ana->AddToHistogramsName(Form("Ana%s%sEbE_OpenAsy_TM%d_",particle.Data(),opt.Data(),kTM));
+        ana->SetOutputAODName(Form("%s%s%s_OpenAsy",particle.Data(), opt.Data(), kName.Data()));
+      }
+    }
+    
+    //For Pi0 only if  SwitchOnSimpleSplitMassCut()
     caloPID->SetPi0MassRange(0.10, 0.18);
     caloPID->SetEtaMassRange(0.40, 0.60);
     caloPID->SetPhotonMassRange(0.00, 0.08);
-    caloPID->SetClusterSplittingM02Cut(0.5,100); // Do the selection in the analysis class and not in the PID method to fill SS histograms
+    
+    caloPID->SetClusterSplittingMinNCells(6);
+    
+    //caloPID->SetSplitEnergyFractionMinimum(0, 0.95);
+    //caloPID->SetSplitEnergyFractionMinimum(1, 0.95);
+    //caloPID->SetSplitEnergyFractionMinimum(2, 0.8);
+    
+    if(kCollisions=="PbPb" || kName.Contains("150"))
+    {
+      caloPID->SetClusterSplittingMinNCells(4);
+      caloPID->SetPi0MassShiftHighECell(0.005);
+    }
   }
   
-  ana->SwitchOffSelectedClusterHistoFill(); 
-  ana->SwitchOffFillWeightHistograms();
-  
-  if(!kTM) ana->SwitchOnTMHistoFill();
-  else     ana->SwitchOffTMHistoFill();
-  
-  //Set Histograms name tag, bins and ranges
-  
-  ana->AddToHistogramsName(Form("Ana%s%sEbE_TM%d_",particle.Data(),opt.Data(),kTM));
-  SetHistoRangeAndNBins(ana->GetHistogramRanges()); // see method below
-  
-  ConfigureMC(ana);
-  
-  if(kPrint) ana->Print("");
-  
   return  ana;
   
 }
@@ -909,7 +1211,7 @@ AliAnaParticleIsolation* ConfigureIsolationAnalysis(TString particle="Photon",
       ana->GetFiducialCut()->SetSimpleCTSFiducialCut  (0.6, 0, 360) ;    
   }
   
-  ana->SetMinPt(4);
+  ana->SetMinPt(5);
   
   // Input / output delta AOD settings
   
@@ -922,7 +1224,8 @@ AliAnaParticleIsolation* ConfigureIsolationAnalysis(TString particle="Photon",
   else      ana->SwitchOffTMHistoFill();
   
   ana->SwitchOffSSHistoFill();
-  
+  if(!kSimulation) ana->SwitchOnFillPileUpHistograms();
+
   //Do settings for main isolation cut class
   AliIsolationCut * ic =  ana->GetIsolationCut();      
   ic->SetDebug(kDebug);
@@ -941,7 +1244,7 @@ AliAnaParticleIsolation* ConfigureIsolationAnalysis(TString particle="Photon",
     }
     if(kCollisions=="PbPb")
     {
-      ic->SetPtThreshold(2.);
+      ic->SetPtThreshold(3.);
       //ic->SetPtThreshold(1.);
       ic->SetConeSize(0.3);
     }
@@ -989,15 +1292,13 @@ AliAnaParticleIsolation* ConfigureIsolationAnalysis(TString particle="Photon",
 
   SetHistoRangeAndNBins(ana->GetHistogramRanges()); // see method below
   
-  ana->SetHistoPtInConeRangeAndNBins(0, 50 , 250);
-  ana->SetHistoPtSumRangeAndNBins   (0, 100, 250);
-  
   if(particle=="Hadron"  || particle.Contains("CTS"))
   {
     ana->GetHistogramRanges()->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 200) ;
     ana->GetHistogramRanges()->SetHistoEtaRangeAndNBins(-1.5, 1.5, 300) ;
   }
   
+  ana->SwitchOnRealCaloAcceptance(); // primary particle acceptance histograms
   ConfigureMC(ana);
   
   if(kPrint) ic ->Print("");
@@ -1009,7 +1310,7 @@ AliAnaParticleIsolation* ConfigureIsolationAnalysis(TString particle="Photon",
 
 //___________________________________________________________________________________
 AliAnaParticleHadronCorrelation* ConfigureHadronCorrelationAnalysis(TString particle, 
-                                                                    Int_t bIsolated,                                                                    
+                                                                    Bool_t bIsolated,
                                                                     Int_t  partInCone = AliIsolationCut::kOnlyCharged,
                                                                     Int_t  thresType  = AliIsolationCut::kSumPtFracIC,
                                                                     Float_t cone = 0.3,
@@ -1019,8 +1320,8 @@ AliAnaParticleHadronCorrelation* ConfigureHadronCorrelationAnalysis(TString part
   AliAnaParticleHadronCorrelation *ana = new AliAnaParticleHadronCorrelation();
   ana->SetDebug(kDebug);
   
-  ana->SetMinimumTriggerPt(4);
-  ana->SetAssociatedPtRange(0.2,200); 
+  ana->SetMinimumTriggerPt(5);
+  ana->SetAssociatedPtRange(0.2,100); 
   ana->SetDeltaPhiCutRange( TMath::Pi()/2,3*TMath::Pi()/2 ); //[90 deg, 270 deg]
   
   ana->SetNAssocPtBins(9);
@@ -1058,7 +1359,7 @@ AliAnaParticleHadronCorrelation* ConfigureHadronCorrelationAnalysis(TString part
       }
       if(kCollisions=="PbPb")
       {
-        ic->SetPtThreshold(2.);
+        ic->SetPtThreshold(3.);
         //ic->SetPtThreshold(1.);
         ic->SetConeSize(0.3);
       }
@@ -1075,24 +1376,35 @@ AliAnaParticleHadronCorrelation* ConfigureHadronCorrelationAnalysis(TString part
   ana->SwitchOffNearSideLeading(); // Select trigger leading particle of all the particles at +-90 degrees, default
   
   // Mixing with own pool
-  if(kMix)ana->SwitchOnOwnMix();
-  else    ana->SwitchOffOwnMix();
+  if(kMix)
+  {
+    ana->SwitchOnOwnMix();
+    ana->SwitchOnFillNeutralInMixedEvent();
+  }
+  else
+    ana->SwitchOffOwnMix();
   
-  ana->SetNZvertBin(4);
+  ana->SetNZvertBin(20);
   
   if(kCollisions=="pp")
   {
-    ana->SetNMaxEvMix(10);    
+    ana->SetNMaxEvMix(100);    
     ana->SwitchOnTrackMultBins();
     ana->SetNCentrBin(9); // Fixed track mult values
     ana->SetNRPBin(1);
   }
   else 
   {
-    ana->SetNMaxEvMix(5);    
+    ana->SetNMaxEvMix(10);    
     ana->SwitchOffTrackMultBins(); // centrality bins
     ana->SetNCentrBin(3); 
     ana->SetNRPBin(3);
+    if(kName.Contains("60_90"))
+    {
+      printf("*** Set mixing for peripheral\n");
+      ana->SetNMaxEvMix(50);    
+      ana->SetNCentrBin(2); 
+    }    
   }  
   
   ana->SwitchOnFiducialCut();
@@ -1120,10 +1432,9 @@ AliAnaParticleHadronCorrelation* ConfigureHadronCorrelationAnalysis(TString part
   // If trigger is photon, check if it was tagged as decay previously
   if(particle!="Hadron" )
   {
-    if(particle=="Pi0" || particle =="Eta") 
+    if(particle.Contains("Pi0") || particle.Contains("Eta"))
     {
-      if(!particle.Contains("SS")) ana->SwitchOnPi0TriggerDecayCorr();
-      else                         ana->SwitchOffPi0TriggerDecayCorr();
+      ana->SwitchOffPi0TriggerDecayCorr();
       ana->SwitchOffDecayTriggerDecayCorr();
     }
     else
@@ -1141,7 +1452,7 @@ AliAnaParticleHadronCorrelation* ConfigureHadronCorrelationAnalysis(TString part
   if(particle=="Photon")
   {
     printf("**** SET M02 limits *** \n");
-    ana->SetM02Cut(0.15,0.3);
+    ana->SetM02Cut(0.1,0.27);
   }
   
   // if triggering on PHOS and EMCAL is on
@@ -1185,7 +1496,7 @@ AliAnaCalorimeterQA* ConfigureQAAnalysis()
   ana->SetDebug(kDebug); //10 for lots of messages
   ana->SetCalorimeter(kCalorimeter);
   
-  ana->SetTimeCut(-1000,1000); // Open time cut
+  ana->SetTimeCut(-1e10,1e10); // Open time cut
   
   // Study inter detector correlation (PHOS, EMCAL, Tracks, V0)
   if(kCalorimeter=="PHOS"  && kTrig=="PHOS")
@@ -1209,18 +1520,7 @@ AliAnaCalorimeterQA* ConfigureQAAnalysis()
   ana->SwitchOffStudyClustersAsymmetry();
   ana->SwitchOffStudyWeight();
   ana->SwitchOnFillAllTrackMatchingHistogram();
-  ana->SwitchOffFillAllCellTimeHisto() ;
-
-  if(kCalorimeter=="EMCAL")
-  {
-    if     (kYears==2010)  ana->SetNumberOfModules(4); 
-    else if(kYears==2011)  ana->SetNumberOfModules(10);
-    else                   ana->SetNumberOfModules(12); 
-  }
-  else 
-  {//PHOS
-    ana->SetNumberOfModules(3); 
-  }
+  ana->SwitchOnFillAllCellTimeHisto() ;
   
   ana->AddToHistogramsName("QA_"); //Begining of histograms name
   SetHistoRangeAndNBins(ana->GetHistogramRanges()); // see method below
@@ -1233,6 +1533,42 @@ AliAnaCalorimeterQA* ConfigureQAAnalysis()
   
 }
 
+//________________________________________________________________
+AliAnaGeneratorKine* ConfigureGenKineAnalysis()
+{
+  // Analysis for parton, jets correlation with photon and pi0
+  
+  AliAnaGeneratorKine *ana = new AliAnaGeneratorKine();
+  ana->SetDebug(kDebug); //10 for lots of messages
+  
+  // Minimum particles energy
+  ana->SetMinPt(10); // Trigger photon, pi0 minimum pT
+  ana->SetMinChargedPt(0.2);
+  ana->SetMinNeutralPt(0.3);
+  
+  // Detectors acceptance
+  ana->SetCalorimeter("EMCAL");
+  ana->SetTriggerDetector("EMCAL");
+  
+  ana->GetFiducialCut()->SetSimpleEMCALFiducialCut(0.65, 81, 179);
+  ana->GetFiducialCut()->SetSimpleCTSFiducialCut(0.9, 0, 360);
+  
+  AliIsolationCut * ic =  ana->GetIsolationCut();
+  ic->SetDebug(kDebug);
+  ic->SetPtThreshold(0.5);
+  ic->SetConeSize(0.5);
+  ic->SetSumPtThreshold(1.0) ;
+  ic->SetICMethod(AliIsolationCut::kPtThresIC); // kSumPtIC
+  
+  ana->AddToHistogramsName("AnaGenKine_");
+  SetHistoRangeAndNBins(ana->GetHistogramRanges()); // see method below
+  
+  if(kPrint) ana->Print("");
+  
+  return ana;
+  
+}
+
 //________________________________________________________
 void ConfigureMC(AliAnaCaloTrackCorrBaseClass* ana)
 {
@@ -1295,24 +1631,28 @@ void SetHistoRangeAndNBins (AliHistogramRanges* histoRanges)
   histoRanges->SetHistodRRangeAndNBins(0.,0.15,150);//QA
 
   // QA, electron, charged
-  histoRanges->SetHistoPOverERangeAndNBins(0,10.,100);
-  histoRanges->SetHistodEdxRangeAndNBins(0.,200.,200);
+  histoRanges->SetHistoPOverERangeAndNBins(0,  2.5 ,500);
+  histoRanges->SetHistodEdxRangeAndNBins  (0.,250.0,500);
   
   // QA
   histoRanges->SetHistoFinePtRangeAndNBins(0, 10, 200) ; // bining for fhAmpId
   histoRanges->SetHistoRatioRangeAndNBins(0.,2.,100);
   histoRanges->SetHistoVertexDistRangeAndNBins(0.,500.,500);
-  histoRanges->SetHistoNClusterCellRangeAndNBins(0,500,500);
+  histoRanges->SetHistoNClusterCellRangeAndNBins(0,50,50);
   histoRanges->SetHistoZRangeAndNBins(-400,400,200);
   histoRanges->SetHistoRRangeAndNBins(400,450,25);
   histoRanges->SetHistoV0SignalRangeAndNBins(0,5000,500);
   histoRanges->SetHistoV0MultiplicityRangeAndNBins(0,5000,500);
   histoRanges->SetHistoTrackMultiplicityRangeAndNBins(0,5000,500);
   
+  // Isolation
+  histoRanges->SetHistoPtInConeRangeAndNBins(0, 50 , 250);
+  histoRanges->SetHistoPtSumRangeAndNBins   (0, 100, 250);
+  
 }
 
-//_________________
-Int_t TriggerMask()
+//_____________________________
+UInt_t SetTriggerMaskFromName()
 {
   if(kTrig=="EMC7")
   {
@@ -1367,17 +1707,22 @@ Int_t TriggerMask()
   else if(kTrig=="Central")
   {
     printf("CaloTrackCorr trigger Central\n");
-    return AliVEvent::kCentral;
-  } 
+    return (AliVEvent::kCentral  | AliVEvent::kMB);
+  }
+  else if(kTrig=="CentralEGA")
+  {
+    printf("CaloTrackCorr trigger Central+EMCEGA\n");
+    return (AliVEvent::kCentral | AliVEvent::kEMCEGA);
+  }
   else if(kTrig=="SemiCentral")
   {
     printf("CaloTrackCorr trigger SemiCentral\n");
-    return AliVEvent::kSemiCentral;
+    return (AliVEvent::kSemiCentral | AliVEvent::kMB);
   }
   else if(kTrig=="SemiOrCentral")
   {
     printf("CaloTrackCorr trigger SemiCentral Or Central\n");
-    return (AliVEvent::kSemiCentral | AliVEvent::kCentral);
-  }    
+    return (AliVEvent::kSemiCentral | AliVEvent::kCentral  | AliVEvent::kMB);
+  }
 }