]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
emcal clusterizer: add track matching recalculation for ESDs; PartCorr Reader, recalc...
authorgconesab <gconesab@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 22 Feb 2011 16:51:55 +0000 (16:51 +0000)
committergconesab <gconesab@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 22 Feb 2011 16:51:55 +0000 (16:51 +0000)
PWG4/CaloCalib/AliAnalysisTaskEMCALClusterize.cxx
PWG4/CaloCalib/AliAnalysisTaskEMCALClusterize.h
PWG4/CaloCalib/macros/emcalReclusterize.C
PWG4/PartCorrBase/AliCaloTrackReader.cxx

index 2e0a14431f2b5b7354b7b962ec817029f4747378..9f4bd7dc7d26dd673315984167ae23903ac2ecf4 100644 (file)
@@ -53,6 +53,7 @@
 #include "AliEMCALDigit.h"
 #include "AliCaloCalibPedestal.h"
 #include "AliEMCALCalibData.h"
+#include "AliEMCALRecoUtils.h"
 
 #include "AliAnalysisTaskEMCALClusterize.h"
 
@@ -66,7 +67,7 @@ AliAnalysisTaskEMCALClusterize::AliAnalysisTaskEMCALClusterize(const char *name)
   , fDigitsArr(0),       fClusterArr(0),       fCaloClusterArr(0)
   , fRecParam(0),        fClusterizer(0),      fUnfolder(0),           fJustUnfold(kFALSE) 
   , fOutputAODBranch(0), fOutputAODBranchName("newEMCALClusters"),     fFillAODFile(kTRUE)
-  , fRun(-1)
+  , fRun(-1),            fRecoUtils(0)
   
   {
   //ctor
@@ -75,7 +76,8 @@ AliAnalysisTaskEMCALClusterize::AliAnalysisTaskEMCALClusterize(const char *name)
   fClusterArr      = new TObjArray(100);
   fCaloClusterArr  = new TObjArray(100);
   fRecParam        = new AliEMCALRecParam;
-  fBranchNames="ESD:AliESDHeader.,EMCALCells.";
+  fBranchNames     = "ESD:AliESDHeader.,EMCALCells.";
+  fRecoUtils       = new AliEMCALRecoUtils();
 }
 
 //________________________________________________________________________
@@ -86,7 +88,7 @@ AliAnalysisTaskEMCALClusterize::AliAnalysisTaskEMCALClusterize()
   , fDigitsArr(0),       fClusterArr(0),       fCaloClusterArr(0)
   , fRecParam(0),        fClusterizer(0),      fUnfolder(0),           fJustUnfold(kFALSE)
   , fOutputAODBranch(0), fOutputAODBranchName("newEMCALClusters"),     fFillAODFile(kFALSE)
-  , fRun(-1)
+  , fRun(-1),            fRecoUtils(0)
 {
   // Constructor
   for(Int_t i = 0; i < 10; i++) fGeomMatrix[i] = 0 ;
@@ -94,7 +96,8 @@ AliAnalysisTaskEMCALClusterize::AliAnalysisTaskEMCALClusterize()
   fClusterArr      = new TObjArray(100);
   fCaloClusterArr  = new TObjArray(100);
   fRecParam        = new AliEMCALRecParam;
-  fBranchNames="ESD:AliESDHeader.,EMCALCells.";
+  fBranchNames     = "ESD:AliESDHeader.,EMCALCells.";
+  fRecoUtils       = new AliEMCALRecoUtils();
 }
 
 //________________________________________________________________________
@@ -117,8 +120,10 @@ AliAnalysisTaskEMCALClusterize::~AliAnalysisTaskEMCALClusterize()
     delete fCaloClusterArr; 
   }
 
-  if(fClusterizer) {delete fClusterizer;}
-  if(fUnfolder)    {delete fUnfolder;   }
+  if(fClusterizer) delete fClusterizer;
+  if(fUnfolder)    delete fUnfolder;   
+  if(fRecoUtils)   delete fRecoUtils;
+
 }
 
 //-------------------------------------------------------------------
@@ -143,7 +148,9 @@ void AliAnalysisTaskEMCALClusterize::UserExec(Option_t *)
   //Remove the contents of output list set in the previous event 
   fOutputAODBranch->Clear("C");
   
-  AliVEvent * event = InputEvent();
+  AliVEvent   * event    = InputEvent();
+  AliESDEvent * esdevent = dynamic_cast<AliESDEvent*>(InputEvent());
+
   if (!event) {
     Error("UserExec","Event not available");
     return;
@@ -304,6 +311,10 @@ void AliAnalysisTaskEMCALClusterize::UserExec(Option_t *)
     digitsTree  ->Delete("all");
   }
   
+  //Recalculate track-matching for the new clusters, only with ESDs
+  if(esdevent)fRecoUtils->FindMatches(esdevent,fCaloClusterArr);
+
+  
   //-------------------------------------------------------------------------------------
   //Put the new clusters in the AOD list
   //-------------------------------------------------------------------------------------
