| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

Electronics.h

Go to the documentation of this file.
00001 
00009 #ifndef CONVENTIONS_ELECTRONICS_H
00010 #define CONVENTIONS_ELECTRONICS_H 1
00011 
00012 #include "Conventions/Detectors.h"
00013 #include "CLHEP/Units/SystemOfUnits.h"
00014 #include <vector>
00015 
00019 namespace DayaBay {
00020   
00021   typedef std::vector<int> DigitalSignal;
00022   typedef std::vector<double> AnalogSignal;
00023 
00027   class ElecChannelId : public Detector {
00028   public:
00029     ElecChannelId() : Detector(0) {}
00030     ElecChannelId(int board, int connector,
00031                 Site::Site_t site,
00032                 DetectorId::DetectorId_t det);
00033     ElecChannelId(const ElecChannelId& channel) : Detector(channel) {}
00034     ElecChannelId(int data) : Detector(data) {}
00035     virtual ~ElecChannelId();
00036     // Assignment Operator
00037     ElecChannelId& operator=(const ElecChannelId& id) 
00038       { m_data = id.m_data; return *this; }
00039 
00040     // Return the board index in the crate
00041     int board() const;
00042 
00043     // Return the connector number on the board, starting from 1.
00044     // (connector == 0 implies the entire board.)
00045     int connector() const;
00046 
00047   };
00048 
00067   class FeeChannelId : public ElecChannelId {
00068   public:
00069     FeeChannelId() : ElecChannelId(0) {}
00070     FeeChannelId(int board, int connector,
00071                Site::Site_t site, DetectorId::DetectorId_t det) : 
00072                ElecChannelId(board, connector, site, det) {}
00073     FeeChannelId(const FeeChannelId& channel) : ElecChannelId(channel) {}
00074     FeeChannelId(int data) : ElecChannelId(data) {}
00075     virtual ~FeeChannelId();
00076     // Assignment Operator
00077     FeeChannelId& operator=(const FeeChannelId& id) 
00078       { m_data = id.m_data; return *this; }
00079 
00080     // Return the electronics identifier of the entire board
00081     FeeChannelId boardId() const;
00082 
00083   };
00084 
00091   class FadcChannelId : public ElecChannelId {
00092   public:
00093     FadcChannelId() : ElecChannelId(0) {}
00094     FadcChannelId(int connector,
00095                Site::Site_t site, DetectorId::DetectorId_t det) : 
00096                ElecChannelId(20, connector, site, det) {}
00097         FadcChannelId(int board, int connector,
00098                Site::Site_t site, DetectorId::DetectorId_t det) : 
00099                ElecChannelId(board, connector, site, det) {}
00100     FadcChannelId(const FeeChannelId& channel) : ElecChannelId(channel) {}
00101     FadcChannelId(int data) : ElecChannelId(data) {}
00102     virtual ~FadcChannelId();
00103     // Assignment Operator
00104     FadcChannelId& operator=(const FadcChannelId& id) 
00105       { m_data = id.m_data; return *this; }
00106 
00107     // Return the electronics identifier of the entire board
00108     FadcChannelId boardId() const;
00109     // given an input channel return the channel Id of the output.
00110     int outputId() const;
00111     // given an output channel return the first input channel Id.   
00112     int firstInputId() const;
00113     // given an output channel return the second input channel Id.   
00114     int secondInputId() const;
00115   };
00116   
00130   class FecChannelId : public ElecChannelId {
00131   public:
00132     FecChannelId() : ElecChannelId(0) {}
00133     FecChannelId(int board, int connector,
00134                Site::Site_t site, DetectorId::DetectorId_t det) :
00135                ElecChannelId(board, connector, site, det) {}
00136     FecChannelId(const FecChannelId& channel) : ElecChannelId(channel) {}
00137     FecChannelId(int data) : ElecChannelId(data) {}
00138     virtual ~FecChannelId();
00139     // Assignment Operator
00140     FecChannelId& operator=(const FecChannelId& id) 
00141       { m_data = id.m_data; return *this; }
00142 
00143     // Return the electronics identifier of the entire board
00144     FecChannelId boardId() const;
00145   };
00146 
00153   const int BaseFrequencyHz = int(40 * 1e6); // 40 MHz
00154   // Clock cycles relative to base frequency
00155   const int TdcCycles = 16;
00156   const int AdcCycles = 1;
00157   const int EsumCycles = 4;
00158   const int NhitCycles = 2;
00159   // Convenience Frequencies
00160   const int TdcFrequencyHz = BaseFrequencyHz * TdcCycles;
00161   const int AdcFrequencyHz = BaseFrequencyHz * AdcCycles;
00162   const int EsumFrequencyHz = BaseFrequencyHz * EsumCycles;
00163   const int NhitFrequencyHz = BaseFrequencyHz * NhitCycles;
00164   
00165   const int FadcFrequencyHz = int(1 * 1e9); // 1 GHz
00166 
00167   // Time tolerances - amount of time to extend ElecHeader time window
00168   //                   (extending from SimHeader time window)
00169   // preTimeTolerance based on width of ADC widened shaped pulse
00170   // postTimeTolerance based on timing of after pulses
00171   const double preTimeTolerance  = 300.0*CLHEP::nanosecond;
00172   const double postTimeTolerance = 10.0*CLHEP::microsecond;
00173 
00174   // Number of trigger window cycles - default value
00175   const int TriggerWindowCycles = 8;
00176 
00177   namespace FeeGain
00178   {
00179     enum FeeGain_t {
00180       kUnknown = 0,
00181       kHigh,
00182       kLow
00183     };
00184 
00185     // FIXME: Add these functions to Electronics.cc
00186     // Convert type enum back and forth to string.
00187     //const char* AsString(FeeGain_t gain);
00188     //FeeGain_t FromString(const char* str);    
00189   }
00190 
00191   namespace Threshold
00192   {
00193     enum Threshold_t {
00194       kUnknown = 0,
00195       kCrossing,
00196       kAbove
00197     };
00198   }
00199 
00200   namespace ESumComp
00201   {
00202     enum ESumComp_t {
00203       kUnknown  = 0,
00204       kESumLow  = 0x01,
00205       kESumHigh = 0x02,
00206       kESumTotal= 0x04,
00207       kESumNone = 0x08,
00208     };
00209   }
00210 
00211   std::ostream& operator<<(std::ostream& str, 
00212                            const DayaBay::ElecChannelId& elecChannel);
00213 }
00214 
00215 #endif // CONVENTIONS_ELECTRONICS_H
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 20:14:47 2011 for Conventions by doxygen 1.4.7