CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
PPSTimingCalibrationPCLWorker.cc
Go to the documentation of this file.
1 /****************************************************************************
2  *
3  * This is a part of PPS offline software.
4  * Authors:
5  * Edoardo Bossini
6  * Piotr Maciej Cwiklicki
7  * Laurent Forthomme
8  *
9  ****************************************************************************/
10 
13 
18 
21 
25 
27 
28 //------------------------------------------------------------------------------
29 
30 class PPSTimingCalibrationPCLWorker : public DQMGlobalEDAnalyzer<TimingCalibrationHistograms> {
31 public:
33 
34  void dqmAnalyze(const edm::Event&, const edm::EventSetup&, const TimingCalibrationHistograms&) const override;
35 
37 
38 private:
40  const edm::Run&,
41  const edm::EventSetup&,
42  TimingCalibrationHistograms&) const override;
43 
46 
48 };
49 
50 //------------------------------------------------------------------------------
51 
53  : diamondRecHitToken_(
54  consumes<edm::DetSetVector<CTPPSDiamondRecHit>>(iConfig.getParameter<edm::InputTag>("diamondRecHitTag"))),
55  geomEsToken_(esConsumes<edm::Transition::BeginRun>()),
56  dqmDir_(iConfig.getParameter<std::string>("dqmDir")) {}
57 
58 //------------------------------------------------------------------------------
59 
61  const edm::Run& iRun,
62  const edm::EventSetup& iSetup,
63  TimingCalibrationHistograms& iHists) const {
64  iBooker.cd();
65  iBooker.setCurrentFolder(dqmDir_);
66  std::string ch_name;
67 
68  const auto& geom = iSetup.getData(geomEsToken_);
69  for (auto it = geom.beginSensor(); it != geom.endSensor(); ++it) {
70  if (!CTPPSDiamondDetId::check(it->first))
71  continue;
72  const CTPPSDiamondDetId detid(it->first);
73  if (detid.station() != 1)
74  continue;
75  detid.channelName(ch_name);
76  iHists.leadingTime[detid.rawId()] = iBooker.book1D("t_" + ch_name, ch_name + ";t (ns);Entries", 1200, -60., 60.);
77  iHists.toT[detid.rawId()] = iBooker.book1D("tot_" + ch_name, ch_name + ";ToT (ns);Entries", 100, -20., 20.);
78  iHists.leadingTimeVsToT[detid.rawId()] =
79  iBooker.book2D("tvstot_" + ch_name, ch_name + ";ToT (ns);t (ns)", 240, 0., 60., 450, -20., 25.);
80  }
81 }
82 
83 //------------------------------------------------------------------------------
84 
86  const edm::EventSetup& iSetup,
87  const TimingCalibrationHistograms& iHists) const {
88  // then extract the rechits information for later processing
90  iEvent.getByToken(diamondRecHitToken_, dsv_rechits);
91  // ensure timing detectors rechits are found in the event content
92  if (dsv_rechits->empty()) {
93  edm::LogWarning("PPSTimingCalibrationPCLWorker:dqmAnalyze") << "No rechits retrieved from the event content.";
94  return;
95  }
96  for (const auto& ds_rechits : *dsv_rechits) {
97  const CTPPSDiamondDetId detid(ds_rechits.detId());
98  if (iHists.leadingTimeVsToT.count(detid.rawId()) == 0) {
99  edm::LogWarning("PPSTimingCalibrationPCLWorker:dqmAnalyze")
100  << "Pad with detId=" << detid << " is not set to be monitored.";
101  continue;
102  }
103  for (const auto& rechit : ds_rechits) {
104  // skip invalid rechits
105  if (rechit.time() == 0. || rechit.toT() < 0.)
106  continue;
107  iHists.leadingTime.at(detid.rawId())->Fill(rechit.time());
108  iHists.toT.at(detid.rawId())->Fill(rechit.toT());
109  iHists.leadingTimeVsToT.at(detid.rawId())->Fill(rechit.toT(), rechit.time());
110  }
111  }
112 }
113 
114 //------------------------------------------------------------------------------
115 
118  desc.add<edm::InputTag>("diamondRecHitTag", edm::InputTag("ctppsDiamondUncalibRecHits"))
119  ->setComment("input tag for the PPS diamond detectors rechits");
120  desc.add<std::string>("dqmDir", "AlCaReco/PPSTimingCalibrationPCL")
121  ->setComment("output path for the various DQM plots");
122 
123  descriptions.addWithDefaultLabel(desc);
124 }
125 
uint32_t station() const
Definition: CTPPSDetId.h:58
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
Reconstructed hit in diamond detectors.
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void channelName(std::string &name, NameFlag flag=nFull) const
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
static void fillDescriptions(edm::ConfigurationDescriptions &)
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)
edm::EDGetTokenT< edm::DetSetVector< CTPPSDiamondRecHit > > diamondRecHitToken_
Transition
Definition: Transition.h:12
ParameterDescriptionBase * add(U const &iLabel, T const &value)
static bool check(unsigned int raw)
returns true if the raw ID is a PPS-timing one
edm::ESGetToken< CTPPSGeometry, VeryForwardRealGeometryRecord > geomEsToken_
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:177
PPSTimingCalibrationPCLWorker(const edm::ParameterSet &)
void bookHistograms(DQMStore::IBooker &, const edm::Run &, const edm::EventSetup &, TimingCalibrationHistograms &) const override
Detector ID class for CTPPS Timing Diamond detectors. Bits [19:31] : Assigend in CTPPSDetId Calss Bit...
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
void dqmAnalyze(const edm::Event &, const edm::EventSetup &, const TimingCalibrationHistograms &) const override
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
Definition: Run.h:45