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