]>
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" |
d5315275 | 104 | #include "AliMUONTriggerUtilities.h" |
c5ce806f | 105 | |
106 | #include "AliMpArea.h" | |
88544f7e | 107 | #include "AliMpCDB.h" |
c5ce806f | 108 | #include "AliMpConstants.h" |
acd0cf59 | 109 | #include "AliMpDDLStore.h" |
110 | #include "AliMpSegmentation.h" | |
c5ce806f | 111 | |
cf464691 | 112 | #include "AliRawReader.h" |
c5ce806f | 113 | #include "AliCDBManager.h" |
93d7b017 | 114 | #include "AliCodeTimer.h" |
c5ce806f | 115 | #include "AliLog.h" |
00977a64 | 116 | #include "AliRunInfo.h" |
c5ce806f | 117 | |
22899106 | 118 | #include <Riostream.h> |
15d30ed4 | 119 | #include <TObjArray.h> |
22899106 | 120 | #include <TClonesArray.h> |
121 | #include <TString.h> | |
122 | #include <TTree.h> | |
2060b217 | 123 | |
9265505b | 124 | /// \cond CLASSIMP |
cac2eb58 | 125 | ClassImp(AliMUONReconstructor) |
22899106 | 126 | /// \endcond |
b2d7df0b | 127 | |
cac2eb58 | 128 | //_____________________________________________________________________________ |
22899106 | 129 | AliMUONReconstructor::AliMUONReconstructor() : |
130 | AliReconstructor(), | |
22899106 | 131 | fDigitMaker(0x0), |
ef4cb4f1 | 132 | fTransformer(new AliMUONGeometryTransformer()), |
22899106 | 133 | fDigitStore(0x0), |
134 | fTriggerCircuit(0x0), | |
135 | fCalibrationData(0x0), | |
136 | fDigitCalibrator(0x0), | |
22899106 | 137 | fTriggerStore(0x0), |
9ec6a948 | 138 | fTrackStore(0x0), |
00d46f24 | 139 | fClusterStore(0x0), |
d5315275 | 140 | fTriggerProcessor(0x0), |
cfeca9e2 | 141 | fTriggerUtilities(0x0), |
142 | fClusterServers(), | |
7b830a3f | 143 | fTrackers(), |
144 | fShouldCalibrate(kTRUE) | |
8789635b | 145 | { |
22899106 | 146 | /// normal ctor |
88544f7e | 147 | |
acd0cf59 | 148 | AliDebug(1,""); |
78dfbced | 149 | |
150 | // Unload mapping objects | |
151 | // if they have been loaded from the obsolete OCDB mapping objects | |
152 | ||
153 | if ( AliMpDDLStore::Instance(false) ) { | |
154 | AliCDBManager::Instance()->UnloadFromCache("MUON/Calib/DDLStore"); | |
155 | delete AliMpDDLStore::Instance(); | |
156 | } | |
157 | ||
158 | if ( AliMpSegmentation::Instance(false) ) { | |
159 | AliCDBManager::Instance()->UnloadFromCache("MUON/Calib/Mapping"); | |
160 | delete AliMpSegmentation::Instance(); | |
161 | } | |
acd0cf59 | 162 | |
88544f7e | 163 | // Load mapping |
a55f49a0 | 164 | if ( ! AliMpCDB::LoadDDLStore() ) { |
88544f7e | 165 | AliFatal("Could not access mapping from OCDB !"); |
166 | } | |
167 | ||
a55f49a0 | 168 | // Load geometry data |
169 | fTransformer->LoadGeometryData(); | |
cfeca9e2 | 170 | |
171 | fClusterServers.SetOwner(kTRUE); | |
172 | fTrackers.SetOwner(kTRUE); | |
22899106 | 173 | } |
d19b6003 | 174 | |
22899106 | 175 | //_____________________________________________________________________________ |
176 | AliMUONReconstructor::~AliMUONReconstructor() | |
177 | { | |
7d5d0cc5 | 178 | /// dtor |
179 | ||
acd0cf59 | 180 | AliDebug(1,""); |
181 | ||
05315e71 | 182 | delete fDigitCalibrator; |
183 | ||
22899106 | 184 | delete fDigitMaker; |
185 | delete fDigitStore; | |
186 | delete fTransformer; | |
22899106 | 187 | delete fTriggerCircuit; |
22899106 | 188 | delete fTriggerStore; |
189 | delete fTrackStore; | |
9ec6a948 | 190 | delete fClusterStore; |
00d46f24 | 191 | delete fTriggerProcessor; |
d5315275 | 192 | delete fTriggerUtilities; |
acd0cf59 | 193 | |
194 | delete AliMpSegmentation::Instance(false); | |
05315e71 | 195 | delete AliMpDDLStore::Instance(false); |
196 | ||
cfeca9e2 | 197 | delete fCalibrationData; |
22899106 | 198 | } |
96fdfe9a | 199 | |
22899106 | 200 | //_____________________________________________________________________________ |
201 | void | |
202 | AliMUONReconstructor::Calibrate(AliMUONVDigitStore& digitStore) const | |
203 | { | |
204 | /// Calibrate the digitStore | |
205 | if (!fDigitCalibrator) | |
206 | { | |
207 | CreateCalibrator(); | |
208 | } | |
7b830a3f | 209 | |
210 | if ( fShouldCalibrate ) | |
211 | { | |
212 | AliCodeTimerAuto(Form("%s::Calibrate(AliMUONVDigitStore*)",fDigitCalibrator->ClassName()),0) | |
213 | fDigitCalibrator->Calibrate(digitStore); | |
214 | } | |
22899106 | 215 | } |
96fdfe9a | 216 | |
22899106 | 217 | //_____________________________________________________________________________ |
218 | void | |
219 | AliMUONReconstructor::ConvertDigits(AliRawReader* rawReader, | |
220 | AliMUONVDigitStore* digitStore, | |
221 | AliMUONVTriggerStore* triggerStore) const | |
222 | { | |
223 | /// Convert raw data into digit and trigger stores | |
224 | CreateDigitMaker(); | |
c6e702f8 | 225 | |
226 | // Skip reconstruction if event is Calibration | |
227 | if ( GetRecoParam()->GetEventSpecie() == AliRecoParam::kCalib ) { | |
228 | digitStore->Clear(); // Remove possible digits from previous event | |
229 | triggerStore->Clear(); // Remove possible triggers from previous event | |
230 | AliInfo("Calibration event: do not convert digits"); | |
231 | return; | |
232 | } | |
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 |
99c136e1 | 247 | AliCodeTimerAuto("",0) |
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 | ||
22899106 | 271 | //_____________________________________________________________________________ |
272 | void | |
273 | AliMUONReconstructor::CreateDigitMaker() const | |
274 | { | |
275 | /// Create (and create if necessary) the digit maker | |
276 | if (fDigitMaker) return; | |
277 | ||
99c136e1 | 278 | AliCodeTimerAuto("",0) |
22899106 | 279 | |
e3a2b9c9 | 280 | TString option = GetOption(); |
b6f591ae | 281 | |
282 | Bool_t enableErrorLogging = kFALSE; | |
283 | ||
284 | if (option.Contains("ENABLEERRORLOGGING")) | |
e3a2b9c9 | 285 | { |
b6f591ae | 286 | enableErrorLogging = kTRUE; |
e3a2b9c9 | 287 | } |
b6f591ae | 288 | |
289 | fDigitMaker = new AliMUONDigitMaker(enableErrorLogging); | |
5483c51b | 290 | option.ToUpper(); |
64f628e9 | 291 | |
292 | // Always make trigger digits | |
293 | // (needed when calculating trigger chamber efficiency) | |
294 | fDigitMaker->SetMakeTriggerDigits(kTRUE); | |
295 | ||
9074a9a9 | 296 | if ( GetRecoParam()->TryRecover() ) |
297 | { | |
298 | fDigitMaker->SetTryRecover(kTRUE); | |
299 | } | |
300 | else | |
301 | { | |
302 | fDigitMaker->SetTryRecover(kFALSE); | |
303 | } | |
22899106 | 304 | } |
305 | ||
306 | //_____________________________________________________________________________ | |
307 | void | |
308 | AliMUONReconstructor::CreateTriggerCircuit() const | |
309 | { | |
310 | /// Return (and create if necessary) the trigger circuit object | |
311 | if (fTriggerCircuit) return; | |
312 | ||
99c136e1 | 313 | AliCodeTimerAuto("",0) |
22899106 | 314 | |
32ab62c9 | 315 | fTriggerCircuit = new AliMUONTriggerCircuit(fTransformer); |
22899106 | 316 | |
32ab62c9 | 317 | } |
8c0b5e70 | 318 | |
d5315275 | 319 | //_____________________________________________________________________________ |
320 | void | |
321 | AliMUONReconstructor::CreateTriggerUtilities() const | |
322 | { | |
323 | /// Return (and create if necessary) the trigger utilities object | |
324 | if ( fTriggerUtilities ) return; | |
325 | ||
326 | AliCodeTimerAuto("",0) | |
327 | ||
328 | if ( ! fCalibrationData ) CreateCalibrationData(); | |
329 | ||
330 | fTriggerUtilities = new AliMUONTriggerUtilities(fCalibrationData); | |
331 | } | |
332 | ||
22899106 | 333 | //_____________________________________________________________________________ |
334 | AliTracker* | |
d76c31f4 | 335 | AliMUONReconstructor::CreateTracker() const |
22899106 | 336 | { |
337 | /// Create the MUONTracker object | |
ee103e97 | 338 | |
22899106 | 339 | CreateTriggerCircuit(); |
d5315275 | 340 | CreateTriggerUtilities(); |
c5ce806f | 341 | |
cfeca9e2 | 342 | const AliMUONRecoParam* rp = GetRecoParam(); |
343 | ||
344 | Int_t es = rp->GetEventSpecie(); | |
345 | ||
346 | AliTracker* tracker = static_cast<AliTracker*>(fTrackers.At(es)); | |
347 | ||
348 | if (!tracker ) | |
9bf6860b | 349 | { |
cfeca9e2 | 350 | if ( ! rp->CombineClusterTrackReco() ) |
351 | { | |
352 | tracker = new AliMUONTracker(rp, | |
353 | 0x0, | |
354 | *DigitStore(), | |
355 | fTransformer, | |
356 | fTriggerCircuit, | |
357 | fTriggerUtilities); | |
358 | ||
359 | AliInfo(Form("Created tracker %p for recoparam of type %s es=%d", | |
360 | tracker, | |
361 | AliRecoParam::GetEventSpecieName(AliRecoParam::Convert(rp->GetEventSpecie())),es)); | |
362 | } | |
363 | else | |
364 | { | |
365 | ||
366 | tracker = new AliMUONTracker(rp, | |
367 | CreateClusterServer(*rp), | |
368 | *DigitStore(), | |
369 | fTransformer, | |
370 | fTriggerCircuit, | |
371 | fTriggerUtilities); | |
372 | ||
373 | AliInfo(Form("Created (combined) tracker %p for recoparam of type %s es=%d", | |
374 | tracker, | |
375 | AliRecoParam::GetEventSpecieName(AliRecoParam::Convert(rp->GetEventSpecie())),es)); | |
376 | } | |
377 | ||
378 | fTrackers.AddAtAndExpand(tracker,es); | |
c5ce806f | 379 | } |
22899106 | 380 | |
22899106 | 381 | |
382 | return tracker; | |
b2d7df0b | 383 | } |
384 | ||
f9247068 | 385 | //_____________________________________________________________________________ |
c5ce806f | 386 | AliMUONVClusterFinder* |
9bf6860b | 387 | AliMUONReconstructor::CreateClusterFinder(const char* clusterFinderType) |
f9247068 | 388 | { |
c5ce806f | 389 | /// Create a given cluster finder instance |
22899106 | 390 | |
99c136e1 | 391 | AliCodeTimerAutoGeneral("",0) |
06ca6d7b | 392 | |
f9247068 | 393 | AliMUONVClusterFinder* clusterFinder(0x0); |
394 | ||
c5ce806f | 395 | TString opt(clusterFinderType); |
f9247068 | 396 | opt.ToUpper(); |
397 | ||
93d7b017 | 398 | if ( strstr(opt,"PRECLUSTERV2") ) |
399 | { | |
400 | clusterFinder = new AliMUONPreClusterFinderV2; | |
401 | } | |
402 | else if ( strstr(opt,"PRECLUSTERV3") ) | |
403 | { | |
404 | clusterFinder = new AliMUONPreClusterFinderV3; | |
405 | } | |
406 | else if ( strstr(opt,"PRECLUSTER") ) | |
f9247068 | 407 | { |
408 | clusterFinder = new AliMUONPreClusterFinder; | |
409 | } | |
3ab319aa | 410 | else if ( strstr(opt,"PEAKCOG") ) |
411 | { | |
412 | clusterFinder = new AliMUONClusterFinderPeakCOG(kFALSE,new AliMUONPreClusterFinder); | |
413 | } | |
414 | else if ( strstr(opt,"PEAKFIT") ) | |
415 | { | |
416 | clusterFinder = new AliMUONClusterFinderPeakFit(kFALSE,new AliMUONPreClusterFinder); | |
417 | } | |
f9247068 | 418 | else if ( strstr(opt,"COG") ) |
419 | { | |
93d7b017 | 420 | clusterFinder = new AliMUONClusterFinderCOG(new AliMUONPreClusterFinder); |
f9247068 | 421 | } |
93d7b017 | 422 | else if ( strstr(opt,"SIMPLEFITV3") ) |
423 | { | |
424 | clusterFinder = new AliMUONClusterFinderSimpleFit(new AliMUONClusterFinderCOG(new AliMUONPreClusterFinderV3)); | |
425 | } | |
f9247068 | 426 | else if ( strstr(opt,"SIMPLEFIT") ) |
427 | { | |
93d7b017 | 428 | clusterFinder = new AliMUONClusterFinderSimpleFit(new AliMUONClusterFinderCOG(new AliMUONPreClusterFinder)); |
f9247068 | 429 | } |
430 | else if ( strstr(opt,"MLEM:DRAW") ) | |
431 | { | |
93d7b017 | 432 | clusterFinder = new AliMUONClusterFinderMLEM(kTRUE,new AliMUONPreClusterFinder); |
f9247068 | 433 | } |
93d7b017 | 434 | else if ( strstr(opt,"MLEMV3") ) |
435 | { | |
436 | clusterFinder = new AliMUONClusterFinderMLEM(kFALSE,new AliMUONPreClusterFinderV3); | |
437 | } | |
438 | else if ( strstr(opt,"MLEMV2") ) | |
439 | { | |
440 | clusterFinder = new AliMUONClusterFinderMLEM(kFALSE,new AliMUONPreClusterFinderV2); | |
441 | } | |
f9247068 | 442 | else if ( strstr(opt,"MLEM") ) |
443 | { | |
93d7b017 | 444 | clusterFinder = new AliMUONClusterFinderMLEM(kFALSE,new AliMUONPreClusterFinder); |
f9247068 | 445 | } |
22899106 | 446 | else |
447 | { | |
9bf6860b | 448 | AliErrorClass(Form("clustering mode \"%s\" does not exist",opt.Data())); |
c5ce806f | 449 | return 0x0; |
22899106 | 450 | } |
f9247068 | 451 | |
c5ce806f | 452 | return clusterFinder; |
453 | } | |
454 | ||
455 | //_____________________________________________________________________________ | |
cfeca9e2 | 456 | AliMUONVClusterServer* |
457 | AliMUONReconstructor::CreateClusterServer(const AliMUONRecoParam& rp) const | |
c5ce806f | 458 | { |
459 | /// Create cluster server | |
460 | ||
99c136e1 | 461 | AliCodeTimerAuto("",0); |
c5ce806f | 462 | |
cfeca9e2 | 463 | AliMUONVClusterServer* clusterServer = static_cast<AliMUONVClusterServer*>(fClusterServers.At(rp.GetEventSpecie())); |
c5ce806f | 464 | |
cfeca9e2 | 465 | if (!clusterServer ) |
466 | { | |
467 | AliMUONVClusterFinder* clusterFinder = CreateClusterFinder(rp.GetClusteringMode()); | |
468 | ||
469 | if ( !clusterFinder ) return 0x0; | |
470 | ||
471 | clusterServer = new AliMUONSimpleClusterServer(clusterFinder,*fTransformer); | |
472 | ||
054ef6d1 | 473 | AliInfo(Form("Created AliMUONSimpleClusterServer (%p) for specie %d with clustering = %s (following requesting clustering mode %s)", |
474 | clusterServer,rp.GetEventSpecie(),clusterFinder->ClassName(),rp.GetClusteringMode())); | |
cfeca9e2 | 475 | |
476 | fClusterServers.AddAtAndExpand(clusterServer,rp.GetEventSpecie()); | |
477 | } | |
f9247068 | 478 | |
cfeca9e2 | 479 | return clusterServer; |
f9247068 | 480 | } |
481 | ||
cac2eb58 | 482 | //_____________________________________________________________________________ |
22899106 | 483 | void |
00d46f24 | 484 | AliMUONReconstructor::CreateCalibrationData() const |
cac2eb58 | 485 | { |
22899106 | 486 | /// Create the calibrator |
2457f726 | 487 | |
00d46f24 | 488 | AliCodeTimerAuto("",0); |
3bc8b580 | 489 | |
22899106 | 490 | Int_t runNumber = AliCDBManager::Instance()->GetRun(); |
3bc8b580 | 491 | |
22899106 | 492 | fCalibrationData = new AliMUONCalibrationData(runNumber); |
493 | if ( !fCalibrationData->IsValid() ) | |
494 | { | |
495 | AliError("Could not retrieve calibrations !"); | |
496 | delete fCalibrationData; | |
497 | fCalibrationData = 0x0; | |
498 | return; | |
499 | } | |
500 | ||
00977a64 | 501 | // It is now time to check whether we have everything to proceed. |
502 | // What we need depends on whether both tracker and trigger | |
503 | // are in the readout chain, and what specific "bad channel policy" | |
504 | // we use | |
505 | ||
506 | Bool_t kTracker(kFALSE); | |
507 | Bool_t kTrigger(kFALSE); | |
508 | ||
509 | const AliRunInfo* runInfo = GetRunInfo(); | |
510 | if (!runInfo) | |
511 | { | |
13242232 | 512 | AliError("Could not get runinfo ?"); |
00977a64 | 513 | } |
514 | else | |
515 | { | |
516 | TString detectors(runInfo->GetActiveDetectors()); | |
517 | if (detectors.Contains("MUONTRK")) kTracker=kTRUE; | |
518 | if (detectors.Contains("MUONTRG")) kTrigger=kTRUE; | |
519 | } | |
520 | ||
521 | AliInfo(Form("Run with MUON TRIGGER : %s and MUON TRACKER : %s", | |
522 | kTrigger ? "YES":"NO" , | |
523 | kTracker ? "YES":"NO")); | |
524 | ||
525 | if ( kTracker ) | |
22899106 | 526 | { |
00977a64 | 527 | // Check that we get all the calibrations we'll need |
528 | if ( !fCalibrationData->Pedestals() || | |
529 | !fCalibrationData->Gains() ) | |
530 | { | |
531 | AliFatal(Form("Could not access all required calibration data (PED %p GAIN %p)", | |
532 | fCalibrationData->Pedestals(),fCalibrationData->Gains())); | |
533 | } | |
534 | ||
535 | if ( !fCalibrationData->HV() ) | |
536 | { | |
537 | // Special treatment of HV. We only break if the values | |
538 | // are not there *AND* we cut on them. | |
539 | UInt_t mask = GetRecoParam()->PadGoodnessMask(); | |
540 | TString smask(AliMUONPadStatusMaker::AsCondition(mask)); | |
541 | if ( smask.Contains("HV") ) | |
542 | { | |
543 | AliFatal("Could not access all required calibration data (HV)"); | |
544 | } | |
545 | } | |
9ffe3ef4 | 546 | } |
00d46f24 | 547 | } |
548 | ||
549 | //_____________________________________________________________________________ | |
550 | void | |
551 | AliMUONReconstructor::CreateCalibrator() const | |
552 | { | |
553 | /// Create the calibrator | |
554 | ||
555 | AliCodeTimerAuto("",0); | |
556 | ||
557 | if ( ! fCalibrationData ) | |
558 | CreateCalibrationData(); | |
559 | ||
560 | AliInfo("Calibration will occur."); | |
561 | ||
22899106 | 562 | TString opt(GetOption()); |
563 | opt.ToUpper(); | |
b2d7df0b | 564 | |
22899106 | 565 | if ( strstr(opt,"NOSTATUSMAP") ) |
566 | { | |
22f7c9ba | 567 | AliWarning("NOSTATUSMAP is obsolete"); |
22899106 | 568 | } |
22f7c9ba | 569 | |
7b830a3f | 570 | Bool_t kTracker(kFALSE); |
571 | ||
572 | const AliRunInfo* runInfo = GetRunInfo(); | |
573 | if (!runInfo) | |
574 | { | |
575 | AliError("Could not get runinfo ?"); | |
576 | } | |
577 | else | |
578 | { | |
579 | TString detectors(runInfo->GetActiveDetectors()); | |
580 | if (detectors.Contains("MUONTRK")) kTracker=kTRUE; | |
581 | } | |
582 | ||
583 | if ( kTracker ) | |
584 | { | |
585 | fDigitCalibrator = new AliMUONDigitCalibrator(*fCalibrationData,GetRecoParam()); | |
586 | } | |
587 | else | |
588 | { | |
589 | AliWarning("Apparently running without MCH so will not instantiante the DigitCalibrator nor read MCH OCDB objects..."); | |
590 | fShouldCalibrate=kFALSE; | |
591 | } | |
22899106 | 592 | } |
9c4b1ee7 | 593 | |
00d46f24 | 594 | //_____________________________________________________________________________ |
595 | void | |
596 | AliMUONReconstructor::ResponseRemovingChambers(AliMUONVTriggerStore* triggerStore) const | |
597 | { | |
598 | /// Update trigger information with informatins obtained after | |
599 | /// re-calculation of trigger response | |
600 | AliCodeTimerAuto("",0); | |
601 | ||
602 | if ( ! fCalibrationData ) | |
603 | CreateCalibrationData(); | |
604 | ||
605 | if ( ! fTriggerProcessor ) | |
606 | fTriggerProcessor = new AliMUONTriggerElectronics(fCalibrationData); | |
607 | ||
608 | fTriggerProcessor->ResponseRemovingChambers(*triggerStore); | |
609 | } | |
610 | ||
22899106 | 611 | //_____________________________________________________________________________ |
612 | AliMUONVDigitStore* | |
613 | AliMUONReconstructor::DigitStore() const | |
614 | { | |
615 | /// Return (and create if necessary) the digit container | |
616 | if (!fDigitStore) | |
617 | { | |
93d7b017 | 618 | TString sopt(GetOption()); |
619 | sopt.ToUpper(); | |
620 | ||
621 | AliInfo(Form("Options=%s",sopt.Data())); | |
622 | ||
623 | if ( sopt.Contains("DIGITSTOREV1") ) | |
624 | { | |
625 | fDigitStore = AliMUONVDigitStore::Create("AliMUONDigitStoreV1"); | |
626 | } | |
627 | else if ( sopt.Contains("DIGITSTOREV2R") ) | |
628 | { | |
629 | fDigitStore = AliMUONVDigitStore::Create("AliMUONDigitStoreV2R"); | |
630 | } | |
631 | else if ( sopt.Contains("DIGITSTOREV2S") ) | |
632 | { | |
633 | fDigitStore = AliMUONVDigitStore::Create("AliMUONDigitStoreV2S"); | |
634 | } | |
635 | ||
636 | if (!fDigitStore) fDigitStore = AliMUONVDigitStore::Create("AliMUONDigitStoreV2R"); | |
637 | ||
638 | AliInfo(Form("Will use %s to store digits during reconstruction",fDigitStore->ClassName())); | |
22899106 | 639 | } |
640 | return fDigitStore; | |
641 | } | |
94f6fba9 | 642 | |
22899106 | 643 | //_____________________________________________________________________________ |
644 | void | |
645 | AliMUONReconstructor::FillTreeR(AliMUONVTriggerStore* triggerStore, | |
22899106 | 646 | TTree& clustersTree) const |
647 | { | |
648 | /// Write the trigger and cluster information into TreeR | |
9074a9a9 | 649 | |
99c136e1 | 650 | AliCodeTimerAuto("",0) |
cc87ebcd | 651 | |
22899106 | 652 | Bool_t ok(kFALSE); |
9bf6860b | 653 | Bool_t alone(kTRUE); // is trigger the only info in TreeR ? |
654 | ||
cfeca9e2 | 655 | const AliMUONRecoParam* rp = GetRecoParam(); |
656 | ||
657 | if ( ! rp->CombineClusterTrackReco() ) | |
9bf6860b | 658 | { |
659 | alone = kFALSE; // we'll get both tracker and trigger information in TreeR | |
660 | } | |
661 | ||
22899106 | 662 | if ( triggerStore ) |
663 | { | |
00d46f24 | 664 | ResponseRemovingChambers(triggerStore); |
9bf6860b | 665 | ok = triggerStore->Connect(clustersTree,alone); |
22899106 | 666 | if (!ok) |
b2d7df0b | 667 | { |
22899106 | 668 | AliError("Could not create triggerStore branches in TreeR"); |
cc87ebcd | 669 | } |
cac2eb58 | 670 | } |
9bf6860b | 671 | |
9bf6860b | 672 | if ( !alone ) |
673 | { | |
9ec6a948 | 674 | if (!fClusterStore) |
675 | { | |
676 | fClusterStore = new AliMUONClusterStoreV2; | |
677 | } | |
9bf6860b | 678 | |
cfeca9e2 | 679 | AliMUONVClusterServer* clusterServer = CreateClusterServer(*rp); |
9bf6860b | 680 | |
681 | TIter next(DigitStore()->CreateIterator()); | |
cfeca9e2 | 682 | clusterServer->UseDigits(next,DigitStore()); |
9bf6860b | 683 | |
684 | AliMpArea area; | |
685 | ||
cfeca9e2 | 686 | AliDebug(1,Form("Doing full clusterization in local reconstruction using %s ",clusterServer->ClassName())); |
9bf6860b | 687 | |
688 | for ( Int_t i = 0; i < AliMpConstants::NofTrackingChambers(); ++i ) | |
689 | { | |
cfeca9e2 | 690 | if (rp->UseChamber(i)) |
9bf6860b | 691 | { |
cfeca9e2 | 692 | if ( ( i == 6 || i == 7 ) && rp->BypassSt4() ) continue; |
693 | if ( ( i == 8 || i == 9 ) && rp->BypassSt5() ) continue; | |
9bf6860b | 694 | |
cfeca9e2 | 695 | clusterServer->Clusterize(i,*fClusterStore,area,rp); |
9bf6860b | 696 | } |
697 | } | |
698 | ||
9ec6a948 | 699 | Bool_t cok = fClusterStore->Connect(clustersTree,alone); |
9bf6860b | 700 | |
701 | if (!cok) AliError("Could not connect clusterStore to clusterTree"); | |
702 | ||
9ec6a948 | 703 | AliDebug(1,Form("Number of clusters found = %d",fClusterStore->GetSize())); |
9bf6860b | 704 | |
9ec6a948 | 705 | StdoutToAliDebug(1,fClusterStore->Print()); |
9bf6860b | 706 | } |
707 | ||
22899106 | 708 | if (ok) // at least one type of branches created successfully |
709 | { | |
710 | clustersTree.Fill(); | |
711 | } | |
9bf6860b | 712 | |
f73ad454 | 713 | if (fClusterStore) fClusterStore->Clear(); |
cac2eb58 | 714 | } |
cf464691 | 715 | |
cfeca9e2 | 716 | //_____________________________________________________________________________ |
717 | const AliMUONRecoParam* AliMUONReconstructor::GetRecoParam() | |
718 | { | |
719 | /// Get the recoparam from reconstruction | |
720 | return dynamic_cast<const AliMUONRecoParam*>(AliReconstructor::GetRecoParam(AliReconstruction::GetDetIndex("MUON"))); | |
721 | } | |
722 | ||
723 | ||
cf464691 | 724 | //_____________________________________________________________________________ |
22899106 | 725 | Bool_t |
726 | AliMUONReconstructor::HasDigitConversion() const | |
cf464691 | 727 | { |
22899106 | 728 | /// We *do* have digit conversion, but we might advertise it only |
729 | /// if we want to save the digits. | |
730 | ||
731 | TString opt(GetOption()); | |
732 | opt.ToUpper(); | |
733 | if ( opt.Contains("SAVEDIGITS" ) && !opt.Contains("NOLOCALRECONSTRUCTION") ) | |
734 | { | |
735 | return kTRUE; | |
736 | } | |
737 | else | |
738 | { | |
739 | return kFALSE; | |
740 | } | |
741 | } | |
f9247068 | 742 | |
22899106 | 743 | //_____________________________________________________________________________ |
744 | void | |
745 | AliMUONReconstructor::Reconstruct(AliRawReader* rawReader, TTree* clustersTree) const | |
746 | { | |
747 | /// This method is called by AliReconstruction if HasLocalReconstruction()==kTRUE AND | |
748 | /// HasDigitConversion()==kFALSE | |
8cde4af5 | 749 | |
22899106 | 750 | if ( !clustersTree ) |
751 | { | |
752 | AliError("clustersTree is 0x0 !"); | |
753 | return; | |
754 | } | |
b2d7df0b | 755 | |
93d7b017 | 756 | ConvertDigits(rawReader,DigitStore(),TriggerStore()); |
c5ce806f | 757 | |
758 | FillTreeR(TriggerStore(),*clustersTree); | |
22899106 | 759 | } |
64b056bc | 760 | |
196471e9 | 761 | //_____________________________________________________________________________ |
22899106 | 762 | void |
763 | AliMUONReconstructor::Reconstruct(TTree* digitsTree, TTree* clustersTree) const | |
a2da7817 | 764 | { |
22899106 | 765 | /// This method is called by AliReconstruction if HasLocalReconstruction()==kTRUE |
766 | /// AND HasDigitConversion()==kTRUE | |
767 | ||
99c136e1 | 768 | AliCodeTimerAuto("",0) |
93d7b017 | 769 | |
22899106 | 770 | AliDebug(1,""); |
771 | ||
772 | if (!digitsTree || !clustersTree) | |
773 | { | |
774 | AliError(Form("Tree is null : digitsTree=%p clustersTree=%p", | |
775 | digitsTree,clustersTree)); | |
776 | return; | |
777 | } | |
d19b6003 | 778 | |
22899106 | 779 | if (!fDigitStore) |
780 | { | |
781 | fDigitStore = AliMUONVDigitStore::Create(*digitsTree); | |
782 | if (!fDigitStore) | |
783 | { | |
784 | AliError(Form("Could not get DigitStore from %s",digitsTree->GetName())); | |
785 | } | |
786 | else | |
787 | { | |
788 | AliInfo(Form("Created %s from %s",fDigitStore->ClassName(),digitsTree->GetName())); | |
789 | } | |
790 | } | |
791 | if (!fTriggerStore) | |
792 | { | |
793 | fTriggerStore = AliMUONVTriggerStore::Create(*digitsTree); | |
794 | if (!fTriggerStore) | |
795 | { | |
796 | AliError(Form("Could not get TriggerStore from %s",digitsTree->GetName())); | |
797 | } | |
798 | else | |
799 | { | |
800 | AliInfo(Form("Created %s from %s",fTriggerStore->ClassName(),digitsTree->GetName())); | |
801 | } | |
802 | } | |
803 | ||
804 | if (!fTriggerStore && !fDigitStore) | |
805 | { | |
806 | AliError("No store at all. Nothing to do."); | |
807 | return; | |
808 | } | |
809 | ||
810 | // insure we start with empty stores | |
811 | if ( fDigitStore ) | |
812 | { | |
813 | fDigitStore->Clear(); | |
814 | Bool_t alone = ( fTriggerStore ? kFALSE : kTRUE ); | |
815 | Bool_t ok = fDigitStore->Connect(*digitsTree,alone); | |
816 | if (!ok) | |
817 | { | |
818 | AliError("Could not connect digitStore to digitsTree"); | |
819 | return; | |
820 | } | |
821 | } | |
822 | if ( fTriggerStore ) | |
823 | { | |
824 | fTriggerStore->Clear(); | |
825 | Bool_t alone = ( fDigitStore ? kFALSE : kTRUE ); | |
826 | Bool_t ok = fTriggerStore->Connect(*digitsTree,alone); | |
827 | if (!ok) | |
828 | { | |
829 | AliError("Could not connect triggerStore to digitsTree"); | |
830 | return; | |
831 | } | |
832 | } | |
833 | ||
834 | digitsTree->GetEvent(0); | |
835 | ||
836 | if ( fDigitStore ) | |
837 | { | |
e729a0c8 | 838 | // Insure we got calibrated digits (if we reconstruct from pure simulated, |
839 | // i.e. w/o going through raw data, this will be the case) | |
840 | TIter next(fDigitStore->CreateIterator()); | |
841 | AliMUONVDigit* digit = static_cast<AliMUONVDigit*>(next()); | |
ca4733b5 | 842 | if (digit && !digit->IsCalibrated()) |
e729a0c8 | 843 | { |
844 | Calibrate(*fDigitStore); | |
845 | } | |
22899106 | 846 | } |
847 | ||
c5ce806f | 848 | FillTreeR(fTriggerStore,*clustersTree); |
cac2eb58 | 849 | } |
196471e9 | 850 | |
851 | //_____________________________________________________________________________ | |
22899106 | 852 | AliMUONVTriggerStore* |
853 | AliMUONReconstructor::TriggerStore() const | |
196471e9 | 854 | { |
22899106 | 855 | /// Return (and create if necessary and allowed) the trigger container |
856 | TString sopt(GetOption()); | |
857 | sopt.ToUpper(); | |
858 | ||
859 | if (sopt.Contains("TRIGGERDISABLE")) | |
860 | { | |
861 | delete fTriggerStore; | |
862 | fTriggerStore = 0x0; | |
863 | } | |
864 | else | |
865 | { | |
866 | if (!fTriggerStore) | |
867 | { | |
868 | fTriggerStore = new AliMUONTriggerStoreV1; | |
869 | } | |
870 | } | |
871 | return fTriggerStore; | |
196471e9 | 872 | } |