|
//-------------------------------------------------------------------- // // BrTofCalibration is a BRAHMS data class providing storage and // access function for TOF specific calibration parameters. // Note that all the DB access work is done in the Baseclass. The user // code tells the Baseclass the name and element of the data // // Code inspired by FV's BrCalibrationParamsBB.cxx //-------------------------------------------------------------------- //-------------------------------------------------------------------- // // $Id: BrTofCalibration.cxx,v 1.13 2002/06/05 13:00:51 ouerdane Exp $ // $Author: ouerdane $ // $Date: 2002/06/05 13:00:51 $ // #ifndef WIN32 #include <iostream> #include <iomanip> #else #include <iostream.h> #include <iomanip.h> #endif #ifndef BRAT_BrTofCalibration #include "BrTofCalibration.h" #endif #ifndef ROOT_TString #include "TString.h" #endif #ifndef BRAT_BrParameterDbManager #include "BrParameterDbManager.h" #endif #ifndef BRAT_BrDetectorParamsTof #include "BrDetectorParamsTof.h" #endif ClassImp(BrTofCalibration); BrTofCalibration::BrTofCalibration() { // Constructor. Set counter and list data members to zero. // Don't use this constructor unless you have to and know // what you are doing // Use BrCalibrationParams(Char_t, Char_t ) instead } //_________________________________________________________________________ BrTofCalibration::BrTofCalibration(Char_t *name, Char_t *title) : BrCalibration(name, title) { // Standard constructor. // the name should be that of the associated detector e.g. "TOF1" // Create the Db Objects needed for the specific tables. // Beware difference between constructor and Init. AddParameterData("topPedestal", &fTopPedestal); AddParameterData("topPedestalWidth", &fTopPedestalWidth); AddParameterData("botPedestal", &fBotPedestal); AddParameterData("botPedestalWidth", &fBotPedestalWidth); if (strcmp(GetName(), "TOFWCal") && strcmp(GetName(), "H1Cal")) { AddParameterData("topAdcGain", &fTopAdcGain); AddParameterData("topTdcGain", &fTopTdcGain); AddParameterData("topTdcOffset", &fTopTdcOffset); AddParameterData("topSlewPar1", &fTopSlewPar1); AddParameterData("topSlewPar2", &fTopSlewPar2); AddParameterData("botAdcGain", &fBotAdcGain); AddParameterData("botTdcGain", &fBotTdcGain); AddParameterData("botTdcOffset", &fBotTdcOffset); AddParameterData("botSlewPar1", &fBotSlewPar1); AddParameterData("botSlewPar2", &fBotSlewPar2); AddParameterData("timeOffset", &fTimeOffset); AddParameterData("deltaDelay", &fDeltaDelay); AddParameterData("effSpeedOfLight", &fEffSpeedOfLight); } if(!strcmp(GetName(), "TD1") || !strcmp(GetName(),"TMrsF") || !strcmp(GetName(),"TMrsB") ){ AddParameterData("topGap", &fTopAdcGap); AddParameterData("topGapStart", &fTopAdcGapStart); AddParameterData("botGap", &fBotAdcGap); AddParameterData("botGapStart", &fBotAdcGapStart); } BrParameterDbManager* parMan = BrParameterDbManager::Instance(); fParamsTof = (BrDetectorParamsTof*)parMan-> GetDetectorParameters("BrDetectorParamsTof", GetName()); } //_________________________________________________________________________ BrTofCalibration::~BrTofCalibration() { // Default destructor // } // // For each Table setup in the constructor via the AddParameterData // an access method must be declared (in the .h files) and defined // (here in the .cxx file). The fAccesMode test guarentees that the array has // been setup, but does not make an index check. It is assumed the usercode // knows how many data each calibration has (to make coding effecient) // /* //_____________________________________________________________________________ Int_t BrTofCalibration::GetAccessMode(const Char_t* par) const { // get the accessmode of the parameter data TString s(par); Int_t mode = 0; if (s == "topPedestal") mode = fTopPedestal.fAccessMode; if (s == "topPedestalWidth") mode = fTopPedestalWidth.fAccessMode; if (s == "topAdcGain") mode = fTopAdcGain.fAccessMode; if (s == "topTdcGain") mode = fTopTdcGain.fAccessMode; if (s == "topTdcOffset") mode = fTopTdcOffset.fAccessMode; if (s == "topSlewPar1") mode = fTopSlewPar1.fAccessMode; if (s == "topSlewPar2") mode = fTopSlewPar2.fAccessMode; if (s == "botPedestal") mode = fBotPedestal.fAccessMode; if (s == "botPedestalWidth") mode = fBotPedestalWidth.fAccessMode; if (s == "botAdcGain") mode = fBotAdcGain.fAccessMode; if (s == "botTdcGain") mode = fBotTdcGain.fAccessMode; if (s == "botTdcOffset") mode = fBotTdcOffset.fAccessMode; if (s == "botSlewPar1") mode = fBotSlewPar1.fAccessMode; if (s == "botSlewPar2") mode = fBotSlewPar2.fAccessMode; if (s == "timeOffset") mode = fTimeOffset.fAccessMode; if (s == "deltaDelay") mode = fDeltaDelay.fAccessMode; if (s == "effSpeedOfLight") mode = fEffSpeedOfLight.fAccessMode; return mode; } */ //_____________________________________________________________________________ void BrTofCalibration::SetTopPedestal(Int_t slat, Float_t value) { CheckSlat(slat); if (fSlatOutOfBound) return; if(fTopPedestal.fAccessMode){ Float_t* array = (Float_t*)fTopPedestal.fRevision->GetArray(); array[slat-1]= value; } } //_____________________________________________________________________________ void BrTofCalibration::SetTopPedestalWidth(Int_t slat, Float_t value) { CheckSlat(slat); if (fSlatOutOfBound) return; if(fTopPedestalWidth.fAccessMode){ Float_t* array = (Float_t*)fTopPedestalWidth.fRevision->GetArray(); array[slat-1]= value; } } //_____________________________________________________________________________ void BrTofCalibration::SetTopAdcGain(Int_t slat, Float_t value) { CheckSlat(slat); if (fSlatOutOfBound) return; if(fTopAdcGain.fAccessMode){ Float_t* array = (Float_t*)fTopAdcGain.fRevision->GetArray(); array[slat-1]= value; } } //_____________________________________________________________________________ void BrTofCalibration::SetTopAdcGap(Int_t slat, Float_t value) { CheckSlat(slat); if (fSlatOutOfBound) return; if(fTopAdcGap.fAccessMode){ Float_t* array = (Float_t*)fTopAdcGap.fRevision->GetArray(); array[slat-1]= value; } } //_____________________________________________________________________________ void BrTofCalibration::SetTopAdcGapStart(Int_t slat, Float_t value) { CheckSlat(slat); if (fSlatOutOfBound) return; if(fTopAdcGapStart.fAccessMode){ Float_t* array = (Float_t*)fTopAdcGapStart.fRevision->GetArray(); array[slat-1]= value; } } //_____________________________________________________________________________ void BrTofCalibration::SetTopTdcGain(Int_t slat, Float_t value) { CheckSlat(slat); if (fSlatOutOfBound) return; if(fTopTdcGain.fAccessMode){ Float_t* array = (Float_t*)fTopTdcGain.fRevision->GetArray(); array[slat-1]= value; } } //_____________________________________________________________________________ void BrTofCalibration::SetTopTdcOffset(Int_t slat, Float_t value) { CheckSlat(slat); if (fSlatOutOfBound) return; if(fTopTdcOffset.fAccessMode){ Float_t* array = (Float_t*)fTopTdcOffset.fRevision->GetArray(); array[slat-1]= value; } } //_____________________________________________________________________________ void BrTofCalibration::SetDeltaDelay(Int_t slat, Float_t value) { CheckSlat(slat); if (fSlatOutOfBound) return; if(fDeltaDelay.fAccessMode){ Float_t* array = (Float_t*)fDeltaDelay.fRevision->GetArray(); array[slat-1]= value; } } //_____________________________________________________________________________ void BrTofCalibration::SetTopSlewPar1(Int_t slat, Float_t value) { CheckSlat(slat); if (fSlatOutOfBound) return; if(fTopSlewPar1.fAccessMode){ Float_t* array = (Float_t*)fTopSlewPar1.fRevision->GetArray(); array[slat-1]= value; } } //_____________________________________________________________________________ void BrTofCalibration::SetTopSlewPar2(Int_t slat, Float_t value) { CheckSlat(slat); if (fSlatOutOfBound) return; if(fTopSlewPar2.fAccessMode){ Float_t* array = (Float_t*)fTopSlewPar2.fRevision->GetArray(); array[slat-1]= value; } } //_____________________________________________________________________________ void BrTofCalibration::SetEffSpeedOfLight(Int_t slat, Float_t value) { CheckSlat(slat); if (fSlatOutOfBound) return; if(fEffSpeedOfLight.fAccessMode){ Float_t* array = (Float_t*)fEffSpeedOfLight.fRevision->GetArray(); array[slat-1]= value; } } //_____________________________________________________________________________ void BrTofCalibration::SetTimeOffset(Int_t slat, Float_t value) { CheckSlat(slat); if (fSlatOutOfBound) return; if(fTimeOffset.fAccessMode){ Float_t* array = (Float_t*)fTimeOffset.fRevision->GetArray(); array[slat-1]= value; } } //_____________________________________________________________________________ Float_t BrTofCalibration::GetTopPedestal(Int_t slat) const { CheckSlat(slat); if (fSlatOutOfBound) return 0; if(fTopPedestal.fAccessMode ) return ((Float_t*) fTopPedestal.fRevision->GetArray())[slat-1] ; else return 0; } //_____________________________________________________________________________ Float_t BrTofCalibration::GetTopPedestalWidth(Int_t slat) const { CheckSlat(slat); if (fSlatOutOfBound) return 0; if(fTopPedestalWidth.fAccessMode ) return ((Float_t*) fTopPedestalWidth.fRevision->GetArray())[slat-1] ; else return 0; } //_____________________________________________________________________________ Float_t BrTofCalibration::GetTopAdcGain(Int_t slat) const { CheckSlat(slat); if (fSlatOutOfBound) return 0; if(fTopAdcGain.fAccessMode ) return ((Float_t*) fTopAdcGain.fRevision->GetArray())[slat-1] ; else return 0; } //_____________________________________________________________________________ Float_t BrTofCalibration::GetTopAdcGap(Int_t slat) const { CheckSlat(slat); if (fSlatOutOfBound) return 0; if(fTopAdcGap.fAccessMode ) return ((Float_t*) fTopAdcGap.fRevision->GetArray())[slat-1] ; else return 0; } //_____________________________________________________________________________ Float_t BrTofCalibration::GetTopAdcGapStart(Int_t slat) const { CheckSlat(slat); if (fSlatOutOfBound) return 0; if(fTopAdcGapStart.fAccessMode ) return ((Float_t*) fTopAdcGapStart.fRevision->GetArray())[slat-1] ; else return 0; } //_____________________________________________________________________________ Float_t BrTofCalibration::GetTopTdcGain(Int_t slat) const { CheckSlat(slat); if (fSlatOutOfBound) return 0; if(fTopTdcGain.fAccessMode ) return ((Float_t*) fTopTdcGain.fRevision->GetArray())[slat-1] ; else return 0; } //_____________________________________________________________________________ Float_t BrTofCalibration::GetTopTdcOffset(Int_t slat) const { CheckSlat(slat); if (fSlatOutOfBound) return 0; if(fTopTdcOffset.fAccessMode ) return ((Float_t*) fTopTdcOffset.fRevision->GetArray())[slat-1] ; else return 0; } //_____________________________________________________________________________ Float_t BrTofCalibration::GetDeltaDelay(Int_t slat) const { CheckSlat(slat); if (fSlatOutOfBound) return 0; if(fDeltaDelay.fAccessMode ) return ((Float_t*) fDeltaDelay.fRevision->GetArray())[slat-1] ; else return 0; } //_____________________________________________________________________________ Float_t BrTofCalibration::GetEffSpeedOfLight(Int_t slat) const { CheckSlat(slat); if (fSlatOutOfBound) return 0; if(fEffSpeedOfLight.fAccessMode ) return ((Float_t*) fEffSpeedOfLight.fRevision->GetArray())[slat-1] ; else return 0; } //_____________________________________________________________________________ Float_t BrTofCalibration::GetTimeOffset(Int_t slat) const { CheckSlat(slat); if (fSlatOutOfBound) return 0; if(fTimeOffset.fAccessMode ) return ((Float_t*) fTimeOffset.fRevision->GetArray())[slat-1] ; else return 0; } //_____________________________________________________________________________ Float_t BrTofCalibration::GetTopSlewPar1(Int_t slat) const { CheckSlat(slat); if (fSlatOutOfBound) return 0; if(fTopSlewPar1.fAccessMode ) return ((Float_t*) fTopSlewPar1.fRevision->GetArray())[slat-1] ; else return 0; } //_____________________________________________________________________________ Float_t BrTofCalibration::GetTopSlewPar2(Int_t slat) const { CheckSlat(slat); if (fSlatOutOfBound) return 0; if(fTopSlewPar2.fAccessMode ) return ((Float_t*) fTopSlewPar2.fRevision->GetArray())[slat-1] ; else return 0; } //_____________________________________________________________________________ //_____________________________________________________________________________ /// /// Bottom slats void BrTofCalibration::SetBotPedestal(Int_t slat, Float_t value) { CheckSlat(slat); if (fSlatOutOfBound) return; if(fBotPedestal.fAccessMode){ Float_t* array = (Float_t*)fBotPedestal.fRevision->GetArray(); array[slat-1]= value; } } //_____________________________________________________________________________ void BrTofCalibration::SetBotPedestalWidth(Int_t slat, Float_t value) { CheckSlat(slat); if (fSlatOutOfBound) return; if(fBotPedestalWidth.fAccessMode){ Float_t* array = (Float_t*)fBotPedestalWidth.fRevision->GetArray(); array[slat-1]= value; } } //_____________________________________________________________________________ void BrTofCalibration::SetBotAdcGain(Int_t slat, Float_t value) { CheckSlat(slat); if (fSlatOutOfBound) return; if(fBotAdcGain.fAccessMode){ Float_t* array = (Float_t*)fBotAdcGain.fRevision->GetArray(); array[slat-1]= value; } } //_____________________________________________________________________________ void BrTofCalibration::SetBotAdcGap(Int_t slat, Float_t value) { CheckSlat(slat); if (fSlatOutOfBound) return; if(fBotAdcGap.fAccessMode){ Float_t* array = (Float_t*)fBotAdcGap.fRevision->GetArray(); array[slat-1]= value; } } //_____________________________________________________________________________ void BrTofCalibration::SetBotAdcGapStart(Int_t slat, Float_t value) { CheckSlat(slat); if (fSlatOutOfBound) return; if(fBotAdcGapStart.fAccessMode){ Float_t* array = (Float_t*)fBotAdcGapStart.fRevision->GetArray(); array[slat-1]= value; } } //_____________________________________________________________________________ void BrTofCalibration::SetBotTdcGain(Int_t slat, Float_t value) { CheckSlat(slat); if (fSlatOutOfBound) return; if(fBotTdcGain.fAccessMode){ Float_t* array = (Float_t*)fBotTdcGain.fRevision->GetArray(); array[slat-1]= value; } } //_____________________________________________________________________________ void BrTofCalibration::SetBotTdcOffset(Int_t slat, Float_t value) { CheckSlat(slat); if (fSlatOutOfBound) return; if(fBotTdcOffset.fAccessMode){ Float_t* array = (Float_t*)fBotTdcOffset.fRevision->GetArray(); array[slat-1]= value; } } //_____________________________________________________________________________ void BrTofCalibration::SetBotSlewPar1(Int_t slat, Float_t value) { CheckSlat(slat); if (fSlatOutOfBound) return; if(fBotSlewPar1.fAccessMode){ Float_t* array = (Float_t*)fBotSlewPar1.fRevision->GetArray(); array[slat-1]= value; } } //_____________________________________________________________________________ void BrTofCalibration::SetBotSlewPar2(Int_t slat, Float_t value) { CheckSlat(slat); if (fSlatOutOfBound) return; if(fBotSlewPar2.fAccessMode){ Float_t* array = (Float_t*)fBotSlewPar2.fRevision->GetArray(); array[slat-1]= value; } } // getters //_____________________________________________________________________________ Float_t BrTofCalibration::GetBotPedestal(Int_t slat) const { CheckSlat(slat); if (fSlatOutOfBound) return 0; if(fBotPedestal.fAccessMode ) return ((Float_t*) fBotPedestal.fRevision->GetArray())[slat-1] ; else return 0; } //_____________________________________________________________________________ Float_t BrTofCalibration::GetBotPedestalWidth(Int_t slat) const { CheckSlat(slat); if (fSlatOutOfBound) return 0; if(fBotPedestalWidth.fAccessMode ) return ((Float_t*) fBotPedestalWidth.fRevision->GetArray())[slat-1] ; else return 0; } //_____________________________________________________________________________ Float_t BrTofCalibration::GetBotAdcGain(Int_t slat) const { CheckSlat(slat); if (fSlatOutOfBound) return 0; if(fBotAdcGain.fAccessMode ) return ((Float_t*) fBotAdcGain.fRevision->GetArray())[slat-1] ; else return 0; } //_____________________________________________________________________________ Float_t BrTofCalibration::GetBotAdcGap(Int_t slat) const { CheckSlat(slat); if (fSlatOutOfBound) return 0; if(fBotAdcGap.fAccessMode ) return ((Float_t*) fBotAdcGap.fRevision->GetArray())[slat-1] ; else return 0; } //_____________________________________________________________________________ Float_t BrTofCalibration::GetBotAdcGapStart(Int_t slat) const { CheckSlat(slat); if (fSlatOutOfBound) return 0; if(fBotAdcGapStart.fAccessMode ) return ((Float_t*) fBotAdcGapStart.fRevision->GetArray())[slat-1] ; else return 0; } //_____________________________________________________________________________ Float_t BrTofCalibration::GetBotTdcGain(Int_t slat) const { CheckSlat(slat); if (fSlatOutOfBound) return 0; if(fBotTdcGain.fAccessMode ) return ((Float_t*) fBotTdcGain.fRevision->GetArray())[slat-1] ; else return 0; } //_____________________________________________________________________________ Float_t BrTofCalibration::GetBotTdcOffset(Int_t slat) const { CheckSlat(slat); if (fSlatOutOfBound) return 0; if(fBotTdcOffset.fAccessMode ) return ((Float_t*) fBotTdcOffset.fRevision->GetArray())[slat-1] ; else return 0; } //_____________________________________________________________________________ Float_t BrTofCalibration::GetBotSlewPar1(Int_t slat) const { CheckSlat(slat); if (fSlatOutOfBound) return 0; if(fBotSlewPar1.fAccessMode ) return ((Float_t*) fBotSlewPar1.fRevision->GetArray())[slat-1] ; else return 0; } //_____________________________________________________________________________ Float_t BrTofCalibration::GetBotSlewPar2(Int_t slat) const { CheckSlat(slat); if (fSlatOutOfBound) return 0; if(fBotSlewPar2.fAccessMode ) return ((Float_t*) fBotSlewPar2.fRevision->GetArray())[slat-1] ; else return 0; } //_____________________________________________________________________________ void BrTofCalibration::CheckSlat(Int_t slat) const { fSlatOutOfBound = kFALSE; if (slat < 1 || slat > fParamsTof->GetNoSlats()) { cerr << GetName() << " slat number " << slat << " is out of bound" << endl; fSlatOutOfBound = kTRUE; } } //_____________________________________________________________________________ Bool_t BrTofCalibration::ValidCalibration(Int_t slat) { CheckSlat(slat); if (fSlatOutOfBound) return kFALSE; if(strcmp(GetName(),"TD1")){ if (GetBotPedestal(slat) == kCalException || GetTopPedestal(slat) == kCalException || GetBotAdcGain(slat) == kCalException || GetTopAdcGain(slat) == kCalException || GetBotTdcGain(slat) == kCalException || GetTopAdcGain(slat) == kCalException || GetTimeOffset(slat) == kCalException || // GetTopSlewPar1(slat) == kCalException || // GetTopSlewPar2(slat) == kCalException || // GetBotSlewPar1(slat) == kCalException || // GetBotSlewPar2(slat) == kCalException || GetDeltaDelay(slat) == kCalException || GetEffSpeedOfLight(slat) == kCalException ) // ignore slewing for now return kFALSE; } else { if (GetBotPedestal(slat) == kCalException || GetTopPedestal(slat) == kCalException || GetBotAdcGain(slat) == kCalException || GetTopAdcGain(slat) == kCalException || GetBotTdcGain(slat) == kCalException || GetTopAdcGain(slat) == kCalException ) return kFALSE; } return kTRUE; } //--------------------------------------------------------------- // // $Log: BrTofCalibration.cxx,v $ // Revision 1.13 2002/06/05 13:00:51 ouerdane // fixed small error in names in access mode checking // // Revision 1.12 2002/04/02 19:46:05 videbaek // Add Gap selection for TMrsF and TMrsB // // Revision 1.11 2002/03/20 19:27:31 videbaek // Add AdcGap and AdcGapStart for calibration class. This is used for TD1 // (and TMRS ) only. It is discarded in code for other TOF cases. // // Revision 1.10 2001/11/12 15:25:41 ouerdane // corrected method ValidCalibration // // Revision 1.9 2001/11/12 14:57:06 ouerdane // added parameter timeOffset and updated version number to 4 // // Revision 1.8 2001/11/05 06:48:52 ouerdane // added check of tdc offsets // // Revision 1.7 2001/10/23 20:49:02 ouerdane // Added H1Cal and TOFW Cal for pedestals only // // Revision 1.6 2001/10/08 10:27:31 cholm // Changed detector calibration data classes to derive from BrCalibration, // rather than BrParameterElement, since that has been replaced. Impact // on various modules, and so on. Some user code may need to be changed to. // // Revision 1.5 2001/10/02 01:45:55 ouerdane // Added method GetAccessMode to know in cal modules which mode the parameter is set to // // Revision 1.4 2001/07/31 09:09:08 ouerdane // Made Getters const, member fSlatOutOfBound mutable and non persistent // Changed class version number to 3 // // Revision 1.3 2001/07/01 12:04:15 cholm // Moved RevisionExists from this class to BrParameterElemenent (see also // that class' implementation files log message), and merge some // conflicts. Class version was bumped to 2 - this is important when you // change the data members. With ROOT 3 schema evolution that is // fortunately the only thing one has to do :-) // // Revision 1.3 2001/06/21 12:11:32 ouerdane // Changed name of a method (SlatIsCalibrated is now ValidCalibration) // This method checks if one the calibration parameters is // equal to BrTofCalibration::kCalException. If so, ignore slat // for recontruction in BrTofRdoModule // // Revision 1.2 2001/06/20 08:51:41 ouerdane // Corrected a parameter name (effective speed of ligt) // // Revision 1.1 2001/06/19 12:46:30 ouerdane // Added calibration classes and reconstruction classes. // Brat compiles but these classes haven't been tested in this // context. Be careful if you use them before I (DO) check if // all is ok. // // Note: some classes are still not included (BrTofSlewingModule, // BrTofCscintCalModule, BrTofTdcOffsetModule). Will do that after // Brat2 is available // // Revision 1.6 2001/06/06 15:37:50 ouerdane // added parameter timeOffset, corresponding setters and getters // // Revision 1.5 2001/06/05 19:12:05 ouerdane // Removed inclusion of header file BrDbInc.h // // Revision 1.4 2001/05/31 22:07:55 ouerdane // removed const from getters // // Revision 1.3 2001/05/31 21:36:37 ouerdane // Bug fixes in Getters and Setters (to check if the slat number if out of bound) // // Revision 1.2 2001/05/31 18:48:24 ouerdane // Added a public method Bool_t RevisionExists(Char_t*) // The user can check if a revision definitely exists in the // database by calling this method (use the paramater name as argument) // // Revision 1.1 2001/05/30 17:20:37 ouerdane // The TOF detector calibration package is released! // To have all kind of details about it, please consult the README file. // For trouble-shooting, bugs, comments, send email to ouerdane@nbi.dk // or brahms-tof-l@bnl.gov // Enjoy! // |
||||||
This page automatically generated by script docBrat by Christian Holm |
Copyright ; 2002 BRAHMS Collaboration
<brahmlib@rcf.rhic.bnl.gov>
|