X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=MUON%2FAliMUONDigitCalibrator.cxx;h=86a4d62198fe5c59035fe96eb04f601f2672d955;hb=69a6bda09099a2c63b6b5a9588a9aba85224cd37;hp=75f6868a9613c115c790029e7a1180271a6bb68a;hpb=58e1d4edca9e8b4255ce184ec1452e9d82668423;p=u%2Fmrichter%2FAliRoot.git diff --git a/MUON/AliMUONDigitCalibrator.cxx b/MUON/AliMUONDigitCalibrator.cxx index 75f6868a961..86a4d62198f 100644 --- a/MUON/AliMUONDigitCalibrator.cxx +++ b/MUON/AliMUONDigitCalibrator.cxx @@ -17,8 +17,11 @@ #include "AliMUONDigitCalibrator.h" +#include "AliCDBEntry.h" +#include "AliCDBManager.h" #include "AliLog.h" #include "AliMUONCalibrationData.h" +#include "AliMUONConstants.h" #include "AliMUONLogger.h" #include "AliMUONPadStatusMaker.h" #include "AliMUONPadStatusMapMaker.h" @@ -65,9 +68,7 @@ const Int_t AliMUONDigitCalibrator::fgkGain(2); const Int_t AliMUONDigitCalibrator::fgkInjectionGain(3); //_____________________________________________________________________________ -AliMUONDigitCalibrator::AliMUONDigitCalibrator(const AliMUONCalibrationData& calib, - const AliMUONRecoParam* recoParams, - const char* calibMode) +AliMUONDigitCalibrator::AliMUONDigitCalibrator(Int_t runNumber) : TObject(), fLogger(new AliMUONLogger(20000)), fStatusMaker(0x0), @@ -83,12 +84,64 @@ fMask(0) { /// ctor - Ctor(calibMode,calib,recoParams); + AliMUONRecoParam* recoParam(0x0); + + AliCDBEntry* e = AliCDBManager::Instance()->Get("MUON/Calib/RecoParam",runNumber); + if (e) + { + TObject* o = e->GetObject(); + if ( o->IsA() == TObjArray::Class() ) + { + TObjArray* a = static_cast(o); +// a->SetOwner(kTRUE); // FIXME: this should be done but somehow makes the reco crash at the end at cleaning stage... investigate why ? + TIter next(a); + AliMUONRecoParam* p; + while ( ( p = static_cast(next()) )) + { + if ( p->IsDefault()) recoParam = p; + } + } + else + { + recoParam = static_cast(o); + } + } + if (!recoParam) + { + AliError("Cannot get the recoParam. Failing"); + return; + } + + // OK. Now get all we need and work... + + AliMUONCalibrationData calib(runNumber); + + Ctor(calib,recoParam,kFALSE); } //_____________________________________________________________________________ AliMUONDigitCalibrator::AliMUONDigitCalibrator(const AliMUONCalibrationData& calib, - const char* calibMode) + const AliMUONRecoParam* recoParams) +: TObject(), +fLogger(new AliMUONLogger(20000)), +fStatusMaker(0x0), +fStatusMapMaker(0x0), +fPedestals(0x0), +fGains(0x0), +fApplyGains(0), +fCapacitances(0x0), +fNumberOfBadPads(0), +fNumberOfPads(0), +fChargeSigmaCut(0), +fMask(0) +{ + /// ctor + + Ctor(calib,recoParams); +} + +//_____________________________________________________________________________ +AliMUONDigitCalibrator::AliMUONDigitCalibrator(const AliMUONCalibrationData& calib, int /*b*/) : TObject(), fLogger(new AliMUONLogger(20000)), fStatusMaker(0x0), @@ -104,18 +157,19 @@ fMask(0) { /// ctor - Ctor(calibMode,calib,0x0); + Ctor(calib,0x0); } //_____________________________________________________________________________ void -AliMUONDigitCalibrator::Ctor(const char* calibMode, - const AliMUONCalibrationData& calib, - const AliMUONRecoParam* recoParams) +AliMUONDigitCalibrator::Ctor(const AliMUONCalibrationData& calib, + const AliMUONRecoParam* recoParams, + Bool_t deferredInitialization) { /// designated ctor - TString cMode(calibMode); + TString cMode("NOGAIN"); + if (recoParams) cMode=recoParams->GetCalibrationMode(); cMode.ToUpper(); if ( cMode == "NOGAIN" ) @@ -140,7 +194,7 @@ AliMUONDigitCalibrator::Ctor(const char* calibMode, } else { - AliError(Form("Invalid calib mode = %s. Will use NOGAIN instead",calibMode)); + AliError(Form("Invalid calib mode = %s. Will use NOGAIN instead",cMode.Data())); fApplyGains = fgkNoGain; } @@ -169,8 +223,11 @@ AliMUONDigitCalibrator::Ctor(const char* calibMode, fChargeSigmaCut = recoParams->ChargeSigmaCut(); } - - Bool_t deferredInitialization = kTRUE; + else + { + fLogger->Log("No RecoParam available"); + fLogger->Log(Form("SigmaCut=%e",fChargeSigmaCut)); + } fStatusMapMaker = new AliMUONPadStatusMapMaker(*fStatusMaker,fMask,deferredInitialization); @@ -234,6 +291,7 @@ AliMUONDigitCalibrator::Calibrate(AliMUONVDigitStore& digitStore) } digit->Calibrated(kTRUE); + digit->ChargeInFC(kTRUE); Float_t charge(0.0); Int_t statusMap; @@ -244,7 +302,7 @@ AliMUONDigitCalibrator::Calibrate(AliMUONVDigitStore& digitStore) Bool_t ok = IsValidDigit(digit->DetElemId(),digit->ManuId(),digit->ManuChannel(),&statusMap); digit->SetStatusMap(statusMap); - + if (ok) { charge = CalibrateDigit(digit->DetElemId(),digit->ManuId(),digit->ManuChannel(), @@ -257,6 +315,7 @@ AliMUONDigitCalibrator::Calibrate(AliMUONVDigitStore& digitStore) digit->SetCharge(charge); digit->Saturated(isSaturated); + } } @@ -270,6 +329,13 @@ AliMUONDigitCalibrator::CalibrateDigit(Int_t detElemId, Int_t manuId, Int_t manu /// Calibrate one digit /// Return the digit charge, in fC + if ( nsigmas < 0 ) + { + nsigmas = fChargeSigmaCut; + } + + fLogger->Log(Form("ChargeSigmaCut used = %e",nsigmas)); + AliMUONVCalibParam* pedestal = static_cast (fPedestals->FindObject(detElemId,manuId)); @@ -299,11 +365,11 @@ AliMUONDigitCalibrator::CalibrateDigit(Int_t detElemId, Int_t manuId, Int_t manu // Gain (mV/fC) = 1/(a0*capa) with a0~1.25 and capa~0.2 Float_t charge(0); - Float_t capa(0.2); // capa = 0.2 and a0 = 1.25 - Float_t a0(1.25); // is equivalent to gain = 4 mV/fC - Float_t a1(0); - Float_t adc2mv(0.61); // 1 ADC channel = 0.61 mV - Float_t injGain(4); // By default the gain is set to 4 mV/fC + Float_t capa(AliMUONConstants::DefaultCapa()); // capa = 0.2 and a0 = 1.25 + Float_t a0(AliMUONConstants::DefaultA0()); // is equivalent to gain = 4 mV/fC + Float_t a1(0); + Float_t adc2mv(AliMUONConstants::DefaultADC2MV()); // 1 ADC channel = 0.61 mV + Float_t injGain(4); // By default the gain is set to 4 mV/fC // // Note that the ChargeMax (for one pad) is roughly 4096 * 0.61 mV/channel / 4 mV/fC = 625 fC @@ -390,6 +456,9 @@ AliMUONDigitCalibrator::IsValidDigit(Int_t detElemId, Int_t manuId, Int_t manuCh { /// Check if a given pad is ok or not. + // initialize the statusmap to dead by default + if (statusMap) *statusMap = AliMUONPadStatusMapMaker::SelfDeadMask(); + // First a protection against bad input parameters AliMpDetElement* de = AliMpDDLStore::Instance()->GetDetElement(detElemId); if (!de) return kFALSE; // not existing DE @@ -408,7 +477,7 @@ AliMUONDigitCalibrator::IsValidDigit(Int_t detElemId, Int_t manuId, Int_t manuCh // ok, now we have a valid channel number, so let's see if that pad // behaves or not ;-) - Int_t sm = fStatusMapMaker->StatusMap(detElemId,manuId,manuChannel); + Int_t sm = StatusMap(detElemId,manuId,manuChannel); if (statusMap) *statusMap = sm;