CMS 3D CMS Logo

TotemT2RecHitProducer.cc
Go to the documentation of this file.
1 /****************************************************************************
2  *
3  * This is a part of TOTEM offline software.
4  * Authors:
5  * Laurent Forthomme (laurent.forthomme@cern.ch)
6  *
7  ****************************************************************************/
8 
9 #include <memory>
10 
16 
19 
22 
26 
28 
33 
35 public:
37 
39 
40 private:
41  void produce(edm::Event&, const edm::EventSetup&) override;
42 
49 
50  const bool applyCalib_;
52 };
53 
55  : digiToken_(consumes<edmNew::DetSetVector<TotemT2Digi> >(iConfig.getParameter<edm::InputTag>("digiTag"))),
56  geometryToken_(esConsumes<TotemGeometry, TotemGeometryRcd>()),
57  applyCalib_(iConfig.getParameter<bool>("applyCalibration")),
58  algo_(iConfig) {
59  if (applyCalib_)
60  timingCalibrationToken_ = esConsumes<PPSTimingCalibration, PPSTimingCalibrationRcd>(
61  edm::ESInputTag(iConfig.getParameter<std::string>("timingCalibrationTag")));
62  produces<edmNew::DetSetVector<TotemT2RecHit> >();
63 }
64 
66  auto pOut = std::make_unique<edmNew::DetSetVector<TotemT2RecHit> >();
67 
68  // get the digi collection
69  const auto& digis = iEvent.get(digiToken_);
70 
71  if (!digis.empty()) {
72  if (applyCalib_ && calibWatcher_.check(iSetup))
74 
75  // produce the rechits collection
76  algo_.build(iSetup.getData(geometryToken_), digis, *pOut);
77  }
78 
79  iEvent.put(std::move(pOut));
80 }
81 
84 
85  desc.add<edm::InputTag>("digiTag", edm::InputTag("totemT2Digis", "TotemT2"))
86  ->setComment("input digis collection to retrieve");
87  desc.add<std::string>("timingCalibrationTag", "GlobalTag:TotemT2TimingCalibration")
88  ->setComment("input tag for timing calibrations retrieval");
89  desc.add<double>("timeSliceNs", 25.0 / 1024.0)
90  ->setComment("conversion constant between timing bin size and nanoseconds");
91  desc.add<bool>("applyCalibration", false)->setComment("switch on/off the timing calibration");
92 
93  descr.add("totemT2RecHits", desc);
94 }
95 
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
static void fillDescriptions(edm::ConfigurationDescriptions &)
edm::ESGetToken< PPSTimingCalibrationLUT, PPSTimingCalibrationLUTRcd > timingCalibrationLUTToken_
edm::ESGetToken< PPSTimingCalibration, PPSTimingCalibrationRcd > timingCalibrationToken_
edm::EDGetTokenT< edmNew::DetSetVector< TotemT2Digi > > digiToken_
int iEvent
Definition: GenABIO.cc:224
void build(const TotemGeometry &, const edmNew::DetSetVector< TotemT2Digi > &, edmNew::DetSetVector< TotemT2RecHit > &) override
edm::ESWatcher< PPSTimingCalibrationRcd > calibWatcher_
A watcher to detect timing calibration changes.
TotemT2RecHitProducerAlgorithm algo_
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
bool getData(T &iHolder) const
Definition: EventSetup.h:122
edm::ESGetToken< TotemGeometry, TotemGeometryRcd > geometryToken_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Event setup record containing the real (actual) geometry information.
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:57
void setCalibration(const PPSTimingCalibration &calib, const PPSTimingCalibrationLUT &calibLUT)
HLT enums.
TotemT2RecHitProducer(const edm::ParameterSet &)
def move(src, dest)
Definition: eostools.py:511
void produce(edm::Event &, const edm::EventSetup &) override