Correct implementation of SM, chamber, pad, and MCM status in digitization
[u/mrichter/AliRoot.git] / TRD / Cal / AliTRDCalMCMStatus.cxx
CommitLineData
7754cd1f 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/* $Id$ */
17
18///////////////////////////////////////////////////////////////////////////////
19// //
20// TRD calibration class for MCM status //
21// //
22///////////////////////////////////////////////////////////////////////////////
23
24#include "AliTRDCalMCMStatus.h"
2745a409 25#include "AliTRDgeometry.h"
7754cd1f 26#include "AliTRDCalSingleChamberStatus.h"
27
28ClassImp(AliTRDCalMCMStatus)
29
30//_____________________________________________________________________________
6bf5f0ce 31AliTRDCalMCMStatus::AliTRDCalMCMStatus()
32 :TNamed()
7754cd1f 33{
34 //
35 // AliTRDCalMCMStatus default constructor
36 //
37
38 for (Int_t idet = 0; idet < kNdet; idet++) {
39 fROC[idet] = 0;
40 }
41
42}
43
44//_____________________________________________________________________________
45AliTRDCalMCMStatus::AliTRDCalMCMStatus(const Text_t *name, const Text_t *title)
6bf5f0ce 46 :TNamed(name,title)
7754cd1f 47{
48 //
49 // AliTRDCalMCMStatus constructor
50 //
51
52 for (Int_t isec = 0; isec < kNsect; isec++) {
53 for (Int_t ipla = 0; ipla < kNplan; ipla++) {
54 for (Int_t icha = 0; icha < kNcham; icha++) {
55 Int_t idet = AliTRDgeometry::GetDetector(ipla,icha,isec);
56 fROC[idet] = new AliTRDCalSingleChamberStatus(ipla,icha,8);
57 }
58 }
59 }
60
61}
62
7754cd1f 63//_____________________________________________________________________________
6bf5f0ce 64AliTRDCalMCMStatus::AliTRDCalMCMStatus(const AliTRDCalMCMStatus &c)
65 :TNamed(c)
7754cd1f 66{
67 //
68 // AliTRDCalMCMStatus copy constructor
69 //
70
71 ((AliTRDCalMCMStatus &) c).Copy(*this);
72
73}
74
75///_____________________________________________________________________________
76AliTRDCalMCMStatus::~AliTRDCalMCMStatus()
77{
78 //
79 // AliTRDCalMCMStatus destructor
80 //
81
82 for (Int_t idet = 0; idet < kNdet; idet++) {
83 if (fROC[idet]) {
84 delete fROC[idet];
85 fROC[idet] = 0;
86 }
87 }
88
89}
90
91//_____________________________________________________________________________
92AliTRDCalMCMStatus &AliTRDCalMCMStatus::operator=(const AliTRDCalMCMStatus &c)
93{
94 //
95 // Assignment operator
96 //
97
6bf5f0ce 98 if (this != &c) {
99 ((AliTRDCalMCMStatus &) c).Copy(*this);
100 }
101
7754cd1f 102 return *this;
103
104}
105
106//_____________________________________________________________________________
107void AliTRDCalMCMStatus::Copy(TObject &c) const
108{
109 //
110 // Copy function
111 //
112
113 for (Int_t idet = 0; idet < kNdet; idet++) {
114 if (fROC[idet]) {
115 fROC[idet]->Copy(*((AliTRDCalMCMStatus &) c).fROC[idet]);
116 }
117 }
118
119 TObject::Copy(c);
2745a409 120
7754cd1f 121}
122
2745a409 123//_____________________________________________________________________________
124Bool_t AliTRDCalMCMStatus::CheckStatus(Int_t d, Int_t col, Int_t row, Int_t bitMask) const
125{
126 //
127 // Checks the MCM status byte
128 //
129
6bf5f0ce 130 // To translate pad column number into MCM number
131 Int_t mcm = ((Int_t) col / 18);
132
133 AliTRDCalSingleChamberStatus* roc = GetCalROC(d);
134
135 if (!roc) {
136 return kFALSE;
137 }
138 else {
139 return (roc->GetStatus(mcm,row) & bitMask) ? kTRUE : kFALSE;
140 }
141
142}
143
144//_____________________________________________________________________________
145Char_t AliTRDCalMCMStatus::GetStatus(Int_t d, Int_t col, Int_t row) const
146{
147 //
148 // Gets the MCM status byte
149 //
150
151 // To translate pad column number into MCM number
152 Int_t mcm = ((Int_t) col / 18);
153
2745a409 154 AliTRDCalSingleChamberStatus* roc = GetCalROC(d);
155
156 if (!roc) {
157 return kFALSE;
158 }
159 else {
6bf5f0ce 160 return roc->GetStatus(mcm,row);
2745a409 161 }
162
163}
164
165//_____________________________________________________________________________
6bf5f0ce 166AliTRDCalSingleChamberStatus *AliTRDCalMCMStatus::GetCalROC(Int_t p, Int_t c, Int_t s) const
2745a409 167{
168 //
169 // Returns the readout chamber of this MCM
170 //
171
172 return GetCalROC(AliTRDgeometry::GetDetector(p,c,s));
173
174}