]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Add rough way to assing MC label to cell from cluster MC label, in case of old MC...
authorgconesab <gconesab@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 25 Jan 2013 14:14:45 +0000 (14:14 +0000)
committergconesab <gconesab@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 25 Jan 2013 14:14:45 +0000 (14:14 +0000)
ANALYSIS/TenderSupplies/AliEMCALTenderSupply.cxx
ANALYSIS/TenderSupplies/AliEMCALTenderSupply.h

index 1c7521792c0a0222ce2a62d69bac8aa93fbcb1b1..524fda75869fd19834a1b6bd9a65f8137b1ac224 100644 (file)
@@ -103,6 +103,7 @@ AliTenderSupply()
 ,fExoticCellFraction(-1)
 ,fExoticCellDiffTime(-1)
 ,fExoticCellMinAmplitude(-1)
+,fSetCellMCLabelFromCluster(kFALSE)
 {
   // Default constructor.
 
@@ -160,6 +161,7 @@ AliTenderSupply(name,tender)
 ,fExoticCellFraction(-1)
 ,fExoticCellDiffTime(-1)
 ,fExoticCellMinAmplitude(-1)
+,fSetCellMCLabelFromCluster(kFALSE)
 {
   // Named constructor
   
@@ -217,6 +219,7 @@ AliTenderSupply(name)
 ,fExoticCellFraction(-1)
 ,fExoticCellDiffTime(-1)
 ,fExoticCellMinAmplitude(-1)
+,fSetCellMCLabelFromCluster(kFALSE)
 {
   // Named constructor.
   
@@ -1416,6 +1419,32 @@ void AliEMCALTenderSupply::FillDigitsArray()
 
  if (!event)
     return;
+    
+  // In case of MC productions done before aliroot tag v5-02-Rev09
+  // assing the cluster label to all the cells belonging to this cluster
+  // very rough
+  Int_t cellLabels[12672];
+  if(fSetCellMCLabelFromCluster)
+  {
+    for (Int_t i = 0; i < 12672; i++) cellLabels[i] = 0;
+    
+    Int_t nClusters = event->GetNumberOfCaloClusters();
+    for (Int_t i = 0; i < nClusters; i++)
+    {
+      AliVCluster *clus =  event->GetCaloCluster(i);
+      
+      if(!clus) continue;
+      
+      if(!clus->IsEMCAL()) continue ;
+      
+      Int_t      label = clus->GetLabel();
+      UShort_t * index = clus->GetCellsAbsId() ;
+      
+      for(Int_t icell=0; icell < clus->GetNCells(); icell++ )
+        cellLabels[index[icell]] = label;
+      
+    }// cluster loop
+  }
   
   fDigitsArr->Clear("C");
   AliVCaloCells *cells = event->GetEMCALCells();
@@ -1436,17 +1465,11 @@ void AliEMCALTenderSupply::FillDigitsArray()
    if (fEMCALRecoUtils->IsExoticCell(cellNumber,cells,event->GetBunchCrossNumber())) 
       continue;
     
+    if(fSetCellMCLabelFromCluster) mcLabel = cellLabels[cellNumber];
+    
     new((*fDigitsArr)[idigit]) AliEMCALDigit(mcLabel, mcLabel, cellNumber,
                                              (Float_t)cellAmplitude, (Float_t)cellTime,
                                              AliEMCALDigit::kHG,idigit, 0, 0, 1);
-    
-//    AliEMCALDigit *digit = static_cast<AliEMCALDigit*>(fDigitsArr->New(idigit));
-//    digit->SetId(cellNumber);
-//    digit->SetTime((Float_t)cellTime);
-//    digit->SetTimeR((Float_t)cellTime);
-//    digit->SetIndexInList(idigit);
-//    digit->SetType(AliEMCALDigit::kHG);
-//    digit->SetAmplitude((Float_t)cellAmplitude);
     idigit++;
   }
 }
index e29c6290f906678b4d0b6b88b926c83c281c61d0..2bf4a5fdda3d26b06cf9bf8474dbc289cb5662c9 100644 (file)
@@ -151,10 +151,13 @@ public:
 
   void     SwitchOnUpdateCellOnly()                       { fDoUpdateOnly = kTRUE            ;} 
   void     SwitchOffUpdateCellOnly()                      { fDoUpdateOnly = kFALSE           ;}  
-
-  void     SwitchOnTrackMatch()                           { fDoTrackMatch = kTRUE            ;} 
-  void     SwitchOffTrackMatch()                          { fDoTrackMatch = kFALSE           ;}  
  
+  void     SwitchOnTrackMatch()                           { fDoTrackMatch = kTRUE            ;}
+  void     SwitchOffTrackMatch()                          { fDoTrackMatch = kFALSE           ;}
+
+  void     SwitchOnUseClusterMCLabelForCell()             { fSetCellMCLabelFromCluster = kTRUE  ;}
+  void     SwitchOffUseClusterMCLabelForCell()            { fSetCellMCLabelFromCluster = kFALSE ;}
+  
 private:
 
   AliVEvent* GetEvent();
@@ -225,9 +228,11 @@ private:
   Float_t                fExoticCellDiffTime;     // if time of candidate to exotic and close cell is too different (in ns), it must be noisy, set amp to 0
   Float_t                fExoticCellMinAmplitude; // check for exotic only if amplitud is larger than this value
 
+  Bool_t                 fSetCellMCLabelFromCluster; // Use cluster MC label as cell label
+  
   AliEMCALTenderSupply(const AliEMCALTenderSupply&c);
   AliEMCALTenderSupply& operator= (const AliEMCALTenderSupply&c);
   
-  ClassDef(AliEMCALTenderSupply, 12); // EMCAL tender task
+  ClassDef(AliEMCALTenderSupply, 13); // EMCAL tender task
 };
 #endif