From: cvetan Date: Fri, 12 Oct 2007 14:35:29 +0000 (+0000) Subject: AliDCSSensor: Updated Eval method to return first/last value of fit if specified... X-Git-Url: http://git.uio.no/git/?p=u%2Fmrichter%2FAliRoot.git;a=commitdiff_plain;h=67a165ed541d2da2e70a099e742a014422a47b4e AliDCSSensor: Updated Eval method to return first/last value of fit if specified time is outside fit period. AliDCSSensorArray: Added function to report how many detectors where a succesful fit was made. AliTPCSensorTemp, AliTPCSensorTempArray: Entered possibility to configure Amanda string for temperature parameters. AliTPCPreprocessor: Corrected Amanda string for temperature DCS maps. Corrections to meet requirements from failover tests. (Haavard) --- diff --git a/STEER/AliDCSSensor.cxx b/STEER/AliDCSSensor.cxx index 98b04823bfb..378ff071e06 100644 --- a/STEER/AliDCSSensor.cxx +++ b/STEER/AliDCSSensor.cxx @@ -25,8 +25,6 @@ #include "AliDCSSensor.h" ClassImp(AliDCSSensor) -const Double_t kSmall = -9e99; // invalid small value -const Double_t kLarge = 9e99; // invalid large value const Double_t kSecInHour = 3600.; // seconds in one hour @@ -82,7 +80,8 @@ Double_t AliDCSSensor::GetValue(UInt_t timeSec) // Get temperature value for actual sensor // timeSec given as offset from start-of-run measured in seconds // - return Eval(TTimeStamp(fStartTime+timeSec)); + Bool_t inside; + return Eval(TTimeStamp(fStartTime+timeSec),inside); } //_____________________________________________________________________________ Double_t AliDCSSensor::GetValue(TTimeStamp time) @@ -90,29 +89,37 @@ Double_t AliDCSSensor::GetValue(TTimeStamp time) // Get temperature value for actual sensor // time given as absolute TTimeStamp // - return Eval(time); + Bool_t inside; + return Eval(time, inside); } //_____________________________________________________________________________ -Double_t AliDCSSensor::Eval(const TTimeStamp& time) const +Double_t AliDCSSensor::Eval(const TTimeStamp& time, Bool_t inside) const { // // Return temperature at given time - // If time < start of map return kSmall - // If time > end of map return kLarge + // If time < start of map return value at start of map, inside = false + // If time > end of map return value at end of map, inside = false UInt_t timeSec = time.GetSec(); UInt_t diff = timeSec-fStartTime; + inside = true; - if ( timeSec < fStartTime ) return kSmall; - if ( timeSec > fEndTime ) return kLarge; + if ( timeSec < fStartTime ) { + inside=false; + diff=0; + } + if ( timeSec > fEndTime ) { + inside=false; + diff = fEndTime-fStartTime; + } Double_t timeHour = diff/kSecInHour; if ( fFit ) { return fFit->Eval(timeHour); } else { - return kSmall; + return -99; } } diff --git a/STEER/AliDCSSensor.h b/STEER/AliDCSSensor.h index 09b3a9263a9..e7f3a91f6e3 100644 --- a/STEER/AliDCSSensor.h +++ b/STEER/AliDCSSensor.h @@ -67,7 +67,7 @@ public: void SetEndTime (TTimeStamp time) {fEndTime = time.GetSec(); } Double_t GetValue(UInt_t timeSec); Double_t GetValue(TTimeStamp time); - Double_t Eval(const TTimeStamp& time) const; + Double_t Eval(const TTimeStamp& time, Bool_t inside=true) const; TGraph *MakeGraph (Int_t nPoints=100) const; static TClonesArray * ReadTree(TTree *tree); diff --git a/STEER/AliDCSSensorArray.cxx b/STEER/AliDCSSensorArray.cxx index 03ed5fda796..661cbb6540d 100644 --- a/STEER/AliDCSSensorArray.cxx +++ b/STEER/AliDCSSensorArray.cxx @@ -47,7 +47,7 @@ AliDCSSensorArray::AliDCSSensorArray():TNamed(), } //_____________________________________________________________________________ -AliDCSSensorArray::AliDCSSensorArray(TClonesArray *arr):TNamed(), +AliDCSSensorArray::AliDCSSensorArray(TClonesArray *arr):TNamed(), fMinGraph(10), fMinPoints(10), fIter(10), @@ -65,7 +65,7 @@ AliDCSSensorArray::AliDCSSensorArray(TClonesArray *arr):TNamed(), } //_____________________________________________________________________________ -AliDCSSensorArray::AliDCSSensorArray(Int_t run, const char* dbEntry) : +AliDCSSensorArray::AliDCSSensorArray(Int_t run, const char* dbEntry) : TNamed(), fMinGraph(10), fMinPoints(10), @@ -81,8 +81,8 @@ AliDCSSensorArray::AliDCSSensorArray(Int_t run, const char* dbEntry) : // // Read configuration from OCDB // - - AliCDBEntry *entry = AliCDBManager::Instance()->Get(dbEntry,run); + + AliCDBEntry *entry = AliCDBManager::Instance()->Get(dbEntry,run); TTree *tree = (TTree*) entry->GetObject(); fSensors = AliDCSSensor::ReadTree(tree); } @@ -103,7 +103,7 @@ AliDCSSensorArray::AliDCSSensorArray(UInt_t startTime, UInt_t endTime, { // - // AliDCSSensorArray constructor for Shuttle preprocessor + // AliDCSSensorArray constructor for Shuttle preprocessor // (confTree read from OCDB) // fSensors = AliDCSSensor::ReadTree(confTree); @@ -132,8 +132,7 @@ AliDCSSensorArray::AliDCSSensorArray(const AliDCSSensorArray &c):TNamed(c), // AliDCSSensorArray copy constructor // - ((AliDCSSensorArray &) c).Copy(*this); - + fSensors = (TClonesArray*)c.fSensors->Clone(); } ///_____________________________________________________________________________ @@ -153,22 +152,16 @@ AliDCSSensorArray &AliDCSSensorArray::operator=(const AliDCSSensorArray &c) // // Assignment operator // - - if (this != &c) ((AliDCSSensorArray &) c).Copy(*this); + if (this != &c) { + fSensors->Delete(); + new (this) AliDCSSensorArray(c); + fSensors = (TClonesArray*)c.fSensors->Clone(); + } return *this; - } -//_____________________________________________________________________________ -void AliDCSSensorArray::Copy(TObject &c) const -{ - // - // Copy function - // +//____________________________________________________________________________ - TObject::Copy(c); -} -//_____________________________________________________________________________ void AliDCSSensorArray::SetGraph(TMap *map) { // @@ -220,7 +213,20 @@ void AliDCSSensorArray::MakeSplineFit(TMap *map, Bool_t keepMap) } } - +//_____________________________________________________________________________ +Int_t AliDCSSensorArray::NumFits() const +{ + // + // Return number of sensors where a succesful fit has been made + // + Int_t nfit=0; + Int_t nsensors = fSensors->GetEntries(); + for ( Int_t isensor=0; isensorAt(isensor); + if (entry->GetFit()) nfit++; + } + return nfit; +} //_____________________________________________________________________________ Double_t AliDCSSensorArray::GetValue(UInt_t timeSec, Int_t sensor) { diff --git a/STEER/AliDCSSensorArray.h b/STEER/AliDCSSensorArray.h index 2cbbe1152e4..544ae17a4ef 100644 --- a/STEER/AliDCSSensorArray.h +++ b/STEER/AliDCSSensorArray.h @@ -31,7 +31,6 @@ class AliDCSSensorArray : public TNamed { AliDCSSensorArray(const AliDCSSensorArray &c); virtual ~AliDCSSensorArray(); AliDCSSensorArray &operator=(const AliDCSSensorArray &c); - virtual void Copy (TObject &c) const; void SetStartTime (const TTimeStamp& start) { fStartTime = start; } void SetEndTime (const TTimeStamp& end) { fEndTime = end; } TTimeStamp GetStartTime () const { return fStartTime; } @@ -65,10 +64,12 @@ class AliDCSSensorArray : public TNamed { void RemoveSensorNum(Int_t ind); void RemoveSensor(Int_t IdDCS); Int_t NumSensors() const { return fSensors->GetEntries(); } + Int_t NumFits() const; Int_t GetFirstIdDCS() const; Int_t GetLastIdDCS() const; + protected: Int_t fMinGraph; // minimum #points of graph to be fitted Int_t fMinPoints; // minimum number of points per knot in fit @@ -81,6 +82,8 @@ class AliDCSSensorArray : public TNamed { TTimeStamp fEndTime; // end time for measurements in this entry TClonesArray *fSensors; // Array of sensors + + ClassDef(AliDCSSensorArray,3) // TPC calibration class for parameters which are saved per pad }; diff --git a/TPC/AliTPCPreprocessor.cxx b/TPC/AliTPCPreprocessor.cxx index acb9473fc13..613aa29e3da 100644 --- a/TPC/AliTPCPreprocessor.cxx +++ b/TPC/AliTPCPreprocessor.cxx @@ -37,6 +37,8 @@ const Int_t kValCutTemp = 100; // discard temperatures > 100 degre const Int_t kDiffCutTemp = 5; // discard temperature differences > 5 degrees const TString kPedestalRunType = "PEDESTAL_RUN"; // pedestal run identifier const TString kPulserRunType = "PULSER_RUN"; // pulser run identifier +const TString kAmandaTemp = "tpc_PT_%d.Temperature"; // Amanda string for temperature entries +const Double_t kFitFraction = 0.7; // Fraction of DCS sensor fits required // // This class is the SHUTTLE preprocessor for the TPC detector. @@ -49,7 +51,7 @@ ClassImp(AliTPCPreprocessor) //______________________________________________________________________________________________ AliTPCPreprocessor::AliTPCPreprocessor(AliShuttleInterface* shuttle) : AliPreprocessor("TPC",shuttle), - fConfEnv(0), fTemp(0), fPressure(0), fConfigOK(kTRUE), fROC(0) + fConfEnv(0), fTemp(0), fConfigOK(kTRUE), fROC(0) { // constructor fROC = AliTPCROC::Instance(); @@ -57,7 +59,7 @@ AliTPCPreprocessor::AliTPCPreprocessor(AliShuttleInterface* shuttle) : //______________________________________________________________________________________________ // AliTPCPreprocessor::AliTPCPreprocessor(const AliTPCPreprocessor& org) : // AliPreprocessor(org), -// fConfEnv(0), fTemp(0), fPressure(0), fConfigOK(kTRUE) +// fConfEnv(0), fTemp(0), fConfigOK(kTRUE) // { // // copy constructor not implemented // // -- missing underlying copy constructor in AliPreprocessor @@ -73,7 +75,6 @@ AliTPCPreprocessor::~AliTPCPreprocessor() // destructor delete fTemp; - delete fPressure; } //______________________________________________________________________________________________ AliTPCPreprocessor& AliTPCPreprocessor::operator = (const AliTPCPreprocessor& ) @@ -115,22 +116,10 @@ void AliTPCPreprocessor::Initialize(Int_t run, UInt_t startTime, fConfigOK = kFALSE; return; } - fTemp = new AliTPCSensorTempArray(fStartTime, fEndTime, confTree); + fTemp = new AliTPCSensorTempArray(fStartTime, fEndTime, confTree, kAmandaTemp); fTemp->SetValCut(kValCutTemp); fTemp->SetDiffCut(kDiffCutTemp); - // Pressure sensors - - confTree=0; - entry=0; - entry = GetFromOCDB("Config", "Pressure"); - if (entry) confTree = (TTree*) entry->GetObject(); - if ( confTree==0 ) { - Log("AliTPCPreprocsessor: Pressure Config OCDB entry missing.\n"); - fConfigOK = kFALSE; - return; - } - fPressure = new AliDCSSensorArray(fStartTime, fEndTime, confTree); } @@ -153,10 +142,6 @@ UInt_t AliTPCPreprocessor::Process(TMap* dcsAliasMap) UInt_t tempResult = MapTemperature(dcsAliasMap); UInt_t result=tempResult; - // Pressure sensors - - UInt_t pressureResult = MapPressure(dcsAliasMap); - result += pressureResult; // Other calibration information will be retrieved through FXS files // examples: @@ -217,9 +202,15 @@ UInt_t AliTPCPreprocessor::MapTemperature(TMap* dcsAliasMap) TMap *map = fTemp->ExtractDCS(dcsAliasMap); if (map) { fTemp->MakeSplineFit(map); - AliInfo(Form("Temperature values extracted, fits performed.\n")); + Double_t fitFraction = fTemp->NumFits()/fTemp->NumSensors(); + if (fitFraction > kFitFraction ) { + AliInfo(Form("Temperature values extracted, fits performed.\n")); + } else { + Log ("Too few temperature maps fitted. \n"); + result = 9; + } } else { - Log("AliTPCPreprocsessor: no temperature map extracted. \n"); + Log("No temperature map extracted. \n"); result=9; } delete map; @@ -239,39 +230,6 @@ UInt_t AliTPCPreprocessor::MapTemperature(TMap* dcsAliasMap) return result; } -//______________________________________________________________________________________________ - -UInt_t AliTPCPreprocessor::MapPressure(TMap* dcsAliasMap) -{ - - // extract DCS temperature maps. Perform fits to save space - - UInt_t result=0; - TMap *map = fPressure->ExtractDCS(dcsAliasMap); - if (map) { - fPressure->MakeSplineFit(map); - AliInfo(Form("Pressure values extracted, fits performed.\n")); - } else { - Log("AliTPCPreprocsessor: no atmospheric pressure map extracted. \n"); - result=9; - } - delete map; - // Now store the final CDB file - - if ( result == 0 ) { - AliCDBMetaData metaData; - metaData.SetBeamPeriod(0); - metaData.SetResponsible("Haavard Helstrup"); - metaData.SetComment("Preprocessor AliTPC data base entries."); - - Bool_t storeOK = Store("Calib", "Pressure", fPressure, &metaData, 0, 0); - if ( !storeOK ) result=1; - - } - - return result; - -} //______________________________________________________________________________________________ @@ -322,6 +280,11 @@ UInt_t AliTPCPreprocessor::ExtractPedestals(Int_t sourceFXS) } AliTPCCalibPedestal *calPed; f->GetObject("AliTPCCalibPedestal",calPed); + if ( !calPed ) { + Log ("No pedestal calibration object in file."); + result = 2; + break; + } // replace entries for the sectors available in the present file @@ -348,7 +311,7 @@ UInt_t AliTPCPreprocessor::ExtractPedestals(Int_t sourceFXS) if ( !storeOK ) ++result; } else { - Log ("Error: no entries!"); + Log ("Error: no entries in input file list!"); result = 1; } @@ -415,6 +378,11 @@ UInt_t AliTPCPreprocessor::ExtractPulser(Int_t sourceFXS) } AliTPCCalibPulser *calPulser; f->GetObject("AliTPCCalibPulser",calPulser); + if ( !calPulser ) { + Log ("No pulser calibration object in file."); + result = 2; + break; + } // replace entries for the sectors available in the present file @@ -441,7 +409,7 @@ UInt_t AliTPCPreprocessor::ExtractPulser(Int_t sourceFXS) if ( !storeOK ) ++result; } else { - Log ("Error: no entries!"); + Log ("Error: no entries in input file list!"); result = 1; } diff --git a/TPC/AliTPCPreprocessor.h b/TPC/AliTPCPreprocessor.h index 55849a23eb3..22a33eedebc 100644 --- a/TPC/AliTPCPreprocessor.h +++ b/TPC/AliTPCPreprocessor.h @@ -32,7 +32,6 @@ class AliTPCPreprocessor : public AliPreprocessor private: TEnv *fConfEnv; // Preprocessor configuration map AliTPCSensorTempArray *fTemp; // CDB class for temperature sensors - AliDCSSensorArray *fPressure; // CDB class for pressure sensors Bool_t fConfigOK; // Identify succesful reading of OCDB Config AliTPCROC *fROC; // TPC Read-Out configuration diff --git a/TPC/AliTPCSensorTemp.cxx b/TPC/AliTPCSensorTemp.cxx index b265a88ab39..63c5f7a0c94 100644 --- a/TPC/AliTPCSensorTemp.cxx +++ b/TPC/AliTPCSensorTemp.cxx @@ -33,11 +33,11 @@ */ // -#include + #include "AliTPCSensorTemp.h" ClassImp(AliTPCSensorTemp) -const char kAmandaString[] = "tpc_temp:PT_%d.Temperature"; + const Float_t kASideX[18][5]={ { 99.56, 117.59, 160.82, 186.92, 213.11}, @@ -73,7 +73,7 @@ const Float_t kASideY[18][5]={ {-50.55, -59.7, -81.65, -94.9, -108.2}, {-77.45, -91.47, -125.1, -145.4, -165.77}, {-95.0, -112.2, -153.45, -178.35, -203.35}, - {-101.1, -119.4, -163.3, -189.8, -216.4}, + {-101.1, -119.4, -163.3, -189.8, -216.4}, {-95.0, -112.2, -153.45, -178.35, -203.35}, {-77.45, -91.47, -125.1, -145.4, -165.77}, {-50.55, -59.7, -81.65, -94.9, -108.2}, @@ -113,7 +113,7 @@ const Float_t kCSideY[18][5]={ {-50.55, -59.7, -81.56, -94.9, -108.2}, {-77.45, -91.47, -125.1, -145.4, -165.77}, {-95.0, -112.2, -153.45, -178.35, -203.35}, - {-101.1, -119.4, -163.3, -189.8, -216.4}, + {-101.1, -119.4, -163.3, -189.8, -216.4}, {-95.0, -112.2, -153.45, -178.35, -203.35}, {-77.45, -91.47, -125.1, -145.4, -165.77}, {-50.55, -59.7, -81.65, -94.9, -108.2}, @@ -175,7 +175,8 @@ TClonesArray * AliTPCSensorTemp::ReadList(const char *fname) { //______________________________________________________________________________________________ -TClonesArray * AliTPCSensorTemp::ReadTree(TTree *tree) { +TClonesArray * AliTPCSensorTemp::ReadTree(TTree *tree, + const TString& amandaString) { Int_t nentries = tree->GetEntries(); Int_t sensor=0; @@ -209,7 +210,7 @@ TClonesArray * AliTPCSensorTemp::ReadTree(TTree *tree) { tree->GetEntry(isensor); temp->SetId(sensor); temp->SetIdDCS(echa); - TString stringID = Form (kAmandaString,echa); + TString stringID = Form (amandaString.Data(),echa); temp->SetStringID(stringID); if (side[0]=='C') temp->SetSide(1); temp->SetSector(sector); diff --git a/TPC/AliTPCSensorTemp.h b/TPC/AliTPCSensorTemp.h index 3b673a9767b..eaff19b3874 100644 --- a/TPC/AliTPCSensorTemp.h +++ b/TPC/AliTPCSensorTemp.h @@ -28,6 +28,8 @@ class TTimeStamp; // Class AliTPCSensorTempSensors //////////////////////////////////////////////////////////////////////// +const TString kAmandaString = "tpc_temp:PT_%d.Temperature"; + class AliTPCSensorTemp : public AliDCSSensor { public: @@ -48,7 +50,8 @@ public: static TClonesArray * ReadList(const char *fname); - static TClonesArray * ReadTree(TTree *tree); + static TClonesArray * ReadTree(TTree *tree, + const TString& amandaString = kAmandaString); protected: Int_t fType; // Position of sensors on fieldcage diff --git a/TPC/AliTPCSensorTempArray.cxx b/TPC/AliTPCSensorTempArray.cxx index 42e6e290a00..b7ddb1bf105 100644 --- a/TPC/AliTPCSensorTempArray.cxx +++ b/TPC/AliTPCSensorTempArray.cxx @@ -24,6 +24,9 @@ #include "AliTPCSensorTempArray.h" #include "TLinearFitter.h" #include "TVectorD.h" +#include "AliLog.h" + + ClassImp(AliTPCSensorTempArray) @@ -53,21 +56,21 @@ AliTPCSensorTempArray::AliTPCSensorTempArray(Int_t run) : AliDCSSensorArray() } //_____________________________________________________________________________ AliTPCSensorTempArray::AliTPCSensorTempArray(UInt_t startTime, UInt_t endTime, - TTree* confTree) + TTree* confTree, const TString& amandaString) :AliDCSSensorArray() { // // AliTPCSensorTempArray constructor for Shuttle preprocessor // (confTree read from OCDB) // - fSensors = AliTPCSensorTemp::ReadTree(confTree); + fSensors = AliTPCSensorTemp::ReadTree(confTree,amandaString); fSensors->BypassStreamer(kFALSE); fStartTime = TTimeStamp(startTime); fEndTime = TTimeStamp(endTime); } //_____________________________________________________________________________ -AliTPCSensorTempArray::AliTPCSensorTempArray(const char *fname) : +AliTPCSensorTempArray::AliTPCSensorTempArray(const char *fname) : AliDCSSensorArray() { // @@ -102,28 +105,22 @@ AliTPCSensorTempArray &AliTPCSensorTempArray::operator=(const AliTPCSensorTempAr // // Assignment operator // - - if (this != &c) ((AliTPCSensorTempArray &) c).Copy(*this); + if (this != &c) { + fSensors->Delete(); + new (this) AliTPCSensorTempArray(c); + fSensors = (TClonesArray*)c.fSensors->Clone(); + } return *this; - } -//_____________________________________________________________________________ -void AliTPCSensorTempArray::Copy(TObject &c) const -{ - // - // Copy function - // - TObject::Copy(c); -} //_____________________________________________________________________________ -void AliTPCSensorTempArray::ReadSensors(const char *dbEntry) +void AliTPCSensorTempArray::ReadSensors(const char *dbEntry) { // // Read list of temperature sensors from text file // - AliCDBEntry *entry = AliCDBManager::Instance()->Get(dbEntry); + AliCDBEntry *entry = AliCDBManager::Instance()->Get(dbEntry); TTree *tree = (TTree*) entry->GetObject(); fSensors = AliTPCSensorTemp::ReadTree(tree); diff --git a/TPC/AliTPCSensorTempArray.h b/TPC/AliTPCSensorTempArray.h index 0e74341e55a..9419a8c4caa 100644 --- a/TPC/AliTPCSensorTempArray.h +++ b/TPC/AliTPCSensorTempArray.h @@ -28,13 +28,13 @@ class AliDCSSensor; class AliTPCSensorTempArray : public AliDCSSensorArray { public: AliTPCSensorTempArray(); - AliTPCSensorTempArray(Int_t run); + AliTPCSensorTempArray(Int_t run); AliTPCSensorTempArray(const char *fname); - AliTPCSensorTempArray (UInt_t startTime, UInt_t endTime, TTree* confTree); - AliTPCSensorTempArray(const AliTPCSensorTempArray &c); + AliTPCSensorTempArray (UInt_t startTime, UInt_t endTime, TTree* confTree, + const TString& amandaString = kAmandaString); + AliTPCSensorTempArray(const AliTPCSensorTempArray &c); virtual ~AliTPCSensorTempArray(); AliTPCSensorTempArray &operator=(const AliTPCSensorTempArray &c); - virtual void Copy (TObject &c) const; void ReadSensors (const char *dbEntry); AliTPCSensorTemp* GetSensor (Int_t type, Int_t side, Int_t sector, Int_t num); AliTPCSensorTemp* GetSensor (Int_t IdDCS);