CMS 3D CMS Logo

PrescalesVetosHelper.h
Go to the documentation of this file.
1 #ifndef PRESCALESVETOSHELPERS_H__
2 #define PRESCALESVETOSHELPERS_H__
3 
4 #include <cassert>
6 
7 // If you want to create a new object that you can read and write, use this constructor:
8 //
9 // l1t::PrescalesVetosHelper x(new L1TPrescalesVetors());
10 //
11 // If you wish to read the table from the EventSetup, and will only read, use this:
12 //
13 // const PrescalesVetosHelper * x = PrescalesVetosHelper::readFromEventSetup(...)
14 // //...
15 // delete x;
16 //
17 // If you wish to read the table from the EventSetup, but then be able to edit the values locally, use this:
18 //
19 // PrescalesVetorsHelper * x = PrescalesVetosHelper::readAndWriteFromEventSetup(...)
20 // //...
22 //
23 // but there's a performance penalty as a copy is made.
24 
25 
26 //
27 // This class does not take over responsibility for deleting the pointers it is
28 // initialized with. That is responsibility of the calling code.
29 //
30 
31 
32 namespace l1t {
33 
35  public:
36  enum {VERSION_ = 1};
37 
39 
40  //ctor if creating a new table (e.g. from XML or python file)
42  //create for reading only, from the EventSetup:
44  // create for reading and writing, starting from the EventSetup:
46 
47  int bxMaskDefault() const { return read_->bxmask_default_; };
49 
50  inline const std::vector<std::vector<int> >& prescaleTable() const { return read_->prescale_table_; };
51  void setPrescaleFactorTable(std::vector<std::vector<int> > value){ check_write(); write_->prescale_table_ = value; };
52  inline const std::vector<int>& triggerMaskVeto() const { return read_->veto_; };
53  void setTriggerMaskVeto(std::vector<int> value){ check_write(); write_->veto_ = value; };
54 
55  inline const std::map<int, std::vector<int> >& triggerAlgoBxMask() const { return read_->bxmask_map_; };
56  void setTriggerAlgoBxMask(std::map<int, std::vector<int> > value){ check_write(); write_->bxmask_map_ = value; };
57 
58  // access to underlying pointers, mainly for ESProducer:
59  const L1TGlobalPrescalesVetos * getReadInstance() const {return read_;}
61 
62  private:
64  void useCopy();
65  void check_write() { assert(write_); }
66  // separating read from write allows for a high-performance read-only mode (as no copy is made):
67  const L1TGlobalPrescalesVetos * read_; // when reading/getting, use this.
68  L1TGlobalPrescalesVetos * write_; // when writing/setting, use this.
70  };
71 
72 }
73 #endif
const std::vector< std::vector< int > > & prescaleTable() const
void setPrescaleFactorTable(std::vector< std::vector< int > > value)
const double w
Definition: UKUtility.cc:23
PrescalesVetosHelper(L1TGlobalPrescalesVetos *w)
std::map< int, std::vector< int > > bxmask_map_
delete x;
Definition: CaloConfig.h:22
const std::map< int, std::vector< int > > & triggerAlgoBxMask() const
static const PrescalesVetosHelper * readFromEventSetup(const L1TGlobalPrescalesVetos *es)
const std::vector< int > & triggerMaskVeto() const
Definition: value.py:1
void setTriggerMaskVeto(std::vector< int > value)
L1TGlobalPrescalesVetos * write_
const L1TGlobalPrescalesVetos * getReadInstance() const
std::vector< std::vector< int > > prescale_table_
const L1TGlobalPrescalesVetos * read_
void setTriggerAlgoBxMask(std::map< int, std::vector< int > > value)
L1TGlobalPrescalesVetos * getWriteInstance()
static PrescalesVetosHelper * readAndWriteFromEventSetup(const L1TGlobalPrescalesVetos *es)