CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/CondFormats/RunInfo/interface/FillInfo.h

Go to the documentation of this file.
00001 #include "CondFormats/Common/interface/Time.h"
00002 #include <bitset>
00003 #include <iostream>
00004 #include <string>
00005 #include <sstream>
00006 #include <vector>
00007 
00008 class FillInfo {
00009  public:
00010   enum FillType { UNKNOWN = 0, PROTONS = 1, IONS = 2, COSMICS = 3, GAP = 4 };
00011   enum ParticleType { NONE = 0, PROTON = 1, PB82 = 2, AR18 = 3, D = 4, XE54 = 5 };
00012   typedef FillType FillTypeId;
00013   typedef ParticleType ParticleTypeId;
00014   FillInfo();
00015   FillInfo( unsigned short const & lhcFill, bool const & fromData = true );
00016   ~FillInfo();
00017   
00018   //constant static unsigned integer hosting the maximum number of LHC bunch slots
00019   static size_t const bunchSlots = 3564;
00020   
00021   //constant static unsigned integer hosting the available number of LHC bunch slots
00022   static size_t const availableBunchSlots = 2808;
00023   
00024   //reset instance
00025   void setFill( unsigned short const & lhcFill, bool const & fromData = true );
00026   
00027   //getters
00028   unsigned short const & fillNumber() const;
00029   
00030   bool const & isData() const;
00031   
00032   unsigned short const & bunchesInBeam1() const;
00033   
00034   unsigned short const & bunchesInBeam2() const;
00035   
00036   unsigned short const & collidingBunches() const;
00037   
00038   unsigned short const & targetBunches() const;
00039   
00040   FillTypeId const & fillType() const;
00041   
00042   ParticleTypeId const & particleTypeForBeam1() const;
00043   
00044   ParticleTypeId const & particleTypeForBeam2() const;
00045   
00046   float const & crossingAngle() const;
00047 
00048   float const & betaStar() const;
00049   
00050   float const & intensityForBeam1() const;
00051   
00052   float const & intensityForBeam2() const;
00053   
00054   float const & energy() const;
00055   
00056   cond::Time_t const & createTime() const;
00057   
00058   cond::Time_t const & beginTime() const;
00059   
00060   cond::Time_t const & endTime() const;
00061   
00062   std::string const & injectionScheme() const;
00063   
00064   std::bitset<bunchSlots+1> const & bunchBitsetForBeam1() const;
00065   
00066   std::bitset<bunchSlots+1> const & bunchBitsetForBeam2() const;
00067   
00068   //returns a boolean, true if the bunch slot number is in the circulating bunch configuration
00069   bool isBunchInBeam1( size_t const & bunch ) const;
00070   
00071   bool isBunchInBeam2( size_t const & bunch ) const;
00072   
00073   //member functions returning *by value* a vector with all filled bunch slots
00074   std::vector<unsigned short> bunchConfigurationForBeam1() const;
00075   
00076   std::vector<unsigned short> bunchConfigurationForBeam2() const;
00077   
00078   //setters
00079   unsigned short & bunchesInBeam1();
00080   
00081   unsigned short & bunchesInBeam2();
00082   
00083   unsigned short & collidingBunches();
00084   
00085   unsigned short & targetBunches();
00086   
00087   FillTypeId & fillType();
00088   
00089   ParticleTypeId & particleTypeForBeam1();
00090   
00091   ParticleTypeId & particleTypeForBeam2();
00092   
00093   float & crossingAngle();
00094   
00095   float & betaStar();
00096   
00097   float & intensityForBeam1();
00098   
00099   float & intensityForBeam2();
00100   
00101   float & energy();
00102   
00103   cond::Time_t & createTime();
00104   
00105   cond::Time_t & beginTime();
00106   
00107   cond::Time_t & endTime();
00108   
00109   std::string & injectionScheme();
00110   
00111   std::bitset<bunchSlots+1> & bunchBitsetForBeam1();
00112   
00113   std::bitset<bunchSlots+1> & bunchBitsetForBeam2();
00114   
00115   //sets all values in one go
00116   void setBeamInfo( unsigned short const & bunches1
00117                     ,unsigned short const & bunches2
00118                     ,unsigned short const & collidingBunches
00119                     ,unsigned short const & targetBunches
00120                     ,FillTypeId const & fillType
00121                     ,ParticleTypeId const & particleType1
00122                     ,ParticleTypeId const & particleType2
00123                     ,float const & angle
00124                     ,float const & beta
00125                     ,float const & intensity1
00126                     ,float const & intensity2
00127                     ,float const & energy
00128                     ,cond::Time_t const & createTime
00129                     ,cond::Time_t const & beginTime
00130                     ,cond::Time_t const & endTime
00131                     ,std::string const & scheme
00132                     ,std::bitset<bunchSlots+1> const & bunchConf1 
00133                     ,std::bitset<bunchSlots+1> const & bunchConf2 );
00134   
00135   //dumping values on output stream
00136   void print(std::stringstream & ss) const;
00137   
00138  private:
00139   bool m_isData;
00140   unsigned short m_lhcFill;
00141   unsigned short m_bunches1, m_bunches2, m_collidingBunches, m_targetBunches;
00142   FillTypeId m_fillType;
00143   ParticleTypeId m_particles1, m_particles2;
00144   float m_crossingAngle, m_betastar, m_intensity1, m_intensity2, m_energy;
00145   cond::Time_t m_createTime, m_beginTime, m_endTime;
00146   std::string m_injectionScheme;
00147   //BEWARE: since CMS counts bunches starting from one,
00148   //the size of the bitset must be incremented by one,
00149   //in order to avoid off-by-one
00150   std::bitset<bunchSlots+1> m_bunchConfiguration1, m_bunchConfiguration2;
00151 };
00152 
00153 std::ostream & operator<<( std::ostream &, FillInfo fillInfo );