AliRoot Core  a565103 (a565103)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliMUONQAMappingCheck.cxx
Go to the documentation of this file.
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 
30 
31 #include "AliMUONQAMappingCheck.h"
32 
33 #include "AliCDBManager.h"
34 #include "AliCodeTimer.h"
35 #include "AliLog.h"
36 #include "AliMUON2DMap.h"
37 #include "AliMUONDigitCalibrator.h"
38 #include "AliMUONCalibParamND.h"
41 #include "AliMUONTrackerData.h"
42 #include "AliMUONVCluster.h"
43 #include "AliMUONVDigit.h"
44 #include "AliMpConstants.h"
45 #include "AliMpDetElement.h"
46 #include "AliMpDDLStore.h"
47 #include "AliMpPad.h"
48 #include "AliMpSegmentation.h"
49 #include "AliMpVSegmentation.h"
50 
51 #include "AliMpManuIterator.h"
52 
56 
57 //_____________________________________________________________________________
59 : TObject(),
60 fStore(new AliMUON2DMap(kTRUE)),
61 fGeometryTransformer(new AliMUONGeometryTransformer),
62 fDigitCalibrator(new AliMUONDigitCalibrator(runNumber)),
63 fNumberOfEvents(0),
64 fNumberOfClusters(0),
65 fNumberOfMonoCathodeClusters(0),
66 fNumberOfLegitimateMonoCathodeClusters(0)
67 {
69 
70  AliCodeTimerAuto(Form("RUN %d",runNumber),0);
71 
72  fGeometryTransformer->LoadGeometryData();
73 
74  // Init the store with all the manus. Note that this is not strictly necessary,
75  // but it helps not to get its growth (that would otherwise happen in
76  // AddClusterLocation each time we get a cluster associated with a manu where
77  // we got no cluster yet) confused with a memory leak...
79  Int_t detElemId, manuId;
80 
81  while (it.Next(detElemId,manuId))
82  {
83  fStore->Add(new AliMUONCalibParamND(4,AliMpConstants::ManuNofChannels(),detElemId,manuId,0.0));
84  }
85 }
86 
87 //_____________________________________________________________________________
89 {
91  AliInfo(Form("Nevents %d Nclusters %d Nmono-cathodes %d Nlegitimate-mono-cathodes %d",
96  delete fStore;
97  delete fGeometryTransformer;
98  delete fDigitCalibrator;
99 }
100 
101 //____________________________________________________________________________
103  Int_t manuId, Int_t manuChannel,
104  Bool_t monoCathode,
105  Bool_t legitimateMonoCathode)
106 {
108  if ( manuId > 0 )
109  {
110  AliMUONVCalibParam* p = static_cast<AliMUONVCalibParam*>(fStore->FindObject(detElemId,manuId));
111  if (!p)
112  {
113  p = new AliMUONCalibParamND(4,AliMpConstants::ManuNofChannels(),detElemId,manuId,0.0);
114  fStore->Add(p);
115  }
116 
117  p->SetValueAsDouble(manuChannel,0,p->ValueAsDouble(manuChannel,0)+1.0);
118 
119  if ( monoCathode )
120  {
121  p->SetValueAsDouble(manuChannel,1,p->ValueAsDouble(manuChannel,1)+1.0);
122  if (!legitimateMonoCathode)
123  {
124  p->SetValueAsDouble(manuChannel,2,p->ValueAsDouble(manuChannel,2)+1.0);
125  }
126  }
127  }
128 }
129 
130 //____________________________________________________________________________
131 void
133 {
135  ++fNumberOfEvents;
136 }
137 
138 //____________________________________________________________________________
140 AliMUONQAMappingCheck::CreateData(const char* name) const
141 {
143 
144  AliMUONVStore* store = static_cast<AliMUONVStore*>(fStore->Clone());
145 
146  TIter next(store->CreateIterator());
147  AliMUONVCalibParam* param;
148 
149  while ( ( param = static_cast<AliMUONVCalibParam*>(next()) ) )
150  {
151  for ( Int_t i = 0; i < param->Size(); ++i )
152  {
153  param->SetValueAsDouble(i,3,fNumberOfEvents);
154  }
155  }
156 
157  AliMUONTrackerData* data = new AliMUONTrackerData(name,name,4,kTRUE);
158  data->SetDimensionName(0,"all"); // all clusters
159  data->SetDimensionName(1,"mono"); // mono-cathode clusters
160  data->SetDimensionName(2,"suspect"); // not legitimate mono-cathode clusters
161  data->SetDimensionName(3,"Nevents"); // number of events
162  data->DisableChannelLevel();
163 
164  data->Add(*store);
165 
166  delete store;
167 
168  return data;
169 }
170 
171 //____________________________________________________________________________
172 void
174  Int_t& manuBending, Int_t& manuBendingChannel,
175  Int_t& manuNonBending, Int_t& manuNonBendingChannel,
176  Bool_t& monoCathode, Bool_t& legitimateMonoCathode)
177 {
180 
181  Int_t detElemId = cluster.GetDetElemId();
182 
183  Double_t x,y,z;
184 
185  fGeometryTransformer->Global2Local(detElemId,cluster.GetX(),cluster.GetY(),cluster.GetZ(),x,y,z);
186 
188 
191 
192  AliMpPad padB = segB->PadByPosition(x,y);
193  AliMpPad padNB = segNB->PadByPosition(x,y);
194 
195  manuBending = padB.GetManuId();
196  manuBendingChannel = padB.GetManuChannel();
197 
198  manuNonBending = padNB.GetManuId();
199  manuNonBendingChannel = padNB.GetManuChannel();
200 
201  Bool_t bending(kFALSE);
202  Bool_t nonBending(kFALSE);
203 
204  for ( Int_t i = 0; i < cluster.GetNDigits(); ++i )
205 // for ( Int_t i = 0; i < cluster.GetNDigits() && !(bending && nonBending); ++i )
206  {
207  UInt_t digitId = cluster.GetDigitId(i);
208  Int_t manuId = AliMUONVDigit::ManuId(digitId);
209  if ( manuId > 0 )
210  {
212  {
213  nonBending = kTRUE;
214  }
215  else
216  {
217  bending = kTRUE;
218  }
219  }
220  }
221 
222  monoCathode = ( bending != nonBending );
223 
224  if ( monoCathode )
225  {
226  legitimateMonoCathode = kFALSE;
227  if (!bending)
228  {
229  if ( IsManuDead(detElemId,manuBending) ) legitimateMonoCathode = kTRUE;
230  }
231 
232  if (!nonBending)
233  {
234 
235  if ( IsManuDead(detElemId,manuNonBending) ) legitimateMonoCathode = kTRUE;
236  }
237  }
238 
239  if (!bending) manuBending *= -1;
240  if (!nonBending) manuNonBending *= -1;
241 
243  if ( monoCathode )
244  {
246  if ( legitimateMonoCathode ) ++fNumberOfLegitimateMonoCathodeClusters;
247  }
248 }
249 
250 //____________________________________________________________________________
251 Bool_t AliMUONQAMappingCheck::IsManuDead(Int_t detElemId, Int_t manuId) const
252 {
255 
256  if ( manuId <= 0 ) return kTRUE;
257 
258  Int_t n(0);
259 
260  for ( Int_t i = 0; i < AliMpConstants::ManuNofChannels(); ++i)
261  {
262  if ( IsChannelDead(detElemId,manuId,i) ) ++n;
263  }
264  return n > 16;
265 }
266 
267 //____________________________________________________________________________
268 Bool_t AliMUONQAMappingCheck::IsChannelDead(Int_t detElemId, Int_t manuId, Int_t manuChannel) const
269 {
271 
272  return ( fDigitCalibrator->StatusMap(detElemId,manuId,manuChannel) & (AliMUONPadStatusMapMaker::SelfDeadMask() != 0) );
273 }
274 
275 //____________________________________________________________________________
276 void
278 {
280 
281  if ( cluster.GetCharge() < 10 ) return;
282 
283  Int_t manuBendingId, manuBendingChannel;
284  Int_t manuNonBendingId, manuNonBendingChannel;
285  Bool_t monoCathode, legitimateMonoCathode;
286 
287  GetClusterLocation(cluster, manuBendingId, manuBendingChannel,manuNonBendingId, manuNonBendingChannel, monoCathode,legitimateMonoCathode);
288 
289  AddClusterLocation(cluster.GetDetElemId(),manuBendingId,manuBendingChannel,monoCathode,legitimateMonoCathode);
290  AddClusterLocation(cluster.GetDetElemId(),manuNonBendingId,manuNonBendingChannel,monoCathode,legitimateMonoCathode);
291 }
virtual TIterator * CreateIterator() const =0
Return an iterator to loop over the whole store.
Implementation of AliMUONVTrackerData.
Class to be called from AliMUONQADataMakerRec.
const AliMpVSegmentation * GetMpSegmentation(Int_t detElemId, AliMp::CathodType cath, Bool_t warn=true) const
static AliMpSegmentation * Instance(Bool_t warn=true)
virtual Double_t GetZ() const =0
Return coordinate Z (cm)
void GetClusterLocation(AliMUONVCluster &cluster, Int_t &manuBending, Int_t &manuBendingChannel, Int_t &manuNonBending, Int_t &manuNonBendingChannel, Bool_t &monoCathode, Bool_t &legitimateMonoCathode)
Top container class for geometry transformations.
AliMUONGeometryTransformer * fGeometryTransformer
! to go from global to local DE coordinates
Int_t GetManuId() const
Definition: AliMpPad.cxx:256
void Store(AliMUONVCluster &cluster)
Int_t StatusMap(Int_t detElemId, Int_t manuId, Int_t manuChannel) const
virtual void SetDimensionName(Int_t index, const char *value)
Set the name of a given dimension.
AliMpDetElement * GetDetElement(Int_t detElemId, Bool_t warn=true) const
virtual Double_t ValueAsDouble(Int_t i, Int_t j=0) const
Bool_t IsChannelDead(Int_t detElemId, Int_t manuId, Int_t manuChannel) const
The class defines the electronics properties of detection element.
AliMUONDigitCalibrator * fDigitCalibrator
! to get statusmap
AliMUONVTrackerData * CreateData(const char *name) const
Bool_t Next(Int_t &detElemId, Int_t &manuId)
Class to loop over all manus of MUON Tracker.
ClassImp(TPCGenInfo)
Definition: AliTPCCmpNG.C:254
Int_t GetManuChannel() const
Definition: AliMpPad.cxx:264
virtual UInt_t GetDigitId(Int_t i) const =0
Return Id of digits i.
Container of calibration values for a given number of channels.
static AliMpDDLStore * Instance(Bool_t warn=true)
static Int_t ManuNofChannels()
Max number of channels per manu.
abstract base class for clusters
Class to calibrate the digits.
Int_t fNumberOfEvents
! number of events seen
non-bending plane
Implementation of AliMUONVCalibParam for tuples of double.
virtual void DisableChannelLevel()
Disable storing values at the channel level.
virtual Int_t GetNDigits() const =0
Return number of associated digits.
static Int_t SelfDeadMask()
Return status bit map to tell a pad is bad.
Bool_t Add(const AliMUONTrackerData &data)
Basic implementation of AliMUONVStore container using AliMpExMap internally.
Definition: AliMUON2DMap.h:20
Int_t fNumberOfLegitimateMonoCathodeClusters
! number of mono-cathode that have a reason to be so
Bool_t IsManuDead(Int_t detElemId, Int_t manuId) const
virtual Double_t GetY() const =0
Return coordinate Y (cm)
bending plane
virtual Bool_t Add(TObject *object)=0
Add an object to the store.
virtual AliMpPad PadByPosition(Double_t x, Double_t y, Bool_t warning=true) const =0
Find pad by position.
void Global2Local(Int_t detElemId, Float_t xg, Float_t yg, Float_t zg, Float_t &xl, Float_t &yl, Float_t &zl) const
AliMp::CathodType GetCathodType(AliMp::PlaneType planeType) const
The abstract base class for the segmentation.
virtual Int_t ManuId() const =0
The electronic card id this digit belongs to (manuId for tracker, localboardId for trigger) ...
Class which encapsuate all information about a pad.
Definition: AliMpPad.h:22
static Int_t GetDetElemId(UInt_t uniqueID)
Return detection element id, part of the uniqueID.
virtual Double_t GetX() const =0
Return coordinate X (cm)
Int_t fNumberOfMonoCathodeClusters
! total number of mono-cathode clusters seen
Base class for MUON data stores.
Definition: AliMUONVStore.h:22
Int_t fNumberOfClusters
! total number of clusters seen
virtual Double_t GetCharge() const =0
Set the cluster charge.
Base class for MUON data that can be presented at different levels in the hierarchy of the MUON syste...
void AddClusterLocation(Int_t detElemId, Int_t manuId, Int_t manuChannel, Bool_t monoCathode, Bool_t legitimateMonoCathode)
AliMUONVStore * fStore
! store cluster informations at manu level
virtual TObject * FindObject(const char *name) const
Find an object by name.
static Int_t ManuMask(AliMp::PlaneType planeType)
virtual void SetValueAsDouble(Int_t i, Int_t j, Double_t value)