]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWGGA/EMCALTasks/macros/AddTaskEMCALClusterize.C
update macros after last changes
[u/mrichter/AliRoot.git] / PWGGA / EMCALTasks / macros / AddTaskEMCALClusterize.C
index 74f529c471e4b6e99fa0483f1d7b54f031eb9ae1..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,74 +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              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); 
 
@@ -92,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[10];
+  //-------------------------------------------------------
+  // 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<10;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);