CMS 3D CMS Logo

CTPPSDiamondRecHitProducer.cc
Go to the documentation of this file.
1 /****************************************************************************
2  *
3  * This is a part of PPS offline software.
4  * Authors:
5  * Laurent Forthomme (laurent.forthomme@cern.ch)
6  * Nicola Minafra (nicola.minafra@cern.ch)
7  *
8  ****************************************************************************/
9 
10 #include <memory>
11 
18 
22 
25 
29 
31 
35 
37 public:
39 
41 
42 private:
43  void produce(edm::Event&, const edm::EventSetup&) override;
44 
49 
52 
55 };
56 
58  : digiToken_(consumes<edm::DetSetVector<CTPPSDiamondDigi> >(iConfig.getParameter<edm::InputTag>("digiTag"))),
60  applyCalib_(iConfig.getParameter<bool>("applyCalibration")),
61  algo_(iConfig) {
62  if (applyCalib_) {
63  timingCalibrationToken_ = esConsumes<PPSTimingCalibration, PPSTimingCalibrationRcd>(
64  edm::ESInputTag(iConfig.getParameter<std::string>("timingCalibrationTag")));
65  timingCalibrationLUTToken_ = esConsumes<PPSTimingCalibrationLUT, PPSTimingCalibrationLUTRcd>();
66  }
67  produces<edm::DetSetVector<CTPPSDiamondRecHit> >();
68 }
69 
71  auto pOut = std::make_unique<edm::DetSetVector<CTPPSDiamondRecHit> >();
72 
73  // get the digi collection
74  const auto& digis = iEvent.get(digiToken_);
75 
76  if (!digis.empty()) {
77  if (applyCalib_ && calibWatcher_.check(iSetup))
79 
80  // produce the rechits collection
81  algo_.build(iSetup.getData(geometryToken_), digis, *pOut);
82  }
83 
84  iEvent.put(std::move(pOut));
85 }
86 
89 
90  desc.add<edm::InputTag>("digiTag", edm::InputTag("ctppsDiamondRawToDigi", "TimingDiamond"))
91  ->setComment("input digis collection to retrieve");
92  desc.add<std::string>("timingCalibrationTag", "GlobalTag:PPSDiamondTimingCalibration")
93  ->setComment("input tag for timing calibrations retrieval");
94  desc.add<double>("timeSliceNs", 25.0 / 1024.0)
95  ->setComment("conversion constant between HPTDC timing bin size and nanoseconds");
96  desc.add<bool>("applyCalibration", true)->setComment("switch on/off the timing calibration");
97 
98  descr.add("ctppsDiamondRecHits", desc);
99 }
100 
void build(const CTPPSGeometry &, const edm::DetSetVector< CTPPSDiamondDigi > &, edm::DetSetVector< CTPPSDiamondRecHit > &) override
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::ESGetToken< PPSTimingCalibration, PPSTimingCalibrationRcd > timingCalibrationToken_
static void fillDescriptions(edm::ConfigurationDescriptions &)
edm::EDGetTokenT< edm::DetSetVector< CTPPSDiamondDigi > > digiToken_
void produce(edm::Event &, const edm::EventSetup &) override
Event setup record containing the real (actual) geometry information.
int iEvent
Definition: GenABIO.cc:224
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
bool getData(T &iHolder) const
Definition: EventSetup.h:122
The manager class for TOTEM RP geometry.
Definition: CTPPSGeometry.h:30
void add(std::string const &label, ParameterSetDescription const &psetDescription)
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:57
void setCalibration(const PPSTimingCalibration &calib, const PPSTimingCalibrationLUT &calibLUT)
HLT enums.
edm::ESGetToken< PPSTimingCalibrationLUT, PPSTimingCalibrationLUTRcd > timingCalibrationLUTToken_
CTPPSDiamondRecHitProducerAlgorithm algo_
edm::ESGetToken< CTPPSGeometry, VeryForwardRealGeometryRecord > geometryToken_
CTPPSDiamondRecHitProducer(const edm::ParameterSet &)
edm::ESWatcher< PPSTimingCalibrationRcd > calibWatcher_
A watcher to detect timing calibration changes.
def move(src, dest)
Definition: eostools.py:511