CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC2_patch1/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   //returns a boolean, true if the bunch slot number is in the circulating bunch configuration
00065   bool isBunchInBeam1( size_t const & bunch ) const;
00066   
00067   bool isBunchInBeam2( size_t const & bunch ) const;
00068   
00069   //member functions returning *by value* a vector with all filled bunch slots
00070   std::vector<unsigned short> bunchConfigurationForBeam1() const;
00071   
00072   std::vector<unsigned short> bunchConfigurationForBeam2() const;
00073   
00074   //setters
00075   void setBunchesInBeam1( unsigned short const & bunches );
00076   
00077   void setBunchesInBeam2( unsigned short const & bunches );
00078   
00079   void setCollidingBunches( unsigned short const & collidingBunches );
00080   
00081   void setTargetBunches( unsigned short const & targetBunches );
00082   
00083   void setFillType( FillTypeId const & fillType );
00084   
00085   void setParticleTypeForBeam1( ParticleTypeId const & particleType );
00086   
00087   void setParticleTypeForBeam2( ParticleTypeId const & particleType );
00088   
00089   void setCrossingAngle( float const & angle );
00090   
00091   void setBetaStar( float const & betaStar );
00092   
00093   void setIntensityForBeam1( float const & intensity );
00094   
00095   void setIntensityForBeam2( float const & intensity );
00096   
00097   void setEnergy( float const & energy );
00098   
00099   void setCreationTime( cond::Time_t const & createTime );
00100   
00101   void setBeginTime( cond::Time_t const & beginTime );
00102   
00103   void setEndTime( cond::Time_t const & endTime );
00104   
00105   void setInjectionScheme( std::string const & injectionScheme );
00106   
00107   //sets all values in one go
00108   void setBeamInfo( unsigned short const & bunches1
00109                     ,unsigned short const & bunches2
00110                     ,unsigned short const & collidingBunches
00111                     ,unsigned short const & targetBunches
00112                     ,FillTypeId const & fillType
00113                     ,ParticleTypeId const & particleType1
00114                     ,ParticleTypeId const & particleType2
00115                     ,float const & angle
00116                     ,float const & beta
00117                     ,float const & intensity1
00118                     ,float const & intensity2
00119                     ,float const & energy
00120                     ,cond::Time_t const & createTime
00121                     ,cond::Time_t const & beginTime
00122                     ,cond::Time_t const & endTime
00123                     ,std::string const & scheme
00124                     ,std::bitset<bunchSlots+1> const & bunchConf1 
00125                     ,std::bitset<bunchSlots+1> const & bunchConf2 );
00126   
00127   //dumping values on output stream
00128   void print(std::stringstream & ss) const;
00129   
00130  protected:
00131   std::bitset<bunchSlots+1> const & bunchBitsetForBeam1() const;
00132   
00133   std::bitset<bunchSlots+1> const & bunchBitsetForBeam2() const;
00134   
00135   void setBunchBitsetForBeam1( std::bitset<bunchSlots+1> const & bunchConfiguration );
00136   
00137   void setBunchBitsetForBeam2( std::bitset<bunchSlots+1> const & bunchConfiguration );
00138   
00139  private:
00140   bool m_isData;
00141   unsigned short m_lhcFill;
00142   unsigned short m_bunches1, m_bunches2, m_collidingBunches, m_targetBunches;
00143   FillTypeId m_fillType;
00144   ParticleTypeId m_particles1, m_particles2;
00145   float m_crossingAngle, m_betastar, m_intensity1, m_intensity2, m_energy;
00146   cond::Time_t m_createTime, m_beginTime, m_endTime;
00147   std::string m_injectionScheme;
00148   //BEWARE: since CMS counts bunches starting from one,
00149   //the size of the bitset must be incremented by one,
00150   //in order to avoid off-by-one
00151   std::bitset<bunchSlots+1> m_bunchConfiguration1, m_bunchConfiguration2;
00152 };
00153 
00154 std::ostream & operator<<( std::ostream &, FillInfo fillInfo );