]>
Commit | Line | Data |
---|---|---|
04236e67 | 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 | // Produces the data needed to calculate the TOF quality assurance. // | |
19 | // QA objects are 1 & 2 Dimensional histograms. // | |
20 | // author: S.Arcelli // | |
21 | // // | |
17f2cd01 | 22 | // last modified by F. Bellini (fbellini@cern.ch) on 02/03/2010 // |
04236e67 | 23 | /////////////////////////////////////////////////////////////////////// |
24 | ||
32bd8225 | 25 | /* Modified by fbellini on 30/03/2010 |
26 | Changed raws time histos range to 610ns | |
27 | Added FilterLTMData() and FilterSpare() methods | |
28 | Added check on enabled channels for raw data | |
29 | Updated RecPoints QA | |
30 | ||
31 | */ | |
32 | ||
33 | /* Modified by fbellini on 02/03/2010 | |
34 | Fixed raw data decoding methods (use AliTOFRawStream::LoadRawDataBuffer()) | |
35 | Added filter for noisy channels and read map from OCDB | |
36 | Added GetCalibData() method | |
37 | Added CheckVolumeID() and CheckEquipID() methods | |
38 | Updated Raw QA | |
39 | */ | |
40 | ||
04236e67 | 41 | #include <TClonesArray.h> |
04236e67 | 42 | #include <TH1F.h> |
43 | #include <TH2F.h> | |
5c7c93fa | 44 | |
32bd8225 | 45 | |
17f2cd01 | 46 | #include "AliCDBManager.h" |
17f2cd01 | 47 | #include "AliCDBEntry.h" |
04236e67 | 48 | #include "AliESDEvent.h" |
49 | #include "AliESDtrack.h" | |
04236e67 | 50 | #include "AliQAChecker.h" |
51 | #include "AliRawReader.h" | |
32bd8225 | 52 | #include "AliTOFRawStream.h" |
5c7c93fa | 53 | #include "AliTOFcluster.h" |
54 | #include "AliTOFQADataMakerRec.h" | |
04236e67 | 55 | #include "AliTOFrawData.h" |
5c7c93fa | 56 | #include "AliTOFGeometry.h" |
17f2cd01 | 57 | #include "AliTOFChannelOnlineStatusArray.h" |
58 | ||
04236e67 | 59 | |
60 | ClassImp(AliTOFQADataMakerRec) | |
61 | ||
62 | //____________________________________________________________________________ | |
63 | AliTOFQADataMakerRec::AliTOFQADataMakerRec() : | |
17f2cd01 | 64 | AliQADataMakerRec(AliQAv1::GetDetName(AliQAv1::kTOF), "TOF Quality Assurance Data Maker"), |
65 | fCalibData(0x0), | |
66 | fEnableNoiseFiltering(kFALSE) | |
04236e67 | 67 | { |
68 | // | |
69 | // ctor | |
70 | // | |
71 | } | |
72 | ||
73 | //____________________________________________________________________________ | |
74 | AliTOFQADataMakerRec::AliTOFQADataMakerRec(const AliTOFQADataMakerRec& qadm) : | |
17f2cd01 | 75 | AliQADataMakerRec(), |
76 | fCalibData(qadm.fCalibData), | |
77 | fEnableNoiseFiltering(qadm.fEnableNoiseFiltering) | |
04236e67 | 78 | { |
79 | // | |
80 | //copy ctor | |
81 | // | |
82 | SetName((const char*)qadm.GetName()) ; | |
83 | SetTitle((const char*)qadm.GetTitle()); | |
84 | } | |
85 | ||
86 | //__________________________________________________________________ | |
87 | AliTOFQADataMakerRec& AliTOFQADataMakerRec::operator = (const AliTOFQADataMakerRec& qadm ) | |
88 | { | |
89 | // | |
90 | // assignment operator. | |
91 | // | |
92 | this->~AliTOFQADataMakerRec(); | |
93 | new(this) AliTOFQADataMakerRec(qadm); | |
94 | return *this; | |
95 | } | |
96 | ||
17f2cd01 | 97 | //---------------------------------------------------------------------------- |
98 | AliTOFChannelOnlineStatusArray* AliTOFQADataMakerRec::GetCalibData() const | |
99 | { | |
32bd8225 | 100 | // |
101 | // Retrive TOF calib objects from OCDB | |
102 | // | |
17f2cd01 | 103 | AliCDBManager *man = AliCDBManager::Instance(); |
104 | ||
105 | AliCDBEntry *cdbe=0; | |
106 | ||
107 | cdbe = man->Get("TOF/Calib/Status",fRun); | |
108 | if(!cdbe){ | |
109 | AliWarning("Load of calibration data from default storage failed!"); | |
110 | AliWarning("Calibration data will be loaded from local storage ($ALICE_ROOT)"); | |
111 | man->SetDefaultStorage("local://$ALICE_ROOT/OCDB"); | |
112 | cdbe = man->Get("TOF/Calib/Status",fRun); | |
113 | } | |
114 | // Retrieval of data in directory TOF/Calib/Data: | |
115 | ||
116 | AliTOFChannelOnlineStatusArray * array = 0; | |
117 | if (cdbe) array = (AliTOFChannelOnlineStatusArray *)cdbe->GetObject(); | |
118 | if (!array) AliFatal("No calibration data from calibration database !"); | |
119 | ||
120 | return array; | |
121 | ||
122 | } | |
123 | ||
124 | ||
125 | ||
04236e67 | 126 | //____________________________________________________________________________ |
127 | void AliTOFQADataMakerRec::InitRaws() | |
128 | { | |
129 | // | |
130 | // create Raws histograms in Raws subdir | |
131 | // | |
7d297381 | 132 | const Bool_t expert = kTRUE ; |
133 | const Bool_t saveCorr = kTRUE ; | |
134 | const Bool_t image = kTRUE ; | |
04236e67 | 135 | |
32bd8225 | 136 | TH1F * h0 = new TH1F("hTOFRaws", "Number of TOF Raw Hits; TOF raw hits number;Counts ",1001, -1., 1000.) ; |
137 | TH1F * h1 = new TH1F("hTOFRawsIA", "Number of TOF Raw Hits - I/A side; TOF raw hits number ;Counts ",1001, -1., 1000.) ; | |
138 | TH1F * h2 = new TH1F("hTOFRawsOA", "Number of TOF Raw Hits - O/A side; TOF raw hits number ;Counts ",1001, -1., 1000.) ; | |
139 | TH1F * h3 = new TH1F("hTOFRawsIC", "Number of TOF Raw Hits - I/C side; TOF raw hits number ;Counts ",1001, -1., 1000.) ; | |
140 | TH1F * h4 = new TH1F("hTOFRawsOC", "Number of TOF Raw Hits - O/C side; TOF raw hits number ;Counts ",1001, -1., 1000.) ; | |
141 | TH1F * h5 = new TH1F("hTOFRawsTimeIA", "Raws Time Spectrum in TOF (ns) - I/A side;Measured raw TOF time [ns];Counts", 25000,0. ,610.) ; | |
142 | TH1F * h6 = new TH1F("hTOFRawsTimeOA", "Raws Time Spectrum in TOF (ns) - O/A side;Measured raw TOF time [ns];Counts", 25000,0. ,610.) ; | |
143 | TH1F * h7 = new TH1F("hTOFRawsTimeIC", "Raws Time Spectrum in TOF (ns) - I/C side;Measured raw TOF time [ns];Counts", 25000,0. ,610.) ; | |
144 | TH1F * h8 = new TH1F("hTOFRawsTimeOC", "Raws Time Spectrum in TOF (ns) - O/C side;Measured raw TOF time [ns];Counts", 25000,0. ,610.) ; | |
145 | TH1F * h9 = new TH1F("hTOFRawsToTIA", "Raws ToT Spectrum in TOF (ns) - I/A side;Measured raw ToT [ns];Counts", 1000, 0., 244.) ; | |
17f2cd01 | 146 | TH1F * h10 = new TH1F("hTOFRawsToTOA", "Raws ToT Spectrum in TOF (ns) - O/A side;Measured raw ToT [ns];Counts", 10000, 0., 244.) ; |
147 | TH1F * h11 = new TH1F("hTOFRawsToTIC", "Raws ToT Spectrum in TOF (ns) - I/C side;Measured raw ToT [ns];Counts", 10000, 0., 244.) ; | |
148 | TH1F * h12 = new TH1F("hTOFRawsToTOC", "Raws ToT Spectrum in TOF (ns) - O/C side;Measured raw ToT [ns];Counts", 10000, 0., 244.) ; | |
32bd8225 | 149 | |
17f2cd01 | 150 | TH1F * h13 = new TH1F("hTOFRawsTRMHitRate035", "TRM hit rate - crates 0 to 35 ;TRM index = DDL*10+TRM(0-9);Counts", 361, 0., 361.) ; |
151 | TH1F * h14 = new TH1F("hTOFRawsTRMHitRate3671","TRM hit rate - crates 36 to 71 ;TRM index = DDL*10+TRM(0-9);Counts", 361, 361., 722.) ; | |
32bd8225 | 152 | TH1F * h15 = new TH1F("hTOFRawsLTMHitRate", "LTM hit rate; Crate; Counts", 72, 0., 72.); |
153 | ||
154 | TH1F * h16 = new TH1F("hTOFRawsVolumeErrorCounter","Invalid hit/volume association error counter per DDL; DDL; error counter ",73, -1., 72.) ; | |
155 | TH1F * h17 = new TH1F("hTOFRawsEquipErrorCounter", "Invalid hit/equipment association error counter per DDL; DDL; error counter ",73, -1., 72.) ; | |
156 | ||
157 | TH1F * h18 = new TH1F("hTOFOrphansTime", "Raws Time Spectrum in TOF (ns) for hits with no ToT measurement;Measured raw TOF time [ns];Counts", 25000,0. ,610.) ; | |
17f2cd01 | 158 | TH1F * h19 = new TH1F("hTOFRawsWords", "Number of TOF Raw words per event; TOF raw words number;Counts ",1001, -1., 1000.) ; |
159 | TH2F * h20 = new TH2F("hTOFRawTimeVsDDL", "TOF raw time spectrum vs DDL; TOF raw time [ns];DDL ",1000,0. ,2440., 72, 0., 72.) ; | |
160 | TH2F * h21 = new TH2F("hTOFRawToTVsDDL", "TOF raw ToT spectrum vs DDL; TOF raw ToT [ns];DDL ", 100, 0., 244., 72, 0., 72.) ; | |
32bd8225 | 161 | TH2F * h22 = new TH2F("hTOFRawsClusMap","Raws vs TOF eta-phi;eta (2*strip+padz);phi (48*sector+padx)",183, -0.5, 182.5,865,-0.5,864.5) ; |
162 | ||
163 | // TH1F * h23 = new TH1F("hTOFRawsDecodingErr","Decoding errors counts per DDL; DDL;Counts",72,0,72); | |
164 | // TH1F * h24 = new TH1F("hTOFRawsEventsPerDDL","Events number per DDL; DDL; Event Number",72,0,72); | |
165 | ||
44ed7a66 | 166 | |
17f2cd01 | 167 | h0->Sumw2() ; |
168 | h1->Sumw2() ; | |
169 | h2->Sumw2() ; | |
170 | h3->Sumw2() ; | |
171 | h4->Sumw2() ; | |
172 | h5->Sumw2() ; | |
173 | h6->Sumw2() ; | |
174 | h7->Sumw2() ; | |
175 | h8->Sumw2() ; | |
176 | h9->Sumw2() ; | |
177 | h10->Sumw2() ; | |
178 | h11->Sumw2() ; | |
179 | h12->Sumw2() ; | |
180 | h13->Sumw2() ; | |
181 | h14->Sumw2() ; | |
182 | h15->Sumw2() ; | |
183 | h16->Sumw2() ; | |
184 | h17->Sumw2() ; | |
185 | h18->Sumw2() ; | |
186 | h19->Sumw2() ; | |
187 | h20->Sumw2() ; | |
188 | h21->Sumw2() ; | |
32bd8225 | 189 | h22->Sumw2() ; |
190 | ||
17f2cd01 | 191 | Add2RawsList(h0, 0, !expert, image, !saveCorr) ; |
192 | Add2RawsList(h1, 1, expert, !image, !saveCorr) ; | |
193 | Add2RawsList(h2, 2, expert, !image, !saveCorr) ; | |
194 | Add2RawsList(h3, 3, expert, !image, !saveCorr) ; | |
195 | Add2RawsList(h4, 4, expert, !image, !saveCorr) ; | |
196 | Add2RawsList(h5, 5, !expert, image, !saveCorr) ; | |
197 | Add2RawsList(h6, 6, !expert, image, !saveCorr) ; | |
198 | Add2RawsList(h7, 7, !expert, image, !saveCorr) ; | |
199 | Add2RawsList(h8, 8, !expert, image, !saveCorr) ; | |
200 | Add2RawsList(h9, 9, !expert, image, !saveCorr) ; | |
201 | Add2RawsList(h10, 10, !expert, image, !saveCorr) ; | |
202 | Add2RawsList(h11, 11, !expert, image, !saveCorr) ; | |
203 | Add2RawsList(h12, 12, !expert, image, !saveCorr) ; | |
204 | Add2RawsList(h13, 13, expert, !image, !saveCorr) ; | |
205 | Add2RawsList(h14, 14, expert, !image, !saveCorr) ; | |
206 | Add2RawsList(h15, 15, expert, !image, !saveCorr) ; | |
32bd8225 | 207 | Add2RawsList(h16, 16, expert, !image, !saveCorr) ; |
17f2cd01 | 208 | Add2RawsList(h17, 17, expert, !image, !saveCorr) ; |
209 | Add2RawsList(h18, 18, expert, !image, !saveCorr) ; | |
210 | Add2RawsList(h19, 19, expert, !image, !saveCorr) ; | |
211 | Add2RawsList(h20, 20, expert, !image, !saveCorr) ; | |
212 | Add2RawsList(h21, 21, expert, !image, !saveCorr) ; | |
32bd8225 | 213 | Add2RawsList(h22, 22, !expert, image, !saveCorr) ; |
214 | ||
17f2cd01 | 215 | |
44ed7a66 | 216 | } |
217 | ||
04236e67 | 218 | //____________________________________________________________________________ |
219 | void AliTOFQADataMakerRec::InitRecPoints() | |
220 | { | |
221 | // | |
222 | // create RecPoints histograms in RecPoints subdir | |
223 | // | |
135306ea | 224 | |
32bd8225 | 225 | const Bool_t expert = kTRUE ; |
226 | const Bool_t image = kTRUE ; | |
04236e67 | 227 | |
32bd8225 | 228 | TH1F * h0 = new TH1F("hTOFRecPoints", "Number of TOF RecPoints per event;TOF recPoints number;Counts",1001, -1., 1000.) ; |
229 | TH1F * h1 = new TH1F("hTOFRecPointsTimeIA", "RecPoints Time Spectrum in TOF (ns) - I/A side;Calibrated TOF time [ns];Counts", 25000,0. ,610.) ; | |
230 | TH1F * h2 = new TH1F("hTOFRecPointsTimeOA", "RecPoints Time Spectrum in TOF (ns)- O/A side;Calibrated TOF time [ns];Counts", 25000,0. ,610.) ; | |
231 | TH1F * h3 = new TH1F("hTOFRecPointsTimeIC", "RecPoints Time Spectrum in TOF (ns)- I/C side;Calibrated TOF time [ns];Counts", 25000,0. ,610.) ; | |
232 | TH1F * h4 = new TH1F("hTOFRecPointsTimeOC", "RecPoints Time Spectrum in TOF (ns)- O/C side;Calibrated TOF time [ns];Counts", 25000,0. ,610.) ; | |
233 | ||
234 | TH1F * h5 = new TH1F("hTOFRecPointsRawTimeIA", "RecPoints raw Time Spectrum in TOF (ns)-I/A side ;Measured TOF time [ns];Counts", 25000,0. ,610.) ; | |
235 | TH1F * h6 = new TH1F("hTOFRecPointsRawTimeOA", "RecPoints raw Time Spectrum in TOF (ns)-O/A side;Measured TOF time [ns];Counts", 25000,0. ,610.) ; | |
236 | TH1F * h7 = new TH1F("hTOFRecPointsRawTimeIC", "RecPoints raw Time Spectrum in TOF (ns)-I/C side;Measured TOF time [ns];Counts", 25000,0. ,610.) ; | |
237 | TH1F * h8 = new TH1F("hTOFRecPointsRawTimeOC", "RecPoints raw Time Spectrum in TOF (ns)-O/C side;Measured TOF time [ns];Counts", 25000,0. ,610.) ; | |
238 | ||
239 | TH1F * h9 = new TH1F("hTOFRecPointsToTIA", "RecPoints ToT Spectrum in TOF (ns)-I/A side;Measured TOT [ns];Counts",10000, 0., 244. ) ; | |
240 | TH1F * h10 = new TH1F("hTOFRecPointsToTOA", "RecPoints ToT Spectrum in TOF (ns)-O/A side;Measured TOT [ns];Counts",10000, 0., 244. ) ; | |
241 | TH1F * h11 = new TH1F("hTOFRecPointsToTIC", "RecPoints ToT Spectrum in TOF (ns)-I/C side;Measured TOT [ns];Counts",10000, 0., 244. ) ; | |
242 | TH1F * h12 = new TH1F("hTOFRecPointsToTOC", "RecPoints ToT Spectrum in TOF (ns)-O/C side;Measured TOT [ns];Counts",10000, 0., 244. ) ; | |
243 | ||
244 | TH2F * h13 = new TH2F("hTOFRecPointsClusMap","RecPoints vs TOF phi-eta; eta (2*strip+padz);phi (48*sector+padx)",183, -0.5, 182.5,865,-0.5,864.5) ; | |
04236e67 | 245 | |
32bd8225 | 246 | h0->Sumw2() ; |
247 | h1->Sumw2() ; | |
248 | h2->Sumw2() ; | |
249 | h3->Sumw2() ; | |
250 | h4->Sumw2() ; | |
251 | h5->Sumw2() ; | |
252 | h6->Sumw2() ; | |
253 | h7->Sumw2() ; | |
254 | h8->Sumw2() ; | |
255 | h9->Sumw2() ; | |
256 | h10->Sumw2() ; | |
257 | h11->Sumw2() ; | |
258 | h12->Sumw2() ; | |
259 | h13->Sumw2() ; | |
260 | ||
261 | Add2RecPointsList(h0, 0, !expert, image) ; | |
262 | Add2RecPointsList(h1, 1, !expert, image) ; | |
263 | Add2RecPointsList(h2, 2, !expert, image) ; | |
264 | Add2RecPointsList(h3, 3, !expert, image) ; | |
265 | Add2RecPointsList(h4, 4, !expert, image) ; | |
266 | Add2RecPointsList(h5, 5, expert, !image) ; | |
267 | Add2RecPointsList(h6, 6, expert, !image) ; | |
268 | Add2RecPointsList(h7, 7, expert, !image) ; | |
269 | Add2RecPointsList(h8, 8, expert, !image) ; | |
270 | Add2RecPointsList(h9, 9, !expert, image) ; | |
271 | Add2RecPointsList(h10, 10, !expert, image) ; | |
272 | Add2RecPointsList(h11, 11, !expert, image) ; | |
273 | Add2RecPointsList(h12, 12, !expert, image) ; | |
274 | Add2RecPointsList(h13, 13, expert, !image) ; | |
17f2cd01 | 275 | |
04236e67 | 276 | } |
277 | ||
278 | //____________________________________________________________________________ | |
279 | void AliTOFQADataMakerRec::InitESDs() | |
280 | { | |
281 | // | |
282 | //create ESDs histograms in ESDs subdir | |
283 | // | |
135306ea | 284 | |
17f2cd01 | 285 | Bool_t expert = kFALSE; |
286 | ||
287 | TH1F * h0 = new TH1F("hTOFESDs", "Number of matched TOF tracks over ESDs", 250, -1., 4.) ; | |
04236e67 | 288 | h0->Sumw2() ; |
17f2cd01 | 289 | Add2ESDsList(h0, 0, expert) ; |
04236e67 | 290 | |
32bd8225 | 291 | TH1F * h1 = new TH1F("hTOFESDsTime", "Time Spectrum in TOF (ns)", 1000, 0., 244) ; |
04236e67 | 292 | h1->Sumw2() ; |
17f2cd01 | 293 | Add2ESDsList(h1, 1, expert) ; |
04236e67 | 294 | |
32bd8225 | 295 | TH1F * h2 = new TH1F("hTOFESDsRawTime", "raw Time Spectrum in TOF (ns)", 1000, 0., 244) ; |
04236e67 | 296 | h2->Sumw2() ; |
17f2cd01 | 297 | Add2ESDsList(h2, 2, expert) ; |
04236e67 | 298 | |
32bd8225 | 299 | TH1F * h3 = new TH1F("hTOFESDsToT", "ToT Spectrum in TOF (ns)", 1000, 0., 244) ; |
04236e67 | 300 | h3->Sumw2() ; |
17f2cd01 | 301 | Add2ESDsList(h3, 3, expert) ; |
04236e67 | 302 | |
17f2cd01 | 303 | TH1F * h4 = new TH1F("hTOFESDsPID", "Fraction of matched TOF tracks with good PID glag", 100, 0., 1.) ; |
04236e67 | 304 | h4->Sumw2() ; |
17f2cd01 | 305 | Add2ESDsList(h4, 4, expert) ; |
04236e67 | 306 | } |
307 | ||
308 | //____________________________________________________________________________ | |
309 | void AliTOFQADataMakerRec::MakeRaws(AliRawReader* rawReader) | |
310 | { | |
311 | // | |
312 | // makes data from Raws | |
313 | // | |
eca4fa66 | 314 | |
04236e67 | 315 | Double_t tdc2ns=AliTOFGeometry::TdcBinWidth()*1E-3; |
316 | Double_t tot2ns=AliTOFGeometry::ToTBinWidth()*1E-3; | |
317 | ||
17f2cd01 | 318 | Int_t nentries=0; |
319 | Int_t ntof[5]; /* 0=tot, 1=IA, 2=OA, 3=IC, 4=OC*/ | |
320 | for (Int_t j=0;j<5;j++){ ntof[j]=0;} | |
04236e67 | 321 | |
17f2cd01 | 322 | Int_t equipmentID[5]; //(ddl, trm, chain,tdc,channel) |
323 | Int_t volumeID[5]; //(sector,plate,strip,padX,padZ) | |
324 | Int_t volumeID2[5]; //(sector,plate,strip,padZ,padX) to use AliTOFGeometry::GetIndex() | |
325 | Int_t out[5]; // out=(indexZ,indexPhi) | |
326 | Int_t chIndex=-1; | |
04236e67 | 327 | |
328 | TClonesArray * clonesRawData; | |
329 | AliTOFRawStream tofInput(rawReader); | |
17f2cd01 | 330 | |
331 | //uncomment if needed to apply DeltaBC correction | |
332 | //tofInput.ApplyBCCorrections(kTRUE); | |
333 | ||
04236e67 | 334 | for (Int_t iDDL = 0; iDDL < AliTOFGeometry::NDDL()*AliTOFGeometry::NSectors(); iDDL++){ |
335 | rawReader->Reset(); | |
17f2cd01 | 336 | tofInput.LoadRawDataBuffers(iDDL); |
04236e67 | 337 | clonesRawData = (TClonesArray*)tofInput.GetRawData(); |
338 | for (Int_t iRawData = 0; iRawData<clonesRawData->GetEntriesFast(); iRawData++) { | |
17f2cd01 | 339 | nentries++; |
340 | AliTOFrawData *tofRawDatum = (AliTOFrawData*)clonesRawData->UncheckedAt(iRawData); | |
341 | ||
342 | if (tofRawDatum->GetTOF()){ | |
343 | ||
344 | equipmentID[0]=iDDL; | |
345 | equipmentID[1]=tofRawDatum->GetTRM(); | |
346 | equipmentID[2]=tofRawDatum->GetTRMchain(); | |
347 | equipmentID[3]=tofRawDatum->GetTDC(); | |
348 | equipmentID[4]=tofRawDatum->GetTDCchannel(); | |
349 | ||
32bd8225 | 350 | if (!CheckEquipID(equipmentID)) GetRawsData(17)->Fill(equipmentID[0]); |
17f2cd01 | 351 | else { |
352 | tofInput.EquipmentId2VolumeId(iDDL, | |
353 | tofRawDatum->GetTRM(), | |
354 | tofRawDatum->GetTRMchain(), | |
355 | tofRawDatum->GetTDC(), | |
356 | tofRawDatum->GetTDCchannel(), | |
357 | volumeID); | |
32bd8225 | 358 | if (FilterSpare(equipmentID)) continue; |
359 | if (FilterLTMData(equipmentID)) GetRawsData(15)->Fill(equipmentID[0]); | |
360 | else { | |
361 | if (!CheckVolumeID(volumeID)) GetRawsData(16)->Fill(equipmentID[0]); | |
362 | else { | |
363 | ||
17f2cd01 | 364 | GetMapIndeces(volumeID,out); |
365 | ||
366 | volumeID2[0]=volumeID[0]; | |
367 | volumeID2[1]=volumeID[1]; | |
368 | volumeID2[2]=volumeID[2]; | |
369 | volumeID2[3]=volumeID[4]; | |
370 | volumeID2[4]=volumeID[3]; | |
371 | chIndex=AliTOFGeometry::GetIndex(volumeID2); | |
372 | ||
373 | if (tofRawDatum->GetTOT()){ | |
32bd8225 | 374 | if (!(fCalibData->GetNoiseStatus(chIndex)==AliTOFChannelOnlineStatusArray::kTOFNoiseBad) |
375 | && (fCalibData->GetHWStatus(chIndex) == AliTOFChannelOnlineStatusArray::kTOFHWOk)) {//noise and enabled filter | |
17f2cd01 | 376 | ntof[0]++; //counter for tof hits |
377 | if (volumeID2[0]>4 && volumeID2[0]<14){ //I side | |
378 | if ((iDDL%4==0)|| (iDDL%4==1)){ //A side | |
379 | ntof[1]++; | |
380 | GetRawsData(5)->Fill( tofRawDatum->GetTOF()*tdc2ns) ;//in ns | |
381 | GetRawsData(9)->Fill( tofRawDatum->GetTOT()*tot2ns) ;//in ns | |
382 | } else { | |
383 | if ((iDDL%4==2)|| (iDDL%4==3)){//C side | |
384 | ntof[3]++; | |
385 | GetRawsData(7)->Fill( tofRawDatum->GetTOF()*tdc2ns) ;//in ns | |
386 | GetRawsData(11)->Fill( tofRawDatum->GetTOT()*tot2ns) ;//in ns | |
387 | } | |
388 | } | |
389 | } else { | |
390 | if (volumeID2[0]<5 || volumeID2[0]>13){ //O side | |
391 | if ((iDDL%4==0)|| (iDDL%4==1)){ //A side | |
392 | ntof[2]++; | |
393 | GetRawsData(6)->Fill( tofRawDatum->GetTOF()*tdc2ns) ;//in ns | |
394 | GetRawsData(10)->Fill( tofRawDatum->GetTOT()*tot2ns) ;//in ns | |
395 | } else { | |
396 | if ((iDDL%4==2)|| (iDDL%4==3)){//C side | |
397 | ntof[4]++; | |
398 | GetRawsData(8)->Fill( tofRawDatum->GetTOF()*tdc2ns) ;//in ns | |
399 | GetRawsData(12)->Fill( tofRawDatum->GetTOT()*tot2ns) ;//in ns | |
400 | } | |
401 | } | |
402 | } | |
403 | } | |
404 | //compute TRM offset | |
32bd8225 | 405 | Int_t trm= iDDL*10+(equipmentID[1]-3); |
17f2cd01 | 406 | if (iDDL>=0 && iDDL<36) GetRawsData(13)->Fill(trm) ;//in ns |
407 | if (iDDL>=36 && iDDL<72) GetRawsData(14)->Fill(trm) ;//in ns | |
32bd8225 | 408 | GetRawsData(22)->Fill( out[0],out[1]) ;//raw map |
17f2cd01 | 409 | |
410 | GetRawsData(20)->Fill(tofRawDatum->GetTOF()*tdc2ns,iDDL); | |
411 | GetRawsData(21)->Fill(tofRawDatum->GetTOT()*tot2ns,iDDL); | |
412 | ||
413 | }//noise filter | |
414 | }//end hit selection | |
415 | else { //orphans | |
32bd8225 | 416 | if (!(fCalibData->GetNoiseStatus(chIndex) == AliTOFChannelOnlineStatusArray::kTOFNoiseBad) |
417 | && (fCalibData->GetHWStatus(chIndex) == AliTOFChannelOnlineStatusArray::kTOFHWOk)) | |
418 | GetRawsData(18)->Fill( tofRawDatum->GetTOF()*tdc2ns) ;//in ns | |
17f2cd01 | 419 | }//end orphans |
32bd8225 | 420 | }//end volumeID check |
421 | }//end LTM filter | |
17f2cd01 | 422 | }//end equipID check |
423 | } | |
04236e67 | 424 | } // while loop |
425 | ||
426 | clonesRawData->Clear(); | |
04236e67 | 427 | } // DDL Loop |
428 | ||
17f2cd01 | 429 | for (Int_t j=0;j<5;j++){ |
430 | if(ntof[j]<=0) GetRawsData(j)->Fill(-1.) ; | |
431 | else GetRawsData(j)->Fill(ntof[j]); | |
04236e67 | 432 | } |
17f2cd01 | 433 | if (nentries<=0) GetRawsData(19)->Fill(-1.) ; |
434 | else GetRawsData(19)->Fill(nentries) ; | |
44ed7a66 | 435 | |
44ed7a66 | 436 | } |
437 | ||
44ed7a66 | 438 | //____________________________________________________________________________ |
04236e67 | 439 | void AliTOFQADataMakerRec::MakeRecPoints(TTree * clustersTree) |
440 | { | |
32bd8225 | 441 | // |
442 | // Make data from Clusters | |
443 | // | |
444 | ||
445 | Double_t tdc2ns=AliTOFGeometry::TdcBinWidth()*1E-3; | |
446 | Double_t tot2ns=AliTOFGeometry::ToTBinWidth()*1E-3; | |
447 | ||
448 | Int_t volumeID[5]; | |
449 | Int_t volumeID2[5]; | |
450 | Int_t out[5]; | |
451 | ||
452 | TBranch *branch=clustersTree->GetBranch("TOF"); | |
453 | if (!branch) { | |
454 | AliError("can't get the branch with the TOF clusters !"); | |
455 | return; | |
456 | } | |
457 | ||
458 | static TClonesArray dummy("AliTOFcluster",10000); | |
459 | dummy.Clear(); | |
460 | TClonesArray *clusters=&dummy; | |
461 | branch->SetAddress(&clusters); | |
462 | ||
463 | // Import the tree | |
464 | clustersTree->GetEvent(0); | |
465 | ||
466 | Int_t nentries=clusters->GetEntriesFast(); | |
467 | if(nentries<=0){ | |
468 | GetRecPointsData(0)->Fill(-1.) ; | |
469 | }else{ | |
470 | GetRecPointsData(0)->Fill(nentries) ; | |
471 | } | |
472 | ||
473 | TIter next(clusters) ; | |
474 | AliTOFcluster * c ; | |
475 | while ( (c = dynamic_cast<AliTOFcluster *>(next())) ) { | |
476 | ||
477 | volumeID[0] = c->GetDetInd(0); | |
478 | volumeID[1] = c->GetDetInd(1); | |
479 | volumeID[2] = c->GetDetInd(2); | |
480 | volumeID[3] = c->GetDetInd(4); //X and Z indeces inverted in RecPoints | |
481 | volumeID[4] = c->GetDetInd(3); //X and Z indeces inverted in RecPoints | |
482 | ||
483 | for (Int_t i=0;i<5;i++){ | |
484 | volumeID2[i]=c->GetDetInd(i); //X and Z indeces inverted in RecPoints | |
485 | } | |
486 | ||
487 | GetMapIndeces(volumeID,out); | |
488 | //Int_t chIndex=AliTOFGeometry::GetIndex(volumeID2); | |
489 | Int_t iDDL=AliTOFRawStream::Geant2DDL(volumeID2); | |
490 | ||
491 | if (c->GetTDCRAW() && c->GetTDC() && c->GetToT()){ | |
492 | if (volumeID2[0]>4 && volumeID2[0]<14){ //I side | |
493 | if ((iDDL%4==0)|| (iDDL%4==1)){ //A side | |
494 | GetRecPointsData(1)->Fill( c->GetTDC()*tdc2ns) ;//in ns | |
495 | GetRecPointsData(5)->Fill( c->GetTDCRAW()*tdc2ns) ;//in ns | |
496 | GetRecPointsData(9)->Fill( c->GetToT()*tot2ns) ;//in ns | |
497 | ||
498 | } else { | |
499 | if ((iDDL%4==2)|| (iDDL%4==3)){//C side | |
500 | GetRecPointsData(3)->Fill( c->GetTDC()*tdc2ns) ;//in ns | |
501 | GetRecPointsData(7)->Fill( c->GetTDCRAW()*tdc2ns) ;//in ns | |
502 | GetRecPointsData(11)->Fill( c->GetToT()*tot2ns) ;//in ns | |
503 | } | |
504 | } | |
505 | } else { | |
506 | if (volumeID2[0]<5 || volumeID2[0]>13){ //O side | |
507 | if ((iDDL%4==0)|| (iDDL%4==1)){ //A side | |
508 | GetRecPointsData(2)->Fill( c->GetTDC()*tdc2ns) ;//in ns | |
509 | GetRecPointsData(6)->Fill( c->GetTDCRAW()*tdc2ns) ;//in ns | |
510 | GetRecPointsData(10)->Fill( c->GetToT()*tot2ns) ;//in ns | |
511 | } else { | |
512 | if ((iDDL%4==2)|| (iDDL%4==3)){//C side | |
513 | GetRecPointsData(4)->Fill( c->GetTDC()*tdc2ns) ;//in ns | |
514 | GetRecPointsData(8)->Fill( c->GetTDCRAW()*tdc2ns) ;//in ns | |
515 | GetRecPointsData(12)->Fill( c->GetToT()*tot2ns) ;//in ns | |
516 | } | |
517 | } | |
518 | } | |
519 | } | |
520 | GetRecPointsData(13)->Fill(out[0],out[1]); | |
521 | ||
522 | } | |
523 | ||
524 | }//end while | |
525 | ||
526 | ||
04236e67 | 527 | } |
528 | ||
529 | //____________________________________________________________________________ | |
32bd8225 | 530 | void AliTOFQADataMakerRec::MakeESDs(AliESDEvent * const esd) |
04236e67 | 531 | { |
532 | // | |
533 | // make QA data from ESDs | |
534 | // | |
535 | Int_t ntrk = esd->GetNumberOfTracks() ; | |
536 | Int_t ntof=0; | |
537 | Int_t ntofpid=0; | |
538 | while (ntrk--) { | |
539 | AliESDtrack *track=esd->GetTrack(ntrk); | |
540 | Double_t tofTime=track->GetTOFsignal()*1E-3;//in ns | |
541 | Double_t tofTimeRaw=track->GetTOFsignalRaw()*1E-3;//in ns | |
542 | Double_t tofToT=track->GetTOFsignalToT(); //in ns | |
543 | if(!(tofTime>0))continue; | |
544 | ntof++; | |
545 | GetESDsData(1)->Fill(tofTime); | |
546 | GetESDsData(2)->Fill(tofTimeRaw); | |
547 | GetESDsData(3)->Fill(tofToT); | |
548 | //check how many tracks where ESD PID is ok | |
549 | UInt_t status=track->GetStatus(); | |
550 | if (((status&AliESDtrack::kESDpid)==0) || | |
551 | ((status&AliESDtrack::kTOFpid)==0)) continue; | |
552 | ntofpid++; | |
553 | } | |
554 | ||
555 | Int_t nentries=ntof; | |
556 | if(nentries<=0){ | |
557 | GetESDsData(0)->Fill(-1.) ; | |
558 | }else{ | |
559 | GetESDsData(0)->Fill(TMath::Log10(nentries)) ; | |
560 | } | |
561 | ||
17f2cd01 | 562 | if(ntof>0)GetESDsData(4)->Fill(ntofpid/ntof) ; |
563 | ||
04236e67 | 564 | } |
04236e67 | 565 | //____________________________________________________________________________ |
566 | void AliTOFQADataMakerRec::StartOfDetectorCycle() | |
567 | { | |
568 | // | |
569 | //Detector specific actions at start of cycle | |
570 | //to be implemented | |
17f2cd01 | 571 | |
572 | fCalibData = GetCalibData(); | |
573 | ||
04236e67 | 574 | } |
575 | ||
576 | //____________________________________________________________________________ | |
4e25ac79 | 577 | void AliTOFQADataMakerRec::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray ** list) |
04236e67 | 578 | { |
579 | //Detector specific actions at end of cycle | |
580 | // do the QA checking | |
17f2cd01 | 581 | |
4e25ac79 | 582 | AliQAChecker::Instance()->Run(AliQAv1::kTOF, task, list) ; |
04236e67 | 583 | } |
584 | //____________________________________________________________________________ | |
32bd8225 | 585 | void AliTOFQADataMakerRec::GetMapIndeces(const Int_t* const in , Int_t* out) |
04236e67 | 586 | { |
587 | // | |
588 | //return appropriate indeces for the theta-phi map | |
589 | // | |
590 | ||
591 | Int_t npadX = AliTOFGeometry::NpadX(); | |
592 | Int_t npadZ = AliTOFGeometry::NpadZ(); | |
593 | Int_t nStripA = AliTOFGeometry::NStripA(); | |
594 | Int_t nStripB = AliTOFGeometry::NStripB(); | |
595 | Int_t nStripC = AliTOFGeometry::NStripC(); | |
596 | ||
597 | Int_t isector = in[0]; | |
598 | Int_t iplate = in[1]; | |
599 | Int_t istrip = in[2]; | |
600 | Int_t ipadX = in[3]; | |
601 | Int_t ipadZ = in[4]; | |
602 | ||
603 | Int_t stripOffset = 0; | |
604 | switch (iplate) { | |
605 | case 0: | |
606 | stripOffset = 0; | |
607 | break; | |
608 | case 1: | |
609 | stripOffset = nStripC; | |
610 | break; | |
611 | case 2: | |
612 | stripOffset = nStripC+nStripB; | |
613 | break; | |
614 | case 3: | |
615 | stripOffset = nStripC+nStripB+nStripA; | |
616 | break; | |
617 | case 4: | |
618 | stripOffset = nStripC+nStripB+nStripA+nStripB; | |
619 | break; | |
620 | default: | |
17f2cd01 | 621 | AliDebug(1,Form("Wrong plate number in TOF (%d) !",iplate)); |
04236e67 | 622 | break; |
623 | }; | |
624 | Int_t zindex=npadZ*(istrip+stripOffset)+(ipadZ+1); | |
625 | Int_t phiindex=npadX*isector+ipadX+1; | |
626 | out[0]=zindex; | |
627 | out[1]=phiindex; | |
628 | ||
629 | } | |
17f2cd01 | 630 | //--------------------------------------------------------------- |
32bd8225 | 631 | Bool_t AliTOFQADataMakerRec::CheckVolumeID(const Int_t * const volumeID) |
17f2cd01 | 632 | { |
32bd8225 | 633 | // |
634 | //Checks volume ID validity | |
635 | // | |
17f2cd01 | 636 | |
637 | for (Int_t j=0;j<5;j++){ | |
638 | if (volumeID[j]<0) { | |
639 | AliDebug(1,Form("Invalid detector volume index for volumeID[%i]",j)); | |
640 | return kFALSE; | |
641 | } | |
642 | } | |
643 | return kTRUE; | |
644 | ||
645 | } | |
646 | ||
647 | //--------------------------------------------------------------- | |
32bd8225 | 648 | Bool_t AliTOFQADataMakerRec::CheckEquipID(const Int_t * const equipmentID) |
17f2cd01 | 649 | { |
32bd8225 | 650 | // |
651 | //Checks equipment ID validity | |
652 | ||
17f2cd01 | 653 | for (Int_t j=0;j<5;j++){ |
654 | if (equipmentID[j]<0) { | |
17f2cd01 | 655 | AliDebug(1,Form("Invalid equipment volume index for equipmentID[%i]",j)); |
656 | return kFALSE; | |
657 | } | |
658 | } | |
659 | return kTRUE; | |
660 | } | |
32bd8225 | 661 | //--------------------------------------------------------------- |
662 | Bool_t AliTOFQADataMakerRec::FilterLTMData(const Int_t * const equipmentID) const | |
663 | { | |
664 | /*It returns kTRUE if data come from LTM. | |
665 | It thus filter trigger-related signals */ | |
666 | ||
667 | Int_t ddl, trm, tdc; | |
668 | //if (!CheckEquipID(equipmentID)) return kFALSE; | |
669 | ddl = equipmentID[0]; | |
670 | trm = equipmentID[1]; | |
671 | tdc = equipmentID[3]; | |
672 | ||
673 | if ((ddl%2==1) && (trm==3) && (tdc>11 && tdc<15)) | |
674 | return kTRUE; | |
675 | else | |
676 | return kFALSE; | |
677 | ||
678 | } | |
679 | //--------------------------------------------------------------- | |
680 | Bool_t AliTOFQADataMakerRec::FilterSpare(const Int_t * const equipmentID) const | |
681 | { | |
682 | /*It returns kTRUE if data come from spare | |
683 | equipment ID. | |
684 | So far only check on TRM 3 crate left is implemented */ | |
685 | ||
686 | Int_t ddl, trm, tdc; | |
687 | //if (!CheckEquipID(equipmentID)) return kFALSE; | |
688 | ddl = equipmentID[0]; | |
689 | trm = equipmentID[1]; | |
690 | tdc = equipmentID[3]; | |
691 | ||
692 | if ((ddl%2==1) && (trm==3) && (tdc>2 && tdc<12)) | |
693 | return kTRUE; | |
694 | else | |
695 | return kFALSE; | |
696 | ||
697 | } |