]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONMCDataInterface.h
Generation of generic AOD by the test script of MUON
[u/mrichter/AliRoot.git] / MUON / AliMUONMCDataInterface.h
1 #ifndef ALIMUONMCDATAINTERFACE_H
2 #define ALIMUONMCDATAINTERFACE_H
3
4 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5 * See cxx source for full Copyright notice                               */
6
7 // $Id$
8
9 /// \ingroup sim
10 /// \class AliMUONMCDataInterface
11 /// \brief Easy to use data access to MC information
12 /// 
13 // Author Laurent Aphecetche
14 //
15 // Moved parts of old AliMUONDataInterface interface to AliMUONMCDataInterface
16 //  Artur Szostak <artursz@iafrica.com> (University of Cape Town)
17
18 #ifndef ROOT_TObject
19 #  include "TObject.h"
20 #endif
21
22 class AliMUONVStore;
23 class AliMUONVHitStore;
24 class AliMUONVDigitStore;
25 class AliMUONVTriggerStore;
26 class AliMUONHit;
27 class AliMUONVDigit;
28 class AliMUONLocalTrigger;
29 class AliMUONRegionalTrigger;
30 class AliMUONGlobalTrigger;
31
32 class AliLoader;
33 class AliStack;
34
35 class TIterator;
36 class TClonesArray;
37 class TParticle;
38
39 class AliMUONMCDataInterface : public TObject
40 {
41 public:
42   AliMUONMCDataInterface(const char* filename="galice.root");
43   virtual ~AliMUONMCDataInterface();
44
45   void Open(const char* filename);
46   
47   /// Returns true if the data interface was able to open the root file correctly.
48   Bool_t IsValid() const { return fIsValid; };
49
50   Int_t NumberOfEvents() const;
51   /// Returns the index number of the current event as used int GetEvent(Int_t).
52   Int_t   CurrentEvent() const { return fCurrentEvent; }
53
54   Int_t NumberOfTracks(Int_t event);
55   Int_t NumberOfTrackRefs(Int_t event);
56   
57   AliMUONVHitStore* HitStore(Int_t event, Int_t track);
58   AliMUONVDigitStore* SDigitStore(Int_t event);
59   AliMUONVDigitStore* DigitStore(Int_t event);
60   AliStack* Stack(Int_t event);
61   TClonesArray* TrackRefs(Int_t event, Int_t track);
62   AliMUONVTriggerStore* TriggerStore(Int_t event);
63   
64   void DumpDigits(Int_t event, Bool_t sorted=kTRUE);
65   void DumpSDigits(Int_t event, Bool_t sorted=kTRUE);
66   void DumpHits(Int_t event);
67   void DumpKine(Int_t event);
68   void DumpTrackRefs(Int_t event);
69   void DumpTrigger(Int_t event);
70   
71   Bool_t GetEvent(Int_t event = 0);
72   
73   // Note the following methods can be extremely slow. Remember they are only
74   // here for end user convenience for his/her small tests and macros.
75   // If you want speed then don't use these methods. If you really want peak
76   // performance then you should be talking to the AliRunLoader and Store
77   // objects directly.
78   Int_t NumberOfParticles();
79   TParticle* Particle(Int_t index);
80   Int_t NumberOfTracks();
81   Int_t NumberOfHits(Int_t track);
82   AliMUONHit* Hit(Int_t track, Int_t index);
83   Int_t NumberOfSDigits(Int_t detElemId);
84   AliMUONVDigit* SDigit(Int_t detElemId, Int_t index);
85   Int_t NumberOfSDigits(Int_t chamber, Int_t cathode);
86   AliMUONVDigit* SDigit(Int_t chamber, Int_t cathode, Int_t index);
87   Int_t NumberOfDigits(Int_t detElemId);
88   AliMUONVDigit* Digit(Int_t detElemId, Int_t index);
89   Int_t NumberOfDigits(Int_t chamber, Int_t cathode);
90   AliMUONVDigit* Digit(Int_t chamber, Int_t cathode, Int_t index);
91   Int_t NumberOfLocalTriggers();
92   AliMUONLocalTrigger* LocalTrigger(Int_t index);
93   Int_t NumberOfRegionalTriggers();
94   AliMUONRegionalTrigger* RegionalTrigger(Int_t index);
95   AliMUONGlobalTrigger* GlobalTrigger();
96   Int_t NumberOfTrackRefs();
97   TClonesArray* TrackRefs(Int_t track);
98   
99 private:
100
101   enum IteratorType
102   {
103     kNoIterator,
104     kHitIterator,
105     kSDigitIteratorByDetectorElement,
106     kSDigitIteratorByChamberAndCathode,
107     kDigitIteratorByDetectorElement,
108     kDigitIteratorByChamberAndCathode,
109     kLocalTriggerIterator,
110     kRegionalTriggerIterator
111   };
112   
113   /// Not implemented
114   AliMUONMCDataInterface(const AliMUONMCDataInterface&);
115   /// Not implemented
116   AliMUONMCDataInterface& operator=(const AliMUONMCDataInterface&);
117
118   void DumpSorted(const AliMUONVStore& store) const;
119   Bool_t LoadEvent(Int_t event);
120   
121   void ResetStores();
122   
123   TIterator* GetIterator(IteratorType type, Int_t x = 0, Int_t y = 0);
124   void ResetIterator();
125   
126   Int_t CountObjects(TIterator* iter);
127   TObject* FetchObject(TIterator* iter, Int_t index);
128   
129   
130   AliLoader* fLoader; //!< Tree accessor
131   AliMUONVHitStore* fHitStore; //!< current hit store (owner)
132   AliMUONVDigitStore* fSDigitStore; //!< current sdigit store (owner)
133   AliMUONVDigitStore* fDigitStore; //!< current digit store (owner)
134   AliMUONVTriggerStore* fTriggerStore; //!< current trigger store (owner)
135   TClonesArray* fTrackRefs; //!< current trackrefs (owner)
136   Int_t fCurrentEvent; //!< Current event we've read in
137   Bool_t fIsValid; //!< whether we were initialized properly or not
138   
139   IteratorType fCurrentIteratorType;  //!< The type of iterator that is currently set.
140   Int_t fCurrentIndex;  //!< A current index number maintained for certain iteration operations.
141   Int_t fDataX; //!< Extra data parameter about the iterator, can be the chamber number, detector element or track number.
142   Int_t fDataY; //!< Extra data parameter about the iterator, can be the cathode number.
143   TIterator* fIterator; //!< Iterator for various iteration operations.
144   
145   static Int_t fgInstanceCounter; //!< To build unique folder name for each instance
146
147   ClassDef(AliMUONMCDataInterface,0) // Easy to use MC data accessor
148 };
149
150 #endif