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