]>
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 | ||
84 | void AliPHOSEmcBadChannelsMap::BadChannelIds(Int_t *badIds) | |
85 | { | |
86 | //Fill array badIds by the Ids of bad channels. | |
87 | //Array badIds of length GetNumOfBadChannels() should be prepared in advance. | |
88 | ||
89 | if(!badIds) return; | |
90 | if(!fBads>0) return; | |
91 | ||
92 | AliPHOSGeometry* geom = AliPHOSGeometry::GetInstance(); | |
93 | ||
94 | if(!geom) | |
95 | geom = AliPHOSGeometry::GetInstance("IHEP"); | |
96 | ||
97 | Int_t absId; | |
98 | Int_t relId[4]; | |
99 | ||
100 | Int_t iBad = 0; | |
101 | relId[1] = 0; // EMC crystal | |
102 | ||
103 | for(Int_t mod=1; mod<6; mod++) { | |
104 | for(Int_t col=1; col<57; col++) { | |
105 | for(Int_t row=1; row<65; row++) { | |
106 | if(IsBadChannel(mod,col,row)) { | |
107 | relId[0] = mod; | |
108 | relId[3] = col; | |
109 | relId[2] = row; | |
110 | geom->RelToAbsNumbering(relId,absId); | |
111 | badIds[iBad]=absId; | |
112 | iBad++; | |
113 | } | |
114 | } | |
115 | } | |
116 | } | |
117 | ||
118 | } |