2 /// Macro to time the PadBy*** methods of AliMpVSegmentation implementation(s)
4 /// The output should ressemble this (output from a MacBook Pro 2.33 GHz on Feb, 18th, 2009)
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!
10 /// ManuId2PCBIndex R:0.0645s C:0.0400s (9676 slices)
11 /// ManuId2Sector R:0.0434s C:0.0200s (7152 slices)
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)
22 /// timeMapping Load mapping R:2.9965s C:2.9000s (1 slices) (1)
23 /// ************************************
24 /// * Row * pI.fMemRe * sname *
25 /// ************************************
27 /// * 1 * 76 * 1 * (2)
28 /// ************************************
30 /// GetMotifPosition R:0.0795s C:0.1400s (7152 slices)
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)
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)
43 /// PadByPosition-St12 R:7.6133s C:7.5700s (32 slices) (5)
44 /// PadByPosition-St345 R:2.3484s C:2.4300s (280 slices)
46 /// Interesting points in the output are :
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.
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
57 /// Note also that currently the PadByPosition is by far the slowest of the
58 /// 3 methods (Indices,Location,Position).
60 /// L. Aphecetche, Subatech
63 #if !defined(__CINT__) || defined(__MAKECINT__)
65 #include "AliMpVSegmentation.h"
67 #include "AliMpSegmentation.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"
76 #include "AliMpVPadIterator.h"
78 #include "AliSysInfo.h"
80 #include <TObjArray.h>
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...
88 //______________________________________________________________________________
89 Int_t StationId(Int_t detElemId)
91 switch ( 1 + AliMpDEManager::GetChamberId(detElemId) / 2 )
107 //______________________________________________________________________________
108 void ByPosition(const AliMpVSegmentation* seg, Int_t detElemId, const TObjArray& pads)
110 /// Time the PadByPosition method
112 Int_t stationId = StationId(detElemId);
114 AliCodeTimerAutoGeneral(Form("PadByPosition-St%d",stationId),);
119 while ( ( pad = static_cast<AliMpPad*>(next()) ) )
121 seg->PadByPosition(pad->GetPositionX(),pad->GetPositionY(),kFALSE);
125 //______________________________________________________________________________
126 void ByIndices(const AliMpVSegmentation* seg, Int_t detElemId)
128 /// Time the (Has)PadByIndices method
130 Int_t stationId = StationId(detElemId);
132 AliCodeTimerAutoGeneral(Form("PadByIndices-St%d",stationId),);
134 for ( Int_t ix = 0; ix < seg->MaxPadIndexX(); ++ix )
136 for ( Int_t iy = 0; iy < seg->MaxPadIndexY(); ++iy )
138 seg->PadByIndices(ix,iy,kFALSE);
144 AliCodeTimerAutoGeneral(Form("HasPadByIndices-St%d",stationId),);
146 for ( Int_t ix = 0; ix < seg->MaxPadIndexX(); ++ix )
148 for ( Int_t iy = 0; iy < seg->MaxPadIndexY(); ++iy )
150 seg->HasPadByIndices(ix,iy);
156 //______________________________________________________________________________
157 void ByLocation(const AliMpVSegmentation* seg, Int_t detElemId, Int_t manuId)
159 /// Time the (Has)PadByLocation method
161 Int_t stationId = StationId(detElemId);
163 AliCodeTimerAutoGeneral(Form("PadByLocation-St%d",stationId),);
165 for ( Int_t manuChannel = 0; manuChannel < AliMpConstants::ManuNofChannels(); ++manuChannel )
167 seg->PadByLocation(manuId,manuChannel,kFALSE);
172 AliCodeTimerAutoGeneral(Form("HasPadByLocation-St%d",stationId),);
174 for ( Int_t manuChannel = 0; manuChannel < AliMpConstants::ManuNofChannels(); ++manuChannel )
176 seg->HasPadByLocation(manuId,manuChannel);
182 //______________________________________________________________________________
183 void timeMapping(Int_t nloop=1)
185 AliCodeTimer::Instance()->Reset();
188 AliSysInfo::AddStamp("0");
189 AliCodeTimerAutoGeneral("Load mapping",);
190 AliMpCDB::LoadDDLStore2();
191 AliSysInfo::AddStamp("1");
192 AliCodeTimer::Instance()->Print();
194 t.ReadFile("syswatch.log");
195 t.Scan("pI.fMemResident:sname");
198 AliCodeTimer::Instance()->Reset();
200 for ( Int_t i = 0; i < nloop; ++i )
202 AliMpManuIterator it;
207 while ( it.Next(detElemId,manuId) )
209 const AliMpVSegmentation* seg = AliMpSegmentation::Instance()->GetMpSegmentationByElectronics(detElemId,manuId);
211 ByLocation(seg,detElemId,manuId);
214 AliMpDEIterator deit;
218 while (!deit.IsDone())
220 Int_t detElemId = deit.CurrentDEId();
222 if ( AliMpDEManager::GetStationType(detElemId) != AliMp::kStationTrigger )
225 for ( Int_t cath = 0; cath < 2; ++cath )
227 const AliMpVSegmentation* seg = AliMpSegmentation::Instance()->GetMpSegmentation(detElemId,AliMp::GetCathodType(cath));
229 ByIndices(seg,detElemId);
232 pads.SetOwner(kTRUE);
234 AliMpVPadIterator* pit = seg->CreateIterator();
238 while (!pit->IsDone())
240 AliMpPad pad = pit->CurrentItem();
241 pads.Add(new AliMpPad(pad));
247 ByPosition(seg, detElemId, pads);
256 AliCodeTimer::Instance()->Print();