From 5d950f54249d30f15d5b6efa743d46da6ade6386 Mon Sep 17 00:00:00 2001 From: laphecet Date: Mon, 10 Jan 2011 16:14:16 +0000 Subject: [PATCH] (hopefully) Last tweaks to have the embedding straight : the charge of sdigits is converted back to ADC units in case they are in fC (as is the case when coming from raw2sdigits) before going to digits (Javier) --- MUON/AliMUON.cxx | 60 ++++++++++++++++++++++++++++++--- MUON/AliMUON.h | 5 ++- MUON/AliMUONConstants.cxx | 14 ++++++++ MUON/AliMUONConstants.h | 16 ++++++++- MUON/AliMUONDigit.cxx | 25 ++++++++++++++ MUON/AliMUONDigit.h | 5 ++- MUON/AliMUONDigitCalibrator.cxx | 11 +++--- MUON/AliMUONDigitMaker.cxx | 19 ++++------- MUON/AliMUONDigitMaker.h | 5 ++- MUON/AliMUONDigitizerV3.cxx | 18 +++++++--- MUON/AliMUONVDigit.h | 3 ++ MUON/MUONbaseLinkDef.h | 4 +++ MUON/MUONrecLinkDef.h | 4 --- MUON/libMUONbase.pkg | 4 ++- MUON/libMUONrec.pkg | 2 -- 15 files changed, 155 insertions(+), 40 deletions(-) diff --git a/MUON/AliMUON.cxx b/MUON/AliMUON.cxx index 5bce7dffdce..b3eee0eb613 100644 --- a/MUON/AliMUON.cxx +++ b/MUON/AliMUON.cxx @@ -27,6 +27,7 @@ #include "AliMUONSDigitizerV2.h" #include "AliMUONDigitizerV3.h" #include "AliMUONDigitMaker.h" +#include "AliMUONDigit.h" #include "AliMUONCalibrationData.h" #include "AliMUONDigitStoreV1.h" @@ -44,6 +45,10 @@ #include "AliMUONSt2GeometryBuilderV2.h" #include "AliMUONSlatGeometryBuilder.h" #include "AliMUONTriggerGeometryBuilder.h" +#include "AliMUONDigitCalibrator.h" +#include "AliMUONRecoParam.h" +#include "AliCDBManager.h" +#include "AliCDBEntry.h" #include "AliMUONRawWriter.h" @@ -104,7 +109,8 @@ AliMUON::AliMUON() fDigitMaker(0x0), fHitStore(0x0), fDigitStoreConcreteClassName(), - fCalibrationData(0x0) + fCalibrationData(0x0), + fDigitCalibrator(0x0) { /// Default Constructor @@ -141,7 +147,8 @@ AliMUON::AliMUON(const char *name, const char* title) fDigitMaker(new AliMUONDigitMaker), fHitStore(0x0), fDigitStoreConcreteClassName("AliMUONDigitStoreV2S"), - fCalibrationData() + fCalibrationData(), + fDigitCalibrator(0x0) { /// Standard constructor @@ -205,6 +212,7 @@ AliMUON::~AliMUON() delete fDigitMaker; delete fHitStore; delete fCalibrationData; + delete fDigitCalibrator; } //_____________________________________________________________________________ @@ -508,7 +516,7 @@ void AliMUON::Digits2Raw() //_____________________________________________________________________ Bool_t AliMUON::Raw2SDigits(AliRawReader* rawReader) { - /// Convert raw data to SDigit + /// Convert raw data to SDigit if (!fLoader->TreeS()) fLoader->MakeSDigitsContainer(); @@ -519,8 +527,52 @@ Bool_t AliMUON::Raw2SDigits(AliRawReader* rawReader) sDigitStore->Connect(*treeS); if (!fDigitMaker) fDigitMaker = new AliMUONDigitMaker; - fDigitMaker->Raw2Digits(rawReader,sDigitStore,0x0,kTRUE); + + if (!fDigitCalibrator) + { + AliMUONRecoParam* recoParam = 0x0; + + AliCDBEntry* entry = AliCDBManager::Instance()->Get("MUON/Calib/RecoParam"); + + if (entry) + { + // load recoParam according OCDB content (single or array) + if (!(recoParam = dynamic_cast(entry->GetObject()))) + { + TObjArray* recoParamArray = static_cast(entry->GetObject()); + + for(Int_t i = 0; i < recoParamArray->GetEntriesFast(); ++i) + { + recoParam = static_cast(recoParamArray->UncheckedAt(i)); + if (recoParam->IsDefault()) break; + recoParam = 0x0; + } + } + } + + TString calibMode = recoParam->GetCalibrationMode(); + + fDigitCalibrator = new AliMUONDigitCalibrator(*fCalibrationData,recoParam,calibMode.Data()); + } + + fDigitMaker->Raw2Digits(rawReader,sDigitStore,0x0); + + fDigitCalibrator->Calibrate(*sDigitStore); + + TIter next(sDigitStore->CreateIterator()); + AliMUONDigit* sdigit; + + // now tweak the digits to make them "as fresh as possible", i.e. + // reset their calibrated status, as they'll be calibrated again + // once embedded. + while ( ( sdigit = static_cast(next()) ) ) + { + sdigit->Calibrated(kFALSE); + sdigit->ChargeInFC(); + } + treeS->Fill(); + fLoader->WriteSDigits("OVERWRITE"); fLoader->UnloadSDigits(); diff --git a/MUON/AliMUON.h b/MUON/AliMUON.h index 12c4776799d..fb7042c21e1 100644 --- a/MUON/AliMUON.h +++ b/MUON/AliMUON.h @@ -27,6 +27,7 @@ class AliMUONVGeometryBuilder; class AliMUONDigitMaker; class AliMUONVHitStore; class AliMUONCalibrationData; +class AliMUONDigitCalibrator; class AliLoader; @@ -187,7 +188,9 @@ class AliMUON : public AliDetector AliMUONCalibrationData* fCalibrationData; ///< pointer of calibration data - ClassDef(AliMUON,22) // MUON Detector base class + AliMUONDigitCalibrator* fDigitCalibrator; ///< digit calibrator (for raw2sdigits) + + ClassDef(AliMUON,23) // MUON Detector base class }; #endif diff --git a/MUON/AliMUONConstants.cxx b/MUON/AliMUONConstants.cxx index a4c08606a47..6ba88928659 100644 --- a/MUON/AliMUONConstants.cxx +++ b/MUON/AliMUONConstants.cxx @@ -118,6 +118,12 @@ Float_t AliMUONConstants::fgAverageChamberT[14]= {17.64*1E-9, 18.28*1E-9, 22.68*1E-9, 23.33*1E-9, 32.42*1E-9, 33.48*1E-9, 42.76*1E-9, 43.81*1E-9, 47.13*1E-9, 48.17*1E-9, 53.75*1E-9, 54.32*1E-9, 57.12*1E-9, 57.67*1E-9}; +// is equivalent to gain = 4 mV/fC +const Float_t AliMUONConstants::fgkDefaultA0 = 1.25; +// 1 ADC channel = 0.61 mV +const Float_t AliMUONConstants::fgkDefaultADC2MV = 0.61; +const Float_t AliMUONConstants::fgkDefaultCapa = 0.2; + //______________________________________________________________________________ Int_t AliMUONConstants::NCh() { @@ -184,3 +190,11 @@ Float_t AliMUONConstants::ReducedQTot(Float_t qtot, Float_t timeDif) Float_t q = qtot*1.19*(1.24-timeDif*1E6)*TMath::Exp(-(0.97-timeDif*1E6)*(0.97-timeDif*1E6)/2.42); return q; } + +//______________________________________________________________________________ +Float_t AliMUONConstants::FC2ADC() { + // Return conversionfactor fc to adc + Float_t fc2adc = 1./(DefaultA0()*DefaultCapa()*DefaultADC2MV()); + + return fc2adc; +} diff --git a/MUON/AliMUONConstants.h b/MUON/AliMUONConstants.h index ddfa73ec64a..7cfccf1b721 100644 --- a/MUON/AliMUONConstants.h +++ b/MUON/AliMUONConstants.h @@ -102,7 +102,17 @@ class AliMUONConstants : public TObject { static Float_t AverageChamberT(Int_t i) {return fgAverageChamberT[i];} /// Return a reduced total charge static Float_t ReducedQTot(Float_t qtot, Float_t timeDif); - + + // Return conversionfactor fc to adc + static Float_t FC2ADC(); + + // Return default a0 + static Float_t DefaultA0() { return fgkDefaultA0; } + // Return default adc2mv + static Float_t DefaultADC2MV() { return fgkDefaultADC2MV; } + // Return default Capa + static Float_t DefaultCapa() { return fgkDefaultCapa; } + protected: /// Default constructor AliMUONConstants() : TObject() {} @@ -160,6 +170,10 @@ class AliMUONConstants : public TObject { static Float_t fgAverageChamberT[14]; ///Clear(); // insure we start with an empty container - tracker = ReadTrackerDDL(rawReader,sdigit); + tracker = ReadTrackerDDL(rawReader); } if ( fTriggerStore || fMakeTriggerDigits ) @@ -220,7 +219,7 @@ AliMUONDigitMaker::Raw2Digits(AliRawReader* rawReader, //____________________________________________________________________ Int_t -AliMUONDigitMaker::ReadTrackerDDL(AliRawReader* rawReader, Bool_t sdigit) +AliMUONDigitMaker::ReadTrackerDDL(AliRawReader* rawReader) { /// Reading tracker DDL /// filling the fDigitStore container, which must not be null @@ -290,14 +289,8 @@ AliMUONDigitMaker::ReadTrackerDDL(AliRawReader* rawReader, Bool_t sdigit) digit->SetPadXY(pad.GetIx(),pad.GetIy()); - if ( sdigit ) - { - digit->SetCharge(charge); - } - else - { - digit->SetADC(charge); - } + digit->SetADC(charge); + } if ( fRawStreamTracker->IsErrorMessage() ) diff --git a/MUON/AliMUONDigitMaker.h b/MUON/AliMUONDigitMaker.h index d3215899fdd..0db61172832 100644 --- a/MUON/AliMUONDigitMaker.h +++ b/MUON/AliMUONDigitMaker.h @@ -46,10 +46,9 @@ class AliMUONDigitMaker : public TObject // write raw data Int_t Raw2Digits(AliRawReader* rawReader, AliMUONVDigitStore* digitContainer=0, - AliMUONVTriggerStore* triggerStore=0, - Bool_t sdigit=kFALSE); + AliMUONVTriggerStore* triggerStore=0); - Int_t ReadTrackerDDL(AliRawReader* rawReader, Bool_t sdigit); + Int_t ReadTrackerDDL(AliRawReader* rawReader); Int_t ReadTriggerDDL(AliRawReader* rawReader); Int_t TriggerDigits(Int_t nBoard, const TArrayS* xyPattern, diff --git a/MUON/AliMUONDigitizerV3.cxx b/MUON/AliMUONDigitizerV3.cxx index 548212871cd..57e7969114b 100644 --- a/MUON/AliMUONDigitizerV3.cxx +++ b/MUON/AliMUONDigitizerV3.cxx @@ -144,7 +144,7 @@ AliMUONDigitizerV3::ApplyResponseToTrackerDigit(AliMUONVDigit& digit, Bool_t add /// - add some electronics noise (thus leading to a realistic adc), if requested to do so /// - sets the signal to zero if below 3*sigma of the noise - Float_t charge = digit.Charge(); + Float_t charge = digit.IsChargeInFC() ? digit.Charge()*AliMUONConstants::FC2ADC() : digit.Charge(); // We set the charge to 0, as the only relevant piece of information // after Digitization is the ADC value. @@ -241,12 +241,13 @@ AliMUONDigitizerV3::DecalibrateTrackerDigit(const AliMUONVCalibParam& pedestals, Float_t pedestalSigma = pedestals.ValueAsFloat(channel,1); AliDebugClass(1,Form("DE %04d MANU %04d CH %02d PEDMEAN %7.2f PEDSIGMA %7.2f", - pedestals.ID0(),pedestals.ID1(),channel,pedestalMean,pedestalSigma)); + pedestals.ID0(),pedestals.ID1(),channel,pedestalMean,pedestalSigma)); Float_t a0 = gains.ValueAsFloat(channel,0); Float_t a1 = gains.ValueAsFloat(channel,1); Int_t thres = gains.ValueAsInt(channel,2); Int_t qual = gains.ValueAsInt(channel,3); + if ( qual <= 0 ) return 0; Float_t chargeThres = a0*thres; @@ -324,6 +325,13 @@ AliMUONDigitizerV3::DecalibrateTrackerDigit(const AliMUONVCalibParam& pedestals, if ( adc < TMath::Nint(pedestalMean + fgNSigmas*pedestalSigma + 0.5) ) { + AliErrorClass(Form(" DE %04d Manu %04d Channel %02d " + " a0 %7.2f a1 %7.2f thres %04d ped %7.2f pedsig %7.2f adcNoise %7.2f" + " charge=%7.2f padc=%7.2f adc=%04d ZS=%04d", + pedestals.ID0(),pedestals.ID1(),channel, + a0, a1, thres, pedestalMean, pedestalSigma, adcNoise, + charge, padc, adc, TMath::Nint(pedestalMean + fgNSigmas*pedestalSigma + 0.5))); + adc = 0; } @@ -409,7 +417,7 @@ AliMUONDigitizerV3::Exec(Option_t*) // files. for ( Int_t iFile = 0; iFile < nInputFiles; ++iFile ) - { + { AliLoader* inputLoader = GetLoader(fManager->GetInputFolderName(iFile)); inputLoader->LoadSDigits("READ"); @@ -437,6 +445,7 @@ AliMUONDigitizerV3::Exec(Option_t*) dstore->Clear(); } + // At this point, we do have digit arrays (one per chamber) which contains // the merging of all the sdigits of the input file(s). @@ -453,9 +462,8 @@ AliMUONDigitizerV3::Exec(Option_t*) // Generate noise-only digits for trigger. GenerateNoisyDigitsForTrigger(*fDigitStore); } - ApplyResponse(*fDigitStore,*fOutputDigitStore); - + if ( fGenerateNoisyDigits ) { // Generate noise-only digits for tracker. diff --git a/MUON/AliMUONVDigit.h b/MUON/AliMUONVDigit.h index b0d66e3e6ff..86fb19859e7 100644 --- a/MUON/AliMUONVDigit.h +++ b/MUON/AliMUONVDigit.h @@ -68,6 +68,9 @@ public: virtual Bool_t IsCalibrated() const=0; /// Set the calibrated status virtual void Calibrated(Bool_t value)=0; + + /// Whether this digit has charge in femto coulomb + virtual Bool_t IsChargeInFC() const { return kFALSE; } /// Whether or not this digit was obtained from a conversion (e.g. real to simulated) virtual Bool_t IsConverted() const { return kFALSE; } diff --git a/MUON/MUONbaseLinkDef.h b/MUON/MUONbaseLinkDef.h index 3880818bed5..a06831019bd 100644 --- a/MUON/MUONbaseLinkDef.h +++ b/MUON/MUONbaseLinkDef.h @@ -41,6 +41,10 @@ #pragma link C++ class AliMUONDigitMaker+; #pragma link C++ class AliMUONRawWriter+; +// calibration +#pragma link C++ class AliMUONDigitCalibrator+; +#pragma link C++ class AliMUONPadStatusMapMaker+; + // needed by qa (sim and rec) #pragma link C++ class AliMUONRecoParam+; #pragma link C++ class AliMUONPadStatusMaker+; diff --git a/MUON/MUONrecLinkDef.h b/MUON/MUONrecLinkDef.h index 90e76ecaa41..45f32cd3017 100644 --- a/MUON/MUONrecLinkDef.h +++ b/MUON/MUONrecLinkDef.h @@ -53,10 +53,6 @@ #pragma link C++ class AliMUONESDInterface+; -// calibration -#pragma link C++ class AliMUONDigitCalibrator+; -#pragma link C++ class AliMUONPadStatusMapMaker+; - // QA #pragma link C++ class AliMUONQADataMakerRec+; #pragma link C++ class AliMUONTrackerQADataMakerRec+; diff --git a/MUON/libMUONbase.pkg b/MUON/libMUONbase.pkg index 409c2195fc3..e43a0221d1d 100644 --- a/MUON/libMUONbase.pkg +++ b/MUON/libMUONbase.pkg @@ -28,7 +28,9 @@ SRCS:= AliMUONConstants.cxx \ AliMUONTrackerQAChecker.cxx \ AliMUONTriggerQAChecker.cxx \ AliMUONRecoParam.cxx \ - AliMUONPadStatusMaker.cxx + AliMUONPadStatusMaker.cxx \ + AliMUONDigitCalibrator.cxx \ + AliMUONPadStatusMapMaker.cxx HDRS:= $(SRCS:.cxx=.h) diff --git a/MUON/libMUONrec.pkg b/MUON/libMUONrec.pkg index d86ace2c666..c61f763b9a5 100644 --- a/MUON/libMUONrec.pkg +++ b/MUON/libMUONrec.pkg @@ -12,7 +12,6 @@ SRCS:= AliMUONReconstructor.cxx \ AliMUONTriggerTrack.cxx \ AliMUONVTriggerTrackStore.cxx \ AliMUONTriggerTrackStoreV1.cxx \ - AliMUONDigitCalibrator.cxx \ AliMUONVClusterFinder.cxx \ AliMUONPreClusterFinder.cxx \ AliMUONPreClusterFinderV2.cxx \ @@ -23,7 +22,6 @@ SRCS:= AliMUONReconstructor.cxx \ AliMUONClusterFinderCOG.cxx \ AliMUONPad.cxx \ AliMUONCluster.cxx \ - AliMUONPadStatusMapMaker.cxx \ AliMUONTrackHitPattern.cxx \ AliMUONVClusterStore.cxx \ AliMUONClusterStoreV1.cxx \ -- 2.43.0