]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - FMD/AliFMDParameters.h
implemented TPCDigitDump and AltroChannelSelector
[u/mrichter/AliRoot.git] / FMD / AliFMDParameters.h
index 0e50bc774be9ceec44c63075208446dce09a338f..84222a900b7c7433f3e292adcb33fdbabefa1324 100644 (file)
@@ -7,17 +7,17 @@
  *
  * See cxx source for full Copyright notice                               
  */
-/** @file    AliFMDParameters.h
-    @author  Christian Holm Christensen <cholm@nbi.dk>
-    @date    Mon Mar 27 12:44:43 2006
-    @brief   Manager of FMD parameters
-*/
 //____________________________________________________________________
 //
 //  Singleton class to handle various parameters (not geometry) of the
 //  FMD
 //  Should get ata fromm Conditions DB.
 //
+/** @file    AliFMDParameters.h
+    @author  Christian Holm Christensen <cholm@nbi.dk>
+    @date    Mon Mar 27 12:44:43 2006
+    @brief   Manager of FMD parameters
+*/
 #ifndef ROOT_TNamed
 # include <TNamed.h>
 #endif
@@ -37,6 +37,15 @@ class AliFMDCalibGain;
 class AliFMDCalibSampleRate;
 class AliFMDCalibStripRange;
 class AliFMDAltroMapping;
+class AliCDBEntry;
+class AliFMDPreprocessor;
+
+//____________________________________________________________________
+//
+//  Singleton class to handle various parameters (not geometry) of the
+//  FMD
+//  Should get ata fromm Conditions DB.
+//
 
 /** @brief This class is a singleton that handles various parameters
     of the FMD detectors.  
@@ -69,6 +78,22 @@ class AliFMDAltroMapping;
 class AliFMDParameters : public TNamed
 {
 public:
+  /** Enumeration of things to initialize */ 
+  enum What { 
+    /** Pulser gain */ 
+    kPulseGain = 0x1, // Pulser gain 
+    /** Pedestals and noise */ 
+    kPedestal = 0x2, // Pedestal and noise 
+    /** Dead channel map */ 
+    kDeadMap = 0x4, // Dead channel map
+    /**  Over sampling rate */ 
+    kSampleRate = 0x8, // Over sampling rate 
+    /** Zero suppression parameters */ 
+    kZeroSuppression = 0x10, // Zero suppression parameters 
+    /** ALTRO data map */ 
+    kAltroMap = 0x20 // Altro channel map
+  };
+  
   /** Singleton access
       @return  single to */
   static AliFMDParameters* Instance();
@@ -76,10 +101,33 @@ public:
   /** Initialize the manager.  This tries to read the parameters from
       CDB.  If that fails, the class uses the hard-coded parameters. 
    */
-  void Init();
+  void Init(Bool_t forceReInit=kFALSE, 
+           UInt_t what = (kPulseGain|kPedestal|kDeadMap|kSampleRate|
+                          kZeroSuppression|kAltroMap));
+  /** Initialize the manager.  This tries to read the parameters from
+      CDB.  If that fails, the class uses the hard-coded parameters. 
+   */
+  void Init(AliFMDPreprocessor* pp, 
+           Bool_t forceReInit=kFALSE, 
+           UInt_t what = (kPulseGain|kPedestal|kDeadMap|kSampleRate|
+                          kZeroSuppression|kAltroMap));
   /** Print all parameters. 
       @param option Option string */
   void Print(Option_t* option="A") const;
+  /** Draw parameters. 
+      @param option What to draw. Should be one of 
+      - dead     Dead channels
+      - threshold Threshold
+      - gain     Gain
+      - pedestal  Pedestal
+      - noise    Noise (or pedestal width)
+      - zero     Zero suppression
+      - rate     Sampling rate (VA1 clock / ALTRO clock)
+      - min      Minimum strip read out
+      - max      Maximum strip read out
+      - map      hardware address
+  */
+  void Draw(Option_t* option="pedestal");
   
   /** @{ */
   /** @name Set various `Fixed' parameters */
@@ -213,6 +261,20 @@ public:
                       Char_t ring, 
                       UShort_t sector, 
                       UShort_t strip) const;
