![]() |
|
|||
File indexing completed on 2024-07-02 00:53:32
0001 // -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: t; tab-width: 8; -*- 0002 0003 #ifndef ECALMATACQDIGI_H 0004 #define ECALMATACQDIGI_H 1 0005 0006 #include <ostream> 0007 #include <vector> 0008 #include <algorithm> 0009 #include "Rtypes.h" 0010 0011 #define ECAL_MATACQ_DIGI_VERS 2 0012 0013 /** \class EcalMatacqDigi 0014 */ 0015 0016 class EcalMatacqDigi { 0017 public: 0018 /** LSB of ADC count in Volt 0019 */ 0020 static const double lsb_; 0021 0022 /** Maximum number of time samples 0023 */ 0024 static const int MAXSAMPLES = 2560; 0025 0026 public: 0027 typedef int key_type; //matacq channel id used as key for edm::SortedCollection 0028 0029 public: 0030 /** Default constructor. 0031 */ 0032 EcalMatacqDigi() : chId_(-1), ts_(0.), tTrigS_(999.), version_(-1) { init(); } 0033 0034 /** Constructor 0035 * @param samples adc time samples 0036 * @param chId Matacq channel ID 0037 * @param ts sampling time in seconds 0038 * @param version Matacq raw data private version 0039 * @param tTrigg time position of the trigger in seconds 0040 */ 0041 EcalMatacqDigi(const std::vector<Short_t>& samples, 0042 const int& chId, 0043 const double& ts, 0044 const short& version = -1, 0045 const double& tTrig = 999.) 0046 : chId_(chId), data_(samples), ts_(ts), tTrigS_(tTrig), version_(version) { 0047 init(); 0048 }; 0049 0050 /** Gets amplitude in ADC count of time sample i. i between 0 and size()-1. 0051 * Note: Amplitude is pedestal subtracted at acquisition time. 0052 */ 0053 float adcCount(const int& i) const { return data_[i]; } 0054 0055 /** Gets amplitude in Volt of time sample i. i between 0 and size()-1. 0056 * Note: Amplitude is pedestal subtracted at acquisition time. 0057 */ 0058 float amplitudeV(const int& i) const { return data_[i] * lsb_; } 0059 0060 /** Gets Matacq electronics channel id 0061 */ 0062 int chId() const { return chId_; } 0063 0064 /** For edm::SortedCollection. 0065 * @return as key the matacq channel id 0066 */ 0067 int id() const { return chId_; } 0068 0069 // /** Sets Matacq electronics channel id 0070 // */ 0071 // void chId(int newChId){ chId_ = newChId;} 0072 0073 /** Number of time samples 0074 */ 0075 int size() const { return data_.size(); } 0076 0077 /** Swaps samples with the passed samples. For package internal use. 0078 * @param samples new time samples in unit used in raw data 0079 * (a priori ADC count). 0080 */ 0081 void swap(std::vector<short>& samples) { std::swap(data_, samples); } 0082 0083 void swap(EcalMatacqDigi& a); 0084 0085 // /** Gets time of sample i. i between 0 and size()-1. 0086 // */ 0087 // float t(int i) const { return ts()*i;} 0088 0089 /** Gets sampling time in seconds 0090 */ 0091 float ts() const { return ts_; } 0092 0093 // /** Sets sampling time period 0094 // * @param ts sampling time period in seconds 0095 // */ 0096 // void ts(double newTs){ 0097 // ts_ = newTs; 0098 // } 0099 0100 /** Gets time of trigger in seconds. 0101 * @return (t_trig-t_0), with t_trig the trigger time and t_0 the first. 0102 * Returns 999 if not available. 0103 * sample time. 0104 */ 0105 float tTrig() const { return tTrigS_; } 0106 0107 // /** Sets trigger time position 0108 // * @param tTrigS (t_trig-t_0) in seconds, with t_trig the time of MATACQ 0109 // * trigger and t_0 the time of the first sample of each MATACQ channel. 0110 // */ 0111 // void tTrig(double tTrigS){ 0112 // tTrigS_ = tTrigS; 0113 // } 0114 0115 /** version of raw data format, the digis originate from. 0116 * @return raw data format version, -1 if not available. 0117 */ 0118 short version() const { return version_; } 0119 0120 // /** Sets the raw data format, the digi is issued from. 0121 // * @param version internal matacq raw data format version 0122 // */ 0123 // void version(short version){ 0124 // version_ = version; 0125 // } 0126 0127 #if (ECAL_MATACQ_DIGI_VERS >= 2) 0128 /** Gets the bunch crossing id field contents. 0129 * @return BX id 0130 */ 0131 int bxId() const { return bxId_; } 0132 0133 /** Sets the bunch crossing id field contents. 0134 * @param value new value 0135 */ 0136 void bxId(int value) { bxId_ = value; } 0137 0138 /** Gets level one accept counter of the event 0139 * @return l1a 0140 */ 0141 int l1a() const { return l1a_; } 0142 0143 /** Sets level one accept counter of the event 0144 * @param value new value 0145 */ 0146 void l1a(int value) { l1a_ = value; } 0147 0148 /** Gets type of test trigger 0149 * @return triggerType 0150 */ 0151 int triggerType() const { return triggerType_; } 0152 0153 /** Sets type of test trigger 0154 * @param value new value 0155 */ 0156 void triggerType(int value) { triggerType_ = value; } 0157 0158 /** Gets the matacq data timestamp with fine granularity (89.1us) 0159 * @return acquisition date of the data expressed in number of "elapsed" 0160 * second and microseconds since the EPOCH as defined in POSIX.1. 0161 * See time() standard c function and gettimeofday UNIX function. 0162 */ 0163 timeval timeStamp() const { 0164 timeval value; 0165 value.tv_sec = tv_sec_; 0166 value.tv_usec = tv_usec_; 0167 return value; 0168 } 0169 0170 /** Sets the matcq event timestmap 0171 * @param value new value 0172 */ 0173 void timeStamp(timeval value) { 0174 tv_sec_ = value.tv_sec; 0175 tv_usec_ = value.tv_usec; 0176 } 0177 0178 /** Gets the LHC orbit ID of the event 0179 * Available only for Matacq data format version >=3 and for P5 data. 0180 * @return the LHC orbit ID 0181 */ 0182 UInt_t orbitId() const { return orbitId_; } 0183 0184 /** Sets the LHC orbit ID of the event. 0185 * @param value new value 0186 */ 0187 void orbitId(UInt_t value) { orbitId_ = value; } 0188 0189 /** Gets the Trig Rec value (see Matacq documentation) 0190 * Available only for Matacq data format version >=3. 0191 * @return the Trig Rec value 0192 */ 0193 int trigRec() const { return trigRec_; } 0194 0195 /** Sets the Trig Rec value (see Matacq documentation) 0196 * @param value new value 0197 */ 0198 void trigRec(int value) { trigRec_ = value; } 0199 0200 /** Gets the Posttrig value (see Matacq documentation). 0201 * Available only for Matacq data format version >=3. 0202 */ 0203 int postTrig() const { return postTrig_; } 0204 0205 /** Sets the Posttrig value (see Matacq documentation). 0206 * @param value new value 0207 */ 0208 void postTrig(int value) { postTrig_ = value; } 0209 0210 /** Gets the vernier values (see Matacq documentation) 0211 * @return verniers 0212 */ 0213 std::vector<int> vernier() const { return vernier_; } 0214 0215 /** Sets verniers 0216 * @param value new value 0217 */ 0218 void vernier(const std::vector<int>& value) { vernier_ = value; } 0219 0220 /** Gets "Delay A" setting of laser delay box in ns.delayA 0221 * @return delayA 0222 */ 0223 int delayA() const { return delayA_; } 0224 0225 /** Sets "Delay A" setting of laser delay box in ns.delayA 0226 * @param value new value 0227 */ 0228 void delayA(int value) { delayA_ = value; } 0229 0230 /** Gets the WTE-to-Laser delay of EMTC in LHC clock unit. 0231 * @return emtcDelay 0232 */ 0233 int emtcDelay() const { return emtcDelay_; } 0234 0235 /** Sets the WTE-to-Laser delay of EMTC in LHC clock unit. 0236 * @param value new value 0237 */ 0238 void emtcDelay(int value) { emtcDelay_ = value; } 0239 0240 /** Gets the EMTC laser phase in 1/8th LHC clock unit. 0241 * @return emtcPhase 0242 */ 0243 int emtcPhase() const { return emtcPhase_; } 0244 0245 /** Sets the EMTC laser phase in 1/8th LHC clock unit. 0246 * @param value new value 0247 */ 0248 void emtcPhase(int value) { emtcPhase_ = value; } 0249 0250 /** Gets the laser logarithmic attenuator setting in -10dB unit. 0251 * Between 0 and 5*(-10dB), -1 if unknown. 0252 * @return attenuation_dB 0253 */ 0254 int attenuation_dB() const { return attenuation_dB_; } 0255 0256 /** Sets the laser Logarithmic attenuator setting in -10dB unit. 0257 * Between 0 and 5*(-10dB), -1 if unknown. 0258 * @param value new value 0259 */ 0260 void attenuation_dB(int value) { attenuation_dB_ = value; } 0261 0262 /** Gets the laser power setting in percents 0263 * (set with the linear attenuator), 0264 * @return laserPower 0265 */ 0266 int laserPower() const { return laserPower_; } 0267 0268 /** Sets the laser power setting in percents 0269 * (set with the linear attenuator), 0270 * @param value new value 0271 */ 0272 void laserPower(int value) { laserPower_ = value; } 0273 #endif 0274 0275 void init() { 0276 #if (ECAL_MATACQ_DIGI_VERS >= 2) 0277 bxId_ = -1; 0278 l1a_ = -1; 0279 triggerType_ = -1; 0280 orbitId_ = -1; 0281 trigRec_ = -1; 0282 postTrig_ = -1; 0283 vernier_ = std::vector<Int_t>(4, -1); 0284 delayA_ = -1; 0285 emtcDelay_ = -1; 0286 emtcPhase_ = -1; 0287 attenuation_dB_ = -1; 0288 laserPower_ = -1; 0289 tv_sec_ = 0; 0290 tv_usec_ = 0; 0291 #endif 0292 } 0293 0294 private: 0295 /** Electronic channel id 0296 */ 0297 int chId_; 0298 0299 /** ADC count of time samples 0300 */ 0301 std::vector<Short_t> data_; 0302 0303 /**Sampling period in seconds. In priniciple 1ns or 0.5ns 0304 */ 0305 double ts_; 0306 0307 /** Trigger time in seconds 0308 */ 0309 double tTrigS_; 0310 0311 /** version of raw data format, the digis originate from. 0312 */ 0313 short version_; 0314 0315 #if (ECAL_MATACQ_DIGI_VERS >= 2) 0316 /** Type of test trigger 0317 * @return triggerType 0318 */ 0319 int8_t triggerType_; 0320 0321 /** Logarithmic attenuator setting in -10dB unit. Between 0 and 0322 * 5*(-10dB), -1 if unknown. 0323 */ 0324 int8_t attenuation_dB_; 0325 0326 /** Bunch crossing Id 0327 */ 0328 Short_t bxId_; 0329 0330 /** Event id. Actually LV1 ID. 0331 */ 0332 Int_t l1a_; 0333 0334 /* LHC orbit ID 0335 */ 0336 Int_t orbitId_; 0337 0338 /** Trig Rec value (see Matacq documentation) 0339 */ 0340 Short_t trigRec_; 0341 0342 /** Posttrig value (see Matacq documentation) 0343 */ 0344 Short_t postTrig_; 0345 0346 /** Vernier values (see Matacq documentation) 0347 */ 0348 std::vector<Int_t> vernier_; 0349 0350 /** "Delay A" setting of laser delay box in ns. 0351 */ 0352 Int_t delayA_; 0353 0354 /** WTE-to-Laser delay of EMTC in LHC clock unit. 0355 */ 0356 Int_t emtcDelay_; 0357 0358 /** EMTC laser phase in 1/8th LHC clock unit. 0359 */ 0360 Int_t emtcPhase_; 0361 0362 /** Laser power in percents (set with the linear attenuator). 0363 */ 0364 Int_t laserPower_; 0365 0366 /** Matacq acquisition time stamp 0367 */ 0368 /** We don't use timeval directly, because its typedef is platform dependent. 0369 */ 0370 Long64_t tv_sec_; 0371 Long64_t tv_usec_; 0372 0373 #endif 0374 }; 0375 0376 std::ostream& operator<<(std::ostream& s, const EcalMatacqDigi& digi); 0377 0378 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.2.1 LXR engine. The LXR team |
![]() ![]() |