From 7754cd1f78851b92317ec92ab52e0124eee76da8 Mon Sep 17 00:00:00 2001 From: cblume Date: Wed, 15 Mar 2006 08:09:23 +0000 Subject: [PATCH] Update of calibration classes by Jan Fiete --- TRD/AliTRDReconstructor.cxx | 29 -- TRD/AliTRDReconstructor.h | 2 - TRD/AliTRDcalibDB.cxx | 434 ++++++++++++++++++----- TRD/AliTRDcalibDB.h | 68 ++-- TRD/AliTRDclusterizer.cxx | 5 - TRD/AliTRDclusterizer.h | 5 - TRD/AliTRDclusterizerV1.cxx | 1 - TRD/AliTRDclusterizerV1.h | 1 - TRD/AliTRDdigitizer.cxx | 68 ++-- TRD/AliTRDdigitizer.h | 10 +- TRD/AliTRDgeometry.cxx | 15 +- TRD/AliTRDgeometry.h | 3 +- TRD/AliTRDpidESD.cxx | 2 +- TRD/AliTRDsimpleMC.cxx | 20 +- TRD/AliTRDsimpleMC.h | 4 +- TRD/AliTRDtracker.cxx | 1 - TRD/AliTRDtracker.h | 1 - TRD/Cal/AliTRDCalChamberPos.cxx | 58 +++ TRD/Cal/AliTRDCalChamberPos.h | 39 ++ TRD/Cal/AliTRDCalChamberStatus.cxx | 52 +++ TRD/Cal/AliTRDCalChamberStatus.h | 36 ++ TRD/Cal/AliTRDCalDet.cxx | 102 ++++++ TRD/Cal/AliTRDCalDet.h | 45 +++ TRD/Cal/AliTRDCalGlobals.cxx | 59 +++ TRD/Cal/AliTRDCalGlobals.h | 37 ++ TRD/Cal/AliTRDCalMCMStatus.cxx | 116 ++++++ TRD/Cal/AliTRDCalMCMStatus.h | 57 +++ TRD/Cal/AliTRDCalMonitoring.cxx | 57 +++ TRD/Cal/AliTRDCalMonitoring.h | 50 +++ TRD/Cal/AliTRDCalPIDLQ.cxx | 348 ++++++++++++++++++ TRD/Cal/AliTRDCalPIDLQ.h | 73 ++++ TRD/Cal/AliTRDCalPad.cxx | 136 +++++++ TRD/Cal/AliTRDCalPad.h | 49 +++ TRD/Cal/AliTRDCalPadStatus.cxx | 117 ++++++ TRD/Cal/AliTRDCalPadStatus.h | 59 +++ TRD/Cal/AliTRDCalROC.cxx | 208 +++++++++++ TRD/Cal/AliTRDCalROC.h | 57 +++ TRD/Cal/AliTRDCalSingleChamberStatus.cxx | 193 ++++++++++ TRD/Cal/AliTRDCalSingleChamberStatus.h | 55 +++ TRD/Cal/AliTRDCalStackPos.cxx | 58 +++ TRD/Cal/AliTRDCalStackPos.h | 57 +++ TRD/Cal/AliTRDCalSuperModulePos.cxx | 58 +++ TRD/Cal/AliTRDCalSuperModulePos.h | 53 +++ TRD/Cal/AliTRDCalSuperModuleStatus.cxx | 52 +++ TRD/Cal/AliTRDCalSuperModuleStatus.h | 36 ++ TRD/Cal/AliTRDCreateDummyCDB.C | 285 +++++++++++++++ TRD/Cal/AliTRDTestCal.C | 55 +++ TRD/Cal/AliTRDbenchmarkCalibDB.C | 53 +++ TRD/TRDbaseLinkDef.h | 10 +- TRD/libTRDbase.pkg | 24 +- 50 files changed, 3163 insertions(+), 250 deletions(-) create mode 100644 TRD/Cal/AliTRDCalChamberPos.cxx create mode 100644 TRD/Cal/AliTRDCalChamberPos.h create mode 100644 TRD/Cal/AliTRDCalChamberStatus.cxx create mode 100644 TRD/Cal/AliTRDCalChamberStatus.h create mode 100644 TRD/Cal/AliTRDCalDet.cxx create mode 100644 TRD/Cal/AliTRDCalDet.h create mode 100644 TRD/Cal/AliTRDCalGlobals.cxx create mode 100644 TRD/Cal/AliTRDCalGlobals.h create mode 100644 TRD/Cal/AliTRDCalMCMStatus.cxx create mode 100644 TRD/Cal/AliTRDCalMCMStatus.h create mode 100644 TRD/Cal/AliTRDCalMonitoring.cxx create mode 100644 TRD/Cal/AliTRDCalMonitoring.h create mode 100644 TRD/Cal/AliTRDCalPIDLQ.cxx create mode 100644 TRD/Cal/AliTRDCalPIDLQ.h create mode 100644 TRD/Cal/AliTRDCalPad.cxx create mode 100644 TRD/Cal/AliTRDCalPad.h create mode 100644 TRD/Cal/AliTRDCalPadStatus.cxx create mode 100644 TRD/Cal/AliTRDCalPadStatus.h create mode 100644 TRD/Cal/AliTRDCalROC.cxx create mode 100644 TRD/Cal/AliTRDCalROC.h create mode 100644 TRD/Cal/AliTRDCalSingleChamberStatus.cxx create mode 100644 TRD/Cal/AliTRDCalSingleChamberStatus.h create mode 100644 TRD/Cal/AliTRDCalStackPos.cxx create mode 100644 TRD/Cal/AliTRDCalStackPos.h create mode 100644 TRD/Cal/AliTRDCalSuperModulePos.cxx create mode 100644 TRD/Cal/AliTRDCalSuperModulePos.h create mode 100644 TRD/Cal/AliTRDCalSuperModuleStatus.cxx create mode 100644 TRD/Cal/AliTRDCalSuperModuleStatus.h create mode 100644 TRD/Cal/AliTRDCreateDummyCDB.C create mode 100644 TRD/Cal/AliTRDTestCal.C create mode 100644 TRD/Cal/AliTRDbenchmarkCalibDB.C diff --git a/TRD/AliTRDReconstructor.cxx b/TRD/AliTRDReconstructor.cxx index b5e76c58ab3..ee4d145ccbc 100644 --- a/TRD/AliTRDReconstructor.cxx +++ b/TRD/AliTRDReconstructor.cxx @@ -24,7 +24,6 @@ #include "AliTRDReconstructor.h" #include "AliRunLoader.h" -#include "AliTRDparameter.h" #include "AliTRDclusterizerV1.h" #include "AliTRDtracker.h" #include "AliTRDpidESD.h" @@ -45,13 +44,6 @@ void AliTRDReconstructor::Reconstruct(AliRunLoader* runLoader) const AliTRDclusterizerV1 clusterer("clusterer", "TRD clusterizer"); runLoader->CdGAFile(); - AliTRDparameter* trdParam = GetTRDparameter(runLoader); - if (!trdParam) { - Error("Reconstruct", "no TRD parameters found"); - return; - } - trdParam->ReInit(); - clusterer.SetParameter(trdParam); Int_t nEvents = runLoader->GetNumberOfEvents(); for (Int_t iEvent = 0; iEvent < nEvents; iEvent++) { @@ -77,13 +69,6 @@ void AliTRDReconstructor::Reconstruct(AliRunLoader* runLoader, AliTRDclusterizerV1 clusterer("clusterer", "TRD clusterizer"); runLoader->CdGAFile(); - AliTRDparameter* trdParam = GetTRDparameter(runLoader); - if (!trdParam) { - Error("Reconstruct", "no TRD parameters found"); - return; - } - trdParam->ReInit(); - clusterer.SetParameter(trdParam); Int_t nEvents = runLoader->GetNumberOfEvents(); for (Int_t iEvent = 0; iEvent < nEvents; iEvent++) { @@ -122,18 +107,4 @@ void AliTRDReconstructor::FillESD(AliRunLoader* /*runLoader*/, } -//_____________________________________________________________________________ -AliTRDparameter* AliTRDReconstructor::GetTRDparameter(AliRunLoader* runLoader) const -{ -// get the TRD parameters - - runLoader->CdGAFile(); - AliTRDparameter* trdParam = (AliTRDparameter*) gFile->Get("TRDparameter"); - if (!trdParam) { - Error("GetTRDparameter", "no TRD parameters available"); - return NULL; - } - return trdParam; -} - diff --git a/TRD/AliTRDReconstructor.h b/TRD/AliTRDReconstructor.h index 28a64b80dcb..2935dc0d47d 100644 --- a/TRD/AliTRDReconstructor.h +++ b/TRD/AliTRDReconstructor.h @@ -13,7 +13,6 @@ #include "AliReconstructor.h" -class AliTRDparameter; class AliRawReader; class AliTRDReconstructor: public AliReconstructor { @@ -32,7 +31,6 @@ public: virtual void FillESD(AliRunLoader* runLoader, AliESD* esd) const; private: - AliTRDparameter* GetTRDparameter(AliRunLoader* runLoader) const; ClassDef(AliTRDReconstructor, 0) // class for the TRD reconstruction }; diff --git a/TRD/AliTRDcalibDB.cxx b/TRD/AliTRDcalibDB.cxx index 9a640c0d33d..2bbd584d49c 100644 --- a/TRD/AliTRDcalibDB.cxx +++ b/TRD/AliTRDcalibDB.cxx @@ -34,13 +34,23 @@ #include "AliTRDpadPlane.h" #include "AliTRDCommonParam.h" -#include "AliTRDCalROC.h" -#include "AliTRDCalChamberPos.h" -#include "AliTRDCalStackPos.h" -#include "AliTRDCalPad.h" -#include "AliTRDCalDet.h" -#include "AliTRDCalGlobals.h" -#include "AliTRDCalPIDLQ.h" +#include "Cal/AliTRDCalROC.h" + +#include "Cal/AliTRDCalChamberPos.h" +#include "Cal/AliTRDCalStackPos.h" +#include "Cal/AliTRDCalSuperModulePos.h" + +#include "Cal/AliTRDCalPad.h" +#include "Cal/AliTRDCalDet.h" +#include "Cal/AliTRDCalGlobals.h" +#include "Cal/AliTRDCalPIDLQ.h" +#include "Cal/AliTRDCalMonitoring.h" + +#include "Cal/AliTRDCalSuperModuleStatus.h" +#include "Cal/AliTRDCalChamberStatus.h" +#include "Cal/AliTRDCalMCMStatus.h" +#include "Cal/AliTRDCalPadStatus.h" +#include "Cal/AliTRDCalSingleChamberStatus.h" ClassImp(AliTRDcalibDB) @@ -152,17 +162,30 @@ const TObject* AliTRDcalibDB::GetCachedCDBObject(Int_t id) switch (id) { // parameters defined per pad and chamber - case kIDVdrift : return CacheMergeCDBEntry(kIDVdrift, "TRD/Calib/LocalVdrift", "TRD/Calib/ChamberVdrift"); break; - case kIDT0 : return CacheMergeCDBEntry(kIDT0, "TRD/Calib/LocalT0", "TRD/Calib/ChamberT0"); break; - + case kIDVdriftPad : return CacheCDBEntry(kIDVdriftPad, "TRD/Calib/LocalVdrift"); break; + case kIDVdriftChamber : return CacheCDBEntry(kIDVdriftChamber, "TRD/Calib/ChamberVdrift"); break; + + case kIDT0Pad : return CacheCDBEntry(kIDT0Pad, "TRD/Calib/LocalT0"); break; + case kIDT0Chamber : return CacheCDBEntry(kIDT0Chamber, "TRD/Calib/ChamberT0"); break; + + case kIDGainFactorPad : return CacheCDBEntry(kIDGainFactorPad, "TRD/Calib/LocalGainFactor"); break; + case kIDGainFactorChamber : return CacheCDBEntry(kIDGainFactorChamber, "TRD/Calib/ChamberGainFactor"); break; + // parameters defined per pad - case kIDGainFactor : return CacheCDBEntry(kIDGainFactor, "TRD/Calib/GainFactor"); break; case kIDPRFWidth : return CacheCDBEntry(kIDPRFWidth, "TRD/Calib/PRFWidth"); break; - + + // status values + case kIDSuperModuleStatus : return CacheCDBEntry(kIDSuperModuleStatus, "TRD/Calib/SuperModuleStatus"); break; + case kIDChamberStatus : return CacheCDBEntry(kIDChamberStatus, "TRD/Calib/ChamberStatus"); break; + case kIDMCMStatus : return CacheCDBEntry(kIDMCMStatus, "TRD/Calib/MCMStatus"); break; + case kIDPadStatus : return CacheCDBEntry(kIDPadStatus, "TRD/Calib/PadStatus"); break; + // global parameters + case kIDMonitoringData : return CacheCDBEntry(kIDMonitoringData, "TRD/Calib/MonitoringData"); break; case kIDGlobals : return CacheCDBEntry(kIDGlobals, "TRD/Calib/Globals"); break; - case kIDChamber : return CacheCDBEntry(kIDChamber, "TRD/Calib/Chamber"); break; - case kIDStack : return CacheCDBEntry(kIDStack, "TRD/Calib/Stack"); break; + case kIDSuperModulePos : return CacheCDBEntry(kIDSuperModulePos, "TRD/Calib/SuperModulePos"); break; + case kIDChamberPos : return CacheCDBEntry(kIDChamberPos, "TRD/Calib/ChamberPos"); break; + case kIDStackPos : return CacheCDBEntry(kIDStackPos, "TRD/Calib/StackPos"); break; case kIDPIDLQ : return CacheCDBEntry(kIDPIDLQ, "TRD/Calib/PIDLQ"); break; } return 0; @@ -213,72 +236,21 @@ const TObject* AliTRDcalibDB::CacheCDBEntry(Int_t id, const char* cdbPath) return fCDBCache[id]; } -//_____________________________________________________________________________ -const TObject* AliTRDcalibDB::CacheMergeCDBEntry(Int_t id, const char* cdbPadPath, const char* cdbChamberPath) -{ - // - // Retrieves and caches an object (id ) from the CDB. This function is specialized for parameters which are stored - // as local variation at pad level of a global variable defined per detector chamber. It uses the classes AliTRDCalPad and AliTRDCalDet. - // Before storing the object it retrieves the local variations (cdbPadPath) and the global variable (cdbChamberPath) and merges them using - // the AliTRDCalPad::ScaleROCs. - // - - if (!fCDBCache[id]) - { - AliTRDCalPad* padObject = 0; - AliTRDCalDet* detObject = 0; - - fCDBEntries[id] = GetCDBEntry(cdbPadPath); - if (fCDBEntries[id]) - padObject = dynamic_cast(fCDBEntries[id]->GetObject()); - - AliCDBEntry* mergeEntry = GetCDBEntry(cdbChamberPath); - if (mergeEntry) - detObject = dynamic_cast(mergeEntry->GetObject()); - - if (!padObject || !detObject) - { - if (fCDBEntries[id]) { - if (fCDBEntries[id]->IsOwner() == kFALSE && padObject) - delete padObject; - delete fCDBEntries[id]; - fCDBEntries[id] = 0; - } - if (mergeEntry) - { - if (mergeEntry->IsOwner() == kFALSE && detObject) - delete detObject; - delete mergeEntry; - } - return 0; - } - - padObject->ScaleROCs(detObject); - if (mergeEntry->IsOwner() == kFALSE) - delete detObject; - delete mergeEntry; - - fCDBCache[id] = padObject; - } - - return fCDBCache[id]; -} - //_____________________________________________________________________________ void AliTRDcalibDB::SetRun(Long64_t run) { // - // Sets current run number. Calibration data is read from the corresponding file. + // Sets current run number. Calibration data is read from the corresponding file. // When the run number changes the caching is invalidated. // - + if (fRun == run) return; - + fRun = run; Invalidate(); } - + //_____________________________________________________________________________ void AliTRDcalibDB::Invalidate() { @@ -307,14 +279,14 @@ Bool_t AliTRDcalibDB::GetChamberPos(Int_t det, Float_t* xyz) // Returns the deviation of the chamber position from the nominal position. // - const AliTRDCalChamberPos* chamber = dynamic_cast(GetCachedCDBObject(kIDChamber)); + const AliTRDCalChamberPos* chamber = dynamic_cast(GetCachedCDBObject(kIDChamberPos)); if (!chamber) return kFALSE; - const Float_t* kvalues = chamber->GetChamberPos(det); + const Float_t* kvalues = chamber->GetPos(det); if (!kvalues) return kFALSE; - + xyz[0] = kvalues[0]; xyz[1] = kvalues[1]; xyz[2] = kvalues[2]; @@ -329,11 +301,11 @@ Bool_t AliTRDcalibDB::GetChamberRot(Int_t det, Float_t* xyz) // Returns the rotation of the chamber from the nominal position. // - const AliTRDCalChamberPos* chamber = dynamic_cast(GetCachedCDBObject(kIDChamber)); + const AliTRDCalChamberPos* chamber = dynamic_cast(GetCachedCDBObject(kIDChamberPos)); if (!chamber) return kFALSE; - const Float_t* kvalues = chamber->GetChamberRot(det); + const Float_t* kvalues = chamber->GetRot(det); if (!kvalues) return kFALSE; @@ -351,11 +323,11 @@ Bool_t AliTRDcalibDB::GetStackPos(Int_t chamber, Int_t sector, Float_t* xyz) // Returns the deviation of the stack position from the nominal position. // - const AliTRDCalStackPos* stack = dynamic_cast(GetCachedCDBObject(kIDStack)); + const AliTRDCalStackPos* stack = dynamic_cast(GetCachedCDBObject(kIDStackPos)); if (!stack) return kFALSE; - const Float_t* kvalues = stack->GetStackPos(chamber, sector); + const Float_t* kvalues = stack->GetPos(chamber, sector); if (!kvalues) return kFALSE; @@ -373,11 +345,55 @@ Bool_t AliTRDcalibDB::GetStackRot(Int_t chamber, Int_t sector, Float_t* xyz) // Returns the rotation of the stack from the nominal position. // - const AliTRDCalStackPos* stack = dynamic_cast(GetCachedCDBObject(kIDStack)); + const AliTRDCalStackPos* stack = dynamic_cast(GetCachedCDBObject(kIDStackPos)); if (!stack) return kFALSE; - const Float_t* kvalues = stack->GetStackRot(chamber, sector); + const Float_t* kvalues = stack->GetRot(chamber, sector); + if (!kvalues) + return kFALSE; + + xyz[0] = kvalues[0]; + xyz[1] = kvalues[1]; + xyz[2] = kvalues[2]; + + return kTRUE; +} + +//_____________________________________________________________________________ +Bool_t AliTRDcalibDB::GetSuperModulePos(Int_t sm, Float_t* xyz) +{ + // + // Returns the deviation of the supermodule position from the nominal position. + // + + const AliTRDCalSuperModulePos* smPos = dynamic_cast(GetCachedCDBObject(kIDSuperModulePos)); + if (!smPos) + return kFALSE; + + const Float_t* kvalues = smPos->GetPos(sm); + if (!kvalues) + return kFALSE; + + xyz[0] = kvalues[0]; + xyz[1] = kvalues[1]; + xyz[2] = kvalues[2]; + + return kTRUE; +} + +//_____________________________________________________________________________ +Bool_t AliTRDcalibDB::GetSuperModuleRot(Int_t sm, Float_t* xyz) +{ + // + // Returns the rotation of the supermodule from the nominal position. + // + + const AliTRDCalSuperModulePos* smPos = dynamic_cast(GetCachedCDBObject(kIDSuperModulePos)); + if (!smPos) + return kFALSE; + + const Float_t* kvalues = smPos->GetRot(sm); if (!kvalues) return kFALSE; @@ -394,8 +410,8 @@ Float_t AliTRDcalibDB::GetVdrift(Int_t det, Int_t col, Int_t row) // // Returns the drift velocity for the given pad. // - - const AliTRDCalPad* calPad = dynamic_cast (GetCachedCDBObject(kIDVdrift)); + + const AliTRDCalPad* calPad = dynamic_cast (GetCachedCDBObject(kIDVdriftPad)); if (!calPad) return -1; @@ -403,7 +419,25 @@ Float_t AliTRDcalibDB::GetVdrift(Int_t det, Int_t col, Int_t row) if (!roc) return -1; - return roc->GetValue(col, row); + const AliTRDCalDet* calChamber = dynamic_cast (GetCachedCDBObject(kIDVdriftChamber)); + if (!calChamber) + return -1; + + return calChamber->GetValue(det) * roc->GetValue(col, row); +} + +//_____________________________________________________________________________ +Float_t AliTRDcalibDB::GetVdriftAverage(Int_t det) +{ + // + // Returns the average drift velocity for the given detector + // + + const AliTRDCalDet* calDet = dynamic_cast (GetCachedCDBObject(kIDVdriftChamber)); + if (!calDet) + return -1; + + return calDet->GetValue(det); } //_____________________________________________________________________________ @@ -413,7 +447,7 @@ Float_t AliTRDcalibDB::GetT0(Int_t det, Int_t col, Int_t row) // Returns t0 for the given pad. // - const AliTRDCalPad* calPad = dynamic_cast (GetCachedCDBObject(kIDT0)); + const AliTRDCalPad* calPad = dynamic_cast (GetCachedCDBObject(kIDT0Pad)); if (!calPad) return -1; @@ -421,7 +455,25 @@ Float_t AliTRDcalibDB::GetT0(Int_t det, Int_t col, Int_t row) if (!roc) return -1; - return roc->GetValue(col, row); + const AliTRDCalDet* calChamber = dynamic_cast (GetCachedCDBObject(kIDT0Chamber)); + if (!calChamber) + return -1; + + return calChamber->GetValue(det) * roc->GetValue(col, row); +} + +//_____________________________________________________________________________ +Float_t AliTRDcalibDB::GetT0Average(Int_t det) +{ + // + // Returns the average t0 for the given detector + // + + const AliTRDCalDet* calDet = dynamic_cast (GetCachedCDBObject(kIDT0Chamber)); + if (!calDet) + return -1; + + return calDet->GetValue(det); } //_____________________________________________________________________________ @@ -431,7 +483,7 @@ Float_t AliTRDcalibDB::GetGainFactor(Int_t det, Int_t col, Int_t row) // Returns the gain factor for the given pad. // - const AliTRDCalPad* calPad = dynamic_cast (GetCachedCDBObject(kIDGainFactor)); + const AliTRDCalPad* calPad = dynamic_cast (GetCachedCDBObject(kIDGainFactorPad)); if (!calPad) return -1; @@ -439,7 +491,25 @@ Float_t AliTRDcalibDB::GetGainFactor(Int_t det, Int_t col, Int_t row) if (!roc) return -1; - return roc->GetValue(col, row); + const AliTRDCalDet* calChamber = dynamic_cast (GetCachedCDBObject(kIDGainFactorChamber)); + if (!calChamber) + return -1; + + return calChamber->GetValue(det) * roc->GetValue(col, row); +} + +//_____________________________________________________________________________ +Float_t AliTRDcalibDB::GetGainFactorAverage(Int_t det) +{ + // + // Returns the average gain factor for the given detector + // + + const AliTRDCalDet* calDet = dynamic_cast (GetCachedCDBObject(kIDGainFactorChamber)); + if (!calDet) + return -1; + + return calDet->GetValue(det); } //_____________________________________________________________________________ @@ -480,24 +550,210 @@ Int_t AliTRDcalibDB::GetNumberOfTimeBins() // // Returns the number of time bins which are read-out. // - + const AliTRDCalGlobals* calGlobal = dynamic_cast (GetCachedCDBObject(kIDGlobals)); if (!calGlobal) - return -1; - + return -1; + return calGlobal->GetNumberOfTimeBins(); } +//_____________________________________________________________________________ +Char_t AliTRDcalibDB::GetPadStatus(Int_t det, Int_t col, Int_t row) +{ + // + // Returns the status of the given pad + // + + const AliTRDCalPadStatus* cal = dynamic_cast (GetCachedCDBObject(kIDPadStatus)); + if (!cal) + return -1; + + const AliTRDCalSingleChamberStatus* roc = cal->GetCalROC(det); + if (!roc) + return -1; + + return roc->GetStatus(col, row); +} + +//_____________________________________________________________________________ +Char_t AliTRDcalibDB::GetMCMStatus(Int_t det, Int_t col, Int_t row) +{ + // + // Returns the status of the given MCM + // + + const AliTRDCalMCMStatus* cal = dynamic_cast (GetCachedCDBObject(kIDMCMStatus)); + if (!cal) + return -1; + + const AliTRDCalSingleChamberStatus* roc = cal->GetCalROC(det); + if (!roc) + return -1; + + return roc->GetStatus(col, row); +} + +//_____________________________________________________________________________ +Char_t AliTRDcalibDB::GetChamberStatus(Int_t det) +{ + // + // Returns the status of the given chamber + // + + const AliTRDCalChamberStatus* cal = dynamic_cast (GetCachedCDBObject(kIDChamberStatus)); + if (!cal) + return -1; + + return cal->GetStatus(det); +} + +//_____________________________________________________________________________ +Char_t AliTRDcalibDB::GetSuperModuleStatus(Int_t sm) +{ + // + // Returns the status of the given chamber + // + + const AliTRDCalSuperModuleStatus* cal = dynamic_cast (GetCachedCDBObject(kIDSuperModuleStatus)); + if (!cal) + return -1; + + return cal->GetStatus(sm); +} + +//_____________________________________________________________________________ +Bool_t AliTRDcalibDB::IsPadMasked(Int_t det, Int_t col, Int_t row) +{ + // + // Returns status, see name of functions for details ;-) + // + + const AliTRDCalPadStatus* cal = dynamic_cast (GetCachedCDBObject(kIDPadStatus)); + if (!cal) + return -1; + + return cal->IsMasked(det, col, row); +} + +//_____________________________________________________________________________ +Bool_t AliTRDcalibDB::IsPadBridgedLeft(Int_t det, Int_t col, Int_t row) +{ + // + // Returns status, see name of functions for details ;-) + // + + const AliTRDCalPadStatus* cal = dynamic_cast (GetCachedCDBObject(kIDPadStatus)); + if (!cal) + return -1; + + return cal->IsBridgedLeft(det, col, row); +} + +//_____________________________________________________________________________ +Bool_t AliTRDcalibDB::IsPadBridgedRight(Int_t det, Int_t col, Int_t row) +{ + // + // Returns status, see name of functions for details ;-) + // + + const AliTRDCalPadStatus* cal = dynamic_cast (GetCachedCDBObject(kIDPadStatus)); + if (!cal) + return -1; + + return cal->IsBridgedRight(det, col, row); +} + +//_____________________________________________________________________________ +Bool_t AliTRDcalibDB::IsMCMMasked(Int_t det, Int_t col, Int_t row) +{ + // + // Returns status, see name of functions for details ;-) + // + + const AliTRDCalMCMStatus* cal = dynamic_cast (GetCachedCDBObject(kIDMCMStatus)); + if (!cal) + return -1; + + return cal->IsMasked(det, col, row); +} + +//_____________________________________________________________________________ +Bool_t AliTRDcalibDB::IsChamberInstalled(Int_t det) +{ + // + // Returns status, see name of functions for details ;-) + // + + const AliTRDCalChamberStatus* cal = dynamic_cast (GetCachedCDBObject(kIDChamberStatus)); + if (!cal) + return -1; + + return cal->IsInstalled(det); +} + +//_____________________________________________________________________________ +Bool_t AliTRDcalibDB::IsChamberMasked(Int_t det) +{ + // + // Returns status, see name of functions for details ;-) + // + + const AliTRDCalChamberStatus* cal = dynamic_cast (GetCachedCDBObject(kIDChamberStatus)); + if (!cal) + return -1; + + return cal->IsMasked(det); +} + +//_____________________________________________________________________________ +Bool_t AliTRDcalibDB::IsSuperModuleInstalled(Int_t det) +{ + // + // Returns status, see name of functions for details ;-) + // + + const AliTRDCalSuperModuleStatus* cal = dynamic_cast (GetCachedCDBObject(kIDSuperModuleStatus)); + if (!cal) + return -1; + + return cal->IsInstalled(det); +} + +//_____________________________________________________________________________ +Bool_t AliTRDcalibDB::IsSuperModuleMasked(Int_t det) +{ + // + // Returns status, see name of functions for details ;-) + // + + const AliTRDCalSuperModuleStatus* cal = dynamic_cast (GetCachedCDBObject(kIDSuperModuleStatus)); + if (!cal) + return -1; + + return cal->IsMasked(det); +} + //_____________________________________________________________________________ const AliTRDCalPIDLQ* AliTRDcalibDB::GetPIDLQObject() { // // Returns the object storing the distributions for PID with likelihood // - + return dynamic_cast (GetCachedCDBObject(kIDPIDLQ)); } +//_____________________________________________________________________________ +const AliTRDCalMonitoring* AliTRDcalibDB::GetMonitoringObject() +{ + // + // Returns the object storing the monitoring data + // + + return dynamic_cast (GetCachedCDBObject(kIDMonitoringData)); +} + //_____________________________________________________________________________ Float_t AliTRDcalibDB::GetOmegaTau(Float_t vdrift) { diff --git a/TRD/AliTRDcalibDB.h b/TRD/AliTRDcalibDB.h index fe986b707db..ce308225f47 100644 --- a/TRD/AliTRDcalibDB.h +++ b/TRD/AliTRDcalibDB.h @@ -21,6 +21,7 @@ #include class AliTRDCalPIDLQ; +class AliTRDCalMonitoring; class AliTRDcalibDB : public TObject { @@ -31,43 +32,67 @@ public: static void Terminate(); void SetRun(Long64_t run); - + Long64_t GetRun() { return fRun; } + Bool_t GetChamberPos(Int_t det, Float_t* xyz); - Bool_t GetChamberPos(Int_t plane, Int_t chamber, Int_t sector, Float_t* xyz) { return GetChamberPos(AliTRDgeometry::GetDetector(plane, chamber, sector), xyz); } - Bool_t GetChamberRot(Int_t det, Float_t* xyz); - Bool_t GetChamberRot(Int_t plane, Int_t chamber, Int_t sector, Float_t* xyz) { return GetChamberRot(AliTRDgeometry::GetDetector(plane, chamber, sector), xyz); } - + Bool_t GetStackPos(Int_t chamber, Int_t sector, Float_t* xyz); Bool_t GetStackRot(Int_t chamber, Int_t sector, Float_t* xyz); - + + Bool_t GetSuperModulePos(Int_t sm, Float_t* xyz); + Bool_t GetSuperModuleRot(Int_t sm, Float_t* xyz); + Float_t GetVdrift(Int_t det, Int_t col, Int_t row); - Float_t GetVdrift(Int_t plane, Int_t chamber, Int_t sector, Int_t col, Int_t row) { return GetVdrift(AliTRDgeometry::GetDetector(plane, chamber, sector), col, row); } - + Float_t GetVdriftAverage(Int_t det); + Float_t GetT0(Int_t det, Int_t col, Int_t row); - Float_t GetT0(Int_t plane, Int_t chamber, Int_t sector, Int_t col, Int_t row) { return GetT0(AliTRDgeometry::GetDetector(plane, chamber, sector), col, row); } - + Float_t GetT0Average(Int_t det); + Float_t GetGainFactor(Int_t det, Int_t col, Int_t row); - Float_t GetGainFactor(Int_t plane, Int_t chamber, Int_t sector, Int_t col, Int_t row) { return GetGainFactor(AliTRDgeometry::GetDetector(plane, chamber, sector), col, row); } + Float_t GetGainFactorAverage(Int_t det); Float_t GetPRFWidth(Int_t det, Int_t col, Int_t row); - Float_t GetPRFWidth(Int_t plane, Int_t chamber, Int_t sector, Int_t col, Int_t row) { return GetPRFWidth(AliTRDgeometry::GetDetector(plane, chamber, sector), col, row); } - - Float_t GetSamplingFrequency(); + + Float_t GetSamplingFrequency(); Int_t GetNumberOfTimeBins(); + + Char_t GetPadStatus(Int_t det, Int_t col, Int_t row); + Char_t GetMCMStatus(Int_t det, Int_t col, Int_t row); + Char_t GetChamberStatus(Int_t det); + Char_t GetSuperModuleStatus(Int_t sm); + + Bool_t IsPadMasked(Int_t det, Int_t col, Int_t row); + Bool_t IsPadBridgedLeft(Int_t det, Int_t col, Int_t row); + Bool_t IsPadBridgedRight(Int_t det, Int_t col, Int_t row); - const AliTRDCalPIDLQ* GetPIDLQObject(); + Bool_t IsMCMMasked(Int_t det, Int_t col, Int_t row); + Bool_t IsChamberInstalled(Int_t det); + Bool_t IsChamberMasked(Int_t det); + + Bool_t IsSuperModuleInstalled(Int_t det); + Bool_t IsSuperModuleMasked(Int_t det); + + const AliTRDCalMonitoring* GetMonitoringObject(); + const AliTRDCalPIDLQ* GetPIDLQObject(); + //Related functions, these depend on calibration data static Float_t GetOmegaTau(Float_t vdrift); Int_t PadResponse(Double_t signal, Double_t dist, Int_t plane, Double_t *pad) const; protected: // for caching see also implentation of GetCachedCDBObject in the .cxx file - enum { kCDBCacheSize = 8 }; // Number of cached objects - enum { kIDVdrift = 0, kIDT0 = 1, kIDGainFactor = 2, kIDPRFWidth = 3, kIDGlobals = 4, - kIDChamber = 5, kIDStack = 6, kIDPIDLQ = 7 }; // IDs of cached objects - + enum { kCDBCacheSize = 17 }; // Number of cached objects + enum { kIDVdriftPad = 0, kIDVdriftChamber, + kIDT0Pad, kIDT0Chamber, + kIDGainFactorPad, kIDGainFactorChamber, + kIDPRFWidth, + kIDGlobals, + kIDChamberPos, kIDStackPos, kIDSuperModulePos, + kIDPIDLQ, kIDMonitoringData, + kIDSuperModuleStatus, kIDChamberStatus, kIDMCMStatus, kIDPadStatus }; // IDs of cached objects + const TObject* GetCachedCDBObject(Int_t id); void Invalidate(); @@ -75,8 +100,7 @@ protected: AliCDBEntry* GetCDBEntry(const char* cdbPath); const TObject* CacheCDBEntry(Int_t id, const char* cdbPath); - const TObject* CacheMergeCDBEntry(Int_t id, const char* cdbPadPath, const char* cdbChamberPath); - + static AliTRDcalibDB* fgInstance; // Instance of this class (singleton implementation) static Bool_t fgTerminated; // Defines if this class has already been terminated and therefore does not return instances in GetInstance anymore @@ -102,7 +126,7 @@ private: AliTRDcalibDB(); virtual ~AliTRDcalibDB(); - ClassDef(AliTRDcalibDB, 0) + ClassDef(AliTRDcalibDB, 1) }; #endif diff --git a/TRD/AliTRDclusterizer.cxx b/TRD/AliTRDclusterizer.cxx index f078f779488..87af305108a 100644 --- a/TRD/AliTRDclusterizer.cxx +++ b/TRD/AliTRDclusterizer.cxx @@ -33,7 +33,6 @@ #include "AliTRDcluster.h" #include "AliTRDrecPoint.h" #include "AliTRDgeometry.h" -#include "AliTRDparameter.h" #include "AliTRDcalibDB.h" ClassImp(AliTRDclusterizer) @@ -48,7 +47,6 @@ AliTRDclusterizer::AliTRDclusterizer():TNamed() fClusterTree = NULL; fRecPoints = 0; fVerbose = 0; - fPar = 0; } @@ -63,7 +61,6 @@ AliTRDclusterizer::AliTRDclusterizer(const Text_t* name, const Text_t* title) fClusterTree = NULL; fRecPoints = 0; fVerbose = 0; - fPar = 0; } @@ -113,7 +110,6 @@ void AliTRDclusterizer::Copy(TObject &c) const ((AliTRDclusterizer &) c).fClusterTree = NULL; ((AliTRDclusterizer &) c).fRecPoints = NULL; ((AliTRDclusterizer &) c).fVerbose = fVerbose; - ((AliTRDclusterizer &) c).fPar = 0; } @@ -241,7 +237,6 @@ Bool_t AliTRDclusterizer::WriteClusters(Int_t det) AliTRDgeometry *geo = fTRD->GetGeometry(); geo->SetName("TRDgeometry"); geo->Write(); - fPar->Write(); */ AliLoader* loader = fRunLoader->GetLoader("TRDLoader"); loader->WriteRecPoints("OVERWRITE"); diff --git a/TRD/AliTRDclusterizer.h b/TRD/AliTRDclusterizer.h index 0b01ccf25a5..2bb295caf7e 100644 --- a/TRD/AliTRDclusterizer.h +++ b/TRD/AliTRDclusterizer.h @@ -11,7 +11,6 @@ class TFile; class TTree; class AliRunLoader; -class AliTRDparameter; class AliTRD; class AliTRDcluster; /////////////////////////////////////////////////////// @@ -35,11 +34,8 @@ class AliTRDclusterizer : public TNamed { virtual Bool_t OpenOutput(); virtual Bool_t MakeClusters() = 0; virtual Bool_t WriteClusters(Int_t det); - virtual void SetParameter(AliTRDparameter *par) { fPar = par; }; void SetVerbose(Int_t v = 1) { fVerbose = v; }; - AliTRDparameter *GetParameter() const { return fPar; }; - TObjArray* RecPoints() {if (!fRecPoints) fRecPoints = new TObjArray(400); return fRecPoints;} virtual AliTRDcluster * AddCluster(Double_t *pos, Int_t timebin, Int_t det, Double_t amp, Int_t *tracks , Double_t *sig, Int_t iType, Float_t center = 0); @@ -52,7 +48,6 @@ class AliTRDclusterizer : public TNamed { AliRunLoader *fRunLoader; //! Run Loader TTree *fClusterTree; //! Tree with the cluster - AliTRDparameter *fPar; // TRD digitization parameter object TObjArray* fRecPoints; //! Array of clusters Int_t fVerbose; // Sets the verbose level diff --git a/TRD/AliTRDclusterizerV1.cxx b/TRD/AliTRDclusterizerV1.cxx index 87885edb96a..97ab7584ea4 100644 --- a/TRD/AliTRDclusterizerV1.cxx +++ b/TRD/AliTRDclusterizerV1.cxx @@ -38,7 +38,6 @@ #include "AliTRDdataArrayF.h" #include "AliTRDdataArrayI.h" #include "AliTRDdigitsManager.h" -#include "AliTRDparameter.h" #include "AliTRDpadPlane.h" #include "AliTRDrawData.h" #include "AliTRDcalibDB.h" diff --git a/TRD/AliTRDclusterizerV1.h b/TRD/AliTRDclusterizerV1.h index 4e04ba090a4..db1e2bcb78f 100644 --- a/TRD/AliTRDclusterizerV1.h +++ b/TRD/AliTRDclusterizerV1.h @@ -13,7 +13,6 @@ class AliTRDdataArrayI; class AliTRDdigitsManager; -class AliTRDparameter; class AliRawReader; class AliTRDclusterizerV1 : public AliTRDclusterizer { diff --git a/TRD/AliTRDdigitizer.cxx b/TRD/AliTRDdigitizer.cxx index 9268e8f52c6..c1621f4ae08 100644 --- a/TRD/AliTRDdigitizer.cxx +++ b/TRD/AliTRDdigitizer.cxx @@ -71,7 +71,6 @@ #include "AliTRDsegmentArray.h" #include "AliTRDdigitsManager.h" #include "AliTRDgeometry.h" -#include "AliTRDparameter.h" #include "AliTRDpadPlane.h" #include "AliTRDcalibDB.h" #include "AliTRDSimParam.h" @@ -92,7 +91,6 @@ AliTRDdigitizer::AliTRDdigitizer() fSDigitsManagerList = 0; fTRD = 0; fGeo = 0; - fPar = 0; fEvent = 0; fMasks = 0; fCompress = kTRUE; @@ -169,7 +167,6 @@ Bool_t AliTRDdigitizer::Init() fSDigitsManagerList = 0; fTRD = 0; fGeo = 0; - fPar = 0; //End NewIO comment fEvent = 0; @@ -271,7 +268,6 @@ void AliTRDdigitizer::Copy(TObject &d) const ((AliTRDdigitizer &) d).fSDigitsManagerList = 0; ((AliTRDdigitizer &) d).fTRD = 0; ((AliTRDdigitizer &) d).fGeo = 0; - ((AliTRDdigitizer &) d).fPar = 0; ((AliTRDdigitizer &) d).fEvent = 0; ((AliTRDdigitizer &) d).fMasks = 0; ((AliTRDdigitizer &) d).fCompress = fCompress; @@ -439,7 +435,6 @@ void AliTRDdigitizer::Exec(Option_t* option) //Write parameters orl->CdGAFile(); - if (!gFile->Get("TRDparameter")) GetParameter()->Write(); if (fDebug > 0) { printf(" "); @@ -636,15 +631,7 @@ Bool_t AliTRDdigitizer::MakeDigits() TGeoManager::Import("geometry.root"); - // Create a default parameter class if none is defined - if (!fPar) { - fPar = new AliTRDparameter("TRDparameter","Standard TRD parameter"); - if (fDebug > 0) { - printf(" "); - printf("Create the default parameter object\n"); - } - } - + AliTRDSimParam* simParam = AliTRDSimParam::Instance(); if (!simParam) { printf(" "); @@ -1160,6 +1147,11 @@ Bool_t AliTRDdigitizer::MakeDigits() // Pad and time coupling signalAmp *= coupling; Float_t padgain = calibration->GetGainFactor(iDet, iCol, iRow); + if (padgain<=0) { + TString error; + error.Form("Not a valid gain %f, %d %d %d\n", padgain, iDet, iCol, iRow); + AliError(error); + } signalAmp *= padgain; // Add the noise, starting from minus ADC baseline in electrons Double_t baselineEl = simParam->GetADCbaseline() * (simParam->GetADCinRange() @@ -1290,14 +1282,6 @@ Bool_t AliTRDdigitizer::ConvertSDigits() Int_t iCol; Int_t iTime; - if (!fPar) { - fPar = new AliTRDparameter("TRDparameter","Standard parameter"); - if (fDebug > 0) { - printf(" "); - printf("Create the default parameter object\n"); - } - } - AliTRDSimParam* simParam = AliTRDSimParam::Instance(); if (!simParam) { @@ -1376,6 +1360,13 @@ Bool_t AliTRDdigitizer::ConvertSDigits() for (iTime = 0; iTime < nTimeTotal; iTime++) { Double_t signal = (Double_t) digitsIn->GetDataUnchecked(iRow,iCol,iTime); signal *= sDigitsScale; + Float_t padgain = calibration->GetGainFactor(iDet, iCol, iRow); + if (padgain<=0) { + TString error; + error.Form("Not a valid gain %f, %d %d %d\n", padgain, iDet, iCol, iRow); + AliError(error); + } + signal *= padgain; // Pad and time coupling signal *= coupling; // Add the noise, starting from minus ADC baseline in electrons @@ -1444,14 +1435,6 @@ Bool_t AliTRDdigitizer::MergeSDigits() // Number of track dictionary arrays const Int_t kNDict = AliTRDdigitsManager::kNDict; - if (!fPar) { - fPar = new AliTRDparameter("TRDparameter","Standard parameter"); - if (fDebug > 0) { - printf(" "); - printf("Create the default parameter object\n"); - } - } - AliTRDSimParam* simParam = AliTRDSimParam::Instance(); if (!simParam) { @@ -1648,7 +1631,6 @@ Bool_t AliTRDdigitizer::WriteDigits() const //Write parameters fRunLoader->CdGAFile(); - if (!gFile->Get("TRDparameter")) GetParameter()->Write(); // Store the digits and the dictionary in the tree return fDigitsManager->WriteDigits(); @@ -1734,7 +1716,7 @@ Double_t AliTRDdigitizer::TimeStruct(Float_t vdrift, Double_t dist, Double_t z) const Int_t kz2 = kz1+1; if (r1<0 || r1>37 || kz1<0 || kz1>10) { - printf(" Warning. Indices out of range: "); + printf(" Warning. Indices out of range: "); printf("dist=%.2f, z=%.2f, r1=%d, kz1=%d\n",dist,z,r1,kz1); } @@ -1805,16 +1787,16 @@ void AliTRDdigitizer::SampleTimeStruct(Float_t vdrift) fVDsmp[7] = 2.134; if ( vdrift < fVDsmp[0] ) { - printf(" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"); - printf(" Drift Velocity too small (%.3f<%.3f)\n" + printf(" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"); + printf(" Drift Velocity too small (%.3f<%.3f)\n" , vdrift, fVDsmp[0]); - printf(" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"); + printf(" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"); vdrift = fVDsmp[0]; } else if ( vdrift > fVDsmp[7] ) { - printf(" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"); - printf(" Drift Velocity too large (%.3f>%.3f)\n" + printf(" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"); + printf(" Drift Velocity too large (%.3f>%.3f)\n" , vdrift,fVDsmp[6]); - printf(" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"); + printf(" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"); vdrift = fVDsmp[7]; } @@ -2506,15 +2488,7 @@ void AliTRDdigitizer::RecalcDiffusion(Float_t vdrift) { if (vdrift == fDiffusionInfo.fLastVdrift) return; - - if (!fPar) { - fPar = new AliTRDparameter("TRDparameter","Standard TRD parameter"); - if (fDebug > 0) { - printf(" "); - printf("Create the default parameter object\n"); - } - } - + AliTRDSimParam* simParam = AliTRDSimParam::Instance(); if (!simParam) { diff --git a/TRD/AliTRDdigitizer.h b/TRD/AliTRDdigitizer.h index bb7f824c755..8f2aced714f 100644 --- a/TRD/AliTRDdigitizer.h +++ b/TRD/AliTRDdigitizer.h @@ -16,7 +16,6 @@ class AliRunLoader; class AliTRD; class AliTRDdigitsManager; class AliTRDgeometry; -class AliTRDparameter; /////////////////////////////////////////////////////// // Produces digits from the hits information // @@ -54,9 +53,8 @@ class AliTRDdigitizer : public AliDigitizer { virtual void SetSDigits(Int_t v = 1) { fSDigits = v; }; virtual void SetSDigitsScale(Float_t s) { fSDigitsScale = s; }; virtual void SetEvent(Int_t v = 0) { fEvent = v; }; - virtual void SetManager(AliTRDdigitsManager *man) { fDigitsManager = man; }; + virtual void SetManager(AliTRDdigitsManager *man) { fDigitsManager = man; }; virtual void SetGeometry(AliTRDgeometry *geo) { fGeo = geo; }; - virtual void SetParameter(AliTRDparameter *par) { fPar = par; }; virtual void SetMergeSignalOnly(Bool_t m = kTRUE) { fMergeSignalOnly = m; }; AliTRDdigitsManager *Digits() const { return fDigitsManager; }; @@ -64,9 +62,8 @@ class AliTRDdigitizer : public AliDigitizer { Bool_t GetCompress() const { return fCompress; }; Bool_t GetSDigits() const { return fSDigits; }; Float_t GetSDigitsScale() const { return fSDigitsScale; }; - AliTRDparameter *GetParameter() const { return fPar; }; - virtual Double_t TimeStruct(Float_t vdrift, Double_t time, Double_t z); + virtual Double_t TimeStruct(Float_t vdrift, Double_t time, Double_t z); Float_t GetDiffusionT(Float_t vdrift); Float_t GetDiffusionL(Float_t vdrift); @@ -83,7 +80,6 @@ class AliTRDdigitizer : public AliDigitizer { TList *fSDigitsManagerList; //! List of managers of input s-digits AliTRD *fTRD; //! TRD detector class AliTRDgeometry *fGeo; //! TRD geometry - AliTRDparameter *fPar; // TRD common parameter object Int_t fEvent; //! Event number Int_t *fMasks; //! Masks for the merging Bool_t fCompress; // Switch to keep only compressed data in memory @@ -120,7 +116,7 @@ class AliTRDdigitizer : public AliDigitizer { virtual Bool_t CheckDetector(Int_t plane, Int_t chamber, Int_t sector); - ClassDef(AliTRDdigitizer,9) // Produces TRD-Digits + ClassDef(AliTRDdigitizer, 10) // Produces TRD-Digits }; diff --git a/TRD/AliTRDgeometry.cxx b/TRD/AliTRDgeometry.cxx index 4483c164d61..9e433b360f3 100644 --- a/TRD/AliTRDgeometry.cxx +++ b/TRD/AliTRDgeometry.cxx @@ -26,7 +26,6 @@ #include "AliRunLoader.h" #include "AliTRDgeometry.h" -#include "AliTRDparameter.h" #include "AliTRDpadPlane.h" #include "AliRun.h" @@ -302,21 +301,22 @@ Bool_t AliTRDgeometry::Local2Global(Int_t iplan, Int_t icham, Int_t isect Float_t timeSlice = local[2] + 0.5; Float_t time0 = GetTime0(iplan); + Int_t idet = GetDetector(iplan, icham, isect); + Double_t rot[3]; - rot[0] = time0 - (timeSlice - calibration->GetT0(iplan, icham, isect, col, row)) - * calibration->GetVdrift(iplan, icham, isect, col, row)/calibration->GetSamplingFrequency(); + rot[0] = time0 - (timeSlice - calibration->GetT0(idet, col, row)) + * calibration->GetVdrift(idet, col, row)/calibration->GetSamplingFrequency(); rot[1] = padPlane->GetColPos(col) - 0.5 * padPlane->GetColSize(col); rot[2] = padPlane->GetRowPos(row) - 0.5 * padPlane->GetRowSize(row); // Rotate back to original position - Int_t idet = GetDetector(iplan,icham,isect); return RotateBack(idet,rot,global); } //_____________________________________________________________________________ Bool_t AliTRDgeometry::Global2Local(Int_t mode, Double_t *local, Double_t *global - , Int_t* index, AliTRDparameter *par) const + , Int_t* index) const { // // Converts local pad-coordinates (row,col,time) into @@ -330,11 +330,6 @@ Bool_t AliTRDgeometry::Global2Local(Int_t mode, Double_t *local, Double_t *globa // mode=2 - local coordinate in pad, and pad row, x - rotated global // - if (!par) { - Error("Global2Local","No parameter defined\n"); - return kFALSE; - } - //Int_t idet = GetDetector(iplan,icham,isect); // Detector number Int_t idet = GetDetector(index[0],index[1],index[2]); // Detector number Rotate(idet,global,local); diff --git a/TRD/AliTRDgeometry.h b/TRD/AliTRDgeometry.h index 5923b765842..edee8963ce7 100644 --- a/TRD/AliTRDgeometry.h +++ b/TRD/AliTRDgeometry.h @@ -14,7 +14,6 @@ #include "AliGeometry.h" class AliRunLoader; -class AliTRDparameter; class AliTRDgeometry : public AliGeometry { @@ -34,7 +33,7 @@ class AliTRDgeometry : public AliGeometry { , Double_t *local, Double_t *global) const; virtual Bool_t Global2Local(Int_t mode, Double_t *local, Double_t *global - , Int_t* index, AliTRDparameter *par) const; + , Int_t* index) const; virtual Bool_t Global2Detector(Double_t global[3], Int_t index[3]); virtual Bool_t Rotate(Int_t d, Double_t *pos, Double_t *rot) const; diff --git a/TRD/AliTRDpidESD.cxx b/TRD/AliTRDpidESD.cxx index eb4f888c967..52e17dcf9a7 100644 --- a/TRD/AliTRDpidESD.cxx +++ b/TRD/AliTRDpidESD.cxx @@ -27,7 +27,7 @@ #include "AliESD.h" #include "AliESDtrack.h" #include "AliTRDcalibDB.h" -#include "AliTRDCalPIDLQ.h" +#include "Cal/AliTRDCalPIDLQ.h" ClassImp(AliTRDpidESD) diff --git a/TRD/AliTRDsimpleMC.cxx b/TRD/AliTRDsimpleMC.cxx index c2ade3f12b8..d4a1133153c 100644 --- a/TRD/AliTRDsimpleMC.cxx +++ b/TRD/AliTRDsimpleMC.cxx @@ -27,12 +27,10 @@ #include "AliRun.h" #include "AliTRDgeometry.h" -#include "AliTRDparameter.h" #include "AliTRDsimpleMC.h" #include "AliTRDv1.h" -#include "AliTRDparameter.h" #include "AliMC.h" - + ClassImp(AliTRDsimpleMC) //_____________________________________________________________________________ @@ -60,9 +58,8 @@ AliTRDsimpleMC::AliTRDsimpleMC() fTrackEntering = kFALSE; fTRD = NULL; - fPar = NULL; - -} + +} //_____________________________________________________________________________ AliTRDsimpleMC::AliTRDsimpleMC(const char *name, const char *title) @@ -90,9 +87,8 @@ AliTRDsimpleMC::AliTRDsimpleMC(const char *name, const char *title) fTrackEntering = kFALSE; fTRD = NULL; - fPar = NULL; - -} + +} //_____________________________________________________________________________ AliTRDsimpleMC::AliTRDsimpleMC(const AliTRDsimpleMC &m):TVirtualMC(m) @@ -160,13 +156,9 @@ void AliTRDsimpleMC::NewTrack(Int_t iTrack, Int_t pdg // Starts a new track. // - if (!fPar) { - fPar = new AliTRDparameter("TRDparameter","Standard TRD parameter"); - } - if (!fTRD) { fTRD = (AliTRDv1 *) gAlice->GetDetector("TRD"); - fX0 = AliTRDgeometry::GetTime0(0) - AliTRDgeometry::DrThick(); + fX0 = AliTRDgeometry::GetTime0(0) - AliTRDgeometry::DrThick(); } fTRD->ResetHits(); diff --git a/TRD/AliTRDsimpleMC.h b/TRD/AliTRDsimpleMC.h index 7a456b13d99..2f076b6bc0e 100644 --- a/TRD/AliTRDsimpleMC.h +++ b/TRD/AliTRDsimpleMC.h @@ -17,7 +17,6 @@ #include "AliDecayer.h" class AliTRDv1; -class AliTRDparameter; class TArrayD; class AliTRDsimpleMC : public TVirtualMC { @@ -304,9 +303,8 @@ class AliTRDsimpleMC : public TVirtualMC { Bool_t fTrackEntering; // Track entering chamber AliTRDv1 *fTRD; //! TRD detector object - AliTRDparameter *fPar; //! TRD parameter object - ClassDef(AliTRDsimpleMC,2) // Simple TRD Monte Carlo class + ClassDef(AliTRDsimpleMC, 3) // Simple TRD Monte Carlo class }; #endif diff --git a/TRD/AliTRDtracker.cxx b/TRD/AliTRDtracker.cxx index a3b444f3aaa..2d99849e787 100644 --- a/TRD/AliTRDtracker.cxx +++ b/TRD/AliTRDtracker.cxx @@ -28,7 +28,6 @@ #include #include "AliTRDgeometry.h" -#include "AliTRDparameter.h" #include "AliTRDpadPlane.h" #include "AliTRDgeometryFull.h" #include "AliTRDcluster.h" diff --git a/TRD/AliTRDtracker.h b/TRD/AliTRDtracker.h index 3dfa29a4032..6e77b4ae170 100644 --- a/TRD/AliTRDtracker.h +++ b/TRD/AliTRDtracker.h @@ -13,7 +13,6 @@ class TParticle; class TParticlePDG; class AliTRDgeometry; -class AliTRDparameter; class AliTRDtrack; class AliTRDtracklet; class AliTRDcluster; diff --git a/TRD/Cal/AliTRDCalChamberPos.cxx b/TRD/Cal/AliTRDCalChamberPos.cxx new file mode 100644 index 00000000000..c4111b505f5 --- /dev/null +++ b/TRD/Cal/AliTRDCalChamberPos.cxx @@ -0,0 +1,58 @@ +/************************************************************************** + * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + +/* $Id$ */ + +/////////////////////////////////////////////////////////////////////////////// +// // +// TRD calibration class for position parameters of chambers // +// // +/////////////////////////////////////////////////////////////////////////////// + +#include "AliTRDCalChamberPos.h" + +ClassImp(AliTRDCalChamberPos) + +//_____________________________________________________________________________ +AliTRDCalChamberPos::AliTRDCalChamberPos():TNamed() +{ + // + // AliTRDCalChamberPos default constructor + // + + for (Int_t idet = 0; idet < kNdet; idet++) { + for (Int_t i = 0; i < 3; ++i) { + fChamberPos[idet][i] = 0; + fChamberRot[idet][i] = 0; + } + } +} + +//_____________________________________________________________________________ +AliTRDCalChamberPos::AliTRDCalChamberPos(const Text_t *name, const Text_t *title) + :TNamed(name,title) +{ + // + // AliTRDCalChamberPos constructor + // + + for (Int_t idet = 0; idet < kNdet; idet++) { + for (Int_t i = 0; i < 3; ++i) { + fChamberPos[idet][i] = 0; + fChamberRot[idet][i] = 0; + } + } +} + diff --git a/TRD/Cal/AliTRDCalChamberPos.h b/TRD/Cal/AliTRDCalChamberPos.h new file mode 100644 index 00000000000..f5559fbe9da --- /dev/null +++ b/TRD/Cal/AliTRDCalChamberPos.h @@ -0,0 +1,39 @@ +#ifndef AliTRDCALCHAMBERPOS_H +#define AliTRDCALCHAMBERPOS_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +/* $Id$ */ + +/////////////////////////////////////////////////////////////////////////////// +// // +// TRD calibration class for position parameters chambers // +// // +/////////////////////////////////////////////////////////////////////////////// + +#include "TNamed.h" + +class AliTRDCalChamberPos : public TNamed { + public: + enum { kNdet = 540 }; + + AliTRDCalChamberPos(); + AliTRDCalChamberPos(const Text_t* name, const Text_t* title); + + const Float_t* GetPos(Int_t det) const { return fChamberPos[det]; }; + const Float_t* GetRot(Int_t det) const { return fChamberRot[det]; }; + + void SetPos(Int_t det, Float_t x, Float_t y, Float_t z) { fChamberPos[det][0] = x; fChamberPos[det][1] = y; fChamberPos[det][2] = z; }; + void SetPos(Int_t det, Float_t* xyz) { SetPos(det, xyz[0], xyz[1], xyz[2]); }; + + void SetRot(Int_t det, Float_t x, Float_t y, Float_t z) { fChamberRot[det][0] = x; fChamberRot[det][1] = y; fChamberRot[det][2] = z; }; + void SetRot(Int_t det, Float_t* xyz) { SetRot(det, xyz[0], xyz[1], xyz[2]); }; + + protected: + Float_t fChamberPos[kNdet][3]; // Deviations of the positions of the chambers from the ideal position + Float_t fChamberRot[kNdet][3]; // Rotation of the chambers in respect to the ideal position + + ClassDef(AliTRDCalChamberPos,1) +}; + +#endif diff --git a/TRD/Cal/AliTRDCalChamberStatus.cxx b/TRD/Cal/AliTRDCalChamberStatus.cxx new file mode 100644 index 00000000000..805306091b8 --- /dev/null +++ b/TRD/Cal/AliTRDCalChamberStatus.cxx @@ -0,0 +1,52 @@ +/************************************************************************** + * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + +/* $Id$ */ + +/////////////////////////////////////////////////////////////////////////////// +// // +// TRD calibration class for status of chambers // +// // +/////////////////////////////////////////////////////////////////////////////// + +#include "AliTRDCalChamberStatus.h" + +ClassImp(AliTRDCalChamberStatus) + +//_____________________________________________________________________________ +AliTRDCalChamberStatus::AliTRDCalChamberStatus():TNamed() +{ + // + // AliTRDCalChamberStatus default constructor + // + + for (Int_t idet = 0; idet < kNdet; idet++) { + fStatus[idet] = 0; + } +} + +//_____________________________________________________________________________ +AliTRDCalChamberStatus::AliTRDCalChamberStatus(const Text_t *name, const Text_t *title) + :TNamed(name,title) +{ + // + // AliTRDCalChamberStatus constructor + // + + for (Int_t idet = 0; idet < kNdet; idet++) { + fStatus[idet] = 0; + } +} + diff --git a/TRD/Cal/AliTRDCalChamberStatus.h b/TRD/Cal/AliTRDCalChamberStatus.h new file mode 100644 index 00000000000..7a063c20f40 --- /dev/null +++ b/TRD/Cal/AliTRDCalChamberStatus.h @@ -0,0 +1,36 @@ +#ifndef AliTRDCalChamberStatus_H +#define AliTRDCalChamberStatus_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +/* $Id$ */ + +/////////////////////////////////////////////////////////////////////////////// +// // +// TRD calibration class for status of supermodules // +// // +/////////////////////////////////////////////////////////////////////////////// + +#include "TNamed.h" + +class AliTRDCalChamberStatus : public TNamed { + public: + enum { kNdet = 540, kNstacks = 90, kNcham = 5, kNsect = 18 }; + enum { kInstalled = 1, kMasked = 2 }; + + AliTRDCalChamberStatus(); + AliTRDCalChamberStatus(const Text_t* name, const Text_t* title); + + const Char_t GetStatus(Int_t det) const { return fStatus[det]; }; + void SetStatus(Int_t det, Char_t status) { fStatus[det] = status; }; + + Bool_t IsInstalled(Int_t sm) const { return (GetStatus(sm) & kInstalled) ? kTRUE : kFALSE; } + Bool_t IsMasked(Int_t sm) const { return (GetStatus(sm) & kMasked) ? kTRUE : kFALSE; } + + protected: + Char_t fStatus[kNdet]; // status byte + + ClassDef(AliTRDCalChamberStatus,1) +}; + +#endif diff --git a/TRD/Cal/AliTRDCalDet.cxx b/TRD/Cal/AliTRDCalDet.cxx new file mode 100644 index 00000000000..55fcab0f038 --- /dev/null +++ b/TRD/Cal/AliTRDCalDet.cxx @@ -0,0 +1,102 @@ +/************************************************************************** + * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + +/* $Id$ */ + +/////////////////////////////////////////////////////////////////////////////// +// // +// TRD calibration class for parameters which saved per detector // +// // +/////////////////////////////////////////////////////////////////////////////// + +#include "AliTRDCalDet.h" + +ClassImp(AliTRDCalDet) + +//_____________________________________________________________________________ +AliTRDCalDet::AliTRDCalDet():TNamed() +{ + // + // AliTRDCalDet default constructor + // + + for (Int_t idet = 0; idet < kNdet; idet++) { + fData[idet] = 0; + } + +} + +//_____________________________________________________________________________ +AliTRDCalDet::AliTRDCalDet(const Text_t *name, const Text_t *title) + :TNamed(name,title) +{ + // + // AliTRDCalDet constructor + // + + for (Int_t idet = 0; idet < kNdet; idet++) { + fData[idet] = 0; + } + +} + + +//_____________________________________________________________________________ +AliTRDCalDet::AliTRDCalDet(const AliTRDCalDet &c):TNamed(c) +{ + // + // AliTRDCalDet copy constructor + // + + ((AliTRDCalDet &) c).Copy(*this); + +} + +///_____________________________________________________________________________ +AliTRDCalDet::~AliTRDCalDet() +{ + // + // AliTRDCalDet destructor + // + +} + +//_____________________________________________________________________________ +AliTRDCalDet &AliTRDCalDet::operator=(const AliTRDCalDet &c) +{ + // + // Assignment operator + // + + if (this != &c) ((AliTRDCalDet &) c).Copy(*this); + return *this; + +} + +//_____________________________________________________________________________ +void AliTRDCalDet::Copy(TObject &c) const +{ + // + // Copy function + // + + for (Int_t idet = 0; idet < kNdet; idet++) { + ((AliTRDCalDet &) c).fData[idet] = fData[idet]; + } + + TObject::Copy(c); + +} + diff --git a/TRD/Cal/AliTRDCalDet.h b/TRD/Cal/AliTRDCalDet.h new file mode 100644 index 00000000000..d6cddf7a173 --- /dev/null +++ b/TRD/Cal/AliTRDCalDet.h @@ -0,0 +1,45 @@ +#ifndef ALITRDCALDET_H +#define ALITRDCALDET_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +/* $Id$ */ + +/////////////////////////////////////////////////////////////////////////////// +// // +// TRD calibration class for parameters which are saved per detector // +// // +/////////////////////////////////////////////////////////////////////////////// + +#include "TNamed.h" +#include "AliTRDgeometry.h" + +class AliTRDCalDet : public TNamed { + + public: + + enum { kNplan = 6, kNcham = 5, kNsect = 18, kNdet = 540 }; + + AliTRDCalDet(); + AliTRDCalDet(const Text_t* name, const Text_t* title); + AliTRDCalDet(const AliTRDCalDet &c); + virtual ~AliTRDCalDet(); + AliTRDCalDet &operator=(const AliTRDCalDet &c); + + virtual void Copy(TObject &c) const; + + Float_t GetValue(Int_t d) const { return fData[d]; }; + Float_t GetValue(Int_t p, Int_t c, Int_t s) const { return fData[AliTRDgeometry::GetDetector(p,c,s)]; }; + + void SetValue(Int_t d, Float_t value) { fData[d] = value; }; + void SetValue(Int_t p, Int_t c, Int_t s, Float_t value) { fData[AliTRDgeometry::GetDetector(p,c,s)] = value; }; + + protected: + + Float_t fData[kNdet]; //[kNdet] Data + + ClassDef(AliTRDCalDet,1) // TRD calibration class for parameters which are saved per detector + +}; + +#endif diff --git a/TRD/Cal/AliTRDCalGlobals.cxx b/TRD/Cal/AliTRDCalGlobals.cxx new file mode 100644 index 00000000000..64929cdb2de --- /dev/null +++ b/TRD/Cal/AliTRDCalGlobals.cxx @@ -0,0 +1,59 @@ +/************************************************************************** + * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + +/* $Id$ */ + +/////////////////////////////////////////////////////////////////////////////// +// // +// TRD calibration class for global TRD parameters // +// // +/////////////////////////////////////////////////////////////////////////////// + +#include "AliTRDCalGlobals.h" + +ClassImp(AliTRDCalGlobals) + +//_____________________________________________________________________________ +AliTRDCalGlobals::AliTRDCalGlobals():TNamed() +{ + // + // AliTRDCalGlobals default constructor + // + + + Init(); +} + +//_____________________________________________________________________________ +AliTRDCalGlobals::AliTRDCalGlobals(const Text_t *name, const Text_t *title) + :TNamed(name,title) +{ + // + // AliTRDCalGlobals constructor + // + + Init(); +} + +//_____________________________________________________________________________ +void AliTRDCalGlobals::Init() +{ + // + // default initialization + // + + fSamplingFrequency = 0; + fNumberOfTimeBins = 0; +} diff --git a/TRD/Cal/AliTRDCalGlobals.h b/TRD/Cal/AliTRDCalGlobals.h new file mode 100644 index 00000000000..2f85035b40c --- /dev/null +++ b/TRD/Cal/AliTRDCalGlobals.h @@ -0,0 +1,37 @@ +#ifndef AliTRDCALGLOBALS_H +#define AliTRDCALGLOBALS_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +/* $Id$ */ + +/////////////////////////////////////////////////////////////////////////////// +// // +// TRD calibration class for global TRD parameters // +// // +/////////////////////////////////////////////////////////////////////////////// + +#include "TNamed.h" + +class AliTRDCalGlobals : public TNamed { + public: + AliTRDCalGlobals(); + AliTRDCalGlobals(const Text_t* name, const Text_t* title); + virtual ~AliTRDCalGlobals() {}; + + void SetSamplingFrequency(Float_t freq) { fSamplingFrequency = freq; }; + Float_t GetSamplingFrequency() const { return fSamplingFrequency; }; + + void SetNumberOfTimeBins(Int_t value) { fNumberOfTimeBins = value; }; + Int_t GetNumberOfTimeBins() const { return fNumberOfTimeBins; }; + + protected: + Float_t fSamplingFrequency; // Sampling Frequency in MHz + Int_t fNumberOfTimeBins; // Number of timebins + + void Init(); + + ClassDef(AliTRDCalGlobals,1) // TRD calibration class for global TRD parameters +}; + +#endif diff --git a/TRD/Cal/AliTRDCalMCMStatus.cxx b/TRD/Cal/AliTRDCalMCMStatus.cxx new file mode 100644 index 00000000000..6ed6063e97f --- /dev/null +++ b/TRD/Cal/AliTRDCalMCMStatus.cxx @@ -0,0 +1,116 @@ +/************************************************************************** + * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + +/* $Id$ */ + +/////////////////////////////////////////////////////////////////////////////// +// // +// TRD calibration class for MCM status // +// // +/////////////////////////////////////////////////////////////////////////////// + +#include "AliTRDCalMCMStatus.h" +#include "AliTRDCalSingleChamberStatus.h" + +ClassImp(AliTRDCalMCMStatus) + +//_____________________________________________________________________________ +AliTRDCalMCMStatus::AliTRDCalMCMStatus():TNamed() +{ + // + // AliTRDCalMCMStatus default constructor + // + + for (Int_t idet = 0; idet < kNdet; idet++) { + fROC[idet] = 0; + } + +} + +//_____________________________________________________________________________ +AliTRDCalMCMStatus::AliTRDCalMCMStatus(const Text_t *name, const Text_t *title) + :TNamed(name,title) +{ + // + // AliTRDCalMCMStatus constructor + // + + for (Int_t isec = 0; isec < kNsect; isec++) { + for (Int_t ipla = 0; ipla < kNplan; ipla++) { + for (Int_t icha = 0; icha < kNcham; icha++) { + Int_t idet = AliTRDgeometry::GetDetector(ipla,icha,isec); + fROC[idet] = new AliTRDCalSingleChamberStatus(ipla,icha,8); + } + } + } + +} + + +//_____________________________________________________________________________ +AliTRDCalMCMStatus::AliTRDCalMCMStatus(const AliTRDCalMCMStatus &c):TNamed(c) +{ + // + // AliTRDCalMCMStatus copy constructor + // + + ((AliTRDCalMCMStatus &) c).Copy(*this); + +} + +///_____________________________________________________________________________ +AliTRDCalMCMStatus::~AliTRDCalMCMStatus() +{ + // + // AliTRDCalMCMStatus destructor + // + + for (Int_t idet = 0; idet < kNdet; idet++) { + if (fROC[idet]) { + delete fROC[idet]; + fROC[idet] = 0; + } + } + +} + +//_____________________________________________________________________________ +AliTRDCalMCMStatus &AliTRDCalMCMStatus::operator=(const AliTRDCalMCMStatus &c) +{ + // + // Assignment operator + // + + if (this != &c) ((AliTRDCalMCMStatus &) c).Copy(*this); + return *this; + +} + +//_____________________________________________________________________________ +void AliTRDCalMCMStatus::Copy(TObject &c) const +{ + // + // Copy function + // + + for (Int_t idet = 0; idet < kNdet; idet++) { + if (fROC[idet]) { + fROC[idet]->Copy(*((AliTRDCalMCMStatus &) c).fROC[idet]); + } + } + + TObject::Copy(c); +} + diff --git a/TRD/Cal/AliTRDCalMCMStatus.h b/TRD/Cal/AliTRDCalMCMStatus.h new file mode 100644 index 00000000000..8c3d026c0ae --- /dev/null +++ b/TRD/Cal/AliTRDCalMCMStatus.h @@ -0,0 +1,57 @@ +#ifndef ALITRDCALMCMSTATUS_H +#define ALITRDCALMCMSTATUS_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +/* $Id$ */ + +/////////////////////////////////////////////////////////////////////////////// +// // +// TRD calibration class for MCM status // +// // +/////////////////////////////////////////////////////////////////////////////// + +#include "TNamed.h" +#include "AliTRDgeometry.h" +#include "AliTRDCalSingleChamberStatus.h" + +class AliTRDCalMCMStatus : public TNamed { + + public: + + enum { kNplan = 6, kNcham = 5, kNsect = 18, kNdet = 540 }; + enum { kMasked = 2, kMCMTemperatureBit1 = 4, kMBMTemperatureBit2 = 8 }; + + AliTRDCalMCMStatus(); + AliTRDCalMCMStatus(const Text_t* name, const Text_t* title); + AliTRDCalMCMStatus(const AliTRDCalMCMStatus &c); + virtual ~AliTRDCalMCMStatus(); + AliTRDCalMCMStatus &operator=(const AliTRDCalMCMStatus &c); + + virtual void Copy(TObject &c) const; + + AliTRDCalSingleChamberStatus *GetCalROC(Int_t d) const { return fROC[d]; }; + AliTRDCalSingleChamberStatus *GetCalROC(Int_t p, Int_t c, Int_t s) const + { return GetCalROC(AliTRDgeometry::GetDetector(p,c,s)); }; + + Bool_t IsMasked(Int_t d, Int_t col, Int_t row) const { return CheckStatus(d, col, row, kMasked); }; + inline Bool_t CheckStatus(Int_t d, Int_t col, Int_t row, Int_t bitMask) const; + + protected: + + AliTRDCalSingleChamberStatus *fROC[kNdet]; // Array of ROC objects which contain the values per pad + + ClassDef(AliTRDCalMCMStatus,1) // TRD calibration class for MCM status + +}; + +Bool_t AliTRDCalMCMStatus::CheckStatus(Int_t d, Int_t col, Int_t row, Int_t bitMask) const +{ + AliTRDCalSingleChamberStatus* roc = GetCalROC(d); + if (!roc) + return kFALSE; + + return (roc->GetStatus(col, row) & bitMask) ? kTRUE : kFALSE; +} + +#endif diff --git a/TRD/Cal/AliTRDCalMonitoring.cxx b/TRD/Cal/AliTRDCalMonitoring.cxx new file mode 100644 index 00000000000..e97e3ad4b39 --- /dev/null +++ b/TRD/Cal/AliTRDCalMonitoring.cxx @@ -0,0 +1,57 @@ +/************************************************************************** + * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + +/* $Id$ */ + +/////////////////////////////////////////////////////////////////////////////// +// // +// TRD calibration class for global TRD parameters // +// // +/////////////////////////////////////////////////////////////////////////////// + +#include "AliTRDCalMonitoring.h" + +ClassImp(AliTRDCalMonitoring) + +//_____________________________________________________________________________ +AliTRDCalMonitoring::AliTRDCalMonitoring():TNamed() +{ + // + // AliTRDCalMonitoring default constructor + // + + + Init(); +} + +//_____________________________________________________________________________ +AliTRDCalMonitoring::AliTRDCalMonitoring(const Text_t *name, const Text_t *title) + :TNamed(name,title) +{ + // + // AliTRDCalMonitoring constructor + // + + Init(); +} + +//_____________________________________________________________________________ +void AliTRDCalMonitoring::Init() +{ + // + // default initialization + // + +} diff --git a/TRD/Cal/AliTRDCalMonitoring.h b/TRD/Cal/AliTRDCalMonitoring.h new file mode 100644 index 00000000000..44ef4277a26 --- /dev/null +++ b/TRD/Cal/AliTRDCalMonitoring.h @@ -0,0 +1,50 @@ +#ifndef AliTRDCALMONITORING_H +#define AliTRDCALMONITORING_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +/* $Id$ */ + +/////////////////////////////////////////////////////////////////////////////// +// // +// TRD calibration class for monitoring data // +// // +/////////////////////////////////////////////////////////////////////////////// + +#include "TNamed.h" + +class AliTRDCalMonitoring : public TNamed { + public: + AliTRDCalMonitoring(); + AliTRDCalMonitoring(const Text_t* name, const Text_t* title); + virtual ~AliTRDCalMonitoring() {}; + + //void SetSamplingFrequency(Float_t freq) { fSamplingFrequency = freq; }; + //Float_t GetSamplingFrequency() const { return fSamplingFrequency; }; + + protected: + Int_t fADCTresholds[6700]; + Float_t fDriftVelocity; // Drift velocity from the monitor + TString fGasComposition; // Gas composition + Float_t fEnvironmentTemperature; + + //Float_t fMCMTemperature[6700]; + + Float_t fAnodeCurrentsMin[540]; + Float_t fAnodeCurrentsMax[540]; + Float_t fDriftCurrentsMin[540]; + Float_t fDriftCurrentsMax[540]; + Float_t fAnodeVoltagesMin[540]; + Float_t fAnodeVoltagesMax[540]; + Float_t fDriftVoltagesMin[540]; + Float_t fDriftVoltagesMax[540]; + + Float_t fLVVoltage[360]; + Float_t fLVCurrent[360]; + + void Init(); + + ClassDef(AliTRDCalMonitoring,1) // TRD calibration class for global TRD parameters +}; + +#endif diff --git a/TRD/Cal/AliTRDCalPIDLQ.cxx b/TRD/Cal/AliTRDCalPIDLQ.cxx new file mode 100644 index 00000000000..da33cfeab2a --- /dev/null +++ b/TRD/Cal/AliTRDCalPIDLQ.cxx @@ -0,0 +1,348 @@ +/************************************************************************** + * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + +//----------------------------------------------------------------- +// Class for dE/dx and Time Bin of Max. Cluster for Electrons and +// pions in TRD. +// It is instantiated in class AliTRDpidESD for particle identification +// in TRD +// Prashant Shukla +//----------------------------------------------------------------- + +#include "AliTRDCalPIDLQ.h" +#include +#include + +ClassImp(AliTRDCalPIDLQ) + +Char_t* AliTRDCalPIDLQ::fpartName[AliPID::kSPECIES] = {"electron", "muon", "pion", "kaon", "proton"}; + +//_________________________________________________________________________ +AliTRDCalPIDLQ::AliTRDCalPIDLQ(): + TNamed(), + fNMom(0), + fTrackMomentum(0), + fMeanChargeRatio(0), + fNbins(0), + fBinSize(0), + fHistdEdx(0), + fHistTimeBin(0) +{ + // + // The Default constructor + // + +} + +//_________________________________________________________________________ +AliTRDCalPIDLQ::AliTRDCalPIDLQ(const Text_t *name, const Text_t *title) : TNamed(name, title) +{ + // + // The main constructor + // + + Init(); +} + +//_____________________________________________________________________________ +AliTRDCalPIDLQ::AliTRDCalPIDLQ(const AliTRDCalPIDLQ &c) : TNamed(c) +{ + // + // copy constructor + // + + Init(); + + ((AliTRDCalPIDLQ &) c).Copy(*this); +} + +//_________________________________________________________________________ +AliTRDCalPIDLQ::~AliTRDCalPIDLQ() +{ + // + // Destructor + // + + CleanUp(); +} + +//_________________________________________________________________________ +void AliTRDCalPIDLQ::CleanUp() +{ + if (fHistdEdx) + { + delete fHistdEdx; + fHistdEdx = 0; + } + + if (fHistTimeBin) + { + delete fHistTimeBin; + fHistTimeBin = 0; + } + + if (fTrackMomentum) + { + delete[] fTrackMomentum; + fTrackMomentum = 0; + } +} + +//_____________________________________________________________________________ +AliTRDCalPIDLQ &AliTRDCalPIDLQ::operator=(const AliTRDCalPIDLQ &c) +{ + // + // Assignment operator + // + + if (this != &c) ((AliTRDCalPIDLQ &) c).Copy(*this); + return *this; +} + +//_____________________________________________________________________________ +void AliTRDCalPIDLQ::Copy(TObject &c) const +{ + // + // Copy function + // + + AliTRDCalPIDLQ& target = (AliTRDCalPIDLQ &) c; + + target.CleanUp(); + + target.fNMom = fNMom; + + target.fTrackMomentum = new Double_t[fNMom]; + for (Int_t i=0; iClone(); + + if (fHistTimeBin) + target.fHistTimeBin = (TObjArray*) fHistTimeBin->Clone(); + + TObject::Copy(c); +} + +//_________________________________________________________________________ +void AliTRDCalPIDLQ::Init() +{ + fNMom = 11; + + fTrackMomentum = new Double_t[fNMom]; + Double_t trackMomentum[11] = {0.6, 0.8, 1, 1.5, 2, 3, 4, 5, 6, 8, 10}; + for (Int_t imom = 0; imom < 11; imom++) + fTrackMomentum[imom] = trackMomentum[imom]; + + fHistdEdx = new TObjArray(AliPID::kSPECIES * fNMom); + fHistdEdx->SetOwner(); + fHistTimeBin = new TObjArray(AliPID::kSPECIES * fNMom); + fHistTimeBin->SetOwner(); + + // ADC Gain normalization + fMeanChargeRatio=1.0; + + // Number of bins and bin size + fNbins = 0; + fBinSize = 0.; +} + +//_________________________________________________________________________ +Bool_t AliTRDCalPIDLQ::ReadData(Char_t *responseFile) +{ + // + // Read the TRD dEdx histograms. + // + // Read histogram Root file + TFile *histFile = new TFile(responseFile, "READ"); + if (!histFile || !histFile->IsOpen()) { + Error("AliTRDCalPIDLQ", "opening TRD histgram file %s failed", responseFile); + return kFALSE; + } + gROOT->cd(); + + // Read histograms + Char_t text[200]; + for (Int_t particle = 0; particle < AliPID::kSPECIES; ++particle) + { + Char_t* particleKey = ""; + switch (particle) + { + case AliPID::kElectron: particleKey = "EL"; break; + case AliPID::kPion: particleKey = "PI"; break; + case AliPID::kMuon: particleKey = "MU"; break; + case AliPID::kKaon: particleKey = "KA"; break; + case AliPID::kProton: particleKey = "PR"; break; + } + + for (Int_t imom = 0; imom < fNMom; imom++) + { + sprintf(text, "h1dEdx%s%01d", particleKey, imom+1); + TH1F* hist = (TH1F*)histFile->Get(text)->Clone(); + hist->Scale(1.0/hist->Integral()); + fHistdEdx->AddAt(hist, GetHistID(particle, imom)); + + if (particle == AliPID::kElectron || particle == AliPID::kPion) + { + sprintf(text,"h1MaxTimBin%s%01d", particleKey, imom+1); + TH1F* hist = (TH1F*)histFile->Get(text)->Clone(); + hist->Scale(1.0/hist->Integral()); + fHistTimeBin->AddAt(hist, GetHistID(particle,imom)); + } + } + } + + histFile->Close(); + delete histFile; + + // Number of bins and bin size + TH1F* hist = (TH1F*) fHistdEdx->At(GetHistID(AliPID::kPion, 1)); + fNbins = hist->GetNbinsX(); + fBinSize = hist->GetBinWidth(1); + + return kTRUE; +} + +//_________________________________________________________________________ +Double_t AliTRDCalPIDLQ::GetMean(Int_t k, Int_t ip) const +{ + // + // Gets mean of de/dx dist. of e + printf("Mean for particle = %s and momentum = %.2f is:\n", fpartName[k], fTrackMomentum[ip]); + if (k < 0 || k > AliPID::kSPECIES) + return 0; + + return ((TH1F*) fHistdEdx->At(GetHistID(k,ip)))->GetMean(); +} + +//_________________________________________________________________________ +Double_t AliTRDCalPIDLQ::GetNormalization(Int_t k, Int_t ip) const +{ + // + // Gets Normalization of de/dx dist. of e + + printf("Normalization for particle = %s and momentum = %.2f is:\n",fpartName[k], fTrackMomentum[ip]); + if (k < 0 || k > AliPID::kSPECIES) + return 0; + + return ((TH1F*) fHistdEdx->At(GetHistID(k,ip)))->Integral(); +} + +//_________________________________________________________________________ +TH1F* AliTRDCalPIDLQ::GetHistogram(Int_t k, Int_t ip) const +{ + // + // + printf("Histogram for particle = %s and momentum = %.2f is:\n", fpartName[k], fTrackMomentum[ip]); + if (k < 0 || k > AliPID::kSPECIES) + return 0; + + return (TH1F*) fHistdEdx->At(GetHistID(k,ip)); +} + +//_________________________________________________________________________ +Double_t AliTRDCalPIDLQ::GetProbability(Int_t k, Double_t mom, Double_t dedx1) const +{ + // + // Gets the Probability of having dedx at a given momentum (mom) + // and particle type k (0 for e) and (2 for pi) + // from the precalculated de/dx distributions + + Double_t dedx = dedx1/fMeanChargeRatio; + Int_t iEnBin= ((Int_t) (dedx/fBinSize+1)); + if(iEnBin > fNbins) iEnBin = fNbins; + + if (k < 0 || k > AliPID::kSPECIES) + return 1; + + TH1F* hist1 = 0; + TH1F* hist2 = 0; + Double_t mom1 = 0; + Double_t mom2 = 0; + + // Lower limit + if (mom<=fTrackMomentum[0]) + { + hist1 = (TH1F*) fHistdEdx->At(GetHistID(k,1)); + hist2 = (TH1F*) fHistdEdx->At(GetHistID(k,0)); + mom1 = fTrackMomentum[1]; + mom2 = fTrackMomentum[0]; + } + + // Upper Limit + if(mom>=fTrackMomentum[fNMom-1]) + { + hist2 = (TH1F*) fHistdEdx->At(GetHistID(k,fNMom-1)); + hist1 = (TH1F*) fHistdEdx->At(GetHistID(k,fNMom-2)); + mom2 = fTrackMomentum[fNMom-1]; + mom1 = fTrackMomentum[fNMom-2]; + } + + // In the range + for (Int_t ip=1; ipAt(GetHistID(k,ip)); + hist2 = (TH1F*) fHistdEdx->At(GetHistID(k,ip-1)); + mom1 = fTrackMomentum[ip]; + mom2 = fTrackMomentum[ip-1]; + } + } + + Double_t slop = (hist1->GetBinContent(iEnBin) - hist2->GetBinContent(iEnBin)) / (mom1 - mom2); + return hist2->GetBinContent(iEnBin) + slop * (mom - mom2); +} + +//_________________________________________________________________________ +Double_t AliTRDCalPIDLQ::GetProbabilityT(Int_t k, Double_t mom, Int_t timbin) const +{ + // + // Gets the Probability of having timbin at a given momentum (mom) + // and particle type k (0 for e) and (2 for pi) + // from the precalculated timbin distributions + + if (timbin<=0) + return 0.; + Int_t iTBin=timbin+1; + + // everything which is not electron counts as pion for time bin + if (k != AliPID::kElectron) + k = AliPID::kPion; + + if (mom<=fTrackMomentum[0]) + return ((TH1F*) fHistTimeBin->At(GetHistID(k,0)))->GetBinContent(iTBin); + + if (mom>=fTrackMomentum[fNMom-1]) + return ((TH1F*) fHistTimeBin->At(GetHistID(k,fNMom-1)))->GetBinContent(iTBin); + + for (Int_t ip=1; ipAt(GetHistID(k,ip)))->GetBinContent(iTBin) - ((TH1F*) fHistTimeBin->At(GetHistID(k,ip-1)))->GetBinContent(iTBin)) / (fTrackMomentum[ip] - fTrackMomentum[ip-1]); + // Linear Interpolation + return ((TH1F*) fHistTimeBin->At(GetHistID(k,ip-1)))->GetBinContent(iTBin) + slop * (mom - fTrackMomentum[ip-1]); + } + } + + return -1; +} diff --git a/TRD/Cal/AliTRDCalPIDLQ.h b/TRD/Cal/AliTRDCalPIDLQ.h new file mode 100644 index 00000000000..2600a8bf822 --- /dev/null +++ b/TRD/Cal/AliTRDCalPIDLQ.h @@ -0,0 +1,73 @@ +#ifndef ALITRDCALPIDLQ_H +#define ALITRDCALPIDLQ_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ +/*----------------------------------------------------------------- + Class for dE/dx and Time Bin of Max. Cluster for Electrons and + pions in TRD. + It is instantiated in class AliTRDpidESD for particle identification + in TRD + Prashant Shukla + -----------------------------------------------------------------*/ + +#include +#include + +class TH1F; +class TObjArray; + +class AliTRDCalPIDLQ : public TNamed { + public: + AliTRDCalPIDLQ(); + AliTRDCalPIDLQ(const Text_t *name, const Text_t *title); + + AliTRDCalPIDLQ(const AliTRDCalPIDLQ& pd); // Copy Constructor + virtual ~AliTRDCalPIDLQ(); // Destructor + + AliTRDCalPIDLQ &operator=(const AliTRDCalPIDLQ &c); + virtual void Copy(TObject &c) const; + + Double_t GetMeanChargeRatio() const { return fMeanChargeRatio; } + + Double_t GetMomentum(Int_t ip) const {return fTrackMomentum[ip];} + // Gets the momentum for given histogram number ip + Double_t GetMean(Int_t iType, Int_t ip) const; + // Particle type is iType and histogram number is ip + Double_t GetNormalization(Int_t iType, Int_t ip) const; + + TH1F* GetHistogram(Int_t iType, Int_t ip) const; + + Double_t GetProbability(Int_t iType, Double_t mom, Double_t dedx) const; + // Gets the Probability of having dedx + Double_t GetProbabilityT(Int_t iType, Double_t mom, Int_t timbin) const; + // Gets the Probability of having timbin + Int_t GetNbins() const {return fNbins;} // Number of Energy bins + Double_t GetBinSize() const {return fBinSize;} // Size of Energy bin + + Bool_t ReadData(Char_t *responseFile); // Read histograms + // Update the histograms from responseFile + void SetMeanChargeRatio(Double_t ratio) { fMeanChargeRatio = ratio; } + + protected: + void Init(); // Reset data + void CleanUp(); // Delete pointers; + inline Int_t GetHistID(Int_t particle, Int_t mom) const { return particle*fNMom + mom; } + + static Char_t *fpartName[AliPID::kSPECIES]; //! Names of particle species + + Int_t fNMom; // Number of momenta + Double_t* fTrackMomentum; //[fNMom] Track momenta for which response functions are available + Double_t fMeanChargeRatio; // Ratio of mean charge from real Det. to prob. dist. + + Int_t fNbins; // Number of Energy bins + Double_t fBinSize; // Size of Energy bin + + TObjArray *fHistdEdx; //-> Prob. of dEdx for 5 particles (e, pi, muon, kaon, proton) and for several momenta + TObjArray *fHistTimeBin; //-> Prob. of max time bin for 5 particles (e, pi, muon, kaon, proton) and for several momenta + + ClassDef(AliTRDCalPIDLQ, 1) +}; + + +#endif + diff --git a/TRD/Cal/AliTRDCalPad.cxx b/TRD/Cal/AliTRDCalPad.cxx new file mode 100644 index 00000000000..59ce274acb6 --- /dev/null +++ b/TRD/Cal/AliTRDCalPad.cxx @@ -0,0 +1,136 @@ +/************************************************************************** + * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + +/* $Id$ */ + +/////////////////////////////////////////////////////////////////////////////// +// // +// TRD calibration class for parameters which saved per pad // +// // +/////////////////////////////////////////////////////////////////////////////// + +#include "AliTRDCalPad.h" +#include "AliTRDCalROC.h" +#include "AliTRDCalDet.h" + +ClassImp(AliTRDCalPad) + +//_____________________________________________________________________________ +AliTRDCalPad::AliTRDCalPad():TNamed() +{ + // + // AliTRDCalPad default constructor + // + + for (Int_t idet = 0; idet < kNdet; idet++) { + fROC[idet] = 0; + } + +} + +//_____________________________________________________________________________ +AliTRDCalPad::AliTRDCalPad(const Text_t *name, const Text_t *title) + :TNamed(name,title) +{ + // + // AliTRDCalPad constructor + // + + for (Int_t isec = 0; isec < kNsect; isec++) { + for (Int_t ipla = 0; ipla < kNplan; ipla++) { + for (Int_t icha = 0; icha < kNcham; icha++) { + Int_t idet = GetDet(ipla,icha,isec); + fROC[idet] = new AliTRDCalROC(ipla,icha); + } + } + } + +} + + +//_____________________________________________________________________________ +AliTRDCalPad::AliTRDCalPad(const AliTRDCalPad &c):TNamed(c) +{ + // + // AliTRDCalPad copy constructor + // + + ((AliTRDCalPad &) c).Copy(*this); + +} + +///_____________________________________________________________________________ +AliTRDCalPad::~AliTRDCalPad() +{ + // + // AliTRDCalPad destructor + // + + for (Int_t idet = 0; idet < kNdet; idet++) { + if (fROC[idet]) { + delete fROC[idet]; + fROC[idet] = 0; + } + } + +} + +//_____________________________________________________________________________ +AliTRDCalPad &AliTRDCalPad::operator=(const AliTRDCalPad &c) +{ + // + // Assignment operator + // + + if (this != &c) ((AliTRDCalPad &) c).Copy(*this); + return *this; + +} + +//_____________________________________________________________________________ +void AliTRDCalPad::Copy(TObject &c) const +{ + // + // Copy function + // + + for (Int_t idet = 0; idet < kNdet; idet++) { + if (fROC[idet]) { + fROC[idet]->Copy(*((AliTRDCalPad &) c).fROC[idet]); + } + } + + TObject::Copy(c); +} + +//_____________________________________________________________________________ +void AliTRDCalPad::ScaleROCs(AliTRDCalDet* values) +{ + // + // Scales ROCs of this class with the values from the class + // Is used if an AliTRDCalPad object defines local variations of a parameter + // defined per detector using a AliTRDCalDet class + // + + if (!values) + return; + + for (Int_t idet = 0; idet < kNdet; idet++) { + if (fROC[idet]) { + fROC[idet]->Scale(values->GetValue(idet)); + } + } +} + diff --git a/TRD/Cal/AliTRDCalPad.h b/TRD/Cal/AliTRDCalPad.h new file mode 100644 index 00000000000..28b68daa4fe --- /dev/null +++ b/TRD/Cal/AliTRDCalPad.h @@ -0,0 +1,49 @@ +#ifndef ALITRDCALPAD_H +#define ALITRDCALPAD_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +/* $Id$ */ + +/////////////////////////////////////////////////////////////////////////////// +// // +// TRD calibration class for parameters which are saved per pad // +// // +/////////////////////////////////////////////////////////////////////////////// + +#include "TNamed.h" + +class AliTRDCalROC; +class AliTRDCalDet; + +class AliTRDCalPad : public TNamed { + + public: + + enum { kNplan = 6, kNcham = 5, kNsect = 18, kNdet = 540 }; + + AliTRDCalPad(); + AliTRDCalPad(const Text_t* name, const Text_t* title); + AliTRDCalPad(const AliTRDCalPad &c); + virtual ~AliTRDCalPad(); + AliTRDCalPad &operator=(const AliTRDCalPad &c); + + virtual void Copy(TObject &c) const; + + static inline Int_t GetDet(Int_t p, Int_t c, Int_t s) { return p+c*kNplan+s*kNplan*kNcham; }; + + AliTRDCalROC *GetCalROC(Int_t d) const { return fROC[d]; }; + AliTRDCalROC *GetCalROC(Int_t p, Int_t c, Int_t s) const + { return fROC[GetDet(p,c,s)]; }; + + void ScaleROCs(AliTRDCalDet* values); + + protected: + + AliTRDCalROC *fROC[kNdet]; // Array of ROC objects which contain the values per pad + + ClassDef(AliTRDCalPad,1) // TRD calibration class for parameters which are saved per pad + +}; + +#endif diff --git a/TRD/Cal/AliTRDCalPadStatus.cxx b/TRD/Cal/AliTRDCalPadStatus.cxx new file mode 100644 index 00000000000..ef8896c4e12 --- /dev/null +++ b/TRD/Cal/AliTRDCalPadStatus.cxx @@ -0,0 +1,117 @@ +/************************************************************************** + * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + +/* $Id$ */ + +/////////////////////////////////////////////////////////////////////////////// +// // +// TRD calibration class for MCM status // +// // +/////////////////////////////////////////////////////////////////////////////// + +#include "AliTRDCalPadStatus.h" + +#include "AliTRDCalSingleChamberStatus.h" + +ClassImp(AliTRDCalPadStatus) + +//_____________________________________________________________________________ +AliTRDCalPadStatus::AliTRDCalPadStatus():TNamed() +{ + // + // AliTRDCalPadStatus default constructor + // + + for (Int_t idet = 0; idet < kNdet; idet++) { + fROC[idet] = 0; + } + +} + +//_____________________________________________________________________________ +AliTRDCalPadStatus::AliTRDCalPadStatus(const Text_t *name, const Text_t *title) + :TNamed(name,title) +{ + // + // AliTRDCalPadStatus constructor + // + + for (Int_t isec = 0; isec < kNsect; isec++) { + for (Int_t ipla = 0; ipla < kNplan; ipla++) { + for (Int_t icha = 0; icha < kNcham; icha++) { + Int_t idet = AliTRDgeometry::GetDetector(ipla,icha,isec); + fROC[idet] = new AliTRDCalSingleChamberStatus(ipla,icha,144); + } + } + } + +} + + +//_____________________________________________________________________________ +AliTRDCalPadStatus::AliTRDCalPadStatus(const AliTRDCalPadStatus &c):TNamed(c) +{ + // + // AliTRDCalPadStatus copy constructor + // + + ((AliTRDCalPadStatus &) c).Copy(*this); + +} + +///_____________________________________________________________________________ +AliTRDCalPadStatus::~AliTRDCalPadStatus() +{ + // + // AliTRDCalPadStatus destructor + // + + for (Int_t idet = 0; idet < kNdet; idet++) { + if (fROC[idet]) { + delete fROC[idet]; + fROC[idet] = 0; + } + } + +} + +//_____________________________________________________________________________ +AliTRDCalPadStatus &AliTRDCalPadStatus::operator=(const AliTRDCalPadStatus &c) +{ + // + // Assignment operator + // + + if (this != &c) ((AliTRDCalPadStatus &) c).Copy(*this); + return *this; + +} + +//_____________________________________________________________________________ +void AliTRDCalPadStatus::Copy(TObject &c) const +{ + // + // Copy function + // + + for (Int_t idet = 0; idet < kNdet; idet++) { + if (fROC[idet]) { + fROC[idet]->Copy(*((AliTRDCalPadStatus &) c).fROC[idet]); + } + } + + TObject::Copy(c); +} + diff --git a/TRD/Cal/AliTRDCalPadStatus.h b/TRD/Cal/AliTRDCalPadStatus.h new file mode 100644 index 00000000000..c4c47783497 --- /dev/null +++ b/TRD/Cal/AliTRDCalPadStatus.h @@ -0,0 +1,59 @@ +#ifndef ALITRDCALPADSTATUS_H +#define ALITRDCALPADSTATUS_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +/* $Id$ */ + +/////////////////////////////////////////////////////////////////////////////// +// // +// TRD calibration class for MCM status // +// // +/////////////////////////////////////////////////////////////////////////////// + +#include "TNamed.h" +#include "AliTRDgeometry.h" +#include "AliTRDCalSingleChamberStatus.h" + +class AliTRDCalPadStatus : public TNamed { + + public: + + enum { kNplan = 6, kNcham = 5, kNsect = 18, kNdet = 540 }; + enum { kMasked = 2, kPadBridgedLeft = 4, kPadBridgedRight = 8 }; + + AliTRDCalPadStatus(); + AliTRDCalPadStatus(const Text_t* name, const Text_t* title); + AliTRDCalPadStatus(const AliTRDCalPadStatus &c); + virtual ~AliTRDCalPadStatus(); + AliTRDCalPadStatus &operator=(const AliTRDCalPadStatus &c); + + virtual void Copy(TObject &c) const; + + AliTRDCalSingleChamberStatus *GetCalROC(Int_t d) const { return fROC[d]; }; + AliTRDCalSingleChamberStatus *GetCalROC(Int_t p, Int_t c, Int_t s) const + { return fROC[AliTRDgeometry::GetDetector(p,c,s)]; }; + + Bool_t IsMasked(Int_t d, Int_t col, Int_t row) const { return CheckStatus(d, col, row, kMasked); }; + Bool_t IsBridgedLeft(Int_t d, Int_t col, Int_t row) const { return CheckStatus(d, col, row, kPadBridgedLeft); }; + Bool_t IsBridgedRight(Int_t d, Int_t col, Int_t row) const { return CheckStatus(d, col, row, kPadBridgedRight); }; + inline Bool_t CheckStatus(Int_t d, Int_t col, Int_t row, Int_t bitMask) const; + + protected: + + AliTRDCalSingleChamberStatus *fROC[kNdet]; // Array of ROC objects which contain the values per pad + + ClassDef(AliTRDCalPadStatus,1) // TRD calibration class for MCM status + +}; + +Bool_t AliTRDCalPadStatus::CheckStatus(Int_t d, Int_t col, Int_t row, Int_t bitMask) const +{ + AliTRDCalSingleChamberStatus* roc = GetCalROC(d); + if (!roc) + return kFALSE; + + return (roc->GetStatus(col, row) & bitMask) ? kTRUE : kFALSE; +} + +#endif diff --git a/TRD/Cal/AliTRDCalROC.cxx b/TRD/Cal/AliTRDCalROC.cxx new file mode 100644 index 00000000000..e6e7cf28324 --- /dev/null +++ b/TRD/Cal/AliTRDCalROC.cxx @@ -0,0 +1,208 @@ +/************************************************************************** + * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + +/* $Id$ */ + +/////////////////////////////////////////////////////////////////////////////// +// // +// Calibration base class for a single ROC // +// Contains one UShort_t value per pad // +// However, values are set and get as float, there are stored internally as // +// (UShort_t) value * 10000 // +// // +/////////////////////////////////////////////////////////////////////////////// + +#include "AliTRDCalROC.h" + +ClassImp(AliTRDCalROC) + +//_____________________________________________________________________________ +AliTRDCalROC::AliTRDCalROC():TObject() +{ + // + // Default constructor + // + + fPla = 0; + fCha = 0; + + fNrows = 0; + fNcols = 0; + + fNchannels = 0; + fData = 0; +} + +//_____________________________________________________________________________ +AliTRDCalROC::AliTRDCalROC(Int_t p, Int_t c):TObject() +{ + // + // Constructor that initializes a given pad plane type + // + + fPla = p; + fCha = c; + + fNcols = 144; + + // + // The pad plane parameter + // + switch (p) { + case 0: + if (c == 2) { + // L0C0 type + fNrows = 12; + } + else { + // L0C1 type + fNrows = 16; + } + break; + case 1: + if (c == 2) { + // L1C0 type + fNrows = 12; + } + else { + // L1C1 type + fNrows = 16; + } + break; + case 2: + if (c == 2) { + // L2C0 type + fNrows = 12; + } + else { + // L2C1 type + fNrows = 16; + } + break; + case 3: + if (c == 2) { + // L3C0 type + fNrows = 12; + } + else { + // L3C1 type + fNrows = 16; + } + break; + case 4: + if (c == 2) { + // L4C0 type + fNrows = 12; + } + else { + // L4C1 type + fNrows = 16; + } + break; + case 5: + if (c == 2) { + // L5C0 type + fNrows = 12; + } + else { + // L5C1 type + fNrows = 16; + } + break; + }; + + fNchannels = fNrows * fNcols; + if (fNchannels != 0) + fData = new UShort_t[fNchannels]; + + for (Int_t i=0; i + +//_____________________________________________________________________________ +class AliTRDCalROC : public TObject { + + public: + + AliTRDCalROC(); + AliTRDCalROC(Int_t p, Int_t c); + AliTRDCalROC(const AliTRDCalROC &c); + virtual ~AliTRDCalROC(); + AliTRDCalROC &operator=(const AliTRDCalROC &c); + virtual void Copy(TObject &c) const; + + Int_t GetNrows() const { return fNrows; }; + Int_t GetNcols() const { return fNcols; }; + + Int_t GetChannel(Int_t c, Int_t r) { return r+c*fNrows; }; + Int_t GetNchannels() const { return fNchannels; }; + + Float_t GetValue(Int_t ich) const { return (Float_t) fData[ich] / 10000; }; + Float_t GetValue(Int_t col, Int_t row) { return GetValue(GetChannel(col,row)); }; + + void SetValue(Int_t ich, Float_t value) { fData[ich] = (UShort_t) (value * 10000); }; + void SetValue(Int_t col, Int_t row, Float_t value) { SetValue(GetChannel(col,row), value); }; + + void Scale(Float_t value); + + protected: + + Int_t fPla; // Plane number + Int_t fCha; // Chamber number + + Int_t fNrows; // Number of rows + Int_t fNcols; // Number of columns + + Int_t fNchannels; // Number of channels + UShort_t *fData; //[fNchannels] Data + + ClassDef(AliTRDCalROC, 2) // TRD ROC calibration class + +}; + +#endif diff --git a/TRD/Cal/AliTRDCalSingleChamberStatus.cxx b/TRD/Cal/AliTRDCalSingleChamberStatus.cxx new file mode 100644 index 00000000000..d8aed9c8483 --- /dev/null +++ b/TRD/Cal/AliTRDCalSingleChamberStatus.cxx @@ -0,0 +1,193 @@ +/************************************************************************** + * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + +/* $Id$ */ + +/////////////////////////////////////////////////////////////////////////////// +// // +// Calibration base class for a single ROC // +// Contains one char value per pad // +// // +/////////////////////////////////////////////////////////////////////////////// + +#include "AliTRDCalSingleChamberStatus.h" + +ClassImp(AliTRDCalSingleChamberStatus) + +//_____________________________________________________________________________ +AliTRDCalSingleChamberStatus::AliTRDCalSingleChamberStatus():TObject() +{ + // + // Default constructor + // + + fPla = 0; + fCha = 0; + + fNrows = 0; + fNcols = 0; + + fNchannels = 0; + fData = 0; +} + +//_____________________________________________________________________________ +AliTRDCalSingleChamberStatus::AliTRDCalSingleChamberStatus(Int_t p, Int_t c, Int_t cols):TObject() +{ + // + // Constructor that initializes a given pad plane type + // + + fPla = p; + fCha = c; + + fNcols = cols; + + // + // The pad plane parameter + // + switch (p) { + case 0: + if (c == 2) { + // L0C0 type + fNrows = 12; + } + else { + // L0C1 type + fNrows = 16; + } + break; + case 1: + if (c == 2) { + // L1C0 type + fNrows = 12; + } + else { + // L1C1 type + fNrows = 16; + } + break; + case 2: + if (c == 2) { + // L2C0 type + fNrows = 12; + } + else { + // L2C1 type + fNrows = 16; + } + break; + case 3: + if (c == 2) { + // L3C0 type + fNrows = 12; + } + else { + // L3C1 type + fNrows = 16; + } + break; + case 4: + if (c == 2) { + // L4C0 type + fNrows = 12; + } + else { + // L4C1 type + fNrows = 16; + } + break; + case 5: + if (c == 2) { + // L5C0 type + fNrows = 12; + } + else { + // L5C1 type + fNrows = 16; + } + break; + }; + + fNchannels = fNrows * fNcols; + if (fNchannels != 0) + fData = new Char_t[fNchannels]; + + for (Int_t i=0; i + +//_____________________________________________________________________________ +class AliTRDCalSingleChamberStatus : public TObject { + + public: + + AliTRDCalSingleChamberStatus(); + AliTRDCalSingleChamberStatus(Int_t p, Int_t c, Int_t cols); + AliTRDCalSingleChamberStatus(const AliTRDCalSingleChamberStatus &c); + virtual ~AliTRDCalSingleChamberStatus(); + AliTRDCalSingleChamberStatus &operator=(const AliTRDCalSingleChamberStatus &c); + virtual void Copy(TObject &c) const; + + Int_t GetNrows() const { return fNrows; }; + Int_t GetNcols() const { return fNcols; }; + + Int_t GetChannel(Int_t c, Int_t r) const { return r+c*fNrows; }; + Int_t GetNchannels() const { return fNchannels; }; + Char_t GetStatus(Int_t ich) const { return fData[ich]; }; + Char_t GetStatus(Int_t col, Int_t row) const { return fData[GetChannel(col,row)]; }; + + void SetStatus(Int_t ich, Char_t vd) { fData[ich] = vd; }; + void SetStatus(Int_t col, Int_t row, Char_t vd) + { fData[GetChannel(col,row)] = vd; }; + + protected: + + Int_t fPla; // Plane number + Int_t fCha; // Chamber number + + Int_t fNrows; // Number of rows + Int_t fNcols; // Number of columns + + Int_t fNchannels; // Number of channels + Char_t *fData; //[fNchannels] Data + + ClassDef(AliTRDCalSingleChamberStatus,1) // TRD ROC calibration class + +}; + +#endif diff --git a/TRD/Cal/AliTRDCalStackPos.cxx b/TRD/Cal/AliTRDCalStackPos.cxx new file mode 100644 index 00000000000..e29c916d309 --- /dev/null +++ b/TRD/Cal/AliTRDCalStackPos.cxx @@ -0,0 +1,58 @@ +/************************************************************************** + * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + +/* $Id$ */ + +/////////////////////////////////////////////////////////////////////////////// +// // +// TRD calibration class for position parameters of the stacks // +// // +/////////////////////////////////////////////////////////////////////////////// + +#include "AliTRDCalStackPos.h" + +ClassImp(AliTRDCalStackPos) + +//_____________________________________________________________________________ +AliTRDCalStackPos::AliTRDCalStackPos():TNamed() +{ + // + // AliTRDCalStackPos default constructor + // + + for (Int_t idet = 0; idet < kNstacks; idet++) { + for (Int_t i = 0; i < 3; ++i) { + fStackPos[idet][i] = 0; + fStackRot[idet][i] = 0; + } + } +} + +//_____________________________________________________________________________ +AliTRDCalStackPos::AliTRDCalStackPos(const Text_t *name, const Text_t *title) + :TNamed(name,title) +{ + // + // AliTRDCalStackPos constructor + // + + for (Int_t idet = 0; idet < kNstacks; idet++) { + for (Int_t i = 0; i < 3; ++i) { + fStackPos[idet][i] = 0; + fStackRot[idet][i] = 0; + } + } +} + diff --git a/TRD/Cal/AliTRDCalStackPos.h b/TRD/Cal/AliTRDCalStackPos.h new file mode 100644 index 00000000000..129026c7733 --- /dev/null +++ b/TRD/Cal/AliTRDCalStackPos.h @@ -0,0 +1,57 @@ +#ifndef AliTRDCALSTACKPOS_H +#define AliTRDCALSTACKPOS_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +/* $Id$ */ + +/////////////////////////////////////////////////////////////////////////////// +// // +// TRD calibration class for position parameters of the stacks and chambers // +// // +/////////////////////////////////////////////////////////////////////////////// + +#include "TNamed.h" + +class AliTRDCalStackPos : public TNamed { + public: + enum { kNdet = 540, kNstacks = 90, kNcham = 5, kNsect = 18 }; + + AliTRDCalStackPos(); + AliTRDCalStackPos(const Text_t* name, const Text_t* title); + + const Float_t* GetPos(Int_t chamber, Int_t sector) const { return fStackPos[GetStackNumber(chamber, sector)]; }; + const Float_t* GetRot(Int_t chamber, Int_t sector) const { return fStackPos[GetStackNumber(chamber, sector)]; }; + + inline void SetPos(Int_t chamber, Int_t sector, Float_t x, Float_t y, Float_t z); + void SetPos(Int_t chamber, Int_t sector, Float_t* xyz) { SetPos(chamber, sector, xyz[0], xyz[1], xyz[2]); }; + + inline void SetRot(Int_t chamber, Int_t sector, Float_t x, Float_t y, Float_t z); + void SetRot(Int_t chamber, Int_t sector, Float_t* xyz) { SetRot(chamber, sector, xyz[0], xyz[1], xyz[2]); }; + + protected: + static Int_t GetStackNumber(Int_t chamber, Int_t sector) { return chamber+sector*kNcham; }; + + Float_t fStackPos[kNstacks][3]; // Deviations of the positions of the stacks from the ideal position + Float_t fStackRot[kNstacks][3]; // Rotation of the stacks in respect to the ideal position + + ClassDef(AliTRDCalStackPos,1) +}; + +void AliTRDCalStackPos::SetPos(Int_t chamber, Int_t sector, Float_t x, Float_t y, Float_t z) +{ + Int_t stack = GetStackNumber(chamber, sector); + fStackPos[stack][0] = x; + fStackPos[stack][1] = y; + fStackPos[stack][2] = z; +} + +void AliTRDCalStackPos::SetRot(Int_t chamber, Int_t sector, Float_t x, Float_t y, Float_t z) +{ + Int_t stack = GetStackNumber(chamber, sector); + fStackRot[stack][0] = x; + fStackRot[stack][1] = y; + fStackRot[stack][2] = z; +} + +#endif diff --git a/TRD/Cal/AliTRDCalSuperModulePos.cxx b/TRD/Cal/AliTRDCalSuperModulePos.cxx new file mode 100644 index 00000000000..29e2885976e --- /dev/null +++ b/TRD/Cal/AliTRDCalSuperModulePos.cxx @@ -0,0 +1,58 @@ +/************************************************************************** + * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + +/* $Id$ */ + +/////////////////////////////////////////////////////////////////////////////// +// // +// TRD calibration class for position parameters of the supermodules // +// // +/////////////////////////////////////////////////////////////////////////////// + +#include "AliTRDCalSuperModulePos.h" + +ClassImp(AliTRDCalSuperModulePos) + +//_____________________________________________________________________________ +AliTRDCalSuperModulePos::AliTRDCalSuperModulePos():TNamed() +{ + // + // AliTRDCalSuperModulePos default constructor + // + + for (Int_t idet = 0; idet < kNsect; idet++) { + for (Int_t i = 0; i < 3; ++i) { + fPos[idet][i] = 0; + fRot[idet][i] = 0; + } + } +} + +//_____________________________________________________________________________ +AliTRDCalSuperModulePos::AliTRDCalSuperModulePos(const Text_t *name, const Text_t *title) + :TNamed(name,title) +{ + // + // AliTRDCalSuperModulePos constructor + // + + for (Int_t idet = 0; idet < kNsect; idet++) { + for (Int_t i = 0; i < 3; ++i) { + fPos[idet][i] = 0; + fRot[idet][i] = 0; + } + } +} + diff --git a/TRD/Cal/AliTRDCalSuperModulePos.h b/TRD/Cal/AliTRDCalSuperModulePos.h new file mode 100644 index 00000000000..7e9c66bde81 --- /dev/null +++ b/TRD/Cal/AliTRDCalSuperModulePos.h @@ -0,0 +1,53 @@ +#ifndef AliTRDCALSUPERMODULEPOS_H +#define AliTRDCALSUPERMODULEPOS_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +/* $Id$ */ + +/////////////////////////////////////////////////////////////////////////////// +// // +// TRD calibration class for position parameters of the supermodules // +// // +/////////////////////////////////////////////////////////////////////////////// + +#include "TNamed.h" + +class AliTRDCalSuperModulePos : public TNamed { + public: + enum { kNdet = 540, kNstacks = 90, kNcham = 5, kNsect = 18 }; + + AliTRDCalSuperModulePos(); + AliTRDCalSuperModulePos(const Text_t* name, const Text_t* title); + + const Float_t* GetPos(Int_t sm) const { return fPos[sm]; }; + const Float_t* GetRot(Int_t sm) const { return fRot[sm]; }; + + inline void SetPos(Int_t sm, Float_t x, Float_t y, Float_t z); + void SetPos(Int_t sm, Float_t* xyz) { SetPos(sm, xyz[0], xyz[1], xyz[2]); }; + + inline void SetRot(Int_t sm, Float_t x, Float_t y, Float_t z); + void SetRot(Int_t sm, Float_t* xyz) { SetRot(sm, xyz[0], xyz[1], xyz[2]); }; + + protected: + Float_t fPos[kNsect][3]; // Deviations of the positions of the supermodules from the ideal position + Float_t fRot[kNsect][3]; // Rotation of the supermodules in respect to the ideal position + + ClassDef(AliTRDCalSuperModulePos,1) +}; + +void AliTRDCalSuperModulePos::SetPos(Int_t sm, Float_t x, Float_t y, Float_t z) +{ + fPos[sm][0] = x; + fPos[sm][1] = y; + fPos[sm][2] = z; +} + +void AliTRDCalSuperModulePos::SetRot(Int_t sm, Float_t x, Float_t y, Float_t z) +{ + fRot[sm][0] = x; + fRot[sm][1] = y; + fRot[sm][2] = z; +} + +#endif diff --git a/TRD/Cal/AliTRDCalSuperModuleStatus.cxx b/TRD/Cal/AliTRDCalSuperModuleStatus.cxx new file mode 100644 index 00000000000..3643ce952a6 --- /dev/null +++ b/TRD/Cal/AliTRDCalSuperModuleStatus.cxx @@ -0,0 +1,52 @@ +/************************************************************************** + * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + +/* $Id$ */ + +/////////////////////////////////////////////////////////////////////////////// +// // +// TRD calibration class for status of supermodules // +// // +/////////////////////////////////////////////////////////////////////////////// + +#include "AliTRDCalSuperModuleStatus.h" + +ClassImp(AliTRDCalSuperModuleStatus) + +//_____________________________________________________________________________ +AliTRDCalSuperModuleStatus::AliTRDCalSuperModuleStatus():TNamed() +{ + // + // AliTRDCalSuperModuleStatus default constructor + // + + for (Int_t idet = 0; idet < kNsect; idet++) { + fStatus[idet] = 0; + } +} + +//_____________________________________________________________________________ +AliTRDCalSuperModuleStatus::AliTRDCalSuperModuleStatus(const Text_t *name, const Text_t *title) + :TNamed(name,title) +{ + // + // AliTRDCalSuperModuleStatus constructor + // + + for (Int_t idet = 0; idet < kNsect; idet++) { + fStatus[idet] = 0; + } +} + diff --git a/TRD/Cal/AliTRDCalSuperModuleStatus.h b/TRD/Cal/AliTRDCalSuperModuleStatus.h new file mode 100644 index 00000000000..24ba215abcb --- /dev/null +++ b/TRD/Cal/AliTRDCalSuperModuleStatus.h @@ -0,0 +1,36 @@ +#ifndef ALITRDCALSUPERMODULESTATUS_H +#define ALITRDCALSUPERMODULESTATUS_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +/* $Id$ */ + +/////////////////////////////////////////////////////////////////////////////// +// // +// TRD calibration class for status of supermodules // +// // +/////////////////////////////////////////////////////////////////////////////// + +#include "TNamed.h" + +class AliTRDCalSuperModuleStatus : public TNamed { + public: + enum { kNdet = 540, kNstacks = 90, kNcham = 5, kNsect = 18 }; + enum { kInstalled = 1, kMasked = 2 }; + + AliTRDCalSuperModuleStatus(); + AliTRDCalSuperModuleStatus(const Text_t* name, const Text_t* title); + + const Char_t GetStatus(Int_t sm) const { return fStatus[sm]; }; + void SetStatus(Int_t sm, Char_t status) { fStatus[sm] = status; }; + + Bool_t IsInstalled(Int_t sm) const { return (GetStatus(sm) & kInstalled) ? kTRUE : kFALSE; } + Bool_t IsMasked(Int_t sm) const { return (GetStatus(sm) & kMasked) ? kTRUE : kFALSE; } + + protected: + Char_t fStatus[kNsect]; // status byte + + ClassDef(AliTRDCalSuperModuleStatus,1) +}; + +#endif diff --git a/TRD/Cal/AliTRDCreateDummyCDB.C b/TRD/Cal/AliTRDCreateDummyCDB.C new file mode 100644 index 00000000000..859a4b0dd52 --- /dev/null +++ b/TRD/Cal/AliTRDCreateDummyCDB.C @@ -0,0 +1,285 @@ +#if !defined( __CINT__) || defined(__MAKECINT__) + +#include + +#include +#include +#include +#include + +#include "AliTRDgeometry.h" + +#include "AliTRDCalROC.h" +#include "AliTRDCalChamberPos.h" +#include "AliTRDCalStackPos.h" +#include "AliTRDCalSuperModulePos.h" +#include "AliTRDCalPad.h" +#include "AliTRDCalDet.h" +#include "AliTRDCalGlobals.h" + +#include "AliTRDCalSuperModuleStatus.h" +#include "AliTRDCalChamberStatus.h" +#include "AliTRDCalMCMStatus.h" +#include "AliTRDCalPadStatus.h" +#include "AliTRDCalSingleChamberStatus.h" + +#include "AliTRDCalPIDLQ.h" +#include "AliTRDCalMonitoring.h" + +#endif + +// run number for the dummy file +const Int_t gkDummyRun = 0; +AliCDBStorage* gStorLoc = 0; + +TObject* CreatePadObject(const char* shortName, const char* description, Float_t value) +{ + AliTRDCalPad *calPad = new AliTRDCalPad(shortName, description); + for (Int_t det=0; detGetCalROC(det); + for (Int_t channel=0; channelGetNchannels(); ++channel) + calROC->SetValue(channel, value); + } + return calPad; +} + +TObject* CreateDetObject(const char* shortName, const char* description, Float_t value) +{ + AliTRDCalDet *object = new AliTRDCalDet(shortName, description); + for (Int_t det=0; detSetValue(det, value); + return object; +} + +TObject* CreateGlobalsObject() +{ + AliTRDCalGlobals *object = new AliTRDCalGlobals("Globals", "Global TRD calibration parameters"); + + object->SetSamplingFrequency(10.0); + object->SetNumberOfTimeBins(22); + + return object; +} + +TObject* CreateChamberObject() +{ + AliTRDCalChamberPos *object = new AliTRDCalChamberPos("Chamber", "TRD chamber positions"); + + for (Int_t det=0; detSetPos(det, 0, 0, 0); + object->SetRot(det, 0, 0, 0); + } + + return object; +} + +TObject* CreateStackObject() +{ + AliTRDCalStackPos *object = new AliTRDCalStackPos("Stack", "TRD stack positions"); + + for (Int_t sect=0; sectSetPos(chamber, sect, 0, 0, 0); + object->SetRot(chamber, sect, 0, 0, 0); + } + } + + return object; +} + +TObject* CreateSuperModuleObject() +{ + AliTRDCalSuperModulePos *object = new AliTRDCalSuperModulePos("Stack", "TRD supermodule positions"); + + for (Int_t sect=0; sectSetPos(sect, 0, 0, 0); + object->SetRot(sect, 0, 0, 0); + } + + return object; +} + + +TObject* CreatePRFWidthObject() +{ + AliTRDCalPad *calPad = new AliTRDCalPad("PRFWidth","PRFWidth"); + for (Int_t plane=0; planeGetCalROC(plane, chamber, sector); + for (Int_t channel=0; channelGetNchannels(); ++channel) + calROC->SetValue(channel, value); + } + } + } + + return calPad; +} + +AliTRDCalSuperModuleStatus* CreateSuperModuleStatusObject() +{ + AliTRDCalSuperModuleStatus* obj = new AliTRDCalSuperModuleStatus("supermodulestatus", "supermodulestatus"); + + for (Int_t i=0; iSetStatus(i, AliTRDCalSuperModuleStatus::kInstalled); + + return obj; +} + +AliTRDCalChamberStatus* CreateChamberStatusObject() +{ + AliTRDCalChamberStatus* obj = new AliTRDCalChamberStatus("chamberstatus", "chamberstatus"); + + for (Int_t i=0; iSetStatus(i, AliTRDCalChamberStatus::kInstalled); + + return obj; +} + +AliTRDCalMCMStatus* CreateMCMStatusObject() +{ + AliTRDCalMCMStatus* obj = new AliTRDCalMCMStatus("mcmstatus", "mcmstatus"); + + return obj; +} + +AliTRDCalPadStatus* CreatePadStatusObject() +{ + AliTRDCalPadStatus* obj = new AliTRDCalPadStatus("padstatus", "padstatus"); + + return obj; +} + +AliTRDCalPIDLQ* CreatePIDLQObject() +{ + AliTRDCalPIDLQ* pid = new AliTRDCalPIDLQ("pidobject", "pidobject"); + pid->ReadData("$ALICE_ROOT/TRD/TRDdEdxHistogramsV1.root"); + pid->SetMeanChargeRatio(1.0); // The factor is the ratio of Mean of pi charge dist. + // for the New TRD code divided by the Mean of pi charge + // dist. given in AliTRDCalPIDLQ object + + return pid; +} + +AliTRDCalMonitoring* CreateMonitoringObject() +{ + AliTRDCalMonitoring* obj = new AliTRDCalMonitoring(); + + return obj; +} + +AliCDBMetaData* CreateMetaObject(const char* objectClassName) +{ + AliCDBMetaData *md1= new AliCDBMetaData(); + md1->SetObjectClassName(objectClassName); + md1->SetResponsible("Jan Fiete Grosse-Oetringhaus"); + md1->SetBeamPeriod(1); + md1->SetAliRootVersion("05-06-00"); //root version + md1->SetComment("The dummy values in this calibration file are for testing only"); + + return md1; +} + +void StoreObject(const char* cdbPath, TObject* object, AliCDBMetaData* metaData) +{ + AliCDBId id1(cdbPath, gkDummyRun, gkDummyRun); + gStorLoc->Put(object, id1, metaData); +} + + +void AliTRDCreateDummyCDB() +{ + cout << endl << "TRD :: Creating dummy CDB with event number " << gkDummyRun << endl; + + AliCDBManager *man = AliCDBManager::Instance(); + gStorLoc = man->GetStorage("local://$ALICE_ROOT"); + if (!gStorLoc) + return; + + TObject* obj = 0; + AliCDBMetaData* metaData = 0; + + metaData = CreateMetaObject("AliTRDCalPad"); + + obj = CreatePadObject("LocalVdrift","TRD drift velocities (local variations)", 1); + StoreObject("TRD/Calib/LocalVdrift", obj, metaData); + + obj = CreatePadObject("LocalT0","T0 (local variations)", 1); + StoreObject("TRD/Calib/LocalT0", obj, metaData); + + obj = CreatePadObject("GainFactor","GainFactor (local variations)", 1); + StoreObject("TRD/Calib/LocalGainFactor", obj, metaData); + + obj = CreatePRFWidthObject(); + StoreObject("TRD/Calib/PRFWidth", obj, metaData); + + metaData = CreateMetaObject("AliTRDCalDet"); + + obj = CreateDetObject("ChamberVdrift","TRD drift velocities (detector value)", 1.5); + StoreObject("TRD/Calib/ChamberVdrift", obj, metaData); + + obj = CreateDetObject("ChamberT0","T0 (detector value)", 0); + StoreObject("TRD/Calib/ChamberT0", obj, metaData); + + obj = CreateDetObject("ChamberGainFactor","GainFactor (detector value)", 1); + StoreObject("TRD/Calib/ChamberGainFactor", obj, metaData); + + metaData = CreateMetaObject("AliTRDCalGlobals"); + obj = CreateGlobalsObject(); + StoreObject("TRD/Calib/Globals", obj, metaData); + + metaData = CreateMetaObject("AliTRDCalChamberPos"); + obj = CreateChamberObject(); + StoreObject("TRD/Calib/ChamberPos", obj, metaData); + + metaData = CreateMetaObject("AliTRDCalStackPos"); + obj = CreateStackObject(); + StoreObject("TRD/Calib/StackPos", obj, metaData); + + metaData = CreateMetaObject("AliTRDCalSuperModulePos"); + obj = CreateSuperModuleObject(); + StoreObject("TRD/Calib/SuperModulePos", obj, metaData); + + metaData = CreateMetaObject("AliTRDCalSuperModuleStatus"); + obj = CreateSuperModuleStatusObject(); + StoreObject("TRD/Calib/SuperModuleStatus", obj, metaData); + + metaData = CreateMetaObject("AliTRDCalChamberStatus"); + obj = CreateChamberStatusObject(); + StoreObject("TRD/Calib/ChamberStatus", obj, metaData); + + metaData = CreateMetaObject("AliTRDCalMCMStatus"); + obj = CreateMCMStatusObject(); + StoreObject("TRD/Calib/MCMStatus", obj, metaData); + + metaData = CreateMetaObject("AliTRDCalPadStatus"); + obj = CreatePadStatusObject(); + StoreObject("TRD/Calib/PadStatus", obj, metaData); + + metaData = CreateMetaObject("AliTRDCalPIDLQ"); + obj = CreatePIDLQObject(); + StoreObject("TRD/Calib/PIDLQ", obj, metaData); + + metaData = CreateMetaObject("AliTRDCalMonitoring"); + obj = CreateMonitoringObject(); + StoreObject("TRD/Calib/MonitoringData", obj, metaData); +} diff --git a/TRD/Cal/AliTRDTestCal.C b/TRD/Cal/AliTRDTestCal.C new file mode 100644 index 00000000000..437752c8014 --- /dev/null +++ b/TRD/Cal/AliTRDTestCal.C @@ -0,0 +1,55 @@ +void Dump(Char_t* comment, Float_t* f) +{ + cout << f[0] << " " << f[1] << " " << f[2] << endl; +} + +void Dump(Char_t* comment, Float_t f) +{ + cout << comment << ": " << f << endl; +} + +void AliTRDTestCal() +{ + AliTRDcalibDB* calib = AliTRDcalibDB::Instance(); + if (!calib) + { + cerr << "calibDB singleton has already been terminated." << endl; + return; + } + + Float_t f[3]; + + calib->GetChamberPos(0, f); Dump("chamberpos", f); + calib->GetChamberRot(0, f); Dump("chamberrot", f); + + calib->GetStackPos(0, 0, f); Dump("stackpos", f); + calib->GetStackRot(0, 0, f); Dump("stackrot", f); + + calib->GetSuperModulePos(0, f); Dump("smpos", f); + calib->GetSuperModuleRot(0, f); Dump("smrot", f); + + Dump("vdrift", calib->GetVdrift(0, 0, 0)); + Dump("vdrift-av", calib->GetVdriftAverage(0)); + + Dump("t0", calib->GetT0(0, 0, 0)); + Dump("t0-av", calib->GetT0Average(0)); + + Dump("gain", calib->GetGainFactor(0, 0, 0)); + Dump("gain-av", calib->GetGainFactorAverage(0)); + + Dump("prf", calib->GetPRFWidth(0, 0, 0)); + + Dump("sf", calib->GetSamplingFrequency()); + Dump("timebins", calib->GetNumberOfTimeBins()); + + Dump("padstatus", calib->GetPadStatus(0, 0, 0)); + Dump("mcmstatus", calib->GetMCMStatus(0, 0, 0)); + Dump("chamberstatus", calib->GetChamberStatus(0)); + Dump("smstatus", calib->GetSuperModuleStatus(0)); + + AliTRDCalMonitoring* mon = calib->GetMonitoringObject(); + Dump("monitoring", (Float_t) mon); + AliTRDCalPIDLQ* pid = calib->GetPIDLQObject(); + Dump("pid", (Float_t) pid); + +} \ No newline at end of file diff --git a/TRD/Cal/AliTRDbenchmarkCalibDB.C b/TRD/Cal/AliTRDbenchmarkCalibDB.C new file mode 100644 index 00000000000..69a887417d7 --- /dev/null +++ b/TRD/Cal/AliTRDbenchmarkCalibDB.C @@ -0,0 +1,53 @@ +#if !defined( __CINT__) || defined(__MAKECINT__) + +#include + +#include "AliTRDcalibDB.h" +#include +#include + +extern TRandom* gRandom; + +#endif + +#define BENCHMARK(code, comment) \ + timer.Reset(); timer.Start(); \ + for (Int_t i=0; iSetRun(1); + calib->SetRun(0); + calib->GetNumberOfTimeBins(); + + BENCHMARK(calib->GetNumberOfTimeBins();, "GetNumberOfTimeBins"); + BENCHMARK(calib->GetChamberPos(1, xyz);, "GetChamberPos"); + BENCHMARK(calib->GetVdrift((Int_t) (gRandom->Uniform() * 500), (Int_t) (gRandom->Uniform() * 100), (Int_t) (gRandom->Uniform() * 10));, "GetVdrift"); + + #undef NUMBER + #define NUMBER 10000 + BENCHMARK(calib->SetRun(1); calib->SetRun(0); calib->GetNumberOfTimeBins();, "GetNumberOfTimeBins with invalidating"); + BENCHMARK(calib->SetRun(1); calib->SetRun(0); calib->GetChamberPos(1, xyz);, "GetChamberPos with invalidating"); + #undef NUMBER + #define NUMBER 200 + BENCHMARK(calib->SetRun(1); calib->SetRun(0); calib->GetVdrift(1, 1, 1);, "GetVdrift with invalidating"); + + AliTRDcalibDB::Terminate(); +} diff --git a/TRD/TRDbaseLinkDef.h b/TRD/TRDbaseLinkDef.h index 1965679c072..89fefb5221b 100644 --- a/TRD/TRDbaseLinkDef.h +++ b/TRD/TRDbaseLinkDef.h @@ -21,7 +21,6 @@ #pragma link C++ class AliTRDgeometry+; #pragma link C++ class AliTRDgeometryFull+; -#pragma link C++ class AliTRDparameter+; #pragma link C++ class AliTRDpadPlane+; #pragma link C++ class AliTRDdigit+; @@ -38,6 +37,15 @@ #pragma link C++ class AliTRDCalGlobals+; #pragma link C++ class AliTRDCalChamberPos+; #pragma link C++ class AliTRDCalStackPos+; +#pragma link C++ class AliTRDCalSuperModulePos+; #pragma link C++ class AliTRDCalPIDLQ+; +#pragma link C++ class AliTRDCalMonitoring+; + +#pragma link C++ class AliTRDCalSuperModuleStatus+; +#pragma link C++ class AliTRDCalChamberStatus+; +#pragma link C++ class AliTRDCalMCMStatus+; +#pragma link C++ class AliTRDCalPadStatus+; +#pragma link C++ class AliTRDCalSingleChamberStatus+; + #endif diff --git a/TRD/libTRDbase.pkg b/TRD/libTRDbase.pkg index ab7258834ff..905dd5be79e 100644 --- a/TRD/libTRDbase.pkg +++ b/TRD/libTRDbase.pkg @@ -8,23 +8,29 @@ SRCS= AliTRDarrayI.cxx \ AliTRDsegmentArray.cxx \ AliTRDgeometry.cxx \ AliTRDgeometryFull.cxx \ - AliTRDparameter.cxx \ AliTRDdigit.cxx \ AliTRDdigitsManager.cxx \ AliTRDrawData.cxx \ AliTRDpadPlane.cxx \ AliTRDRawStream.cxx \ - AliTRDCalROC.cxx \ - AliTRDCalPad.cxx \ - AliTRDCalDet.cxx \ - AliTRDCalGlobals.cxx \ - AliTRDCalChamberPos.cxx \ - AliTRDCalStackPos.cxx \ AliTRDCommonParam.cxx \ AliTRDcalibDB.cxx \ - AliTRDCalPIDLQ.cxx + Cal/AliTRDCalROC.cxx \ + Cal/AliTRDCalPad.cxx \ + Cal/AliTRDCalDet.cxx \ + Cal/AliTRDCalGlobals.cxx \ + Cal/AliTRDCalChamberPos.cxx \ + Cal/AliTRDCalStackPos.cxx \ + Cal/AliTRDCalSuperModulePos.cxx \ + Cal/AliTRDCalPIDLQ.cxx \ + Cal/AliTRDCalMonitoring.cxx \ + Cal/AliTRDCalSuperModuleStatus.cxx \ + Cal/AliTRDCalChamberStatus.cxx \ + Cal/AliTRDCalMCMStatus.cxx \ + Cal/AliTRDCalPadStatus.cxx \ + Cal/AliTRDCalSingleChamberStatus.cxx -HDRS= $(SRCS:.cxx=.h) +HDRS= $(SRCS:.cxx=.h) DHDR= TRDbaseLinkDef.h -- 2.43.0