]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
update macros after last changes
authorgconesab <gconesab@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 15 Mar 2012 15:20:27 +0000 (15:20 +0000)
committergconesab <gconesab@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 15 Mar 2012 15:20:27 +0000 (15:20 +0000)
PWGGA/CaloTrackCorrelations/macros/AddTaskCaloTrackCorr.C
PWGGA/CaloTrackCorrelations/macros/QA/AddTaskCalorimeterQA.C
PWGGA/CaloTrackCorrelations/macros/ana.C
PWGGA/EMCALTasks/macros/AddTaskEMCALClusterize.C
PWGGA/EMCALTasks/macros/ConfigureEMCALRecoUtils.C

index e3022349860d5f532ac7e5550671802674ec9388..00ad2aaa90248f95610a77bb69ae75685285e891 100644 (file)
@@ -3,7 +3,9 @@ Bool_t  kPrint         = kFALSE;
 Bool_t  kSimulation    = kFALSE;
 Bool_t  kUseKinematics = kFALSE;
 Bool_t  kOutputAOD     = kFALSE;
-Int_t   kRunNumber     = 0;
+Bool_t  kEventSelection= kFALSE;
+Bool_t  kExotic        = kTRUE;
+Bool_t  kNonLinearity  = kFALSE;
 Int_t   kYears         = 2011;
 TString kCollisions    = "pp";
 TString kTrig          = "EMC7" ;
@@ -11,59 +13,93 @@ TString kClusterArray  = "";
 TString kData          = "ESD";
 TString kInputDataType = "ESD";
 TString kCalorimeter   = "EMCAL";
