]> git.uio.no Git - u/mrichter/AliRoot.git/blob - FMD/AliFMDHitDigitizer.h
Various fixes
[u/mrichter/AliRoot.git] / FMD / AliFMDHitDigitizer.h
1 #ifndef ALIFMDHITDIGITIZER_H
2 #define ALIFMDHITDIGITIZER_H
3 /* Copyright(c) 1998-2000, ALICE Experiment at CERN, All rights
4  * reserved. 
5  *
6  * See cxx source for full Copyright notice                               
7  */
8 // Classses to make Hits into digits and summable digits
9 //    
10 //    Digits consists of
11 //    - Detector #
12 //    - Ring ID                                             
13 //    - Sector #     
14 //    - Strip #
15 //    - ADC count in this channel
16 //
17 /** @file    AliFMDHitDigitizer.h
18     @author  Christian Holm Christensen <cholm@nbi.dk>
19     @date    Mon Mar 27 12:38:26 2006
20     @brief   FMD Digitizers declaration
21     @ingroup FMD_sim
22 */
23 #ifndef ALIFMDBASEDIGITIZER_H
24 # include <AliFMDBaseDigitizer.h>
25 #endif
26
27 //====================================================================
28 class TClonesArray;
29 class AliFMD;
30 class AliLoader;
31 class AliRunLoader;
32 class AliFMDDigit;
33 class AliStack;
34
35
36
37 //====================================================================
38 /** @class AliFMDHitDigitizer
39     @brief Concrete digitizer to make digits from hits.  See also
40     AliFMDBaseDigitizer documentation.  
41     @ingroup FMD_sim
42  */
43 class AliFMDHitDigitizer : public AliFMDBaseDigitizer
44 {
45 public:
46   enum Output_t { 
47     kDigits, 
48     kSDigits
49   };
50     
51   /** CTOR */
52   AliFMDHitDigitizer() 
53     : AliFMDBaseDigitizer(), 
54       fOutput(kDigits), 
55       fHoldTime(2e-6),
56       fStack(0)
57   {}
58   /** CTOR 
59       @param name Name */
60   AliFMDHitDigitizer(AliFMD* fmd, Output_t  output);
61   /** DTOR */
62   virtual ~AliFMDHitDigitizer() {}
63   /** Run over the input events (retrieved via run loader) */
64   void Exec(Option_t* option="");
65   /** 
66    * Set the end of integration
67    * 
68    * @param holdT Time when integration ends (nominally @f$
69    *        2\mu{}s@f$) 
70    */
71   void SetHoldTime(Double_t holdT=2e-6) { fHoldTime = holdT; }
72   Double_t GetHoldTime() const { return fHoldTime; }
73 protected:
74   /** Copy constructor 
75       @param o Object to copy from */
76   AliFMDHitDigitizer(const AliFMDHitDigitizer& o) 
77     : AliFMDBaseDigitizer(o),
78       fOutput(o.fOutput), 
79       fHoldTime(2e-6),
80       fStack(o.fStack)
81   {}
82   /** Assignment operator
83       @param o Object to assign from 
84       @return Reference to this */
85   AliFMDHitDigitizer& operator=(const AliFMDHitDigitizer& o) 
86   {
87     AliFMDBaseDigitizer::operator=(o);
88     fHoldTime    = o.fHoldTime;
89     fOutput      = o.fOutput;
90     fStack       = o.fStack;
91     return *this;
92   }
93   /** Make the output tree using the passed loader 
94       @param loader 
95       @return The generated tree. */
96   TTree* MakeOutputTree(AliLoader* loader);
97   /** Sum energy deposited contributions from each hit in a cache
98       @param hitsBranch Branch in input tree */
99   void SumContributions(TBranch* hitsBranch);
100   /** Make a pedestal 
101       @param detector Detector #
102       @param ring     Ring ID
103       @param sector   Sector #
104       @param strip    Strip #
105       @return Pedestal value */
106   UShort_t MakePedestal(UShort_t  detector, 
107                         Char_t    ring, 
108                         UShort_t  sector, 
109                         UShort_t  strip) const;
110   /** Add a digit to output.
111       @param fmd      Pointer to detector object
112       @param detector Detector #
113       @param ring     Ring ID
114       @param sector   Sector number
115       @param strip    Strip number
116       @param edep     Energy deposited (not used)
117       @param count1   ADC count 1
118       @param count2   ADC count 2 (-1 if not used)
119       @param count3   ADC count 3 (-1 if not used) 
120       @param count4   ADC count 4 (-1 if not used) */
121   void AddDigit(UShort_t       detector, 
122                 Char_t         ring,
123                 UShort_t       sector, 
124                 UShort_t       strip, 
125                 Float_t        edep, 
126                 UShort_t       count1, 
127                 Short_t        count2, 
128                 Short_t        count3,
129                 Short_t        count4, 
130                 UShort_t       ntot, 
131                 UShort_t       nprim,
132                 const TArrayI& trackrefs) const;
133   /** Check that digit data is consistent
134       @param digit   Digit
135       @param nhits   Number of hits
136       @param counts  ADC counts */
137   void CheckDigit(AliFMDDigit*    digit,
138                   UShort_t        nhits,
139                   const TArrayI&  counts);
140   /** Store the data using the loader 
141       @param loader The loader */
142   void StoreDigits(AliLoader* loader);
143   
144
145   Output_t      fOutput;           // Output mode
146   Double_t      fHoldTime;         // Stop of integration
147   AliStack*     fStack;            // Kinematics
148
149   ClassDef(AliFMDHitDigitizer,1) // Make Digits from Hits
150 };
151
152
153 #endif
154 //____________________________________________________________________
155 //
156 // Local Variables:
157 //   mode: C++
158 // End:
159 //
160 //
161 // EOF
162 //
163