Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef CondFormats_RunInfo_LHCInfoPerFill_H
0002 #define CondFormats_RunInfo_LHCInfoPerFill_H
0003 
0004 #include "CondFormats/Serialization/interface/Serializable.h"
0005 #include "CondFormats/RunInfo/interface/LHCInfoVectorizedFields.h"
0006 #include "CondFormats/Common/interface/Time.h"
0007 #include <bitset>
0008 #include <iostream>
0009 #include <string>
0010 #include <sstream>
0011 #include <vector>
0012 
0013 class LHCInfoPerFill : public LHCInfoVectorizedFields {
0014 public:
0015   enum FillType { UNKNOWN = 0, PROTONS, IONS, COSMICS, GAP };
0016   enum ParticleType { NONE = 0, PROTON, PB82, AR18, D, XE54 };
0017 
0018   enum IntParamIndex {
0019     LHC_FILL = 0,
0020     BUNCHES_1,
0021     BUNCHES_2,
0022     COLLIDING_BUNCHES,
0023     TARGET_BUNCHES,
0024     FILL_TYPE,
0025     PARTICLES_1,
0026     PARTICLES_2,
0027     ISIZE
0028   };
0029   enum FloatParamIndex {
0030     INTENSITY_1 = 0,
0031     INTENSITY_2,
0032     ENERGY,
0033     DELIV_LUMI,
0034     REC_LUMI,
0035     LUMI_PER_B,
0036     BEAM1_VC,
0037     BEAM2_VC,
0038     BEAM1_RF,
0039     BEAM2_RF,
0040     INST_LUMI,
0041     INST_LUMI_ERR,
0042     FSIZE
0043   };
0044   enum TimeParamIndex { CREATE_TIME = 0, BEGIN_TIME, END_TIME, TSIZE };
0045   enum StringParamIndex { INJECTION_SCHEME = 0, LHC_STATE, LHC_COMMENT, CTPPS_STATUS, SSIZE };
0046 
0047   typedef FillType FillTypeId;
0048   typedef ParticleType ParticleTypeId;
0049   LHCInfoPerFill();
0050 
0051   LHCInfoPerFill* cloneFill() const;
0052 
0053   //constant static unsigned integer hosting the maximum number of LHC bunch slots
0054   static size_t const bunchSlots = 3564;
0055 
0056   //constant static unsigned integer hosting the available number of LHC bunch slots
0057   static size_t const availableBunchSlots = 2808;
0058 
0059   void setFillNumber(unsigned short lhcFill);
0060 
0061   //getters
0062   unsigned short const fillNumber() const;
0063 
0064   unsigned short const bunchesInBeam1() const;
0065 
0066   unsigned short const bunchesInBeam2() const;
0067 
0068   unsigned short const collidingBunches() const;
0069 
0070   unsigned short const targetBunches() const;
0071 
0072   FillTypeId const fillType() const;
0073 
0074   ParticleTypeId const particleTypeForBeam1() const;
0075 
0076   ParticleTypeId const particleTypeForBeam2() const;
0077 
0078   float const intensityForBeam1() const;
0079 
0080   float const intensityForBeam2() const;
0081 
0082   float const energy() const;
0083 
0084   float const delivLumi() const;
0085 
0086   float const recLumi() const;
0087 
0088   float const instLumi() const;
0089 
0090   float const instLumiError() const;
0091 
0092   cond::Time_t const createTime() const;
0093 
0094   cond::Time_t const beginTime() const;
0095 
0096   cond::Time_t const endTime() const;
0097 
0098   std::string const& injectionScheme() const;
0099 
0100   std::vector<float> const& lumiPerBX() const;
0101 
0102   std::string const& lhcState() const;
0103 
0104   std::string const& lhcComment() const;
0105 
0106   std::string const& ctppsStatus() const;
0107 
0108   std::vector<float> const& beam1VC() const;
0109 
0110   std::vector<float> const& beam2VC() const;
0111 
0112   std::vector<float> const& beam1RF() const;
0113 
0114   std::vector<float> const& beam2RF() const;
0115 
0116   std::vector<float>& beam1VC();
0117 
0118   std::vector<float>& beam2VC();
0119 
0120   std::vector<float>& beam1RF();
0121 
0122   std::vector<float>& beam2RF();
0123 
0124   //returns a boolean, true if the injection scheme has a leading 25ns
0125   //TODO: parse the circulating bunch configuration, instead of the string.
0126   bool is25nsBunchSpacing() const;
0127 
0128   //returns a boolean, true if the bunch slot number is in the circulating bunch configuration
0129   bool isBunchInBeam1(size_t const& bunch) const;
0130 
0131   bool isBunchInBeam2(size_t const& bunch) const;
0132 
0133   //member functions returning *by value* a vector with all filled bunch slots
0134   std::vector<unsigned short> bunchConfigurationForBeam1() const;
0135 
0136   std::vector<unsigned short> bunchConfigurationForBeam2() const;
0137 
0138   //setters
0139   void setBunchesInBeam1(unsigned short const& bunches);
0140 
0141   void setBunchesInBeam2(unsigned short const& bunches);
0142 
0143   void setCollidingBunches(unsigned short const& collidingBunches);
0144 
0145   void setTargetBunches(unsigned short const& targetBunches);
0146 
0147   void setFillType(FillTypeId const& fillType);
0148 
0149   void setParticleTypeForBeam1(ParticleTypeId const& particleType);
0150 
0151   void setParticleTypeForBeam2(ParticleTypeId const& particleType);
0152 
0153   void setIntensityForBeam1(float const& intensity);
0154 
0155   void setIntensityForBeam2(float const& intensity);
0156 
0157   void setEnergy(float const& energy);
0158 
0159   void setDelivLumi(float const& delivLumi);
0160 
0161   void setRecLumi(float const& recLumi);
0162 
0163   void setInstLumi(float const& instLumi);
0164 
0165   void setInstLumiError(float const& instLumiError);
0166 
0167   void setCreationTime(cond::Time_t const& createTime);
0168 
0169   void setBeginTime(cond::Time_t const& beginTime);
0170 
0171   void setEndTime(cond::Time_t const& endTime);
0172 
0173   void setInjectionScheme(std::string const& injectionScheme);
0174 
0175   void setLumiPerBX(std::vector<float> const& lumiPerBX);
0176 
0177   void setLhcState(std::string const& lhcState);
0178 
0179   void setLhcComment(std::string const& lhcComment);
0180 
0181   void setCtppsStatus(std::string const& ctppsStatus);
0182 
0183   void setBeam1VC(std::vector<float> const& beam1VC);
0184 
0185   void setBeam2VC(std::vector<float> const& beam2VC);
0186 
0187   void setBeam1RF(std::vector<float> const& beam1RF);
0188 
0189   void setBeam2RF(std::vector<float> const& beam2RF);
0190 
0191   //sets all values in one go
0192   void setInfo(unsigned short const& bunches1,
0193                unsigned short const& bunches2,
0194                unsigned short const& collidingBunches,
0195                unsigned short const& targetBunches,
0196                FillTypeId const& fillType,
0197                ParticleTypeId const& particleType1,
0198                ParticleTypeId const& particleType2,
0199                float const& intensity1,
0200                float const& intensity2,
0201                float const& energy,
0202                float const& delivLumi,
0203                float const& recLumi,
0204                float const& instLumi,
0205                float const& instLumiError,
0206                cond::Time_t const& createTime,
0207                cond::Time_t const& beginTime,
0208                cond::Time_t const& endTime,
0209                std::string const& scheme,
0210                std::vector<float> const& lumiPerBX,
0211                std::string const& lhcState,
0212                std::string const& lhcComment,
0213                std::string const& ctppsStatus,
0214                std::vector<float> const& beam1VC,
0215                std::vector<float> const& beam2VC,
0216                std::vector<float> const& beam1RF,
0217                std::vector<float> const& beam2RF,
0218                std::bitset<bunchSlots + 1> const& bunchConf1,
0219                std::bitset<bunchSlots + 1> const& bunchConf2);
0220 
0221   bool equals(const LHCInfoPerFill& rhs) const;
0222 
0223   bool empty() const;
0224 
0225   //dumping values on output stream
0226   void print(std::stringstream& ss) const;
0227 
0228   std::bitset<bunchSlots + 1> const& bunchBitsetForBeam1() const;
0229 
0230   std::bitset<bunchSlots + 1> const& bunchBitsetForBeam2() const;
0231 
0232   void setBunchBitsetForBeam1(std::bitset<bunchSlots + 1> const& bunchConfiguration);
0233 
0234   void setBunchBitsetForBeam2(std::bitset<bunchSlots + 1> const& bunchConfiguration);
0235 
0236 private:
0237   std::bitset<bunchSlots + 1> m_bunchConfiguration1, m_bunchConfiguration2;
0238 
0239   COND_SERIALIZABLE;
0240 };
0241 
0242 std::ostream& operator<<(std::ostream&, LHCInfoPerFill lhcInfoPerFill);
0243 
0244 #endif  // CondFormats_RunInfo_LHCInfoPerFill_H