1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 //-----------------------------------------------------------------------------
19 /// \class AliMUONPadStatusMapMaker
21 /// Convert a pad statuses into pad status maps.
23 /// A pad status is one 32-bits word describing whether this pad pedestal, gains
24 /// hv is correct or not.
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
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)
44 /// so some care must be taken when designing a mask to be tested ;-) if you
45 /// want to go farther than immediate neighbours...
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).
50 /// \author Laurent Aphecetche
51 //-----------------------------------------------------------------------------
53 #include "AliMUONPadStatusMapMaker.h"
56 #include "AliMUON2DMap.h"
57 #include "AliMUONCalibParamNI.h"
58 #include "AliMUONPadStatusMaker.h"
59 #include "AliMUONVStore.h"
60 #include "AliMUONVCalibParam.h"
61 #include "AliMpConstants.h"
62 #include <Riostream.h>
64 #include "AliCodeTimer.h"
67 ClassImp(AliMUONPadStatusMapMaker)
70 Int_t AliMUONPadStatusMapMaker::fgkSelfDead = 1;
72 //_____________________________________________________________________________
73 AliMUONPadStatusMapMaker::AliMUONPadStatusMapMaker(const AliMUONPadStatusMaker& padStatusMaker,
75 Bool_t deferredInitialization)
77 fStatusMaker(padStatusMaker),
79 fStatusMap(new AliMUON2DMap(true))
82 if (!deferredInitialization)
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()) ) )
90 Int_t detElemId = param->ID0();
91 Int_t manuId = param->ID1();
92 ComputeStatusMap(detElemId,manuId);
97 //_____________________________________________________________________________
98 AliMUONPadStatusMapMaker::~AliMUONPadStatusMapMaker()
104 //_____________________________________________________________________________
106 AliMUONPadStatusMapMaker::ComputeStatusMap(Int_t detElemId, Int_t manuId) const
108 /// Compute the status map for a given manu, and add it to our internal
109 /// fStatusMap internal storage
111 AliCodeTimerAuto("(Int_t,Int_t)")
113 AliMUONVCalibParam* param = new AliMUONCalibParamNI(1,AliMpConstants::ManuNofChannels(),
114 detElemId,manuId,-1);
116 Bool_t ok = fStatusMap->Add(param);
119 AliFatal(Form("Could not add manu %d of de %d",manuId,detElemId));
122 AliMUONVCalibParam* neighbours = fStatusMaker.Neighbours(detElemId,manuId);
124 AliMUONVCalibParam* statusParam = fStatusMaker.PadStatus(detElemId,manuId);
126 Int_t n = neighbours->Dimension();
128 for ( Int_t manuChannel = 0; manuChannel < param->Size(); ++manuChannel )
132 Int_t x = neighbours->ValueAsIntFast(manuChannel,0);
135 // channel is not a valid one (i.e. (manuId,manuChannel) is not an existing pad)
136 statusMap = -1;//fgkSelfDead;
140 for ( Int_t i = 0; i < n; ++i )
142 // Compute the statusmap related to the status of neighbouring
143 // pads. An invalid pad means "outside of edges".
145 Int_t x = neighbours->ValueAsIntFast(manuChannel,i);
147 neighbours->UnpackValue(x,m,c);
148 if ( c < 0 ) continue;
156 status = statusParam->ValueAsIntFast(c); //fStatusMaker.PadStatus(detElemId,m,c);
158 if ( ( fMask==0 && status !=0 ) || ( (status & fMask) != 0 ) )
163 param->SetValueAsIntFast(manuChannel,0,statusMap);
168 //_____________________________________________________________________________
170 AliMUONPadStatusMapMaker::StatusMap(Int_t detElemId, Int_t manuId,
171 Int_t manuChannel) const
174 /// Get the pad status map
176 AliMUONVCalibParam* param = static_cast<AliMUONVCalibParam*>(fStatusMap->FindObject(detElemId,manuId));
179 // not yet computed, so do it now
180 param = ComputeStatusMap(detElemId,manuId);
182 return param->ValueAsInt(manuChannel);