CMS 3D CMS Logo

ConditionHelper.cc
Go to the documentation of this file.
2 
5 
8 
10 
12 
14  params_cache_id_(0ULL), forest_cache_id_(0ULL) {
15 }
16 
18 }
19 
21 
22  bool new_params = false;
23  bool new_forests = false;
24 
25  // Pull configuration from the EventSetup
26  auto& params_setup = iSetup.get<L1TMuonEndCapParamsRcd>();
27  if (params_setup.cacheIdentifier() != params_cache_id_) {
28  params_setup.get(params_);
29 
30  // with the magic above you can use params_->fwVersion to change emulator's behavior
31  // ...
32 
33  // reset cache id
34  params_cache_id_ = params_setup.cacheIdentifier();
35  new_params = true;
36  }
37 
38  // Pull pt LUT from the EventSetup
39  auto& forest_setup = iSetup.get<L1TMuonEndCapForestRcd>();
40  if (forest_setup.cacheIdentifier() != forest_cache_id_) {
41  forest_setup.get(forest_);
42 
43  // at this point we want to reload the newly pulled pT LUT
44  // ...
45 
46  // reset cache id
47  forest_cache_id_ = forest_setup.cacheIdentifier();
48  new_forests = true;
49  }
50 
51  // // Debug
52  // std::cout << "Run number: " << iEvent.id().run() << " fw_version: " << get_fw_version()
53  // << " pt_lut_version: " << get_pt_lut_version() << " pc_lut_version: " << get_pc_lut_version()
54  // << std::endl;
55 
56  return (new_params || new_forests);
57 }
58 
59 unsigned int ConditionHelper::get_fw_version() const {
60  // std::cout << " - Getting firmware version from ConditionHelper: version = " << params_->firmwareVersion_ << std::endl;
61  return params_->firmwareVersion_;
62 }
63 
65  // std::cout << " - Getting pT LUT version from ConditionHelper: version = " << (params_->PtAssignVersion_ & 0xff);
66  // std::cout << " (lowest bits of " << params_->PtAssignVersion_ << ")" << std::endl;
67  return (params_->PtAssignVersion_ & 0xff); // Version indicated by first two bytes
68 }
69 
71  // "PhiMatchWindowSt1" arbitrarily re-mapped to Primitive conversion (PC LUT) version
72  // because of rigid CondFormats naming conventions - AWB 02.06.17
73  // std::cout << " - Getting PC LUT version from ConditionHelper: version = " << params_->PhiMatchWindowSt1_ << std::endl;
74  // return params_->PhiMatchWindowSt1_;
75 
76  // Hack until we figure out why the database is returning "0" for 2017 data - AWB 04.08.17
77  // std::cout << " - Getting PC LUT version from ConditionHelper: version = " << (params_->firmwareVersion_ >= 50000) << std::endl;
78  return (params_->firmwareVersion_ >= 50000);
79 }
edm::ESHandle< L1TMuonEndCapParams > params_
unsigned int get_pc_lut_version() const
edm::ESHandle< L1TMuonEndCapForest > forest_
unsigned int get_fw_version() const
int iEvent
Definition: GenABIO.cc:230
void get(HolderT &iHolder) const
bool checkAndUpdateConditions(const edm::Event &iEvent, const edm::EventSetup &iSetup)
const T & get() const
Definition: EventSetup.h:55
unsigned long long params_cache_id_
unsigned int get_pt_lut_version() const
unsigned long long forest_cache_id_