CMS 3D CMS Logo

EndCapParamsHelper.h
Go to the documentation of this file.
1 #ifndef l1t_EndCapParamsHelper_h_
2 #define l1t_EndCapParamsHelper_h_
3 
4 #include <cassert>
5 #include <vector>
6 #include <map>
7 
10 
11 // If you want to create a new object that you can read and write, use this constructor:
12 //
13 // l1t::EndCapParamsHelper x(new L1TPrescalesVetors());
14 //
15 // If you wish to read the table from the EventSetup, and will only read, use this:
16 //
17 // const EndCapParamsHelper * x = EndCapParamsHelper::readFromEventSetup(...)
18 // //...
19 // delete x;
20 //
21 // If you wish to read the table from the EventSetup, but then be able to edit the values locally, use this:
22 //
23 // EndCapParamsHelper * x = EndCapParamsHelper::readAndWriteFromEventSetup(...)
24 // //...
26 //
27 // but there's a performance penalty as a copy is made.
28 
29 //
30 // This class does not take over responsibility for deleting the pointers it is
31 // initialized with. That is responsibility of the calling code.
32 //
33 
34 namespace l1t {
35 
37  public:
38  enum { VERSION = 1 };
39 
41 
42  //ctor if creating a new table (e.g. from XML or python file)
44  //create for reading only, from the EventSetup:
46  // create for reading and writing, starting from the EventSetup:
48 
51  // "PhiMatchWindowSt1" arbitrarily re-mapped to Primitive conversion (PC LUT) version
52  // because of rigid CondFormats naming conventions - AWB 02.06.17
54 
55  unsigned GetPtAssignVersion() const { return read_->PtAssignVersion_; }
56  unsigned GetFirmwareVersion() const { return read_->firmwareVersion_; }
57  unsigned GetPrimConvVersion() const { return read_->PhiMatchWindowSt1_; }
58 
59  // print all the parameters
60  void print(std::ostream&) const;
61 
62  // access to underlying pointers, mainly for ESProducer:
63  const L1TMuonEndCapParams* getReadInstance() const { return read_; }
65 
66  private:
68  void useCopy();
69  void check_write() { assert(write_); }
70  // separating read from write allows for a high-performance read-only mode (as no copy is made):
71  const L1TMuonEndCapParams* read_; // when reading/getting, use this.
72  L1TMuonEndCapParams* write_; // when writing/setting, use this.
74  };
75 
76 } // namespace l1t
77 #endif
L1TMuonEndCapParams * write_
unsigned GetPtAssignVersion() const
T w() const
static EndCapParamsHelper * readAndWriteFromEventSetup(const L1TMuonEndCapParams *es)
delete x;
Definition: CaloConfig.h:22
const L1TMuonEndCapParams * read_
void SetFirmwareVersion(unsigned version)
assert(be >=bs)
const L1TMuonEndCapParams * getReadInstance() const
unsigned GetPrimConvVersion() const
void print(std::ostream &) const
unsigned GetFirmwareVersion() const
void SetPtAssignVersion(unsigned version)
void SetPrimConvVersion(unsigned version)
L1TMuonEndCapParams * getWriteInstance()
static const EndCapParamsHelper * readFromEventSetup(const L1TMuonEndCapParams *es)
EndCapParamsHelper(L1TMuonEndCapParams *w)