Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:22:50

0001 #ifndef GLOBALPARAMSHELPER_H__
0002 #define GLOBALPARAMSHELPER_H__
0003 
0004 #include <cassert>
0005 #include "CondFormats/L1TObjects/interface/L1TGlobalParameters.h"
0006 #include "CondFormats/DataRecord/interface/L1TGlobalParametersRcd.h"
0007 
0008 // If you want to create a new object that you can read and write, use this constructor:
0009 //
0010 //   l1t::GlobalParamsHelper x(new L1TPrescalesVetors());
0011 //
0012 // If you wish to read the table from the EventSetup, and will only read, use this:
0013 //
0014 //   const GlobalParamsHelper * x = GlobalParamsHelper::readFromEventSetup(...)
0015 //   //...
0016 //   delete x;
0017 //
0018 // If you wish to read the table from the EventSetup, but then be able to edit the values locally, use this:
0019 //
0020 //   GlobalParamsHelper * x = GlobalParamsHelper::readAndWriteFromEventSetup(...)
0021 //   //...
0022 ///  delete x;
0023 //
0024 // but there's a performance penalty as a copy is made.
0025 
0026 //
0027 // This class does not take over responsibility for deleting the pointers it is
0028 // initialized with.  That is responsibility of the calling code.
0029 //
0030 
0031 namespace l1t {
0032 
0033   class GlobalParamsHelper {
0034   public:
0035     enum { VERSION = 1 };
0036 
0037     ~GlobalParamsHelper();
0038 
0039     //ctor if creating a new table (e.g. from XML or python file)
0040     GlobalParamsHelper(L1TGlobalParameters* w);
0041     //create for reading only, from the EventSetup:
0042     static const GlobalParamsHelper* readFromEventSetup(const L1TGlobalParameters* es);
0043     // create for reading and writing, starting from the EventSetup:
0044     static GlobalParamsHelper* readAndWriteFromEventSetup(const L1TGlobalParameters* es);
0045 
0046     //int bxMaskDefault() const { return read_->bxmask_default_; };
0047     //void setBxMaskDefault(int value) { check_write(); write_->bxmask_default_ = value; };
0048 
0049     /// get / set the number of bx in hardware
0050     inline int totalBxInEvent() const { return read_->m_totalBxInEvent; }
0051 
0052     void setTotalBxInEvent(const int&);
0053 
0054     /// get / set the number of physics trigger algorithms
0055     inline unsigned int numberPhysTriggers() const { return read_->m_numberPhysTriggers; }
0056 
0057     void setNumberPhysTriggers(const unsigned int&);
0058 
0059     ///  get / set the number of L1 muons received by GT
0060     inline unsigned int numberL1Mu() const { return read_->m_numberL1Mu; }
0061 
0062     void setNumberL1Mu(const unsigned int&);
0063 
0064     ///  get / set the number of L1 e/gamma objects received by GT
0065     inline unsigned int numberL1EG() const { return read_->m_numberL1EG; }
0066 
0067     void setNumberL1EG(const unsigned int&);
0068 
0069     ///  get / set the number of L1  jets received by GT
0070     inline unsigned int numberL1Jet() const { return read_->m_numberL1Jet; }
0071 
0072     void setNumberL1Jet(const unsigned int&);
0073 
0074     ///  get / set the number of L1 tau  received by GT
0075     inline unsigned int numberL1Tau() const { return read_->m_numberL1Tau; }
0076 
0077     void setNumberL1Tau(const unsigned int&);
0078 
0079     ///   get / set the number of condition chips in GTL
0080     inline unsigned int numberChips() const { return read_->m_numberChips; }
0081 
0082     void setNumberChips(const unsigned int&);
0083 
0084     ///   get / set the number of pins on the GTL condition chips
0085     inline unsigned int pinsOnChip() const { return read_->m_pinsOnChip; }
0086 
0087     void setPinsOnChip(const unsigned int&);
0088 
0089     ///   get / set the correspondence "condition chip - GTL algorithm word"
0090     ///   in the hardware
0091     inline const std::vector<int>& orderOfChip() const { return read_->m_orderOfChip; }
0092 
0093     void setOrderOfChip(const std::vector<int>&);
0094 
0095     /// print all the L1 GT  parameters
0096     void print(std::ostream&) const;
0097 
0098     // access to underlying pointers, mainly for ESProducer:
0099     const L1TGlobalParameters* getReadInstance() const { return read_; }
0100     L1TGlobalParameters* getWriteInstance() { return write_; }
0101 
0102   private:
0103     GlobalParamsHelper(const L1TGlobalParameters* es);
0104     void useCopy();
0105     void check_write() { assert(write_); }
0106     // separating read from write allows for a high-performance read-only mode (as no copy is made):
0107     const L1TGlobalParameters* read_;  // when reading/getting, use this.
0108     L1TGlobalParameters* write_;       // when writing/setting, use this.
0109     bool we_own_write_;
0110   };
0111 
0112 }  // namespace l1t
0113 #endif