+  /** Translate hardware address to detector coordinates 
+      @param ddl      DDL number 
+      @param board    Board address
+      @param chip     Chip #
+      @param channel  Channel #
+      @param det      On return, Detector # (1-3)
+      @param ring     On return, Ring ID ('I' or 'O')
+      @param sec      On return, Sector number (0-39)
+      @param str      On return, Strip number (0-511)
+      @return @c true on success. */
+  Bool_t   Hardware2Detector(UInt_t ddl,    UInt_t    board, 
+                            UInt_t chip,   UInt_t    channel, 
+                            UShort_t& det, Char_t&   ring, 
+                            UShort_t& sec, UShort_t& str) const;
   /** Translate hardware address to detector coordinates 
       @param ddl      DDL number 
       @param addr     Hardware address
@@ -223,6 +285,21 @@ public:
       @return @c true on success. */
   Bool_t   Hardware2Detector(UInt_t ddl, UInt_t addr, UShort_t& det,
                             Char_t& ring, UShort_t& sec, UShort_t& str) const;
+
+  /** Translate detector coordinates to hardware address 
+      @param det      Detector # (1-3)
+      @param ring     Ring ID ('I' or 'O')
+      @param sec      Sector number (0-39)
+      @param str      Strip number (0-511)
+      @param ddl      On return, DDL number 
+      @param board    On return, Board address
+      @param chip     On return, Chip #
+      @param channel  On return, Channel #
+      @return @c true on success. */
+  Bool_t   Detector2Hardware(UShort_t det, Char_t ring, 
+                            UShort_t sec, UShort_t str, 
+                            UInt_t& ddl,  UInt_t& board,
+                            UInt_t& chip, UInt_t& channel) const;
   /** Translate detector coordinates to hardware address 
       @param det      Detector # (1-3)
       @param ring     Ring ID ('I' or 'O')
@@ -239,41 +316,82 @@ public:
   AliFMDAltroMapping* GetAltroMap() const;
   /** @} */
 
-  enum { 
-    kBaseDDL = 0x1000 // DDL offset for the FMD
-  };
-  static const char* fgkPulseGain;      // Path to PulseGain calib object
-  static const char* fgkPedestal;       // Path to Pedestal calib object
-  static const char* fgkDead;           // Path to Dead calib object
-  static const char* fgkSampleRate;     // Path to SampleRate calib object
-  static const char* fgkAltroMap;       // Path to AltroMap calib object
-  static const char* fgkZeroSuppression; // Path to ZeroSuppression cal object
-  static const char* fgkStripRange;      // Path to strip range cal object
+  static const char* PulseGainPath()       { return fgkPulseGain; }
+  static const char* PedestalPath()        { return fgkPedestal; }
+  static const char* DeadPath()            { return fgkDead; }
+  static const char* SampleRatePath()      { return fgkSampleRate; }
+  static const char* AltroMapPath()        { return fgkAltroMap; }
+  static const char* ZeroSuppressionPath() { return fgkZeroSuppression; }
+  static const char* StripRangePath()      { return fgkStripRange; }
 protected:
   /** CTOR  */
   AliFMDParameters();
+  /** CTOR  */
+  AliFMDParameters(const AliFMDParameters& o) 
+    : TNamed(o), 
+      fIsInit(o.fIsInit),
+      fkSiDeDxMip(o.fkSiDeDxMip),
+      fVA1MipRange(o.fVA1MipRange),
+      fAltroChannelSize(o.fAltroChannelSize),
+      fChannelsPerAltro(o.fChannelsPerAltro),
+      fPedestalFactor(o.fPedestalFactor),
+      fFixedPedestal(o.fFixedPedestal),
+      fFixedPedestalWidth(o.fFixedPedestalWidth),
+      fFixedZeroSuppression(o.fFixedZeroSuppression),
+      fFixedSampleRate(o.fFixedSampleRate),
+      fFixedThreshold(o.fFixedThreshold),
+      fFixedMinStrip(o.fFixedMinStrip),
+      fFixedMaxStrip(o.fFixedMaxStrip),
+      fFixedPulseGain(o.fFixedPulseGain),
+      fEdepMip(o.fEdepMip),
+      fZeroSuppression(o.fZeroSuppression),
+      fSampleRate(o.fSampleRate),
+      fPedestal(o.fPedestal),
+      fPulseGain(o.fPulseGain),
+      fDeadMap(o.fDeadMap),
+      fAltroMap(o.fAltroMap),
+      fStripRange(o.fStripRange)
+  {}
+  /** Assignement operator 
+      @return Reference to this */
+  AliFMDParameters& operator=(const AliFMDParameters&) { return *this; }
   /** DTOR */
   virtual ~AliFMDParameters() {}
   /** Singleton instance  */
   static AliFMDParameters* fgInstance;   // Static singleton instance
