Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:05:13

0001 
0002 #ifndef DataFormats_SiStripEventSummary_SiStripEventSummary_H
0003 #define DataFormats_SiStripEventSummary_SiStripEventSummary_H
0004 
0005 #include "DataFormats/SiStripCommon/interface/SiStripConstants.h"
0006 #include <sstream>
0007 #include <vector>
0008 
0009 class SiStripEventSummary;
0010 
0011 /** Debug info for SiStripFedKey class. */
0012 std::ostream& operator<<(std::ostream&, const SiStripEventSummary&);
0013 
0014 /**
0015    @class SiStripFedKey
0016    @author R.Bainbridge
0017    
0018    @brief A container class for generic run and event-related info,
0019    information required by the commissioning analyses (such as
0020    hardware parameters), event quality flags, error conditions, etc...
0021 */
0022 class SiStripEventSummary {
0023 public:
0024   // ---------- Constructors, destructors ----------
0025 
0026   /** Default constructor. */
0027   SiStripEventSummary();
0028 
0029   /** Default destructor. */
0030   ~SiStripEventSummary() { ; }
0031 
0032   // ---------- General information ----------
0033 
0034   /** Identifies if commissioning info is valid or not (when using
0035       global trigger to understand if HW config is being changed). */
0036   inline bool valid() const;
0037 
0038   /** Identifier of trigger FED (null value means not found). */
0039   inline uint16_t triggerFed() const;
0040 
0041   /** Flag to identify if commissioning info already set. */
0042   inline bool isSet() const;
0043 
0044   // ---------- Run and event-related info ----------
0045 
0046   /** Returns run type. */
0047   inline const sistrip::RunType& runType() const;
0048 
0049   /** Returns event number. */
0050   inline const uint32_t& event() const;
0051 
0052   /** Returns bunch crossing number. */
0053   inline const uint32_t& bx() const;
0054 
0055   // ---------- Hardware-related info ----------
0056 
0057   /** Returns FED readout mode. */
0058   inline const sistrip::FedReadoutMode& fedReadoutMode() const;
0059 
0060   /** Returns APV readout mode. */
0061   inline const sistrip::ApvReadoutMode& apvReadoutMode() const;
0062 
0063   /** Returns APVE golden pipeline address. */
0064   inline const uint16_t& apveAddress() const;
0065 
0066   /** Returns number of APVs that are synchronized. */
0067   inline const uint32_t& nApvsInSync() const;
0068 
0069   /** Returns number of APVs that are not synchronized. */
0070   inline const uint32_t& nApvsOutOfSync() const;
0071 
0072   /** Returns number of APVs with error flags set. */
0073   inline const uint32_t& nApvsErrors() const;
0074 
0075   // ---------- Commissioning info ----------
0076 
0077   /** Indicates whether all params are null or not. */
0078   inline bool nullParams() const;
0079 
0080   /** Returns values of all params. */
0081   inline const std::vector<uint32_t>& params() const;
0082 
0083   /** Returns bin number for very fast connection. */
0084   inline const uint32_t& binNumber() const;
0085 
0086   /** Returns PLL coarse delay setting. */
0087   inline const uint32_t& pllCoarse() const;
0088 
0089   /** Returns PLL fine delay setting. */
0090   inline const uint32_t& pllFine() const;
0091 
0092   /** Returns APV latency setting. */
0093   inline const uint32_t& latency() const;
0094 
0095   /** Returns APV calibration channels (CDRV). */
0096   inline const uint32_t& calChan() const;
0097 
0098   /** Returns APV calibration timing (CSEL). */
0099   inline const uint32_t& calSel() const;
0100 
0101   /** Returns APV ISHA. */
0102   inline const uint32_t& isha() const;
0103 
0104   /** Returns APV VFS. */
0105   inline const uint32_t& vfs() const;
0106 
0107   /** Returns TTCrx delay setting. */
0108   inline const uint32_t& ttcrx() const;
0109 
0110   /** Returns VPSP setting. */
0111   inline const uint32_t& vpsp() const;
0112 
0113   /** Returns CCU channel of module being tuned for VPSP. */
0114   inline const uint32_t& vpspCcuChan() const;
0115 
0116   /** Returns LLD gain setting. */
0117   inline const uint32_t& lldGain() const;
0118 
0119   /** Returns LLD bias setting. */
0120   inline const uint32_t& lldBias() const;
0121 
0122   /** Returns device id. */
0123   inline const uint32_t& deviceId() const;
0124 
0125   /** Returns process id. */
0126   inline const uint32_t& processId() const;
0127 
0128   /** Returns process IP address. */
0129   inline const uint32_t& processIp() const;
0130 
0131   /** Returns DCU id. */
0132   inline const uint32_t& dcuId() const;
0133 
0134   /** Returns the layer mask for fine delay runs */
0135   inline const uint32_t& layerScanned() const;
0136 
0137   // ---------- Setter methods ----------
0138 
0139   /** Sets commissioning-related information. */
0140   void commissioningInfo(const uint32_t* const buffer, const uint32_t& event);
0141 
0142   /** Sets DAQ register information. */
0143   void commissioningInfo(const uint32_t& daq_register1, const uint32_t& daq_register2);
0144 
0145   /** Sets trigger FED number. */
0146   inline void triggerFed(const int16_t&);
0147 
0148   /** Sets FED readout mode. */
0149   void fedReadoutMode(const uint16_t&);
0150 
0151   /** Sets event number. */
0152   inline void event(const uint32_t&);
0153 
0154   /** Sets bunch crossing number. */
0155   inline void bx(const uint32_t&);
0156 
0157   inline void apveAddress(uint16_t& addr);
0158   inline void nApvsInSync(uint32_t& napvs_in_sync);
0159   inline void nApvsOutOfSync(uint32_t& napvs_out_of_sync);
0160   inline void nApvsErrors(uint32_t& napvs_with_errors);
0161 
0162 private:
0163   // ---------- General info ----------
0164 
0165   /** Flag to signify if trigger FED information is valid. */
0166   bool valid_;
0167 
0168   /** */
0169   uint16_t triggerFed_;
0170 
0171   // ---------- Run- and event-related info ----------
0172 
0173   /** Run type. */
0174   sistrip::RunType runType_;
0175 
0176   /** Event number. */
0177   uint32_t event_;
0178 
0179   /** Bunch crossing number. */
0180   uint32_t bx_;
0181 
0182   /** Spill number. */
0183   uint32_t spillNumber_;
0184 
0185   /** Number of DataSenders (c.f. ReadoutUnits). */
0186   uint32_t nDataSenders_;
0187 
0188   // ---------- Hardware-related info ----------
0189 
0190   /** FED readout mode. */
0191   sistrip::FedReadoutMode fedReadoutMode_;
0192 
0193   /** APV readout mode. */
0194   sistrip::ApvReadoutMode apvReadoutMode_;
0195 
0196   /** APVE golden pipeline address. */
0197   uint16_t apveAddress_;
0198 
0199   /** Number of APVs that are synchronized. */
0200   uint32_t nApvsInSync_;
0201 
0202   /** Number of APVs that are not synchronized. */
0203   uint32_t nApvsOutOfSync_;
0204 
0205   /** Number of APVs with error flags set. */
0206   uint32_t nApvsErrors_;
0207 
0208   /** Parameters related to commissioning analysis. */
0209   std::vector<uint32_t> params_;
0210 };
0211 
0212 // ---------- inline methods ----------
0213 
0214 bool SiStripEventSummary::valid() const { return valid_; }
0215 uint16_t SiStripEventSummary::triggerFed() const { return triggerFed_; }
0216 bool SiStripEventSummary::isSet() const { return (/* triggerFed_ > 0 && */ runType_ != sistrip::UNDEFINED_RUN_TYPE); }
0217 
0218 const sistrip::RunType& SiStripEventSummary::runType() const { return runType_; }
0219 const uint32_t& SiStripEventSummary::event() const { return event_; }
0220 const uint32_t& SiStripEventSummary::bx() const { return bx_; }
0221 
0222 const sistrip::FedReadoutMode& SiStripEventSummary::fedReadoutMode() const { return fedReadoutMode_; }
0223 const sistrip::ApvReadoutMode& SiStripEventSummary::apvReadoutMode() const { return apvReadoutMode_; }
0224 
0225 const uint16_t& SiStripEventSummary::apveAddress() const { return apveAddress_; }
0226 const uint32_t& SiStripEventSummary::nApvsInSync() const { return nApvsInSync_; }
0227 const uint32_t& SiStripEventSummary::nApvsOutOfSync() const { return nApvsOutOfSync_; }
0228 const uint32_t& SiStripEventSummary::nApvsErrors() const { return nApvsErrors_; }
0229 
0230 bool SiStripEventSummary::nullParams() const { return (!params_[0] && !params_[1] && !params_[2] && !params_[3]); }
0231 const std::vector<uint32_t>& SiStripEventSummary::params() const { return params_; }
0232 const uint32_t& SiStripEventSummary::binNumber() const { return params_[0]; }
0233 const uint32_t& SiStripEventSummary::pllCoarse() const { return params_[0]; }
0234 const uint32_t& SiStripEventSummary::pllFine() const { return params_[1]; }
0235 const uint32_t& SiStripEventSummary::latency() const { return params_[0]; }
0236 const uint32_t& SiStripEventSummary::calChan() const { return params_[1]; }
0237 const uint32_t& SiStripEventSummary::calSel() const { return params_[2]; }
0238 const uint32_t& SiStripEventSummary::isha() const { return params_[3]; }
0239 const uint32_t& SiStripEventSummary::vfs() const { return params_[4]; }
0240 const uint32_t& SiStripEventSummary::ttcrx() const { return params_[2]; }
0241 const uint32_t& SiStripEventSummary::vpsp() const { return params_[0]; }
0242 const uint32_t& SiStripEventSummary::vpspCcuChan() const { return params_[1]; }
0243 const uint32_t& SiStripEventSummary::lldGain() const { return params_[0]; }
0244 const uint32_t& SiStripEventSummary::lldBias() const { return params_[1]; }
0245 const uint32_t& SiStripEventSummary::deviceId() const { return params_[0]; }
0246 const uint32_t& SiStripEventSummary::processId() const { return params_[1]; }
0247 const uint32_t& SiStripEventSummary::processIp() const { return params_[2]; }
0248 const uint32_t& SiStripEventSummary::dcuId() const { return params_[3]; }
0249 const uint32_t& SiStripEventSummary::layerScanned() const { return params_[3]; }
0250 
0251 void SiStripEventSummary::triggerFed(const int16_t& fed) { fed < 0 ? triggerFed_ = 0 : triggerFed_ = fed; }
0252 void SiStripEventSummary::event(const uint32_t& event) { event_ = event; }
0253 void SiStripEventSummary::bx(const uint32_t& bx) { bx_ = bx; }
0254 
0255 void SiStripEventSummary::apveAddress(uint16_t& addr) { apveAddress_ = addr; }
0256 void SiStripEventSummary::nApvsInSync(uint32_t& napvs_in_sync) { nApvsInSync_ = napvs_in_sync; }
0257 void SiStripEventSummary::nApvsOutOfSync(uint32_t& napvs_out_of_sync) { nApvsOutOfSync_ = napvs_out_of_sync; }
0258 void SiStripEventSummary::nApvsErrors(uint32_t& napvs_with_errors) { nApvsErrors_ = napvs_with_errors; }
0259 
0260 #endif  // DataFormats_SiStripEventSummary_SiStripEventSummary_H