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