@@ -314,6 +325,16 @@ void AliAnalysisTaskEMCALClusterize::UserExec(Option_t *)
   for(Int_t i = 0; i < kNumberOfCaloClusters; i++){
     AliAODCaloCluster *newCluster = (AliAODCaloCluster *) fCaloClusterArr->At(i);
     //if(Entry()==0) Info("UserExec","newCluster E %f\n", newCluster->E());
+    
+    //Add matched track, if any, only with ESDs
+    if(esdevent){
+      Int_t trackIndex = fRecoUtils->GetMatchedTrackIndex(i);
+      if(trackIndex >= 0){
+        newCluster->AddTrackMatched(event->GetTrack(trackIndex));
+        if(DebugLevel() > 1) 
+          Info("UserExec","Matched Track index %d to new cluster %d \n",trackIndex,i);
+      }
+    }
     new((*fOutputAODBranch)[i])  AliAODCaloCluster(*newCluster);
   }
   
@@ -329,7 +350,7 @@ Bool_t AliAnalysisTaskEMCALClusterize::AccessOCDB()
   AliVEvent * event = InputEvent();
   if (!event)
   {
-    Warning("AccessODCD","Event not available!!!");
+    Warning("AccessOCDB","Event not available!!!");
     return kFALSE;
   }
 
@@ -341,10 +362,18 @@ Bool_t AliAnalysisTaskEMCALClusterize::AccessOCDB()
     Info("AccessODCD()"," Begin");
 
   fGeom = AliEMCALGeometry::GetInstance(fGeomName);
+  
+  
   AliCDBManager *cdb = AliCDBManager::Instance();
-  if (fOCDBpath.Length())
+    
+
+  if (fOCDBpath.Length()){
     cdb->SetDefaultStorage(fOCDBpath.Data());
+    Info("AccessOCDB","Default storage %s",fOCDBpath.Data());
+  }
+  
   cdb->SetRun(event->GetRunNumber());
+
   //
   // EMCAL from RAW OCDB
   if (fOCDBpath.Contains("alien:"))
@@ -352,14 +381,17 @@ Bool_t AliAnalysisTaskEMCALClusterize::AccessOCDB()
     cdb->SetSpecificStorage("EMCAL/Calib/Data","alien://Folder=/alice/data/2010/OCDB");
     cdb->SetSpecificStorage("EMCAL/Calib/Pedestals","alien://Folder=/alice/data/2010/OCDB");
   }
+
   TString path = cdb->GetDefaultStorage()->GetBaseFolder();
-    
+  
   // init parameters:
+  
   //Get calibration parameters 
   if(!fCalibData)
   {
     AliCDBEntry *entry = (AliCDBEntry*) 
       AliCDBManager::Instance()->Get("EMCAL/Calib/Data");
+    
     if (entry) fCalibData =  (AliEMCALCalibData*) entry->GetObject();
   }
   
@@ -371,6 +403,7 @@ Bool_t AliAnalysisTaskEMCALClusterize::AccessOCDB()
   {
     AliCDBEntry *entry = (AliCDBEntry*) 
       AliCDBManager::Instance()->Get("EMCAL/Calib/Pedestals");
+    
     if (entry) fPedestalData =  (AliCaloCalibPedestal*) entry->GetObject();
   }
     
@@ -378,6 +411,7 @@ Bool_t AliAnalysisTaskEMCALClusterize::AccessOCDB()
     AliFatal("Dead map not found in CDB!");
 
   InitClusterization();
+  
   return kTRUE;
 }
 
index f2d97acdfc4c6cec3c9d032c407ce0df36266f1e..d032c98db20f6cba51d9710ad91a097f7a16b0e7 100644 (file)
@@ -16,6 +16,8 @@ class AliCaloCalibPedestal;
 class AliEMCALClusterizer;\r
 class AliEMCALAfterBurnerUF;\r
 class AliEMCALRecParam;\r
+class AliEMCALRecoUtils;\r
+\r
 \r
 #include "AliAnalysisTaskSE.h"\r
 \r
