CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 
34 
36 public:
38 
40 
41 private:
42  void produce(edm::Event&, const edm::EventSetup&) override;
43 
47 
50 
53 };
54 
56  : digiToken_(consumes<edm::DetSetVector<CTPPSDiamondDigi> >(iConfig.getParameter<edm::InputTag>("digiTag"))),
58  applyCalib_(iConfig.getParameter<bool>("applyCalibration")),
59  algo_(iConfig) {
60  if (applyCalib_) {
61  timingCalibrationToken_ = esConsumes<PPSTimingCalibration, PPSTimingCalibrationRcd>(
62  edm::ESInputTag(iConfig.getParameter<std::string>("timingCalibrationTag")));
63  }
64  produces<edm::DetSetVector<CTPPSDiamondRecHit> >();
65 }
66 
68  auto pOut = std::make_unique<edm::DetSetVector<CTPPSDiamondRecHit> >();
69 
70  // get the digi collection
72  iEvent.getByToken(digiToken_, digis);
73 
74  if (!digis->empty()) {
75  if (applyCalib_ && calibWatcher_.check(iSetup)) {
77  algo_.setCalibration(*hTimingCalib);
78  }
79  // get the geometry
81 
82  // produce the rechits collection
83  algo_.build(*geometry, *digis, *pOut);
84  }
85 
86  iEvent.put(std::move(pOut));
87 }
88 
91 
92  desc.add<edm::InputTag>("digiTag", edm::InputTag("ctppsDiamondRawToDigi", "TimingDiamond"))
93  ->setComment("input digis collection to retrieve");
94  desc.add<std::string>("timingCalibrationTag", "GlobalTag:PPSDiamondTimingCalibration")
95  ->setComment("input tag for timing calibrations retrieval");
96  desc.add<double>("timeSliceNs", 25.0 / 1024.0)
97  ->setComment("conversion constant between HPTDC timing bin size and nanoseconds");
98  desc.add<bool>("applyCalibration", true)->setComment("switch on/off the timing calibration");
99 
100  descr.add("ctppsDiamondRecHits", desc);
101 }
102 
void setComment(std::string const &value)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
void build(const CTPPSGeometry &, const edm::DetSetVector< CTPPSDiamondDigi > &, edm::DetSetVector< CTPPSDiamondRecHit > &)
edm::ESGetToken< PPSTimingCalibration, PPSTimingCalibrationRcd > timingCalibrationToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
static void fillDescriptions(edm::ConfigurationDescriptions &)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
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
def move
Definition: eostools.py:511
ParameterDescriptionBase * add(U const &iLabel, T const &value)
The manager class for TOTEM RP geometry.
Definition: CTPPSGeometry.h:30
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
void add(std::string const &label, ParameterSetDescription const &psetDescription)
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:57
CTPPSDiamondRecHitProducerAlgorithm algo_
edm::ESGetToken< CTPPSGeometry, VeryForwardRealGeometryRecord > geometryToken_
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:157
CTPPSDiamondRecHitProducer(const edm::ParameterSet &)
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
edm::ESWatcher< PPSTimingCalibrationRcd > calibWatcher_
A watcher to detect timing calibration changes.