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 
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
75  iEvent.getByToken(digiToken_, digis);
76 
77  if (!digis->empty()) {
78  if (applyCalib_ && calibWatcher_.check(iSetup)) {
81  algo_.setCalibration(*hTimingCalib, *hTimingCalibLUT);
82  }
83  // get the geometry
85 
86  // produce the rechits collection
87  algo_.build(*geometry, *digis, *pOut);
88  }
89 
90  iEvent.put(std::move(pOut));
91 }
92 
95 
96  desc.add<edm::InputTag>("digiTag", edm::InputTag("ctppsDiamondRawToDigi", "TimingDiamond"))
97  ->setComment("input digis collection to retrieve");
98  desc.add<std::string>("timingCalibrationTag", "GlobalTag:PPSDiamondTimingCalibration")
99  ->setComment("input tag for timing calibrations retrieval");
100  desc.add<double>("timeSliceNs", 25.0 / 1024.0)
101  ->setComment("conversion constant between HPTDC timing bin size and nanoseconds");
102  desc.add<bool>("applyCalibration", true)->setComment("switch on/off the timing calibration");
103 
104  descr.add("ctppsDiamondRecHits", desc);
105 }
106 
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 setCalibration(const PPSTimingCalibration &, const PPSTimingCalibrationLUT &)
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
edm::ESGetToken< PPSTimingCalibrationLUT, PPSTimingCalibrationLUTRcd > timingCalibrationLUTToken_
CTPPSDiamondRecHitProducerAlgorithm algo_
edm::ESGetToken< CTPPSGeometry, VeryForwardRealGeometryRecord > geometryToken_
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:151
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.