]>
Commit | Line | Data |
---|---|---|
cac2eb58 | 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 | **************************************************************************/ | |
cac2eb58 | 15 | /* $Id$ */ |
16 | ||
3d1463c8 | 17 | //----------------------------------------------------------------------------- |
22899106 | 18 | /// \class AliMUONReconstructor |
19 | /// | |
20 | /// Implementation of AliReconstructor for MUON subsystem. | |
21 | /// | |
22 | /// The behavior of the MUON reconstruction can be changed, besides | |
23 | /// the usual methods found in AliReconstruction (e.g. to disable tracking) | |
24 | /// by using AliReconstruction::SetOption("MUON",options) | |
25 | /// where options should be a space separated string. | |
26 | /// | |
27 | /// Valid options are : | |
28 | /// | |
29 | /// SAVEDIGITS : if you want to save in the TreeD the *calibrated* digits | |
30 | /// that are used for the clustering | |
31 | /// | |
32 | /// SIMPLEFIT : use the AliMUONClusterFinderSimpleFit clusterizer | |
33 | /// | |
34 | /// AZ : use the AliMUONClusterFinderAZ clusterizer (default) | |
35 | /// | |
93d7b017 | 36 | /// MLEM : another implementation of AZ, where preclustering is external |
37 | /// MLEMV3 : MLEM with preclustering=PRECLUSTERV2 | |
38 | /// MLEMV3 : MLEM with preclustering=PRECLUSTERV3 | |
39 | /// | |
22899106 | 40 | /// PRECLUSTER : use only AliMUONPreClusterFinder. Only for debug as |
41 | /// the produced clusters do not have a position, hence the tracking will not | |
42 | /// work | |
93d7b017 | 43 | /// PRECLUSTERV2 : another version of the preclustering |
44 | /// PRECLUSTERV3 : yet another version of the preclustering | |
22899106 | 45 | /// |
46 | /// COG : use AliMUONClusterFinderCOG clusterizer. Not really a production | |
47 | /// option either, as center-of-gravity is generally not a good estimate | |
48 | /// of the cluster position... | |
49 | /// | |
50 | /// NOCLUSTERING : bypass completely the clustering stage | |
51 | /// | |
52 | /// NOSTATUSMAP : disable the computation and usage of the pad status map. Only | |
53 | /// for debug ! | |
54 | /// | |
55 | /// NOLOCALRECONSTRUCTION : for debug, to disable local reconstruction (and hence | |
56 | /// "recover" old behavior) | |
57 | /// | |
58 | /// TRIGGERDISABLE : disable the treatment of MUON trigger | |
59 | /// | |
93d7b017 | 60 | /// DIGITSTOREV1 : use the V1 implementation of the digitstore |
61 | /// DIGITSTOREV2R : use the V2R implementation of the digitstore | |
62 | /// | |
22899106 | 63 | /// \author Laurent Aphecetche, Subatech |
3d1463c8 | 64 | //----------------------------------------------------------------------------- |
30178c30 | 65 | |
cf464691 | 66 | #include "AliMUONReconstructor.h" |
b2d7df0b | 67 | |
22899106 | 68 | #include "AliCDBManager.h" |
69 | #include "AliLoader.h" | |
70 | #include "AliLog.h" | |
71 | #include "AliRunLoader.h" | |
b2d7df0b | 72 | #include "AliMUONCalibrationData.h" |
22899106 | 73 | #include "AliMUONClusterFinderCOG.h" |
74 | #include "AliMUONClusterFinderMLEM.h" | |
75 | #include "AliMUONClusterFinderSimpleFit.h" | |
346fb008 | 76 | #include "AliMUONClusterFinderAZ.h" |
b2d7df0b | 77 | #include "AliMUONClusterReconstructor.h" |
22899106 | 78 | #include "AliMUONClusterStoreV1.h" |
79 | #include "AliMUONConstants.h" | |
b2d7df0b | 80 | #include "AliMUONDigitCalibrator.h" |
2cf44ef3 | 81 | #include "AliMUONDigitMaker.h" |
22899106 | 82 | #include "AliMUONDigitStoreV1.h" |
93d7b017 | 83 | #include "AliMUONDigitStoreV2R.h" |
22899106 | 84 | #include "AliMUONGeometryTransformer.h" |
85 | #include "AliMUONPreClusterFinder.h" | |
93d7b017 | 86 | #include "AliMUONPreClusterFinderV2.h" |
87 | #include "AliMUONPreClusterFinderV3.h" | |
196471e9 | 88 | #include "AliMUONTracker.h" |
22899106 | 89 | #include "AliMUONVTrackStore.h" |
8c0b5e70 | 90 | #include "AliMUONTriggerChamberEff.h" |
e1a10d41 | 91 | #include "AliMUONTriggerCircuit.h" |
96fdfe9a | 92 | #include "AliMUONTriggerCrateStore.h" |
22899106 | 93 | #include "AliMUONTriggerStoreV1.h" |
94 | #include "AliMUONVClusterFinder.h" | |
88544f7e | 95 | #include "AliMpCDB.h" |
cf464691 | 96 | #include "AliRawReader.h" |
93d7b017 | 97 | #include "AliCodeTimer.h" |
22899106 | 98 | #include <Riostream.h> |
99 | #include <TClonesArray.h> | |
100 | #include <TString.h> | |
101 | #include <TTree.h> | |
93d7b017 | 102 | //#include "AliCodeTimer.h" |
9265505b | 103 | /// \cond CLASSIMP |
cac2eb58 | 104 | ClassImp(AliMUONReconstructor) |
22899106 | 105 | /// \endcond |
b2d7df0b | 106 | |
cac2eb58 | 107 | //_____________________________________________________________________________ |
22899106 | 108 | AliMUONReconstructor::AliMUONReconstructor() : |
109 | AliReconstructor(), | |
110 | fCrateManager(0x0), | |
111 | fDigitMaker(0x0), | |
ef4cb4f1 | 112 | fTransformer(new AliMUONGeometryTransformer()), |
22899106 | 113 | fDigitStore(0x0), |
114 | fTriggerCircuit(0x0), | |
115 | fCalibrationData(0x0), | |
116 | fDigitCalibrator(0x0), | |
117 | fClusterReconstructor(0x0), | |
118 | fClusterStore(0x0), | |
119 | fTriggerStore(0x0), | |
120 | fTrackStore(0x0), | |
93d7b017 | 121 | fTrigChamberEff(0x0) |
8789635b | 122 | { |
22899106 | 123 | /// normal ctor |
88544f7e | 124 | |
125 | // Load geometry data | |
ef4cb4f1 | 126 | fTransformer->LoadGeometryData(); |
88544f7e | 127 | |
128 | // Load mapping | |
129 | if ( ! AliMpCDB::LoadMpSegmentation() ) | |
130 | { | |
131 | AliFatal("Could not access mapping from OCDB !"); | |
132 | } | |
133 | ||
134 | // Load DDL store | |
135 | if ( ! AliMpCDB::LoadDDLStore() ) | |
136 | { | |
137 | AliFatal("Could not access DDL Store from OCDB !"); | |
138 | } | |
139 | ||
140 | ||
22899106 | 141 | } |
d19b6003 | 142 | |
22899106 | 143 | //_____________________________________________________________________________ |
144 | AliMUONReconstructor::~AliMUONReconstructor() | |
145 | { | |
146 | /// dtor | |
147 | delete fDigitMaker; | |
148 | delete fDigitStore; | |
149 | delete fTransformer; | |
150 | delete fCrateManager; | |
151 | delete fTriggerCircuit; | |
152 | delete fCalibrationData; | |
153 | delete fDigitCalibrator; | |
154 | delete fClusterReconstructor; | |
155 | delete fClusterStore; | |
156 | delete fTriggerStore; | |
157 | delete fTrackStore; | |
8c0b5e70 | 158 | delete fTrigChamberEff; |
22899106 | 159 | } |
96fdfe9a | 160 | |
22899106 | 161 | //_____________________________________________________________________________ |
162 | void | |
163 | AliMUONReconstructor::Calibrate(AliMUONVDigitStore& digitStore) const | |
164 | { | |
165 | /// Calibrate the digitStore | |
166 | if (!fDigitCalibrator) | |
167 | { | |
168 | CreateCalibrator(); | |
169 | } | |
93d7b017 | 170 | AliCodeTimerAuto(Form("%s::Calibrate(AliMUONVDigitStore*)",fDigitCalibrator->ClassName())) |
22899106 | 171 | fDigitCalibrator->Calibrate(digitStore); |
172 | } | |
96fdfe9a | 173 | |
22899106 | 174 | //_____________________________________________________________________________ |
175 | void | |
176 | AliMUONReconstructor::Clusterize(const AliMUONVDigitStore& digitStore, | |
177 | AliMUONVClusterStore& clusterStore) const | |
178 | { | |
179 | /// Creates clusters from digits. | |
9c4b1ee7 | 180 | |
22899106 | 181 | TString sopt(GetOption()); |
182 | sopt.ToUpper(); | |
183 | if ( sopt.Contains("NOCLUSTERING") ) return; | |
184 | ||
185 | if (!fClusterReconstructor) | |
186 | { | |
187 | CreateClusterReconstructor(); | |
188 | } | |
9c4b1ee7 | 189 | |
93d7b017 | 190 | AliCodeTimerAuto(Form("%s::Digits2Clusters(const AliMUONVDigitStore&,AliMUONVClusterStore&)", |
191 | fClusterReconstructor->ClassName())) | |
22899106 | 192 | fClusterReconstructor->Digits2Clusters(digitStore,clusterStore); |
8789635b | 193 | } |
94f6fba9 | 194 | |
8789635b | 195 | //_____________________________________________________________________________ |
22899106 | 196 | AliMUONVClusterStore* |
197 | AliMUONReconstructor::ClusterStore() const | |
cac2eb58 | 198 | { |
22899106 | 199 | /// Return (and create if necessary) the cluster container |
200 | if (!fClusterStore) | |
201 | { | |
202 | fClusterStore = new AliMUONClusterStoreV1; | |
203 | } | |
204 | return fClusterStore; | |
205 | } | |
d19b6003 | 206 | |
22899106 | 207 | //_____________________________________________________________________________ |
208 | void | |
209 | AliMUONReconstructor::ConvertDigits(AliRawReader* rawReader, | |
210 | AliMUONVDigitStore* digitStore, | |
211 | AliMUONVTriggerStore* triggerStore) const | |
212 | { | |
213 | /// Convert raw data into digit and trigger stores | |
214 | CreateDigitMaker(); | |
93d7b017 | 215 | |
216 | AliCodeTimerStart(Form("%s::Raw2Digits(AliRawReader*,AliMUONVDigitStore*,AliMUONVTriggerStore*)", | |
217 | fDigitMaker->ClassName())) | |
22899106 | 218 | fDigitMaker->Raw2Digits(rawReader,digitStore,triggerStore); |
93d7b017 | 219 | AliCodeTimerStop(Form("%s::Raw2Digits(AliRawReader*,AliMUONVDigitStore*,AliMUONVTriggerStore*)", |
220 | fDigitMaker->ClassName())) | |
22899106 | 221 | Calibrate(*digitStore); |
cac2eb58 | 222 | } |
b2d7df0b | 223 | |
224 | //_____________________________________________________________________________ | |
22899106 | 225 | void |
226 | AliMUONReconstructor::ConvertDigits(AliRawReader* rawReader, TTree* digitsTree) const | |
b2d7df0b | 227 | { |
22899106 | 228 | /// convert raw data into a digit tree |
229 | ||
230 | Bool_t alone = ( TriggerStore() == 0 ); | |
b2d7df0b | 231 | |
22899106 | 232 | Bool_t ok = DigitStore()->Connect(*digitsTree,alone); |
233 | if ( TriggerStore() ) | |
b476b122 | 234 | { |
22899106 | 235 | ok = ok && TriggerStore()->Connect(*digitsTree,kFALSE); |
b476b122 | 236 | } |
ee103e97 | 237 | |
22899106 | 238 | if (!ok) |
239 | { | |
240 | AliError("Could not make branches on TreeD"); | |
241 | } | |
242 | else | |
243 | { | |
244 | ConvertDigits(rawReader,DigitStore(),TriggerStore()); | |
245 | digitsTree->Fill(); | |
246 | DigitStore()->Clear(); | |
247 | } | |
248 | } | |
249 | ||
250 | //_____________________________________________________________________________ | |
251 | AliMUONTriggerCrateStore* | |
252 | AliMUONReconstructor::CrateManager() const | |
253 | { | |
254 | /// Return (and create if necessary) the trigger crate store | |
255 | if (fCrateManager) return fCrateManager; | |
256 | fCrateManager = new AliMUONTriggerCrateStore; | |
257 | fCrateManager->ReadFromFile(); | |
258 | return fCrateManager; | |
259 | } | |
260 | ||
261 | //_____________________________________________________________________________ | |
262 | void | |
263 | AliMUONReconstructor::CreateDigitMaker() const | |
264 | { | |
265 | /// Create (and create if necessary) the digit maker | |
266 | if (fDigitMaker) return; | |
267 | ||
93d7b017 | 268 | AliCodeTimerAuto("") |
22899106 | 269 | |
270 | fDigitMaker = new AliMUONDigitMaker; | |
22899106 | 271 | } |
272 | ||
273 | //_____________________________________________________________________________ | |
274 | void | |
275 | AliMUONReconstructor::CreateTriggerCircuit() const | |
276 | { | |
277 | /// Return (and create if necessary) the trigger circuit object | |
278 | if (fTriggerCircuit) return; | |
279 | ||
93d7b017 | 280 | AliCodeTimerAuto("") |
22899106 | 281 | |
32ab62c9 | 282 | fTriggerCircuit = new AliMUONTriggerCircuit(fTransformer); |
22899106 | 283 | |
32ab62c9 | 284 | } |
8c0b5e70 | 285 | |
286 | //_____________________________________________________________________________ | |
287 | void | |
288 | AliMUONReconstructor::CreateTriggerChamberEff() const | |
289 | { | |
290 | /// Create (and create if necessary) the trigger chamber efficiency class | |
291 | if (fTrigChamberEff) return; | |
292 | ||
93d7b017 | 293 | AliCodeTimerAuto("") |
8c0b5e70 | 294 | |
295 | fTrigChamberEff = new AliMUONTriggerChamberEff(fTransformer,fDigitMaker,kTRUE); | |
296 | //fTrigChamberEff->SetDebugLevel(1); | |
297 | } | |
298 | ||
22899106 | 299 | //_____________________________________________________________________________ |
300 | AliTracker* | |
301 | AliMUONReconstructor::CreateTracker(AliRunLoader* runLoader) const | |
302 | { | |
303 | /// Create the MUONTracker object | |
304 | /// The MUONTracker is passed the GetOption(), i.e. our own options | |
ee103e97 | 305 | |
22899106 | 306 | CreateTriggerCircuit(); |
307 | CreateDigitMaker(); | |
8c0b5e70 | 308 | CreateTriggerChamberEff(); |
22899106 | 309 | |
310 | AliLoader* loader = runLoader->GetDetectorLoader("MUON"); | |
311 | if (!loader) | |
ee103e97 | 312 | { |
22899106 | 313 | AliError("Cannot get MUONLoader, so cannot create MUONTracker"); |
314 | return 0x0; | |
ee103e97 | 315 | } |
8c0b5e70 | 316 | AliMUONTracker* tracker = new AliMUONTracker(loader,fDigitMaker,fTransformer,fTriggerCircuit,fTrigChamberEff); |
22899106 | 317 | tracker->SetOption(GetOption()); |
318 | ||
319 | return tracker; | |
b2d7df0b | 320 | } |
321 | ||
f9247068 | 322 | //_____________________________________________________________________________ |
22899106 | 323 | void |
196471e9 | 324 | AliMUONReconstructor::CreateClusterReconstructor() const |
f9247068 | 325 | { |
22899106 | 326 | /// Create cluster reconstructor, depending on GetOption() |
327 | ||
93d7b017 | 328 | AliCodeTimerAuto("") |
06ca6d7b | 329 | |
22899106 | 330 | AliDebug(1,""); |
331 | ||
f9247068 | 332 | AliMUONVClusterFinder* clusterFinder(0x0); |
333 | ||
334 | TString opt(GetOption()); | |
335 | opt.ToUpper(); | |
336 | ||
93d7b017 | 337 | if ( strstr(opt,"PRECLUSTERV2") ) |
338 | { | |
339 | clusterFinder = new AliMUONPreClusterFinderV2; | |
340 | } | |
341 | else if ( strstr(opt,"PRECLUSTERV3") ) | |
342 | { | |
343 | clusterFinder = new AliMUONPreClusterFinderV3; | |
344 | } | |
345 | else if ( strstr(opt,"PRECLUSTER") ) | |
f9247068 | 346 | { |
347 | clusterFinder = new AliMUONPreClusterFinder; | |
348 | } | |
349 | else if ( strstr(opt,"COG") ) | |
350 | { | |
93d7b017 | 351 | clusterFinder = new AliMUONClusterFinderCOG(new AliMUONPreClusterFinder); |
f9247068 | 352 | } |
93d7b017 | 353 | else if ( strstr(opt,"SIMPLEFITV3") ) |
354 | { | |
355 | clusterFinder = new AliMUONClusterFinderSimpleFit(new AliMUONClusterFinderCOG(new AliMUONPreClusterFinderV3)); | |
356 | } | |
f9247068 | 357 | else if ( strstr(opt,"SIMPLEFIT") ) |
358 | { | |
93d7b017 | 359 | clusterFinder = new AliMUONClusterFinderSimpleFit(new AliMUONClusterFinderCOG(new AliMUONPreClusterFinder)); |
f9247068 | 360 | } |
361 | else if ( strstr(opt,"MLEM:DRAW") ) | |
362 | { | |
93d7b017 | 363 | clusterFinder = new AliMUONClusterFinderMLEM(kTRUE,new AliMUONPreClusterFinder); |
f9247068 | 364 | } |
93d7b017 | 365 | else if ( strstr(opt,"MLEMV3") ) |
366 | { | |
367 | clusterFinder = new AliMUONClusterFinderMLEM(kFALSE,new AliMUONPreClusterFinderV3); | |
368 | } | |
369 | else if ( strstr(opt,"MLEMV2") ) | |
370 | { | |
371 | clusterFinder = new AliMUONClusterFinderMLEM(kFALSE,new AliMUONPreClusterFinderV2); | |
372 | } | |
f9247068 | 373 | else if ( strstr(opt,"MLEM") ) |
374 | { | |
93d7b017 | 375 | clusterFinder = new AliMUONClusterFinderMLEM(kFALSE,new AliMUONPreClusterFinder); |
f9247068 | 376 | } |
22899106 | 377 | else if ( strstr(opt,"AZ") ) |
378 | { | |
379 | clusterFinder = new AliMUONClusterFinderAZ; | |
380 | } | |
381 | else | |
382 | { | |
93d7b017 | 383 | // default is currently AZ |
22899106 | 384 | clusterFinder = new AliMUONClusterFinderAZ; |
385 | } | |
f9247068 | 386 | |
22899106 | 387 | if ( clusterFinder ) |
f9247068 | 388 | { |
389 | AliInfo(Form("Will use %s for clusterizing",clusterFinder->ClassName())); | |
390 | } | |
391 | ||
22899106 | 392 | fClusterReconstructor = new AliMUONClusterReconstructor(clusterFinder,fTransformer); |
f9247068 | 393 | } |
394 | ||
cac2eb58 | 395 | //_____________________________________________________________________________ |
22899106 | 396 | void |
397 | AliMUONReconstructor::CreateCalibrator() const | |
cac2eb58 | 398 | { |
22899106 | 399 | /// Create the calibrator |
2457f726 | 400 | |
93d7b017 | 401 | AliCodeTimerAuto("") |
3bc8b580 | 402 | |
22899106 | 403 | Int_t runNumber = AliCDBManager::Instance()->GetRun(); |
3bc8b580 | 404 | |
22899106 | 405 | AliInfo("Calibration will occur."); |
406 | ||
407 | fCalibrationData = new AliMUONCalibrationData(runNumber); | |
408 | if ( !fCalibrationData->IsValid() ) | |
409 | { | |
410 | AliError("Could not retrieve calibrations !"); | |
411 | delete fCalibrationData; | |
412 | fCalibrationData = 0x0; | |
413 | return; | |
414 | } | |
415 | ||
416 | // Check that we get all the calibrations we'll need | |
417 | if ( !fCalibrationData->Pedestals() || | |
418 | !fCalibrationData->Gains() || | |
419 | !fCalibrationData->HV() ) | |
420 | { | |
421 | AliFatal("Could not access all required calibration data"); | |
9ffe3ef4 | 422 | } |
cc87ebcd | 423 | |
22899106 | 424 | TString opt(GetOption()); |
425 | opt.ToUpper(); | |
426 | Bool_t statusMap(kTRUE); | |
b2d7df0b | 427 | |
22899106 | 428 | if ( strstr(opt,"NOSTATUSMAP") ) |
429 | { | |
430 | AliWarning("Disconnecting status map : SHOULD BE USED FOR DEBUG ONLY. NOT FOR PRODUCTION !!!"); | |
431 | statusMap = kFALSE; | |
432 | } | |
433 | fDigitCalibrator = new AliMUONDigitCalibrator(*fCalibrationData,statusMap); | |
434 | } | |
9c4b1ee7 | 435 | |
22899106 | 436 | //_____________________________________________________________________________ |
437 | AliMUONVDigitStore* | |
438 | AliMUONReconstructor::DigitStore() const | |
439 | { | |
440 | /// Return (and create if necessary) the digit container | |
441 | if (!fDigitStore) | |
442 | { | |
93d7b017 | 443 | TString sopt(GetOption()); |
444 | sopt.ToUpper(); | |
445 | ||
446 | AliInfo(Form("Options=%s",sopt.Data())); | |
447 | ||
448 | if ( sopt.Contains("DIGITSTOREV1") ) | |
449 | { | |
450 | fDigitStore = AliMUONVDigitStore::Create("AliMUONDigitStoreV1"); | |
451 | } | |
452 | else if ( sopt.Contains("DIGITSTOREV2R") ) | |
453 | { | |
454 | fDigitStore = AliMUONVDigitStore::Create("AliMUONDigitStoreV2R"); | |
455 | } | |
456 | else if ( sopt.Contains("DIGITSTOREV2S") ) | |
457 | { | |
458 | fDigitStore = AliMUONVDigitStore::Create("AliMUONDigitStoreV2S"); | |
459 | } | |
460 | ||
461 | if (!fDigitStore) fDigitStore = AliMUONVDigitStore::Create("AliMUONDigitStoreV2R"); | |
462 | ||
463 | AliInfo(Form("Will use %s to store digits during reconstruction",fDigitStore->ClassName())); | |
22899106 | 464 | } |
465 | return fDigitStore; | |
466 | } | |
94f6fba9 | 467 | |
22899106 | 468 | //_____________________________________________________________________________ |
469 | void | |
470 | AliMUONReconstructor::FillTreeR(AliMUONVTriggerStore* triggerStore, | |
471 | AliMUONVClusterStore* clusterStore, | |
472 | TTree& clustersTree) const | |
473 | { | |
474 | /// Write the trigger and cluster information into TreeR | |
475 | ||
93d7b017 | 476 | AliCodeTimerAuto("") |
cc87ebcd | 477 | |
22899106 | 478 | AliDebug(1,""); |
479 | ||
480 | Bool_t ok(kFALSE); | |
481 | if ( triggerStore ) | |
482 | { | |
483 | Bool_t alone = ( clusterStore ? kFALSE : kTRUE ); | |
484 | ok = triggerStore->Connect(clustersTree,alone); | |
485 | if (!ok) | |
b2d7df0b | 486 | { |
22899106 | 487 | AliError("Could not create triggerStore branches in TreeR"); |
cc87ebcd | 488 | } |
cac2eb58 | 489 | } |
22899106 | 490 | |
491 | if ( clusterStore ) | |
492 | { | |
493 | Bool_t alone = ( triggerStore ? kFALSE : kTRUE ); | |
494 | ok = clusterStore->Connect(clustersTree,alone); | |
495 | if (!ok) | |
496 | { | |
497 | AliError("Could not create triggerStore branches in TreeR"); | |
498 | } | |
499 | } | |
500 | ||
501 | if (ok) // at least one type of branches created successfully | |
502 | { | |
503 | clustersTree.Fill(); | |
504 | } | |
cac2eb58 | 505 | } |
cf464691 | 506 | |
507 | //_____________________________________________________________________________ | |
22899106 | 508 | Bool_t |
509 | AliMUONReconstructor::HasDigitConversion() const | |
cf464691 | 510 | { |
22899106 | 511 | /// We *do* have digit conversion, but we might advertise it only |
512 | /// if we want to save the digits. | |
513 | ||
514 | TString opt(GetOption()); | |
515 | opt.ToUpper(); | |
516 | if ( opt.Contains("SAVEDIGITS" ) && !opt.Contains("NOLOCALRECONSTRUCTION") ) | |
517 | { | |
518 | return kTRUE; | |
519 | } | |
520 | else | |
521 | { | |
522 | return kFALSE; | |
523 | } | |
524 | } | |
f9247068 | 525 | |
22899106 | 526 | //_____________________________________________________________________________ |
527 | Bool_t | |
528 | AliMUONReconstructor::HasLocalReconstruction() const | |
529 | { | |
530 | /// Whether or not we have local reconstruction | |
531 | TString opt(GetOption()); | |
532 | opt.ToUpper(); | |
533 | if ( opt.Contains("NOLOCALRECONSTRUCTION" ) ) | |
94f6fba9 | 534 | { |
22899106 | 535 | return kFALSE; |
30eabfb8 | 536 | } |
22899106 | 537 | else |
538 | { | |
539 | return kTRUE; | |
540 | } | |
541 | } | |
542 | ||
543 | //_____________________________________________________________________________ | |
544 | void | |
545 | AliMUONReconstructor::Reconstruct(AliRawReader* rawReader, TTree* clustersTree) const | |
546 | { | |
547 | /// This method is called by AliReconstruction if HasLocalReconstruction()==kTRUE AND | |
548 | /// HasDigitConversion()==kFALSE | |
8cde4af5 | 549 | |
22899106 | 550 | if ( !clustersTree ) |
551 | { | |
552 | AliError("clustersTree is 0x0 !"); | |
553 | return; | |
554 | } | |
b2d7df0b | 555 | |
93d7b017 | 556 | ConvertDigits(rawReader,DigitStore(),TriggerStore()); |
557 | Clusterize(*(DigitStore()),*(ClusterStore())); | |
22899106 | 558 | |
559 | FillTreeR(TriggerStore(),ClusterStore(),*clustersTree); | |
560 | } | |
64b056bc | 561 | |
22899106 | 562 | //_____________________________________________________________________________ |
563 | void | |
564 | AliMUONReconstructor::Reconstruct(AliRunLoader* runLoader) const | |
565 | { | |
566 | /// Reconstruct simulated data | |
94f6fba9 | 567 | |
93d7b017 | 568 | AliCodeTimerAuto("Reconstruct(AliRunLoader*)") |
94f6fba9 | 569 | |
22899106 | 570 | AliLoader* loader = runLoader->GetDetectorLoader("MUON"); |
571 | if (!loader) | |
572 | { | |
573 | AliError("Could not get MUON loader"); | |
574 | return; | |
575 | } | |
94f6fba9 | 576 | |
22899106 | 577 | Int_t nEvents = runLoader->GetNumberOfEvents(); |
578 | ||
579 | for ( Int_t i = 0; i < nEvents; ++i ) | |
94f6fba9 | 580 | { |
22899106 | 581 | runLoader->GetEvent(i); |
94f6fba9 | 582 | |
22899106 | 583 | loader->LoadRecPoints("update"); |
584 | loader->CleanRecPoints(); | |
585 | loader->MakeRecPointsContainer(); | |
586 | TTree* clustersTree = loader->TreeR(); | |
8cde4af5 | 587 | |
22899106 | 588 | loader->LoadDigits("read"); |
589 | TTree* digitsTree = loader->TreeD(); | |
94f6fba9 | 590 | |
22899106 | 591 | Reconstruct(digitsTree,clustersTree); |
94f6fba9 | 592 | |
22899106 | 593 | loader->UnloadDigits(); |
cf464691 | 594 | loader->WriteRecPoints("OVERWRITE"); |
22899106 | 595 | loader->UnloadRecPoints(); |
cf464691 | 596 | } |
cf464691 | 597 | } |
598 | ||
cac2eb58 | 599 | //_____________________________________________________________________________ |
22899106 | 600 | void |
601 | AliMUONReconstructor::Reconstruct(AliRunLoader* runLoader, AliRawReader* rawReader) const | |
cac2eb58 | 602 | { |
22899106 | 603 | /// This method is called by AliReconstruction if HasLocalReconstruction()==kFALSE |
604 | ||
93d7b017 | 605 | AliCodeTimerAuto("AliMUONReconstructor::Reconstruct(AliRunLoader*, AliRawReader*)") |
22899106 | 606 | |
607 | AliLoader* loader = runLoader->GetDetectorLoader("MUON"); | |
608 | if (!loader) | |
609 | { | |
610 | AliError("Could not get MUON loader"); | |
611 | return; | |
612 | } | |
613 | ||
614 | Int_t i(0); | |
615 | ||
616 | while (rawReader->NextEvent()) | |
617 | { | |
618 | runLoader->GetEvent(i++); | |
619 | ||
620 | loader->LoadRecPoints("update"); | |
621 | loader->CleanRecPoints(); | |
622 | loader->MakeRecPointsContainer(); | |
623 | TTree* clustersTree = loader->TreeR(); | |
8cde4af5 | 624 | |
22899106 | 625 | loader->LoadDigits("update"); |
626 | loader->CleanDigits(); | |
627 | loader->MakeDigitsContainer(); | |
628 | TTree* digitsTree = loader->TreeD(); | |
629 | ConvertDigits(rawReader, digitsTree); | |
630 | loader->WriteDigits("OVERWRITE"); | |
22ccc301 | 631 | |
22899106 | 632 | Reconstruct(digitsTree,clustersTree); |
22ccc301 | 633 | |
22899106 | 634 | loader->UnloadDigits(); |
635 | loader->WriteRecPoints("OVERWRITE"); | |
636 | loader->UnloadRecPoints(); | |
637 | } | |
196471e9 | 638 | } |
639 | ||
640 | //_____________________________________________________________________________ | |
22899106 | 641 | void |
642 | AliMUONReconstructor::Reconstruct(TTree* digitsTree, TTree* clustersTree) const | |
a2da7817 | 643 | { |
22899106 | 644 | /// This method is called by AliReconstruction if HasLocalReconstruction()==kTRUE |
645 | /// AND HasDigitConversion()==kTRUE | |
646 | ||
93d7b017 | 647 | // AliCodeTimerAuto("(TTree*,TTree*)") |
648 | ||
22899106 | 649 | AliDebug(1,""); |
650 | ||
651 | if (!digitsTree || !clustersTree) | |
652 | { | |
653 | AliError(Form("Tree is null : digitsTree=%p clustersTree=%p", | |
654 | digitsTree,clustersTree)); | |
655 | return; | |
656 | } | |
d19b6003 | 657 | |
22899106 | 658 | if (!fDigitStore) |
659 | { | |
660 | fDigitStore = AliMUONVDigitStore::Create(*digitsTree); | |
661 | if (!fDigitStore) | |
662 | { | |
663 | AliError(Form("Could not get DigitStore from %s",digitsTree->GetName())); | |
664 | } | |
665 | else | |
666 | { | |
667 | AliInfo(Form("Created %s from %s",fDigitStore->ClassName(),digitsTree->GetName())); | |
668 | } | |
669 | } | |
670 | if (!fTriggerStore) | |
671 | { | |
672 | fTriggerStore = AliMUONVTriggerStore::Create(*digitsTree); | |
673 | if (!fTriggerStore) | |
674 | { | |
675 | AliError(Form("Could not get TriggerStore from %s",digitsTree->GetName())); | |
676 | } | |
677 | else | |
678 | { | |
679 | AliInfo(Form("Created %s from %s",fTriggerStore->ClassName(),digitsTree->GetName())); | |
680 | } | |
681 | } | |
682 | ||
683 | if (!fTriggerStore && !fDigitStore) | |
684 | { | |
685 | AliError("No store at all. Nothing to do."); | |
686 | return; | |
687 | } | |
688 | ||
689 | // insure we start with empty stores | |
690 | if ( fDigitStore ) | |
691 | { | |
692 | fDigitStore->Clear(); | |
693 | Bool_t alone = ( fTriggerStore ? kFALSE : kTRUE ); | |
694 | Bool_t ok = fDigitStore->Connect(*digitsTree,alone); | |
695 | if (!ok) | |
696 | { | |
697 | AliError("Could not connect digitStore to digitsTree"); | |
698 | return; | |
699 | } | |
700 | } | |
701 | if ( fTriggerStore ) | |
702 | { | |
703 | fTriggerStore->Clear(); | |
704 | Bool_t alone = ( fDigitStore ? kFALSE : kTRUE ); | |
705 | Bool_t ok = fTriggerStore->Connect(*digitsTree,alone); | |
706 | if (!ok) | |
707 | { | |
708 | AliError("Could not connect triggerStore to digitsTree"); | |
709 | return; | |
710 | } | |
711 | } | |
712 | ||
713 | digitsTree->GetEvent(0); | |
714 | ||
715 | if ( fDigitStore ) | |
716 | { | |
e729a0c8 | 717 | // Insure we got calibrated digits (if we reconstruct from pure simulated, |
718 | // i.e. w/o going through raw data, this will be the case) | |
719 | TIter next(fDigitStore->CreateIterator()); | |
720 | AliMUONVDigit* digit = static_cast<AliMUONVDigit*>(next()); | |
721 | if (!digit->IsCalibrated()) | |
722 | { | |
723 | Calibrate(*fDigitStore); | |
724 | } | |
22899106 | 725 | Clusterize(*fDigitStore,*(ClusterStore())); |
726 | } | |
727 | ||
728 | FillTreeR(fTriggerStore,ClusterStore(),*clustersTree); | |
cac2eb58 | 729 | } |
196471e9 | 730 | |
731 | //_____________________________________________________________________________ | |
22899106 | 732 | AliMUONVTriggerStore* |
733 | AliMUONReconstructor::TriggerStore() const | |
196471e9 | 734 | { |
22899106 | 735 | /// Return (and create if necessary and allowed) the trigger container |
736 | TString sopt(GetOption()); | |
737 | sopt.ToUpper(); | |
738 | ||
739 | if (sopt.Contains("TRIGGERDISABLE")) | |
740 | { | |
741 | delete fTriggerStore; | |
742 | fTriggerStore = 0x0; | |
743 | } | |
744 | else | |
745 | { | |
746 | if (!fTriggerStore) | |
747 | { | |
748 | fTriggerStore = new AliMUONTriggerStoreV1; | |
749 | } | |
750 | } | |
751 | return fTriggerStore; | |
196471e9 | 752 | } |