Line data Source code
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 :
29 42 : ClassImp(AliEMCALSensorTempArray)
30 :
31 : //_____________________________________________________________________________
32 0 : AliEMCALSensorTempArray::AliEMCALSensorTempArray():AliDCSSensorArray()
33 0 : {
34 : //
35 : // AliEMCALSensorTempArray default constructor
36 : //
37 0 : }
38 : //_____________________________________________________________________________
39 0 : AliEMCALSensorTempArray::AliEMCALSensorTempArray(Int_t run) : AliDCSSensorArray()
40 0 : {
41 : //
42 : // Read configuration from OCDB
43 : //
44 :
45 : AliCDBEntry *entry =
46 0 : AliCDBManager::Instance()->Get("EMCAL/Config/Temperature",run);
47 0 : if(entry){
48 0 : TTree *tree = (TTree*) entry->GetObject();
49 0 : fSensors = AliEMCALSensorTemp::ReadTree(tree);
50 0 : fSensors->BypassStreamer(kFALSE);
51 0 : }
52 0 : else AliFatal("CDB entry null!");
53 0 : }
54 : //_____________________________________________________________________________
55 : AliEMCALSensorTempArray::AliEMCALSensorTempArray(UInt_t startTime, UInt_t endTime,
56 : TTree* confTree, const TString& amandaString)
57 0 : :AliDCSSensorArray()
58 0 : {
59 : //
60 : // AliEMCALSensorTempArray constructor for Shuttle preprocessor
61 : // (confTree read from OCDB)
62 : //
63 0 : fSensors = AliEMCALSensorTemp::ReadTree(confTree,amandaString);
64 0 : fSensors->BypassStreamer(kFALSE);
65 0 : fStartTime = TTimeStamp((time_t)startTime,0);
66 0 : fEndTime = TTimeStamp((time_t)endTime,0);
67 0 : }
68 :
69 : //_____________________________________________________________________________
70 : AliEMCALSensorTempArray::AliEMCALSensorTempArray(const char *fname,
71 : const TString& amandaString) :
72 0 : AliDCSSensorArray()
73 0 : {
74 : //
75 : // AliEMCALSensorTempArray constructor
76 : //
77 0 : fSensors = AliEMCALSensorTemp::ReadList(fname,amandaString);
78 0 : fSensors->BypassStreamer(kFALSE);
79 0 : }
80 :
81 : //_____________________________________________________________________________
82 : AliEMCALSensorTempArray::AliEMCALSensorTempArray(const AliEMCALSensorTempArray &c):
83 0 : AliDCSSensorArray(c)
84 0 : {
85 : //
86 : // AliEMCALSensorTempArray copy constructor
87 : //
88 0 : }
89 :
90 : //_____________________________________________________________________________
91 : AliEMCALSensorTempArray::~AliEMCALSensorTempArray()
92 0 : {
93 : //
94 : // AliEMCALSensorTempArray destructor
95 : //
96 0 : }
97 :
98 : //_____________________________________________________________________________
99 : AliEMCALSensorTempArray &AliEMCALSensorTempArray::operator=(const AliEMCALSensorTempArray &c)
100 : {
101 : //
102 : // Assignment operator
103 : //
104 0 : if (this != &c) {
105 0 : fSensors->Delete();
106 0 : new (this) AliEMCALSensorTempArray(c);
107 0 : fSensors = (TClonesArray*)c.fSensors->Clone();
108 0 : }
109 0 : return *this;
110 0 : }
111 :
112 : //_____________________________________________________________________________
113 : void AliEMCALSensorTempArray::ReadSensors(const char *dbEntry)
114 : {
115 : //
116 : // Read list of temperature sensors from text file
117 : //
118 0 : AliCDBEntry *entry = AliCDBManager::Instance()->Get(dbEntry);
119 0 : if(entry){
120 0 : TTree *tree = (TTree*) entry->GetObject();
121 0 : fSensors = AliEMCALSensorTemp::ReadTree(tree);
122 0 : }
123 0 : else AliFatal("NULL CDB entry!");
124 0 : }
125 :
126 : //_____________________________________________________________________________
127 : AliEMCALSensorTemp* 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 0 : Int_t nsensors = fSensors->GetEntries();
133 0 : for (Int_t isensor=0; isensor<nsensors; isensor++) {
134 0 : AliEMCALSensorTemp *entry = (AliEMCALSensorTemp*)fSensors->At(isensor);
135 0 : if (entry->GetSide() == side &&
136 0 : entry->GetSector() == sector &&
137 0 : entry->GetNum() == num ) return entry;
138 0 : }
139 0 : return 0;
140 0 : }
141 :
142 : //_____________________________________________________________________________
143 :
144 : AliEMCALSensorTemp* AliEMCALSensorTempArray::GetSensor(Int_t IdDCS){
145 0 : return dynamic_cast<AliEMCALSensorTemp*>(AliDCSSensorArray::GetSensor(IdDCS));
146 : }
147 :
148 : //_____________________________________________________________________________
149 : AliEMCALSensorTemp* AliEMCALSensorTempArray::GetSensor(Double_t x, Double_t y, Double_t z){
150 0 : return dynamic_cast<AliEMCALSensorTemp*>(AliDCSSensorArray::GetSensor(x,y,z));
151 : }
152 :
153 : //_____________________________________________________________________________
154 : Double_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 0 : TLinearFitter fitter(3,"x0++x1++x2");
166 0 : TVectorD param(3);
167 : Int_t i = 0;
168 :
169 0 : Int_t nsensors = fSensors->GetEntries();
170 0 : for (Int_t isensor=0; isensor<nsensors; isensor++) { // loop over all sensors
171 0 : AliEMCALSensorTemp *entry = (AliEMCALSensorTemp*)fSensors->At(isensor);
172 :
173 0 : if (entry->GetSide()==side) { // only the selected side
174 0 : Double_t x[3];
175 0 : x[0]=1;
176 0 : x[1]=entry->GetX();
177 0 : x[2]=entry->GetY();
178 0 : Double_t y = entry->GetValue(timeSec); // get temperature value
179 0 : fitter.AddPoint(x,y,1); // add values to LinearFitter
180 0 : i++;
181 0 : }
182 :
183 : }
184 0 : fitter.Eval();
185 0 : fitter.GetParameters(param);
186 :
187 0 : return param[2]; // return vertical (Y) tempGradient
188 :
189 0 : }
|