@@ -38,7 +40,7 @@ class AliAnalysisTaskEMCALClusterize : public AliAnalysisTaskSE {
   \r
   //Geometry methods\r
   void           SetGeometryName(TString &name)                 { fGeomName = name             ; }\r
-  TString        GeometryName() const                           { return fGeomName             ; }  \r
+  TString        GeometryName()                          const  { return fGeomName             ; }  \r
   void           SwitchOnLoadOwnGeometryMatrices()              { fLoadGeomMatrices = kTRUE    ; }\r
   void           SwitchOffLoadOwnGeometryMatrices()             { fLoadGeomMatrices = kFALSE   ; } \r
   void           SetGeometryMatrixInSM(TGeoHMatrix* m, Int_t i) { fGeomMatrix[i]    = m        ; }\r
@@ -49,9 +51,12 @@ class AliAnalysisTaskEMCALClusterize : public AliAnalysisTaskSE {
   \r
   //Algorithms settings\r
   void           JustUnfold(Bool_t yesno)                       { fJustUnfold          = yesno ; }\r
-  AliEMCALRecParam * GetRecParam()    const                     { return fRecParam             ; }\r
+  AliEMCALRecParam * GetRecParam()                       const  { return fRecParam             ; }\r
   void           InitClusterization();\r
   \r
+  void SetEMCALRecoUtils(AliEMCALRecoUtils * ru)                { fRecoUtils           = ru    ; }\r
+  AliEMCALRecoUtils* GetRecoUtils()                      const  { return fRecoUtils            ; }\r
+  \r
  private:\r
     \r
   virtual void  RecPoints2Clusters(TClonesArray *fdigitsArr, TObjArray *fRecPoints, TObjArray *clusArray);\r
@@ -84,8 +89,12 @@ class AliAnalysisTaskEMCALClusterize : public AliAnalysisTaskSE {
   TString                fOutputAODBranchName;  // New of output AOD branch\r
   Bool_t                 fFillAODFile;      // Fill the output AOD file with the new clusters, \r
                                             // if not they will be only available for the event they were generated\r
- Int_t                   fRun;              //!run number\r
-  ClassDef(AliAnalysisTaskEMCALClusterize, 1);\r
+  Int_t                  fRun;              //!run number\r
+  \r
+  AliEMCALRecoUtils*     fRecoUtils;        // Access to factorized reconstruction algorithms\r
+  \r
+  \r
+  ClassDef(AliAnalysisTaskEMCALClusterize, 2);\r
 };\r
 \r
 #endif //ALIANALYSISTASKEMCALCLUSTERIZE_H\r
index 706325e94b26bf66c0821b660d18b3b57e7dba2a..e2af159b3b29cb757722c770c5a4ab45906c2133 100644 (file)
@@ -93,26 +93,24 @@ void emcalReclusterize(Int_t mode=mLocal)
       }
     
     mgr->SetDebugLevel(1);
+
+    // Create containers for input/output
+    AliAnalysisDataContainer *cinput1  = mgr->GetCommonInputContainer();
+    AliAnalysisDataContainer *coutput1 = mgr->GetCommonOutputContainer();
     
     //-------------------------------------------------------------------------
     //Define task, put here any other task that you want to use.
     //-------------------------------------------------------------------------
-    AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer();
-    AliAnalysisDataContainer *coutput1 = mgr->GetCommonOutputContainer();
     
     // ESD physics selection task
     if(kInputData == "ESD" && kUsePhysSel){
       gROOT->LoadMacro("AddTaskPhysicsSelection.C");
       AliPhysicsSelectionTask* physSelTask = AddTaskPhysicsSelection();
     }
-    
-    // Create containers for input/output
-    AliAnalysisDataContainer *cinput1  = mgr->GetCommonInputContainer();
-    AliAnalysisDataContainer *coutput1 = mgr->GetCommonOutputContainer();
  
     AliAnalysisTaskEMCALClusterize * clusterize = new AliAnalysisTaskEMCALClusterize("EMCALClusterize");
     if(kUsePhysSel)clusterize->SelectCollisionCandidates();
-    //clusterize->SetOCDBPath("local://$ALICE_ROOT/OCDB");
+    //clusterize->SetOCDBPath("local://$ALICE_ROOT/OCDB"); // by default it is raw://
     clusterize->FillAODFile(kFALSE); // fill aod.root with clusters?, not really needed for analysis.
     clusterize->JustUnfold(kTRUE); // if TRUE, do just unfolding, do not recluster cells
     AliEMCALRecParam * params = clusterize->GetRecParam();
index d5af7a3ea5738873de1e19a7d4707bc6fa4e7184..7d48b744d68cd366121625dc260cae9b9c060d6b 100755 (executable)
@@ -874,6 +874,10 @@ void AliCaloTrackReader::FillInputEMCAL() {
         }//EMCAL cluster
       }// cluster exists
     }// cluster loop
+    
+    //Recalculate track matching
+    if(fDataType==kESD)GetCaloUtils()->RecalculateClusterTrackMatching(fInputEvent);
+    
   }//Get the clusters from the input event
   else {
     TClonesArray * clusterList = dynamic_cast<TClonesArray*> (fOutputEvent->FindListObject(fEMCALClustersListName));
@@ -887,12 +891,14 @@ void AliCaloTrackReader::FillInputEMCAL() {
       //printf("E %f\n",clus->E());
       if (clus) FillInputEMCALAlgorithm(clus, iclus);
       else printf("AliCaloTrackReader::FillInputEMCAL() - Null cluster in list!\n");
+      
     }// cluster loop
+    
+    //Recalculate track matching, not necessary, already done in the reclusterization task
+    //GetCaloUtils()->RecalculateClusterTrackMatching(fInputEvent,clusterList);
+    
   }
-  
-  //Recalculate track matching
-  GetCaloUtils()->RecalculateClusterTrackMatching(fInputEvent);
-  
+    
   //fAODEMCALNormalInputEntries = fAODEMCAL->GetEntriesFast();
   if(fDebug > 1) printf("AliCaloTrackReader::FillInputEMCAL() - aod entries %d\n",  fAODEMCAL->GetEntriesFast());//fAODEMCALNormalInputEntries);