-
-AliAnalysisTaskCaloTrackCorrelation *AddTaskCaloTrackCorr(
-                                                    const TString data          = "AOD",
-                                                    const TString calorimeter   = "EMCAL", 
-                                                    const Bool_t  printSettings = kFALSE,
-                                                    const Bool_t  simulation    = kFALSE,
-                                                    const Bool_t  outputAOD     = kFALSE, 
-                                                    const TString outputfile    = "",
-                                                    const Int_t   year          = 2010,
-                                                    const Int_t   run           = 0,
-                                                    const TString col           = "pp", 
-                                                    const TString trigger       = "MB", 
-                                                    const TString clustersArray = "V1" 
-                                                    )
+Bool_t  kTM            = kTRUE;
+Bool_t  kRecalTM       = kTRUE;
+Int_t   kMinCen        = -1;
+Int_t   kMaxCen        = -1;
+TString kName          = "";
+Int_t   kDebug         = -1; 
+Bool_t  kQA            = kFALSE;
+Bool_t  kHadronAN      = kFALSE;
+AliAnalysisTaskCaloTrackCorrelation *AddTaskCaloTrackCorr(const TString data          = "AOD",
+                                                          const TString calorimeter   = "EMCAL", 
+                                                          const Bool_t  simulation    = kFALSE,
+                                                          const Bool_t  eventsel      = kFALSE,
+                                                          const Bool_t  exotic        = kTRUE,
+                                                          const Bool_t  nonlin        = kFALSE,
+                                                          TString       outputfile    = "",
+                                                          const Int_t   year          = 2010,
+                                                          const TString col           = "pp", 
+                                                          const TString trigger       = "MB", 
+                                                          const TString clustersArray = "V1",
+                                                          const Bool_t  recaltm       = kTRUE,
+                                                          const Bool_t  tm            = kTRUE,
+                                                          const Int_t   minCen        = -1,
+                                                          const Int_t   maxCen        = -1,
+                                                          const Bool_t  qaan          = kFALSE,
+                                                          const Bool_t  hadronan      = kFALSE,
+                                                          const Bool_t  outputAOD     = kFALSE, 
+                                                          const Bool_t  printSettings = kFALSE
+                                                          )
 {
   // Creates a CaloTrackCorr task, configures it and adds it to the analysis manager.
   
   kPrint         = printSettings;
   kSimulation    = simulation;
-  kRunNumber     = run;
   kYears         = year;
   kCollisions    = col;
+  kExotic        = exotic;
+  kNonLinearity  = nonlin;
   kTrig          = trigger;
   kClusterArray  = clustersArray;
   kData          = data;
   kCalorimeter   = calorimeter;
   kOutputAOD     = outputAOD;
+  kTM            = tm;
+  kRecalTM       = recaltm;
+  kMinCen        = minCen;
+  kMaxCen        = maxCen;
+  kEventSelection= eventsel;
+  kQA            = qaan;
+  kHadronAN      = hadronan;
   
   // Get the pointer to the existing analysis manager via the static access method.
   
   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
-  if (!mgr) {
+  if (!mgr) 
+  {
     ::Error("AddTask", "No analysis manager to connect to.");
     return NULL;
   }  
   
   // Check the analysis type using the event handlers connected to the analysis manager.
   
-  if (!mgr->GetInputEventHandler()) {
+  if (!mgr->GetInputEventHandler()) 
+  {
     ::Error("AddTask", "This task requires an input event handler");
     return NULL;
   }
+  
   kInputDataType = "AOD";
   if(!kData.Contains("delta"))
     kInputDataType = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
   
-  if(kSimulation) { 
+  if(kSimulation) 
+  { 
     kUseKinematics = (mgr->GetMCtruthEventHandler())?kTRUE:kFALSE; 
     if (!kUseKinematics && data=="AOD" && kInputDataType != "ESD") kUseKinematics = kTRUE; //AOD primary should be available ... 
   } 
   
   cout<<"********* ACCESS KINE? "<<kUseKinematics<<endl;
   
+  // Name for containers
+  
+  kName = Form("%s_Trig%s_Cl%s_TM%d",kCalorimeter.Data(), kTrig.Data(),kClusterArray.Data(),kTM);
+
+  if(kCollisions=="PbPb" && kMaxCen>=0) kName+=Form("Cen%d_%d",kMinCen,kMaxCen);
+    
+  printf("<<<< NAME: %s >>>>>\n",kName.Data());
+  
   // #### Configure analysis ####
     
   AliAnaCaloTrackCorrMaker * maker = new AliAnaCaloTrackCorrMaker();
@@ -74,71 +110,72 @@ AliAnalysisTaskCaloTrackCorrelation *AddTaskCaloTrackCorr(
   
   // Analysis tasks setting and configuration
   Int_t n = 0;//Analysis number, order is important
-  maker->AddAnalysis(ConfigureQAAnalysis()    , n++);  
 
   // Isolation settings
   Int_t partInCone = AliIsolationCut::kNeutralAndCharged; // kOnlyCharged;
-  Int_t thresType  = AliIsolationCut::kSumPtFracIC;       // kPtThresIC;
+  Int_t thresType  = AliIsolationCut::kPtThresIC;// PbPb
+  if(kCollisions=="pp") thresType = AliIsolationCut::kSumPtFracIC ; 
+  
+  
+  maker->AddAnalysis(ConfigurePhotonAnalysis(), n++); // Photon cluster selection
+  maker->AddAnalysis(ConfigurePi0EbEAnalysis("Pi0", AliAnaPi0EbE::kIMCalo), n++); // Pi0 event by event selection, and photon tagging from decay    
+  //maker->AddAnalysis(ConfigurePi0EbEAnalysis("Eta", AliAnaPi0EbE::kIMCalo), n++); // Eta event by event selection, and photon tagging from decay
+
+  maker->AddAnalysis(ConfigureIsolationAnalysis("Photon", partInCone,thresType), n++); // Photon isolation   
+  maker->AddAnalysis(ConfigureIsolationAnalysis("Pi0", partInCone,thresType), n++);    // Pi0 isolation   
+
+  maker->AddAnalysis(ConfigureHadronCorrelationAnalysis("Photon",kFALSE), n++); // Gamma hadron correlation
+  maker->AddAnalysis(ConfigureHadronCorrelationAnalysis("Photon",kTRUE) , n++); // Isolated gamma hadron correlation
+  maker->AddAnalysis(ConfigureHadronCorrelationAnalysis("Pi0"   ,kFALSE), n++); // Pi0 hadron correlation
+  maker->AddAnalysis(ConfigureHadronCorrelationAnalysis("Pi0"   ,kTRUE) , n++); // Isolated pi0 hadron correlation
   
-  if(kClusterArray==""  && kCalorimeter!="PHOS")
+  if(kQA)                  maker->AddAnalysis(ConfigureQAAnalysis(),n++);
+  if(kCalorimeter=="EMCAL")maker->AddAnalysis(ConfigureInClusterIMAnalysis(0.5,3), n++); 
+  
+  if(kHadronAN)
   {
-    //Trigger on tracks, do only once, tracks do not depend on clusterizer
     maker->AddAnalysis(ConfigureChargedAnalysis(), n++);                                // track selection
-    maker->AddAnalysis(ConfigureIsolationAnalysis("Hadron",partInCone,thresType), n++); // track isolation
+    maker->AddAnalysis(ConfigureIsolationAnalysis("Hadron",AliIsolationCut::kOnlyCharged,thresType), n++); // track isolation
     maker->AddAnalysis(ConfigureHadronCorrelationAnalysis("Hadron",kFALSE), n++);       // track-track correlation
     maker->AddAnalysis(ConfigureHadronCorrelationAnalysis("Hadron",kTRUE) , n++);       // Isolated track-track correlation
-  } 
-  else
-  {
-    maker->AddAnalysis(ConfigurePhotonAnalysis(), n++); // Photon cluster selection
-    maker->AddAnalysis(ConfigurePi0Analysis()   , n++); // Pi0 invariant mass analysis
-    maker->AddAnalysis(ConfigurePi0EbEAnalysis("Pi0", AliAnaPi0EbE::kIMCalo), n++); // Pi0 event by event selection, and photon tagging from decay
-    maker->AddAnalysis(ConfigurePi0EbEAnalysis("Eta", AliAnaPi0EbE::kIMCalo), n++); // Eta event by event selection, and photon tagging from decay
-    
-    maker->AddAnalysis(ConfigureIsolationAnalysis("Photon", partInCone,thresType), n++); // Photon isolation
-    maker->AddAnalysis(ConfigureIsolationAnalysis("Pi0",    partInCone,thresType), n++); // Pi0 isolation
-  
-    maker->AddAnalysis(ConfigureHadronCorrelationAnalysis("Photon",kFALSE), n++); // Gamma hadron correlation
-    maker->AddAnalysis(ConfigureHadronCorrelationAnalysis("Photon",kTRUE) , n++); // Isolated gamma hadron correlation
-    maker->AddAnalysis(ConfigureHadronCorrelationAnalysis("Pi0"   ,kFALSE), n++); // Pi0 hadron correlation
-    maker->AddAnalysis(ConfigureHadronCorrelationAnalysis("Pi0"   ,kTRUE) , n++); // Isolated pi0 hadron correlation
-    /*
-    if(kInputDataType=="ESD"){
-      printf("* Configure conversion analysis in part corr\n");
-      maker->AddAnalysis(ConfigurePi0EbEAnalysis("Pi0", AliAnaPi0EbE::kIMCaloTracks), n++); // Pi0 (calo+conversion) event by event selection, 
-      // and photon tagging from decay, need to execute at the same time conversions analysis
-      maker->AddAnalysis(ConfigureIsolationAnalysis("Pi0Conv",partInCone,thresType), n++); // Pi0 (Calo+Conv) isolation
-    }
-    */
   }
-
-  maker->SetAnaDebug(-1)  ;
+  
+  //maker->AddAnalysis(ConfigureIsolationAnalysis("Photon", partInCone,thresType,kTRUE), n++); // Photon multi isolation   
+  //maker->AddAnalysis(ConfigureIsolationAnalysis("Pi0",    partInCone,thresType,kTRUE), n++); // Pi0 multi isolation   
+  //if(kHadronAN) 
+  //  maker->AddAnalysis(ConfigureIsolationAnalysis("Hadron",partInCone,thresType,kTRUE), n++);
+  
+  maker->SetAnaDebug(kDebug)  ;
   maker->SwitchOnHistogramsMaker()  ;
   if(kData.Contains("delta")) maker->SwitchOffAODsMaker() ;
   else                        maker->SwitchOnAODsMaker()  ;
-       
+  
   if(kPrint) maker->Print("");
   
   printf("<< End Configuration of %d analysis for calorimeter %s >>\n",n, kCalorimeter.Data());
-  
+  // CAREFUL
+  //kName = Form("%s_Trig%s_Cl%s_TM%d",kCalorimeter.Data(), kTrig.Data(),kClusterArray.Data(),kFALSE);
+  kName = Form("%s_Trig%s_Cl%s",kCalorimeter.Data(), kTrig.Data(),kClusterArray.Data());
+  if(kCollisions=="PbPb" && kMaxCen>=0) kName+=Form("Cen%d_%d",kMinCen,kMaxCen);
+
   // Create task
   
-  AliAnalysisTaskCaloTrackCorrelation * task = new AliAnalysisTaskCaloTrackCorrelation (Form("PartCorr%s_Trig%s_Cl%s",kCalorimeter.Data(),kTrig.Data(),kClusterArray.Data()));
+  AliAnalysisTaskCaloTrackCorrelation * task = new AliAnalysisTaskCaloTrackCorrelation (Form("CaloTrackCorr%s",kName.Data()));
   task->SetConfigFileName(""); //Don't configure the analysis via configuration file.
-  //task->SetDebugLevel(-1);
-  task->SetBranches("ESD:AliESDRun.,AliESDHeader"); //just a trick to get Constantin's analysis to work
+  task->SetDebugLevel(kDebug);
+  task->SetBranches("ESD:AliESDRun.,AliESDHeader"); 
   task->SetAnalysisMaker(maker);
   mgr->AddTask(task);
   
   //Create containers
   
-  if(outputfile.Length()==0)outputfile = AliAnalysisManager::GetCommonFileName(); 
+  if(outputfile.Length()==0) outputfile = AliAnalysisManager::GetCommonFileName(); 
   
-  AliAnalysisDataContainer *cout_pc   = mgr->CreateContainer(Form("%s_Trig%s_Cl%s",kCalorimeter.Data(),kTrig.Data(),kClusterArray.Data()), TList::Class(), 
+  AliAnalysisDataContainer *cout_pc   = mgr->CreateContainer(kName, TList::Class(), 
                                                              AliAnalysisManager::kOutputContainer, 
                                                              Form("%s",outputfile.Data()));
        
-  AliAnalysisDataContainer *cout_cuts = mgr->CreateContainer(Form("%sCuts_Trig%s_Cl%s",kCalorimeter.Data(),kTrig.Data(), kClusterArray.Data()), TList::Class(), 
+  AliAnalysisDataContainer *cout_cuts = mgr->CreateContainer(Form("Cuts_%s",kName.Data()), TList::Class(), 
                                                              AliAnalysisManager::kParamContainer, 
                                                              Form("%s",outputfile.Data()));
   // Create ONLY the output containers for the data produced by the task.
@@ -152,24 +189,58 @@ AliAnalysisTaskCaloTrackCorrelation *AddTaskCaloTrackCorr(
   
   
   if(kTrig=="EMC7"){
-    printf("PartCorr trigger EMC7\n");
+    printf("CaloTrackCorr trigger EMC7\n");
     task->SelectCollisionCandidates(AliVEvent::kEMC7);
   }
   else if (kTrig=="INT7"){
-    printf("PartCorr trigger INT7\n");
+    printf("CaloTrackCorr trigger INT7\n");
     task->SelectCollisionCandidates(AliVEvent::kINT7);
   }
   else if(kTrig=="EMC1"){
-    printf("PartCorr trigger EMC1\n");
+    printf("CaloTrackCorr trigger EMC1\n");
     task->SelectCollisionCandidates(AliVEvent::kEMC1);
   }
   else if(kTrig=="MB"){
-    printf("PartCorr trigger MB\n");
+    printf("CaloTrackCorr trigger MB\n");
     task->SelectCollisionCandidates(AliVEvent::kMB);
   }  
   else if(kTrig=="PHOS"){
-    printf("PartCorr trigger PHOS\n");
+    printf("CaloTrackCorr trigger PHOS\n");
     task->SelectCollisionCandidates(AliVEvent::kPHI7);
+  }  
+  else if(kTrig=="PHOSPb"){
+    printf("CaloTrackCorr trigger PHOSPb\n");
+    task->SelectCollisionCandidates(AliVEvent::kPHOSPb);
+  }
+  else if(kTrig=="AnyINT")
+  {
+    printf("CaloTrackCorr trigger AnyINT\n");
+    task->SelectCollisionCandidates(AliVEvent::kAnyINT);
+  }  
+  else if(kTrig=="INT")
+  {
+    printf("CaloTrackCorr trigger AnyINT\n");
+    task->SelectCollisionCandidates(AliVEvent::kAny);
+  }
+  else if(kTrig=="EMCEGA")
+  {
+    printf("CaloTrackCorr trigger EMC Gamma\n");
+    task->SelectCollisionCandidates(AliVEvent::kEMCEGA);
+  } 
+  else if(kTrig=="EMCEJE")
+  {
+    printf("CaloTrackCorr trigger EMC Jet\n");
+    task->SelectCollisionCandidates(AliVEvent::kEMCEJE);
+  }
+  else if(kTrig=="Central")
+  {
+    printf("CaloTrackCorr trigger Central\n");
+    task->SelectCollisionCandidates(AliVEvent::kCentral);
+  } 
+  else if(kTrig=="SemiCentral")
+  {
+    printf("CaloTrackCorr trigger SemiCentral\n");
+    task->SelectCollisionCandidates(AliVEvent::kSemiCentral);
   }
   
   return task;
@@ -185,7 +256,7 @@ AliCaloTrackReader * ConfigureReader()
   else if(kData=="MC" && 
           kInputDataType == "ESD") reader = new AliCaloTrackMCReader();
   
-  reader->SetDebug(-1);//10 for lots of messages
+  reader->SetDebug(kDebug);//10 for lots of messages
   
   //Delta AOD?
   //reader->SetDeltaAODFileName("");
@@ -215,28 +286,33 @@ AliCaloTrackReader * ConfigureReader()
   reader->SetCTSPtMin(0.1);
   reader->SetCTSPtMax(1000);
   
-  reader->SwitchOffFiducialCut();
-  
+  reader->SwitchOnFiducialCut();
+  reader->GetFiducialCut()->SetSimpleCTSFiducialCut(0.8, 0, 360) ;
+
   // Tracks
   reader->SwitchOnCTS();
-  if(kInputDataType=="ESD"){
-    gROOT->LoadMacro("$ALICE_ROOT/PWGJE/macros/CreateTrackCutsPWGJE.C"); 
-    AliESDtrackCuts * esdTrackCuts = CreateTrackCutsPWGJE(10041004);   //no ITSrefit
+  if(kInputDataType=="ESD")
+  {
+    gROOT->LoadMacro("$ALICE_ROOT/PWGJE/macros/CreateTrackCutsPWGJE.C");
+    AliESDtrackCuts * esdTrackCuts = CreateTrackCutsPWGJE(10041004);
     reader->SetTrackCuts(esdTrackCuts);
   }
-  else if(kInputDataType=="AOD"){
+  else if(kInputDataType=="AOD")
+  {
     reader->SetTrackFilterMask(128); // Filter bit, not mask
   }
   
   // Calorimeter
   
   reader->SetEMCALClusterListName(kClusterArray);
-  if(kClusterArray == "") {
+  if(kClusterArray == "") 
+  {
     printf("**************** Standard EMCAL clusters branch analysis **************** \n");
     reader->SwitchOnClusterRecalculation();
     // Check in ConfigureCaloUtils that the recalibration and bad map are ON 
   }
-  else {
+  else 
+  {
     printf("**************** Input for analysis is Clusterizer %s **************** \n", kClusterArray.Data());
     reader->SwitchOffClusterRecalculation();
   }  
@@ -262,32 +338,29 @@ AliCaloTrackReader * ConfigureReader()
   // Event selection
   //-----------------
   
-  // Settings for LHC11a
-  if(kRunNumber > 140000 && kRunNumber < = 146860){
-    if(kClusterArray == "") reader->SwitchOnLEDEventsRemoval();
-    reader->RejectFastClusterEvents();
-    printf("Reader: Reject LED events and Fast cluster\n");
-  }  
-  
   //if(!kUseKinematics) reader->SetFiredTriggerClassName("CEMC7EGA-B-NOPF-CENTNOTRD"); // L1 Gamma
   
-  if     (kCollisions=="pp"  ) {
-    if(kRunNumber < 140000) reader->SwitchOnEventSelection(); // remove pileup by default
-    else                    reader->SwitchOffEventSelection(); 
-    reader->SwitchOffV0ANDSelection() ;        // and besides v0 AND
-    reader->SwitchOffPrimaryVertexSelection(); // and besides primary vertex
-    reader->SetZvertexCut(50.);                // Open cut
+  reader->SetZvertexCut(10.);                // Open cut
+  
+  if(kEventSelection)
+  {
+    reader->SwitchOnEventSelection();         // remove pileup by default
+    reader->SwitchOnV0ANDSelection() ;        // and besides v0 AND
+    reader->SwitchOnPrimaryVertexSelection(); // and besides primary vertex
   }
-  else if(kCollisions=="PbPb") {
+  else 
+  {
     reader->SwitchOffEventSelection();         // remove pileup by default
     reader->SwitchOffV0ANDSelection() ;        // and besides v0 AND
-    reader->SwitchOffPrimaryVertexSelection(); // and besides primary vertex
-    reader->SetZvertexCut(10.);                // Centrality defined in this range.
+    reader->SwitchOffPrimaryVertexSelection(); // and besides primary vertex    
+  }
     
+  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->SetCentralityBin(-1,-1); // Accept all events, if not select range
+    reader->SetCentralityBin(kMinCen,kMaxCen); // Accept all events, if not select range
     
     // Event plane (only used in AliAnaPi0 for the moment)
     reader->SetEventPlaneMethod("Q");
@@ -306,117 +379,58 @@ AliCalorimeterUtils* ConfigureCaloUtils()
 {
   
   AliCalorimeterUtils *cu = new AliCalorimeterUtils;
-  cu->SetDebug(-1);
+  cu->SetDebug(kDebug);
   
   // Remove clusters close to borders, at least max energy cell is 1 cell away 
   cu->SetNumberOfCellsFromEMCALBorder(1);
   cu->SetNumberOfCellsFromPHOSBorder(2);
   
-  if(kClusterArray == "") 
-    cu->SwitchOffRecalculateClusterTrackMatching(); // Done in clusterization
-  else            
-    cu->SwitchOnRecalculateClusterTrackMatching();
+  // Search of local maxima in cluster
+  if(kCollisions=="pp")
+  {
+    cu->SetLocalMaximaCutE(0.1);
+    cu->SetLocalMaximaCutEDiff(0.03);
+  }
+  else 
+  {
+    cu->SetLocalMaximaCutE(0.2);
+    cu->SetLocalMaximaCutEDiff(0.03);
+  }
+  
+  cu->SwitchOffClusterPlot();
+
+  if(kRecalTM) cu->SwitchOnRecalculateClusterTrackMatching(); // Done in clusterization
+  else         cu->SwitchOffRecalculateClusterTrackMatching();
   
   cu->SwitchOnBadChannelsRemoval() ;
   
   //EMCAL settings
-  if(kCalorimeter=="EMCAL"){
-    
-    if(kYears==2010) cu->SetEMCALGeometryName("EMCAL_FIRSTYEARV1");
-    else             cu->SetEMCALGeometryName("EMCAL_COMPLETEV1");
-    
-    AliEMCALRecoUtils * recou = cu->GetEMCALRecoUtils();
-    
-    Bool_t bCalib = kTRUE;
-    Bool_t bBadMap= kTRUE;
-    cu->SwitchOnRecalibration();      // Check the reader if it is taken into account during filtering
-    
-    TGeoHMatrix* matrix[12];
-    gROOT->LoadMacro("$ALICE_ROOT/PWGGA/EMCALTasks/macros/ConfigureEMCALRecoUtils.C");
-    ConfigureEMCALRecoUtils(
-                            recou,
-                            kSimulation, 
-                            matrix,
-                            "",//AODB path, default
-                            kRunNumber, 
-                            kPass,
-                            bCalib, 
-                            bBadMap
-                            );   
-    
-    printf("ConfigureCaloUtils() - EMCAL Recalibration ON? %d %d\n",recou->IsRecalibrationOn(), cu->IsRecalibrationOn());
-    printf("ConfigureCaloUtils() - EMCAL BadMap        ON? %d %d\n",recou->IsBadChannelsRemovalSwitchedOn(), cu->IsBadChannelsRemovalSwitchedOn());
-    
-    //Alignment matrices
-    cu->SwitchOffLoadOwnEMCALGeometryMatrices();
-    /*
-     for (Int_t mod=0;mod<12;mod++)
-     {
-     //((TGeoHMatrix*) mobj->At(mod))->Print();
-     cu->SetEMCALGeometryMatrixInSM(matrix[mod],mod);
-     }
-     */
-    
-    // Non linearity
-    if(kCollisions=="pp"  ) { // Do only for pp for the moment
-      cu->SwitchOnCorrectClusterLinearity();
-      if(!kSimulation) recou->SetNonLinearityFunction(AliEMCALRecoUtils::kBeamTestCorrected);
-      else             recou->SetNonLinearityFunction(AliEMCALRecoUtils::kPi0MC);
-    }
-    
-    recou->SwitchOnRejectExoticCell();     // on for QA cells
-    recou->SwitchOffRejectExoticCluster(); // Done in clusterizer
-    
-  }  
-  else { // PHOS settings 
-    
-    Int_t run2010 = kRunNumber;
-    //Use a fixed run number from year 2010 for 2011 runs, not available yet.
-    if(kRunNumber > 140000) run2010 = 139000;
-    
-    // Bad map
+
+  if(!kSimulation)
+    cu->SwitchOnLoadOwnEMCALGeometryMatrices();
+  
+  AliEMCALRecoUtils * recou = cu->GetEMCALRecoUtils();
+  
+  Bool_t bCalib = kTRUE;
+  Bool_t bBadMap= kTRUE;
+  cu->SwitchOnRecalibration(); // Check the reader if it is taken into account during filtering
+  
+  
+  gROOT->LoadMacro("$ALICE_ROOT/PWGGA/EMCALTasks/macros/ConfigureEMCALRecoUtils.C");
+  ConfigureEMCALRecoUtils(recou,
+                          kSimulation,                             
+                          kExotic,
+                          kNonLinearity,
+                          bCalib, 
+                          bBadMap);   
+  
+  printf("ConfigureCaloUtils() - EMCAL Recalibration ON? %d %d\n",recou->IsRecalibrationOn(), cu->IsRecalibrationOn());
+  printf("ConfigureCaloUtils() - EMCAL BadMap        ON? %d %d\n",recou->IsBadChannelsRemovalSwitchedOn(), cu->IsBadChannelsRemovalSwitchedOn());
+  
     
-    AliOADBContainer badmapContainer(Form("phosBadMap"));
-    TString fileName="$ALICE_ROOT/OADB/PHOS/PHOSBadMaps.root";
-    //if(path!="") fileName=path+"PHOSBadMaps.root";
-    badmapContainer.InitFromFile((char*)fileName.Data(),"phosBadMap");
-    //Use a fixed run number from year 2010, this year not available yet.
-    TObjArray *maps = (TObjArray*)badmapContainer.GetObject(run2010,"phosBadMap");
-    if(!maps){
-      printf("Can not read Bad map for run %d. \n You may choose to use your map with ForceUsingBadMap()\n",run2010) ;    
-    }
-    else{
-      printf("Setting PHOS bad map with name %s \n",maps->GetName()) ;
-      for(Int_t mod=1; mod<5;mod++){
-        TH2I *hbmPH = cu->GetPHOSChannelStatusMap(mod);
-        
-        if(hbmPH) 
-          delete hbmPH ;        
-        hbmPH=(TH2I*)maps->At(mod);
-        
-        if(hbmPH) hbmPH->SetDirectory(0);
-        
-        cu->SetPHOSChannelStatusMap(mod-1,hbmPH);
-      }   
-    }
+  // PHOS 
+  cu->SwitchOffLoadOwnPHOSGeometryMatrices();
     
-    //Alignment matrices
-    cu->SwitchOffLoadOwnPHOSGeometryMatrices();
-    /*
-     fileName="$ALICE_ROOT/OADB/PHOS/PHOSGeometry.root";
-     //if(path!="") fileName=path+"PHOSGeometry.root";
-     AliOADBContainer geomContainer("phosGeo");
-     geomContainer.InitFromFile((char*)fileName.Data(),"PHOSRotationMatrixes");
-     TObjArray *matrixes = (TObjArray*)geomContainer.GetObject(run2010,"PHOSRotationMatrixes");    
-     for (Int_t mod=0;mod<5;mod++)
-     {
-     printf("PHOS matrices mod %d, %p\n",mod,((TGeoHMatrix*)matrixes->At(mod)));
-     //((TGeoHMatrix*) mobj->At(mod))->Print();
-     cu->SetPHOSGeometryMatrixInSM(((TGeoHMatrix*)matrixes->At(mod)),mod);
-     }    
-     */
-  }// PHOS
-  
   if(kPrint) cu->Print("");
   
   return cu;
@@ -427,124 +441,179 @@ AliCalorimeterUtils* ConfigureCaloUtils()
 AliAnaPhoton* ConfigurePhotonAnalysis()
 {
   
-  AliAnaPhoton *anaphoton = new AliAnaPhoton();
-  anaphoton->SetDebug(-1); //10 for lots of messages
+  AliAnaPhoton *ana = new AliAnaPhoton();
+  ana->SetDebug(kDebug); //10 for lots of messages
   
   // cluster selection cuts
   
-  anaphoton->SwitchOffFiducialCut();
-  
-  anaphoton->SetCalorimeter(kCalorimeter);
+  ana->SwitchOffFiducialCut();
+
+  ana->SetCalorimeter(kCalorimeter);
   
-  if(kCalorimeter == "PHOS"){
-    anaphoton->SetNCellCut(2);// At least 2 cells
-    anaphoton->SetMinPt(0.3);
-    anaphoton->SetMinDistanceToBadChannel(2, 4, 5);
-    anaphoton->SetTimeCut(-2000,2000); // open cut
+  if(kCalorimeter == "PHOS")
+  {
+    ana->SetNCellCut(2);// At least 3 cells
+    ana->SetMinPt(0.3);
+    ana->SetMinDistanceToBadChannel(2, 4, 5);
+    ana->SetTimeCut(-2000,2000); // open cut
   }
-  else {//EMCAL
-    anaphoton->SetNCellCut(1);// At least 2 cells
-    anaphoton->SetMinPt(0.5); // avoid mip peak at E = 260 MeV
-    anaphoton->SetMaxPt(1000); 
-    anaphoton->SetTimeCut(-1000,1000); // open cut, usual time window of [425-825] ns if time recalibration is off 
+  else 
+  {//EMCAL
+    ana->SetNCellCut(1);// At least 2 cells
+    ana->SetMinEnergy(0.5); // 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 
     // restrict to less than 100 ns when time calibration is on 
-    anaphoton->SetMinDistanceToBadChannel(1, 2, 3); // For filtered AODs, new releases.
+    ana->SetMinDistanceToBadChannel(2, 4, 6); 
   }
   
-  anaphoton->SwitchOnTrackMatchRejection() ;
+  if(kTM)
+  {
+    ana->SwitchOnTrackMatchRejection() ;
+    ana->SwitchOffTMHistoFill() ;
+  }
+  else
+  {
+    ana->SwitchOffTrackMatchRejection() ;
+    ana->SwitchOnTMHistoFill() ;
+  }
   
   //PID cuts (shower shape)
-  anaphoton->SwitchOnCaloPID(); // do PID selection, unless specified in GetCaloPID, selection not based on bayesian
-  AliCaloPID* caloPID = anaphoton->GetCaloPID();
+  ana->SwitchOnCaloPID(); // do PID selection, unless specified in GetCaloPID, selection not based on bayesian
+  AliCaloPID* caloPID = ana->GetCaloPID();
   //Not used in bayesian
   
   //EMCAL
-  caloPID->SetEMCALLambda0CutMax(0.30);
+  caloPID->SetEMCALLambda0CutMax(0.27);
   caloPID->SetEMCALLambda0CutMin(0.10);
   
   caloPID->SetEMCALDEtaCut(0.025);
-  caloPID->SetEMCALDPhiCut(0.05);
-  // In case of official AODs when dX and dZ was not stored, open the cuts 
-  // and rely on having a match recorded. In case of reclusterization, try.
-  if(kData=="AOD" && kClusterArray==""){
-    caloPID->SetEMCALDEtaCut(2000);  
-    caloPID->SetEMCALDPhiCut(2000); 
-  }
+  caloPID->SetEMCALDPhiCut(0.030);
+  
+//  // In case of official AODs when dX and dZ was not stored, open the cuts 
+//  // and rely on having a match recorded. In case of reclusterization, try.
+//  if(kData=="AOD" && kClusterArray=="")
+//  {
+//    caloPID->SetEMCALDEtaCut(2000);  
+//    caloPID->SetEMCALDPhiCut(2000); 
+//  }
   
   //PHOS
   caloPID->SetPHOSDispersionCut(2.5);
   caloPID->SetPHOSRCut(2.);
   if(kData=="AOD") caloPID->SetPHOSRCut(2000.); // Open cut since dX, dZ not stored
   
-  if(kCalorimeter=="PHOS"){
+  if(kCalorimeter=="PHOS")
+  {
     caloPID->SetHistoDEtaRangeAndNBins(-200, 200, 200); // dZ
     caloPID->SetHistoDPhiRangeAndNBins(-200, 200, 200); // dX
   }
   
   //caloPID->SetTOFCut(10000000); // Not used, only to set PID bits
   
-  anaphoton->SwitchOffFillShowerShapeHistograms();  // Filled before photon shower shape selection
+  ana->SwitchOffFillShowerShapeHistograms();  // Filled before photon shower shape selection
   
   // Input / output delta AOD settings
   
-  if(!kData.Contains("delta")) {
-    anaphoton->SetOutputAODName(Form("Photon%s_Trig%s_Cl%s",kCalorimeter.Data(), kTrig.Data(),kClusterArray.Data()));
-    anaphoton->SetOutputAODClassName("AliAODPWG4ParticleCorrelation");
-    //anaphoton->SetOutputAODClassName("AliAODPWG4Particle"); // use if no correlation done
+  if(!kData.Contains("delta")) 
+  {
+    ana->SetOutputAODName(Form("Photon%s",kName.Data()));
+    ana->SetOutputAODClassName("AliAODPWG4ParticleCorrelation");
+    //ana->SetOutputAODClassName("AliAODPWG4Particle"); // use if no correlation done
   }
-  else anaphoton->SetInputAODName(Form("Photon%s_Trig%s_Cl%s",kCalorimeter.Data(), kTrig.Data(),kClusterArray.Data()));
+  else ana->SetInputAODName(Form("Photon%s",kName.Data()));
   
   //Set Histograms name tag, bins and ranges
   
-  anaphoton->AddToHistogramsName("AnaPhoton_");
-  SetHistoRangeAndNBins(anaphoton->GetHistogramRanges()); // see method below
+  ana->AddToHistogramsName(Form("AnaPhoton_TM%d_",kTM));
+  SetHistoRangeAndNBins(ana->GetHistogramRanges()); // see method below
   
   // Number of particle type MC histograms
-  anaphoton->FillNOriginHistograms(8);
-  anaphoton->FillNPrimaryHistograms(4);
+  ana->FillNOriginHistograms(8);
+  ana->FillNPrimaryHistograms(4);
+  
+  ConfigureMC(ana);
+  
+  if(kPrint) ana->Print("");
   
-  if(kSimulation) anaphoton->SwitchOnDataMC() ;//Access MC stack and fill more histograms, AOD MC not implemented yet.
-  else            anaphoton->SwitchOffDataMC() ;
+  return ana;
+  
+}
+
+//__________________________________________________________________________________________
+AliAnaInsideClusterInvariantMass* ConfigureInClusterIMAnalysis(Float_t l0min, Float_t l0max)
+{
 
-  if(kPrint) anaphoton->Print("");
+  AliAnaInsideClusterInvariantMass *ana = new AliAnaInsideClusterInvariantMass();
+  ana->SetDebug(kDebug); //10 for lots of messages
+  
+  // selection cuts
   
-  return anaphoton;
+  ana->SetMinEnergy(5); 
+  ana->SetMaxEnergy(200.);   
+  ana->SetMinNCells(3);
+  ana->SetM02Cut(l0min,l0max);
+  ana->SetCalorimeter(kCalorimeter);
+  
+  //ana->AddToHistogramsName(Form("AnaInClusterIM_%1.2f_%1.2f_",l0min,l0max));
+  ana->AddToHistogramsName("AnaInClusterIM_");
+
+  SetHistoRangeAndNBins(ana->GetHistogramRanges()); // see method below
+  
+  if(kSimulation) ana->SwitchOnDataMC() ;//Access MC stack and fill more histograms, AOD MC not implemented yet.
+  else            ana->SwitchOffDataMC() ;
+  
+  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
+
+  ConfigureMC(ana);
+  
+  if(kPrint) ana->Print("");
+  
+  return ana;
   
 }
 
+
 //_______________________________________________
 AliAnaChargedParticles* ConfigureChargedAnalysis()
 {
   
-  AliAnaChargedParticles *anatrack = new AliAnaChargedParticles();
-  anatrack->SetDebug(-1); //10 for lots of messages
+  AliAnaChargedParticles *ana = new AliAnaChargedParticles();
+  ana->SetDebug(kDebug); //10 for lots of messages
   
   // selection cuts
   
-  anatrack->SetDebug(-1);//10 for lots of messages
-  anatrack->SetMinPt(5.);
-  anatrack->SwitchOffFiducialCut();
-  
+  ana->SetMinPt(8.);
+  ana->SwitchOnFiducialCut();
+  ana->GetFiducialCut()->SetSimpleCTSFiducialCut(0.9, 0, 360) ; //more restrictive cut in reader and after in isolation
+
   // Input / output delta AOD settings
   
-  if(!kData.Contains("delta")) {
-    anatrack->SetOutputAODName(Form("Hadron%s_Trig%s_Cl%s",kCalorimeter.Data(), kTrig.Data(),kClusterArray.Data()));
-    anatrack->SetOutputAODClassName("AliAODPWG4ParticleCorrelation");
-    //anaphoton->SetOutputAODClassName("AliAODPWG4Particle"); // use if no correlation done
+  if(!kData.Contains("delta")) 
+  {
+    ana->SetOutputAODName(Form("Hadron%s",kName.Data()));
+    ana->SetOutputAODClassName("AliAODPWG4ParticleCorrelation");
+    //ana->SetOutputAODClassName("AliAODPWG4Particle"); // use if no correlation done
   }
-  else anatrack->SetInputAODName(Form("Hadron%s_Trig%s_Cl%s",kCalorimeter.Data(), kTrig.Data(),kClusterArray.Data()));
-  printf("Set Hadron%s_Trig%s_Cl%s\n",kCalorimeter.Data(), kTrig.Data(),kClusterArray.Data());
+  else 
+    ana->SetInputAODName(Form("Hadron%s",kName.Data()));
+  printf("Set Hadron%s\n",kName.Data());
   //Set Histograms name tag, bins and ranges
   
-  anatrack->AddToHistogramsName("AnaHadrons_");
-  SetHistoRangeAndNBins(anatrack->GetHistogramRanges()); // see method below
+  ana->AddToHistogramsName("AnaHadrons_");
+  SetHistoRangeAndNBins(ana->GetHistogramRanges()); // see method below
 
-  if(kSimulation) anatrack->SwitchOnDataMC() ;//Access MC stack and fill more histograms, AOD MC not implemented yet.
-  else            anatrack->SwitchOffDataMC() ;
+  ana->GetHistogramRanges()->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 200) ;
+  ana->GetHistogramRanges()->SetHistoEtaRangeAndNBins(-1.5, 1.5, 300) ;
   
-  if(kPrint) anatrack->Print("");
+  ConfigureMC(ana);
   
-  return anatrack;
+  if(kPrint) ana->Print("");
+   
+  return ana;
   
 }
 
@@ -553,53 +622,57 @@ AliAnaChargedParticles* ConfigureChargedAnalysis()
 AliAnaPi0* ConfigurePi0Analysis()
 {
   
-  AliAnaPi0 *anapi0 = new AliAnaPi0();
+  AliAnaPi0 *ana = new AliAnaPi0();
   
-  anapi0->SetDebug(-1);//10 for lots of messages
-  if(kPrint) anapi0->Print("");
+  ana->SetDebug(kDebug);//10 for lots of messages
   
   // Input delta AOD settings
-  anapi0->SetInputAODName(Form("Photon%s_Trig%s_Cl%s",kCalorimeter.Data(), kTrig.Data(),kClusterArray.Data()));
+  ana->SetInputAODName(Form("Photon",kName.Data()));
   
   // Calorimeter settings
-  anapi0->SetCalorimeter(kCalorimeter);
-  if(kCalorimeter=="PHOS") anapi0->SetNumberOfModules(3); //PHOS first year
-  else {                   
-    if(kYears==2010) anapi0->SetNumberOfModules(4); //EMCAL first year
-    else             anapi0->SetNumberOfModules(10);
+  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
-  anapi0->SwitchOnOwnMix(); //Off when mixing done with general mixing frame
+  ana->SwitchOnOwnMix(); //Off when mixing done with general mixing frame
   
   // Cuts 
-  if(kCalorimeter=="EMCAL") anapi0->SetPairTimeCut(70);
+  if(kCalorimeter=="EMCAL") ana->SetPairTimeCut(70);
   
-  if     (kCollisions=="pp"  ) {
-    anapi0->SetNCentrBin(1);
-    anapi0->SetNZvertBin(10);
-    anapi0->SetNRPBin(1);
-    anapi0->SetNMaxEvMix(100);    
-    anapi0->SwitchOffSMCombinations();
-    anapi0->SwitchOffMultipleCutAnalysis();
+  if     (kCollisions=="pp"  ) 
+  {
+    ana->SetNCentrBin(1);
+    ana->SetNZvertBin(10);
+    ana->SetNRPBin(1);
+    ana->SetNMaxEvMix(100);    
+    ana->SwitchOffSMCombinations();
+    ana->SwitchOffMultipleCutAnalysis();
   }
-  else if(kCollisions=="PbPb") {
-    anapi0->SetNCentrBin(10);
-    anapi0->SetNZvertBin(10);
-    anapi0->SetNRPBin(4);
-    anapi0->SetNMaxEvMix(10);
-    anapi0->SwitchOffSMCombinations();
+  else if(kCollisions=="PbPb") 
+  {
+    ana->SetNCentrBin(10);
+    ana->SetNZvertBin(10);
+    ana->SetNRPBin(4);
+    ana->SetNMaxEvMix(10);
+    ana->SwitchOffSMCombinations();
   }
   
   //Set Histograms name tag, bins and ranges
   
-  anapi0->AddToHistogramsName("AnaPi0_");
-  SetHistoRangeAndNBins(anapi0->GetHistogramRanges()); // see method below
-  
-  if(kSimulation) anapi0->SwitchOnDataMC() ;//Access MC stack and fill more histograms, AOD MC not implemented yet.
-  else            anapi0->SwitchOffDataMC() ;
+  ana->AddToHistogramsName(Form("AnaPi0_TM%d_",kTM));
+  SetHistoRangeAndNBins(ana->GetHistogramRanges()); // see method below
 
-  return anapi0;
+  ConfigureMC(ana);
+  
+  if(kPrint) ana->Print("");
+  
+  return ana;
   
 }
 
@@ -608,78 +681,112 @@ AliAnaPi0EbE* ConfigurePi0EbEAnalysis(TString particle,
                                       Int_t analysis)
 {
   
-  AliAnaPi0EbE *anapi0ebe = new AliAnaPi0EbE();
-  anapi0ebe->SetDebug(-1);//10 for lots of messages
+  AliAnaPi0EbE *ana = new AliAnaPi0EbE();
+  ana->SetDebug(kDebug);//10 for lots of messages
   
-  anapi0ebe->SetAnalysisType(analysis);
+  ana->SetAnalysisType(analysis);
   TString opt = "";
   if(analysis==AliAnaPi0EbE::kIMCaloTracks) opt = "Conv";
   if(analysis==AliAnaPi0EbE::kSSCalo)       opt = "SS";
   
-  anapi0ebe->SwitchOffFillWeightHistograms();
-  anapi0ebe->SetMinPt(0.5);
-  if(kCalorimeter=="EMCAL")anapi0ebe->SetPairTimeCut(20); 
-  anapi0ebe->SetCalorimeter(kCalorimeter);
+  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
   
-  anapi0ebe->SetInputAODName(Form("Photon%s_Trig%s_Cl%s",kCalorimeter.Data(), kTrig.Data(),kClusterArray.Data()));
-  if(!kInputDataType.Contains("delta")) {
-    anapi0ebe->SetOutputAODName(Form("%s%s%s_Trig%s_Cl%s",particle.Data(), opt.Data(), kCalorimeter.Data(), kTrig.Data(),kClusterArray.Data()));
-    anapi0ebe->SetOutputAODClassName("AliAODPWG4ParticleCorrelation");
+  ana->SetInputAODName(Form("Photon%s",kName.Data()));
+  if(!kInputDataType.Contains("delta")) 
+  {
+    ana->SetOutputAODName(Form("%s%s%s",particle.Data(), opt.Data(), kName.Data()));
+    ana->SetOutputAODClassName("AliAODPWG4ParticleCorrelation");
   }
-  else  anapi0ebe->SetInputAODName(Form("%s%s%s_Trig%s_Cl%s",particle.Data(),opt.Data(),kCalorimeter.Data(), kTrig.Data(),kClusterArray.Data()));
+  else  
+    ana->SetInputAODName(Form("%s%s%s",particle.Data(),opt.Data(),kName.Data()));
   
-  if(analysis == AliAnaPi0EbE::kIMCaloTracks) anapi0ebe->SetInputAODGammaConvName("PhotonsCTS");
+  if(analysis == AliAnaPi0EbE::kIMCaloTracks) ana->SetInputAODGammaConvName("PhotonsCTS");
   
-  if(analysis!=AliAnaPi0EbE::kSSCalo){
-    
-    AliNeutralMesonSelection *nms = anapi0ebe->GetNeutralMesonSelection();
+  if(analysis!=AliAnaPi0EbE::kSSCalo)
+  {
+    AliNeutralMesonSelection *nms = ana->GetNeutralMesonSelection();
     nms->SetParticle(particle);
-    nms->SwitchOffAngleSelection();
+    nms->SwitchOnAngleSelection();
     nms->KeepNeutralMesonSelectionHistos(kTRUE);
     //nms->SetAngleMaxParam(2,0.2);
-    nms->SetHistoERangeAndNBins(0, 20, 100) ;
+    nms->SetHistoERangeAndNBins(0, 20, 80) ;
     //nms->SetHistoIMRangeAndNBins(0, 1, 400);
   }
   
+  ana->SwitchOffSelectedClusterHistoFill(); 
+  ana->SwitchOffFillWeightHistograms();
+  
+  if(!kTM) ana->SwitchOnTMHistoFill();
+  else     ana->SwitchOffTMHistoFill();
+  
   //Set Histograms name tag, bins and ranges
   
-  anapi0ebe->AddToHistogramsName(Form("Ana%s%sEbE_",particle.Data(),opt.Data()));
-  SetHistoRangeAndNBins(anapi0ebe->GetHistogramRanges()); // see method below
+  ana->AddToHistogramsName(Form("Ana%s%sEbE_TM%d_",particle.Data(),opt.Data(),kTM));
+  SetHistoRangeAndNBins(ana->GetHistogramRanges()); // see method below
   
-  if(kSimulation) anapi0ebe->SwitchOnDataMC() ;//Access MC stack and fill more histograms, AOD MC not implemented yet.
-  else            anapi0ebe->SwitchOffDataMC() ;
+  ConfigureMC(ana);
   
-  if(kPrint) anapi0ebe->Print("");
+  if(kPrint) ana->Print("");
   
-  return  anapi0ebe;
+  return  ana;
   
 }
 
-//___________________________________________________________________
+//____________________________________________________________________________________________________
 AliAnaParticleIsolation* ConfigureIsolationAnalysis(TString particle="Photon", 
                                                     Int_t  partInCone = AliIsolationCut::kOnlyCharged,
                                                     Int_t  thresType  = AliIsolationCut::kSumPtFracIC,
                                                     Bool_t multi      = kFALSE)
 {
   
-  AliAnaParticleIsolation *anaisol = new AliAnaParticleIsolation();
-  anaisol->SetDebug(-1);
+  AliAnaParticleIsolation *ana = new AliAnaParticleIsolation();
+  //ana->SetDebug(kDebug);
+  ana->SetDebug(kDebug);
   
-  anaisol->SetMinPt(5);
+  ana->SwitchOnFiducialCut();
+  //Avoid borders of EMCal
+  if(kCalorimeter=="EMCAL")
+    ana->GetFiducialCut()->SetSimpleEMCALFiducialCut(0.6, 86, 174) ;
+
+  // Same Eta as EMCal, cut in phi if EMCAL was triggering
+  if(particle=="Hadron")
+  {
+    if(kTrig.Contains("EMC"))
+      ana->GetFiducialCut()->SetSimpleCTSFiducialCut  (0.6, 190, 360+70) ;
+    else
+      ana->GetFiducialCut()->SetSimpleCTSFiducialCut  (0.6, 0, 360) ;    
+  }
+  
+  ana->SetMinPt(8);
   
   // Input / output delta AOD settings
   
-  anaisol->SetInputAODName(Form("%s%s_Trig%s_Cl%s",particle.Data(),kCalorimeter.Data(), kTrig.Data(),kClusterArray.Data()));
-  anaisol->SetAODObjArrayName(Form("IC%s",particle.Data())); 
+  ana->SetInputAODName(Form("%s%s",particle.Data(),kName.Data()));
+  ana->SetAODObjArrayName(Form("IC%sTM%d",particle.Data(),kTM)); 
+  
+  ana->SetCalorimeter(kCalorimeter);
+  
+  if(!kTM)  ana->SwitchOnTMHistoFill();
+  else      ana->SwitchOffTMHistoFill();
   
-  anaisol->SetCalorimeter(kCalorimeter);
+  ana->SwitchOffSSHistoFill();
   
   //Do settings for main isolation cut class
-  AliIsolationCut * ic =  anaisol->GetIsolationCut();  
-  ic->SetConeSize(0.4);
-  ic->SetPtThreshold(0.5);
+  AliIsolationCut * ic =  ana->GetIsolationCut();      
+  ic->SetDebug(kDebug);
+  
+  ic->SetConeSize(0.3);
+  
+  if(kCollisions=="pp")  ic->SetPtThreshold(0.5);
+  if(kCollisions=="PbPb")ic->SetPtThreshold(2);
+  //ic->SetPtThreshold(1.);
+  
   ic->SetPtFraction(0.1);
   ic->SetSumPtThreshold(1.0) ;
   ic->SetParticleTypeInCone(partInCone);
@@ -687,23 +794,51 @@ AliAnaParticleIsolation* ConfigureIsolationAnalysis(TString particle="Photon",
   
   //Do or not do isolation with previously produced AODs.
   //No effect if use of SwitchOnSeveralIsolation()
-  anaisol->SwitchOffReIsolation();
+  ana->SwitchOffReIsolation();
+  
   //Multiple IC
-  if(multi) anaisol->SwitchOnSeveralIsolation() ;
-  else      anaisol->SwitchOffSeveralIsolation() ;
+  if(multi) 
+  {
+    ic->SetConeSize(1.);    // Take all for first iteration
+    ic->SetPtThreshold(100);// Take all for first iteration
+    ana->SwitchOnSeveralIsolation() ;
+    ana->AddToHistogramsName(Form("AnaMultiIsol%s_TM%d_",particle.Data(),kTM));
+    ana->SetAODObjArrayName(Form("MultiIC%sTM%d",particle.Data(),kTM));
+    ana->SetNCones(2);
+    ana->SetNPtThresFrac(4);   
+    ana->SetConeSizes(0,0.3);       ana->SetConeSizes(1,0.4);   
+    ana->SetPtThresholds(0, 0.5);   ana->SetPtThresholds(1, 1);  ana->SetPtThresholds(2, 2);     ana->SetPtThresholds(3, 3);
+    ana->SetPtFractions (0, 0.05) ; ana->SetPtFractions (1, 0.1);ana->SetPtFractions (2, 0.2) ;  ana->SetPtFractions (3, 0.3) ;
+    ana->SwitchOffTMHistoFill();
+    ana->SwitchOffSSHistoFill();
+  }
+  else      
+    ana->SwitchOffSeveralIsolation() ;
+  
+  AliCaloPID* caloPID = ana->GetCaloPID();
+  caloPID->SetEMCALDEtaCut(0.025);
+  caloPID->SetEMCALDPhiCut(0.030);
   
   //Set Histograms name tag, bins and ranges
   
-  anaisol->AddToHistogramsName(Form("AnaIsol%s_",particle.Data()));
-  SetHistoRangeAndNBins(anaisol->GetHistogramRanges()); // see method below
+  ana->AddToHistogramsName(Form("AnaIsol%s_TM%d_",particle.Data(),kTM));
+  SetHistoRangeAndNBins(ana->GetHistogramRanges()); // see method below
   
-  if(kPrint) ic     ->Print("");
-  if(kPrint) anaisol->Print("");
+  ana->SetHistoPtInConeRangeAndNBins(0, 50 , 250);
+  ana->SetHistoPtSumRangeAndNBins   (0, 100, 250);
+  
+  if(particle=="Hadron")
+  {
+    ana->GetHistogramRanges()->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 200) ;
+    ana->GetHistogramRanges()->SetHistoEtaRangeAndNBins(-1.5, 1.5, 300) ;
+  }
   
-  if(kSimulation) anaisol->SwitchOnDataMC() ;//Access MC stack and fill more histograms, AOD MC not implemented yet.
-  else            anaisol->SwitchOffDataMC() ;
+  ConfigureMC(ana);
   
-  return anaisol;
+  if(kPrint) ic ->Print("");
+  if(kPrint) ana->Print("");
+  
+  return ana;
   
 }
 
@@ -712,46 +847,64 @@ AliAnaParticleHadronCorrelation* ConfigureHadronCorrelationAnalysis(TString part
                                                                     Int_t bIsolated)
 {
   
-  AliAnaParticleHadronCorrelation *anacorrhadron = new AliAnaParticleHadronCorrelation();
-  anacorrhadron->SetDebug(-1);
+  AliAnaParticleHadronCorrelation *ana = new AliAnaParticleHadronCorrelation();
+  ana->SetDebug(kDebug);
+  
+  ana->SetMinimumTriggerPt(8);
+  ana->SetAssociatedPtRange(0.2,200); 
   
-  anacorrhadron->SetMinimumTriggerPt(5);
-  anacorrhadron->SetAssociatedPtRange(0.2,200); 
+  //Avoid borders of EMCal, same as for isolation
+  if(kCalorimeter=="EMCAL")
+    ana->GetFiducialCut()->SetSimpleEMCALFiducialCut(0.6, 86, 174) ;
+  
+  // Same Eta as EMCal, cut in phi if EMCAL was triggering
+  if(particle=="Hadron")
+  {
+    if(kTrig.Contains("EMC"))
+      ana->GetFiducialCut()->SetSimpleCTSFiducialCut  (0.6, 190, 360+70) ;
+    else
+      ana->GetFiducialCut()->SetSimpleCTSFiducialCut  (0.6, 0, 360) ;    
+  }
   
   // Input / output delta AOD settings
   
-  anacorrhadron->SetInputAODName(Form("%s%s_Trig%s_Cl%s",particle.Data(),kCalorimeter.Data(), kTrig.Data(),kClusterArray.Data()));
-  anacorrhadron->AddToHistogramsName(Form("Ana%sHadronCorrIso%d_",particle.Data(),bIsolated));
-  anacorrhadron->SetAODObjArrayName(Form("%sHadronCorrIso%d",particle.Data(),bIsolated)); 
+  ana->SetInputAODName(Form("%s%s",particle.Data(),kName.Data()));
+  ana->SetAODObjArrayName(Form("%sHadronCorrIso%dTM%d",particle.Data(),bIsolated,kTM)); 
   
-  anacorrhadron->SelectIsolated(bIsolated); // do correlation with isolated photons
+  ana->SelectIsolated(bIsolated); // do correlation with isolated photons
   
-  anacorrhadron->SwitchOnDecayCorr();
-  anacorrhadron->SetMultiBin(1);
-  anacorrhadron->SwitchOffNeutralCorr();
-  anacorrhadron->SwitchOffEventSelection();
-  anacorrhadron->SetDeltaPhiCutRange(1.5,4.5);
+  if(particle=="Pi0" || particle =="Eta") ana->SwitchOnDecayCorr();
+  else                                    ana->SwitchOffDecayCorr();
+  ana->SetMultiBin(1);
+  ana->SwitchOffNeutralCorr();
+  ana->SwitchOffEventSelection();
+  ana->SetDeltaPhiCutRange(1.5,4.5);
   
-  anacorrhadron->SwitchOnSeveralUECalculation();
-  anacorrhadron->SetUeDeltaPhiCutRange(TMath::Pi()/3, 2*TMath::Pi()/3);
+  ana->SwitchOnSeveralUECalculation();
+  ana->SetUeDeltaPhiCutRange(TMath::Pi()/3, 2*TMath::Pi()/3);
   
   //if(kCalorimeter=="PHOS"){
   //Correlate with particles in EMCAL
-  //anacorrhadron->SwitchOnCaloPID();
-  //anacorrhadron->SwitchOnCaloPIDRecalculation(); 
+  //ana->SwitchOnCaloPID();
+  //ana->SwitchOnCaloPIDRecalculation(); 
   //}
   
   //Set Histograms name tag, bins and ranges
   
-  anacorrhadron->AddToHistogramsName(Form("Ana%sHadronCorr_Iso%d_",particle.Data(),bIsolated));
-  SetHistoRangeAndNBins(anacorrhadron->GetHistogramRanges()); // see method below
+  ana->AddToHistogramsName(Form("Ana%sHadronCorr_Iso%d_TM%d_",particle.Data(),bIsolated,kTM));
+  SetHistoRangeAndNBins(ana->GetHistogramRanges()); // see method below
+  
+  if(particle=="Hadron")
+  {
+    ana->GetHistogramRanges()->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 200) ;
+    ana->GetHistogramRanges()->SetHistoEtaRangeAndNBins(-1.5, 1.5, 300) ;
+  }  
   
-  if(kSimulation) anacorrhadron->SwitchOnDataMC() ;//Access MC stack and fill more histograms, AOD MC not implemented yet.
-  else            anacorrhadron->SwitchOffDataMC() ;
+  ConfigureMC(ana);
   
-  if(kPrint) anacorrhadron->Print("");  
+  if(kPrint) ana->Print("");  
   
-  return anacorrhadron;
+  return ana;
   
 }
 
@@ -759,126 +912,139 @@ AliAnaParticleHadronCorrelation* ConfigureHadronCorrelationAnalysis(TString part
 AliAnaCalorimeterQA* ConfigureQAAnalysis()
 {
   
-  AliAnaCalorimeterQA *anaQA = new AliAnaCalorimeterQA();
-  //anaQA->SetDebug(10); //10 for lots of messages
-  anaQA->SetCalorimeter(kCalorimeter);
+  AliAnaCalorimeterQA *ana = new AliAnaCalorimeterQA();
+  ana->SetDebug(kDebug); //10 for lots of messages
+  ana->SetCalorimeter(kCalorimeter);
   
-  anaQA->SetTimeCut(-1000,1000); // Open time cut
+  ana->SetTimeCut(-1000,1000); // Open time cut
   
   // Study inter detector correlation (PHOS, EMCAL, Tracks, V0)
   if(kCalorimeter=="PHOS" && kTrig=="PHOS"){
-    anaQA->SwitchOnCorrelation(); // make sure you switch in the reader PHOS and EMCAL cells and clusters if option is ON
+    ana->SwitchOnCorrelation(); // make sure you switch in the reader PHOS and EMCAL cells and clusters if option is ON
   }
   if(kCalorimeter=="EMCAL" && kClusterArray==""){
-    anaQA->SwitchOnCorrelation(); // make sure you switch in the reader PHOS and EMCAL cells and clusters if option is ON
+    ana->SwitchOnCorrelation(); // make sure you switch in the reader PHOS and EMCAL cells and clusters if option is ON
   }
   else {
-    anaQA->SwitchOffCorrelation();
+    ana->SwitchOffCorrelation();
   }
   
   // Study exotic clusters PHOS and EMCAL
   if(kClusterArray==""){
-    anaQA->SwitchOnStudyBadClusters() ; 
+    ana->SwitchOnStudyBadClusters() ; 
   }
   else {
-    anaQA->SwitchOffStudyBadClusters() ;
+    ana->SwitchOffStudyBadClusters() ;
   }
   
-  anaQA->SwitchOffFiducialCut();
-  anaQA->SwitchOffFillAllTH3Histogram();
-  anaQA->SwitchOffFillAllPositionHistogram();
-  anaQA->SwitchOffFillAllPositionHistogram2();
-  anaQA->SwitchOffStudyBadClusters();
-  anaQA->SwitchOffStudyClustersAsymmetry();
-  anaQA->SwitchOffStudyWeight();
-  anaQA->SwitchOffFillAllTrackMatchingHistogram();
+  ana->SwitchOffFiducialCut();
+  ana->SwitchOffFillAllTH3Histogram();
+  ana->SwitchOffFillAllPositionHistogram();
+  ana->SwitchOffFillAllPositionHistogram2();
+  if(!kExotic)ana->SwitchOnStudyBadClusters();
+  else        ana->SwitchOffStudyBadClusters();
+  ana->SwitchOffStudyClustersAsymmetry();
+  ana->SwitchOffStudyWeight();
+  ana->SwitchOnFillAllTrackMatchingHistogram();
   
   if(kCalorimeter=="EMCAL")
   {
-    if(kYears==2010)  
-      anaQA->SetNumberOfModules(4); 
-    else{           
-      anaQA->SetNumberOfModules(10); 
-    }
+    if     (kYears==2010)  ana->SetNumberOfModules(4); 
+    else if(kYears==2011)  ana->SetNumberOfModules(10);
+    else                   ana->SetNumberOfModules(12); 
   }
   else 
   {//PHOS
-    anaQA->SetNumberOfModules(3); 
+    ana->SetNumberOfModules(3); 
   }
   
-  anaQA->AddToHistogramsName("QA_"); //Begining of histograms name
-  SetHistoRangeAndNBins(anaQA->GetHistogramRanges()); // see method below
+  ana->AddToHistogramsName("QA_"); //Begining of histograms name
+  SetHistoRangeAndNBins(ana->GetHistogramRanges()); // see method below
   
-  if(kSimulation) anaQA->SwitchOnDataMC() ;//Access MC stack and fill more histograms, AOD MC not implemented yet.
-  else            anaQA->SwitchOffDataMC() ;
+  ConfigureMC(ana);
   
-  if(kPrint) anaQA->Print(""); 
+  if(kPrint) ana->Print("");   
   
-  return anaQA;
+  return ana;
   
 }
 
 //________________________________________________________
-void SetHistoRangeAndNBins (AliHistogramRanges* ana)
+void ConfigureMC(AliAnaCaloTrackCorrBaseClass* ana)
+{
+  if(kSimulation) ana->SwitchOnDataMC() ;//Access MC stack and fill more histograms, AOD MC not implemented yet.
+  else            ana->SwitchOffDataMC() ;
+
+  //Set here generator name, default pythia
+  //ana->GetMCAnalysisUtils()->SetMCGenerator("");
+}  
+
+//________________________________________________________
+void SetHistoRangeAndNBins (AliHistogramRanges* histoRanges)
 {
   // Set common bins for all analysis and MC histograms filling
     
-  ana->SetHistoPtRangeAndNBins(0, 100, 250) ; // Energy and pt histograms
+  histoRanges->SetHistoPtRangeAndNBins(0, 100, 200) ; // Energy and pt histograms
   
-  if(kCalorimeter=="EMCAL"){
-    if(kYears==2010){
-      ana->SetHistoPhiRangeAndNBins(78*TMath::DegToRad(), 122*TMath::DegToRad(), 78) ;
-      ana->SetHistoXRangeAndNBins(-230,90,120); // QA
-      ana->SetHistoYRangeAndNBins(370,450,40);  // QA
+  if(kCalorimeter=="EMCAL")
+  {
+    if(kYears==2010)
+    {
+      histoRanges->SetHistoPhiRangeAndNBins(78*TMath::DegToRad(), 122*TMath::DegToRad(), 78) ;
+      histoRanges->SetHistoXRangeAndNBins(-230,90,120); // QA
+      histoRanges->SetHistoYRangeAndNBins(370,450,40);  // QA
     }
-    else {           
-      ana->SetHistoPhiRangeAndNBins(78*TMath::DegToRad(), 182*TMath::DegToRad(), 108) ;
-      ana->SetHistoXRangeAndNBins(-600,90,200); // QA
-      ana->SetHistoYRangeAndNBins(100,450,100); // QA
+    else if(kYears==2011)
+    {           
+      histoRanges->SetHistoPhiRangeAndNBins(78*TMath::DegToRad(), 182*TMath::DegToRad(), 108) ;
+      histoRanges->SetHistoXRangeAndNBins(-600,90,200); // QA
+      histoRanges->SetHistoYRangeAndNBins(100,450,100); // QA
     }
-    
-    ana->SetHistoEtaRangeAndNBins(-0.72, 0.72, 144) ;
-  }
-  else{
-    ana->SetHistoPhiRangeAndNBins(260*TMath::DegToRad(), 320*TMath::DegToRad(), 60) ;
-    ana->SetHistoEtaRangeAndNBins(-0.13, 0.13, 130) ;
-    
+    else
+    {
+      histoRanges->SetHistoPhiRangeAndNBins(78*TMath::DegToRad(), 190*TMath::DegToRad(), 122) ;
+      histoRanges->SetHistoXRangeAndNBins(-100,90,200); // QA
+      histoRanges->SetHistoYRangeAndNBins(50,450,100);  // QA
+    }
+
+    histoRanges->SetHistoEtaRangeAndNBins(-0.72, 0.72, 144) ;
   }
-  
-  if(kClusterArray==""  && kCalorimeter!="PHOS"){ // Tracks analysis
-    ana->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 200) ;
-    ana->SetHistoEtaRangeAndNBins(-1.5, 1.5, 300) ;
+  else
+  {
+    histoRanges->SetHistoPhiRangeAndNBins(260*TMath::DegToRad(), 320*TMath::DegToRad(), 60) ;
+    histoRanges->SetHistoEtaRangeAndNBins(-0.13, 0.13, 130) ;
   }
   
-  ana->SetHistoShowerShapeRangeAndNBins(0, 3, 300);
+  histoRanges->SetHistoShowerShapeRangeAndNBins(0, 5, 500);
   
-  // Invariant mass analysis
-  ana->SetHistoMassRangeAndNBins(0., 1., 200) ;
-  ana->SetHistoAsymmetryRangeAndNBins(0., 1. , 100) ;
+  // Invariant mass histoRangeslysis
+  histoRanges->SetHistoMassRangeAndNBins(0., 1., 200) ;
+  histoRanges->SetHistoAsymmetryRangeAndNBins(0., 1. , 100) ;
   
   // check if time calibration is on
-  ana->SetHistoTimeRangeAndNBins(-1000.,1000,1000);
-  ana->SetHistoDiffTimeRangeAndNBins(-200, 200, 800);
+  histoRanges->SetHistoTimeRangeAndNBins(-1000.,1000,1000);
+  histoRanges->SetHistoDiffTimeRangeAndNBins(-200, 200, 800);
   
   // track-cluster residuals
-  ana->SetHistoTrackResidualPhiRangeAndNBins(-0.15,0.15,100);
-  ana->SetHistoTrackResidualPhiRangeAndNBins(-0.15,0.15,100);
-  
+  histoRanges->SetHistoTrackResidualEtaRangeAndNBins(-0.15,0.15,300);
+  histoRanges->SetHistoTrackResidualPhiRangeAndNBins(-0.15,0.15,300);
+
   // QA, electron, charged
-  ana->SetHistoPOverERangeAndNBins(0,10.,100);
-  ana->SetHistodEdxRangeAndNBins(0.,200.,200);
+  histoRanges->SetHistoPOverERangeAndNBins(0,10.,100);
+  histoRanges->SetHistodEdxRangeAndNBins(0.,200.,200);
   
   // QA
-  ana->SetHistoFinePtRangeAndNBins(0, 10, 200) ; // bining for fhAmpId
-  ana->SetHistodRRangeAndNBins(0.,TMath::Pi(),150);
-  ana->SetHistoRatioRangeAndNBins(0.,2.,100);
-  ana->SetHistoVertexDistRangeAndNBins(0.,500.,500);
-  ana->SetHistoNClusterCellRangeAndNBins(0,500,500);
-  ana->SetHistoZRangeAndNBins(-400,400,200);
-  ana->SetHistoRRangeAndNBins(400,450,25);
-  ana->SetHistoV0SignalRangeAndNBins(0,5000,500);
-  ana->SetHistoV0MultiplicityRangeAndNBins(0,5000,500);
-  ana->SetHistoTrackMultiplicityRangeAndNBins(0,5000,500);
+  histoRanges->SetHistoFinePtRangeAndNBins(0, 10, 200) ; // bining for fhAmpId
+  histoRanges->SetHistodRRangeAndNBins(0.,TMath::Pi(),150);
+  histoRanges->SetHistoRatioRangeAndNBins(0.,2.,100);
+  histoRanges->SetHistoVertexDistRangeAndNBins(0.,500.,500);
+  histoRanges->SetHistoNClusterCellRangeAndNBins(0,500,500);
+  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);
   
 }
 
+
index 4a47f21324e01b6f834595a8689f06a94f8b11e5..adf0eaf2a11f0a1a5fe9773c0cd50e39b044e54d 100644 (file)
@@ -50,12 +50,15 @@ AliAnalysisTaskCaloTrackCorrelation *AddTaskCalorimeterQA(TString data,
   reader->SetCTSPtMin  (0.);
   reader->SetZvertexCut(10.);
   
-  if(kUseKinematics){
-    if(inputDataType == "ESD"){
+  if(kUseKinematics)
+  {
+    if(inputDataType == "ESD")
+    {
       reader->SwitchOnStack();          
       reader->SwitchOffAODMCParticles(); 
     }
-    else if(inputDataType == "AOD"){
+    else if(inputDataType == "AOD")
+    {
       reader->SwitchOffStack();          
       reader->SwitchOnAODMCParticles(); 
     }
@@ -63,16 +66,15 @@ AliAnalysisTaskCaloTrackCorrelation *AddTaskCalorimeterQA(TString data,
   
   reader->SetDeltaAODFileName(""); //Do not create deltaAOD file, this analysis do not create branches.
   reader->SwitchOffWriteDeltaAOD()  ;
+  reader->SetImportGeometryFromFile(kFALSE);
+  
   if(kPrintSettings) reader->Print("");
   
   // *** Calorimeters Utils    ***
   AliCalorimeterUtils *cu = new AliCalorimeterUtils;
   // Remove clusters close to borders, at least max energy cell is 1 cell away 
   cu->SetNumberOfCellsFromEMCALBorder(1);
-  if     (year==2010) cu->SetEMCALGeometryName("EMCAL_FIRSTYEARV1");
-  else if(year==2011) cu->SetEMCALGeometryName("EMCAL_COMPLETEV1"); 
-  else                cu->SetEMCALGeometryName("EMCAL_COMPLETE12SMV1"); 
-  
+
   AliEMCALRecoUtils* reco = cu->GetEMCALRecoUtils();
   reco->SwitchOnRejectExoticCell() ; // reject exotic cells, fill different histograms for exotic clusters and good clusters
   reco->SetExoticCellDiffTimeCut(10000); // Open  
index f601b0738a873e3c64d2b8587553b89f40ef9dbe..b843559cda938a960825e441e70e4e717ae28322 100644 (file)
@@ -23,7 +23,7 @@ enum anaModes {mLocal=0, mPROOF=1, mPlugin=2, mGRID=3};
 
 char * kInDir   = "/user/data/files/"; 
 char * kPattern = ""; // Data are in files kInDir/kPattern+i 
-Int_t  kFile    = 1
+Int_t  kFile    = 3
 
 //---------------------------------------------------------------------------
 // Dataset for proof analysis, mode=mPROOF
@@ -182,7 +182,7 @@ void ana(Int_t mode=mGRID)
   TString outputFile = AliAnalysisManager::GetCommonFileName(); 
   
   //-------------------------------------------------------------------------
-  //Define task, put here any other task that you want to use.
+  // Define task, put here any other task that you want to use.
   //-------------------------------------------------------------------------
   
   // Physics selection
@@ -199,12 +199,23 @@ void ana(Int_t mode=mGRID)
   // Simple event counting tasks
   AddTaskCounter("");   // All
   //AddTaskCounter("MB"); // Min Bias
+  AddTaskCounter("Any"); 
+  AddTaskCounter("AnyINT");// Min Bias
+
   if(!kMC)
   {
-    AddTaskCounter("INT7"); // Min Bias
-    //AddTaskCounter("EMC1"); // Trig Th > 1.5 GeV approx
+    AddTaskCounter("EMC1"); // Trig Th > 1.5 GeV approx
     AddTaskCounter("EMC7"); // Trig Th > 4-5 GeV 
-    AddTaskCounter("PHOS"); //  
+    AddTaskCounter("EMCEGA"); 
+    AddTaskCounter("EMCEJE"); 
+    if(kCollision=="PbPb")
+    {
+      AddTaskCounter("Central"); 
+      AddTaskCounter("SemiCentral"); 
+      AddTaskCounter("PHOSPb"); 
+    }
+    else AddTaskCounter("PHOS"); 
+
   }
     
   // -----------------
@@ -214,7 +225,7 @@ void ana(Int_t mode=mGRID)
   if(kInputData=="ESD"){
     printf("* Configure photon conversion analysis in macro \n");
     TString arguments = "-run-on-train -use-own-xyz  -force-aod -mc-off ";
-    gROOT->LoadMacro("$ALICE_ROOT/PWGGA/GammaConv/macros/ConfigGammaConversion.C");
+    gROOT->LoadMacro("$ALICE_ROOT/PWGGA/GammaConversion/macros/ConfigGammaConversion.C");
     AliAnalysisTaskGammaConversion * taskGammaConversion = 
     ConfigGammaConversion(arguments,mgr->GetCommonInputContainer());
     taskGammaConversion->SelectCollisionCandidates();
@@ -228,108 +239,137 @@ void ana(Int_t mode=mGRID)
   }
 */  
   
+  
+  
   Bool_t kPrint   = kFALSE;
   Bool_t deltaAOD = kFALSE;
   gROOT->LoadMacro("AddTaskCaloTrackCorr.C");   // $ALICE_ROOT/PWGGA/CaloTrackCorrelations/macros
-  gROOT->LoadMacro("$ALICE_ROOT/PWGGA/EMCALTasks/AddTaskEMCALClusterize.C"); // $ALICE_ROOT/PWGGA/EMCALTasks/macros  
-  
-  
-  // ------
-  // Tracks
-  // ------  
-
-  // Track isolation-correlation analysis and EMCAL QA analysis
-  AliAnalysisTaskCaloTrackCorrelation *anamb  = AddTaskCaloTrackCorr(kInputData, "EMCAL",   kPrint,kMC, deltaAOD,  outputFile.Data(), 
-                                                               kYear,kRun,kCollision,"INT7","");   // PHOS trigger
+  gROOT->LoadMacro("$ALICE_ROOT/PWGGA/EMCALTasks/macros/AddTaskEMCALClusterize.C"); // $ALICE_ROOT/PWGGA/EMCALTasks/macros  
   
-  AliAnalysisTaskCaloTrackCorrelation *anatr  = AddTaskCaloTrackCorr(kInputData, "EMCAL",   kPrint,kMC, deltaAOD,  outputFile.Data(), 
-                                                               kYear,kRun,kCollision,"EMC7","");  
+ // gROOT->LoadMacro("$ALICE_ROOT/PWGGA/CaloTrackCorrelations/macros/QA/AddTaskCalorimeterQA.C");  
+ // AliAnalysisTaskCaloTrackCorrelation * qatask = AddTaskCalorimeterQA(kInputData,kYear,kPrint,kMC); 
   
-  // -----
-  // EMCAL
-  // -----  
-  
-  Bool_t  bTrackMatch = kTRUE;
-  Int_t   minEcell    = 50;  // 50  MeV (10 MeV used in reconstruction)
-  Int_t   minEseed    = 100; // 100 MeV
-  Int_t   dTime       = 0;   // default, 250 ns
-  Int_t   wTime       = 0;   // default 425 < T < 825 ns
-  TString clTrigger   = "";  // Do not select, do Min Bias and triggered
-  
-  //Analysis with clusterizer V1
-  AliAnalysisTaskEMCALClusterize * clv1 = AddTaskEMCALClusterize(kMC,"V1",clTrigger,kRun,kPass, bTrackMatch,
-                                                                 minEcell,minEseed,dTime,wTime);    
-  
-  TString arrayNameV1(Form("V1_Ecell%d_Eseed%d_DT%d_WT%d",minEcell,minEseed, dTime,wTime));
-  printf("Name of clusterizer array: %s\n",arrayNameV1.Data());
-  
-  if(!kMC)
+  if(kCollision=="pp")
   {
+    printf("==================================== \n");
+    printf("CONFIGURE ANALYSIS FOR PP COLLISIONS \n");
+    printf("==================================== \n");
     
-    AliAnalysisTaskCaloTrackCorrelation *anav1tr  = AddTaskCaloTrackCorr(kInputData, "EMCAL",   kPrint,kMC, deltaAOD,  outputFile.Data(), 
-                                                                   kYear,kRun,kCollision,"EMC7",arrayNameV1);
+    Bool_t  clTM      = kTRUE;
+    Bool_t  reTM      = kFALSE; // Recalculate matches if not already done in clusterizer
+    Bool_t  anTM      = kTRUE;  // Remove matched
+    Bool_t  exo       = kTRUE;  // Remove exotic cells
+    Bool_t  annonlin  = kFALSE; // Apply non linearity (analysis)
+    Int_t   minEcell  = 50;     // 50  MeV (10 MeV used in reconstruction)
+    Int_t   minEseed  = 100;    // 100 MeV
+    Int_t   dTime     = 0;      // default, 250 ns
+    Int_t   wTime     = 0;      // default 425 < T < 825 ns
+    TString clTrigger = "EMC7";   
+    TString anTrigger = "EMC7";  
+    if(kMC) 
+    {
+      clTrigger = "";
+      anTrigger = "";
+    }
     
-    AliAnalysisTaskCaloTrackCorrelation *anav1mb  = AddTaskCaloTrackCorr(kInputData, "EMCAL",   kPrint,kMC, deltaAOD,  outputFile.Data(), 
-                                                                   kYear,kRun,kCollision,"INT7",arrayNameV1);
-  }
-  else 
-  {// No trigger (should be MB, but for single particle productions it does not work)
+    Bool_t  selectEvents = kFALSE; // Select events depending on V0, pile-up and vertex quality
+    Bool_t  qa     = kTRUE; // Do besides calorimeter QA analysis
+    Bool_t  hadron = kTRUE; // Do besides charged track correlations analysis    
     
-    AliAnalysisTaskCaloTrackCorrelation *anav1  = AddTaskCaloTrackCorr(kInputData, "EMCAL",   kPrint,kMC, deltaAOD,  outputFile.Data(), 
-                                                                 kYear,kRun,kCollision,"",arrayNameV1);
-  }
-  
-  
-  
-  //Analysis with clusterizer V2
-  AliAnalysisTaskEMCALClusterize * clv2 = AddTaskEMCALClusterize(kMC,"V2",clTrigger,kRun,kPass, bTrackMatch,
-                                                                 minEcell,minEseed,dTime,wTime);    
-  
-  TString arrayNameV2(Form("V2_Ecell%d_Eseed%d_DT%d_WT%d",minEcell,minEseed, dTime,wTime));
-  printf("Name of clusterizer array: %s\n",arrayNameV2.Data());
-  
-  if(!kMC)
-  {
+    //Analysis with clusterizer V1
     
-    AliAnalysisTaskCaloTrackCorrelation *anav2tr  = AddTaskCaloTrackCorr(kInputData, "EMCAL",   kPrint,kMC, deltaAOD,  outputFile.Data(), 
-                                                                   kYear,kRun,kCollision,"EMC7",arrayNameV2);
+    TString arrayNameV1 = "";
+    AliAnalysisTaskEMCALClusterize * clv1 = AddTaskEMCALClusterize(kMC,exo,"V1",arrayNameV1,clTrigger, clTM,
+                                                                   minEcell,minEseed,dTime,wTime);    
     
-    AliAnalysisTaskCaloTrackCorrelation *anav2mb  = AddTaskCaloTrackCorr(kInputData, "EMCAL",   kPrint,kMC, deltaAOD,  outputFile.Data(), 
-                                                                   kYear,kRun,kCollision,"INT7",arrayNameV2);
-  }
-  else 
-  {// No trigger (should be MB, but for single particle productions it does not work)
-    AliAnalysisTaskCaloTrackCorrelation *anav2  = AddTaskCaloTrackCorr(kInputData, "EMCAL",   kPrint,kMC, deltaAOD,  outputFile.Data(), 
-                                                                 kYear,kRun,kCollision,"",arrayNameV2);    
-  }
-  /*
-  // -----
-  // PHOS
-  // -----
+    printf("Name of clusterizer1 array: %s\n",arrayNameV1.Data());
+    
+    AliAnalysisTaskCaloTrackCorrelation *anav1   = AddTaskCaloTrackCorr(kInputData, "EMCAL", kMC, selectEvents, exo, annonlin, outputFile.Data(), 
+                                                                        kYear,kCollision,anTrigger,arrayNameV1,reTM,anTM, 
+                                                                        -1,-1, qa, hadron,deltaAOD,kPrint);
+    
+    
+    //Analysis with clusterizer V2
+    TString arrayNameV2 = "";
+    AliAnalysisTaskEMCALClusterize * clv2 = AddTaskEMCALClusterize(kMC,exo,"V2",arrayNameV2,clTrigger, clTM,
+                                                                   minEcell,minEseed,dTime,wTime);    
+
+    printf("Name of clusterizer2 array: %s\n",arrayNameV2.Data());
+    
+    hadron = kFALSE;
+    AliAnalysisTaskCaloTrackCorrelation *anav2   = AddTaskCaloTrackCorr(kInputData, "EMCAL", kMC, selectEvents, exo, annonlin, outputFile.Data(), 
+                                                                        kYear,kCollision,anTrigger,arrayNameV2,reTM,anTM, 
+                                                                        -1,-1,qa,hadron,deltaAOD,kPrint);
   
-  //Add here PHOS tender or whatever is needed
+  }
   
-  if(!kMC)
+  if(kCollision=="PbPb")
   {
+    printf("====================================== \n");
+    printf("CONFIGURE ANALYSIS FOR PbPb COLLISIONS \n");
+    printf("====================================== \n");
     
-    AliAnalysisTaskCaloTrackCorrelation *anav1tr = AddTaskCaloTrackCorr(kInputData, "PHOS", kPrint,kMC, deltaAOD,  outputFile.Data(), 
-                                                                  kYear,kRun,kCollision,"PHOS",""); // PHOS trigger
+    Bool_t  clTM      = kTRUE;
+    Bool_t  reTM      = kFALSE; // Recalculate matches if not already done in clusterizer
+    Bool_t  anTM      = kTRUE;  // Remove matched
+    Bool_t  exo       = kTRUE;  // Remove exotic cells
+    Bool_t  annonlin  = kFALSE; // Apply non linearity (analysis)
+    Int_t   minEcell  = 100;    // 50  MeV (10 MeV used in reconstruction)
+    Int_t   minEseed  = 200;    // 100 MeV
+    Int_t   dTime     = 0;      // default, 250 ns
+    Int_t   wTime     = 0;      // default 425 < T < 825 ns
+    TString clTrigger = "EMCGA"; 
+    TString anTrigger = "EMCGA";  
+    if(kMC) 
+    {
+      clTrigger = "";
+      anTrigger = "";
+    }
     
-    AliAnalysisTaskCaloTrackCorrelation *anav1mb = AddTaskCaloTrackCorr(kInputData, "PHOS",   kPrint,kMC, deltaAOD,  outputFile.Data(), 
-                                                                  kYear,kRun,kCollision,"INT7","");
+    Bool_t  selectEvents = kFALSE; // Select events depending on V0, pile-up and vertex quality
+    Bool_t  qa     = kTRUE; // Do besides calorimeter QA analysis
+    Bool_t  hadron = kTRUE; // Do besides charged track correlations analysis    
     
-  }
-  else 
-  {// No trigger
+    //Analysis with clusterizer V1
     
-    AliAnalysisTaskCaloTrackCorrelation *anav1mb = AddTaskCaloTrackCorr(kInputData, "PHOS",   kPrint,kMC, deltaAOD,  outputFile.Data(), 
-                                                                  kYear,kRun,kCollision,"","");
+    TString arrayNameV1 = "";
+    AliAnalysisTaskEMCALClusterize * clv1 = AddTaskEMCALClusterize(kMC,exo,"V1",arrayNameV1,clTrigger, clTM,
+                                                                   minEcell,minEseed,dTime,wTime);    
     
-  }
+    
+    printf("Name of clusterizer1 array: %s\n",arrayNameV1.Data());
+    
+    AliAnalysisTaskCaloTrackCorrelation *anav1c   = AddTaskCaloTrackCorr(kInputData, "EMCAL", kMC, selectEvents, exo, annonlin, outputFile.Data(), 
+                                                                         kYear,kCollision,anTrigger,arrayNameV1,reTM,anTM, 
+                                                                         0,20,qa,hadron,deltaAOD,kPrint);
+    AliAnalysisTaskCaloTrackCorrelation *anav1m   = AddTaskCaloTrackCorr(kInputData, "EMCAL", kMC, selectEvents, exo, annonlin, outputFile.Data(), 
+                                                                        kYear,kCollision,anTrigger,arrayNameV1,reTM,anTM,
+                                                                         20,40,qa,hadron,deltaAOD,kPrint);
+    AliAnalysisTaskCaloTrackCorrelation *anav1p   = AddTaskCaloTrackCorr(kInputData, "EMCAL", kMC,  selectEvents, exo, annonlin, outputFile.Data(), 
+                                                                        kYear,kCollision,anTrigger,arrayNameV1,reTM,anTM,
+                                                                         60,80,qa,hadron,deltaAOD,kPrint);
+  
+    //Analysis with clusterizer V2
 
-  */
+    TString arrayNameV2 = "";
+    AliAnalysisTaskEMCALClusterize * clv2 = AddTaskEMCALClusterize(kMC,exo,"V2",arrayNameV2,clTrigger, clTM,
+                                                                   minEcell,minEseed,dTime,wTime);        
+    
+    printf("Name of clusterizer2 array: %s\n",arrayNameV2.Data());
+    
+    hadron = kFALSE;
+    
+    AliAnalysisTaskCaloTrackCorrelation *anav2c   = AddTaskCaloTrackCorr(kInputData, "EMCAL", kMC, selectEvents, exo, annonlin, outputFile.Data(), 
+                                                                         kYear,kCollision,anTrigger,arrayNameV2,reTM,anTM, 
+                                                                         0,20,qa,hadron,deltaAOD,kPrint);
+    AliAnalysisTaskCaloTrackCorrelation *anav2m   = AddTaskCaloTrackCorr(kInputData, "EMCAL", kMC, selectEvents, exo, annonlin, outputFile.Data(), 
+                                                                         kYear,kCollision,anTrigger,arrayNameV2,reTM,anTM,
+                                                                         20,40,qa,hadron,deltaAOD,kPrint);
+    AliAnalysisTaskCaloTrackCorrelation *anav2p   = AddTaskCaloTrackCorr(kInputData, "EMCAL", kMC, selectEvents, exo, annonlin, outputFile.Data(), 
+                                                                         kYear,kCollision,anTrigger,arrayNameV2,reTM,anTM,
+                                                                         60,80,qa,hadron,deltaAOD,kPrint);
+  }
+  
   //-----------------------
   // Run the analysis
   //-----------------------    
@@ -366,7 +406,7 @@ void  LoadLibraries(Int_t mode)
     //     //proof->UploadPackage("JETAN");
     //     proof->UploadPackage("PHOSUtils");
     //     proof->UploadPackage("EMCALUtils");
-    //     proof->UploadPackage("PWGCaloTrackBase");
+    //     proof->UploadPackage("PWGCaloTrackCorrBase");
     //     proof->UploadPackage("PWGGACaloTrackCorrelations");
     //     proof->UploadPackage("PWGGAEMCALTasks");
     
@@ -380,7 +420,7 @@ void  LoadLibraries(Int_t mode)
     //     //proof->EnablePackage("JETAN");
     //     proof->EnablePackage("PHOSUtils");
     //     proof->EnablePackage("EMCALUtils");
-    //     proof->EnablePackage("PWGCaloTrackBase");
+    //     proof->EnablePackage("PWGCaloTrackCorrBase");
     //     proof->EnablePackage("PWGGACaloTrackCorrelations");
     //     proof->EnablePackage("PWGGAEMCALTasks");
     return;
@@ -404,6 +444,7 @@ void  LoadLibraries(Int_t mode)
   gSystem->Load("libAOD.so");
   gSystem->Load("libRAWDatabase.so"); // Root + libraries to if reclusterization is done
   gSystem->Load("libProof.so"); 
+  gSystem->Load("libOADB");
   gSystem->Load("libANALYSIS.so");
   gSystem->Load("libSTEER.so"); // Root + libraries to if reclusterization is done
   
@@ -436,12 +477,13 @@ void  LoadLibraries(Int_t mode)
   //SetupPar("PWGGACaloTrackCorrelations");
   //SetupPar("PWGGAEMCALTasks");
   
   //gSystem->Load("libJETAN");
   //gSystem->Load("FASTJETAN");
   //gSystem->Load("PWGJE");
 
-  gSystem->Load("libCORRFW.so");
-  gSystem->Load("libPWGGAGammaConv.so"); 
+  //gSystem->Load("libCORRFW.so");
+  //gSystem->Load("libPWGGAGammaConv.so"); 
   //SetupPar("PWGGAGammaConv"); 
   
   // needed for plugin?
@@ -953,12 +995,20 @@ void CheckEnvironmentVariables()
   }// args loop
   
   if(!sRun.Contains("LHC10")){
-    if ( kRun < 140000) {
+    if     ( kRun < 140000) 
+    {
       kYear = 2010;
       if( kRun >= 136851 ) kCollision = "PbPb";
     }
-    else{
+    else if( kRun < 170600)
+    {
       kYear = 2011;
+      if( kRun >= 166500 ) kCollision = "PbPb";
+    }
+    else 
+    {
+      kYear = 2012;
+
     }
   }
   
@@ -1008,6 +1058,43 @@ void AddTaskCounter(const TString trigger = "MB")
     printf("counter trigger PHOS\n");
     counter->SelectCollisionCandidates(AliVEvent::kPHI7);
   }
+  else if(trigger=="PHOSPb")
+  {
+    printf("counter trigger PHOSPb\n");
+    counter->SelectCollisionCandidates(AliVEvent::kPHOSPb);
+  }
+  else if(trigger=="AnyINT")
+  {
+    printf("counter trigger AnyINT\n");
+    counter->SelectCollisionCandidates(AliVEvent::kAnyINT);
+  }  
+  else if(trigger=="INT")
+  {
+    printf("counter trigger AnyINT\n");
+    counter->SelectCollisionCandidates(AliVEvent::kAny);
+  }
+  else if(trigger=="EMCEGA")
+  {
+    printf("counter trigger EMC Gamma\n");
+    counter->SelectCollisionCandidates(AliVEvent::kEMCEGA);
+  } 
+  else if(trigger=="EMCEJE")
+  {
+    printf("counter trigger EMC Jet\n");
+    counter->SelectCollisionCandidates(AliVEvent::kEMCEJE);
+  }
+  else if(trigger=="Central")
+  {
+    printf("counter trigger Central\n");
+    counter->SelectCollisionCandidates(AliVEvent::kCentral);
+  } 
+  else if(trigger=="SemiCentral")
+  {
+    printf("counter trigger SemiCentral\n");
+    counter->SelectCollisionCandidates(AliVEvent::kSemiCentral);
+  }
+  
+  
   
   TString outputFile = AliAnalysisManager::GetCommonFileName(); 
   AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer();
index b87c9c462a538484ff44bf1552fe3e5ea7ba887b..5cc1ed8eb1a1e91811ba7061aac0dde87d0edec8 100644 (file)
@@ -1,9 +1,9 @@
 AliAnalysisTaskEMCALClusterize* AddTaskEMCALClusterize(
                                                        const Int_t   bMC        = kFALSE,
+                                                       const Bool_t  exotic     = kTRUE,
                                                        const TString name       = "V1Unfold", 
+                                                       TString & arrayName,
                                                        const TString trigger    = "", 
-                                                       const Int_t   run        = 0, 
-                                                       const TString pass       = "pass3",
                                                        const Bool_t  tm         = kTRUE, 
                                                        const Int_t   minEcell   = 50,
                                                        const Int_t   minEseed   = 100,
@@ -16,75 +16,82 @@ AliAnalysisTaskEMCALClusterize* AddTaskEMCALClusterize(
   // Get the pointer to the existing analysis manager via the static access method.
   //==============================================================================
   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
-  if (!mgr) {
+  if (!mgr)
+  {
     ::Error("AddTaskEMCALClusterize", "No analysis manager to connect to.");
     return NULL;
   }  
   
   // Check the analysis type using the event handlers connected to the analysis manager.
   //==============================================================================
-  if (!mgr->GetInputEventHandler()) {
-    ::Error("AddTaskEMCALClusterize", "This task requires an input event handler");
+  if (!mgr->GetInputEventHandler())
+  {
+    ::Error("AddTaskEMCALClusterize", "This clusterize requires an input event handler");
     return NULL;
   }
   
+  //-------------------------------------------------------
+  // Init the task and do settings
+  //-------------------------------------------------------
+
   AliAnalysisTaskEMCALClusterize* clusterize = new AliAnalysisTaskEMCALClusterize(Form("EMCALClusterize%s_Ecell%d_Eseed%d_DT%d_WT%d",
                                                                                        name.Data(),minEcell,minEseed,maxDeltaT,timeWindow));
 
-  clusterize->SetAODBranchName(Form("%s_Ecell%d_Eseed%d_DT%d_WT%d",
-                                    name.Data(),minEcell,minEseed,maxDeltaT,timeWindow));
+  // Set clusters branch name, make sure the analysis after this one read this name
+  
+  arrayName = Form("%s_Ecell%d_Eseed%d_DT%d_WT%d",name.Data(),minEcell,minEseed,maxDeltaT,timeWindow);
+  clusterize->SetAODBranchName(arrayName);
 
-  printf("Created Branch Name: %s_Ecell%d_Eseed%d_DT%d_WT%d\n",name.Data(),minEcell,minEseed, maxDeltaT,timeWindow);
+  printf("Created Branch Name: \n",arrayName.Data());
   //clusterize->SetOCDBPath("local://$ALICE_ROOT/OCDB");
 
+  // Some general settings to create AOD file in case we want to keep it
   clusterize->SwitchOffFillAODCaloCells();
   clusterize->SwitchOffFillAODHeader();
   clusterize->FillAODFile(kFALSE); // fill aod.root with clusters?, not really needed for analysis.
 
+  // Do track matching after clusterization
   if(tm) clusterize->SwitchOnTrackMatching();
   else   clusterize->SwitchOffTrackMatching();
   
-  // Settings for LHC11a
-  if(run > 140000 && run <= 146860) {
-    clusterize->SwitchOnLEDEventsRemoval() ;
-    printf("Clusterizer: Reject LED events\n");
-  }
-  else clusterize->SwitchOffLEDEventsRemoval() ;
-  
-  printf(" ---- Clusterize RUN >%d< ---- \n",run);
-  
-  if     (run > 140000)  clusterize->SetGeometryName("EMCAL_COMPLETEV1");
-  else if(run > 171000)  clusterize->SetGeometryName("EMCAL_COMPLETE12SMV1");
-  else                   clusterize->SetGeometryName("EMCAL_FIRSTYEARV1");
+  //-------------------------------------------------------
+  // Set clusterization parameters via rec param
+  //-------------------------------------------------------
 
   AliEMCALRecParam * params = clusterize->GetRecParam();
 
+  // Position and SS weight parameter
   params->SetW0(4.5);
 
-  //printf("**** InputHandler %s ***\n",(mgr->GetInputEventHandler())->ClassName());
+  // Time cuts, depend on data type (no cells time in AODs)
   TString sHandler((mgr->GetInputEventHandler())->ClassName());
-  if(sHandler.Contains("AOD")){
+  if(sHandler.Contains("AOD"))
+  {
     printf("AliAnalysisTaskEMCALClusterize - Open time cuts for AODs\n");
     params->SetTimeCut(1e6);//Open this cut for AODs
     params->SetTimeMin(-1); //Open this cut for AODs
     params->SetTimeMax(1e6);//Open this cut for AODs    
   }
-  else{
+  else
+  {
     printf("AliAnalysisTaskEMCALClusterize - Set time cuts for ESDs\n");
     if(maxDeltaT > 1) params->SetTimeCut(maxDeltaT*1.e-9);
     else            { params->SetTimeCut(250*1.e-9); printf("default maxDeltaT = 250 ns\n"); }// Same as in reco
     
-    if(timeWindow > 1){
+    if(timeWindow > 1)
+    {
       params->SetTimeMin(-1*timeWindow*1.e-9);
       params->SetTimeMax(timeWindow*1.e-9);
     }
-    else{ // same as in reco
+    else
+    { // same as in reco
       params->SetTimeMin(425*1.e-9);
       params->SetTimeMax(825*1.e-9);
       printf("default time window 425 ns < T < 825 ns\n");
     }
   }
 
+  // Energy cuts
   params->SetClusteringThreshold(minEseed/1.e3);                                          
   params->SetMinECut            (minEcell/1.e3); 
 
@@ -93,68 +100,112 @@ AliAnalysisTaskEMCALClusterize* AddTaskEMCALClusterize(
   if(name.Contains("V1")) params->SetClusterizerFlag(AliEMCALRecParam::kClusterizerv1);
   if(name.Contains("NxN"))params->SetClusterizerFlag(AliEMCALRecParam::kClusterizerNxN);
 
+  //-------------------------------------------------------
+  // Unfolding, 2 options :
+  //-------------------------------------------------------
 
-  //Unfolding
+  //    1) Just unfold existing clusters
   if(name.Contains("JustUnfold"))
     clusterize->JustUnfold(kTRUE); // if TRUE, do just unfolding, do not recluster cells
   else  
     clusterize->JustUnfold(kFALSE); 
 
-  if (name.Contains("Unfold")){
-
+  //   2) Unfold clusters created in the clusterize (revise settings)
+  if (name.Contains("Unfold"))
+  {
     clusterize->SwitchOnCellEnergySelection();
     clusterize->SetCellCuts(minEUnf/1000.,minFrac/10000.);
     printf("AliAnalysisTaskEMCALClusterize - Cuts: min E %f, frac %f\n",minEUnf/1000.,minFrac/10000.);
     //clusterize->SwitchOffCellEnergySelection(); 
-
+    
     if(!name.Contains("Just"))
-    params->SetUnfold(kTRUE);
-  else 
-    params->SetUnfold(kFALSE);
-
+      params->SetUnfold(kTRUE);
+    else 
+      params->SetUnfold(kFALSE);
+    
   } // unfold
   
-  TGeoHMatrix* matrix[12];
+  //-------------------------------------------------------
+  // Configure AliEMCALRecoUtils
+  //-------------------------------------------------------
+
   AliEMCALRecoUtils * reco = clusterize->GetRecoUtils();
+  gROOT->LoadMacro("$ALICE_ROOT/PWGGA/EMCALTasks/macros/ConfigureEMCALRecoUtils.C"); // $ALICE_ROOT/PWGGA/EMCALTasks/macros
+  ConfigureEMCALRecoUtils(reco,bMC,exotic);
   
-  gROOT->LoadMacro("ConfigureEMCALRecoUtils.C"); // $ALICE_ROOT/PWGGA/EMCALTasks/macros
-  ConfigureEMCALRecoUtils(
-                          reco,
-                          bMC, 
-                          matrix,
-                          "",//AODB path, default
-                          run, 
-                          pass
-                          );
-  
+  //-------------------------------------------------------
   //Alignment matrices
-  
+  //-------------------------------------------------------
+
   clusterize->SetImportGeometryFromFile(kTRUE); // import geometry.root file
   
-  for (Int_t mod=0;mod<12;mod++)
-  {
-    //((TGeoHMatrix*) mobj->At(mod))->Print();
-    clusterize->SetGeometryMatrixInSM(matrix[mod],mod);
+  if(!kMC)
+  {    
+    clusterize->SwitchOnLoadOwnGeometryMatrices();
   }
   
-  clusterize->SwitchOnLoadOwnGeometryMatrices();
-    
+  //-------------------------------------------------------
+  // Trigger options
+  //-------------------------------------------------------
+
   if(trigger=="EMC7"){
-    printf("AliAnalysisTaskEMCALClusterize ---Data with kEMC7 Trigger and clusterizer %s\n",name.Data());
+    printf("Clusterizing task trigger EMC7\n");
     clusterize->SelectCollisionCandidates(AliVEvent::kEMC7);
   }
   else if (trigger=="INT7"){
-    printf("AliAnalysisTaskEMCALClusterize ---Data with kINT7 Trigger and clusterizer %s\n",name.Data());
+    printf("Clusterizing task trigger INT7\n");
     clusterize->SelectCollisionCandidates(AliVEvent::kINT7);
   }
   else if(trigger=="EMC1"){
-    printf("AliAnalysisTaskEMCALClusterize ---Data with kEMC1 Trigger and clusterizer %s\n",name.Data());
+    printf("Clusterizing task trigger EMC1\n");
     clusterize->SelectCollisionCandidates(AliVEvent::kEMC1);
   }
   else if(trigger=="MB"){
-    printf("AliAnalysisTaskEMCALClusterize ---Data with kMB Trigger and clusterizer %s\n",name.Data());
+    printf("Clusterizing task trigger MB\n");
     clusterize->SelectCollisionCandidates(AliVEvent::kMB);
+  }  
+  else if(trigger=="PHOS"){
+    printf("Clusterizing task trigger PHOS\n");
+    clusterize->SelectCollisionCandidates(AliVEvent::kPHI7);
+  }  
+  else if(trigger=="PHOSPb"){
+    printf("Clusterizing task trigger PHOSPb\n");
+    clusterize->SelectCollisionCandidates(AliVEvent::kPHOSPb);
   }
+  else if(trigger=="AnyINT")
+  {
+    printf("Clusterizing task trigger AnyINT\n");
+    clusterize->SelectCollisionCandidates(AliVEvent::kAnyINT);
+  }  
+  else if(trigger=="INT")
+  {
+    printf("Clusterizing task trigger AnyINT\n");
+    clusterize->SelectCollisionCandidates(AliVEvent::kAny);
+  }
+  else if(trigger=="EMCEGA")
+  {
+    printf("Clusterizing task trigger EMC Gamma\n");
+    clusterize->SelectCollisionCandidates(AliVEvent::kEMCEGA);
+  } 
+  else if(trigger=="EMCEJE")
+  {
+    printf("Clusterizing task trigger EMC Jet\n");
+    clusterize->SelectCollisionCandidates(AliVEvent::kEMCEJE);
+  }
+  else if(trigger=="Central")
+  {
+    printf("Clusterizing task trigger Central\n");
+    clusterize->SelectCollisionCandidates(AliVEvent::kCentral);
+  } 
+  else if(trigger=="SemiCentral")
+  {
+    printf("Clusterizing task trigger SemiCentral\n");
+    clusterize->SelectCollisionCandidates(AliVEvent::kSemiCentral);
+  }
+  
+  //-------------------------------------------------------
+  // Final settings, pass to manager and set the containers
+  //-------------------------------------------------------
 
   mgr->AddTask(clusterize);
   
index f3d90a8f981de205d0f61631b17f0fa8c671199d..7905a9a1109ffd8a3a9f3e9bb6296a7585d76b92 100644 (file)
 
-void ConfigureEMCALRecoUtils(
-                             AliEMCALRecoUtils* reco,
-                             Bool_t  bMC   = kFALSE,
-                             TGeoHMatrix* matrix[12],
-                             TString path  = "",
-                             Int_t   run   = 0, 
-                             TString pass  = "pass2",
-                             Bool_t bRecalE= kTRUE,
-                             Bool_t bBad   = kTRUE,
-                             Bool_t bRecalT= kFALSE
-                             )
+void ConfigureEMCALRecoUtils(AliEMCALRecoUtils* reco,
+                             Bool_t  bMC    = kFALSE,
+                             Bool_t  bExotic= kTRUE,
+                             Bool_t  bNonLin= kFALSE,
+                             Bool_t  bRecalE= kTRUE,
+                             Bool_t  bBad   = kTRUE,
+                             Bool_t  bRecalT= kFALSE)
 {  
 
   // Configure RecoUtils with OADB objects
   
-  printf("**** Configure AliEMCALRecoUtils, LOAD AODB ***\n");
-  printf("\t run %d, pass %s\n",run,pass.Data());
-  
+  printf("**** Configure AliEMCALRecoUtils ***\n");
   
   // Exotic cells removal
   
-  reco->SwitchOnRejectExoticCell() ;
-  reco->SetExoticCellDiffTimeCut(10000); // Open  
-  reco->SetExoticCellFractionCut(0.95);  // 1-Ecross/Ecell > 0.95 -> out
-  reco->SetExoticCellMinAmplitudeCut(0.75); // 750 MeV    
-  
-  gSystem->Load("libOADB");
-  
-  // Geometry settings, matrices
+  if(bExotic)
+  {
+    printf("Remove exotics in EMCAL\n");
+    reco->SwitchOnRejectExoticCell() ;
+    reco->SwitchOnRejectExoticCluster(); 
+    
+    reco->SetExoticCellDiffTimeCut(10000);    // Open  
+    reco->SetExoticCellFractionCut(0.95);     // 1-Ecross/Ecell > 0.95 -> out
+    reco->SetExoticCellMinAmplitudeCut(0.75); // 750 MeV    
+  }  
   
-  // Instantiate EMCAL geometry for the first time
+  //Recalibration factors
   
-  AliEMCALGeometry*   geom = 0; 
-  if     (run < 140000) geom = AliEMCALGeometry::GetInstance("EMCAL_FIRSTYEARV1");
-  else if(run < 171000) geom = AliEMCALGeometry::GetInstance("EMCAL_COMPLETEV1");
-  else                  geom = AliEMCALGeometry::GetInstance("EMCAL_COMPLETE12SMV1");
+  if(bRecalE && ! bMC)
+  {
+    reco->SwitchOnRecalibration();
+  } 
 
-  Int_t nSM = geom->GetNumberOfSuperModules();
-
-  // Alignment matrices
-
-  TString fileName="$ALICE_ROOT/OADB/EMCAL/EMCALlocal2master.root";
-  if(path!="") fileName=path+"EMCALlocal2master.root";
-
-  AliOADBContainer EMCALgeoCont("AliEMCALgeo");
-  EMCALgeoCont.InitFromFile((char*)fileName.Data(),"AliEMCALgeo");
-  TObjArray *mobj=(TObjArray*)EMCALgeoCont.GetObject(run,"EmcalMatrices");
-  for (Int_t mod=0;mod<nSM;mod++)
-    {
-      matrix[mod] = (TGeoHMatrix*) mobj->At(mod);
-      //matrix[mod]->Print();
-    }
-      
-  reco->SetPositionAlgorithm(AliEMCALRecoUtils::kPosTowerGlobal);   
-  
+  // Remove EMCAL hot channels 
   
-  // *** Energy recalibration settings ***
-  
-  if(pass == "pass3"){
-    bRecalE = kFALSE;
-    bBad   = kFALSE;
-  }
-  
-  if(bMC){
-    bRecalE = kFALSE;
+  if(bBad)
+  {
+    reco->SwitchOnBadChannelsRemoval();
+    reco->SwitchOnDistToBadChannelRecalculation();
   }
-  
-  //Recalibration factors
-  if(bRecalE){
-    
-    fileName="$ALICE_ROOT/OADB/EMCAL/EMCALRecalib.root";
-    if(path!="") fileName=path+"EMCALRecalib.root";
-    
-    AliOADBContainer *contRF=new AliOADBContainer("");
-    contRF->InitFromFile((char*)fileName.Data(),"AliEMCALRecalib");
-    
-    TObjArray *recal=(TObjArray*)contRF->GetObject(run); 
-    if(recal){
-      TObjArray *recalpass=(TObjArray*)recal->FindObject(pass);
-      if(recalpass){
-        TObjArray *recalib=(TObjArray*)recalpass->FindObject("Recalib");
-        if(recalib){
-          reco->SwitchOnRecalibration();
-          printf("AliEMCALRecoUtils - RECALIBRATE \n");
-          for (Int_t i=0; i<nSM; ++i) {
-            TH2F *h = reco->GetEMCALChannelRecalibrationFactors(i);
-            if (h)
-              delete h;
-            h = (TH2F*)recalib->FindObject(Form("EMCALRecalFactors_SM%d",i));
-            if (!h) {
-              AliError(Form("Could not load EMCALRecalFactors_SM%d",i));
-              continue;
-            }
-            h->SetDirectory(0);
-            reco->SetEMCALChannelRecalibrationFactors(i,h);
-          } 
-        }else printf("AliEMCALRecoUtils ---Do NOT recalibrate 1\n");
-      }else printf("AliEMCALRecoUtils ---Do NOT recalibrate 2\n");
-    }else printf("AliEMCALRecoUtils ---Do NOT recalibrate 3\n");
-    
-    //TFile * f = new TFile("RecalibrationFactors.root","read");
-    //for(Int_t i =0; i< 12; i++)  reco->SetEMCALChannelRecalibrationFactors( i, (TH2F*) f->Get(Form("EMCALRecalFactors_SM%d",i)));                                                                     
-    // //  reco->SwitchOnTimeDepCorrection();
-    // //  //char cmd[200] ; 
-    // //  //sprintf(cmd, ".!tar xvfz CorrectionFiles.tgz") ; 
-    // //  //gROOT->ProcessLine(cmd) ; 
-    // //      
-    
-  } else printf("AliEMCALRecoUtils ---Do NOT recalibrate\n");
-
-  // *** Remove EMCAL hot channels *** 
-  
-  if(bBad){
-    
-    fileName="$ALICE_ROOT/OADB/EMCAL/EMCALBadChannels.root";
-    if(path!="") fileName=path+"EMCALBadChannels.root";
-    
-    AliOADBContainer *contBC=new AliOADBContainer("");
-    contBC->InitFromFile((char*)fileName.Data(),"AliEMCALBadChannels"); 
-    TObjArray *arrayBC=(TObjArray*)contBC->GetObject(run);
-    if(arrayBC){
-      TObjArray *arrayBCpass=(TObjArray*)arrayBC->FindObject(pass);
-      if(arrayBCpass){
-        
-        reco->SwitchOnBadChannelsRemoval();
-        reco->SwitchOnDistToBadChannelRecalculation();
-        printf("AliEMCALRecoUtils - REMOVE bad cells \n");
-
-        for (Int_t i=0; i<nSM; ++i) {
-          TH2I *hbm = reco->GetEMCALChannelStatusMap(i);
-          if (hbm)
-            delete hbm;
-          hbm=(TH2I*)arrayBCpass->FindObject(Form("EMCALBadChannelMap_Mod%d",i));
-          
-          if (!hbm) {
-            AliError(Form("Can not get EMCALBadChannelMap_Mod%d",i));
-            continue;
-          }
-          
-          hbm->SetDirectory(0);
-          reco->SetEMCALChannelStatusMap(i,hbm);
-        }
-      } else printf("AliEMCALRecoUtils ---Do NOT remove bad channels 1\n");
-    }  else printf("AliEMCALRecoUtils ---Do NOT remove bad channels 2\n");
-  } else printf("AliEMCALRecoUtils ---Do NOT remove bad channels 3 \n");
-
-  /*  
-    Int_t iCol = -1, iRow = -1, iSM =-1, iMod = -1,iIphi =-1,iIeta = -1;
-    Int_t badAbsID[]={74, 103};
-    
-    for(Int_t i=0;i < sizeof(badAbsID)/sizeof(Int_t); i++){
-      geom->GetCellIndex(badAbsID[i],iSM,iMod,iIphi,iIeta); 
-      // Gives SuperModule and Tower numbers
-      geom->GetCellPhiEtaIndexInSModule(iSM,iMod,
-                                       iIphi, iIeta,iRow,iCol);
-      //printf("bad ID %d, col %d, row %d, sm %d\n",badAbsID[i],iCol,iRow,iSM);
-      reco->SetEMCALChannelStatus(iSM , iCol, iRow,1);
-    }
-
-    }
-   */
  
   // *** Time recalibration settings ***
   
-  if(bRecalT){
-    
+  if(bRecalT)
+  {
     reco->SwitchOnTimeRecalibration();
+  }
     
-    //Waiting for OADB, meanwhile
-    
-    TFile * ftime = 0;
-    TString path ="./"; 
-    //TString path = "alien:///alice/cern.ch/user/g/germain/RecalDB/Time";
-    //TGrid::Connect("alien://");
-    
-    if     (run > 140000 && run < 146500 )
-      ftime = TFile::Open(Form("%s/RefLHC11apass1-7TeV.root",path.Data()));
-    else if(run > 146500 && run <= 146860 )
-      ftime = TFile::Open(Form("%s/RefLHC11apass3-2.76TeV.root",path.Data()));
-    else if(run > 146860 && run < 156477 )
-      ftime = TFile::Open(Form("%s/RefLHC11cpass1-7TeV.root",path.Data()));
-    else if(run >= 156477)
-      ftime = TFile::Open(Form("%s/RefLHC11dpass1-7TeV.root",path.Data()));
-    else if(run <  140000 && run > 136850)
-      ftime = TFile::Open(Form("%s/RefLHC10hpass2PbPb2.76TeV.root",path.Data()));
-    else if(run < 136850)
-      ftime = TFile::Open(Form("%s/RefLHC10dpass2-7TeV.root",path.Data()));
-    else printf("Run %d, not considered for time calibration\n",run);
-    
-    if(ftime){
-      printf("AliEMCALRecoUtils - Time recalibration ON\n");
-      
-      for(Int_t i =0; i< 4; i++)  reco->SetEMCALChannelTimeRecalibrationFactors( i, (TH1F*) ftime->Get(Form("hAllTimeAvBC%d",i)));     
-    }
-    else printf("AliEMCALRecoUtils --- Time recalibration OFF\n");
+  // position
     
-  }    else printf("AliEMCALRecoUtils --- Time recalibration OFF 2\n");
+  reco->SetPositionAlgorithm(AliEMCALRecoUtils::kPosTowerGlobal);   
 
-    
+  
+  // Non linearity
+  
+  if( kNonLinearity ) 
+  { 
+    printf("Apply non linearity to EMCAL\n");
+    cu->SwitchOnCorrectClusterLinearity();
+    if(!kSimulation) reco->SetNonLinearityFunction(AliEMCALRecoUtils::kBeamTestCorrected);
+    else             reco->SetNonLinearityFunction(AliEMCALRecoUtils::kPi0MC);
+  }
+  
 }