]>
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 | /// | |
ad3c6eda | 22 | /// The clustering mode and the associated parameters can be changed through the |
23 | /// AliMUONRecoParam object set in the reconstruction macro or read from the CDB | |
24 | /// (see methods in AliMUONRecoParam.h file for details) | |
22899106 | 25 | /// |
96ebe67e | 26 | /// Valid modes are : |
22899106 | 27 | /// |
28 | /// SIMPLEFIT : use the AliMUONClusterFinderSimpleFit clusterizer | |
29 | /// | |
96ebe67e | 30 | /// SIMPLEFITV3 : SIMPLEFIT with preclustering=PRECLUSTERV3 |
31 | /// | |
32 | /// MLEM : use AliMUONClusterFinderMLEM and AliMUONPreClusterFinder for preclustering (default) | |
33 | /// MLEMV2 : MLEM with preclustering=PRECLUSTERV2 | |
93d7b017 | 34 | /// MLEMV3 : MLEM with preclustering=PRECLUSTERV3 |
35 | /// | |
22899106 | 36 | /// PRECLUSTER : use only AliMUONPreClusterFinder. Only for debug as |
37 | /// the produced clusters do not have a position, hence the tracking will not | |
38 | /// work | |
93d7b017 | 39 | /// PRECLUSTERV2 : another version of the preclustering |
40 | /// PRECLUSTERV3 : yet another version of the preclustering | |
22899106 | 41 | /// |
42 | /// COG : use AliMUONClusterFinderCOG clusterizer. Not really a production | |
43 | /// option either, as center-of-gravity is generally not a good estimate | |
44 | /// of the cluster position... | |
45 | /// | |
3ab319aa | 46 | /// PEAKCOG : COG cluster finder around local maxima |
47 | /// PEAKFIT : fit around local maxima with up to 3 peaks, COG otherwise | |
48 | /// | |
22899106 | 49 | /// NOCLUSTERING : bypass completely the clustering stage |
50 | /// | |
96ebe67e | 51 | /// ------ |
22899106 | 52 | /// |
96ebe67e | 53 | /// The behavior of the MUON reconstruction can also be changed, besides |
54 | /// the usual methods found in AliReconstruction (e.g. to disable tracking) | |
55 | /// by using AliReconstruction::SetOption("MUON",options) | |
56 | /// where options should be a space separated string. | |
57 | /// | |
58 | /// Valid options are : | |
59 | /// | |
60 | /// SAVEDIGITS : if you want to save in the TreeD the *calibrated* digits | |
61 | /// that are used for the clustering | |
22899106 | 62 | /// |
93d7b017 | 63 | /// DIGITSTOREV1 : use the V1 implementation of the digitstore |
64 | /// DIGITSTOREV2R : use the V2R implementation of the digitstore | |
65 | /// | |
96ebe67e | 66 | /// NOLOCALRECONSTRUCTION : for debug, to disable local reconstruction (and hence |
67 | /// "recover" old behavior) | |
68 | /// | |
69 | /// TRIGGERDISABLE : disable the treatment of MUON trigger | |
70 | /// | |
b6f591ae | 71 | /// ENABLEERRORLOGGING : enable error logging (this activates also warnings in RawStreamTracker) |
481d8064 | 72 | /// |
22899106 | 73 | /// \author Laurent Aphecetche, Subatech |
3d1463c8 | 74 | //----------------------------------------------------------------------------- |
30178c30 | 75 | |
cf464691 | 76 | #include "AliMUONReconstructor.h" |
b2d7df0b | 77 | |
b2d7df0b | 78 | #include "AliMUONCalibrationData.h" |
22899106 | 79 | #include "AliMUONClusterFinderCOG.h" |
80 | #include "AliMUONClusterFinderMLEM.h" | |
81 | #include "AliMUONClusterFinderSimpleFit.h" | |
3ab319aa | 82 | #include "AliMUONClusterFinderPeakCOG.h" |
83 | #include "AliMUONClusterFinderPeakFit.h" | |
9bf6860b | 84 | #include "AliMUONClusterStoreV1.h" |
85 | #include "AliMUONClusterStoreV2.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" |
00977a64 | 92 | #include "AliMUONPadStatusMaker.h" |
22899106 | 93 | #include "AliMUONPreClusterFinder.h" |
93d7b017 | 94 | #include "AliMUONPreClusterFinderV2.h" |
95 | #include "AliMUONPreClusterFinderV3.h" | |
c5ce806f | 96 | #include "AliMUONSimpleClusterServer.h" |
196471e9 | 97 | #include "AliMUONTracker.h" |
e1a10d41 | 98 | #include "AliMUONTriggerCircuit.h" |
22899106 | 99 | #include "AliMUONTriggerStoreV1.h" |
100 | #include "AliMUONVClusterFinder.h" | |
c5ce806f | 101 | #include "AliMUONVClusterServer.h" |
102 | #include "AliMUONVTrackStore.h" | |
00d46f24 | 103 | #include "AliMUONTriggerElectronics.h" |
c5ce806f | 104 | |
105 | #include "AliMpArea.h" | |
88544f7e | 106 | #include "AliMpCDB.h" |
c5ce806f | 107 | #include "AliMpConstants.h" |
acd0cf59 | 108 | #include "AliMpDDLStore.h" |
109 | #include "AliMpSegmentation.h" | |
c5ce806f | 110 | |
cf464691 | 111 | #include "AliRawReader.h" |
c5ce806f | 112 | #include "AliCDBManager.h" |
93d7b017 | 113 | #include "AliCodeTimer.h" |
c5ce806f | 114 | #include "AliLog.h" |
00977a64 | 115 | #include "AliRunInfo.h" |
c5ce806f | 116 | |
22899106 | 117 | #include <Riostream.h> |
15d30ed4 | 118 | #include <TObjArray.h> |
22899106 | 119 | #include <TClonesArray.h> |
120 | #include <TString.h> | |
121 | #include <TTree.h> | |
2060b217 | 122 | |
9265505b | 123 | /// \cond CLASSIMP |
cac2eb58 | 124 | ClassImp(AliMUONReconstructor) |
22899106 | 125 | /// \endcond |
b2d7df0b | 126 | |
cac2eb58 | 127 | //_____________________________________________________________________________ |
22899106 | 128 | AliMUONReconstructor::AliMUONReconstructor() : |
129 | AliReconstructor(), | |
22899106 | 130 | fDigitMaker(0x0), |
ef4cb4f1 | 131 | fTransformer(new AliMUONGeometryTransformer()), |
22899106 | 132 | fDigitStore(0x0), |
133 | fTriggerCircuit(0x0), | |
134 | fCalibrationData(0x0), | |
135 | fDigitCalibrator(0x0), | |
c5ce806f | 136 | fClusterServer(0x0), |
22899106 | 137 | fTriggerStore(0x0), |
9ec6a948 | 138 | fTrackStore(0x0), |
00d46f24 | 139 | fClusterStore(0x0), |
140 | fTriggerProcessor(0x0) | |
8789635b | 141 | { |
22899106 | 142 | /// normal ctor |
88544f7e | 143 | |
acd0cf59 | 144 | AliDebug(1,""); |
78dfbced | 145 | |
146 | // Unload mapping objects | |
147 | // if they have been loaded from the obsolete OCDB mapping objects | |
148 | ||
149 | if ( AliMpDDLStore::Instance(false) ) { | |
150 | AliCDBManager::Instance()->UnloadFromCache("MUON/Calib/DDLStore"); | |
151 | delete AliMpDDLStore::Instance(); | |
152 | } | |
153 | ||
154 | if ( AliMpSegmentation::Instance(false) ) { | |
155 | AliCDBManager::Instance()->UnloadFromCache("MUON/Calib/Mapping"); | |
156 | delete AliMpSegmentation::Instance(); | |
157 | } | |
acd0cf59 | 158 | |
88544f7e | 159 | // Load mapping |
a55f49a0 | 160 | if ( ! AliMpCDB::LoadDDLStore() ) { |
88544f7e | 161 | AliFatal("Could not access mapping from OCDB !"); |
162 | } | |
163 | ||
a55f49a0 | 164 | // Load geometry data |
165 | fTransformer->LoadGeometryData(); | |
88544f7e | 166 | |
22899106 | 167 | } |
d19b6003 | 168 | |
22899106 | 169 | //_____________________________________________________________________________ |
170 | AliMUONReconstructor::~AliMUONReconstructor() | |
171 | { | |
7d5d0cc5 | 172 | /// dtor |
173 | ||
acd0cf59 | 174 | AliDebug(1,""); |
175 | ||
22899106 | 176 | delete fDigitMaker; |
177 | delete fDigitStore; | |
178 | delete fTransformer; | |
22899106 | 179 | delete fTriggerCircuit; |
22899106 | 180 | delete fDigitCalibrator; |
411a502a | 181 | delete fCalibrationData; |
c5ce806f | 182 | delete fClusterServer; |
22899106 | 183 | delete fTriggerStore; |
184 | delete fTrackStore; | |
9ec6a948 | 185 | delete fClusterStore; |
00d46f24 | 186 | delete fTriggerProcessor; |
acd0cf59 | 187 | |
188 | delete AliMpSegmentation::Instance(false); | |
189 | delete AliMpDDLStore::Instance(false); | |
22899106 | 190 | } |
96fdfe9a | 191 | |
22899106 | 192 | //_____________________________________________________________________________ |
193 | void | |
194 | AliMUONReconstructor::Calibrate(AliMUONVDigitStore& digitStore) const | |
195 | { | |
196 | /// Calibrate the digitStore | |
197 | if (!fDigitCalibrator) | |
198 | { | |
199 | CreateCalibrator(); | |
200 | } | |
99c136e1 | 201 | AliCodeTimerAuto(Form("%s::Calibrate(AliMUONVDigitStore*)",fDigitCalibrator->ClassName()),0) |
00977a64 | 202 | fDigitCalibrator->Calibrate(digitStore); |
22899106 | 203 | } |
96fdfe9a | 204 | |
22899106 | 205 | //_____________________________________________________________________________ |
206 | void | |
207 | AliMUONReconstructor::ConvertDigits(AliRawReader* rawReader, | |
208 | AliMUONVDigitStore* digitStore, | |
209 | AliMUONVTriggerStore* triggerStore) const | |
210 | { | |
211 | /// Convert raw data into digit and trigger stores | |
212 | CreateDigitMaker(); | |
c6e702f8 | 213 | |
214 | // Skip reconstruction if event is Calibration | |
215 | if ( GetRecoParam()->GetEventSpecie() == AliRecoParam::kCalib ) { | |
216 | digitStore->Clear(); // Remove possible digits from previous event | |
217 | triggerStore->Clear(); // Remove possible triggers from previous event | |
218 | AliInfo("Calibration event: do not convert digits"); | |
219 | return; | |
220 | } | |
93d7b017 | 221 | |
222 | AliCodeTimerStart(Form("%s::Raw2Digits(AliRawReader*,AliMUONVDigitStore*,AliMUONVTriggerStore*)", | |
223 | fDigitMaker->ClassName())) | |
22899106 | 224 | fDigitMaker->Raw2Digits(rawReader,digitStore,triggerStore); |
93d7b017 | 225 | AliCodeTimerStop(Form("%s::Raw2Digits(AliRawReader*,AliMUONVDigitStore*,AliMUONVTriggerStore*)", |
226 | fDigitMaker->ClassName())) | |
22899106 | 227 | Calibrate(*digitStore); |
cac2eb58 | 228 | } |
b2d7df0b | 229 | |
230 | //_____________________________________________________________________________ | |
22899106 | 231 | void |
232 | AliMUONReconstructor::ConvertDigits(AliRawReader* rawReader, TTree* digitsTree) const | |
b2d7df0b | 233 | { |
22899106 | 234 | /// convert raw data into a digit tree |
99c136e1 | 235 | AliCodeTimerAuto("",0) |
22899106 | 236 | |
237 | Bool_t alone = ( TriggerStore() == 0 ); | |
b2d7df0b | 238 | |
22899106 | 239 | Bool_t ok = DigitStore()->Connect(*digitsTree,alone); |
240 | if ( TriggerStore() ) | |
b476b122 | 241 | { |
22899106 | 242 | ok = ok && TriggerStore()->Connect(*digitsTree,kFALSE); |
b476b122 | 243 | } |
ee103e97 | 244 | |
22899106 | 245 | if (!ok) |
246 | { | |
247 | AliError("Could not make branches on TreeD"); | |
248 | } | |
249 | else | |
250 | { | |
251 | ConvertDigits(rawReader,DigitStore(),TriggerStore()); | |
2060b217 | 252 | AliCodeTimerStart("Fill digits") |
22899106 | 253 | digitsTree->Fill(); |
2060b217 | 254 | AliCodeTimerStop("Fill digits") |
22899106 | 255 | DigitStore()->Clear(); |
256 | } | |
257 | } | |
258 | ||
22899106 | 259 | //_____________________________________________________________________________ |
260 | void | |
261 | AliMUONReconstructor::CreateDigitMaker() const | |
262 | { | |
263 | /// Create (and create if necessary) the digit maker | |
264 | if (fDigitMaker) return; | |
265 | ||
99c136e1 | 266 | AliCodeTimerAuto("",0) |
22899106 | 267 | |
e3a2b9c9 | 268 | TString option = GetOption(); |
b6f591ae | 269 | |
270 | Bool_t enableErrorLogging = kFALSE; | |
271 | ||
272 | if (option.Contains("ENABLEERRORLOGGING")) | |
e3a2b9c9 | 273 | { |
b6f591ae | 274 | enableErrorLogging = kTRUE; |
e3a2b9c9 | 275 | } |
b6f591ae | 276 | |
277 | fDigitMaker = new AliMUONDigitMaker(enableErrorLogging); | |
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 | ||
99c136e1 | 292 | AliCodeTimerAuto("",0) |
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 | |
a0dc65b4 | 310 | if ( ! GetRecoParam()->CombineClusterTrackReco() ) |
c5ce806f | 311 | { |
a0dc65b4 | 312 | tracker = new AliMUONTracker(GetRecoParam(), |
313 | 0x0, | |
9bf6860b | 314 | *DigitStore(), |
315 | fDigitMaker, | |
316 | fTransformer, | |
317 | fTriggerCircuit); | |
318 | } | |
319 | else | |
320 | { | |
a0dc65b4 | 321 | tracker = new AliMUONTracker(GetRecoParam(), |
322 | fClusterServer, | |
9bf6860b | 323 | *DigitStore(), |
324 | fDigitMaker, | |
325 | fTransformer, | |
326 | fTriggerCircuit); | |
c5ce806f | 327 | } |
22899106 | 328 | |
22899106 | 329 | |
330 | return tracker; | |
b2d7df0b | 331 | } |
332 | ||
f9247068 | 333 | //_____________________________________________________________________________ |
c5ce806f | 334 | AliMUONVClusterFinder* |
9bf6860b | 335 | AliMUONReconstructor::CreateClusterFinder(const char* clusterFinderType) |
f9247068 | 336 | { |
c5ce806f | 337 | /// Create a given cluster finder instance |
22899106 | 338 | |
99c136e1 | 339 | AliCodeTimerAutoGeneral("",0) |
06ca6d7b | 340 | |
f9247068 | 341 | AliMUONVClusterFinder* clusterFinder(0x0); |
342 | ||
c5ce806f | 343 | TString opt(clusterFinderType); |
f9247068 | 344 | opt.ToUpper(); |
345 | ||
93d7b017 | 346 | if ( strstr(opt,"PRECLUSTERV2") ) |
347 | { | |
348 | clusterFinder = new AliMUONPreClusterFinderV2; | |
349 | } | |
350 | else if ( strstr(opt,"PRECLUSTERV3") ) | |
351 | { | |
352 | clusterFinder = new AliMUONPreClusterFinderV3; | |
353 | } | |
354 | else if ( strstr(opt,"PRECLUSTER") ) | |
f9247068 | 355 | { |
356 | clusterFinder = new AliMUONPreClusterFinder; | |
357 | } | |
3ab319aa | 358 | else if ( strstr(opt,"PEAKCOG") ) |
359 | { | |
360 | clusterFinder = new AliMUONClusterFinderPeakCOG(kFALSE,new AliMUONPreClusterFinder); | |
361 | } | |
362 | else if ( strstr(opt,"PEAKFIT") ) | |
363 | { | |
364 | clusterFinder = new AliMUONClusterFinderPeakFit(kFALSE,new AliMUONPreClusterFinder); | |
365 | } | |
f9247068 | 366 | else if ( strstr(opt,"COG") ) |
367 | { | |
93d7b017 | 368 | clusterFinder = new AliMUONClusterFinderCOG(new AliMUONPreClusterFinder); |
f9247068 | 369 | } |
93d7b017 | 370 | else if ( strstr(opt,"SIMPLEFITV3") ) |
371 | { | |
372 | clusterFinder = new AliMUONClusterFinderSimpleFit(new AliMUONClusterFinderCOG(new AliMUONPreClusterFinderV3)); | |
373 | } | |
f9247068 | 374 | else if ( strstr(opt,"SIMPLEFIT") ) |
375 | { | |
93d7b017 | 376 | clusterFinder = new AliMUONClusterFinderSimpleFit(new AliMUONClusterFinderCOG(new AliMUONPreClusterFinder)); |
f9247068 | 377 | } |
378 | else if ( strstr(opt,"MLEM:DRAW") ) | |
379 | { | |
93d7b017 | 380 | clusterFinder = new AliMUONClusterFinderMLEM(kTRUE,new AliMUONPreClusterFinder); |
f9247068 | 381 | } |
93d7b017 | 382 | else if ( strstr(opt,"MLEMV3") ) |
383 | { | |
384 | clusterFinder = new AliMUONClusterFinderMLEM(kFALSE,new AliMUONPreClusterFinderV3); | |
385 | } | |
386 | else if ( strstr(opt,"MLEMV2") ) | |
387 | { | |
388 | clusterFinder = new AliMUONClusterFinderMLEM(kFALSE,new AliMUONPreClusterFinderV2); | |
389 | } | |
f9247068 | 390 | else if ( strstr(opt,"MLEM") ) |
391 | { | |
93d7b017 | 392 | clusterFinder = new AliMUONClusterFinderMLEM(kFALSE,new AliMUONPreClusterFinder); |
f9247068 | 393 | } |
22899106 | 394 | else |
395 | { | |
9bf6860b | 396 | AliErrorClass(Form("clustering mode \"%s\" does not exist",opt.Data())); |
c5ce806f | 397 | return 0x0; |
22899106 | 398 | } |
f9247068 | 399 | |
c5ce806f | 400 | return clusterFinder; |
401 | } | |
402 | ||
403 | //_____________________________________________________________________________ | |
404 | void | |
405 | AliMUONReconstructor::CreateClusterServer() const | |
406 | { | |
407 | /// Create cluster server | |
408 | ||
409 | if ( fClusterServer ) return; | |
410 | ||
99c136e1 | 411 | AliCodeTimerAuto("",0); |
9bf6860b | 412 | |
15d30ed4 | 413 | AliMUONVClusterFinder* clusterFinder = CreateClusterFinder(GetRecoParam()->GetClusteringMode()); |
c5ce806f | 414 | |
415 | if ( !clusterFinder ) return; | |
416 | ||
3304fa09 | 417 | AliInfo(Form("Will use %s for clusterizing",clusterFinder->ClassName())); |
f9247068 | 418 | |
9bf6860b | 419 | fClusterServer = new AliMUONSimpleClusterServer(clusterFinder,*fTransformer); |
f9247068 | 420 | } |
421 | ||
cac2eb58 | 422 | //_____________________________________________________________________________ |
22899106 | 423 | void |
00d46f24 | 424 | AliMUONReconstructor::CreateCalibrationData() const |
cac2eb58 | 425 | { |
22899106 | 426 | /// Create the calibrator |
2457f726 | 427 | |
00d46f24 | 428 | AliCodeTimerAuto("",0); |
3bc8b580 | 429 | |
22899106 | 430 | Int_t runNumber = AliCDBManager::Instance()->GetRun(); |
3bc8b580 | 431 | |
22899106 | 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 | ||
00977a64 | 441 | // It is now time to check whether we have everything to proceed. |
442 | // What we need depends on whether both tracker and trigger | |
443 | // are in the readout chain, and what specific "bad channel policy" | |
444 | // we use | |
445 | ||
446 | Bool_t kTracker(kFALSE); | |
447 | Bool_t kTrigger(kFALSE); | |
448 | ||
449 | const AliRunInfo* runInfo = GetRunInfo(); | |
450 | if (!runInfo) | |
451 | { | |
452 | AliError("Could not get runinfo ?") | |
453 | } | |
454 | else | |
455 | { | |
456 | TString detectors(runInfo->GetActiveDetectors()); | |
457 | if (detectors.Contains("MUONTRK")) kTracker=kTRUE; | |
458 | if (detectors.Contains("MUONTRG")) kTrigger=kTRUE; | |
459 | } | |
460 | ||
461 | AliInfo(Form("Run with MUON TRIGGER : %s and MUON TRACKER : %s", | |
462 | kTrigger ? "YES":"NO" , | |
463 | kTracker ? "YES":"NO")); | |
464 | ||
465 | if ( kTracker ) | |
22899106 | 466 | { |
00977a64 | 467 | // Check that we get all the calibrations we'll need |
468 | if ( !fCalibrationData->Pedestals() || | |
469 | !fCalibrationData->Gains() ) | |
470 | { | |
471 | AliFatal(Form("Could not access all required calibration data (PED %p GAIN %p)", | |
472 | fCalibrationData->Pedestals(),fCalibrationData->Gains())); | |
473 | } | |
474 | ||
475 | if ( !fCalibrationData->HV() ) | |
476 | { | |
477 | // Special treatment of HV. We only break if the values | |
478 | // are not there *AND* we cut on them. | |
479 | UInt_t mask = GetRecoParam()->PadGoodnessMask(); | |
480 | TString smask(AliMUONPadStatusMaker::AsCondition(mask)); | |
481 | if ( smask.Contains("HV") ) | |
482 | { | |
483 | AliFatal("Could not access all required calibration data (HV)"); | |
484 | } | |
485 | } | |
9ffe3ef4 | 486 | } |
00d46f24 | 487 | } |
488 | ||
489 | //_____________________________________________________________________________ | |
490 | void | |
491 | AliMUONReconstructor::CreateCalibrator() const | |
492 | { | |
493 | /// Create the calibrator | |
494 | ||
495 | AliCodeTimerAuto("",0); | |
496 | ||
497 | if ( ! fCalibrationData ) | |
498 | CreateCalibrationData(); | |
499 | ||
500 | AliInfo("Calibration will occur."); | |
501 | ||
22899106 | 502 | TString opt(GetOption()); |
503 | opt.ToUpper(); | |
b2d7df0b | 504 | |
22899106 | 505 | if ( strstr(opt,"NOSTATUSMAP") ) |
506 | { | |
22f7c9ba | 507 | AliWarning("NOSTATUSMAP is obsolete"); |
22899106 | 508 | } |
22f7c9ba | 509 | |
de98fdc9 | 510 | TString calibMode = GetRecoParam()->GetCalibrationMode(); |
511 | ||
de487b6e | 512 | fDigitCalibrator = new AliMUONDigitCalibrator(*fCalibrationData,GetRecoParam(),calibMode.Data()); |
22899106 | 513 | } |
9c4b1ee7 | 514 | |
00d46f24 | 515 | //_____________________________________________________________________________ |
516 | void | |
517 | AliMUONReconstructor::ResponseRemovingChambers(AliMUONVTriggerStore* triggerStore) const | |
518 | { | |
519 | /// Update trigger information with informatins obtained after | |
520 | /// re-calculation of trigger response | |
521 | AliCodeTimerAuto("",0); | |
522 | ||
523 | if ( ! fCalibrationData ) | |
524 | CreateCalibrationData(); | |
525 | ||
526 | if ( ! fTriggerProcessor ) | |
527 | fTriggerProcessor = new AliMUONTriggerElectronics(fCalibrationData); | |
528 | ||
529 | fTriggerProcessor->ResponseRemovingChambers(*triggerStore); | |
530 | } | |
531 | ||
22899106 | 532 | //_____________________________________________________________________________ |
533 | AliMUONVDigitStore* | |
534 | AliMUONReconstructor::DigitStore() const | |
535 | { | |
536 | /// Return (and create if necessary) the digit container | |
537 | if (!fDigitStore) | |
538 | { | |
93d7b017 | 539 | TString sopt(GetOption()); |
540 | sopt.ToUpper(); | |
541 | ||
542 | AliInfo(Form("Options=%s",sopt.Data())); | |
543 | ||
544 | if ( sopt.Contains("DIGITSTOREV1") ) | |
545 | { | |
546 | fDigitStore = AliMUONVDigitStore::Create("AliMUONDigitStoreV1"); | |
547 | } | |
548 | else if ( sopt.Contains("DIGITSTOREV2R") ) | |
549 | { | |
550 | fDigitStore = AliMUONVDigitStore::Create("AliMUONDigitStoreV2R"); | |
551 | } | |
552 | else if ( sopt.Contains("DIGITSTOREV2S") ) | |
553 | { | |
554 | fDigitStore = AliMUONVDigitStore::Create("AliMUONDigitStoreV2S"); | |
555 | } | |
556 | ||
557 | if (!fDigitStore) fDigitStore = AliMUONVDigitStore::Create("AliMUONDigitStoreV2R"); | |
558 | ||
559 | AliInfo(Form("Will use %s to store digits during reconstruction",fDigitStore->ClassName())); | |
22899106 | 560 | } |
561 | return fDigitStore; | |
562 | } | |
94f6fba9 | 563 | |
22899106 | 564 | //_____________________________________________________________________________ |
565 | void | |
566 | AliMUONReconstructor::FillTreeR(AliMUONVTriggerStore* triggerStore, | |
22899106 | 567 | TTree& clustersTree) const |
568 | { | |
569 | /// Write the trigger and cluster information into TreeR | |
570 | ||
99c136e1 | 571 | AliCodeTimerAuto("",0) |
cc87ebcd | 572 | |
22899106 | 573 | AliDebug(1,""); |
574 | ||
575 | Bool_t ok(kFALSE); | |
9bf6860b | 576 | Bool_t alone(kTRUE); // is trigger the only info in TreeR ? |
577 | ||
a0dc65b4 | 578 | if ( ! GetRecoParam()->CombineClusterTrackReco() ) |
9bf6860b | 579 | { |
580 | alone = kFALSE; // we'll get both tracker and trigger information in TreeR | |
581 | } | |
582 | ||
22899106 | 583 | if ( triggerStore ) |
584 | { | |
00d46f24 | 585 | ResponseRemovingChambers(triggerStore); |
9bf6860b | 586 | ok = triggerStore->Connect(clustersTree,alone); |
22899106 | 587 | if (!ok) |
b2d7df0b | 588 | { |
22899106 | 589 | AliError("Could not create triggerStore branches in TreeR"); |
cc87ebcd | 590 | } |
cac2eb58 | 591 | } |
9bf6860b | 592 | |
9bf6860b | 593 | if ( !alone ) |
594 | { | |
9ec6a948 | 595 | if (!fClusterStore) |
596 | { | |
597 | fClusterStore = new AliMUONClusterStoreV2; | |
598 | } | |
9bf6860b | 599 | |
600 | CreateClusterServer(); | |
601 | ||
602 | TIter next(DigitStore()->CreateIterator()); | |
2e2d0c44 | 603 | fClusterServer->UseDigits(next,DigitStore()); |
9bf6860b | 604 | |
605 | AliMpArea area; | |
606 | ||
607 | AliDebug(1,Form("Doing full clusterization in local reconstruction using %s ",fClusterServer->ClassName())); | |
608 | ||
609 | for ( Int_t i = 0; i < AliMpConstants::NofTrackingChambers(); ++i ) | |
610 | { | |
a0dc65b4 | 611 | if (GetRecoParam()->UseChamber(i)) |
9bf6860b | 612 | { |
a0dc65b4 | 613 | if ( ( i == 6 || i == 7 ) && GetRecoParam()->BypassSt4() ) continue; |
614 | if ( ( i == 8 || i == 9 ) && GetRecoParam()->BypassSt5() ) continue; | |
9bf6860b | 615 | |
35be7ed7 | 616 | fClusterServer->Clusterize(i,*fClusterStore,area,GetRecoParam()); |
9bf6860b | 617 | } |
618 | } | |
619 | ||
9ec6a948 | 620 | Bool_t cok = fClusterStore->Connect(clustersTree,alone); |
9bf6860b | 621 | |
622 | if (!cok) AliError("Could not connect clusterStore to clusterTree"); | |
623 | ||
9ec6a948 | 624 | AliDebug(1,Form("Number of clusters found = %d",fClusterStore->GetSize())); |
9bf6860b | 625 | |
9ec6a948 | 626 | StdoutToAliDebug(1,fClusterStore->Print()); |
9bf6860b | 627 | } |
628 | ||
22899106 | 629 | if (ok) // at least one type of branches created successfully |
630 | { | |
631 | clustersTree.Fill(); | |
632 | } | |
9bf6860b | 633 | |
f73ad454 | 634 | if (fClusterStore) fClusterStore->Clear(); |
cac2eb58 | 635 | } |
cf464691 | 636 | |
637 | //_____________________________________________________________________________ | |
22899106 | 638 | Bool_t |
639 | AliMUONReconstructor::HasDigitConversion() const | |
cf464691 | 640 | { |
22899106 | 641 | /// We *do* have digit conversion, but we might advertise it only |
642 | /// if we want to save the digits. | |
643 | ||
644 | TString opt(GetOption()); | |
645 | opt.ToUpper(); | |
646 | if ( opt.Contains("SAVEDIGITS" ) && !opt.Contains("NOLOCALRECONSTRUCTION") ) | |
647 | { | |
648 | return kTRUE; | |
649 | } | |
650 | else | |
651 | { | |
652 | return kFALSE; | |
653 | } | |
654 | } | |
f9247068 | 655 | |
22899106 | 656 | //_____________________________________________________________________________ |
657 | void | |
658 | AliMUONReconstructor::Reconstruct(AliRawReader* rawReader, TTree* clustersTree) const | |
659 | { | |
660 | /// This method is called by AliReconstruction if HasLocalReconstruction()==kTRUE AND | |
661 | /// HasDigitConversion()==kFALSE | |
8cde4af5 | 662 | |
22899106 | 663 | if ( !clustersTree ) |
664 | { | |
665 | AliError("clustersTree is 0x0 !"); | |
666 | return; | |
667 | } | |
b2d7df0b | 668 | |
93d7b017 | 669 | ConvertDigits(rawReader,DigitStore(),TriggerStore()); |
c5ce806f | 670 | |
671 | FillTreeR(TriggerStore(),*clustersTree); | |
22899106 | 672 | } |
64b056bc | 673 | |
196471e9 | 674 | //_____________________________________________________________________________ |
22899106 | 675 | void |
676 | AliMUONReconstructor::Reconstruct(TTree* digitsTree, TTree* clustersTree) const | |
a2da7817 | 677 | { |
22899106 | 678 | /// This method is called by AliReconstruction if HasLocalReconstruction()==kTRUE |
679 | /// AND HasDigitConversion()==kTRUE | |
680 | ||
99c136e1 | 681 | AliCodeTimerAuto("",0) |
93d7b017 | 682 | |
22899106 | 683 | AliDebug(1,""); |
684 | ||
685 | if (!digitsTree || !clustersTree) | |
686 | { | |
687 | AliError(Form("Tree is null : digitsTree=%p clustersTree=%p", | |
688 | digitsTree,clustersTree)); | |
689 | return; | |
690 | } | |
d19b6003 | 691 | |
22899106 | 692 | if (!fDigitStore) |
693 | { | |
694 | fDigitStore = AliMUONVDigitStore::Create(*digitsTree); | |
695 | if (!fDigitStore) | |
696 | { | |
697 | AliError(Form("Could not get DigitStore from %s",digitsTree->GetName())); | |
698 | } | |
699 | else | |
700 | { | |
701 | AliInfo(Form("Created %s from %s",fDigitStore->ClassName(),digitsTree->GetName())); | |
702 | } | |
703 | } | |
704 | if (!fTriggerStore) | |
705 | { | |
706 | fTriggerStore = AliMUONVTriggerStore::Create(*digitsTree); | |
707 | if (!fTriggerStore) | |
708 | { | |
709 | AliError(Form("Could not get TriggerStore from %s",digitsTree->GetName())); | |
710 | } | |
711 | else | |
712 | { | |
713 | AliInfo(Form("Created %s from %s",fTriggerStore->ClassName(),digitsTree->GetName())); | |
714 | } | |
715 | } | |
716 | ||
717 | if (!fTriggerStore && !fDigitStore) | |
718 | { | |
719 | AliError("No store at all. Nothing to do."); | |
720 | return; | |
721 | } | |
722 | ||
723 | // insure we start with empty stores | |
724 | if ( fDigitStore ) | |
725 | { | |
726 | fDigitStore->Clear(); | |
727 | Bool_t alone = ( fTriggerStore ? kFALSE : kTRUE ); | |
728 | Bool_t ok = fDigitStore->Connect(*digitsTree,alone); | |
729 | if (!ok) | |
730 | { | |
731 | AliError("Could not connect digitStore to digitsTree"); | |
732 | return; | |
733 | } | |
734 | } | |
735 | if ( fTriggerStore ) | |
736 | { | |
737 | fTriggerStore->Clear(); | |
738 | Bool_t alone = ( fDigitStore ? kFALSE : kTRUE ); | |
739 | Bool_t ok = fTriggerStore->Connect(*digitsTree,alone); | |
740 | if (!ok) | |
741 | { | |
742 | AliError("Could not connect triggerStore to digitsTree"); | |
743 | return; | |
744 | } | |
745 | } | |
746 | ||
747 | digitsTree->GetEvent(0); | |
748 | ||
749 | if ( fDigitStore ) | |
750 | { | |
e729a0c8 | 751 | // Insure we got calibrated digits (if we reconstruct from pure simulated, |
752 | // i.e. w/o going through raw data, this will be the case) | |
753 | TIter next(fDigitStore->CreateIterator()); | |
754 | AliMUONVDigit* digit = static_cast<AliMUONVDigit*>(next()); | |
ca4733b5 | 755 | if (digit && !digit->IsCalibrated()) |
e729a0c8 | 756 | { |
757 | Calibrate(*fDigitStore); | |
758 | } | |
22899106 | 759 | } |
760 | ||
c5ce806f | 761 | FillTreeR(fTriggerStore,*clustersTree); |
cac2eb58 | 762 | } |
196471e9 | 763 | |
764 | //_____________________________________________________________________________ | |
22899106 | 765 | AliMUONVTriggerStore* |
766 | AliMUONReconstructor::TriggerStore() const | |
196471e9 | 767 | { |
22899106 | 768 | /// Return (and create if necessary and allowed) the trigger container |
769 | TString sopt(GetOption()); | |
770 | sopt.ToUpper(); | |
771 | ||
772 | if (sopt.Contains("TRIGGERDISABLE")) | |
773 | { | |
774 | delete fTriggerStore; | |
775 | fTriggerStore = 0x0; | |
776 | } | |
777 | else | |
778 | { | |
779 | if (!fTriggerStore) | |
780 | { | |
781 | fTriggerStore = new AliMUONTriggerStoreV1; | |
782 | } | |
783 | } | |
784 | return fTriggerStore; | |
196471e9 | 785 | } |