]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/mapping/macros/timeMapping.C
New setting of the cross-section (Bogdan)
[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
88#define HASPAD
89
90//______________________________________________________________________________
91Int_t StationId(Int_t detElemId)
92{
93 switch ( 1 + AliMpDEManager::GetChamberId(detElemId) / 2 )
94 {
95 case 1:
96 case 2:
97 return 12;
98 break;
99 case 3:
100 case 4:
101 case 5:
102 return 345;
103 break;
104 default:
105 return -1;
106 }
107}
108
109//______________________________________________________________________________
110void ByPosition(const AliMpVSegmentation* seg, Int_t detElemId, const TObjArray& pads)
111{
112 /// Time the PadByPosition method
113
114 Int_t stationId = StationId(detElemId);
115
116 AliCodeTimerAutoGeneral(Form("PadByPosition-St%d",stationId));
117
118 TIter next(&pads);
119 AliMpPad* pad;
120
121 while ( ( pad = static_cast<AliMpPad*>(next()) ) )
122 {
123 seg->PadByPosition(pad->Position(),kFALSE);
124 }
125}
126
127//______________________________________________________________________________
128void ByIndices(const AliMpVSegmentation* seg, Int_t detElemId)
129{
130 /// Time the (Has)PadByIndices method
131
132 Int_t stationId = StationId(detElemId);
133 {
134 AliCodeTimerAutoGeneral(Form("PadByIndices-St%d",stationId));
135
136 for ( Int_t ix = 0; ix < seg->MaxPadIndexX(); ++ix )
137 {
138 for ( Int_t iy = 0; iy < seg->MaxPadIndexY(); ++iy )
139 {
140 seg->PadByIndices(AliMpIntPair(ix,iy),kFALSE);
141 }
142 }
143 }
144
145#ifdef HASPAD
146 {
147 AliCodeTimerAutoGeneral(Form("HasPadByIndices-St%d",stationId));
148
149 for ( Int_t ix = 0; ix < seg->MaxPadIndexX(); ++ix )
150 {
151 for ( Int_t iy = 0; iy < seg->MaxPadIndexY(); ++iy )
152 {
153 seg->HasPadByIndices(AliMpIntPair(ix,iy));
154 }
155 }
156 }
157#endif
158}
159
160//______________________________________________________________________________
161void ByLocation(const AliMpVSegmentation* seg, Int_t detElemId, Int_t manuId)
162{
163 /// Time the (Has)PadByLocation method
164
165 Int_t stationId = StationId(detElemId);
166 {
167 AliCodeTimerAutoGeneral(Form("PadByLocation-St%d",stationId));
168
169 for ( Int_t manuChannel = 0; manuChannel < AliMpConstants::ManuNofChannels(); ++manuChannel )
170 {
171 seg->PadByLocation(AliMpIntPair(manuId,manuChannel),kFALSE);
172 }
173 }
174
175#ifdef HASPAD
176 {
177 AliCodeTimerAutoGeneral(Form("HasPadByLocation-St%d",stationId));
178
179 for ( Int_t manuChannel = 0; manuChannel < AliMpConstants::ManuNofChannels(); ++manuChannel )
180 {
181 seg->HasPadByLocation(AliMpIntPair(manuId,manuChannel));
182 }
183 }
184#endif
185
186}
187
188//______________________________________________________________________________
189void timeMapping(Int_t nloop=1)
190{
191 AliCodeTimer::Instance()->Reset();
192
193 {
194 AliSysInfo::AddStamp("0");
195 AliCodeTimerAutoGeneral("Load mapping");
196 AliMpCDB::LoadDDLStore2();
197 AliSysInfo::AddStamp("1");
198 AliCodeTimer::Instance()->Print();
199 TTree t;
200 t.ReadFile("syswatch.log");
201 t.Scan("pI.fMemResident:sname");
202 }
203
204 AliCodeTimer::Instance()->Reset();
205
206 for ( Int_t i = 0; i < nloop; ++i )
207 {
208 AliMpManuIterator it;
209
210 Int_t detElemId;
211 Int_t manuId;
212
213 while ( it.Next(detElemId,manuId) )
214 {
215 const AliMpVSegmentation* seg = AliMpSegmentation::Instance()->GetMpSegmentationByElectronics(detElemId,manuId);
216
217 ByLocation(seg,detElemId,manuId);
218 }
219
220 AliMpDEIterator deit;
221
222 deit.First();
223
224 while (!deit.IsDone())
225 {
226 Int_t detElemId = deit.CurrentDEId();
227
228 if ( AliMpDEManager::GetStationType(detElemId) != AliMp::kStationTrigger )
229 {
230
231 for ( Int_t cath = 0; cath < 2; ++cath )
232 {
233 const AliMpVSegmentation* seg = AliMpSegmentation::Instance()->GetMpSegmentation(detElemId,AliMp::GetCathodType(cath));
234
235 ByIndices(seg,detElemId);
236
237 TObjArray pads;
238 pads.SetOwner(kTRUE);
239
240 AliMpVPadIterator* pit = seg->CreateIterator();
241
242 pit->First();
243
244 while (!pit->IsDone())
245 {
246 AliMpPad pad = pit->CurrentItem();
247 pads.Add(new AliMpPad(pad));
248 pit->Next();
249 }
250
251 delete pit;
252
253 ByPosition(seg, detElemId, pads);
254 }
255
256 }
257
258 deit.Next();
259 }
260
261 }
262 AliCodeTimer::Instance()->Print();
263}
264
f05d3eb1 265#endif