]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EMCAL/AliEMCALSensorTempArray.cxx
Bug fix: AliHLTComponent::ConfigureFromArgumentString
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALSensorTempArray.cxx
CommitLineData
60ea8d38 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
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 **************************************************************************/
15
16
17///////////////////////////////////////////////////////////////////////////////
18// //
19// EMCAL calibration class for saved temperature sensor parameters //
20// Authors: David Silvermyr, copied from TPC (Ivanov, Helstrup) //
21// //
22///////////////////////////////////////////////////////////////////////////////
23
24#include "AliEMCALSensorTempArray.h"
25#include "TLinearFitter.h"
26#include "TVectorD.h"
27#include "AliLog.h"
28
29ClassImp(AliEMCALSensorTempArray)
30
31//_____________________________________________________________________________
32AliEMCALSensorTempArray::AliEMCALSensorTempArray():AliDCSSensorArray()
33{
34 //
35 // AliEMCALSensorTempArray default constructor
36 //
37}
38//_____________________________________________________________________________
39AliEMCALSensorTempArray::AliEMCALSensorTempArray(Int_t run) : AliDCSSensorArray()
40{
41 //
42 // Read configuration from OCDB
43 //
44
45 AliCDBEntry *entry =
46 AliCDBManager::Instance()->Get("EMCAL/Config/Temperature",run);
a51e676d 47 if(entry){
48 TTree *tree = (TTree*) entry->GetObject();
49 fSensors = AliEMCALSensorTemp::ReadTree(tree);
50 fSensors->BypassStreamer(kFALSE);
51 }
52 else AliFatal("CDB entry null!");
60ea8d38 53}
54//_____________________________________________________________________________
55AliEMCALSensorTempArray::AliEMCALSensorTempArray(UInt_t startTime, UInt_t endTime,
56 TTree* confTree, const TString& amandaString)
57 :AliDCSSensorArray()
58{
59 //
60 // AliEMCALSensorTempArray constructor for Shuttle preprocessor
61 // (confTree read from OCDB)
62 //
63 fSensors = AliEMCALSensorTemp::ReadTree(confTree,amandaString);
64 fSensors->BypassStreamer(kFALSE);
65 fStartTime = TTimeStamp((time_t)startTime,0);
66 fEndTime = TTimeStamp((time_t)endTime,0);
67}
68
69//_____________________________________________________________________________
70AliEMCALSensorTempArray::AliEMCALSensorTempArray(const char *fname,
71 const TString& amandaString) :
72 AliDCSSensorArray()
73{
74 //
75 // AliEMCALSensorTempArray constructor
76 //
77 fSensors = AliEMCALSensorTemp::ReadList(fname,amandaString);
78 fSensors->BypassStreamer(kFALSE);
79}
80
81//_____________________________________________________________________________
82AliEMCALSensorTempArray::AliEMCALSensorTempArray(const AliEMCALSensorTempArray &c):
83 AliDCSSensorArray(c)
84{
85 //
86 // AliEMCALSensorTempArray copy constructor
87 //
88}
89
90//_____________________________________________________________________________
91AliEMCALSensorTempArray::~AliEMCALSensorTempArray()
92{
93 //
94 // AliEMCALSensorTempArray destructor
95 //
96}
97
98//_____________________________________________________________________________
99AliEMCALSensorTempArray &AliEMCALSensorTempArray::operator=(const AliEMCALSensorTempArray &c)
100{
101 //
102 // Assignment operator
103 //
104 if (this != &c) {
105 fSensors->Delete();
106 new (this) AliEMCALSensorTempArray(c);
107 fSensors = (TClonesArray*)c.fSensors->Clone();
108 }
109 return *this;
110}
111
112//_____________________________________________________________________________
113void AliEMCALSensorTempArray::ReadSensors(const char *dbEntry)
114{
115 //
116 // Read list of temperature sensors from text file
117 //
118 AliCDBEntry *entry = AliCDBManager::Instance()->Get(dbEntry);
622e10be 119 if(entry){
120 TTree *tree = (TTree*) entry->GetObject();
121 fSensors = AliEMCALSensorTemp::ReadTree(tree);
122 }
123 else AliFatal("NULL CDB entry!");
60ea8d38 124}
125
126//_____________________________________________________________________________
127AliEMCALSensorTemp* AliEMCALSensorTempArray::GetSensor(Int_t side, Int_t sector, Int_t num)
128{
129 //
130 // Return sensor information for sensor specified by side, sector and num
131 //
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;
138 }
139 return 0;
140}
141
142//_____________________________________________________________________________
143
144AliEMCALSensorTemp* AliEMCALSensorTempArray::GetSensor(Int_t IdDCS){
145 return dynamic_cast<AliEMCALSensorTemp*>(AliDCSSensorArray::GetSensor(IdDCS));
146}
147
148//_____________________________________________________________________________
149AliEMCALSensorTemp* AliEMCALSensorTempArray::GetSensor(Double_t x, Double_t y, Double_t z){
150 return dynamic_cast<AliEMCALSensorTemp*>(AliDCSSensorArray::GetSensor(x,y,z));
151}
152
153//_____________________________________________________________________________
154Double_t AliEMCALSensorTempArray::GetTempGradientY(UInt_t timeSec, Int_t side){
155 //
156 // Extract Linear Vertical Temperature Gradient [K/cm] within the EMCAL on
157 // Shaft Side(A): 0
158 // Muon Side(C): 1
159 // Values based on TemperatureSensors within the EMCAL
160 //
161 // FIXME: Also return residual-distribution, covariance Matrix
162 // or simply chi2 for validity check?
163 //
164
165 TLinearFitter fitter(3,"x0++x1++x2");
166 TVectorD param(3);
167 Int_t i = 0;
168
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);
172
173 if (entry->GetSide()==side) { // only the selected side
174 Double_t x[3];
175 x[0]=1;
176 x[1]=entry->GetX();
177 x[2]=entry->GetY();
178 Double_t y = entry->GetValue(timeSec); // get temperature value
179 fitter.AddPoint(x,y,1); // add values to LinearFitter
180 i++;
181 }
182
183 }
184 fitter.Eval();
185 fitter.GetParameters(param);
186
187 return param[2]; // return vertical (Y) tempGradient
188
189 }