Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-03-17 10:47:37

0001 #ifndef CondFormats_SiStripObjects_ApvTimingAnalysis_H
0002 #define CondFormats_SiStripObjects_ApvTimingAnalysis_H
0003 
0004 #include "CondFormats/SiStripObjects/interface/CommissioningAnalysis.h"
0005 #include "DataFormats/SiStripCommon/interface/SiStripConstants.h"
0006 #include <sstream>
0007 #include <vector>
0008 #include <cstdint>
0009 
0010 /**
0011    @class ApvTimingAnalysis
0012    @author M. Wingham, R.Bainbridge
0013    @brief Analysis for timing run using APV tick marks.
0014 */
0015 class ApvTimingAnalysis : public CommissioningAnalysis {
0016 public:
0017   // ---------- con(de)structors ----------
0018 
0019   ApvTimingAnalysis(const uint32_t& key);
0020 
0021   ApvTimingAnalysis();
0022 
0023   ~ApvTimingAnalysis() override { ; }
0024 
0025   friend class ApvTimingAlgorithm;
0026 
0027   // ---------- public interface ----------
0028 
0029   /** Identifies if analysis is valid or not. */
0030   bool isValid() const override;
0031 
0032   /** Identifies if tick mark is found or not. */
0033   bool foundTickMark() const;
0034 
0035   /** Time of tick mark rising edge [ns]. */
0036   inline const float& time() const;
0037 
0038   /** Error on time of tick mark rising edge [ns]. */
0039   inline const float& error() const;
0040 
0041   /** Optimum sampling point, defined w.r.t. rising edge [ns]. */
0042   inline const float& optimumSamplingPoint() const;
0043 
0044   /** Sampling point of "reference" tick mark [ns]. */
0045   inline const float& refTime() const;
0046 
0047   /** Static method to set global reference time [ns]. */
0048   void refTime(const float& time, const float& targetDelay = -1);
0049 
0050   /** Delay required to sync w.r.t. reference tick mark [ns]. */
0051   inline const float& delay() const;
0052 
0053   /** Height of tick mark [ADC]. */
0054   inline const float& height() const;
0055 
0056   /** Baseline level of tick mark [ADC]. */
0057   inline const float& base() const;
0058 
0059   /** Level of tick mark top [ADC]. */
0060   inline const float& peak() const;
0061 
0062   /** FED frame-finding threshold [ADC] (returns 65535 if invalid). */
0063   uint16_t frameFindingThreshold() const;
0064 
0065   // ---------- misc ----------
0066 
0067   /** Prints analysis results. */
0068   void print(std::stringstream&, uint32_t not_used = 0) override;
0069 
0070   /** Adds error codes for analysis (overrides private base). */
0071   inline void addErrorCode(const std::string& error) override;
0072 
0073   /** Resets analysis member data. */
0074   void reset() override;
0075 
0076   // ---------- public static data ----------
0077 
0078   /** Optimum sampling point, defined w.r.t. rising edge [ns]. */
0079   static const float optimumSamplingPoint_;
0080 
0081   /** Threshold defining minimum tick mark height [ADC]. */
0082   static const float tickMarkHeightThreshold_;
0083 
0084   /** Threshold for FED frame finding (fraction of tick height). */
0085   static const float frameFindingThreshold_;
0086 
0087   // ---------- private member data ----------
0088 
0089 private:
0090   /** Time of tick mark rising edge [ns]. */
0091   float time_;
0092 
0093   /** Error on time of tick mark rising edge [ns]. */
0094   float error_;
0095 
0096   /** Sampling point of "reference" tick mark [ns]. */
0097   static float refTime_;
0098 
0099   /** Delay required to sync w.r.t. reference tick mark [ns]. */
0100   float delay_;
0101 
0102   /** Height of tick mark [ADC]. */
0103   float height_;
0104 
0105   /** Baseline level of tick mark [ADC]. */
0106   float base_;
0107 
0108   /** Level of tick mark top [ADC]. */
0109   float peak_;
0110 
0111   /** Checks synchronization to ref time is done only once. */
0112   bool synchronized_;
0113 };
0114 
0115 // ---------- Inline methods ----------
0116 
0117 const float& ApvTimingAnalysis::time() const { return time_; }
0118 const float& ApvTimingAnalysis::error() const { return error_; }
0119 const float& ApvTimingAnalysis::optimumSamplingPoint() const { return optimumSamplingPoint_; }
0120 const float& ApvTimingAnalysis::refTime() const { return refTime_; }
0121 const float& ApvTimingAnalysis::delay() const { return delay_; }
0122 const float& ApvTimingAnalysis::height() const { return height_; }
0123 const float& ApvTimingAnalysis::base() const { return base_; }
0124 const float& ApvTimingAnalysis::peak() const { return peak_; }
0125 void ApvTimingAnalysis::addErrorCode(const std::string& error) { CommissioningAnalysis::addErrorCode(error); }
0126 
0127 #endif  // CondFormats_SiStripObjects_ApvTimingAnalysis_H