CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
SiPhase2OuterTrackerLorentzAngleReader.cc
Go to the documentation of this file.
1 // user include files
12 
13 //
14 //
15 // class decleration
16 //
18 public:
20  ~SiPhase2OuterTrackerLorentzAngleReader() override = default;
21  void analyze(edm::StreamID, edm::Event const&, edm::EventSetup const&) const override;
22 
23  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
24 
25 private:
26  const uint32_t printdebug_;
29 };
30 
32  : printdebug_(iConfig.getUntrackedParameter<uint32_t>("printDebug", 5)),
33  label_(iConfig.getUntrackedParameter<std::string>("label", "")),
34  laToken_(esConsumes(edm::ESInputTag{"", label_})) {}
35 
37  edm::Event const& iEvent,
38  edm::EventSetup const& iSetup) const {
39  const auto& lorentzAngles = iSetup.getData(laToken_);
40  edm::LogInfo("SiPhase2OuterTrackerLorentzAngleReader")
41  << "[SiPhase2OuterTrackerLorentzAngleReader::analyze] End Reading SiPhase2OuterTrackerLorentzAngle with label "
42  << label_ << std::endl;
43 
44  const auto& detid_la = lorentzAngles.getLorentzAngles();
45  std::unordered_map<unsigned int, float>::const_iterator it;
46  size_t count = 0;
47  for (it = detid_la.begin(); it != detid_la.end() && count < printdebug_; it++) {
48  edm::LogInfo("SiPhase2OuterTrackerLorentzAngleReader") << "detid " << it->first << " \t"
49  << " Lorentz angle " << it->second;
50  count++;
51  }
52 }
53 
54 // ------------ method fills 'descriptions' with the allowed parameters for the module ------------
57  desc.setComment("Module to read SiPhase2OuterTrackerLorentzAngle Payloads");
58  desc.addUntracked<uint32_t>("printDebug", 5)->setComment("maximum amount of print-outs");
59  desc.addUntracked<std::string>("label", "")->setComment("label from which to read the payload");
60  descriptions.addWithDefaultLabel(desc);
61 }
62 
63 //define this as a plug-in
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void analyze(edm::StreamID, edm::Event const &, edm::EventSetup const &) const override
const edm::ESGetToken< SiPhase2OuterTrackerLorentzAngle, SiPhase2OuterTrackerLorentzAngleRcd > laToken_
bool getData(T &iHolder) const
Definition: EventSetup.h:128
void setComment(std::string const &value)
int iEvent
Definition: GenABIO.cc:224
Log< level::Info, false > LogInfo
~SiPhase2OuterTrackerLorentzAngleReader() override=default
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283