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 /// \class AliMUONQAMappingCheck
20 /// Helper class for AliMUONQADataMakerRec, which takes care
21 /// of building an AliMUONVTrackerData to store the location of
22 /// all the clusters encountered during a run, and all the clusters
23 /// that have charge on only one cathode (aka mono-cathode clusters).
25 /// This is to easily spot mapping errors and/or region of complete
28 /// \author Laurent Aphecetche, Subatech
31 #include "AliMUONQAMappingCheck.h"
33 #include "AliCDBManager.h"
35 #include "AliMUON2DMap.h"
36 #include "AliMUONDigitCalibrator.h"
37 #include "AliMUONCalibParamND.h"
38 #include "AliMUONGeometryTransformer.h"
39 #include "AliMUONPadStatusMapMaker.h"
40 #include "AliMUONTrackerData.h"
41 #include "AliMUONVCluster.h"
42 #include "AliMUONVDigit.h"
43 #include "AliMpConstants.h"
44 #include "AliMpDetElement.h"
45 #include "AliMpDDLStore.h"
47 #include "AliMpSegmentation.h"
48 #include "AliMpVSegmentation.h"
51 ClassImp(AliMUONQAMappingCheck)
54 //_____________________________________________________________________________
55 AliMUONQAMappingCheck::AliMUONQAMappingCheck(Int_t runNumber)
57 fStore(new AliMUON2DMap(kTRUE)),
58 fGeometryTransformer(new AliMUONGeometryTransformer),
59 fDigitCalibrator(new AliMUONDigitCalibrator(runNumber)),
62 fNumberOfMonoCathodeClusters(0),
63 fNumberOfLegitimateMonoCathodeClusters(0)
67 fGeometryTransformer->LoadGeometryData();
70 //_____________________________________________________________________________
71 AliMUONQAMappingCheck::~AliMUONQAMappingCheck()
73 /// Dtor. Report on the global number of clusters encountered
74 AliInfo(Form("Nevents %d Nclusters %d Nmono-cathodes %d Nlegitimate-mono-cathodes %d",
77 fNumberOfMonoCathodeClusters,
78 fNumberOfLegitimateMonoCathodeClusters));
80 delete fGeometryTransformer;
81 delete fDigitCalibrator;
84 //____________________________________________________________________________
85 void AliMUONQAMappingCheck::AddClusterLocation(Int_t detElemId,
86 Int_t manuId, Int_t manuChannel,
88 Bool_t legitimateMonoCathode)
90 /// Add one cluster location to our internal store
93 AliMUONVCalibParam* p = static_cast<AliMUONVCalibParam*>(fStore->FindObject(detElemId,manuId));
96 p = new AliMUONCalibParamND(4,AliMpConstants::ManuNofChannels(),detElemId,manuId,0.0);
101 p->SetValueAsDouble(manuChannel,0,p->ValueAsDouble(manuChannel,0)+1.0);
105 p->SetValueAsDouble(manuChannel,1,p->ValueAsDouble(manuChannel,1)+1.0);
106 if (!legitimateMonoCathode)
108 p->SetValueAsDouble(manuChannel,2,p->ValueAsDouble(manuChannel,2)+1.0);
114 //____________________________________________________________________________
116 AliMUONQAMappingCheck::NewEvent()
118 /// Increment number of events seen
122 //____________________________________________________________________________
124 AliMUONQAMappingCheck::CreateData(const char* name) const
126 /// Make a trackerData from our internal store
128 AliMUONVStore* store = static_cast<AliMUONVStore*>(fStore->Clone());
130 TIter next(store->CreateIterator());
131 AliMUONVCalibParam* param;
133 while ( ( param = static_cast<AliMUONVCalibParam*>(next()) ) )
135 for ( Int_t i = 0; i < param->Size(); ++i )
137 param->SetValueAsDouble(i,3,fNumberOfEvents);
141 AliMUONTrackerData* data = new AliMUONTrackerData(name,name,4,kTRUE);
142 data->SetDimensionName(0,"all"); // all clusters
143 data->SetDimensionName(1,"mono"); // mono-cathode clusters
144 data->SetDimensionName(2,"suspect"); // not legitimate mono-cathode clusters
145 data->SetDimensionName(3,"Nevents"); // number of events
146 data->DisableChannelLevel();
155 //____________________________________________________________________________
157 AliMUONQAMappingCheck::GetClusterLocation(AliMUONVCluster& cluster,
158 Int_t& manuBending, Int_t& manuBendingChannel,
159 Int_t& manuNonBending, Int_t& manuNonBendingChannel,
160 Bool_t& monoCathode, Bool_t& legitimateMonoCathode)
162 /// Get the pad under the center of the cluster, and whether or not this cluster
163 /// has charge on both cathodes
165 Int_t detElemId = cluster.GetDetElemId();
169 fGeometryTransformer->Global2Local(detElemId,cluster.GetX(),cluster.GetY(),cluster.GetZ(),x,y,z);
171 AliMpDetElement* de = AliMpDDLStore::Instance()->GetDetElement(detElemId);
173 const AliMpVSegmentation* segB = AliMpSegmentation::Instance()->GetMpSegmentation(detElemId,de->GetCathodType(AliMp::kBendingPlane));
174 const AliMpVSegmentation* segNB = AliMpSegmentation::Instance()->GetMpSegmentation(detElemId,de->GetCathodType(AliMp::kNonBendingPlane));
176 AliMpPad padB = segB->PadByPosition(x,y);
177 AliMpPad padNB = segNB->PadByPosition(x,y);
179 manuBending = padB.GetManuId();
180 manuBendingChannel = padB.GetManuChannel();
182 manuNonBending = padNB.GetManuId();
183 manuNonBendingChannel = padNB.GetManuChannel();
185 Bool_t bending(kFALSE);
186 Bool_t nonBending(kFALSE);
188 for ( Int_t i = 0; i < cluster.GetNDigits(); ++i )
189 // for ( Int_t i = 0; i < cluster.GetNDigits() && !(bending && nonBending); ++i )
191 UInt_t digitId = cluster.GetDigitId(i);
192 Int_t manuId = AliMUONVDigit::ManuId(digitId);
195 if ( manuId & AliMpConstants::ManuMask(AliMp::kNonBendingPlane) )
206 monoCathode = ( bending != nonBending );
210 legitimateMonoCathode = kFALSE;
213 if ( IsManuDead(detElemId,manuBending) ) legitimateMonoCathode = kTRUE;
219 if ( IsManuDead(detElemId,manuNonBending) ) legitimateMonoCathode = kTRUE;
223 if (!bending) manuBending *= -1;
224 if (!nonBending) manuNonBending *= -1;
229 ++fNumberOfMonoCathodeClusters;
230 if ( legitimateMonoCathode ) ++fNumberOfLegitimateMonoCathodeClusters;
234 //____________________________________________________________________________
235 Bool_t AliMUONQAMappingCheck::IsManuDead(Int_t detElemId, Int_t manuId) const
237 /// Using the statusmaker, tells if a given manu is to be considered
238 /// as dead (here dead means at least one manas dead)
240 if ( manuId <= 0 ) return kTRUE;
244 for ( Int_t i = 0; i < AliMpConstants::ManuNofChannels(); ++i)
246 if ( IsChannelDead(detElemId,manuId,i) ) ++n;
251 //____________________________________________________________________________
252 Bool_t AliMUONQAMappingCheck::IsChannelDead(Int_t detElemId, Int_t manuId, Int_t manuChannel) const
254 /// Using the statusmaker, tells if a given channel is dead
256 return ( fDigitCalibrator->StatusMap(detElemId,manuId,manuChannel) & (AliMUONPadStatusMapMaker::SelfDeadMask() != 0) );
259 //____________________________________________________________________________
261 AliMUONQAMappingCheck::Store(AliMUONVCluster& cluster)
263 /// Store information about a single cluster
265 if ( cluster.GetCharge() < 10 ) return;
267 Int_t manuBendingId, manuBendingChannel;
268 Int_t manuNonBendingId, manuNonBendingChannel;
269 Bool_t monoCathode, legitimateMonoCathode;
271 GetClusterLocation(cluster, manuBendingId, manuBendingChannel,manuNonBendingId, manuNonBendingChannel, monoCathode,legitimateMonoCathode);
273 AddClusterLocation(cluster.GetDetElemId(),manuBendingId,manuBendingChannel,monoCathode,legitimateMonoCathode);
274 AddClusterLocation(cluster.GetDetElemId(),manuNonBendingId,manuNonBendingChannel,monoCathode,legitimateMonoCathode);