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 
21 
24 
28 
30 
33 
35 public:
37 
39 
40 private:
41  void produce(edm::Event&, const edm::EventSetup&) override;
42 
44 
49 
50  bool applyCalib_;
52 };
53 
55  : digiToken_(consumes<edm::DetSetVector<CTPPSDiamondDigi> >(iConfig.getParameter<edm::InputTag>("digiTag"))),
56  timingCalibrationTag_(iConfig.getParameter<std::string>("timingCalibrationTag")),
57  applyCalib_(iConfig.getParameter<bool>("applyCalibration")),
58  algo_(iConfig) {
59  produces<edm::DetSetVector<CTPPSDiamondRecHit> >();
60 }
61 
63  auto pOut = std::make_unique<edm::DetSetVector<CTPPSDiamondRecHit> >();
64 
65  // get the digi collection
67  iEvent.getByToken(digiToken_, digis);
68 
69  if (!digis->empty()) {
70  if (applyCalib_ && calibWatcher_.check(iSetup)) {
72  iSetup.get<PPSTimingCalibrationRcd>().get(timingCalibrationTag_, hTimingCalib);
73  algo_.setCalibration(*hTimingCalib);
74  }
75  // get the geometry
78 
79  // produce the rechits collection
80  algo_.build(*geometry, *digis, *pOut);
81  }
82 
83  iEvent.put(std::move(pOut));
84 }
85 
88 
89  desc.add<edm::InputTag>("digiTag", edm::InputTag("ctppsDiamondRawToDigi", "TimingDiamond"))
90  ->setComment("input digis collection to retrieve");
91  desc.add<std::string>("timingCalibrationTag", "GlobalTag:PPSDiamondTimingCalibration")
92  ->setComment("input tag for timing calibrations retrieval");
93  desc.add<double>("timeSliceNs", 25.0 / 1024.0)
94  ->setComment("conversion constant between HPTDC timing bin size and nanoseconds");
95  desc.add<bool>("applyCalibration", true)->setComment("switch on/off the timing calibration");
96 
97  descr.add("ctppsDiamondRecHits", desc);
98 }
99 
edm::ESWatcher::check
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:52
VeryForwardRealGeometryRecord
Event setup record containing the real (actual) geometry information.
Definition: VeryForwardRealGeometryRecord.h:22
geometry
ESHandle< TrackerGeometry > geometry
Definition: TkLasBeamFitter.cc:200
electrons_cff.bool
bool
Definition: electrons_cff.py:372
edm::ESInputTag
Definition: ESInputTag.h:87
edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
CTPPSDiamondRecHitProducer::calibWatcher_
edm::ESWatcher< PPSTimingCalibrationRcd > calibWatcher_
A watcher to detect timing calibration changes.
Definition: CTPPSDiamondRecHitProducer.cc:54
edm::ESWatcher< PPSTimingCalibrationRcd >
ESHandle.h
CTPPSDiamondRecHitProducer::produce
void produce(edm::Event &, const edm::EventSetup &) override
Definition: CTPPSDiamondRecHitProducer.cc:62
edm::EDGetTokenT
Definition: EDGetToken.h:33
edm
HLT enums.
Definition: AlignableModifier.h:19
CTPPSDiamondRecHitProducerAlgorithm::build
void build(const CTPPSGeometry &, const edm::DetSetVector< CTPPSDiamondDigi > &, edm::DetSetVector< CTPPSDiamondRecHit > &)
Definition: CTPPSDiamondRecHitProducerAlgorithm.cc:22
geometry
Definition: geometry.py:1
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
CTPPSDiamondDigi
Definition: CTPPSDiamondDigi.h:16
EDProducer.h
CTPPSDiamondRecHitProducer::digiToken_
edm::EDGetTokenT< edm::DetSetVector< CTPPSDiamondDigi > > digiToken_
Definition: CTPPSDiamondRecHitProducer.cc:49
edm::Handle
Definition: AssociativeIterator.h:50
CTPPSDiamondRecHitProducer::applyCalib_
bool applyCalib_
Definition: CTPPSDiamondRecHitProducer.cc:56
MakerMacros.h
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
CTPPSDiamondRecHitProducer::timingCalibrationTag_
edm::ESInputTag timingCalibrationTag_
Label to timing calibration tag.
Definition: CTPPSDiamondRecHitProducer.cc:52
CTPPSDiamondDigi.h
CTPPSDiamondRecHitProducerAlgorithm.h
CTPPSDiamondRecHit.h
edm::ESHandle
Definition: DTSurvey.h:22
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
CTPPSDiamondDetId.h
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
edm::ParameterSet
Definition: ParameterSet.h:36
CTPPSDiamondRecHitProducerAlgorithm::setCalibration
void setCalibration(const PPSTimingCalibration &)
Definition: CTPPSDiamondRecHitProducerAlgorithm.cc:17
Event.h
CTPPSDiamondRecHitProducerAlgorithm
Definition: CTPPSDiamondRecHitProducerAlgorithm.h:25
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::stream::EDProducer
Definition: EDProducer.h:38
PPSTimingCalibrationRcd
EventSetup record for TOTEM/PPS timing calibration information.
Definition: PPSTimingCalibrationRcd.h:14
edm::EventSetup
Definition: EventSetup.h:57
DetSetVector.h
CTPPSDiamondRecHitProducer
Definition: CTPPSDiamondRecHitProducer.cc:34
get
#define get
VeryForwardRealGeometryRecord.h
CTPPSDiamondRecHitProducer::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &)
Definition: CTPPSDiamondRecHitProducer.cc:86
CTPPSDiamondRecHitProducer::algo_
CTPPSDiamondRecHitProducerAlgorithm algo_
Definition: CTPPSDiamondRecHitProducer.cc:57
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
Frameworkfwd.h
ESWatcher.h
CTPPSDiamondRecHitProducer::CTPPSDiamondRecHitProducer
CTPPSDiamondRecHitProducer(const edm::ParameterSet &)
Definition: CTPPSDiamondRecHitProducer.cc:54
PPSTimingCalibrationRcd.h
DetSet.h
ParameterSet.h
edm::ParameterDescriptionNode::setComment
void setComment(std::string const &value)
Definition: ParameterDescriptionNode.cc:106
edm::Event
Definition: Event.h:73
StreamID.h
edm::InputTag
Definition: InputTag.h:15