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