#include "AliMUONSDigitizerV2.h"
#include "AliMUONDigitizerV3.h"
#include "AliMUONDigitMaker.h"
+#include "AliMUONDigit.h"
#include "AliMUONCalibrationData.h"
#include "AliMUONDigitStoreV1.h"
#include "AliMUONSt2GeometryBuilderV2.h"
#include "AliMUONSlatGeometryBuilder.h"
#include "AliMUONTriggerGeometryBuilder.h"
+#include "AliMUONDigitCalibrator.h"
+#include "AliMUONRecoParam.h"
+#include "AliCDBManager.h"
+#include "AliCDBEntry.h"
#include "AliMUONRawWriter.h"
fDigitMaker(0x0),
fHitStore(0x0),
fDigitStoreConcreteClassName(),
- fCalibrationData(0x0)
+ fCalibrationData(0x0),
+ fDigitCalibrator(0x0)
{
/// Default Constructor
fDigitMaker(new AliMUONDigitMaker),
fHitStore(0x0),
fDigitStoreConcreteClassName("AliMUONDigitStoreV2S"),
- fCalibrationData()
+ fCalibrationData(),
+ fDigitCalibrator(0x0)
{
/// Standard constructor
delete fDigitMaker;
delete fHitStore;
delete fCalibrationData;
+ delete fDigitCalibrator;
}
//_____________________________________________________________________________
//_____________________________________________________________________
Bool_t AliMUON::Raw2SDigits(AliRawReader* rawReader)
{
- /// Convert raw data to SDigit
+ /// Convert raw data to SDigit
if (!fLoader->TreeS()) fLoader->MakeSDigitsContainer();
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<AliMUONRecoParam*>(entry->GetObject())))
+ {
+ TObjArray* recoParamArray = static_cast<TObjArray*>(entry->GetObject());
+
+ for(Int_t i = 0; i < recoParamArray->GetEntriesFast(); ++i)
+ {
+ recoParam = static_cast<AliMUONRecoParam*>(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<AliMUONDigit*>(next()) ) )
+ {
+ sdigit->Calibrated(kFALSE);
+ sdigit->ChargeInFC();
+ }
+
treeS->Fill();
+
fLoader->WriteSDigits("OVERWRITE");
fLoader->UnloadSDigits();
class AliMUONDigitMaker;
class AliMUONVHitStore;
class AliMUONCalibrationData;
+class AliMUONDigitCalibrator;
class AliLoader;
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
{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()
{
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;
+}
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() {}
static Float_t fgAverageChamberT[14]; ///<average arrival time to chamber
+ static const Float_t fgkDefaultA0; ///< Default gain A0
+ static const Float_t fgkDefaultADC2MV; ///< Default ADC to mv conversion factor
+ static const Float_t fgkDefaultCapa; ///< Default Capa
+
ClassDef(AliMUONConstants, 0) // MUON global constants
};
return (fFlags & fgkConverted);
}
+//_____________________________________________________________________________
+Bool_t
+AliMUONDigit::IsChargeInFC() const
+{
+ /// Whether this digit is converted or not
+
+ return (fFlags & fgkChargeInFC);
+}
+
//_____________________________________________________________________________
Bool_t
}
}
+//_____________________________________________________________________________
+void
+AliMUONDigit::ChargeInFC(Bool_t value)
+{
+ /// Set the convertion status of this digit.
+
+ if ( value )
+ {
+ fFlags |= fgkChargeInFC;
+ }
+ else
+ {
+ fFlags &= ~fgkChargeInFC;
+ }
+}
+
//_____________________________________________________________________________
Int_t
AliMUONDigit::Track(Int_t i) const
virtual Bool_t IsNoiseOnly() const;
virtual Bool_t IsEfficiencyApplied() const;
virtual Bool_t IsConverted() const;
+ virtual Bool_t IsChargeInFC() const;
virtual UInt_t StatusMap() const { return fStatusMap; } ///< Return Neighbouring pad status
virtual void NoiseOnly(Bool_t value=kTRUE);
virtual void Saturated(Bool_t saturated=kTRUE);
virtual void EfficiencyApplied(Bool_t value=kTRUE);
virtual void Converted(Bool_t value=kTRUE);
+ virtual void ChargeInFC(Bool_t value=kTRUE);
virtual void SetADC(Int_t adc) {fADC=adc; } ///< Set ADC value
virtual void SetPadXY(Int_t padx, Int_t pady) {fPadX = padx; fPadY=pady; } ///< Set pad number along x
static const UInt_t fgkNoiseOnlyMask = 0x1000; ///< indicate a simulated digit due to noise only
static const UInt_t fgkEfficiencyMask = 0x2000; ///< indicate chamber efficiency has been applied to a simulated digit
static const UInt_t fgkConverted = 0x4000; ///< has been converted from a real digit
+ static const UInt_t fgkChargeInFC = 0x8000; ///< charge unit are femto coulomb
- ClassDef(AliMUONDigit,11) //Digits for MUON
+ ClassDef(AliMUONDigit,12) //Digits for MUON
};
#endif
#include "AliCDBManager.h"
#include "AliLog.h"
#include "AliMUONCalibrationData.h"
+#include "AliMUONConstants.h"
#include "AliMUONLogger.h"
#include "AliMUONPadStatusMaker.h"
#include "AliMUONPadStatusMapMaker.h"
// 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
//____________________________________________________________________
Int_t
AliMUONDigitMaker::Raw2Digits(AliRawReader* rawReader,
- AliMUONVDigitStore* digitStore,
- AliMUONVTriggerStore* triggerStore,
- Bool_t sdigit)
+ AliMUONVDigitStore* digitStore,
+ AliMUONVTriggerStore* triggerStore)
{
/// Main method to creates digit
/// for tracker
if ( fDigitStore )
{
fDigitStore->Clear(); // insure we start with an empty container
- tracker = ReadTrackerDDL(rawReader,sdigit);
+ tracker = ReadTrackerDDL(rawReader);
}
if ( fTriggerStore || fMakeTriggerDigits )
//____________________________________________________________________
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
digit->SetPadXY(pad.GetIx(),pad.GetIy());
- if ( sdigit )
- {
- digit->SetCharge(charge);
- }
- else
- {
- digit->SetADC(charge);
- }
+ digit->SetADC(charge);
+
}
if ( fRawStreamTracker->IsErrorMessage() )
// 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,
/// - 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.
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;
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;
}
// files.
for ( Int_t iFile = 0; iFile < nInputFiles; ++iFile )
- {
+ {
AliLoader* inputLoader = GetLoader(fManager->GetInputFolderName(iFile));
inputLoader->LoadSDigits("READ");
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).
// Generate noise-only digits for trigger.
GenerateNoisyDigitsForTrigger(*fDigitStore);
}
-
ApplyResponse(*fDigitStore,*fOutputDigitStore);
-
+
if ( fGenerateNoisyDigits )
{
// Generate noise-only digits for tracker.
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; }
#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+;
#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+;
AliMUONTrackerQAChecker.cxx \
AliMUONTriggerQAChecker.cxx \
AliMUONRecoParam.cxx \
- AliMUONPadStatusMaker.cxx
+ AliMUONPadStatusMaker.cxx \
+ AliMUONDigitCalibrator.cxx \
+ AliMUONPadStatusMapMaker.cxx
HDRS:= $(SRCS:.cxx=.h)
AliMUONTriggerTrack.cxx \
AliMUONVTriggerTrackStore.cxx \
AliMUONTriggerTrackStoreV1.cxx \
- AliMUONDigitCalibrator.cxx \
AliMUONVClusterFinder.cxx \
AliMUONPreClusterFinder.cxx \
AliMUONPreClusterFinderV2.cxx \
AliMUONClusterFinderCOG.cxx \
AliMUONPad.cxx \
AliMUONCluster.cxx \
- AliMUONPadStatusMapMaker.cxx \
AliMUONTrackHitPattern.cxx \
AliMUONVClusterStore.cxx \
AliMUONClusterStoreV1.cxx \