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