LCOV - code coverage report
Current view: top level - FMD/FMDbase - AliFMDParameters.h (source / functions) Hit Total Coverage
Test: coverage.info Lines: 18 42 42.9 %
Date: 2016-06-14 17:26:59 Functions: 17 46 37.0 %

          Line data    Source code
       1             : #ifndef ALIFMDPARAMETERS_H
       2             : #define ALIFMDPARAMETERS_H
       3             : /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights
       4             :  * reserved. 
       5             :  *
       6             :  * Latest changes by Christian Holm Christensen <cholm@nbi.dk>
       7             :  *
       8             :  * See cxx source for full Copyright notice                               
       9             :  */
      10             : //____________________________________________________________________
      11             : //
      12             : //  Singleton class to handle various parameters (not geometry) of the
      13             : //  FMD
      14             : //  Should get ata fromm Conditions DB.
      15             : //
      16             : /** @file    AliFMDParameters.h
      17             :     @author  Christian Holm Christensen <cholm@nbi.dk>
      18             :     @date    Mon Mar 27 12:44:43 2006
      19             :     @brief   Manager of FMD parameters
      20             : */
      21             : #ifndef ROOT_TNamed
      22             : # include <TNamed.h>
      23             : #endif
      24             : #ifndef ROOT_TArrayI
      25             : # include <TArrayI.h>
      26             : #endif
      27             : #include "AliFMDCalibFwd.h"
      28             : class AliCDBEntry;
      29             : class AliFMDPreprocessor;
      30             : 
      31             : //____________________________________________________________________
      32             : //
      33             : //  Singleton class to handle various parameters (not geometry) of the
      34             : //  FMD
      35             : //  Should get ata fromm Conditions DB.
      36             : //
      37             : 
      38             : /** @brief This class is a singleton that handles various parameters
      39             :     of the FMD detectors.  
      40             :     This class reads from the Conditions DB to get the various
      41             :     parameters, which code can then request from here. In that way,
      42             :     all code uses the same data, and the interface is consistent.
      43             :      
      44             :     Some of the parameter managed are 
      45             :     - @c fPedestal, @c fPedestalWidth
      46             :       Mean and width of the pedestal.  The pedestal is simulated
      47             :       by a Guassian, but derived classes my override MakePedestal
      48             :       to simulate it differently (or pick it up from a database).
      49             :     - @c fVA1MipRange
      50             :       The dymamic MIP range of the VA1_ALICE pre-amplifier chip 
      51             :     - @c fAltroChannelSize
      52             :       The largest number plus one that can be stored in one
      53             :       channel in one time step in the ALTRO ADC chip. 
      54             :     - @c fSampleRate
      55             :       How many times the ALTRO ADC chip samples the VA1_ALICE
      56             :       pre-amplifier signal.   The VA1_ALICE chip is read-out at
      57             :       10MHz, while it's possible to drive the ALTRO chip at
      58             :       25MHz.  That means, that the ALTRO chip can have time to
      59             :       sample each VA1_ALICE signal up to 2 times.  Although it's
      60             :       not certain this feature will be used in the production,
      61             :       we'd like have the option, and so it should be reflected in
      62             :       the code.
      63             : 
      64             :     @ingroup FMD_base
      65             : */
      66             : class AliFMDParameters : public TNamed
      67             : {
      68             : public:
      69             :   /** Enumeration of things to initialize */ 
      70             :   enum What { 
      71             :     /** Pulser gain */ 
      72             :     kPulseGain = 0x1, // Pulser gain 
      73             :     /** Pedestals and noise */ 
      74             :     kPedestal = 0x2, // Pedestal and noise 
      75             :     /** Dead channel map */ 
      76             :     kDeadMap = 0x4, // Dead channel map
      77             :     /**  Over sampling rate */ 
      78             :     kSampleRate = 0x8, // Over sampling rate 
      79             :     /** Zero suppression parameters */ 
      80             :     kZeroSuppression = 0x10, // Zero suppression parameters 
      81             :     /** ALTRO data map */ 
      82             :     kAltroMap = 0x20, // Altro channel map
      83             :     /** Strip Range */
      84             :     kStripRange = 0x40 //Strip range, 
      85             :   };
      86             :   enum { 
      87             :     kAll = (kPulseGain|kPedestal|kDeadMap|kSampleRate|
      88             :             kZeroSuppression|kAltroMap|kStripRange)
      89             :   };
      90             :     
      91             :   /** 
      92             :    * Singleton access
      93             :    * 
      94             :    * 
      95             :    * @return singleton
      96             :    */
      97             :   static AliFMDParameters* Instance();
      98             : 
      99             :   /** 
     100             :    * Initialize the manager.  This tries to read the parameters from
     101             :    * CDB.  If that fails, the class uses the hard-coded parameters.
     102             :    *
     103             :    * @param forceReInit Force (re-)initalize flag
     104             :    * @param what        What to initialize 
     105             :    *
     106             :    * @return 0 on success, bit mask of failed elements otherwise
     107             :    */
     108             :   UShort_t Init(Bool_t forceReInit=kFALSE, UInt_t what=kAll );
     109             :   /** 
     110             :    * Initialize the manager.  This tries to read the parameters from
     111             :    * CDB.  If that fails, the class uses the hard-coded parameters.
     112             :    * 
     113             :    * @param pp          Preprocessor 
     114             :    * @param forceReInit Force (re-)initalize flag
     115             :    * @param what        What to initialize 
     116             :    *
     117             :    * @return 0 on success, bit mask of failed elements otherwise
     118             :    */
     119             :   UShort_t Init(AliFMDPreprocessor* pp, 
     120             :             Bool_t              forceReInit=kFALSE, 
     121             :             UInt_t              what=kAll);
     122             :   /** 
     123             :    * Initialize the manager.  This will try to read some calibrations
     124             :    * (sample rate, strip range, gains, pedestals) from local comma
     125             :    * separated value (CSV) files in the directory pointed at by @a
     126             :    * path.  If they are not found, then they will be retrieved from
     127             :    * OCDB as appropriately.   Other calibrations are always read from
     128             :    * OCDB.  
     129             :    * 
     130             :    * The CSV files should be named as 
     131             :    * 
     132             :    * - Pedestals: <tt>peds</tt><i>det_number</i><tt>.csv</tt>
     133             :    * - Gains: <tt>gains</tt><i>det_number</i><tt>.csv</tt>
     134             :    * - Sample Rate: <tt>conditions</tt><i>det_number</i><tt>.csv</tt>
     135             :    * - Strip Range: <tt>conditions</tt><i>det_number</i><tt>.csv</tt>
     136             :    *
     137             :    * where <i>det_number</i> is the detector number (1, 2, or 3). 
     138             :    *
     139             :    * @param path        Where to look for the CSV files
     140             :    * @param forceReInit Always reinitialise 
     141             :    * @param what        What calibrations to load. 
     142             :    *
     143             :    * @return 0 on success, bit mask of failed elements otherwise
     144             :    */  
     145             :   UShort_t Init(const char* path, 
     146             :                 Bool_t      forceReInit=kFALSE, 
     147             :                 UInt_t      what=kAll);
     148             :   
     149             :   /** 
     150             :    * Automatically generate a dead map from the pedestals and gains.
     151             :    * A channel is marked as dead of the noise is too high (currently
     152             :    * more than 10 ADC counts), or the gain is unreasonable (currently
     153             :    * larger than 10, or smaller than 0.1). 
     154             :    * 
     155             :    * The procedure does not overwrite channels previously marked as
     156             :    * dead - e.g., channels marked as dead in the calibration loaded
     157             :    * from OCDB will continue to be marked as dead.  That is, this
     158             :    * procedure will never make a channel un-dead. 
     159             :    *
     160             :    * @param maxNoise  Maximum noise value before a channel is marked
     161             :    * as dead. 
     162             :    * @param minGain   Minimum value of the calibrated gain before a
     163             :    * channel is considered dead. 
     164             :    * @param maxGain   Maximum value of the calibrated gain before a
     165             :    * channel is considered dead. 
     166             :    */
     167             :   void MakeDeadMap(Float_t maxNoise=10, Float_t minGain=.1, Float_t maxGain=10);
     168             :   /** 
     169             :    * Print all parameters. 
     170             :    *
     171             :    * If option contains an 'A' then everything is printed. 
     172             :    *
     173             :    * If the option contains the string "FMD" the function will search 
     174             :    * for detector, ring, sector, and strip numbers to print, in 
     175             :    * format 
     176             :    *
     177             :    * @verbatim 
     178             :    *    FMD<detector><ring>[<sector>,<string>] 
     179             :    * @endverbatim 
     180             :    *
     181             :    * The wild card '*' means all of <detector>, <ring>, <sector>, or 
     182             :    * <strip>. 
     183             :    *
     184             :    * @param option Option string 
     185             :    */
     186             :   void Print(Option_t* option="A") const;
     187             :   /** 
     188             :    * Draw parameters. 
     189             :    *
     190             :    * @param option What to draw. Should be one of 
     191             :    * - dead       Dead channels
     192             :    * - threshold Threshold
     193             :    * - gain       Gain
     194             :    * - pedestal  Pedestal
     195             :    * - noise      Noise (or pedestal width)
     196             :    * - zero       Zero suppression
     197             :    * - rate       Sampling rate (VA1 clock / ALTRO clock)
     198             :    * - min        Minimum strip read out
     199             :    * - max        Maximum strip read out
     200             :    * - map        hardware address
     201             :    */
     202             :   void Draw(Option_t* option="pedestal");
     203             :   
     204             :   /** @{ */
     205             :   /** @name Set various `Fixed' parameters */
     206             :   /** 
     207             :    * @param r How many MIP signals we can fit in the VA1
     208             :    * pre-amps. (default and design is 20) 
     209             :    */
     210           6 :   void SetVA1MipRange(UShort_t r=20)          { fVA1MipRange = r; }
     211             :   /** 
     212             :    * @param s Maximum number of the ADC (ALTRO).  This is a 10 bit
     213             :    * ADC so, the maximum number is 1024 
     214             :    */
     215           6 :   void SetAltroChannelSize(UShort_t s=1024)   { fAltroChannelSize = s;}
     216             :   /** 
     217             :    * @param size The number of strips multiplexed into one ALTRO
     218             :    * channel. That is, how many strips is connected to one VA1
     219             :    * pre-amp. 
     220             :    */
     221           6 :   void SetChannelsPerAltro(UShort_t size=128) { fChannelsPerAltro = size; }
     222             :   /** 
     223             :    * @param f Factor to use for accepting a signal. 
     224             :    */
     225           6 :   void SetPedestalFactor(Float_t f=3)         { fPedestalFactor = f; }
     226             :   /** 
     227             :    * @param n Number of pre-samples to keep during zero-suppression -
     228             :    * only used in simulation. 
     229             :    */
     230           0 :   void SetZSPreSamples(UShort_t n=1) { fZSPre = (n & 0x3); }
     231             :   /** 
     232             :    * @param n Number of post-samples to keep during zero-suppression -
     233             :    * only used in simulation. 
     234             :    */
     235           0 :   void SetZSPostSamples(UShort_t n=1) { fZSPost = (n & 0x3); }
     236             :   /** 
     237             :    * @param use If true, do pedestal subtraction before zero
     238             :    * suppression - only used in simulation 
     239             :    */
     240           0 :   void SetZSPedSubtract(Bool_t use=kTRUE) { fZSPedSubtract = use; }
     241             :   /** @} */
     242             : 
     243             :   /** @{ */
     244             :   /** @name Set various variable parameter defaults */
     245             :   /** 
     246             :    * @param s Zero suppression threshold in ADC counts 
     247             :    */
     248           6 :   void SetZeroSuppression(UShort_t s=1)       { fFixedZeroSuppression = s; }
     249             :   /** 
     250             :    * @param r How many times we oversample each strip. 
     251             :    */
     252           6 :   void SetSampleRate(UShort_t r=2)            { fFixedSampleRate = r ;}//(r>2?2:r);}
     253             :   /** 
     254             :    * @param r How many times we oversample each strip. 
     255             :    */
     256           0 :   void SetSampleRate(AliFMDCalibSampleRate* r) { fSampleRate = r; }
     257             :   /** 
     258             :    * @param p Pedestal value in ADC counts 
     259             :    */
     260           6 :   void SetPedestal(Float_t p=100)              { fFixedPedestal = p; }
     261             :   /** 
     262             :    * @param p Pedestal map 
     263             :    */
     264           0 :   void SetPedestal(AliFMDCalibPedestal* p) { fPedestal = p; }
     265             :   /** 
     266             :    * @param w Pedestal width in ADC counts 
     267             :    */
     268           6 :   void SetPedestalWidth(Float_t w=2)          { fFixedPedestalWidth = w; }
     269             :   /** 
     270             :    * @param t Threshold used for 1 MIP acceptance. 
     271             :    */
     272           6 :   void SetThreshold(Float_t t=0)              { fFixedThreshold = t; }
     273             :   /** 
     274             :    * Range of strips read out 
     275             :    *
     276             :    * @param min Minimum strip number (0-127). 
     277             :    * @param max Maximum strip number (0-127). 
     278             :    */
     279             :   void SetStripRange(UShort_t min=0, UShort_t max=127);
     280             :   /** 
     281             :    * set the strip range from object
     282             :    * 
     283             :    * @param r Strip range object 
     284             :    */
     285           0 :   void SetStripRange(AliFMDCalibStripRange* r) { fStripRange = r; }
     286             :   /** 
     287             :    * Whether raw data has full common data header (8 32bit words) or
     288             :    * the older invalid format (7 32bit words with bogus entries)
     289             :    *
     290             :    * @param yes if true the raw data has complete data header 
     291             :    */ 
     292           0 :   void UseCompleteHeader(Bool_t yes=kTRUE) { fHasCompleteHeader = yes; } 
     293             :   /** 
     294             :    * @param g Gain map 
     295             :    */
     296           0 :   void SetGain(AliFMDCalibGain* g) { fPulseGain = g; }
     297             :   /** 
     298             :    * @param g Gain map 
     299             :    */
     300           6 :   void SetGain(Float_t g=2) { fFixedPulseGain = g; }
     301             :   /** @} */
     302             : 
     303             :   /** @{ */
     304             :   /** @name Get `Fixed' various parameters */
     305             :   /** 
     306             :    * @return Number of MIP signals that fit inside a VA1 channel  
     307             :    */
     308           0 :   UShort_t GetVA1MipRange()          const { return fVA1MipRange; }
     309             :   /** 
     310             :    * @return The maximum count in the ADC 
     311             :    */
     312      819200 :   UShort_t GetAltroChannelSize()     const { return fAltroChannelSize; }
     313             :   /** 
     314             :    * @return Number of strips muliplexed into one ADC channel 
     315             :    */
     316          24 :   UShort_t GetChannelsPerAltro()     const { return fChannelsPerAltro; }
     317             :   /** 
     318             :    * @return The average energy deposited by one MIP 
     319             :    */
     320             :   Float_t  GetEdepMip()              const;
     321             :   /** 
     322             :    * This is the conversion from Digital-to-Analog-Converter setting
     323             :    * to the number of MIPs. The number was measured in the NBI lab during
     324             :    * August 2008.
     325             :    *
     326             :    * @return The conversion factor from DAC to ADC 
     327             :    */
     328             :   Float_t  GetDACPerMIP()              const;
     329             :   /** 
     330             :    * @return The factor used of signal acceptance 
     331             :    */
     332      409600 :   Float_t  GetPedestalFactor()       const { return fPedestalFactor; }
     333             :   /** 
     334             :    * @param n Number of pre-samples to keep during zero-suppression -
     335             :    * only used in simulation. 
     336             :    */
     337           0 :   UShort_t GetZSPreSamples() const { return fZSPre; }
     338             :   /** 
     339             :    * @param n Number of post-samples to keep during zero-suppression -
     340             :    * only used in simulation. 
     341             :    */
     342           0 :   UShort_t GetZSPostSamples() const { return fZSPost; }
     343             :   /**
     344             :    * @param use If true, do pedestal subtraction before zero
     345             :    * suppression - only used in simulation 
     346             :    */
     347           0 :   Bool_t IsZSPedSubtract() const { return fZSPedSubtract; }
     348             :   /** @} */
     349             :   
     350             :   /** @{ */
     351             :   /** @name Various varible conditions */
     352             :   /** 
     353             :    * Whether the strip is considered dead
     354             :    * 
     355             :    * @param detector Detector # (1-3)
     356             :    * @param ring     Ring ID ('I' or 'O')
     357             :    * @param sector   Sector number (0-39)
     358             :    * @param strip    Strip number (0-511)
     359             :    *
     360             :    * @return @c true if the strip is considered dead, @c false if it's
     361             :    * OK.
     362             :    */
     363             :   Bool_t   IsDead(UShort_t detector, 
     364             :                   Char_t ring, 
     365             :                   UShort_t sector, 
     366             :                   UShort_t strip) const;
     367             :   /** 
     368             :    * Get the threshold in the pulser gain 
     369             :    * 
     370             :    * 
     371             :    * @return Threshold from pulser 
     372             :    */
     373             :   Float_t  GetThreshold() const;
     374             :   /** 
     375             :    * Gain of pre-amp. for strip, sector, ring, detector 
     376             :    *
     377             :    * For simulations this is normally set to 
     378             :    *
     379             :    * @f[ 
     380             :    *  \frac{\mbox{VA1_MIP_Range}{\mbox{ALTRO_channel_size}}\mbox{MIP_Energy_Loss}
     381             :    * @f]
     382             :    * 
     383             :    *  
     384             :    * @param detector Detector # (1-3)
     385             :    * @param ring     Ring ID ('I' or 'O')
     386             :    * @param sector   Sector number (0-39)
     387             :    * @param strip    Strip number (0-511)
     388             :    *
     389             :    * @return Gain of pre-amp.  
     390             :    */
     391             :   Float_t  GetPulseGain(UShort_t detector, 
     392             :                         Char_t ring, 
     393             :                         UShort_t sector, 
     394             :                         UShort_t strip) const;
     395             :   /** 
     396             :    * Get mean of pedestal
     397             :    *
     398             :    * @param detector Detector # (1-3)
     399             :    * @param ring     Ring ID ('I' or 'O')
     400             :    * @param sector   Sector number (0-39)
     401             :    * @param strip    Strip number (0-511)
     402             :    *
     403             :    * @return Mean of pedestal 
     404             :    */
     405             :   Float_t  GetPedestal(UShort_t detector, 
     406             :                        Char_t ring, 
     407             :                        UShort_t sector, 
     408             :                        UShort_t strip) const;
     409             :   /** 
     410             :    * Width of pedestal
     411             :    *
     412             :    * @param detector Detector # (1-3)
     413             :    * @param ring     Ring ID ('I' or 'O')
     414             :    * @param sector   Sector number (0-39)
     415             :    * @param strip    Strip number (0-511)
     416             :    *
     417             :    * @return Width of pedestal 
     418             :    */
     419             :   Float_t  GetPedestalWidth(UShort_t detector, 
     420             :                             Char_t ring, 
     421             :                             UShort_t sector, 
     422             :                             UShort_t strip) const;
     423             :   /** 
     424             :    * zero suppression threshold (in ADC counts)
     425             :    *
     426             :    * @param detector Detector # (1-3)
     427             :    * @param ring     Ring ID ('I' or 'O')
     428             :    * @param sector   Sector number (0-39)
     429             :    * @param strip    Strip number (0-511)
     430             :    *
     431             :    * @return zero suppression threshold (in ADC counts) 
     432             :    */
     433             :   UShort_t GetZeroSuppression(UShort_t detector, 
     434             :                               Char_t ring, 
     435             :                               UShort_t sector, 
     436             :                               UShort_t strip) const;
     437             :   /** 
     438             :    * Get the sampling rate
     439             :    *
     440             :    * @param detector Detector # (1-3)
     441             :    * @param ring     Ring ID ('I' or 'O')
     442             :    * @param sector   Sector number (0-39)
     443             :    * @param strip    Strip number (0-511)
     444             :    *
     445             :    * @return The sampling rate 
     446             :    */
     447             :   UShort_t GetSampleRate(UShort_t detector, 
     448             :                          Char_t ring, 
     449             :                          UShort_t sector, 
     450             :                          UShort_t strip) const;
     451             :   /** 
     452             :    * Get the minimum strip in the read-out range
     453             :    *
     454             :    * @param detector Detector # (1-3)
     455             :    * @param ring     Ring ID ('I' or 'O')
     456             :    * @param sector   Sector number (0-39)
     457             :    * @param strip    Strip number (0-511)
     458             :    *
     459             :    * @return Minimum strip 
     460             :    */
     461             :   UShort_t GetMinStrip(UShort_t detector, 
     462             :                        Char_t ring, 
     463             :                        UShort_t sector, 
     464             :                        UShort_t strip) const;
     465             :   /** 
     466             :    * Get the maximum strip in the read-out range
     467             :    *
     468             :    * @param detector Detector # (1-3)
     469             :    * @param ring     Ring ID ('I' or 'O')
     470             :    * @param sector   Sector number (0-39)
     471             :    * @param strip    Strip number (0-511)
     472             :    *
     473             :    * @return Maximum strip 
     474             :    */
     475             :   UShort_t GetMaxStrip(UShort_t detector, 
     476             :                        Char_t ring, 
     477             :                        UShort_t sector, 
     478             :                        UShort_t strip) const;
     479             :   /** 
     480             :    * Get the number of pre-samples in ALTRO channels
     481             :    *
     482             :    * @param detector Detector # (1-3)
     483             :    * @param ring     Ring ID ('I' or 'O')
     484             :    * @param sector   Sector number (0-39)
     485             :    * @param strip    Strip number (0-511)
     486             :    *
     487             :    * @return Maximum strip 
     488             :    */
     489             :   UShort_t GetPreSamples(UShort_t, 
     490             :                          Char_t, 
     491             :                          UShort_t, 
     492     2051200 :                          UShort_t) const { return 14+5; }
     493             :   /* @}*/
     494             :   
     495             :   /** 
     496             :    * @{ 
     497             :    * @name Hardware to detector translation (and inverse) 
     498             :    */
     499             :   /** 
     500             :    * Map a hardware address into a detector index. 
     501             :    *
     502             :    * @param ddl        Hardware DDL number 
     503             :    * @param board      FEC number
     504             :    * @param altro      ALTRO number 
     505             :    * @param channel    Channel number 
     506             :    * @param timebin    Timebin 
     507             :    * @param det        On return, the detector #
     508             :    * @param ring       On return, the ring ID
     509             :    * @param sec        On return, the sector #
     510             :    * @param str        On return, the base of strip #
     511             :    * @param sam        On return, the sample number for this strip
     512             :    *
     513             :    * @return @c true on success, false otherwise 
     514             :    */
     515             :   Bool_t Hardware2Detector(UShort_t    ddl,        UShort_t    board, 
     516             :                            UShort_t    altro,      UShort_t    chan,
     517             :                            UShort_t  timebin,   
     518             :                            UShort_t& det,        Char_t&   ring, 
     519             :                            UShort_t& sec,        Short_t& str,
     520             :                            UShort_t& sam) const;
     521             :   /** 
     522             :    * Map a hardware address into a detector index. 
     523             :    *
     524             :    * @param ddl        Hardware DDL number 
     525             :    * @param hwaddr     Hardware address.  
     526             :    * @param timebin    Timebin 
     527             :    * @param det        On return, the detector #
     528             :    * @param ring       On return, the ring ID
     529             :    * @param sec        On return, the sector #
     530             :    * @param str        On return, the base of strip #
     531             :    * @param sam        On return, the sample number for this strip
     532             :    *
     533             :    * @return @c true on success, false otherwise 
     534             :    */
     535             :   Bool_t Hardware2Detector(UShort_t    ddl,        UShort_t    hwaddr, 
     536             :                            UShort_t  timebin,    
     537             :                            UShort_t& det,        Char_t&   ring, 
     538             :                            UShort_t& sec,        Short_t& str,
     539             :                            UShort_t& sam) const;
     540             : 
     541             :   /** 
     542             :    * Map a detector index into a hardware address. 
     543             :    *
     544             :    * @param det         The detector #
     545             :    * @param ring        The ring ID
     546             :    * @param sec         The sector #
     547             :    * @param str         The strip #
     548             :    * @param sam         The sample number 
     549             :    * @param ddl         On return, hardware DDL number 
     550             :    * @param board       On return, the FEC board address (local to DDL)
     551             :    * @param altro       On return, the ALTRO number (local to FEC)
     552             :    * @param channel     On return, the channel number (local to ALTRO)
     553             :    * @param timebin     On return, the timebin number (local to ALTRO)
     554             :    *
     555             :    * @return @c true on success, false otherwise 
     556             :    */
     557             :   Bool_t Detector2Hardware(UShort_t  det,        Char_t    ring, 
     558             :                            UShort_t  sec,        UShort_t  str,
     559             :                            UShort_t  sam, 
     560             :                            UShort_t&   ddl,        UShort_t&   board, 
     561             :                            UShort_t&   altro,      UShort_t&   channel, 
     562             :                            UShort_t& timebin) const;
     563             :   /** 
     564             :    * Map a detector index into a hardware address. 
     565             :    *
     566             :    * @param det         The detector #
     567             :    * @param ring        The ring ID
     568             :    * @param sec         The sector #
     569             :    * @param str         The strip #
     570             :    * @param sam         The sample number 
     571             :    * @param ddl         On return, hardware DDL number 
     572             :    * @param hwaddr      On return, hardware address.  
     573             :    * @param timebin     On return, the timebin number (local to ALTRO)
     574             :    *
     575             :    * @return @c true on success, false otherwise 
     576             :    */
     577             :   Bool_t Detector2Hardware(UShort_t  det,        Char_t    ring, 
     578             :                            UShort_t  sec,        UShort_t  str,
     579             :                            UShort_t  sam, 
     580             :                            UShort_t&   ddl,        UShort_t&   hwaddr, 
     581             :                            UShort_t& timebin) const;
     582             :   /** 
     583             :    * Get the map that translates hardware to detector coordinates 
     584             :    *
     585             :    * @return Get the map that translates hardware to detector
     586             :    * coordinates 
     587             :    */ 
     588             :   AliFMDAltroMapping* GetAltroMap() const;
     589             :   /** 
     590             :    * Whether raw data has full common data header (8 32bit words) or
     591             :    * the older invalid format (7 32bit words with bogus entries)
     592             :    *
     593             :    * @return false if the raw data has incomplete data header 
     594             :    */ 
     595           0 :   Bool_t HasCompleteHeader() const { return fHasCompleteHeader; } 
     596             : 
     597             :   /** @} */
     598             : 
     599           0 :   static const char* PulseGainPath()       { return fgkPulseGain; }
     600           0 :   static const char* PedestalPath()        { return fgkPedestal; }
     601           0 :   static const char* DeadPath()            { return fgkDead; }
     602           0 :   static const char* SampleRatePath()      { return fgkSampleRate; }
     603           0 :   static const char* AltroMapPath()        { return fgkAltroMap; }
     604           0 :   static const char* ZeroSuppressionPath() { return fgkZeroSuppression; }
     605           0 :   static const char* StripRangePath()      { return fgkStripRange; }
     606           0 :   static const char* GetPedestalShuttleID()   {return fkPedestalShuttleID;}
     607           0 :   static const char* GetGainShuttleID()       {return fkGainShuttleID;}
     608           0 :   static const char* GetConditionsShuttleID()   {return fkConditionsShuttleID;}
     609             :   
     610             : protected:
     611             :   /** 
     612             :    * CTOR  
     613             :    */
     614             :   AliFMDParameters();
     615             :   /** 
     616             :    * CTOR  
     617             :    */
     618             :   AliFMDParameters(const AliFMDParameters& o) 
     619             :     : TNamed(o), 
     620             :       fIsInit(o.fIsInit),
     621             :       fkSiDeDxMip(o.fkSiDeDxMip),
     622             :       fVA1MipRange(o.fVA1MipRange),
     623             :       fAltroChannelSize(o.fAltroChannelSize),
     624             :       fChannelsPerAltro(o.fChannelsPerAltro),
     625             :       fPedestalFactor(o.fPedestalFactor),
     626             :       fZSPre(o.fZSPre),
     627             :       fZSPost(o.fZSPost),
     628             :       fZSPedSubtract(o.fZSPedSubtract),
     629             :       fFixedPedestal(o.fFixedPedestal),
     630             :       fFixedPedestalWidth(o.fFixedPedestalWidth),
     631             :       fFixedZeroSuppression(o.fFixedZeroSuppression),
     632             :       fFixedSampleRate(o.fFixedSampleRate),
     633             :       fFixedThreshold(o.fFixedThreshold),
     634             :       fFixedMinStrip(o.fFixedMinStrip),
     635             :       fFixedMaxStrip(o.fFixedMaxStrip),
     636             :       fFixedPulseGain(o.fFixedPulseGain),
     637             :       fEdepMip(o.fEdepMip),
     638             :       fHasCompleteHeader(o.fHasCompleteHeader),
     639             :       fZeroSuppression(o.fZeroSuppression),
     640             :       fSampleRate(o.fSampleRate),
     641             :       fPedestal(o.fPedestal),
     642             :       fPulseGain(o.fPulseGain),
     643             :       fDeadMap(o.fDeadMap),
     644             :       fAltroMap(o.fAltroMap),
     645             :     fStripRange(o.fStripRange), 
     646             :     fRunNo(o.fRunNo)
     647             :   {}
     648             :   /** 
     649             :    * Assignement operator 
     650             :    *
     651             :    * @return Reference to this 
     652             :    */
     653             :   AliFMDParameters& operator=(const AliFMDParameters&) { return *this; }
     654             :   /** 
     655             :    * DTOR 
     656             :    */
     657           0 :   virtual ~AliFMDParameters() {}
     658             :   /** 
     659             :    * Singleton instance  
     660             :    */
     661             :   static AliFMDParameters* fgInstance;   // Static singleton instance
     662             :   /** 
     663             :    * Check if the file <i>prefix</i><i>number</i> exists in @a path, 
     664             :    * and write the full path to @a f.  
     665             :    * 
     666             :    * @param prefix  File prefix (cond, peds, gains, ...)
     667             :    * @param path    Path to files
     668             :    * @param number  Detector number (1, 2, or 3)
     669             :    * @param f       On return full path to file (if found)
     670             :    * 
     671             :    * @return @c true if file exists and is readable, @c false otherwise
     672             :    */
     673             :   Bool_t CheckFile(const char* prefix, const char* path, 
     674             :                    int         number, TString&    f) const;
     675             :   /** 
     676             :    * Get an entry from either global AliCDBManager or passed
     677             :    * AliFMDPreprocessor. 
     678             :    * 
     679             :    * @param path  Path to CDB object. 
     680             :    * @param pp    AliFMDPreprocessor 
     681             :    * @param fatal If true, raise a fatal flag if we didn't get the entry.
     682             :    * @return AliCDBEntry if found 
     683             :    */ 
     684             :   AliCDBEntry* GetEntry(const char* path, AliFMDPreprocessor* pp, 
     685             :                         Bool_t fatal=kTRUE) const;
     686             :   /** 
     687             :    * Initialize gains.  Try to get them from CDB 
     688             :    *
     689             :    * @param pp Pre-processor if called from shuttle
     690             :    * 
     691             :    * @return 0 on success, error mask otherwise 
     692             :    */
     693             :   UShort_t InitPulseGain(AliFMDPreprocessor* pp=0);
     694             :   /**
     695             :    * Initialize pedestals.  Try to get them from CDB
     696             :    *
     697             :    * @param pp Pre-processor if called from shuttle
     698             :    * 
     699             :    * @return 0 on success, error mask otherwise 
     700             :    */
     701             :   UShort_t InitPedestal(AliFMDPreprocessor* pp=0);
     702             :   /**
     703             :    * Initialize dead map.  Try to get it from CDB
     704             :    *
     705             :    * @param pp Pre-processor if called from shuttle
     706             :    * 
     707             :    * @return 0 on success, error mask otherwise 
     708             :    */
     709             :   UShort_t InitDeadMap(AliFMDPreprocessor* pp=0);
     710             :   /**
     711             :    * Initialize sample rates.  Try to get them from CDB
     712             :    *
     713             :    * @param pp Pre-processor if called from shuttle
     714             :    * 
     715             :    * @return 0 on success, error mask otherwise 
     716             :    */
     717             :   UShort_t InitSampleRate(AliFMDPreprocessor* pp=0);
     718             :   /**
     719             :    * Initialize zero suppression thresholds.  Try to get them from CDB
     720             :    *
     721             :    * @param pp Pre-processor if called from shuttle
     722             :    * 
     723             :    * @return 0 on success, error mask otherwise 
     724             :    */
     725             :   UShort_t InitZeroSuppression(AliFMDPreprocessor* pp=0);
     726             :   /**
     727             :    * Initialize hardware map.  Try to get it from CDB
     728             :    *
     729             :    * @param pp Pre-processor if called from shuttle
     730             :    * 
     731             :    * @return 0 on success, error mask otherwise 
     732             :    */
     733             :   UShort_t InitAltroMap(AliFMDPreprocessor* pp=0);
     734             :   /**
     735             :    * Initialize strip range.  Try to get it from CDB
     736             :    *
     737             :    * @param pp Pre-processor if called from shuttle
     738             :    * 
     739             :    * @return 0 on success, error mask otherwise 
     740             :    */
     741             :   UShort_t InitStripRange(AliFMDPreprocessor* pp=0);
     742             :   Bool_t CheckForNewRun();
     743             : 
     744             :   Bool_t          fIsInit;                   // Whether we've been initialised  
     745             : 
     746             :   static const char* fgkPulseGain;           // Path to PulseGain calib object
     747             :   static const char* fgkPedestal;            // Path to Pedestal calib object
     748             :   static const char* fgkDead;                // Path to Dead calib object
     749             :   static const char* fgkSampleRate;          // Path to SampleRate calib object
     750             :   static const char* fgkAltroMap;            // Path to AltroMap calib object
     751             :   static const char* fgkZeroSuppression;     // Path to ZeroSuppression cal object
     752             :   static const char* fgkStripRange;          // Path to strip range cal object
     753             :   const Float_t   fkSiDeDxMip;               // MIP dE/dx in Silicon
     754             :   UShort_t        fVA1MipRange;              // # MIPs the pre-amp can do    
     755             :   UShort_t        fAltroChannelSize;         // Largest # to store in 1 ADC ch.
     756             :   UShort_t        fChannelsPerAltro;         // Number of pre-amp. chan/adc chan.
     757             :   Float_t         fPedestalFactor;           // Number of pedestal widths
     758             :   UShort_t        fZSPre;                    // Number of pre-samples in ZS
     759             :   UShort_t        fZSPost;                   // Number of post-samples in ZS
     760             :   Bool_t          fZSPedSubtract;            // Pedestal subtraction before ZS
     761             : 
     762             :   Float_t         fFixedPedestal;            // Pedestal to subtract
     763             :   Float_t         fFixedPedestalWidth;       // Width of pedestal
     764             :   UShort_t        fFixedZeroSuppression;     // Threshold for zero-suppression
     765             :   UShort_t        fFixedSampleRate;          // Times the ALTRO samples pre-amp.
     766             :   Float_t         fFixedThreshold;           // Threshold in ADC counts
     767             :   UShort_t        fFixedMinStrip;            // Minimum strip read-out
     768             :   UShort_t        fFixedMaxStrip;            // Maximum strip read-out 
     769             :   mutable Float_t fFixedPulseGain;           //! Gain (cached)
     770             :   mutable Float_t fEdepMip;                  //! Cache of energy loss for a MIP
     771             :   Bool_t          fHasCompleteHeader;        // raw data has incomplete data header
     772             :   
     773             :   static const char* fkPedestalShuttleID;    // Shuttle/preprocessor ID for pedestals
     774             :   static const char* fkGainShuttleID;        // Shuttle/preprocessor ID for gains
     775             :   static const char* fkConditionsShuttleID;  // Shuttle/preprocessor ID for conditions
     776             :   
     777             :   AliFMDCalibZeroSuppression* fZeroSuppression; // Zero suppression from CDB
     778             :   AliFMDCalibSampleRate*      fSampleRate;      // Sample rate from CDB 
     779             :   AliFMDCalibPedestal*        fPedestal;        // Pedestals 
     780             :   AliFMDCalibGain*            fPulseGain;       // Pulser gain
     781             :   AliFMDCalibDeadMap*         fDeadMap;         // Pulser gain
     782             :   AliFMDAltroMapping*         fAltroMap;        // Map of hardware
     783             :   AliFMDCalibStripRange*      fStripRange;      // Strip range
     784             :   Int_t                       fRunNo;           // Initialized for this run
     785             :   
     786    13275152 :   ClassDef(AliFMDParameters,7) // Manager of parameters
     787             : };
     788             : 
     789             : //__________________________________________________________________
     790             : inline void
     791             : AliFMDParameters::SetStripRange(UShort_t min, UShort_t max) 
     792             : {
     793             :   // Set fixed strip range 
     794           6 :   fFixedMinStrip = min;
     795           3 :   fFixedMaxStrip = max;
     796           3 : }
     797             : 
     798             : #endif
     799             : //____________________________________________________________________
     800             : //
     801             : // Local Variables:
     802             : //   mode: C++
     803             : // End:
     804             : //
     805             : // EOF
     806             : //
     807             : 

Generated by: LCOV version 1.11