]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TRD/AliTRDCalibChamberStatus.cxx
More Coverity stuff ..
[u/mrichter/AliRoot.git] / TRD / AliTRDCalibChamberStatus.cxx
CommitLineData
6c1053a8 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// AliTRDCalibChamberStatus: to determine which half chambers are off //
19// Produce a AliTRDCalChamberStatus calibration object //
20// Check with the AliTRDCalDCSFEE info //
21// //
22// //
23// Authors: //
24// J. Book (jbook@ikf.uni-frankfurt.de) //
25// R. Bailhache (rbailhache@ikf.uni-frankfurt.de) //
26// //
27////////////////////////////////////////////////////////////////////////////
28
29
30//Root includes
31#include <THnSparse.h>
32
33#include <TDirectory.h>
34#include <TFile.h>
fd50bb14 35#include <TAxis.h>
36#include <TH2F.h>
37#include <TStyle.h>
38#include <TCanvas.h>
6c1053a8 39
40//AliRoot includes
41#include "AliRawReader.h"
42
43//header file
44#include "AliLog.h"
45#include "AliTRDCalibChamberStatus.h"
46#include "AliTRDgeometry.h"
fd50bb14 47#include "AliTRDfeeParam.h"
6c1053a8 48#include "AliTRDdigitsManager.h"
49#include "AliTRDSignalIndex.h"
50#include "AliTRDrawFastStream.h"
fd50bb14 51#include "AliTRDpadPlane.h"
6c1053a8 52#include "./Cal/AliTRDCalChamberStatus.h"
53#include "./Cal/AliTRDCalDCS.h"
54#include "./Cal/AliTRDCalDCSFEE.h"
55
fd50bb14 56#include "AliTRDrawStream.h"
57
6c1053a8 58#ifdef ALI_DATE
59#include "event.h"
60#endif
61
62ClassImp(AliTRDCalibChamberStatus) /*FOLD00*/
63
64//_____________________________________________________________________
65AliTRDCalibChamberStatus::AliTRDCalibChamberStatus() : /*FOLD00*/
66 TObject(),
67 fDetector(-1),
68 fNumberOfTimeBins(0),
69 fCounterEventNotEmpty(0),
70 fCalChamberStatus(0x0),
71 fHnSparseI(0x0),
72 fHnSparseHCM(0x0),
73 fHnSparseEvtDet(0x0),
74 fHnSparseDebug(0x0),
75 fHnSparseMCM(0x0),
fd50bb14 76 fC1(0x0),
6c1053a8 77 fDebugLevel(0)
78{
79 //
80 // default constructor
81 //
82
83}
84//_____________________________________________________________________
85AliTRDCalibChamberStatus::AliTRDCalibChamberStatus(const AliTRDCalibChamberStatus &ped) : /*FOLD00*/
86 TObject(ped),
87 fDetector(ped.fDetector),
88 fNumberOfTimeBins(ped.fNumberOfTimeBins),
89 fCounterEventNotEmpty(ped.fCounterEventNotEmpty),
90 fCalChamberStatus(ped.fCalChamberStatus),
91 fHnSparseI(ped.fHnSparseI),
92 fHnSparseHCM(ped.fHnSparseHCM),
93 fHnSparseEvtDet(ped.fHnSparseEvtDet),
94 fHnSparseDebug(ped.fHnSparseDebug),
95 fHnSparseMCM(ped.fHnSparseMCM),
fd50bb14 96 fC1(ped.fC1),
6c1053a8 97 fDebugLevel(ped.fDebugLevel)
98{
99 //
100 // copy constructor
101 //
102
103}
104//_____________________________________________________________________
105AliTRDCalibChamberStatus& AliTRDCalibChamberStatus::operator = (const AliTRDCalibChamberStatus &source)
106{
107 //
108 // assignment operator
109 //
110 if (&source == this) return *this;
111 new (this) AliTRDCalibChamberStatus(source);
112
113 return *this;
114}
115//_____________________________________________________________________
116AliTRDCalibChamberStatus::~AliTRDCalibChamberStatus() /*FOLD00*/
117{
118 //
119 // destructor
120 //
121 if(fCalChamberStatus){
122 delete fCalChamberStatus;
123 }
124 if(fHnSparseI) {
125 delete fHnSparseI;
126 }
127 if(fHnSparseHCM) {
128 delete fHnSparseHCM;
129 }
130 if(fHnSparseEvtDet) {
131 delete fHnSparseEvtDet;
132 }
133 if(fHnSparseDebug) {
134 delete fHnSparseDebug;
135 }
136 if(fHnSparseMCM) {
137 delete fHnSparseMCM;
fd50bb14 138 }
139 if(fC1) {
140 delete fC1;
141 }
6c1053a8 142}
143
144//_____________________________________________________________________
145void AliTRDCalibChamberStatus::Init()
146{
147 //
148 // Init the different THnSparse
149 //
150 //
151
152 //
153 // Init the fHnSparseI
154 //
155
156 //create the map
157 Int_t thnDimEvt[4]; // sm, layer, stack, halfchamber
158 thnDimEvt[0] = 18;
159 thnDimEvt[1] = 6;
160 thnDimEvt[2] = 5;
161 thnDimEvt[3] = 2;
162 //arrays for lower bounds :
163 Double_t* binEdgesEvt[4];
164 for(Int_t ivar = 0; ivar < 4; ivar++)
165 binEdgesEvt[ivar] = new Double_t[thnDimEvt[ivar] + 1];
166 //values for bin lower bounds
167 for(Int_t i=0; i<=thnDimEvt[0]; i++) binEdgesEvt[0][i]= 0.0 + (18.0)/thnDimEvt[0]*(Double_t)i;
168 for(Int_t i=0; i<=thnDimEvt[1]; i++) binEdgesEvt[1][i]= 0.0 + (6.0)/thnDimEvt[1]*(Double_t)i;
169 for(Int_t i=0; i<=thnDimEvt[2]; i++) binEdgesEvt[2][i]= 0.0 + (5.0)/thnDimEvt[2]*(Double_t)i;
170 for(Int_t i=0; i<=thnDimEvt[3]; i++) binEdgesEvt[3][i]= 0.0 + (2.0)/thnDimEvt[3]*(Double_t)i;
171
172 //create the THnSparse
173 fHnSparseI = new THnSparseI("NumberOfEntries","NumberOfEntries",4,thnDimEvt);
174 for (int k=0; k<4; k++) {
175 fHnSparseI->SetBinEdges(k,binEdgesEvt[k]);
176 }
177 fHnSparseI->Sumw2();
178
179 //
180 // Init the fHnSparseHCM (THnSparseI)
181 //
182
183 //create the THnSparse
184 fHnSparseHCM = new THnSparseI("HCMerrors","HCMerrors",4,thnDimEvt);
185 for (int k=0; k<4; k++) {
186 fHnSparseHCM->SetBinEdges(k,binEdgesEvt[k]);
187 }
188 fHnSparseHCM->Sumw2();
189
190
191 //---------//
192 // Debug //
193 if(fDebugLevel > 0) {
194
195 //
196 // Init the fHnSparseEvtDet (THnSparseI)
197 //
198
199 //create the map
200 Int_t thnDimEvts[3]; // event, detector, halfchamber
201 thnDimEvts[0] = 10000;
202 thnDimEvts[1] = 540;
203 thnDimEvts[2] = 2;
204 //arrays for lower bounds :
205 Double_t* binEdgesEvts[3];
206 for(Int_t ivar = 0; ivar < 3; ivar++)
207 binEdgesEvts[ivar] = new Double_t[thnDimEvts[ivar] + 1];
208 //values for bin lower bounds
209 for(Int_t i=0; i<=thnDimEvts[0]; i++) binEdgesEvts[0][i]= 0.0 + (10000.0)/thnDimEvts[0]*(Double_t)i;
210 for(Int_t i=0; i<=thnDimEvts[1]; i++) binEdgesEvts[1][i]= 0.0 + (540.0)/thnDimEvts[1]*(Double_t)i;
211 for(Int_t i=0; i<=thnDimEvts[2]; i++) binEdgesEvts[2][i]= 0.0 + (2.0)/thnDimEvts[2]*(Double_t)i;
212
213 //create the THnSparse
214 fHnSparseEvtDet = new THnSparseI("NumberOfEntriesPerEvent","NumberOfEntriesPerEvent",3,thnDimEvts);
215 for (int k=0; k<3; k++) {
216 fHnSparseEvtDet->SetBinEdges(k,binEdgesEvts[k]);
217 }
218 fHnSparseEvtDet->Sumw2();
219
220 //
221 // Init the fHnSparseDebug (THnSparseI)
222 //
223
224 //create the THnSparse
225 fHnSparseDebug = new THnSparseI("NumberOfDifferentDecisions","NumberOfDifferentDecisions",4,thnDimEvt);
226 for (int k=0; k<4; k++) {
227 fHnSparseDebug->SetBinEdges(k,binEdgesEvt[k]);
228 }
229 fHnSparseDebug->Sumw2();
230
231 //
232 // Init the fHnSparseMCM (THnSparseI)
233 //
234
235 //create the map
236 Int_t thnDimEvtt[6]; // sm, layer, stack, ROB, MCM
237 thnDimEvtt[0] = 18;
238 thnDimEvtt[1] = 6;
239 thnDimEvtt[2] = 5;
240 thnDimEvtt[3] = 8;
fd50bb14 241 thnDimEvtt[4] = 18;
242 thnDimEvtt[5] = 18;
6c1053a8 243 //arrays for lower bounds :
244 Double_t* binEdgesEvtt[6];
245 for(Int_t ivar = 0; ivar < 6; ivar++)
246 binEdgesEvtt[ivar] = new Double_t[thnDimEvtt[ivar] + 1];
247 //values for bin lower bounds
248 for(Int_t i=0; i<=thnDimEvtt[0]; i++) binEdgesEvtt[0][i]= 0.0 + (18.0)/thnDimEvtt[0]*(Double_t)i;
249 for(Int_t i=0; i<=thnDimEvtt[1]; i++) binEdgesEvtt[1][i]= 0.0 + (6.0)/thnDimEvtt[1]*(Double_t)i;
250 for(Int_t i=0; i<=thnDimEvtt[2]; i++) binEdgesEvtt[2][i]= 0.0 + (5.0)/thnDimEvtt[2]*(Double_t)i;
251 for(Int_t i=0; i<=thnDimEvtt[3]; i++) binEdgesEvtt[3][i]= 0.0 + (8.0)/thnDimEvtt[3]*(Double_t)i;
fd50bb14 252 for(Int_t i=0; i<=thnDimEvtt[4]; i++) binEdgesEvtt[4][i]= 0.0 + (18.0)/thnDimEvtt[4]*(Double_t)i;
253 for(Int_t i=0; i<=thnDimEvtt[5]; i++) binEdgesEvtt[5][i]= 0.0 + (18.0)/thnDimEvtt[5]*(Double_t)i;
6c1053a8 254
255 //create the THnSparse
256 fHnSparseMCM = new THnSparseI("MCMerrorDCS","MCMerrorDCS",6,thnDimEvtt);
257 for (int k=0; k<6; k++) {
258 fHnSparseMCM->SetBinEdges(k,binEdgesEvtt[k]);
259 }
260 fHnSparseMCM->Sumw2();
261
262 }
263 // Debug //
264 //---------//
265
266}
267//_____________________________________________________________________
268void AliTRDCalibChamberStatus::ProcessEvent(AliRawReader * rawReader, Int_t nevents_physics)
269{
270 //
271 // Event Processing loop
272 //
273 //
274
275 Bool_t notEmpty = kFALSE;
276
277 AliTRDrawFastStream *rawStream = new AliTRDrawFastStream(rawReader);
fdc15553 278 if (!rawStream) return;
1a278748 279 rawStream->SetNoErrorWarning();
6c1053a8 280 rawStream->SetSharedPadReadout(kFALSE);
281
282 AliTRDdigitsManager *digitsManager = new AliTRDdigitsManager(kTRUE);
283 digitsManager->CreateArrays();
284
fd50bb14 285 Int_t det = 0;
286 while ((det = rawStream->NextChamber(digitsManager, NULL, NULL)) >= 0) {
287
288 //nextchamber loop
289
290 // do the QA analysis
291 if (digitsManager->GetIndexes(det)->HasEntry()) {//QA
292 // printf("there is ADC data on this chamber!\n");
293
294 AliTRDSignalIndex *indexes = digitsManager->GetIndexes(det);
295 if (indexes->IsAllocated() == kFALSE) {
296 // AliError("Indexes do not exist!");
297 break;
298 }
299
300 Int_t iRow = 0;
301 Int_t iCol = 0;
302 indexes->ResetCounters();
303
304 while (indexes->NextRCIndex(iRow, iCol)){
305 Int_t iMcm = (Int_t)(iCol/18); // current group of 18 col pads
306
307 Int_t layer = AliTRDgeometry::GetLayer(det);
308 Int_t sm = AliTRDgeometry::GetSector(det);
309 Int_t stac = AliTRDgeometry::GetStack(det);
310 Double_t rphi = 0.5;
311 if(iMcm > 3) rphi = 1.5;
312
313 Double_t val[4] = {sm,layer,stac,rphi};
314 fHnSparseI->Fill(&val[0]);
315 notEmpty = kTRUE;
316
317 //---------//
318 // Debug //
319 if(fDebugLevel > 0) {
320 Int_t detector = AliTRDgeometry::GetDetector(layer,stac,sm);
321 Double_t valu[3] = {nevents_physics,detector,rphi};
322 fHnSparseEvtDet->Fill(&valu[0]);
323 }
324 // Debug //
325 //---------//
326 }
327
328 }
329 digitsManager->ClearArrays(det);
330 }
331
332 if(notEmpty) fCounterEventNotEmpty++;
333
334 if(digitsManager) delete digitsManager;
335 if(rawStream) delete rawStream;
336
337}//_____________________________________________________________________
338void AliTRDCalibChamberStatus::ProcessEvent3(AliRawReader * rawReader, Int_t nevents_physics)
339{
340 //
341 // Event Processing loop with AliTRDrawStream
342 //
343 //
344
345 Bool_t notEmpty = kFALSE;
346
347 AliTRDdigitsManager *digitsManager = new AliTRDdigitsManager(kTRUE);
348 digitsManager->CreateArrays();
349
350 AliTRDrawStream *rawStream = new AliTRDrawStream(rawReader);
351 rawStream->SetDigitsManager(digitsManager);
352 // rawStream->SetNoErrorWarning();
353 // rawStream->SetSharedPadReadout(kFALSE);
354
355
6c1053a8 356 Int_t det = 0;
357 while ((det = rawStream->NextChamber(digitsManager, NULL, NULL)) >= 0) {
358
359 //nextchamber loop
360
361 // do the QA analysis
362 if (digitsManager->GetIndexes(det)->HasEntry()) {//QA
363 // printf("there is ADC data on this chamber!\n");
364
365 AliTRDSignalIndex *indexes = digitsManager->GetIndexes(det);
366 if (indexes->IsAllocated() == kFALSE) {
367 // AliError("Indexes do not exist!");
368 break;
369 }
370
371 Int_t iRow = 0;
372 Int_t iCol = 0;
373 indexes->ResetCounters();
374
375 while (indexes->NextRCIndex(iRow, iCol)){
376 Int_t iMcm = (Int_t)(iCol/18); // current group of 18 col pads
377
378 Int_t layer = AliTRDgeometry::GetLayer(det);
379 Int_t sm = AliTRDgeometry::GetSector(det);
380 Int_t stac = AliTRDgeometry::GetStack(det);
381 Double_t rphi = 0.5;
382 if(iMcm > 3) rphi = 1.5;
383
384 Double_t val[4] = {sm,layer,stac,rphi};
385 fHnSparseI->Fill(&val[0]);
386 notEmpty = kTRUE;
387
388 //---------//
389 // Debug //
390 if(fDebugLevel > 0) {
391 Int_t detector = AliTRDgeometry::GetDetector(layer,stac,sm);
392 Double_t valu[3] = {nevents_physics,detector,rphi};
393 fHnSparseEvtDet->Fill(&valu[0]);
394 }
395 // Debug //
396 //---------//
397 }
398
399 }
400 digitsManager->ClearArrays(det);
401 }
402
403 if(notEmpty) fCounterEventNotEmpty++;
404
405 if(digitsManager) delete digitsManager;
fdc15553 406 delete rawStream;
6c1053a8 407
408}
409//_____________________________________________________________________
410Bool_t AliTRDCalibChamberStatus::TestEventHisto(Int_t nevent) /*FOLD00*/
411{
412 //
413 // Test event loop
414 // fill the fHnSparseI with entries
415 //
416
417 AliTRDgeometry geo;
418
419
420 for(Int_t ievent=0; ievent<nevent; ievent++){
421 for (Int_t ism=0; ism<18; ism++){
422 for (Int_t istack=0; istack<5; istack++){
423 for (Int_t ipl=0; ipl<6; ipl++){
424 for (Int_t icol=0; icol<geo.GetColMax(ipl); icol++){
425 Int_t side = 0;
426 if(icol > 72) side = 1;
427 Double_t val[4] = {ism,ipl,istack,side};
428 fHnSparseI->Fill(&val[0]);
429 }
430 }
431 }
432 }
433 }
434
435 return kTRUE;
436
437}
438//_____________________________________________________________________
439void AliTRDCalibChamberStatus::AnalyseHisto() /*FOLD00*/
440{
fd50bb14 441 //
442 // Create the AliTRDCalChamberStatus according to the fHnSparseI
443 //
444
6c1053a8 445 if(fCalChamberStatus) delete fCalChamberStatus;
446 fCalChamberStatus = new AliTRDCalChamberStatus();
447
448 // Check if enough events to say something
fd50bb14 449 if(fCounterEventNotEmpty < 200) {
6c1053a8 450 // Say all installed
451 for (Int_t ism=0; ism<18; ism++) {
452 for (Int_t ipl=0; ipl<6; ipl++) {
453 for (Int_t istack=0; istack<5; istack++) {
454 // layer, stack, sector
455 Int_t det = AliTRDgeometry::GetDetector(ipl,istack,ism);
456 fCalChamberStatus->SetStatus(det,1);
457 }
458 }
459 }
460 return;
461 }
462
463 // Mask out all chambers
464 for (Int_t ism=0; ism<18; ism++) {
465 for (Int_t ipl=0; ipl<6; ipl++) {
466 for (Int_t istack=0; istack<5; istack++) {
467 // layer, stack, sector
468 Int_t det = AliTRDgeometry::GetDetector(ipl,istack,ism);
469 fCalChamberStatus->SetStatus(det,2);
470 }
471 }
472 }
473
474 // Unmask good chambers
475 Int_t coord[4];
476 for(Int_t bin = 0; bin < fHnSparseI->GetNbins(); bin++) {
477
478 fHnSparseI->GetBinContent(bin,coord);
479 // layer, stack, sector
480 Int_t detector = AliTRDgeometry::GetDetector(coord[1]-1,coord[2]-1,coord[0]-1);
481
482 //
483 // Check which halfchamber side corresponds to the bin number (0=A, 1=B)
484 // Change the status accordingly
485 //
486
487 switch(fCalChamberStatus->GetStatus(detector))
488 {
489 case 1: break; // no changes
490 case 2:
491 if(coord[3]-1==0) {
492 fCalChamberStatus->SetStatus(detector,4); break; // only SideB is masked
493 }
494 else {
495 fCalChamberStatus->SetStatus(detector,3); break; // only SideA is masked
496 }
497 case 3: fCalChamberStatus->SetStatus(detector,1); break; // unmask SideA
498 case 4: fCalChamberStatus->SetStatus(detector,1); break; // unmask SideB
499 }
500 }
501
502
503}
504//_____________________________________________________________________
505void AliTRDCalibChamberStatus::CheckEORStatus(AliTRDCalDCS *calDCS) /*FOLD00*/
506{
507 //
508 // Correct the AliTRDCalChamberStatus according to the AliTRDCalDCS
509 // Using globale state of the HalfChamberMerger (HCM)
510 //
6c1053a8 511 for(Int_t det = 0; det < 540; det++) {
512 AliTRDCalDCSFEE* calDCSFEEEOR = calDCS->GetCalDCSFEEObj(det);
fd50bb14 513
514 if(!calDCSFEEEOR) continue;
6c1053a8 515
516 // MCM Global State Machine State Definitions
517 // low_power = 0,
518 // test = 1,
519 // wait_pre = 3,
520 // preproc = 7,
521 // zero_sp = 8,
522 // full_rd = 9,
523 // clear_st = 11,
524 // wait_L1 = 12,
525 // tr_send = 14,
526 // tr_proc = 15
527
528 Int_t sm = AliTRDgeometry::GetSector(det);
529 Int_t lay = AliTRDgeometry::GetLayer(det);
530 Int_t stac = AliTRDgeometry::GetStack(det);
531
fd50bb14 532 Int_t stateA = 0; // 0=bad, 1=good state
533 Int_t stateB = 0;
534
535 // loop over all mcm to define DCS-HCS
536 for(Int_t ii = 0; ii < 8; ii++) { //ROB loop
537 for(Int_t i = 0; i < 18; i++) { //MCM loop
538
539 Int_t side = ii%2; // 0=sideA, 1=sideB
540 Int_t cstate = calDCSFEEEOR->GetMCMGlobalState(ii,i); //current mcm state
541
542 if(cstate==3) {
543 switch(side) {
544 case 0: stateA=1; break;
545 case 1: stateB=1; break;
546 }
547 }
548 }
549 }
1a278748 550
6c1053a8 551 //---------//
552 // Debug //
553 if(fDebugLevel > 0) {
fd50bb14 554 if( ((fCalChamberStatus->GetStatus(det) <= 1) && (stateA==0 || stateB==0)) ||
555 ((fCalChamberStatus->GetStatus(det) == 2) && (stateA==1 || stateB==1)) ||
556 ((fCalChamberStatus->GetStatus(det) == 3) && (stateA==1 || stateB==0)) ||
557 ((fCalChamberStatus->GetStatus(det) == 4) && (stateB==0 || stateB==1)) )
6c1053a8 558 {
559 //printf(" Different half chamber status in DCS and DATA!!\n");
560 Double_t val[4] = {sm,lay,stac,1};
561 fHnSparseDebug->Fill(&val[0]);
562
fd50bb14 563 // Fill MCM status map
564 for(Int_t ii = 0; ii < 8; ii++) { //ROB loop
565 for(Int_t i = 0; i < 18; i++) { //MCM loop
566 Double_t valss[6] = {sm,lay,stac,ii,i
567 ,calDCSFEEEOR->GetMCMGlobalState(ii,i)};
568 fHnSparseMCM->Fill(&valss[0]);
569
6c1053a8 570 }
571 }
572 }
573 }
574 //---------//
575 // Debug //
1a278748 576
fd50bb14 577 //---------------------------------------
1a278748 578 // Change the status according to DCS
fd50bb14 579 //---------------------------------------
580 Int_t StatusData = fCalChamberStatus->GetStatus(det);
581 switch(StatusData)
582 {
583 case 1:
584 if(stateA==0 && stateB==0) fCalChamberStatus->SetStatus(det,2); // completely masked from DCS
585 if(stateA==1 && stateB==0) fCalChamberStatus->SetStatus(det,4); // Only B side masked from DCS
586 if(stateA==0 && stateB==1) fCalChamberStatus->SetStatus(det,3); // Only A side masked from DCS
587 if(stateA==1 && stateB==1) fCalChamberStatus->SetStatus(det,1);
588 break;
589 case 2: // completely masked from DATA
590 if(stateA==0 && stateB==0) fCalChamberStatus->SetStatus(det,2); // completely masked from DCS
591 break;
592 case 3: // Only A side masked from DATA
593 if(stateA==0 && stateB==0) fCalChamberStatus->SetStatus(det,2); // completely masked from DCS
594 if(stateA==1 && stateB==0) fCalChamberStatus->SetStatus(det,2); // Only B side masked from DCS
595 if(stateA==0 && stateB==1) fCalChamberStatus->SetStatus(det,3); // Only A side masked from DCS
596 if(stateA==1 && stateB==1) fCalChamberStatus->SetStatus(det,3);
597 break;
598 case 4: // Only B side masked from DATA
599 if(stateA==0 && stateB==0) fCalChamberStatus->SetStatus(det,2); // completely masked from DCS
600 if(stateA==1 && stateB==0) fCalChamberStatus->SetStatus(det,4); // Only B side masked from DCS
601 if(stateA==0 && stateB==1) fCalChamberStatus->SetStatus(det,2); // Only A side masked from DCS
602 if(stateA==1 && stateB==1) fCalChamberStatus->SetStatus(det,4);
603 break;
1a278748 604 }
1a278748 605
6c1053a8 606 }
607
608}
609
610//_____________________________________________________________________________________
611void AliTRDCalibChamberStatus::Add(AliTRDCalibChamberStatus *calibChamberStatus) /*FOLD00*/
612{
613 //
614 // Add the THnSparseI of this calibChamberStatus
615 //
616
617 fCounterEventNotEmpty += calibChamberStatus->GetNumberEventNotEmpty();
618
619 THnSparseI *hnSparseI = calibChamberStatus->GetSparseI();
620 if(!hnSparseI) return;
621
622 if(!fHnSparseI) {
623 fHnSparseI = (THnSparseI *) hnSparseI->Clone();
624 }
625 else {
626 fHnSparseI->Add(hnSparseI);
627 }
628
629
630}
631//_____________________________________________________________________
632void AliTRDCalibChamberStatus::DumpToFile(const Char_t *filename, const Char_t *dir, Bool_t append) /*FOLD00*/
633{
634 //
635 // Write class to file
636 //
637
638 TString sDir(dir);
639 TString option;
640
641 if ( append )
642 option = "update";
643 else
644 option = "recreate";
645
646 TDirectory *backup = gDirectory;
647 TFile f(filename,option.Data());
648 f.cd();
649 if ( !sDir.IsNull() ){
650 f.mkdir(sDir.Data());
651 f.cd(sDir);
652 }
653 this->Write();
654 f.Close();
655
656 if ( backup ) backup->cd();
657}
fd50bb14 658//_____________________________________________________________________________
659TH2D* AliTRDCalibChamberStatus::PlotSparseI(Int_t sm,Int_t side)
660{
661 //
662 // Plot number of entries for supermodule sm
663 // as a function of layer and stack
664 //
665
666 if(!fHnSparseI) return 0x0;
667
668 fHnSparseI->GetAxis(0)->SetRange(sm+1,sm+1);
669 fHnSparseI->GetAxis(3)->SetRange(side+1,side+1);
670 TH2D *h2 = fHnSparseI->Projection(1,2);
671
672
673 return h2;
674
675}
676//_____________________________________________________________________
677TH2F *AliTRDCalibChamberStatus::MakeHisto2DSmPlEORStatus(AliTRDCalDCS *calDCS, Int_t sm, Int_t pl) /*FOLD00*/
678{
679 //
680 // Plot globale state of the HalfChamberMerger (HCM)
681 //
682 AliTRDfeeParam *paramfee = AliTRDfeeParam::Instance();
683
684 AliTRDgeometry *trdGeo = new AliTRDgeometry();
685 AliTRDpadPlane *padPlane0 = trdGeo->GetPadPlane(pl,0); // layer,stack
686 Double_t row0 = padPlane0->GetRow0();
687 Double_t col0 = padPlane0->GetCol0();
6c1053a8 688
fd50bb14 689 char name[1000];
690 sprintf(name,"%s DCS status sm %d pl %d",GetTitle(),sm,pl);
691 TH2F * his = new TH2F( name, name, 88,-TMath::Abs(row0),TMath::Abs(row0)
692 ,148,-TMath::Abs(col0),TMath::Abs(col0));
693
694
695 // Where we begin
696 Int_t offsetsmpl = 30*sm+pl;
697 Int_t nstack = 5;
698 Int_t ncols = 144;
699
700 for (Int_t k = 0; k < nstack; k++){
701 Int_t det = offsetsmpl+k*6;
702 Int_t stac = AliTRDgeometry::GetStack(det);
703 AliTRDCalDCSFEE* calDCSFEEEOR = calDCS->GetCalDCSFEEObj(det);
704 if(!calDCSFEEEOR) { continue;}
705 for (Int_t icol=0; icol<ncols; icol++){
706 Int_t nrows = 16;
707 if(stac==2) nrows = 12;
708 for (Int_t irow=0; irow<nrows; irow++){
709 Int_t binz = 0;
710 Int_t kb = 5-1-k;
711 Int_t krow = nrows-1-irow;
712 Int_t kcol = ncols-1-icol;
713 if(kb > 2) binz = 16*(kb-1)+12+krow+1+2*(kb+1);
714 else binz = 16*kb+krow+1+2*(kb+1);
715 Int_t biny = kcol+1+2;
716 // Take the value
717 Int_t mcm = paramfee->GetMCMfromPad(irow,icol);
718 Int_t rob = paramfee->GetROBfromPad(irow,icol);
719 Int_t state = calDCSFEEEOR->GetMCMGlobalState(rob,mcm);
720 his->SetBinContent(binz,biny,state);
721 }
722 }
723 for(Int_t icol = 1; icol < 147; icol++){
724 for(Int_t l = 0; l < 2; l++){
725 Int_t binz = 0;
726 Int_t kb = 5-1-k;
727 if(kb > 2) binz = 16*(kb-1)+12+1+2*(kb+1)-(l+1);
728 else binz = 16*kb+1+2*(kb+1)-(l+1);
729 his->SetBinContent(binz,icol,16.0);
730 }
731 }
732 }
733
734 for(Int_t icol = 1; icol < 147; icol++){
735 his->SetBinContent(88,icol,16.0);
736 his->SetBinContent(87,icol,16.0);
737 }
738 for(Int_t irow = 1; irow < 89; irow++){
739 his->SetBinContent(irow,1,16.0);
740 his->SetBinContent(irow,2,16.0);
741 his->SetBinContent(irow,147,16.0);
742 his->SetBinContent(irow,148,16.0);
743 }
744
745 his->SetXTitle("z (cm)");
746 his->SetYTitle("y (cm)");
747 his->SetMaximum(12);
748 his->SetMinimum(0.0);
749 his->SetStats(0);
750
751 return his;
752
753}
754//_____________________________________________________________________________
755TCanvas* AliTRDCalibChamberStatus::PlotHistos2DSmEORStatus(AliTRDCalDCS *calDCS, Int_t sm, const Char_t *name)
756{
757 //
758 // Make 2D graph
759 //
760
761 gStyle->SetPalette(1);
762 fC1 = new TCanvas(name,name,50,50,600,800);
763 fC1->Divide(3,2);
764 fC1->cd(1);
765 MakeHisto2DSmPlEORStatus(calDCS,sm,0)->Draw("colz");
766 fC1->cd(2);
767 MakeHisto2DSmPlEORStatus(calDCS,sm,1)->Draw("colz");
768 fC1->cd(3);
769 MakeHisto2DSmPlEORStatus(calDCS,sm,2)->Draw("colz");
770 fC1->cd(4);
771 MakeHisto2DSmPlEORStatus(calDCS,sm,3)->Draw("colz");
772 fC1->cd(5);
773 MakeHisto2DSmPlEORStatus(calDCS,sm,4)->Draw("colz");
774 fC1->cd(6);
775 MakeHisto2DSmPlEORStatus(calDCS,sm,5)->Draw("colz");
776
777 return fC1;
778
779}
dc67f7d2 780
781