]>
Commit | Line | Data |
---|---|---|
52ee9a4c | 1 | /************************************************************************** |
2 | * Copyright(c) 2007, 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 | // PHOS EmCal bad channels map. // | |
21 | // // | |
22 | /////////////////////////////////////////////////////////////////////////////// | |
23 | ||
24 | #include "AliPHOSEmcBadChannelsMap.h" | |
9af66eca | 25 | #include "AliPHOSGeometry.h" |
52ee9a4c | 26 | |
27 | ClassImp(AliPHOSEmcBadChannelsMap) | |
28 | ||
29 | //________________________________________________________________ | |
30 | ||
31 | AliPHOSEmcBadChannelsMap::AliPHOSEmcBadChannelsMap() : fBads(-1) | |
32 | { | |
33 | Reset(); | |
34 | } | |
35 | ||
36 | //________________________________________________________________ | |
37 | ||
38 | void AliPHOSEmcBadChannelsMap::Reset() | |
39 | { | |
40 | //Set all channels as good. | |
41 | ||
42 | for(Int_t module=0; module<5; module++) | |
43 | for(Int_t column=0; column<56; column++) | |
44 | for(Int_t row=0; row<64; row++) | |
45 | fBadChannelEmc[module][column][row] = kFALSE; | |
46 | ||
47 | fBads=0; | |
48 | ||
49 | } | |
50 | ||
51 | //________________________________________________________________ | |
52 | ||
53 | AliPHOSEmcBadChannelsMap::AliPHOSEmcBadChannelsMap(const AliPHOSEmcBadChannelsMap &map): | |
54 | TObject(map),fBads(map.fBads) | |
55 | { | |
56 | //Copy constructor. | |
57 | ||
58 | for(Int_t module=0; module<5; module++) | |
59 | for(Int_t column=0; column<56; column++) | |
60 | for(Int_t row=0; row<64; row++) | |
61 | fBadChannelEmc[module][column][row] = map.fBadChannelEmc[module][column][row]; | |
62 | ||
63 | } | |
64 | ||
65 | //________________________________________________________________ | |
66 | ||
67 | AliPHOSEmcBadChannelsMap& AliPHOSEmcBadChannelsMap::operator= (const AliPHOSEmcBadChannelsMap &map) | |
68 | { | |
69 | //Assignment operator. | |
70 | ||
71 | if(this != &map) { | |
72 | fBads = map.fBads; | |
73 | for(Int_t module=0; module<5; module++) | |
74 | for(Int_t column=0; column<56; column++) | |
75 | for(Int_t row=0; row<64; row++) | |
76 | fBadChannelEmc[module][column][row] = map.fBadChannelEmc[module][column][row]; | |
77 | } | |
78 | ||
79 | return *this; | |
80 | } | |
9af66eca | 81 | |
82 | //_________________________________________________________________ | |
83 | ||
aff426ad | 84 | void AliPHOSEmcBadChannelsMap::SetBadChannel(Int_t module, Int_t col, Int_t row) |
85 | { | |
86 | // Declare a channel (module,col,row) as a bad, if it was not set before | |
87 | ||
88 | if (!fBadChannelEmc[module-1][col-1][row-1]) { | |
89 | fBadChannelEmc[module-1][col-1][row-1] = kTRUE; | |
90 | ++fBads; | |
91 | } | |
92 | } | |
93 | //_________________________________________________________________ | |
94 | ||
9af66eca | 95 | void AliPHOSEmcBadChannelsMap::BadChannelIds(Int_t *badIds) |
96 | { | |
97 | //Fill array badIds by the Ids of bad channels. | |
98 | //Array badIds of length GetNumOfBadChannels() should be prepared in advance. | |
99 | ||
100 | if(!badIds) return; | |
101 | if(!fBads>0) return; | |
102 | ||
103 | AliPHOSGeometry* geom = AliPHOSGeometry::GetInstance(); | |
104 | ||
105 | if(!geom) | |
106 | geom = AliPHOSGeometry::GetInstance("IHEP"); | |
107 | ||
108 | Int_t absId; | |
109 | Int_t relId[4]; | |
110 | ||
111 | Int_t iBad = 0; | |
112 | relId[1] = 0; // EMC crystal | |
113 | ||
114 | for(Int_t mod=1; mod<6; mod++) { | |
115 | for(Int_t col=1; col<57; col++) { | |
116 | for(Int_t row=1; row<65; row++) { | |
117 | if(IsBadChannel(mod,col,row)) { | |
118 | relId[0] = mod; | |
119 | relId[3] = col; | |
120 | relId[2] = row; | |
121 | geom->RelToAbsNumbering(relId,absId); | |
122 | badIds[iBad]=absId; | |
123 | iBad++; | |
124 | } | |
125 | } | |
126 | } | |
127 | } | |
128 | ||
129 | } |