]>
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 | /// | |
96ebe67e | 22 | /// The clustering mode and the associated parameters can be changed by using |
23 | /// AliMUONRecoParam *muonRecoParam = AliMUONRecoParam::GetLow(High)FluxParam(); | |
24 | /// muonRecoParam->Set...(); // see methods in AliMUONRecoParam.h for details | |
15d30ed4 | 25 | /// AliRecoParam::Instance()->RegisterRecoParam(muonRecoParam); |
22899106 | 26 | /// |
96ebe67e | 27 | /// Valid modes are : |
22899106 | 28 | /// |
29 | /// SIMPLEFIT : use the AliMUONClusterFinderSimpleFit clusterizer | |
30 | /// | |
96ebe67e | 31 | /// SIMPLEFITV3 : SIMPLEFIT with preclustering=PRECLUSTERV3 |
32 | /// | |
33 | /// MLEM : use AliMUONClusterFinderMLEM and AliMUONPreClusterFinder for preclustering (default) | |
34 | /// MLEMV2 : MLEM with preclustering=PRECLUSTERV2 | |
93d7b017 | 35 | /// MLEMV3 : MLEM with preclustering=PRECLUSTERV3 |
36 | /// | |
22899106 | 37 | /// PRECLUSTER : use only AliMUONPreClusterFinder. Only for debug as |
38 | /// the produced clusters do not have a position, hence the tracking will not | |
39 | /// work | |
93d7b017 | 40 | /// PRECLUSTERV2 : another version of the preclustering |
41 | /// PRECLUSTERV3 : yet another version of the preclustering | |
22899106 | 42 | /// |
43 | /// COG : use AliMUONClusterFinderCOG clusterizer. Not really a production | |
44 | /// option either, as center-of-gravity is generally not a good estimate | |
45 | /// of the cluster position... | |
46 | /// | |
3ab319aa | 47 | /// PEAKCOG : COG cluster finder around local maxima |
48 | /// PEAKFIT : fit around local maxima with up to 3 peaks, COG otherwise | |
49 | /// | |
22899106 | 50 | /// NOCLUSTERING : bypass completely the clustering stage |
51 | /// | |
96ebe67e | 52 | /// ------ |
22899106 | 53 | /// |
96ebe67e | 54 | /// The behavior of the MUON reconstruction can also be changed, besides |
55 | /// the usual methods found in AliReconstruction (e.g. to disable tracking) | |
56 | /// by using AliReconstruction::SetOption("MUON",options) | |
57 | /// where options should be a space separated string. | |
58 | /// | |
59 | /// Valid options are : | |
60 | /// | |
61 | /// SAVEDIGITS : if you want to save in the TreeD the *calibrated* digits | |
62 | /// that are used for the clustering | |
22899106 | 63 | /// |
93d7b017 | 64 | /// DIGITSTOREV1 : use the V1 implementation of the digitstore |
65 | /// DIGITSTOREV2R : use the V2R implementation of the digitstore | |
66 | /// | |
96ebe67e | 67 | /// NOLOCALRECONSTRUCTION : for debug, to disable local reconstruction (and hence |
68 | /// "recover" old behavior) | |
69 | /// | |
70 | /// TRIGGERDISABLE : disable the treatment of MUON trigger | |
71 | /// | |
e3a2b9c9 | 72 | /// USEFASTDECODER : makes the digit maker class use the high performance decoder |
73 | /// AliMUONTrackerDDLDecoder instead of AliMUONPayloadTracker. | |
74 | /// | |
22899106 | 75 | /// \author Laurent Aphecetche, Subatech |
3d1463c8 | 76 | //----------------------------------------------------------------------------- |
30178c30 | 77 | |
cf464691 | 78 | #include "AliMUONReconstructor.h" |
b2d7df0b | 79 | |
b2d7df0b | 80 | #include "AliMUONCalibrationData.h" |
22899106 | 81 | #include "AliMUONClusterFinderCOG.h" |
82 | #include "AliMUONClusterFinderMLEM.h" | |
83 | #include "AliMUONClusterFinderSimpleFit.h" | |
3ab319aa | 84 | #include "AliMUONClusterFinderPeakCOG.h" |
85 | #include "AliMUONClusterFinderPeakFit.h" | |
22899106 | 86 | #include "AliMUONConstants.h" |
b2d7df0b | 87 | #include "AliMUONDigitCalibrator.h" |
2cf44ef3 | 88 | #include "AliMUONDigitMaker.h" |
22899106 | 89 | #include "AliMUONDigitStoreV1.h" |
93d7b017 | 90 | #include "AliMUONDigitStoreV2R.h" |
22899106 | 91 | #include "AliMUONGeometryTransformer.h" |
92 | #include "AliMUONPreClusterFinder.h" | |
93d7b017 | 93 | #include "AliMUONPreClusterFinderV2.h" |
94 | #include "AliMUONPreClusterFinderV3.h" | |
c5ce806f | 95 | #include "AliMUONRecoParam.h" |
96 | #include "AliMUONSimpleClusterServer.h" | |
196471e9 | 97 | #include "AliMUONTracker.h" |
e1a10d41 | 98 | #include "AliMUONTriggerCircuit.h" |
96fdfe9a | 99 | #include "AliMUONTriggerCrateStore.h" |
22899106 | 100 | #include "AliMUONTriggerStoreV1.h" |
101 | #include "AliMUONVClusterFinder.h" | |
c5ce806f | 102 | #include "AliMUONVClusterServer.h" |
103 | #include "AliMUONVTrackStore.h" | |
104 | ||
105 | #include "AliMpArea.h" | |
88544f7e | 106 | #include "AliMpCDB.h" |
c5ce806f | 107 | #include "AliMpConstants.h" |
108 | ||
15d30ed4 | 109 | #include "AliRecoParam.h" |
cf464691 | 110 | #include "AliRawReader.h" |
c5ce806f | 111 | #include "AliCDBManager.h" |
93d7b017 | 112 | #include "AliCodeTimer.h" |
c5ce806f | 113 | #include "AliLog.h" |
114 | ||
22899106 | 115 | #include <Riostream.h> |
15d30ed4 | 116 | #include <TObjArray.h> |
22899106 | 117 | #include <TClonesArray.h> |
118 | #include <TString.h> | |
119 | #include <TTree.h> | |
2060b217 | 120 | |
9265505b | 121 | /// \cond CLASSIMP |
cac2eb58 | 122 | ClassImp(AliMUONReconstructor) |
22899106 | 123 | /// \endcond |
b2d7df0b | 124 | |
3304fa09 | 125 | AliMUONRecoParam* AliMUONReconstructor::fgRecoParam = 0x0; // reconstruction parameters |
126 | ||
cac2eb58 | 127 | //_____________________________________________________________________________ |
22899106 | 128 | AliMUONReconstructor::AliMUONReconstructor() : |
129 | AliReconstructor(), | |
130 | fCrateManager(0x0), | |
131 | fDigitMaker(0x0), | |
ef4cb4f1 | 132 | fTransformer(new AliMUONGeometryTransformer()), |
22899106 | 133 | fDigitStore(0x0), |
134 | fTriggerCircuit(0x0), | |
135 | fCalibrationData(0x0), | |
136 | fDigitCalibrator(0x0), | |
c5ce806f | 137 | fClusterServer(0x0), |
22899106 | 138 | fTriggerStore(0x0), |
683cb6c5 | 139 | fTrackStore(0x0) |
8789635b | 140 | { |
22899106 | 141 | /// normal ctor |
88544f7e | 142 | |
88544f7e | 143 | // Load mapping |
a55f49a0 | 144 | if ( ! AliMpCDB::LoadDDLStore() ) { |
88544f7e | 145 | AliFatal("Could not access mapping from OCDB !"); |
146 | } | |
147 | ||
a55f49a0 | 148 | // Load geometry data |
149 | fTransformer->LoadGeometryData(); | |
88544f7e | 150 | |
22899106 | 151 | } |
d19b6003 | 152 | |
22899106 | 153 | //_____________________________________________________________________________ |
154 | AliMUONReconstructor::~AliMUONReconstructor() | |
155 | { | |
156 | /// dtor | |
157 | delete fDigitMaker; | |
158 | delete fDigitStore; | |
159 | delete fTransformer; | |
160 | delete fCrateManager; | |
161 | delete fTriggerCircuit; | |
162 | delete fCalibrationData; | |
163 | delete fDigitCalibrator; | |
c5ce806f | 164 | delete fClusterServer; |
22899106 | 165 | delete fTriggerStore; |
166 | delete fTrackStore; | |
22899106 | 167 | } |
96fdfe9a | 168 | |
3304fa09 | 169 | //_____________________________________________________________________________ |
15d30ed4 | 170 | const AliMUONRecoParam* AliMUONReconstructor::GetRecoParam() |
3304fa09 | 171 | { |
15d30ed4 | 172 | /// get reconstruction parameters |
3304fa09 | 173 | |
15d30ed4 | 174 | if (!fgRecoParam) { |
175 | ||
176 | // get reconstruction parameters from AliRecoParam if any | |
177 | TObjArray *recoParams = AliRecoParam::Instance()->GetRecoParam("MUON"); | |
178 | ||
179 | if (recoParams) { | |
180 | ||
181 | fgRecoParam = (AliMUONRecoParam*) recoParams->Last(); | |
182 | ||
183 | } else { | |
184 | ||
185 | // initialize reconstruction parameters if not already done | |
186 | cout<<"W-AliMUONReconstructor::GetRecoParam: Reconstruction parameters not initialized - Use default one"<<endl; | |
187 | fgRecoParam = AliMUONRecoParam::GetLowFluxParam(); | |
188 | AliRecoParam::Instance()->RegisterRecoParam(fgRecoParam); | |
189 | ||
190 | } | |
191 | ||
3304fa09 | 192 | } |
193 | ||
15d30ed4 | 194 | return fgRecoParam; |
3304fa09 | 195 | } |
196 | ||
22899106 | 197 | //_____________________________________________________________________________ |
198 | void | |
199 | AliMUONReconstructor::Calibrate(AliMUONVDigitStore& digitStore) const | |
200 | { | |
201 | /// Calibrate the digitStore | |
202 | if (!fDigitCalibrator) | |
203 | { | |
204 | CreateCalibrator(); | |
205 | } | |
93d7b017 | 206 | AliCodeTimerAuto(Form("%s::Calibrate(AliMUONVDigitStore*)",fDigitCalibrator->ClassName())) |
22899106 | 207 | fDigitCalibrator->Calibrate(digitStore); |
208 | } | |
96fdfe9a | 209 | |
22899106 | 210 | //_____________________________________________________________________________ |
211 | void | |
212 | AliMUONReconstructor::ConvertDigits(AliRawReader* rawReader, | |
213 | AliMUONVDigitStore* digitStore, | |
214 | AliMUONVTriggerStore* triggerStore) const | |
215 | { | |
216 | /// Convert raw data into digit and trigger stores | |
217 | CreateDigitMaker(); | |
93d7b017 | 218 | |
219 | AliCodeTimerStart(Form("%s::Raw2Digits(AliRawReader*,AliMUONVDigitStore*,AliMUONVTriggerStore*)", | |
220 | fDigitMaker->ClassName())) | |
22899106 | 221 | fDigitMaker->Raw2Digits(rawReader,digitStore,triggerStore); |
93d7b017 | 222 | AliCodeTimerStop(Form("%s::Raw2Digits(AliRawReader*,AliMUONVDigitStore*,AliMUONVTriggerStore*)", |
223 | fDigitMaker->ClassName())) | |
22899106 | 224 | Calibrate(*digitStore); |
cac2eb58 | 225 | } |
b2d7df0b | 226 | |
227 | //_____________________________________________________________________________ | |
22899106 | 228 | void |
229 | AliMUONReconstructor::ConvertDigits(AliRawReader* rawReader, TTree* digitsTree) const | |
b2d7df0b | 230 | { |
22899106 | 231 | /// convert raw data into a digit tree |
2060b217 | 232 | AliCodeTimerAuto("") |
22899106 | 233 | |
234 | Bool_t alone = ( TriggerStore() == 0 ); | |
b2d7df0b | 235 | |
22899106 | 236 | Bool_t ok = DigitStore()->Connect(*digitsTree,alone); |
237 | if ( TriggerStore() ) | |
b476b122 | 238 | { |
22899106 | 239 | ok = ok && TriggerStore()->Connect(*digitsTree,kFALSE); |
b476b122 | 240 | } |
ee103e97 | 241 | |
22899106 | 242 | if (!ok) |
243 | { | |
244 | AliError("Could not make branches on TreeD"); | |
245 | } | |
246 | else | |
247 | { | |
248 | ConvertDigits(rawReader,DigitStore(),TriggerStore()); | |
2060b217 | 249 | AliCodeTimerStart("Fill digits") |
22899106 | 250 | digitsTree->Fill(); |
2060b217 | 251 | AliCodeTimerStop("Fill digits") |
22899106 | 252 | DigitStore()->Clear(); |
253 | } | |
254 | } | |
255 | ||
256 | //_____________________________________________________________________________ | |
257 | AliMUONTriggerCrateStore* | |
258 | AliMUONReconstructor::CrateManager() const | |
259 | { | |
260 | /// Return (and create if necessary) the trigger crate store | |
261 | if (fCrateManager) return fCrateManager; | |
262 | fCrateManager = new AliMUONTriggerCrateStore; | |
263 | fCrateManager->ReadFromFile(); | |
264 | return fCrateManager; | |
265 | } | |
266 | ||
267 | //_____________________________________________________________________________ | |
268 | void | |
269 | AliMUONReconstructor::CreateDigitMaker() const | |
270 | { | |
271 | /// Create (and create if necessary) the digit maker | |
272 | if (fDigitMaker) return; | |
273 | ||
93d7b017 | 274 | AliCodeTimerAuto("") |
22899106 | 275 | |
e3a2b9c9 | 276 | TString option = GetOption(); |
277 | Bool_t enableErrorLogging = kTRUE; | |
278 | Bool_t useFastDecoder = kFALSE; | |
e3ce3989 | 279 | if (option.Contains("USEFASTDECODER")) |
e3a2b9c9 | 280 | { |
281 | useFastDecoder = kTRUE; | |
282 | } | |
283 | fDigitMaker = new AliMUONDigitMaker(enableErrorLogging, useFastDecoder); | |
22899106 | 284 | } |
285 | ||
286 | //_____________________________________________________________________________ | |
287 | void | |
288 | AliMUONReconstructor::CreateTriggerCircuit() const | |
289 | { | |
290 | /// Return (and create if necessary) the trigger circuit object | |
291 | if (fTriggerCircuit) return; | |
292 | ||
93d7b017 | 293 | AliCodeTimerAuto("") |
22899106 | 294 | |
32ab62c9 | 295 | fTriggerCircuit = new AliMUONTriggerCircuit(fTransformer); |
22899106 | 296 | |
32ab62c9 | 297 | } |
8c0b5e70 | 298 | |
22899106 | 299 | //_____________________________________________________________________________ |
300 | AliTracker* | |
d76c31f4 | 301 | AliMUONReconstructor::CreateTracker() const |
22899106 | 302 | { |
303 | /// Create the MUONTracker object | |
ee103e97 | 304 | |
22899106 | 305 | CreateTriggerCircuit(); |
306 | CreateDigitMaker(); | |
c5ce806f | 307 | CreateClusterServer(); |
308 | ||
309 | if (!fClusterServer) | |
310 | { | |
311 | AliError("ClusterServer is NULL ! Cannot create tracker"); | |
312 | return 0x0; | |
313 | } | |
22899106 | 314 | |
c5ce806f | 315 | AliMUONTracker* tracker = new AliMUONTracker(*fClusterServer, |
89b4e052 | 316 | *DigitStore(), |
c5ce806f | 317 | fDigitMaker, |
318 | fTransformer, | |
683cb6c5 | 319 | fTriggerCircuit); |
22899106 | 320 | |
321 | return tracker; | |
b2d7df0b | 322 | } |
323 | ||
f9247068 | 324 | //_____________________________________________________________________________ |
c5ce806f | 325 | AliMUONVClusterFinder* |
326 | AliMUONReconstructor::CreateClusterFinder(const char* clusterFinderType) const | |
f9247068 | 327 | { |
c5ce806f | 328 | /// Create a given cluster finder instance |
22899106 | 329 | |
93d7b017 | 330 | AliCodeTimerAuto("") |
06ca6d7b | 331 | |
f9247068 | 332 | AliMUONVClusterFinder* clusterFinder(0x0); |
333 | ||
c5ce806f | 334 | TString opt(clusterFinderType); |
f9247068 | 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 | } | |
3ab319aa | 349 | else if ( strstr(opt,"PEAKCOG") ) |
350 | { | |
351 | clusterFinder = new AliMUONClusterFinderPeakCOG(kFALSE,new AliMUONPreClusterFinder); | |
352 | } | |
353 | else if ( strstr(opt,"PEAKFIT") ) | |
354 | { | |
355 | clusterFinder = new AliMUONClusterFinderPeakFit(kFALSE,new AliMUONPreClusterFinder); | |
356 | } | |
f9247068 | 357 | else if ( strstr(opt,"COG") ) |
358 | { | |
93d7b017 | 359 | clusterFinder = new AliMUONClusterFinderCOG(new AliMUONPreClusterFinder); |
f9247068 | 360 | } |
93d7b017 | 361 | else if ( strstr(opt,"SIMPLEFITV3") ) |
362 | { | |
363 | clusterFinder = new AliMUONClusterFinderSimpleFit(new AliMUONClusterFinderCOG(new AliMUONPreClusterFinderV3)); | |
364 | } | |
f9247068 | 365 | else if ( strstr(opt,"SIMPLEFIT") ) |
366 | { | |
93d7b017 | 367 | clusterFinder = new AliMUONClusterFinderSimpleFit(new AliMUONClusterFinderCOG(new AliMUONPreClusterFinder)); |
f9247068 | 368 | } |
369 | else if ( strstr(opt,"MLEM:DRAW") ) | |
370 | { | |
93d7b017 | 371 | clusterFinder = new AliMUONClusterFinderMLEM(kTRUE,new AliMUONPreClusterFinder); |
f9247068 | 372 | } |
93d7b017 | 373 | else if ( strstr(opt,"MLEMV3") ) |
374 | { | |
375 | clusterFinder = new AliMUONClusterFinderMLEM(kFALSE,new AliMUONPreClusterFinderV3); | |
376 | } | |
377 | else if ( strstr(opt,"MLEMV2") ) | |
378 | { | |
379 | clusterFinder = new AliMUONClusterFinderMLEM(kFALSE,new AliMUONPreClusterFinderV2); | |
380 | } | |
f9247068 | 381 | else if ( strstr(opt,"MLEM") ) |
382 | { | |
93d7b017 | 383 | clusterFinder = new AliMUONClusterFinderMLEM(kFALSE,new AliMUONPreClusterFinder); |
f9247068 | 384 | } |
22899106 | 385 | else |
386 | { | |
3304fa09 | 387 | AliError(Form("clustering mode \"%s\" does not exist",opt.Data())); |
c5ce806f | 388 | return 0x0; |
22899106 | 389 | } |
f9247068 | 390 | |
c5ce806f | 391 | return clusterFinder; |
392 | } | |
393 | ||
394 | //_____________________________________________________________________________ | |
395 | void | |
396 | AliMUONReconstructor::CreateClusterServer() const | |
397 | { | |
398 | /// Create cluster server | |
399 | ||
400 | if ( fClusterServer ) return; | |
401 | ||
402 | AliCodeTimerAuto("") | |
403 | ||
404 | AliDebug(1,""); | |
405 | ||
15d30ed4 | 406 | AliMUONVClusterFinder* clusterFinder = CreateClusterFinder(GetRecoParam()->GetClusteringMode()); |
c5ce806f | 407 | |
408 | if ( !clusterFinder ) return; | |
409 | ||
3304fa09 | 410 | AliInfo(Form("Will use %s for clusterizing",clusterFinder->ClassName())); |
f9247068 | 411 | |
c5ce806f | 412 | fClusterServer = new AliMUONSimpleClusterServer(*clusterFinder,*fTransformer); |
f9247068 | 413 | } |
414 | ||
cac2eb58 | 415 | //_____________________________________________________________________________ |
22899106 | 416 | void |
417 | AliMUONReconstructor::CreateCalibrator() const | |
cac2eb58 | 418 | { |
22899106 | 419 | /// Create the calibrator |
2457f726 | 420 | |
93d7b017 | 421 | AliCodeTimerAuto("") |
3bc8b580 | 422 | |
22899106 | 423 | Int_t runNumber = AliCDBManager::Instance()->GetRun(); |
3bc8b580 | 424 | |
22899106 | 425 | AliInfo("Calibration will occur."); |
426 | ||
427 | fCalibrationData = new AliMUONCalibrationData(runNumber); | |
428 | if ( !fCalibrationData->IsValid() ) | |
429 | { | |
430 | AliError("Could not retrieve calibrations !"); | |
431 | delete fCalibrationData; | |
432 | fCalibrationData = 0x0; | |
433 | return; | |
434 | } | |
435 | ||
436 | // Check that we get all the calibrations we'll need | |
437 | if ( !fCalibrationData->Pedestals() || | |
438 | !fCalibrationData->Gains() || | |
439 | !fCalibrationData->HV() ) | |
440 | { | |
441 | AliFatal("Could not access all required calibration data"); | |
9ffe3ef4 | 442 | } |
cc87ebcd | 443 | |
22899106 | 444 | TString opt(GetOption()); |
445 | opt.ToUpper(); | |
b2d7df0b | 446 | |
22899106 | 447 | if ( strstr(opt,"NOSTATUSMAP") ) |
448 | { | |
22f7c9ba | 449 | AliWarning("NOSTATUSMAP is obsolete"); |
22899106 | 450 | } |
22f7c9ba | 451 | |
de98fdc9 | 452 | TString calibMode = GetRecoParam()->GetCalibrationMode(); |
453 | ||
454 | fDigitCalibrator = new AliMUONDigitCalibrator(*fCalibrationData,calibMode.Data()); | |
22899106 | 455 | } |
9c4b1ee7 | 456 | |
22899106 | 457 | //_____________________________________________________________________________ |
458 | AliMUONVDigitStore* | |
459 | AliMUONReconstructor::DigitStore() const | |
460 | { | |
461 | /// Return (and create if necessary) the digit container | |
462 | if (!fDigitStore) | |
463 | { | |
93d7b017 | 464 | TString sopt(GetOption()); |
465 | sopt.ToUpper(); | |
466 | ||
467 | AliInfo(Form("Options=%s",sopt.Data())); | |
468 | ||
469 | if ( sopt.Contains("DIGITSTOREV1") ) | |
470 | { | |
471 | fDigitStore = AliMUONVDigitStore::Create("AliMUONDigitStoreV1"); | |
472 | } | |
473 | else if ( sopt.Contains("DIGITSTOREV2R") ) | |
474 | { | |
475 | fDigitStore = AliMUONVDigitStore::Create("AliMUONDigitStoreV2R"); | |
476 | } | |
477 | else if ( sopt.Contains("DIGITSTOREV2S") ) | |
478 | { | |
479 | fDigitStore = AliMUONVDigitStore::Create("AliMUONDigitStoreV2S"); | |
480 | } | |
481 | ||
482 | if (!fDigitStore) fDigitStore = AliMUONVDigitStore::Create("AliMUONDigitStoreV2R"); | |
483 | ||
484 | AliInfo(Form("Will use %s to store digits during reconstruction",fDigitStore->ClassName())); | |
22899106 | 485 | } |
486 | return fDigitStore; | |
487 | } | |
94f6fba9 | 488 | |
22899106 | 489 | //_____________________________________________________________________________ |
490 | void | |
491 | AliMUONReconstructor::FillTreeR(AliMUONVTriggerStore* triggerStore, | |
22899106 | 492 | TTree& clustersTree) const |
493 | { | |
494 | /// Write the trigger and cluster information into TreeR | |
495 | ||
93d7b017 | 496 | AliCodeTimerAuto("") |
cc87ebcd | 497 | |
22899106 | 498 | AliDebug(1,""); |
499 | ||
500 | Bool_t ok(kFALSE); | |
501 | if ( triggerStore ) | |
502 | { | |
c5ce806f | 503 | ok = triggerStore->Connect(clustersTree,kTRUE); |
22899106 | 504 | if (!ok) |
b2d7df0b | 505 | { |
22899106 | 506 | AliError("Could not create triggerStore branches in TreeR"); |
cc87ebcd | 507 | } |
cac2eb58 | 508 | } |
22899106 | 509 | |
22899106 | 510 | if (ok) // at least one type of branches created successfully |
511 | { | |
512 | clustersTree.Fill(); | |
513 | } | |
cac2eb58 | 514 | } |
cf464691 | 515 | |
516 | //_____________________________________________________________________________ | |
22899106 | 517 | Bool_t |
518 | AliMUONReconstructor::HasDigitConversion() const | |
cf464691 | 519 | { |
22899106 | 520 | /// We *do* have digit conversion, but we might advertise it only |
521 | /// if we want to save the digits. | |
522 | ||
523 | TString opt(GetOption()); | |
524 | opt.ToUpper(); | |
525 | if ( opt.Contains("SAVEDIGITS" ) && !opt.Contains("NOLOCALRECONSTRUCTION") ) | |
526 | { | |
527 | return kTRUE; | |
528 | } | |
529 | else | |
530 | { | |
531 | return kFALSE; | |
532 | } | |
533 | } | |
f9247068 | 534 | |
22899106 | 535 | //_____________________________________________________________________________ |
536 | void | |
537 | AliMUONReconstructor::Reconstruct(AliRawReader* rawReader, TTree* clustersTree) const | |
538 | { | |
539 | /// This method is called by AliReconstruction if HasLocalReconstruction()==kTRUE AND | |
540 | /// HasDigitConversion()==kFALSE | |
8cde4af5 | 541 | |
22899106 | 542 | if ( !clustersTree ) |
543 | { | |
544 | AliError("clustersTree is 0x0 !"); | |
545 | return; | |
546 | } | |
b2d7df0b | 547 | |
93d7b017 | 548 | ConvertDigits(rawReader,DigitStore(),TriggerStore()); |
c5ce806f | 549 | |
550 | FillTreeR(TriggerStore(),*clustersTree); | |
22899106 | 551 | } |
64b056bc | 552 | |
196471e9 | 553 | //_____________________________________________________________________________ |
22899106 | 554 | void |
555 | AliMUONReconstructor::Reconstruct(TTree* digitsTree, TTree* clustersTree) const | |
a2da7817 | 556 | { |
22899106 | 557 | /// This method is called by AliReconstruction if HasLocalReconstruction()==kTRUE |
558 | /// AND HasDigitConversion()==kTRUE | |
559 | ||
2060b217 | 560 | AliCodeTimerAuto("") |
93d7b017 | 561 | |
22899106 | 562 | AliDebug(1,""); |
563 | ||
564 | if (!digitsTree || !clustersTree) | |
565 | { | |
566 | AliError(Form("Tree is null : digitsTree=%p clustersTree=%p", | |
567 | digitsTree,clustersTree)); | |
568 | return; | |
569 | } | |
d19b6003 | 570 | |
22899106 | 571 | if (!fDigitStore) |
572 | { | |
573 | fDigitStore = AliMUONVDigitStore::Create(*digitsTree); | |
574 | if (!fDigitStore) | |
575 | { | |
576 | AliError(Form("Could not get DigitStore from %s",digitsTree->GetName())); | |
577 | } | |
578 | else | |
579 | { | |
580 | AliInfo(Form("Created %s from %s",fDigitStore->ClassName(),digitsTree->GetName())); | |
581 | } | |
582 | } | |
583 | if (!fTriggerStore) | |
584 | { | |
585 | fTriggerStore = AliMUONVTriggerStore::Create(*digitsTree); | |
586 | if (!fTriggerStore) | |
587 | { | |
588 | AliError(Form("Could not get TriggerStore from %s",digitsTree->GetName())); | |
589 | } | |
590 | else | |
591 | { | |
592 | AliInfo(Form("Created %s from %s",fTriggerStore->ClassName(),digitsTree->GetName())); | |
593 | } | |
594 | } | |
595 | ||
596 | if (!fTriggerStore && !fDigitStore) | |
597 | { | |
598 | AliError("No store at all. Nothing to do."); | |
599 | return; | |
600 | } | |
601 | ||
602 | // insure we start with empty stores | |
603 | if ( fDigitStore ) | |
604 | { | |
605 | fDigitStore->Clear(); | |
606 | Bool_t alone = ( fTriggerStore ? kFALSE : kTRUE ); | |
607 | Bool_t ok = fDigitStore->Connect(*digitsTree,alone); | |
608 | if (!ok) | |
609 | { | |
610 | AliError("Could not connect digitStore to digitsTree"); | |
611 | return; | |
612 | } | |
613 | } | |
614 | if ( fTriggerStore ) | |
615 | { | |
616 | fTriggerStore->Clear(); | |
617 | Bool_t alone = ( fDigitStore ? kFALSE : kTRUE ); | |
618 | Bool_t ok = fTriggerStore->Connect(*digitsTree,alone); | |
619 | if (!ok) | |
620 | { | |
621 | AliError("Could not connect triggerStore to digitsTree"); | |
622 | return; | |
623 | } | |
624 | } | |
625 | ||
626 | digitsTree->GetEvent(0); | |
627 | ||
628 | if ( fDigitStore ) | |
629 | { | |
e729a0c8 | 630 | // Insure we got calibrated digits (if we reconstruct from pure simulated, |
631 | // i.e. w/o going through raw data, this will be the case) | |
632 | TIter next(fDigitStore->CreateIterator()); | |
633 | AliMUONVDigit* digit = static_cast<AliMUONVDigit*>(next()); | |
ca4733b5 | 634 | if (digit && !digit->IsCalibrated()) |
e729a0c8 | 635 | { |
636 | Calibrate(*fDigitStore); | |
637 | } | |
22899106 | 638 | } |
639 | ||
c5ce806f | 640 | FillTreeR(fTriggerStore,*clustersTree); |
cac2eb58 | 641 | } |
196471e9 | 642 | |
643 | //_____________________________________________________________________________ | |
22899106 | 644 | AliMUONVTriggerStore* |
645 | AliMUONReconstructor::TriggerStore() const | |
196471e9 | 646 | { |
22899106 | 647 | /// Return (and create if necessary and allowed) the trigger container |
648 | TString sopt(GetOption()); | |
649 | sopt.ToUpper(); | |
650 | ||
651 | if (sopt.Contains("TRIGGERDISABLE")) | |
652 | { | |
653 | delete fTriggerStore; | |
654 | fTriggerStore = 0x0; | |
655 | } | |
656 | else | |
657 | { | |
658 | if (!fTriggerStore) | |
659 | { | |
660 | fTriggerStore = new AliMUONTriggerStoreV1; | |
661 | } | |
662 | } | |
663 | return fTriggerStore; | |
196471e9 | 664 | } |