CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
PPSDiamondSampicTimingCalibrationPCLWorker.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: CalibPPS/TimingCalibration/PPSDiamondSampicTimingCalibrationPCLWorker
4 // Class: PPSDiamondSampicTimingCalibrationPCLWorker
5 //
13 //
14 // Original Author: Christopher Misan
15 // Created: Mon, 26 Jul 2021 07:37:13 GMT
16 //
17 //
18 
19 #include <string>
20 
23 
26 
28 
31 
37 
38 //------------------------------------------------------------------------------
39 
41  std::unordered_map<uint32_t, dqm::reco::MonitorElement*> timeHisto;
42  std::unordered_map<uint32_t, dqm::reco::MonitorElement*> db;
43  std::unordered_map<uint32_t, dqm::reco::MonitorElement*> sampic;
44  std::unordered_map<uint32_t, dqm::reco::MonitorElement*> channel;
45 };
46 
48  : public DQMGlobalEDAnalyzer<Histograms_PPSDiamondSampicTimingCalibrationPCLWorker> {
49 public:
52 
53  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
54 
55 private:
57  edm::Run const&,
58  edm::EventSetup const&,
60 
61  void dqmAnalyze(edm::Event const&,
62  edm::EventSetup const&,
64 
65  // ------------ member data ------------
70 };
71 
72 //------------------------------------------------------------------------------
73 
75  : totemTimingDigiToken_(
76  consumes<edm::DetSetVector<TotemTimingDigi>>(iConfig.getParameter<edm::InputTag>("totemTimingDigiTag"))),
77  totemTimingRecHitToken_(
78  consumes<edm::DetSetVector<TotemTimingRecHit>>(iConfig.getParameter<edm::InputTag>("totemTimingRecHitTag"))),
79  geomEsToken_(esConsumes<edm::Transition::BeginRun>()),
80  folder_(iConfig.getParameter<std::string>("folder")) {}
81 
83 
84 //------------------------------------------------------------------------------
85 
87  edm::Event const& iEvent,
88  edm::EventSetup const& iSetup,
92  iEvent.getByToken(totemTimingRecHitToken_, timingRecHit);
93  iEvent.getByToken(totemTimingDigiToken_, timingDigi);
94 
95  if (timingRecHit->empty()) {
96  edm::LogWarning("PPSDiamondSampicTimingCalibrationPCLWorker:dqmAnalyze")
97  << "No rechits retrieved from the event content.";
98  return;
99  }
100 
101  for (const auto& digis : *timingDigi) {
102  const CTPPSDiamondDetId detId(digis.detId());
103  for (const auto& digi : digis) {
104  histos.db.at(detId.rawId())->Fill(digi.hardwareBoardId());
105  histos.sampic.at(detId.rawId())->Fill(digi.hardwareSampicId());
106  histos.channel.at(detId.rawId())->Fill(digi.hardwareChannelId());
107  }
108  }
109 
110  for (const auto& recHits : *timingRecHit) {
111  const CTPPSDiamondDetId detId(recHits.detId());
112  for (const auto& recHit : recHits)
113  histos.timeHisto.at(detId.rawId())->Fill(recHit.time());
114  }
115 }
116 
117 //------------------------------------------------------------------------------
118 
120  DQMStore::IBooker& ibook,
121  edm::Run const& run,
122  edm::EventSetup const& iSetup,
124  ibook.setCurrentFolder(folder_);
125  std::string ch_name;
126  const auto& geom = iSetup.getData(geomEsToken_);
127  for (auto it = geom.beginSensor(); it != geom.endSensor(); ++it) {
128  if (!CTPPSDiamondDetId::check(it->first))
129  continue;
130  const CTPPSDiamondDetId detid(it->first);
131 
134  detid.channelName(ch_name);
135  histos.timeHisto[detid.rawId()] = ibook.book1D(path + "/" + ch_name, ch_name, 500, -25, 25);
136  histos.db[detid.rawId()] = ibook.bookInt(path + "/" + ch_name + "db");
137  histos.sampic[detid.rawId()] = ibook.bookInt(path + "/" + ch_name + "sampic");
138  histos.channel[detid.rawId()] = ibook.bookInt(path + "/" + ch_name + "channel");
139  }
140 }
141 
142 //------------------------------------------------------------------------------
143 
146  desc.add<edm::InputTag>("totemTimingDigiTag", edm::InputTag("totemTimingRawToDigi", "TotemTiming"))
147  ->setComment("input tag for the PPS diamond detectors digi");
148  desc.add<edm::InputTag>("totemTimingRecHitTag", edm::InputTag("totemTimingRecHits"))
149  ->setComment("input tag for the PPS diamond detectors rechits");
150  desc.add<std::string>("folder", "AlCaReco/PPSDiamondSampicTimingCalibrationPCL")
151  ->setComment("output path for the various DQM plots");
152  descriptions.add("PPSDiamondSampicTimingCalibrationPCLWorker", desc);
153 }
154 
std::string folder_
std::unordered_map< uint32_t, dqm::reco::MonitorElement * > timeHisto
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
edm::EDGetTokenT< edm::DetSetVector< TotemTimingRecHit > > totemTimingRecHitToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void channelName(std::string &name, NameFlag flag=nFull) const
std::unordered_map< uint32_t, dqm::reco::MonitorElement * > db
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
std::unordered_map< uint32_t, dqm::reco::MonitorElement * > channel
bool getData(T &iHolder) const
Definition: EventSetup.h:128
int iEvent
Definition: GenABIO.cc:224
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
Transition
Definition: Transition.h:12
ParameterDescriptionBase * add(U const &iLabel, T const &value)
edm::ESGetToken< CTPPSGeometry, VeryForwardRealGeometryRecord > geomEsToken_
static bool check(unsigned int raw)
returns true if the raw ID is a PPS-timing one
void dqmAnalyze(edm::Event const &, edm::EventSetup const &, Histograms_PPSDiamondSampicTimingCalibrationPCLWorker const &) const override
MonitorElement * bookInt(TString const &name, FUNC onbooking=NOOP())
Definition: DQMStore.h:73
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &, Histograms_PPSDiamondSampicTimingCalibrationPCLWorker &) const override
Detector ID class for CTPPS Timing Diamond detectors. Bits [19:31] : Assigend in CTPPSDetId Calss Bit...
std::unordered_map< uint32_t, dqm::reco::MonitorElement * > sampic
Log< level::Warning, false > LogWarning
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
Definition: Run.h:45
edm::EDGetTokenT< edm::DetSetVector< TotemTimingDigi > > totemTimingDigiToken_