+  /** Get an entry from either global AliCDBManager or passed
+      AliFMDPreprocessor. 
+      @param path  Path to CDB object. 
+      @param pp    AliFMDPreprocessor 
+      @param fatal If true, raise a fatal flag if we didn't get the entry.
+      @return AliCDBEntry if found */ 
+  AliCDBEntry* GetEntry(const char* path, AliFMDPreprocessor* pp, 
+                       Bool_t fatal=kTRUE) const;
   /** Initialize gains.  Try to get them from CDB */
-  void InitPulseGain();
+  void InitPulseGain(AliFMDPreprocessor* pp=0);
   /** Initialize pedestals.  Try to get them from CDB */
-  void InitPedestal();
+  void InitPedestal(AliFMDPreprocessor* pp=0);
   /** Initialize dead map.  Try to get it from CDB */
-  void InitDeadMap();
+  void InitDeadMap(AliFMDPreprocessor* pp=0);
   /** Initialize sample rates.  Try to get them from CDB */
-  void InitSampleRate();
+  void InitSampleRate(AliFMDPreprocessor* pp=0);
   /** Initialize zero suppression thresholds.  Try to get them from CDB */
-  void InitZeroSuppression();
+  void InitZeroSuppression(AliFMDPreprocessor* pp=0);
   /** Initialize hardware map.  Try to get it from CDB */
-  void InitAltroMap();
+  void InitAltroMap(AliFMDPreprocessor* pp=0);
   /** Initialize strip range.  Try to get it from CDB */
-  void InitStripRange();
+  void InitStripRange(AliFMDPreprocessor* pp=0);
 
   Bool_t          fIsInit;               // Whether we've been initialised  
 
-  const Float_t   fSiDeDxMip;            // MIP dE/dx in Silicon
+  static const char* fgkPulseGain;      // Path to PulseGain calib object
+  static const char* fgkPedestal;       // Path to Pedestal calib object
+  static const char* fgkDead;           // Path to Dead calib object
+  static const char* fgkSampleRate;     // Path to SampleRate calib object
+  static const char* fgkAltroMap;       // Path to AltroMap calib object
+  static const char* fgkZeroSuppression; // Path to ZeroSuppression cal object
+  static const char* fgkStripRange;      // Path to strip range cal object
+  const Float_t   fkSiDeDxMip;           // MIP dE/dx in Silicon
   UShort_t        fVA1MipRange;          // # MIPs the pre-amp can do    
   UShort_t        fAltroChannelSize;     // Largest # to store in 1 ADC ch.
   UShort_t        fChannelsPerAltro;     // Number of pre-amp. chan/adc chan.
@@ -283,9 +401,9 @@ protected:
   Float_t         fFixedPedestalWidth;   // Width of pedestal
   UShort_t        fFixedZeroSuppression; // Threshold for zero-suppression
   UShort_t        fFixedSampleRate;      // Times the ALTRO samples pre-amp.
-  Float_t         fFixedThreshold;       //
-  UShort_t        fFixedMinStrip;
-  UShort_t        fFixedMaxStrip;
+  Float_t         fFixedThreshold;       // Threshold in ADC counts
+  UShort_t        fFixedMinStrip;        // Minimum strip read-out
+  UShort_t        fFixedMaxStrip;        // Maximum strip read-out 
   mutable Float_t fFixedPulseGain;       //! Gain (cached)
   mutable Float_t fEdepMip;              //! Cache of energy loss for a MIP
   
@@ -297,7 +415,7 @@ protected:
   AliFMDAltroMapping*         fAltroMap;        // Map of hardware
   AliFMDCalibStripRange*      fStripRange;      // Strip range
   
-  ClassDef(AliFMDParameters,4)
+  ClassDef(AliFMDParameters,5) // Manager of parameters
 };
 
 #endif