1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
17 ///////////////////////////////////////////////////////////////////////////////
19 // EMCAL calibration class for saved temperature sensor parameters //
20 // Authors: David Silvermyr, copied from TPC (Ivanov, Helstrup) //
22 ///////////////////////////////////////////////////////////////////////////////
24 #include "AliEMCALSensorTempArray.h"
25 #include "TLinearFitter.h"
29 ClassImp(AliEMCALSensorTempArray)
31 //_____________________________________________________________________________
32 AliEMCALSensorTempArray::AliEMCALSensorTempArray():AliDCSSensorArray()
35 // AliEMCALSensorTempArray default constructor
38 //_____________________________________________________________________________
39 AliEMCALSensorTempArray::AliEMCALSensorTempArray(Int_t run) : AliDCSSensorArray()
42 // Read configuration from OCDB
46 AliCDBManager::Instance()->Get("EMCAL/Config/Temperature",run);
48 TTree *tree = (TTree*) entry->GetObject();
49 fSensors = AliEMCALSensorTemp::ReadTree(tree);
50 fSensors->BypassStreamer(kFALSE);
52 else AliFatal("CDB entry null!");
54 //_____________________________________________________________________________
55 AliEMCALSensorTempArray::AliEMCALSensorTempArray(UInt_t startTime, UInt_t endTime,
56 TTree* confTree, const TString& amandaString)
60 // AliEMCALSensorTempArray constructor for Shuttle preprocessor
61 // (confTree read from OCDB)
63 fSensors = AliEMCALSensorTemp::ReadTree(confTree,amandaString);
64 fSensors->BypassStreamer(kFALSE);
65 fStartTime = TTimeStamp((time_t)startTime,0);
66 fEndTime = TTimeStamp((time_t)endTime,0);
69 //_____________________________________________________________________________
70 AliEMCALSensorTempArray::AliEMCALSensorTempArray(const char *fname,
71 const TString& amandaString) :
75 // AliEMCALSensorTempArray constructor
77 fSensors = AliEMCALSensorTemp::ReadList(fname,amandaString);
78 fSensors->BypassStreamer(kFALSE);
81 //_____________________________________________________________________________
82 AliEMCALSensorTempArray::AliEMCALSensorTempArray(const AliEMCALSensorTempArray &c):
86 // AliEMCALSensorTempArray copy constructor
90 //_____________________________________________________________________________
91 AliEMCALSensorTempArray::~AliEMCALSensorTempArray()
94 // AliEMCALSensorTempArray destructor
98 //_____________________________________________________________________________
99 AliEMCALSensorTempArray &AliEMCALSensorTempArray::operator=(const AliEMCALSensorTempArray &c)
102 // Assignment operator
106 new (this) AliEMCALSensorTempArray(c);
107 fSensors = (TClonesArray*)c.fSensors->Clone();
112 //_____________________________________________________________________________
113 void AliEMCALSensorTempArray::ReadSensors(const char *dbEntry)
116 // Read list of temperature sensors from text file
118 AliCDBEntry *entry = AliCDBManager::Instance()->Get(dbEntry);
120 TTree *tree = (TTree*) entry->GetObject();
121 fSensors = AliEMCALSensorTemp::ReadTree(tree);
123 else AliFatal("NULL CDB entry!");
126 //_____________________________________________________________________________
127 AliEMCALSensorTemp* AliEMCALSensorTempArray::GetSensor(Int_t side, Int_t sector, Int_t num)
130 // Return sensor information for sensor specified by side, sector and num
132 Int_t nsensors = fSensors->GetEntries();
133 for (Int_t isensor=0; isensor<nsensors; isensor++) {
134 AliEMCALSensorTemp *entry = (AliEMCALSensorTemp*)fSensors->At(isensor);
135 if (entry->GetSide() == side &&
136 entry->GetSector() == sector &&
137 entry->GetNum() == num ) return entry;
142 //_____________________________________________________________________________
144 AliEMCALSensorTemp* AliEMCALSensorTempArray::GetSensor(Int_t IdDCS){
145 return dynamic_cast<AliEMCALSensorTemp*>(AliDCSSensorArray::GetSensor(IdDCS));
148 //_____________________________________________________________________________
149 AliEMCALSensorTemp* AliEMCALSensorTempArray::GetSensor(Double_t x, Double_t y, Double_t z){
150 return dynamic_cast<AliEMCALSensorTemp*>(AliDCSSensorArray::GetSensor(x,y,z));
153 //_____________________________________________________________________________
154 Double_t AliEMCALSensorTempArray::GetTempGradientY(UInt_t timeSec, Int_t side){
156 // Extract Linear Vertical Temperature Gradient [K/cm] within the EMCAL on
159 // Values based on TemperatureSensors within the EMCAL
161 // FIXME: Also return residual-distribution, covariance Matrix
162 // or simply chi2 for validity check?
165 TLinearFitter fitter(3,"x0++x1++x2");
169 Int_t nsensors = fSensors->GetEntries();
170 for (Int_t isensor=0; isensor<nsensors; isensor++) { // loop over all sensors
171 AliEMCALSensorTemp *entry = (AliEMCALSensorTemp*)fSensors->At(isensor);
173 if (entry->GetSide()==side) { // only the selected side
178 Double_t y = entry->GetValue(timeSec); // get temperature value
179 fitter.AddPoint(x,y,1); // add values to LinearFitter
185 fitter.GetParameters(param);
187 return param[2]; // return vertical (Y) tempGradient