From 861d6ce8403e80bf3bfd16d30f1717d54b4aaff2 Mon Sep 17 00:00:00 2001 From: ivana Date: Wed, 2 Apr 2008 07:49:54 +0000 Subject: [PATCH] - Added a protection in the recursive method AliMUONPreClusterFinder::Add, 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 | 75 ++++++++++++++++++++++++++++---- MUON/AliMUONDigitCalibrator.h | 6 ++- MUON/AliMUONPreClusterFinder.cxx | 39 +++++++++++++---- MUON/AliMUONPreClusterFinder.h | 5 ++- 4 files changed, 104 insertions(+), 21 deletions(-) diff --git a/MUON/AliMUONDigitCalibrator.cxx b/MUON/AliMUONDigitCalibrator.cxx index fb6f83d5530..06b52b32ee3 100644 --- a/MUON/AliMUONDigitCalibrator.cxx +++ b/MUON/AliMUONDigitCalibrator.cxx @@ -17,18 +17,20 @@ #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(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 ) { diff --git a/MUON/AliMUONDigitCalibrator.h b/MUON/AliMUONDigitCalibrator.h index e64c5b341e8..faa41e10819 100644 --- a/MUON/AliMUONDigitCalibrator.h +++ b/MUON/AliMUONDigitCalibrator.h @@ -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 diff --git a/MUON/AliMUONPreClusterFinder.cxx b/MUON/AliMUONPreClusterFinder.cxx index bd098848b91..dad97fa7aee 100644 --- a/MUON/AliMUONPreClusterFinder.cxx +++ b/MUON/AliMUONPreClusterFinder.cxx @@ -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(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(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 ) diff --git a/MUON/AliMUONPreClusterFinder.h b/MUON/AliMUONPreClusterFinder.h index 7ca9b559e1a..df17032704d 100644 --- a/MUON/AliMUONPreClusterFinder.h +++ b/MUON/AliMUONPreClusterFinder.h @@ -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 -- 2.43.0