]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EMCAL/AliEMCALClusterizerNxN.cxx
delete trackParam
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALClusterizerNxN.cxx
index ce248cee10da8ab6cd4bd4290755077f06c9dd98..0e5ee37236fe223c2332135fee650d0e79cfc4ba 100644 (file)
@@ -67,14 +67,14 @@ ClassImp(AliEMCALClusterizerNxN)
 
 //____________________________________________________________________________
 AliEMCALClusterizerNxN::AliEMCALClusterizerNxN()
-: AliEMCALClusterizer(), fNRowDiff(1), fNColDiff(1)
+  : AliEMCALClusterizer(), fNRowDiff(1), fNColDiff(1), fEnergyGrad(0)
 {
   // ctor with the indication of the file where header Tree and digits Tree are stored
 }
 
 //____________________________________________________________________________
 AliEMCALClusterizerNxN::AliEMCALClusterizerNxN(AliEMCALGeometry* geometry)
-  : AliEMCALClusterizer(geometry), fNRowDiff(1), fNColDiff(1)
+  : AliEMCALClusterizer(geometry), fNRowDiff(1), fNColDiff(1), fEnergyGrad(0)
 {
   // ctor with the indication of the file where header Tree and digits Tree are stored
   // use this contructor to avoid usage of Init() which uses runloader
@@ -83,7 +83,7 @@ AliEMCALClusterizerNxN::AliEMCALClusterizerNxN(AliEMCALGeometry* geometry)
 
 //____________________________________________________________________________
 AliEMCALClusterizerNxN::AliEMCALClusterizerNxN(AliEMCALGeometry* geometry, AliEMCALCalibData * calib, AliCaloCalibPedestal * caloped)
-: AliEMCALClusterizer(geometry, calib, caloped), fNRowDiff(1), fNColDiff(1)
+: AliEMCALClusterizer(geometry, calib, caloped), fNRowDiff(1), fNColDiff(1), fEnergyGrad(0)
 {
   // ctor, geometry and calibration are initialized elsewhere.
 }
@@ -167,6 +167,11 @@ Int_t AliEMCALClusterizerNxN::AreNeighbours(AliEMCALDigit * d1, AliEMCALDigit *
   // The order of d1 and d2 is important: first (d1) should be a digit already in a cluster 
   //                                      which is compared to a digit (d2)  not yet in a cluster  
   
+  if (fEnergyGrad) { //false by default
+    if (d2->GetCalibAmp()>d1->GetCalibAmp())
+      return 3; // energy of neighboring cell should be smaller in order to become a neighbor
+  }
+
   Int_t nSupMod1=0, nModule1=0, nIphi1=0, nIeta1=0, iphi1=0, ieta1=0;
   Int_t nSupMod2=0, nModule2=0, nIphi2=0, nIeta2=0, iphi2=0, ieta2=0;
   Int_t rowdiff=0, coldiff=0;
@@ -228,13 +233,16 @@ void AliEMCALClusterizerNxN::MakeClusters()
   fNumberOfECAClusters = 0;
   fRecPoints->Delete();
   
-  // Set up TObjArray with pointers to digits to work on 
+  // Set up TObjArray with pointers to digits to work on, calibrate digits 
   TObjArray digitsC;
   TIter nextdigit(fDigitsArr);
   AliEMCALDigit *digit = 0;
   while ( (digit = static_cast<AliEMCALDigit*>(nextdigit())) ) {
-    Float_t dEnergyCalibrated = Calibrate(digit->GetAmplitude(), digit->GetTime(),digit->GetId());
+    Float_t dEnergyCalibrated = digit->GetAmplitude();
+    Float_t time              = digit->GetTime();
+    Calibrate(dEnergyCalibrated,time ,digit->GetId());
     digit->SetCalibAmp(dEnergyCalibrated);
+    digit->SetTime(time);    
     digitsC.AddLast(digit);
   }
   
@@ -254,9 +262,12 @@ void AliEMCALClusterizerNxN::MakeClusters()
     while ( (digit = static_cast<AliEMCALDigit *>(nextdigitC())) ) 
     { // scan over the list of digitsC
       Float_t dEnergyCalibrated = digit->GetCalibAmp();
-
-      if (fGeom->CheckAbsCellId(digit->GetId()) && dEnergyCalibrated > 0.0) // no threshold!
-      {
+      Float_t time              = digit->GetTime();
+      if (fGeom->CheckAbsCellId(digit->GetId()) &&
+          dEnergyCalibrated > fMinECut          &&
+          time              < fTimeMax          &&
+          time              > fTimeMin             ) // no threshold by default!
+      {                                              // needs to be set in OCDB!
         if (dEnergyCalibrated > dMaxEnergyDigit) 
         {
           dMaxEnergyDigit = dEnergyCalibrated;
@@ -308,9 +319,11 @@ void AliEMCALClusterizerNxN::MakeClusters()
       if (fNumberOfECAClusters >= fRecPoints->GetSize()) 
         fRecPoints->Expand(2*fNumberOfECAClusters+1);
       
-      AliEMCALRecPoint *recPoint = new  AliEMCALRecPoint(""); 
-      fRecPoints->AddAt(recPoint, fNumberOfECAClusters);
-      recPoint = static_cast<AliEMCALRecPoint *>(fRecPoints->At(fNumberOfECAClusters)); 
+      (*fRecPoints)[fNumberOfECAClusters] = new AliEMCALRecPoint("") ;
+      AliEMCALRecPoint *recPoint = dynamic_cast<AliEMCALRecPoint *>( fRecPoints->At(fNumberOfECAClusters) ) ;
+      // AliEMCALRecPoint *recPoint = new  AliEMCALRecPoint(""); 
+      // fRecPoints->AddAt(recPoint, fNumberOfECAClusters);
+      // recPoint = static_cast<AliEMCALRecPoint *>(fRecPoints->At(fNumberOfECAClusters)); 
       if (recPoint) {
         fNumberOfECAClusters++;       
         recPoint->SetClusterType(AliVCluster::kEMCALClusterv1);
@@ -319,10 +332,9 @@ void AliEMCALClusterizerNxN::MakeClusters()
         for (Int_t idig = 0; idig < clusterDigitList.GetEntries(); idig++)
         {
           digit = (AliEMCALDigit*)clusterDigitList.At(idig);
-          Float_t dEnergyCalibrated = digit->GetCalibAmp();
           AliDebug(5, Form(" Adding digit %d", digit->GetId()));
           // note: this way the sharing info is lost!
-          recPoint->AddDigit(*digit, dEnergyCalibrated, kFALSE); //Time or TimeR?
+          recPoint->AddDigit(*digit, digit->GetCalibAmp(), kFALSE); //Time or TimeR?
           digitsC.Remove(digit);                 
         }
       }// recpoint