]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/mapping/macros/timeMapping.C
Redefinition of macro to avoid warnings
[u/mrichter/AliRoot.git] / MUON / mapping / macros / timeMapping.C
CommitLineData
909eee57 1///
2/// Macro to time the PadBy*** methods of AliMpVSegmentation implementation(s)
3///
4/// The output should ressemble this (output from a MacBook Pro 2.33 GHz on Feb, 18th, 2009)
5///
6/// I-AliCDBManager::Init: AliEn classes enabled in Root. AliCDBGrid factory registered.
7/// I-AliCDBManager::SetDefaultStorage: Setting Default storage to: local://$ALICE_ROOT/OCDB
8/// W-AliCDBManager::Get: Run number explicitly set in query: CDB cache temporarily disabled!
9/// AliMpDCSNamer
10/// ManuId2PCBIndex R:0.0645s C:0.0400s (9676 slices)
11/// ManuId2Sector R:0.0434s C:0.0200s (7152 slices)
12/// AliMpDetElement
13/// AddManu
14/// R:1.6670s C:1.6900s (16828 slices)
15/// slat R:0.8474s C:0.8600s (9676 slices)
16/// st12 R:0.6383s C:0.6000s (7152 slices)
17/// AliMpFastSegmentation
18/// AliMpFastSegmentation
19/// AliMpSectorSegmentation R:0.0929s C:0.0900s (4 slices)
20/// AliMpSlatSegmentation R:0.1142s C:0.1400s (38 slices)
21/// General
22/// timeMapping Load mapping R:2.9965s C:2.9000s (1 slices) (1)
23/// ************************************
24/// * Row * pI.fMemRe * sname *
25/// ************************************
26/// * 0 * 30 * 0 *
27/// * 1 * 76 * 1 * (2)
28/// ************************************
29/// AliMpMotifMap
30/// GetMotifPosition R:0.0795s C:0.1400s (7152 slices)
31/// General
32/// ByIndices
33/// HasPadByIndices-St12 R:0.1787s C:0.1700s (32 slices) (3)
34/// HasPadByIndices-St345 R:0.1579s C:0.1900s (280 slices)
35/// PadByIndices-St12 R:0.5637s C:0.5900s (32 slices)
36/// PadByIndices-St345 R:0.5379s C:0.5100s (280 slices)
37/// ByLocation
38/// HasPadByLocation-St12 R:0.0906s C:0.0800s (7152 slices) (4)
39/// HasPadByLocation-St345 R:0.1216s C:0.1100s (9676 slices)
40/// PadByLocation-St12 R:0.4506s C:0.4300s (7152 slices)
41/// PadByLocation-St345 R:0.5874s C:0.5900s (9676 slices)
42/// ByPosition
43/// PadByPosition-St12 R:7.6133s C:7.5700s (32 slices) (5)
44/// PadByPosition-St345 R:2.3484s C:2.4300s (280 slices)
45///
46/// Interesting points in the output are :
47///
48/// (1) : this is the total time it takes to (create and) load the mapping
49/// (2) : row 1 - row 0 indicates the memory the mapping takes
50/// (3) : the *PadByIndices* are timed here
51/// (4) : the *PadByLocation* are timed here
52/// (5) : the *PadByPosition* are timed here.
53///
54/// 3-4-5 : please note that the HasPadBy... methods are always faster, so
55/// if you do not need the pad itself, but just to know if it's there, use
56/// those.
57/// Note also that currently the PadByPosition is by far the slowest of the
58/// 3 methods (Indices,Location,Position).
59///
60/// L. Aphecetche, Subatech
61///
62
63#if !defined(__CINT__) || defined(__MAKECINT__)
64
65#include "AliMpVSegmentation.h"
66#include "AliMpCDB.h"
67#include "AliMpSegmentation.h"
68#include "AliMpPad.h"
69#include "AliCodeTimer.h"
70#include "AliMpDEManager.h"
71#include "AliMpConstants.h"
72#include "AliMpManuIterator.h"
73#include "AliMpDEIterator.h"
74#include "AliMpCathodType.h"
75#include "AliMpStationType.h"
909eee57 76#include "AliMpVPadIterator.h"
f05d3eb1 77
909eee57 78#include "AliSysInfo.h"
f05d3eb1 79
80#include <TObjArray.h>
81#include <TVector2.h>
909eee57 82#include <TTree.h>
83
84// The line below should be commented if you want to try this macro
85// on revision before 31082 (where AliMpVSegmentation did not have the HasPadBy...
86// methods).
87
909eee57 88//______________________________________________________________________________
89Int_t StationId(Int_t detElemId)
90{
91 switch ( 1 + AliMpDEManager::GetChamberId(detElemId) / 2 )
92 {
93 case 1:
94 case 2:
95 return 12;
96 break;
97 case 3:
98 case 4:
99 case 5:
100 return 345;
101 break;
102 default:
103 return -1;
104 }
105}
106
107//______________________________________________________________________________
108void ByPosition(const AliMpVSegmentation* seg, Int_t detElemId, const TObjArray& pads)
109{
110 /// Time the PadByPosition method
111
112 Int_t stationId = StationId(detElemId);
113
70d92702 114 AliCodeTimerAutoGeneral(Form("PadByPosition-St%d",stationId),);
909eee57 115
116 TIter next(&pads);
117 AliMpPad* pad;
118
119 while ( ( pad = static_cast<AliMpPad*>(next()) ) )
120 {
6e97fbb8 121 seg->PadByPosition(pad->GetPositionX(),pad->GetPositionY(),kFALSE);
909eee57 122 }
123}
124
125//______________________________________________________________________________
126void ByIndices(const AliMpVSegmentation* seg, Int_t detElemId)
127{
128 /// Time the (Has)PadByIndices method
129
130 Int_t stationId = StationId(detElemId);
131 {
70d92702 132 AliCodeTimerAutoGeneral(Form("PadByIndices-St%d",stationId),);
909eee57 133
134 for ( Int_t ix = 0; ix < seg->MaxPadIndexX(); ++ix )
135 {
136 for ( Int_t iy = 0; iy < seg->MaxPadIndexY(); ++iy )
137 {
168e9c4d 138 seg->PadByIndices(ix,iy,kFALSE);
909eee57 139 }
140 }
141 }
142
909eee57 143 {
70d92702 144 AliCodeTimerAutoGeneral(Form("HasPadByIndices-St%d",stationId),);
909eee57 145
146 for ( Int_t ix = 0; ix < seg->MaxPadIndexX(); ++ix )
147 {
148 for ( Int_t iy = 0; iy < seg->MaxPadIndexY(); ++iy )
149 {
168e9c4d 150 seg->HasPadByIndices(ix,iy);
909eee57 151 }
152 }
153 }
909eee57 154}
155
156//______________________________________________________________________________
157void ByLocation(const AliMpVSegmentation* seg, Int_t detElemId, Int_t manuId)
158{
159 /// Time the (Has)PadByLocation method
160
161 Int_t stationId = StationId(detElemId);
162 {
70d92702 163 AliCodeTimerAutoGeneral(Form("PadByLocation-St%d",stationId),);
909eee57 164
165 for ( Int_t manuChannel = 0; manuChannel < AliMpConstants::ManuNofChannels(); ++manuChannel )
166 {
168e9c4d 167 seg->PadByLocation(manuId,manuChannel,kFALSE);
909eee57 168 }
169 }
170
909eee57 171 {
70d92702 172 AliCodeTimerAutoGeneral(Form("HasPadByLocation-St%d",stationId),);
909eee57 173
174 for ( Int_t manuChannel = 0; manuChannel < AliMpConstants::ManuNofChannels(); ++manuChannel )
175 {
168e9c4d 176 seg->HasPadByLocation(manuId,manuChannel);
909eee57 177 }
178 }
909eee57 179
180}
181
182//______________________________________________________________________________
183void timeMapping(Int_t nloop=1)
184{
185 AliCodeTimer::Instance()->Reset();
186
187 {
188 AliSysInfo::AddStamp("0");
70d92702 189 AliCodeTimerAutoGeneral("Load mapping",);
909eee57 190 AliMpCDB::LoadDDLStore2();
191 AliSysInfo::AddStamp("1");
192 AliCodeTimer::Instance()->Print();
193 TTree t;
194 t.ReadFile("syswatch.log");
195 t.Scan("pI.fMemResident:sname");
196 }
197
198 AliCodeTimer::Instance()->Reset();
199
200 for ( Int_t i = 0; i < nloop; ++i )
201 {
202 AliMpManuIterator it;
203
204 Int_t detElemId;
205 Int_t manuId;
206
207 while ( it.Next(detElemId,manuId) )
208 {
209 const AliMpVSegmentation* seg = AliMpSegmentation::Instance()->GetMpSegmentationByElectronics(detElemId,manuId);
210
211 ByLocation(seg,detElemId,manuId);
212 }
213
214 AliMpDEIterator deit;
215
216 deit.First();
217
218 while (!deit.IsDone())
219 {
220 Int_t detElemId = deit.CurrentDEId();
221
222 if ( AliMpDEManager::GetStationType(detElemId) != AliMp::kStationTrigger )
223 {
224
225 for ( Int_t cath = 0; cath < 2; ++cath )
226 {
227 const AliMpVSegmentation* seg = AliMpSegmentation::Instance()->GetMpSegmentation(detElemId,AliMp::GetCathodType(cath));
228
229 ByIndices(seg,detElemId);
230
231 TObjArray pads;
232 pads.SetOwner(kTRUE);
233
234 AliMpVPadIterator* pit = seg->CreateIterator();
235
236 pit->First();
237
238 while (!pit->IsDone())
239 {
240 AliMpPad pad = pit->CurrentItem();
241 pads.Add(new AliMpPad(pad));
242 pit->Next();
243 }
244
245 delete pit;
246
247 ByPosition(seg, detElemId, pads);
248 }
249
250 }
251
252 deit.Next();
253 }
254
255 }
256 AliCodeTimer::Instance()->Print();
257}
258
f05d3eb1 259#endif