]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
- Added a protection in the recursive method AliMUONPreClusterFinder::Add,
authorivana <ivana@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 2 Apr 2008 07:49:54 +0000 (07:49 +0000)
committerivana <ivana@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 2 Apr 2008 07:49:54 +0000 (07:49 +0000)
  so that it exits if we get more than 500 pads in a single cluster
- In AliMUONDigitCalibrator, if a given DE has more than 5% occupancy,
  I cut its pads at 10sigma instead of 3sigma, thus reducing the number
  of pads
(Laurent)

MUON/AliMUONDigitCalibrator.cxx
MUON/AliMUONDigitCalibrator.h
MUON/AliMUONPreClusterFinder.cxx
MUON/AliMUONPreClusterFinder.h

index fb6f83d5530d5cac3e96d237053dafcc4380f525..06b52b32ee32f89944e6c23bf6e582785adcf66c 100644 (file)
 
 #include "AliMUONDigitCalibrator.h"
 
+#include "AliLog.h"
 #include "AliMUONCalibrationData.h"
-#include "AliMUONVDigit.h"
-#include "AliMUONVDigitStore.h"
 #include "AliMUONLogger.h"
 #include "AliMUONPadStatusMaker.h"
 #include "AliMUONPadStatusMapMaker.h"
-#include "AliMUONVStore.h"
 #include "AliMUONVCalibParam.h"
+#include "AliMUONVDigit.h"
+#include "AliMUONVDigitStore.h"
+#include "AliMUONVStore.h"
+#include "AliMpBusPatch.h"
 #include "AliMpConstants.h"
-#include "AliMpDetElement.h"
 #include "AliMpDDLStore.h"
-#include "AliLog.h"
+#include "AliMpDEIterator.h"
+#include "AliMpDetElement.h"
 
 //-----------------------------------------------------------------------------
 /// \class AliMUONDigitCalibrator
@@ -68,7 +70,8 @@ fStatusMapMaker(0x0),
 fPedestals(0x0),
 fGains(0x0),
 fApplyGains(0),
-fCapacitances(0x0)
+fCapacitances(0x0),
+fNofChannelsPerDE(new TExMap)
 {
   /// ctor
   
@@ -127,6 +130,36 @@ fCapacitances(0x0)
   {
     fCapacitances = calib.Capacitances();
   }
+  
+  // FIXME: get the nof of channels per de directly within AliMpDetElement ?
+  // or use the AliMUONTrackerData class for that ?
+  
+  AliMpDEIterator it;
+  
+  it.First();
+  
+  while ( !it.IsDone() ) 
+  {
+    
+    AliMpDetElement* det = it.CurrentDE();
+    Int_t detElemId = det->GetId();
+    Int_t nchannels(0);
+    
+    for ( Int_t i = 0; i < det->GetNofBusPatches(); ++i ) 
+    {
+      Int_t busPatchId = det->GetBusPatchId(i);
+      AliMpBusPatch* bp = AliMpDDLStore::Instance()->GetBusPatch(busPatchId);
+      for ( Int_t j = 0; j < bp->GetNofManus(); ++j ) 
+      {
+        Int_t manuId = bp->GetManuId(j);
+        nchannels += det->NofChannelsInManu(manuId);
+      }        
+    }
+    
+    it.Next();
+    
+    fNofChannelsPerDE->Add((Long_t)detElemId,(Long_t)nchannels);
+  }
 }
 
 //_____________________________________________________________________________
@@ -140,6 +173,7 @@ AliMUONDigitCalibrator::~AliMUONDigitCalibrator()
   fLogger->Print();
 
   delete fLogger;
+  delete fNofChannelsPerDE;
 }
 
 //_____________________________________________________________________________
@@ -149,16 +183,39 @@ AliMUONDigitCalibrator::Calibrate(AliMUONVDigitStore& digitStore)
   /// Calibrate the digits contained in digitStore  
   TIter next(digitStore.CreateTrackerIterator());
   AliMUONVDigit* digit;
+  Int_t detElemId(-1);
+  Double_t nsigmas(3.0);
+  
+  AliDebug(1,Form("# of digits = %d",digitStore.GetSize()));
   
   while ( ( digit = static_cast<AliMUONVDigit*>(next() ) ) )
   {
-    CalibrateDigit(*digit);
+    if ( digit->DetElemId() != detElemId ) 
+    {
+      // Find out occupancy of that DE
+      detElemId = digit->DetElemId();
+      Double_t nchannels = fNofChannelsPerDE->GetValue(detElemId);
+      Double_t occ = digitStore.GetSize(detElemId)/nchannels;
+      if ( occ > 0.05 ) 
+      {
+        nsigmas = 10.0; // enlarge (a lot) sigma cut if occupancy is high
+        // (which probably means zero suppression was not exactly OK).
+        fLogger->Log(Form("Will use %5.0f*sigma cut for DE %04d "
+                          "due to high occupancy",nsigmas,detElemId));
+      }
+      else
+      {
+        nsigmas = 3.0;
+      }
+    }
+
+     CalibrateDigit(*digit,nsigmas);
   }
 }
 
 //_____________________________________________________________________________
 void
-AliMUONDigitCalibrator::CalibrateDigit(AliMUONVDigit& digit)
+AliMUONDigitCalibrator::CalibrateDigit(AliMUONVDigit& digit, Double_t nsigmas)
 {
   /// Calibrate one digit
   
@@ -247,7 +304,7 @@ AliMUONDigitCalibrator::CalibrateDigit(AliMUONVDigit& digit)
       }
     }
     
