MQwF1TDC.h

Go to the documentation of this file.
00001 
00002 /**********************************************************\
00003 * File: MQwF1TDC.h                                         *
00004 *                                                          *
00005 * Author: P. M. King                                       *
00006 *         J. H. Lee                                        *
00007 * Time-stamp: <2008-07-08 15:40>                           *
00008 \**********************************************************/
00009 
00010 
00011 #ifndef __MQwF1TDC__
00012 #define __MQwF1TDC__
00013 
00014 #include "Rtypes.h"
00015 #include "QwTypes.h"
00016 #include <cstdlib>
00017 #include <iostream>
00018 #include <iomanip>
00019 
00020 ///
00021 /// \ingroup QwAnalysis
00022 class MQwF1TDC{
00023   /******************************************************************
00024    *  Class: MQwF1TDC
00025    *         Mix-in class containing decoding functions for the F1TDC
00026    *         32-bit dataword.
00027    *         The functions in this class will decode a single word
00028    *         of F1TDC data and provide the components of the word
00029    *         through member functions.
00030    ******************************************************************/
00031  
00032   
00033  public:
00034   MQwF1TDC();
00035   ~MQwF1TDC();
00036 
00037   friend std::ostream& operator<<(std::ostream& os, const MQwF1TDC &f1tdc);
00038 
00039   void DecodeTDCWord(UInt_t &word, const UInt_t roc_id);
00040 
00041   Bool_t IsValidDataword() const;
00042   const Bool_t& IsHeaderword()        const {return fF1HeaderFlag;};
00043  
00044   const UInt_t& GetTDCSlotNumber()    const {return fF1SlotNumber;};
00045   const UInt_t& GetTDCChannelNumber() const {return fF1ChannelNumber;};
00046   const UInt_t& GetTDCChipAddress()   const {return fF1ChipAddress;};
00047   const UInt_t& GetTDCChannelAddress()const {return fF1ChannelAddress;};
00048 
00049   const UInt_t& GetTDCData()          const {return fF1Dataword;};
00050   const UInt_t& GetTDCMaxChannels()   const {return fF1MaxChannelsPerModule;};
00051   
00052  
00053   UInt_t GetTDCEventNumber()       const {return GetTDCHeaderEventNumber();};
00054   UInt_t GetTDCTriggerTime()       const {return GetTDCHeaderTriggerTime();};
00055 
00056 
00057   void SetTDCMaxChannels(const UInt_t in) {fF1MaxChannelsPerModule = in;};
00058 
00059 
00060 
00061 
00062 
00063   
00064   /* Double_t SubtractReference(Double_t rawtime, Double_t reftime); */
00065   /* Double_t ActualTimeDifference(Double_t raw_time, Double_t ref_time); */
00066   /* Bool_t CheckDataIntegrity(const UInt_t roc_id, UInt_t *buffer, UInt_t num_words); */
00067   void   PrintTDCHeader(Bool_t flag);
00068   void   PrintTDCData(Bool_t flag);
00069   void   Print(Bool_t flag);
00070   
00071 
00072 
00073   UInt_t GetTDCHeaderEventNumber() const {return fF1HeaderEventNumber;};
00074   UInt_t GetTDCHeaderTriggerTime() const {return fF1HeaderTriggerTime;};
00075 
00076 
00077   Bool_t IsValidDataSlot()         const {return fF1ValidDataSlotFlag;};
00078  
00079   Bool_t IsHeaderXorSetup()        const {return fF1HeaderXorSetupFlag;};
00080   Bool_t IsNotHeaderTrigFIFO()     const {return !fF1HeaderTrigFIFOFlag;};
00081   Bool_t IsOverFlowEntry()         const {return fF1OverFlowEntryFlag;};
00082 
00083   Bool_t IsHitFIFOOverFlow()       const {return fF1HitFIFOFlag;};
00084   Bool_t IsOutputFIFOOverFlow()    const {return fF1OutputFIFOFlag;};
00085   Bool_t IsResolutionLock()        const {return fF1ResolutionLockFlag;};
00086 
00087   Bool_t IsFakeData()              const {return fF1FakeDataFlag;};
00088 
00089  private:
00090 
00091 
00092   //  *********  DATA and Header words ************
00093   // Bit 31 - 0 bit (32 bit)
00094   // 31 - 24 bit
00095   static const UInt_t kF1Mask_SlotNumber;
00096   static const UInt_t kF1Mask_ResolutionLockFlag;
00097   static const UInt_t kF1Mask_OutputFIFOFlag;
00098   static const UInt_t kF1Mask_HitFIFOFlag;
00099   // F1TDC chip output 24-bit words.
00100   // 23 bit for all
00101   static const UInt_t kF1Mask_HeaderFlag;
00102 
00103 
00104 
00105   //  *********  DATA words ************
00106   // 22    bit  : 1 Bit Fake Data Flag
00107   //              0 > a real data
00108   //              1 > a fake data 
00109   // This bit is not described in the F1TDC manual (1.2), I think,
00110   // is introduced by after private communcation with Ed Jastrzembski. 
00111   // Thursday, September 16 14:04:18 EDT 2010, jhlee
00112   static const UInt_t kF1Mask_FakeDataFlag;
00113 
00114   // 16-21 bit : upper 3 Bit Chip address, lower 3 Bit Channel address
00115   //             the total 6 Bit channel number 0-63
00116   static const UInt_t kF1Mask_ChannelNumber;
00117   static const UInt_t kF1Mask_ChipAddress;
00118   static const UInt_t kF1Mask_ChannelAddress;
00119 
00120   // 15- 0 bit : 16 Bit time
00121   static const UInt_t kF1Mask_Dataword;
00122   
00123 
00124   //  *********  Header words ************
00125   // 22    bit : 1 Bit Trigger FIFO overflow
00126   static const UInt_t kF1Mask_HeaderTrigFIFOFlag;
00127   
00128   // 21-16 bit : 6 Bit Event Number
00129   static const UInt_t kF1Mask_HeaderEventNumber;
00130 
00131   // 15- 8 bit : 9 Bit Trigger Time
00132   static const UInt_t kF1Mask_HeaderTriggerTime;
00133 
00134   // 7     bit : 1 Bit Xor Setup register
00135   static const UInt_t kF1Mask_HeaderXorSetupFlag;
00136 
00137   // 6 - 0 bit : upper 3 Bit Chip address, lower 3 Bit Channel address
00138   //             the total 6 Bit channel number 0-63
00139   static const UInt_t kF1Mask_HeaderChannelNumber;
00140   static const UInt_t kF1Mask_HeaderChipAddress;
00141   static const UInt_t kF1Mask_HeaderChannelAddress;
00142   
00143   
00144   //  static const UInt_t offset;
00145   UInt_t fF1ROCNumber;
00146   UInt_t fF1SlotNumber;
00147 
00148   Bool_t fF1HeaderFlag;              // true(1) if word is 0 (header) and false(0) 
00149                                      // if word is 1 (data)
00150   Bool_t fF1HitFIFOFlag;             // true(1) if word is 1 
00151   Bool_t fF1OutputFIFOFlag;          // true(1) if word is 1
00152   Bool_t fF1ResolutionLockFlag;      // true(1) if word is 1
00153 
00154  
00155   Bool_t fF1FakeDataFlag;            // true(1) if word is 1 (Fake)
00156   UInt_t fF1ChannelNumber;
00157   UInt_t fF1ChipAddress;
00158   UInt_t fF1ChannelAddress;
00159   UInt_t fF1Dataword;
00160 
00161 
00162 
00163   Bool_t fF1HeaderTrigFIFOFlag;
00164   UInt_t fF1HeaderEventNumber;
00165   UInt_t fF1HeaderTriggerTime;
00166   Bool_t fF1HeaderXorSetupFlag;
00167  
00168   
00169   UInt_t fF1MaxChannelsPerModule;
00170   Bool_t fF1OverFlowEntryFlag;
00171   Bool_t fF1ValidDataSlotFlag;  
00172 
00173   // Slot 1 - 21 indicates valid data
00174   // Slot 0  is the tag for a "filler" word. This is a non-valid data word that is
00175   //         inserted to make the block of data output from the module consist of
00176   //         an "even" number of words.
00177   // Slot 30 : the module will return 30 when the data is not valid
00178   // 
00179   //           Tempoararily comment out, because I have no idea how
00180   //           to check this inside MQwF1TDC so we don't interrupt 
00181   //           MQwV775TDC. I think "IsSlotRegistered()" can do instead of this
00182   //                   
00183 
00184   void   PrintHitFIFOStatus(const UInt_t roc_id);
00185   void   PrintOutputFIFOStatus(const UInt_t roc_id);
00186   void   PrintResolutionLockStatus(const UInt_t roc_id);
00187 
00188  
00189 
00190 };
00191 
00192 #endif

Generated on 19 Feb 2017 for QwAnalysis by  doxygen 1.6.1