]>
Commit | Line | Data |
---|---|---|
2c780493 | 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$ | |
3d1463c8 | 17 | |
18 | //----------------------------------------------------------------------------- | |
2c780493 | 19 | /// \class AliMUONPadStatusMapMaker |
20 | /// | |
49e396d9 | 21 | /// Convert a pad statuses into pad status maps. |
2c780493 | 22 | /// |
23 | /// A pad status is one 32-bits word describing whether this pad pedestal, gains | |
24 | /// hv is correct or not. | |
25 | /// | |
26 | /// A pad status *map* is one 32-bits (of which 24 only are used) | |
27 | /// word describing whether this pad neighbours are ok or not | |
28 | /// (whether a pad is ok or not is determined by applying a given | |
29 | /// bitmask to the pad status word). Each bit in this word is related to one | |
30 | /// neighbour, assuming the pad itself is at bit 0 | |
31 | /// | |
32 | /// ---------------- | |
33 | /// | 3 | 5 | 8 | | |
34 | /// ---------------- | |
35 | /// | 2 | 0 | 7 | | |
36 | /// ---------------- | |
37 | /// | 1 | 4 | 6 | | |
38 | /// ---------------- | |
39 | /// | |
40 | /// Note that for instance in NonBending plane of slats, at the boundaries | |
41 | /// between two pad densities, the pictures is a bit different, e.g. | |
42 | /// (bits in () are always zero) | |
43 | /// | |
44 | /// so some care must be taken when designing a mask to be tested ;-) if you | |
45 | /// want to go farther than immediate neighbours... | |
46 | /// | |
47 | /// If a pad is at a physical boundary, is will for sure have some bits at 1 | |
48 | /// (i.e. a non-existing neighbour is considered = bad). | |
49 | /// | |
78649106 | 50 | /// \author Laurent Aphecetche |
3d1463c8 | 51 | //----------------------------------------------------------------------------- |
2c780493 | 52 | |
53 | #include "AliMUONPadStatusMapMaker.h" | |
54 | ||
55 | #include "AliLog.h" | |
4f8ed2e4 | 56 | #include "AliMUON2DMap.h" |
5eeebd4b | 57 | #include "AliMUONCalibParamNI.h" |
49e396d9 | 58 | #include "AliMUONPadStatusMaker.h" |
8d8e920c | 59 | #include "AliMUONVStore.h" |
2c780493 | 60 | #include "AliMUONVCalibParam.h" |
8d8e920c | 61 | #include "AliMpConstants.h" |
4f8ed2e4 | 62 | #include <Riostream.h> |
8d8e920c | 63 | #include <TList.h> |
49e396d9 | 64 | #include "AliCodeTimer.h" |
2c780493 | 65 | |
78649106 | 66 | /// \cond CLASSIMP |
2c780493 | 67 | ClassImp(AliMUONPadStatusMapMaker) |
78649106 | 68 | /// \endcond |
2c780493 | 69 | |
70 | Int_t AliMUONPadStatusMapMaker::fgkSelfDead = 1; | |
71 | ||
2c780493 | 72 | //_____________________________________________________________________________ |
49e396d9 | 73 | AliMUONPadStatusMapMaker::AliMUONPadStatusMapMaker(const AliMUONPadStatusMaker& padStatusMaker, |
74 | Int_t mask, | |
75 | Bool_t deferredInitialization) | |
2c780493 | 76 | : TObject(), |
72dae9ff | 77 | fkStatusMaker(padStatusMaker), |
49e396d9 | 78 | fMask(mask), |
79 | fStatusMap(new AliMUON2DMap(true)) | |
2c780493 | 80 | { |
81 | /// ctor | |
49e396d9 | 82 | if (!deferredInitialization) |
2c780493 | 83 | { |
49e396d9 | 84 | AliCodeTimerAuto("Computing complete status map at once"); |
85 | AliMUONVStore* neighboursStore = padStatusMaker.NeighboursStore(); | |
86 | AliMUONVCalibParam* param; | |
87 | TIter next(neighboursStore->CreateIterator()); | |
88 | while ( ( param = static_cast<AliMUONVCalibParam*>(next()) ) ) | |
2c780493 | 89 | { |
49e396d9 | 90 | Int_t detElemId = param->ID0(); |
91 | Int_t manuId = param->ID1(); | |
92 | ComputeStatusMap(detElemId,manuId); | |
2c780493 | 93 | } |
2c780493 | 94 | } |
2c780493 | 95 | } |
96 | ||
2c780493 | 97 | //_____________________________________________________________________________ |
49e396d9 | 98 | AliMUONPadStatusMapMaker::~AliMUONPadStatusMapMaker() |
4f8ed2e4 | 99 | { |
49e396d9 | 100 | /// dtor |
101 | delete fStatusMap; | |
4f8ed2e4 | 102 | } |
103 | ||
104 | //_____________________________________________________________________________ | |
49e396d9 | 105 | AliMUONVCalibParam* |
106 | AliMUONPadStatusMapMaker::ComputeStatusMap(Int_t detElemId, Int_t manuId) const | |
2c780493 | 107 | { |
49e396d9 | 108 | /// Compute the status map for a given manu, and add it to our internal |
109 | /// fStatusMap internal storage | |
2c780493 | 110 | |
49e396d9 | 111 | AliCodeTimerAuto("(Int_t,Int_t)") |
112 | ||
113 | AliMUONVCalibParam* param = new AliMUONCalibParamNI(1,AliMpConstants::ManuNofChannels(), | |
114 | detElemId,manuId,-1); | |
115 | ||
116 | Bool_t ok = fStatusMap->Add(param); | |
117 | if (!ok) | |
118 | { | |
119 | AliFatal(Form("Could not add manu %d of de %d",manuId,detElemId)); | |
120 | } | |
121 | ||
72dae9ff | 122 | AliMUONVCalibParam* neighbours = fkStatusMaker.Neighbours(detElemId,manuId); |
5eeebd4b | 123 | |
72dae9ff | 124 | AliMUONVCalibParam* statusParam = fkStatusMaker.PadStatus(detElemId,manuId); |
2c780493 | 125 | |
49e396d9 | 126 | Int_t n = neighbours->Dimension(); |
2c780493 | 127 | |
49e396d9 | 128 | for ( Int_t manuChannel = 0; manuChannel < param->Size(); ++manuChannel ) |
2c780493 | 129 | { |
49e396d9 | 130 | Int_t statusMap(0); |
5eeebd4b | 131 | |
49e396d9 | 132 | Int_t x = neighbours->ValueAsIntFast(manuChannel,0); |
133 | if ( x < 0 ) | |
5eeebd4b | 134 | { |
49e396d9 | 135 | // channel is not a valid one (i.e. (manuId,manuChannel) is not an existing pad) |
136 | statusMap = -1;//fgkSelfDead; | |
5eeebd4b | 137 | continue; |
138 | } | |
49e396d9 | 139 | |
140 | for ( Int_t i = 0; i < n; ++i ) | |
2c780493 | 141 | { |
49e396d9 | 142 | // Compute the statusmap related to the status of neighbouring |
143 | // pads. An invalid pad means "outside of edges". | |
144 | ||
bf0d3528 | 145 | Int_t y = neighbours->ValueAsIntFast(manuChannel,i); |
49e396d9 | 146 | Int_t m,c; |
bf0d3528 | 147 | neighbours->UnpackValue(y,m,c); |
49e396d9 | 148 | if ( c < 0 ) continue; |
149 | Int_t status = 0; | |
150 | if ( !m ) | |
151 | { | |
152 | status = -1; | |
2c780493 | 153 | } |
154 | else | |
155 | { | |
72dae9ff | 156 | status = statusParam->ValueAsIntFast(c); //fkStatusMaker.PadStatus(detElemId,m,c); |
2c780493 | 157 | } |
49e396d9 | 158 | if ( ( fMask==0 && status !=0 ) || ( (status & fMask) != 0 ) ) |
159 | { | |
160 | statusMap |= (1<<i); | |
161 | } | |
162 | } | |
163 | param->SetValueAsIntFast(manuChannel,0,statusMap); | |
2c780493 | 164 | } |
49e396d9 | 165 | return param; |
2c780493 | 166 | } |
167 | ||
49e396d9 | 168 | //_____________________________________________________________________________ |
169 | Int_t | |
170 | AliMUONPadStatusMapMaker::StatusMap(Int_t detElemId, Int_t manuId, | |
171 | Int_t manuChannel) const | |
172 | ||
173 | { | |
174 | /// Get the pad status map | |
175 | ||
176 | AliMUONVCalibParam* param = static_cast<AliMUONVCalibParam*>(fStatusMap->FindObject(detElemId,manuId)); | |
177 | if (!param) | |
178 | { | |
179 | // not yet computed, so do it now | |
180 | param = ComputeStatusMap(detElemId,manuId); | |
181 | } | |
182 | return param->ValueAsInt(manuChannel); | |
183 | } |