CMS 3D CMS Logo

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 
47  const std::string dqmDir_;
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 
PPSTimingCalibrationPCLWorker
Definition: PPSTimingCalibrationPCLWorker.cc:30
edm::Run
Definition: Run.h:45
edm::EDGetTokenT
Definition: EDGetToken.h:33
CTPPSDiamondRecHit
Reconstructed hit in diamond detectors.
Definition: CTPPSDiamondRecHit.h:16
edm
HLT enums.
Definition: AlignableModifier.h:19
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89301
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
DQMStore.h
TimingCalibrationHistograms
Definition: TimingCalibrationStruct.h:7
edm::Handle
Definition: AssociativeIterator.h:50
PPSTimingCalibrationPCLWorker::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &)
Definition: PPSTimingCalibrationPCLWorker.cc:116
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
CTPPSGeometry.h
MakerMacros.h
CTPPSDetId::station
uint32_t station() const
Definition: CTPPSDetId.h:62
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
CTPPSDiamondRecHit.h
dqm::implementation::NavigatorBase::cd
virtual void cd()
Definition: DQMStore.cc:29
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
PPSTimingCalibrationPCLWorker::diamondRecHitToken_
edm::EDGetTokenT< edm::DetSetVector< CTPPSDiamondRecHit > > diamondRecHitToken_
Definition: PPSTimingCalibrationPCLWorker.cc:51
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
PPSTimingCalibrationPCLWorker::dqmDir_
const std::string dqmDir_
Definition: PPSTimingCalibrationPCLWorker.cc:54
CTPPSDiamondDetId.h
CTPPSDiamondDetId
Detector ID class for CTPPS Timing Diamond detectors. Bits [19:31] : Assigend in CTPPSDetId Calss Bit...
Definition: CTPPSDiamondDetId.h:24
edm::ParameterSet
Definition: ParameterSet.h:47
edm::Transition
Transition
Definition: Transition.h:12
TimingCalibrationHistograms::toT
MonitorMap toT
Definition: TimingCalibrationStruct.h:13
Event.h
iEvent
int iEvent
Definition: GenABIO.cc:224
PPSTimingCalibrationPCLWorker::PPSTimingCalibrationPCLWorker
PPSTimingCalibrationPCLWorker(const edm::ParameterSet &)
Definition: PPSTimingCalibrationPCLWorker.cc:52
CTPPSDiamondDetId::check
static bool check(unsigned int raw)
returns true if the raw ID is a PPS-timing one
Definition: CTPPSDiamondDetId.h:40
edm::EventSetup
Definition: EventSetup.h:58
DetSetVector.h
VeryForwardRealGeometryRecord.h
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ESGetToken< CTPPSGeometry, VeryForwardRealGeometryRecord >
HcalObjRepresent::Fill
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
Definition: HcalObjRepresent.h:1053
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:127
CTPPSDiamondDetId::channelName
void channelName(std::string &name, NameFlag flag=nFull) const
Definition: CTPPSDiamondDetId.h:84
TimingCalibrationHistograms::leadingTime
MonitorMap leadingTime
Definition: TimingCalibrationStruct.h:13
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
std
Definition: JetResolutionObject.h:76
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
Frameworkfwd.h
PPSTimingCalibrationPCLWorker::dqmAnalyze
void dqmAnalyze(const edm::Event &, const edm::EventSetup &, const TimingCalibrationHistograms &) const override
Definition: PPSTimingCalibrationPCLWorker.cc:85
dqm::implementation::IBooker::book2D
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::geomEsToken_
edm::ESGetToken< CTPPSGeometry, VeryForwardRealGeometryRecord > geomEsToken_
Definition: PPSTimingCalibrationPCLWorker.cc:52
dqm::implementation::IBooker
Definition: DQMStore.h:43
DQMGlobalEDAnalyzer
Definition: DQMGlobalEDAnalyzer.h:76
TimingCalibrationStruct.h
ParameterSet.h
DeDxTools::esConsumes
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
edm::Event
Definition: Event.h:73
PPSTimingCalibrationPCLWorker::bookHistograms
void bookHistograms(DQMStore::IBooker &, const edm::Run &, const edm::EventSetup &, TimingCalibrationHistograms &) const override
Definition: PPSTimingCalibrationPCLWorker.cc:60
edm::InputTag
Definition: InputTag.h:15
edm::ConfigurationDescriptions::addWithDefaultLabel
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:87
dqm::implementation::IBooker::book1D
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
TimingCalibrationHistograms::leadingTimeVsToT
MonitorMap leadingTimeVsToT
Definition: TimingCalibrationStruct.h:14
DQMGlobalEDAnalyzer.h