-    if ( padc > 3.0*pedestal->ValueAsFloat(manuChannel,1) ) 
+    if ( padc > nsigmas*pedestal->ValueAsFloat(manuChannel,1) ) 
     {
       if ( fApplyGains != fgkNoGain ) 
       {
index e64c5b341e8a23c1b7469558ec22db12d43558a8..faa41e10819c0f4886e6d836ea306e09c315469d 100644 (file)
@@ -23,6 +23,7 @@ class AliMUONVDigitStore;
 class AliMUONVDigit;
 class AliMUONPadStatusMaker;
 class AliMUONPadStatusMapMaker;
+class TExMap;
 
 class AliMUONDigitCalibrator : public TObject
 {
@@ -39,7 +40,7 @@ private:
     /// Not implemented
     AliMUONDigitCalibrator& operator=(const AliMUONDigitCalibrator& other);
 
-    virtual void CalibrateDigit(AliMUONVDigit& digit);
+    virtual void CalibrateDigit(AliMUONVDigit& digit, Double_t nsigmas);
 
 private:
     AliMUONLogger* fLogger; //!< to log repeated messages
@@ -49,12 +50,13 @@ private:
     AliMUONVStore* fGains; //!< gain values
     Int_t fApplyGains; //!< whether we should apply gains or not, capa or not...
     AliMUONVStore* fCapacitances; //!< capa values
+    TExMap* fNofChannelsPerDE; //!< store nof channels within detection elements
     
     static const Int_t fgkNoGain; //!< do not apply gain calib at all
     static const Int_t fgkGainConstantCapa; //!< apply gain (from OCDB) with constant capa
     static const Int_t fgkGain; //!< apply gain and capa (from OCDB)
     
-  ClassDef(AliMUONDigitCalibrator,5) // Calibrate raw digit
+  ClassDef(AliMUONDigitCalibrator,6) // Calibrate raw digit
 };
 
 #endif
index bd098848b91bd093ef71d35290b0e1bd60c482a2..dad97fa7aeeea6589731b396c78b1fb92a274da5 100644 (file)
@@ -50,7 +50,8 @@ AliMUONPreClusterFinder::AliMUONPreClusterFinder()
   fClusters(0x0),
   fPads(0x0),
   fDetElemId(0),
-  fArea()
+  fArea(),
+  fShouldAbort(kFALSE)
 {
   /// ctor
 }
@@ -94,6 +95,8 @@ AliMUONPreClusterFinder::Prepare(Int_t detElemId,
   fDetElemId = detElemId;
   fArea = area;
   
+  fShouldAbort = kFALSE;
+  
   return kTRUE;
 }
 
@@ -102,6 +105,13 @@ void
 AliMUONPreClusterFinder::AddPad(AliMUONCluster& cluster, AliMUONPad* pad)
 {
   /// Add a pad to a cluster
+  
+  if ( cluster.Multiplicity() > 500 ) 
+  {
+    fShouldAbort = kTRUE;
+    return;
+  }
+  
   cluster.AddPad(*pad);
   
   Int_t cathode = pad->Cathode();
@@ -210,20 +220,31 @@ AliMUONPreClusterFinder::NextCluster()
     // Builds (recursively) a cluster on first cathode only
     AddPad(*cluster,pad);
     
-    // On the 2nd cathode, only add pads overlapping with the current cluster
-    TClonesArray& padArray = *fPads[1];
-    TIter next(&padArray);
-    AliMUONPad* testPad;
-  
-    while ( ( testPad = static_cast<AliMUONPad*>(next())))
+    if ( !ShouldAbort() ) 
     {
-      if (AreOverlapping(*testPad,*cluster) )
+      // On the 2nd cathode, only add pads overlapping with the current cluster
+      TClonesArray& padArray = *fPads[1];
+      TIter next(&padArray);
+      AliMUONPad* testPad;
+      
+      while ( ( testPad = static_cast<AliMUONPad*>(next())) && !ShouldAbort() )
       {
-        AddPad(*cluster,testPad);
+        if (AreOverlapping(*testPad,*cluster) )
+        {
+          AddPad(*cluster,testPad);
+        }
       }
     }
   }
   
+  if ( ShouldAbort() ) 
+  {
+    AliError("Aborting clustering of that DE because we've got too many pads");
+    fClusters->Remove(cluster);
+    fClusters->Compress();
+    return 0x0;
+  }
+  
   if ( cluster->Multiplicity() <= 1 )
   {
     if ( cluster->Multiplicity() == 0 ) 
index 7ca9b559e1ad0dc46b6fdcd738e4e6e084b6cd36..df17032704d98046292210c55dfda60a98106fbc 100644 (file)
@@ -48,13 +48,16 @@ private:
   
   AliMUONPad* GetNextPad(Int_t cathode) const;
 
+  virtual Bool_t ShouldAbort() const { return fShouldAbort; }
+  
 private:
   TClonesArray* fClusters; //!< the clusters we've found (owner)
   TClonesArray** fPads; //!< the pads corresponding to the digits (not owner)
   Int_t fDetElemId; //!< which DE we're considering
   AliMpArea fArea; //!< area into which to consider pads to *start* a cluster
+  Bool_t fShouldAbort; //!< to indicate clustering should stop right now
   
-  ClassDef(AliMUONPreClusterFinder,2) // A basic pre-cluster finder
+  ClassDef(AliMUONPreClusterFinder,3) // A basic pre-cluster finder
 };
 
 #endif