LCOV - code coverage report
Current view: top level - FMD/FMDsim - AliFMDBaseDigitizer.h (source / functions) Hit Total Coverage
Test: coverage.info Lines: 2 14 14.3 %
Date: 2016-06-14 17:26:59 Functions: 3 11 27.3 %

          Line data    Source code
       1             : #ifndef ALIFMDBASEDIGITIZER_H
       2             : #define ALIFMDBASEDIGITIZER_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             : //    Summable digits consists of       
      18             : //    - Detector #
      19             : //    - Ring ID                                             
      20             : //    - Sector #     
      21             : //    - Strip #
      22             : //    - Total energy deposited in the strip
      23             : //    - ADC count in this channel                                  
      24             : //
      25             : /** @file    AliFMDBaseDigitizer.h
      26             :     @author  Christian Holm Christensen <cholm@nbi.dk>
      27             :     @date    Mon Mar 27 12:38:26 2006
      28             :     @brief   FMD Digitizers declaration
      29             :     @ingroup FMD_sim
      30             : */
      31             : #ifndef ALIDIGITIZER_H
      32             : # include <AliDigitizer.h>
      33             : #endif
      34             : #ifndef ALIRUNDIGITIZER_H
      35             : # include <AliDigitizationInput.h>
      36             : #endif
      37             : #ifndef ALIFMDEdepMAP_H
      38             : # include "AliFMDEdepMap.h"
      39             : #endif
      40             : //====================================================================
      41             : class TClonesArray;
      42             : class AliFMD;
      43             : class AliLoader;
      44             : class AliRunLoader;
      45             : class AliFMDDigit;
      46             : 
      47             : 
      48             : //====================================================================
      49             : /** @class AliFMDBaseDigitizer AliFMDDigitizer.h <FMD/AliFMDDigitizer>
      50             :     @brief Base class for digitizers.
      51             : 
      52             :     This class contains the procedures simulation ADC  signal for the
      53             :     Forward Multiplicity detector  : Hits->Digits and Hits->SDigits
      54             :     
      55             :     Digits consists of
      56             :     - Detector #
      57             :     - Ring ID                                             
      58             :     - Sector #     
      59             :     - Strip #
      60             :     - ADC count in this channel                                  
      61             : 
      62             :     Summable digits consists of 
      63             :     - Detector #
      64             :     - Ring ID                                             
      65             :     - Sector #     
      66             :     - Strip #
      67             :     - Total energy deposited in the strip
      68             :     - ADC count in this channel                                  
      69             : 
      70             :     As the Digits and SDigits have so much in common, the classes
      71             :     AliFMDDigitizer and AliFMDSDigitizer are implemented via a base
      72             :     class AliFMDBaseDigitizer.
      73             :     @verbatim
      74             :                     +---------------------+
      75             :                     | AliFMDBaseDigitizer |
      76             :                     +---------------------+
      77             :                               ^
      78             :                               |
      79             :                    +----------+---------+
      80             :                    |                    |
      81             :          +-----------------+     +------------------+
      82             :          | AliFMDDigitizer |    | AliFMDSDigitizer |
      83             :          +-----------------+    +------------------+
      84             :     @endverbatim
      85             :     These classes uses parameters fetched from the AliFMDParameters
      86             :     manager. 
      87             : 
      88             :     The shaping function of the VA1 is generally given by 
      89             :     @f[
      90             :     f(x) = A(1 - \exp(-Bx))
      91             :     @f]
      92             :     where A is the total charge collected in the pre-amp., and B is a
      93             :     paramter that depends on the shaping time of the VA1 circut.
      94             :     
      95             :     When simulating the shaping function of the VA1 pre-amp. chip, we
      96             :     have to take into account, that the shaping function depends on
      97             :     the previous value of read from the pre-amp.  
      98             : 
      99             :     That results in the following algorithm:
     100             :     @code
     101             :     last = 0;
     102             :     for (i=0; i < n_pre_amp_charge; i++) {
     103             :       charge = GetCharge(i);
     104             :       if (last < charge) 
     105             :         f(t) = (charge - last) * (1 - exp(-B * t)) + last
     106             :       else
     107             :         f(t) = (last - charge) * exp(-B * t) + charge)
     108             :       for (j=0; j < sample_rate; j++) 
     109             :         adc[j] = f(i / (# samples))
     110             :       last = charge
     111             :     }
     112             :     @endcode
     113             :     Here, the first loop is over all charges collected by the VA1
     114             :     chip, and the @c sample_rate is how many times the ALTRO ADC
     115             :     samples each of the 128  charges from the pre-amp. 
     116             : 
     117             :     The @c charge is the total charge @f$ Q@f$ collected by the VA1
     118             :     pre-amplifier for a strip.   @f$ Q@f$ is then given by 
     119             :     @f[
     120             :     Q = \frac{E}{e}\frac{S}{r}
     121             :     @f]
     122             :     where @f$ E@f$ is the total energy deposited in a silicon strip, 
     123             :     @f$ R@f$ is the dynamic range of the VA1 pre-amp, @f$ e@f$ is the 
     124             :     energy deposited by a single MIP, and @f$ S@f$ ALTRO channel size
     125             :     in each time step.
     126             : 
     127             :     The energy deposited per MIP is given by 
     128             :     @f$ 
     129             :     e = M \rho w 
     130             :     @f$
     131             :     where @f$ M@f$ is the universal number 
     132             :     @f$ 1.664 \mbox{keV}\mbox{cm}^{2}\mbox{g}^{-1}@f$, @f$ \rho@f$ is
     133             :     the density of silicon, and @f$ w@f$ is the depth of the silicon
     134             :     sensor.  
     135             : 
     136             :     The final ADC count is given by 
     137             :     @f[
     138             :     C' = C + P
     139             :     @f]
     140             :     where @f$ P@f$ is the (randomized) pedestal.
     141             : 
     142             :     This class uses the class template AliFMDEdepMap to make an
     143             :     internal cache of the energy deposted of the hits.  The class
     144             :     template is instantasized as 
     145             : 
     146             :     The first member of the values is the summed energy deposition in a
     147             :     given strip, while the second member of the values is the number of
     148             :     hits in a given strip.  Using the second member, it's possible to
     149             :     do some checks on just how many times a strip got hit, and what
     150             :     kind of error we get in our reconstructed hits.  Note, that this
     151             :     information is currently not written to the digits tree.  I think a
     152             :     QA (Quality Assurance) digit tree is better suited for that task.
     153             :     However, the information is there to be used in the future. 
     154             :     @ingroup FMD_sim
     155             :  */
     156             : class AliFMDBaseDigitizer : public AliDigitizer 
     157             : {
     158             : public:
     159             :   /** CTOR */
     160             :   AliFMDBaseDigitizer();
     161             :   /** Normal CTOR 
     162             :       @param manager Manager of digitization */
     163             :   AliFMDBaseDigitizer(AliDigitizationInput * digInp);
     164             :   /** Normal ctor 
     165             :       @param name Name 
     166             :       @param title Title */
     167             :   AliFMDBaseDigitizer(const Char_t* name, const Char_t* title);
     168             :   /** DTOR */
     169             :   virtual ~AliFMDBaseDigitizer();
     170             :    
     171             :   /** Initialize */
     172             :   virtual Bool_t Init();
     173             :   
     174             :   /** The response shape of the VA1 shaping circuit is approximently
     175             :       given by 
     176             :       @f[
     177             :       f(x) = A(1 - \exp(-Bx))
     178             :       @f]
     179             :       where @f$ A@f$ is the total charge collected by the pre-amp.,
     180             :       and @f$ B@f$ is parameter that depends on the shaping time of
     181             :       the @b VA1 pre-amp.  This member function sets the parameter @f$
     182             :       B@f$ 
     183             :       @param B */
     184           4 :   void     SetShapingTime(Float_t B=10) { fShapingTime = B;  }  
     185             :   /** @return Get the shaping time */
     186           0 :   Float_t  GetShapingTime()      const { return fShapingTime; }
     187             :   
     188           0 :   void SetStoreTrackRefs(Bool_t store=kTRUE) { fStoreTrackRefs = store; }
     189           0 :   Bool_t IsStoreTrackRefs() const { return fStoreTrackRefs; }
     190             :     
     191             : protected:
     192             :   /** For the stored energy contributions in the cache, convert the
     193             :       energy signal to ADC counts, and store the created digit in  
     194             :       the digits array
     195             :       @param fmd Pointer to detector */
     196             :   virtual void     DigitizeHits() const;
     197             :   /** Convert the total energy deposited to a (set of) ADC count(s).
     198             :       See also the class description for more details. 
     199             :       @param edep     Total energy deposited in detector
     200             :       @param last     Last charge collected in previous VA1 channnel
     201             :       @param detector Detector #
     202             :       @param ring     Ring ID
     203             :       @param sector   Sector #
     204             :       @param strip    Strip #
     205             :       @param counts   Array holding the counts on return */
     206             :   virtual void     ConvertToCount(Float_t   edep, 
     207             :                                   Float_t   last,
     208             :                                   UShort_t  detector, 
     209             :                                   Char_t    ring, 
     210             :                                   UShort_t  sector, 
     211             :                                   UShort_t  strip,
     212             :                                   TArrayI&  counts) const;
     213             :   /** Make a pedestal 
     214             :       @param detector Detector #
     215             :       @param ring     Ring ID
     216             :       @param sector   Sector #
     217             :       @param strip    Strip #
     218             :       @return Pedestal value */
     219             :   virtual UShort_t MakePedestal(UShort_t  detector, 
     220             :                                 Char_t    ring, 
     221             :                                 UShort_t  sector, 
     222             :                                 UShort_t  strip) const;
     223             :   /** Add noise to each sample */
     224           0 :   virtual void     AddNoise(TArrayI&) const {}
     225             : 
     226             :   /** Add edep contribution from (detector,ring,sector,strip) to cache */ 
     227             :   virtual void AddContribution(UShort_t detector, 
     228             :                                Char_t   ring, 
     229             :                                UShort_t sector, 
     230             :                                UShort_t strip, 
     231             :                                Float_t  edep, 
     232             :                                Bool_t   isPrimary,
     233             :                                Int_t    nTrackno,
     234             :                                Int_t*   tracknos);
     235             :   /** Add a digit to output */
     236             :   virtual void     AddDigit(UShort_t       detector, 
     237             :                             Char_t         ring,
     238             :                             UShort_t       sector, 
     239             :                             UShort_t       strip, 
     240             :                             Float_t        edep, 
     241             :                             UShort_t       count1, 
     242             :                             Short_t        count2, 
     243             :                             Short_t        count3,
     244             :                             Short_t        count4, 
     245             :                             UShort_t       ntot, 
     246             :                             UShort_t       nprim,
     247             :                             const TArrayI& refs) const;
     248             :   /** Make the output tree using the passed loader 
     249             :       @param loader 
     250             :       @return The generated tree. */
     251             :   virtual TTree* MakeOutputTree(AliLoader* loader);
     252             :   /** Store the data using the loader 
     253             :       @param loader The loader */
     254             :   virtual void StoreDigits(const AliLoader* loader);
     255             : 
     256             :   AliFMD*         fFMD;              // Detector object 
     257             :   AliRunLoader*   fRunLoader;        //! Run loader
     258             :   AliFMDEdepMap   fEdep;             // Cache of Energy from hits 
     259             :   Float_t         fShapingTime;      // Shaping profile parameter
     260             :   Bool_t          fStoreTrackRefs;   // Wether to store track references
     261             :   mutable Int_t   fIgnoredLabels;    //! Number of labels not assigned 
     262             :   
     263             :   /** Copy CTOR 
     264             :       @param o object to copy from  */
     265             :   AliFMDBaseDigitizer(const AliFMDBaseDigitizer& o) 
     266           0 :     : AliDigitizer(o),
     267           0 :       fFMD(o.fFMD),
     268           0 :       fRunLoader(0),
     269           0 :       fEdep(o.fEdep),
     270           0 :       fShapingTime(o.fShapingTime),
     271           0 :       fStoreTrackRefs(o.fStoreTrackRefs), 
     272           0 :       fIgnoredLabels(o.fIgnoredLabels)
     273           0 :   {}
     274             :   /** 
     275             :    * Assignment operator
     276             :    * 
     277             :    * @return Reference to this object 
     278             :    */
     279             :   AliFMDBaseDigitizer& operator=(const AliFMDBaseDigitizer& o);
     280             : 
     281          16 :   ClassDef(AliFMDBaseDigitizer,5) // Base class for FMD digitizers
     282             : };
     283             : 
     284             : 
     285             : #endif
     286             : //____________________________________________________________________
     287             : //
     288             : // Local Variables:
     289             : //   mode: C++
     290             : // End:
     291             : //
     292             : //
     293             : // EOF
     294             : //
     295             : 

Generated by: LCOV version 1.11