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);
47 TTree *tree = (TTree*) entry->GetObject();
48 fSensors = AliEMCALSensorTemp::ReadTree(tree);
49 fSensors->BypassStreamer(kFALSE);
51 //_____________________________________________________________________________
52 AliEMCALSensorTempArray::AliEMCALSensorTempArray(UInt_t startTime, UInt_t endTime,
53 TTree* confTree, const TString& amandaString)
57 // AliEMCALSensorTempArray constructor for Shuttle preprocessor
58 // (confTree read from OCDB)
60 fSensors = AliEMCALSensorTemp::ReadTree(confTree,amandaString);
61 fSensors->BypassStreamer(kFALSE);
62 fStartTime = TTimeStamp((time_t)startTime,0);
63 fEndTime = TTimeStamp((time_t)endTime,0);
66 //_____________________________________________________________________________
67 AliEMCALSensorTempArray::AliEMCALSensorTempArray(const char *fname,
68 const TString& amandaString) :
72 // AliEMCALSensorTempArray constructor
74 fSensors = AliEMCALSensorTemp::ReadList(fname,amandaString);
75 fSensors->BypassStreamer(kFALSE);
78 //_____________________________________________________________________________
79 AliEMCALSensorTempArray::AliEMCALSensorTempArray(const AliEMCALSensorTempArray &c):
83 // AliEMCALSensorTempArray copy constructor
87 //_____________________________________________________________________________
88 AliEMCALSensorTempArray::~AliEMCALSensorTempArray()
91 // AliEMCALSensorTempArray destructor
95 //_____________________________________________________________________________
96 AliEMCALSensorTempArray &AliEMCALSensorTempArray::operator=(const AliEMCALSensorTempArray &c)
99 // Assignment operator
103 new (this) AliEMCALSensorTempArray(c);
104 fSensors = (TClonesArray*)c.fSensors->Clone();
109 //_____________________________________________________________________________
110 void AliEMCALSensorTempArray::ReadSensors(const char *dbEntry)
113 // Read list of temperature sensors from text file
115 AliCDBEntry *entry = AliCDBManager::Instance()->Get(dbEntry);
116 TTree *tree = (TTree*) entry->GetObject();
117 fSensors = AliEMCALSensorTemp::ReadTree(tree);
120 //_____________________________________________________________________________
121 AliEMCALSensorTemp* AliEMCALSensorTempArray::GetSensor(Int_t side, Int_t sector, Int_t num)
124 // Return sensor information for sensor specified by side, sector and num
126 Int_t nsensors = fSensors->GetEntries();
127 for (Int_t isensor=0; isensor<nsensors; isensor++) {
128 AliEMCALSensorTemp *entry = (AliEMCALSensorTemp*)fSensors->At(isensor);
129 if (entry->GetSide() == side &&
130 entry->GetSector() == sector &&
131 entry->GetNum() == num ) return entry;
136 //_____________________________________________________________________________
138 AliEMCALSensorTemp* AliEMCALSensorTempArray::GetSensor(Int_t IdDCS){
139 return dynamic_cast<AliEMCALSensorTemp*>(AliDCSSensorArray::GetSensor(IdDCS));
142 //_____________________________________________________________________________
143 AliEMCALSensorTemp* AliEMCALSensorTempArray::GetSensor(Double_t x, Double_t y, Double_t z){
144 return dynamic_cast<AliEMCALSensorTemp*>(AliDCSSensorArray::GetSensor(x,y,z));
147 //_____________________________________________________________________________
148 Double_t AliEMCALSensorTempArray::GetTempGradientY(UInt_t timeSec, Int_t side){
150 // Extract Linear Vertical Temperature Gradient [K/cm] within the EMCAL on
153 // Values based on TemperatureSensors within the EMCAL
155 // FIXME: Also return residual-distribution, covariance Matrix
156 // or simply chi2 for validity check?
159 TLinearFitter fitter(3,"x0++x1++x2");
163 Int_t nsensors = fSensors->GetEntries();
164 for (Int_t isensor=0; isensor<nsensors; isensor++) { // loop over all sensors
165 AliEMCALSensorTemp *entry = (AliEMCALSensorTemp*)fSensors->At(isensor);
167 if (entry->GetSide()==side) { // only the selected side
172 Double_t y = entry->GetValue(timeSec); // get temperature value
173 fitter.AddPoint(x,y,1); // add values to LinearFitter
179 fitter.GetParameters(param);
181 return param[2]; // return vertical (Y) tempGradient