Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:02:39

0001 #ifndef SiStripBaseDelay_h
0002 #define SiStripBaseDelay_h
0003 
0004 #include "CondFormats/Serialization/interface/Serializable.h"
0005 
0006 #include <algorithm>
0007 #include <cstdint>
0008 #include <sstream>
0009 #include <vector>
0010 
0011 #include "CondFormats/SiStripObjects/interface/SiStripDetSummary.h"
0012 
0013 /**
0014  * Author: M. De Mattia (demattia@pd.infn.it) 25/10/2010:
0015  *
0016  * Base Delay object containing the PLL or time of flight delays. <br>
0017  * It stores the values in a vector\<Delay\>, which is not sorted. <br>
0018  * This object can be used directly to access the information on the delays for each
0019  * detId. However, it is recommended to use the SiStripDelay dependent record which is
0020  * able to combine multiple BaseDelays and provides a much faster access to the information.
0021  */
0022 
0023 class SiStripBaseDelay {
0024 public:
0025   SiStripBaseDelay() {}
0026 
0027   // Defined as public for genreflex
0028   struct Delay {
0029     Delay(const uint32_t inputDetId, const uint16_t inputCoarseDelay, const uint16_t inputFineDelay)
0030         : detId(inputDetId), coarseDelay(inputCoarseDelay), fineDelay(inputFineDelay) {}
0031     /// Default constructor needed by genreflex
0032     Delay() : detId(0), coarseDelay(255), fineDelay(255) {}
0033     uint32_t detId;
0034     unsigned char coarseDelay;
0035     unsigned char fineDelay;
0036 
0037     COND_SERIALIZABLE;
0038   };
0039   typedef std::vector<Delay>::iterator delayIt;
0040   typedef std::vector<Delay>::const_iterator delayConstIt;
0041 
0042   bool put(const uint32_t detId, const uint16_t coarseDelay, const uint16_t fineDelay);
0043   uint16_t coarseDelay(const uint32_t detId);
0044   uint16_t fineDelay(const uint32_t detId) const;
0045   double delay(const uint32_t detId) const;
0046 
0047   /// Fill the input container with all the delays
0048   void delays(std::vector<Delay>& delays) const { delays = delays_; }
0049 
0050   /// Get the list of all detIds for which a delay is stored
0051   void detIds(std::vector<uint32_t>& detIdVector) const;
0052 
0053   /// Get the total number of delays stored (should equal the total number of modules in the SiStripTracker)
0054   inline uint32_t delaysSize() const { return delays_.size(); }
0055 
0056   /// Prints the average value of the delays for all layers and wheels in the SiStripTracker
0057   void printSummary(std::stringstream& ss, const TrackerTopology* trackerTopo) const;
0058   /// Prints the delays for all the detIds
0059   void printDebug(std::stringstream& ss, const TrackerTopology* trackerTopo) const;
0060 
0061 private:
0062   inline double makeDelay(const uint16_t coarseDelay, const uint16_t fineDelay) const {
0063     return (coarseDelay * 25 + fineDelay * (25 / 24.));
0064   }
0065 
0066   std::vector<Delay> delays_;
0067 
0068   COND_SERIALIZABLE;
0069 };
0070 
0071 #endif