X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=FMD%2FAliFMDParameters.cxx;h=a6632a4bc679c24706a519a54bd085604c33225e;hb=e8f4b841df7c610f28d63af23059f7194d99f012;hp=6ff951ab7c356edad12788fae62da5c88887b9b6;hpb=97e942384341fc4671a105cc4ec47b27a01996ca;p=u%2Fmrichter%2FAliRoot.git diff --git a/FMD/AliFMDParameters.cxx b/FMD/AliFMDParameters.cxx index 6ff951ab7c3..a6632a4bc67 100644 --- a/FMD/AliFMDParameters.cxx +++ b/FMD/AliFMDParameters.cxx @@ -40,8 +40,11 @@ #include "AliFMDAltroMapping.h" // ALIFMDALTROMAPPING_H #include // ALICDBMANAGER_H #include // ALICDBMANAGER_H +#include +#include #include #include +#include #include #include @@ -55,14 +58,16 @@ ClassImp(AliFMDParameters) AliFMDParameters* AliFMDParameters::fgInstance = 0; //____________________________________________________________________ -const char* AliFMDParameters::fgkPulseGain = "FMD/Calib/PulseGain"; -const char* AliFMDParameters::fgkPedestal = "FMD/Calib/Pedestal"; -const char* AliFMDParameters::fgkDead = "FMD/Calib/Dead"; -const char* AliFMDParameters::fgkSampleRate = "FMD/Calib/SampleRate"; -const char* AliFMDParameters::fgkAltroMap = "FMD/Calib/AltroMap"; -const char* AliFMDParameters::fgkZeroSuppression = "FMD/Calib/ZeroSuppression"; -const char* AliFMDParameters::fgkStripRange = "FMD/Calib/StripRange"; - +const char* AliFMDParameters::fgkPulseGain = "FMD/Calib/PulseGain"; +const char* AliFMDParameters::fgkPedestal = "FMD/Calib/Pedestal"; +const char* AliFMDParameters::fgkDead = "FMD/Calib/Dead"; +const char* AliFMDParameters::fgkSampleRate = "FMD/Calib/SampleRate"; +const char* AliFMDParameters::fgkAltroMap = "FMD/Calib/AltroMap"; +const char* AliFMDParameters::fgkZeroSuppression = "FMD/Calib/ZeroSuppression"; +const char* AliFMDParameters::fgkStripRange = "FMD/Calib/StripRange"; +const char* AliFMDParameters::fkPedestalShuttleID = "pedestals"; +const char* AliFMDParameters::fkGainShuttleID = "gains"; +const char* AliFMDParameters::fkConditionsShuttleID = "conditions"; //____________________________________________________________________ AliFMDParameters* @@ -90,6 +95,7 @@ AliFMDParameters::AliFMDParameters() fFixedMaxStrip(0), fFixedPulseGain(0), fEdepMip(0), + fHasCompleteHeader(kTRUE), fZeroSuppression(0), fSampleRate(0), fPedestal(0), @@ -109,24 +115,40 @@ AliFMDParameters::AliFMDParameters() SetPedestalFactor(); SetThreshold(); SetStripRange(); + fAltroMap = new AliFMDAltroMapping; } //__________________________________________________________________ void -AliFMDParameters::Init(Bool_t forceReInit) +AliFMDParameters::Init(Bool_t forceReInit, UInt_t what) { // Initialize the parameters manager. We need to get stuff from the // CDB here. if (forceReInit) fIsInit = kFALSE; if (fIsInit) return; - InitPulseGain(); - InitPedestal(); - InitDeadMap(); - InitSampleRate(); - InitZeroSuppression(); - InitAltroMap(); + if (what & kPulseGain) InitPulseGain(); + if (what & kPedestal) InitPedestal(); + if (what & kDeadMap) InitDeadMap(); + if (what & kSampleRate) InitSampleRate(); + if (what & kZeroSuppression) InitZeroSuppression(); + if (what & kAltroMap) InitAltroMap(); + fIsInit = kTRUE; +} +//__________________________________________________________________ +void +AliFMDParameters::Init(AliFMDPreprocessor* pp, Bool_t forceReInit, UInt_t what) +{ + // Initialize the parameters manager. We need to get stuff from the + // CDB here. + if (forceReInit) fIsInit = kFALSE; + if (fIsInit) return; + if (what & kPulseGain) InitPulseGain(pp); + if (what & kPedestal) InitPedestal(pp); + if (what & kDeadMap) InitDeadMap(pp); + if (what & kSampleRate) InitSampleRate(pp); + if (what & kZeroSuppression) InitZeroSuppression(pp); + if (what & kAltroMap) InitAltroMap(pp); fIsInit = kTRUE; - } //__________________________________________________________________ @@ -139,39 +161,38 @@ AliFMDParameters::Draw(Option_t* option) { TString opt(option); enum { - kPulseGain, // Path to PulseGain calib object - kThreshold, // Path to PulseGain calib object - kPedestal, // Path to Pedestal calib object - kPedestalWidth, // Path to Pedestal calib object - kDead, // Path to Dead calib object - kSampleRate, // Path to SampleRate calib object - kAltroMap, // Path to AltroMap calib object - kZeroSuppression, // Path to ZeroSuppression cal object - kMinStripRange, // Path to strip range cal object - kMaxStripRange // Path to strip range cal object + kLocalPulseGain, // Path to PulseGain calib object + kLocalThreshold, // Path to PulseGain calib object + kLocalPedestal, // Path to Pedestal calib object + kLocalPedestalWidth, // Path to Pedestal calib object + kLocalDead, // Path to Dead calib object + kLocalSampleRate, // Path to SampleRate calib object + kLocalAltroMap, // Path to AltroMap calib object + kLocalZeroSuppression, // Path to ZeroSuppression cal object + kLocalMinStripRange, // Path to strip range cal object + kLocalMaxStripRange // Path to strip range cal object } what; - if (opt.Contains("dead", TString::kIgnoreCase)) - what = kDead; + what = kLocalDead; else if (opt.Contains("threshold",TString::kIgnoreCase)) - what = kThreshold; + what = kLocalThreshold; else if (opt.Contains("gain",TString::kIgnoreCase)) - what = kPulseGain; + what = kLocalPulseGain; else if (opt.Contains("pedestal",TString::kIgnoreCase)) - what = kPedestal; + what = kLocalPedestal; else if (opt.Contains("noise",TString::kIgnoreCase)) - what = kPedestalWidth; + what = kLocalPedestalWidth; else if (opt.Contains("zero",TString::kIgnoreCase)) - what = kZeroSuppression; + what = kLocalZeroSuppression; else if (opt.Contains("rate",TString::kIgnoreCase)) - what = kSampleRate; + what = kLocalSampleRate; else if (opt.Contains("min",TString::kIgnoreCase)) - what = kMinStripRange; + what = kLocalMinStripRange; else if (opt.Contains("max",TString::kIgnoreCase)) - what = kMaxStripRange; + what = kLocalMaxStripRange; else if (opt.Contains("map",TString::kIgnoreCase)) - what = kAltroMap; + what = kLocalAltroMap; else { Warning("Draw", "unknown parameter: %s\n\tShould be one of\n\t" "dead, threshold, gain, pedestal, noise, zero, rate, " @@ -206,7 +227,7 @@ AliFMDParameters::Draw(Option_t* option) } } TArrayD ybins(41); - for (Int_t i = 0; i < ybins.fN; i++) ybins[i] = Float_t(i - .5); + for (/*Int_t*/ i = 0; i < ybins.fN; i++) ybins[i] = Float_t(i - .5); TH2D* hist = new TH2D("calib", Form("Calibration %s", option), xbins.fN-1, xbins.fArray, ybins.fN-1, ybins.fArray); @@ -228,26 +249,26 @@ AliFMDParameters::Draw(Option_t* option) UInt_t ddl, addr; Double_t val = 0; switch (what) { - case kPulseGain: // Path to PulseGain calib object + case kLocalPulseGain: // Path to PulseGain calib object val = GetPulseGain(det,ring,sec,str); break; - case kThreshold: // Path to PulseGain calib object + case kLocalThreshold: // Path to PulseGain calib object val = GetThreshold(); break; - case kPedestal: // Path to Pedestal calib object + case kLocalPedestal: // Path to Pedestal calib object val = GetPedestal(det,ring,sec,str); break; - case kPedestalWidth: // Path to Pedestal calib object + case kLocalPedestalWidth: // Path to Pedestal calib object val = GetPedestalWidth(det,ring,sec,str); break; - case kDead: // Path to Dead calib object + case kLocalDead: // Path to Dead calib object val = IsDead(det,ring,sec,str); break; - case kSampleRate: // Path to SampleRate calib object + case kLocalSampleRate: // Path to SampleRate calib object val = GetSampleRate(det,ring,sec,str); break; - case kAltroMap: // Path to AltroMap calib object + case kLocalAltroMap: // Path to AltroMap calib object Detector2Hardware(det,ring,sec,str, ddl, addr); val = addr; break; - case kZeroSuppression: // Path to ZeroSuppression cal object + case kLocalZeroSuppression: // Path to ZeroSuppression cal object val = GetZeroSuppression(det,ring,sec,str); break; - case kMinStripRange: // Path to strip range cal object + case kLocalMinStripRange: // Path to strip range cal object val = GetMinStrip(det,ring,sec,str); break; - case kMaxStripRange: // Path to strip range cal object + case kLocalMaxStripRange: // Path to strip range cal object val = GetMaxStrip(det,ring,sec,str); break; } hist->Fill(idx,sec,val); @@ -434,18 +455,42 @@ AliFMDParameters::SetStripRange(UShort_t min, UShort_t max) fFixedMaxStrip = max; } +//__________________________________________________________________ +AliCDBEntry* +AliFMDParameters::GetEntry(const char* path, AliFMDPreprocessor* pp, + Bool_t fatal) const +{ + // Get an entry from the CDB or via preprocessor + AliCDBEntry* entry = 0; + if (!pp) { + AliCDBManager* cdb = AliCDBManager::Instance(); + entry = cdb->Get(path); + } + else { + const char* third = gSystem->BaseName(path); + const char* second = gSystem->BaseName(gSystem->DirName(path)); + entry = pp->GetFromCDB(second, third); + } + if (!entry) { + TString msg(Form("No %s found in CDB, perhaps you need to " + "use AliFMDCalibFaker?", path)); + if (fatal) { AliFatal(msg.Data()); } + else AliLog::Message(AliLog::kWarning, msg.Data(), "FMD", + "AliFMDParameters", "GetEntry", __FILE__, + __LINE__); + return 0; + } + return entry; +} + + //__________________________________________________________________ void -AliFMDParameters::InitPulseGain() +AliFMDParameters::InitPulseGain(AliFMDPreprocessor* pp) { // Get pulse gain from CDB or used fixed - AliCDBManager* cdb = AliCDBManager::Instance(); - AliCDBEntry* gain = cdb->Get(fgkPulseGain); - if (!gain) { - AliFatal(Form("No %s found in CDB, perhaps you need to " - "use AliFMDCalibFaker?", fgkPulseGain)); - return; - } + AliCDBEntry* gain = GetEntry(fgkPulseGain, pp); + if (!gain) return; AliFMDDebug(1, ("Got gain from CDB")); fPulseGain = dynamic_cast(gain->GetObject()); @@ -453,16 +498,12 @@ AliFMDParameters::InitPulseGain() } //__________________________________________________________________ void -AliFMDParameters::InitPedestal() +AliFMDParameters::InitPedestal(AliFMDPreprocessor* pp) { // Initialize the pedestals from CDB - AliCDBManager* cdb = AliCDBManager::Instance(); - AliCDBEntry* pedestal = cdb->Get(fgkPedestal); - if (!pedestal) { - AliFatal(Form("No %s found in CDB, perhaps you need to " - "use AliFMDCalibFaker?", fgkPedestal)); - return; - } + AliCDBEntry* pedestal = GetEntry(fgkPedestal, pp); + if (!pedestal) return; + AliFMDDebug(1, ("Got pedestal from CDB")); fPedestal = dynamic_cast(pedestal->GetObject()); if (!fPedestal) AliFatal("Invalid pedestal object from CDB"); @@ -470,16 +511,12 @@ AliFMDParameters::InitPedestal() //__________________________________________________________________ void -AliFMDParameters::InitDeadMap() +AliFMDParameters::InitDeadMap(AliFMDPreprocessor* pp) { // Get Dead-channel-map from CDB - AliCDBManager* cdb = AliCDBManager::Instance(); - AliCDBEntry* deadMap = cdb->Get(fgkDead); - if (!deadMap) { - AliFatal(Form("No %s found in CDB, perhaps you need to " - "use AliFMDCalibFaker?", fgkDead)); - return; - } + AliCDBEntry* deadMap = GetEntry(fgkDead, pp); + if (!deadMap) return; + AliFMDDebug(1, ("Got dead map from CDB")); fDeadMap = dynamic_cast(deadMap->GetObject()); if (!fDeadMap) AliFatal("Invalid dead map object from CDB"); @@ -487,16 +524,11 @@ AliFMDParameters::InitDeadMap() //__________________________________________________________________ void -AliFMDParameters::InitZeroSuppression() +AliFMDParameters::InitZeroSuppression(AliFMDPreprocessor* pp) { // Get 0-suppression from CDB - AliCDBManager* cdb = AliCDBManager::Instance(); - AliCDBEntry* zeroSup = cdb->Get(fgkZeroSuppression); - if (!zeroSup) { - AliFatal(Form("No %s found in CDB, perhaps you need to " - "use AliFMDCalibFaker?", fgkZeroSuppression)); - return; - } + AliCDBEntry* zeroSup = GetEntry(fgkZeroSuppression, pp); + if (!zeroSup) return; AliFMDDebug(1, ("Got zero suppression from CDB")); fZeroSuppression = dynamic_cast(zeroSup->GetObject()); @@ -505,16 +537,11 @@ AliFMDParameters::InitZeroSuppression() //__________________________________________________________________ void -AliFMDParameters::InitSampleRate() +AliFMDParameters::InitSampleRate(AliFMDPreprocessor* pp) { // get Sample rate from CDB - AliCDBManager* cdb = AliCDBManager::Instance(); - AliCDBEntry* sampRat = cdb->Get(fgkSampleRate); - if (!sampRat) { - AliFatal(Form("No %s found in CDB, perhaps you need to " - "use AliFMDCalibFaker?", fgkSampleRate)); - return; - } + AliCDBEntry* sampRat = GetEntry(fgkSampleRate, pp); + if (!sampRat) return; AliFMDDebug(1, ("Got zero suppression from CDB")); fSampleRate = dynamic_cast(sampRat->GetObject()); if (!fSampleRate) AliFatal("Invalid zero suppression object from CDB"); @@ -522,17 +549,16 @@ AliFMDParameters::InitSampleRate() //__________________________________________________________________ void -AliFMDParameters::InitAltroMap() +AliFMDParameters::InitAltroMap(AliFMDPreprocessor* pp) { // Get hardware mapping from CDB - AliCDBManager* cdb = AliCDBManager::Instance(); - AliCDBEntry* hwMap = cdb->Get(fgkAltroMap); - if (!hwMap) { - AliFatal(Form("No %s found in CDB, perhaps you need to " - "use AliFMDCalibFaker?", fgkAltroMap)); - fAltroMap = new AliFMDAltroMapping; - return; + if (fAltroMap) { + delete fAltroMap; + fAltroMap = 0; } + AliCDBEntry* hwMap = GetEntry(fgkAltroMap, pp, kFALSE); + if (!hwMap) return; + AliFMDDebug(1, ("Got ALTRO map from CDB")); fAltroMap = dynamic_cast(hwMap->GetObject()); if (!fAltroMap) { @@ -543,16 +569,11 @@ AliFMDParameters::InitAltroMap() //__________________________________________________________________ void -AliFMDParameters::InitStripRange() +AliFMDParameters::InitStripRange(AliFMDPreprocessor* pp) { // Get strips read-out from CDB - AliCDBManager* cdb = AliCDBManager::Instance(); - AliCDBEntry* range = cdb->Get(fgkStripRange); - if (!range) { - AliFatal(Form("No %s found in CDB, perhaps you need to " - "use AliFMDCalibFaker?", fgkStripRange)); - return; - } + AliCDBEntry* range = GetEntry(fgkStripRange, pp); + if (!range) return; AliFMDDebug(1, ("Got strip range from CDB")); fStripRange = dynamic_cast(range->GetObject()); if (!fStripRange) AliFatal("Invalid strip range object from CDB"); @@ -701,9 +722,20 @@ AliFMDParameters::GetAltroMap() const //__________________________________________________________________ Bool_t -AliFMDParameters::Hardware2Detector(UInt_t ddl, UInt_t addr, UShort_t& det, - Char_t& ring, UShort_t& sec, - UShort_t& str) const +AliFMDParameters::Hardware2Detector(UInt_t ddl, UInt_t board, + UInt_t chip, UInt_t chan, + UShort_t& det, Char_t& ring, + UShort_t& sec, UShort_t& str) const +{ + // Map hardware address to detector index + if (!fAltroMap) return kFALSE; + return fAltroMap->Hardware2Detector(ddl,board,chip,chan, det,ring,sec,str); +} +//__________________________________________________________________ +Bool_t +AliFMDParameters::Hardware2Detector(UInt_t ddl, UInt_t addr, + UShort_t& det, Char_t& ring, + UShort_t& sec, UShort_t& str) const { // Map hardware address to detector index if (!fAltroMap) return kFALSE; @@ -712,9 +744,21 @@ AliFMDParameters::Hardware2Detector(UInt_t ddl, UInt_t addr, UShort_t& det, //__________________________________________________________________ Bool_t -AliFMDParameters::Detector2Hardware(UShort_t det, Char_t ring, UShort_t sec, - UShort_t str, UInt_t& ddl, - UInt_t& addr) const +AliFMDParameters::Detector2Hardware(UShort_t det, Char_t ring, + UShort_t sec, UShort_t str, + UInt_t& ddl, UInt_t& board, + UInt_t& chip, UInt_t& chan) const +{ + // Map detector index to hardware address + if (!fAltroMap) return kFALSE; + return fAltroMap->Detector2Hardware(det,ring,sec,str, ddl,board,chip,chan); +} + +//__________________________________________________________________ +Bool_t +AliFMDParameters::Detector2Hardware(UShort_t det, Char_t ring, + UShort_t sec, UShort_t str, + UInt_t& ddl, UInt_t& addr) const { // Map detector index to hardware address if (!fAltroMap) return kFALSE;