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 {
36  public:
38 
40 
41  private:
42  void produce( edm::Event&, const edm::EventSetup& ) override;
43 
45 
50 
52 };
53 
55  digiToken_( consumes<edm::DetSetVector<CTPPSDiamondDigi> >( iConfig.getParameter<edm::InputTag>( "digiTag" ) ) ),
56  timingCalibrationTag_( iConfig.getParameter<std::string>( "timingCalibrationTag" ) ),
57  algo_( iConfig )
58 {
59  produces<edm::DetSetVector<CTPPSDiamondRecHit> >();
60 }
61 
62 void
64 {
65  auto pOut = std::make_unique<edm::DetSetVector<CTPPSDiamondRecHit> >();
66 
67  // get the digi collection
69  iEvent.getByToken( digiToken_, digis );
70 
71  if ( !digis->empty() ) {
72  if ( calibWatcher_.check( iSetup ) ) {
74  iSetup.get<PPSTimingCalibrationRcd>().get( timingCalibrationTag_, hTimingCalib );
75  algo_.setCalibration( *hTimingCalib );
76  }
77  // get the geometry
79  iSetup.get<VeryForwardRealGeometryRecord>().get( geometry );
80 
81  // produce the rechits collection
82  algo_.build( *geometry, *digis, *pOut );
83  }
84 
85  iEvent.put( std::move( pOut ) );
86 }
87 
88 void
90 {
92 
93  desc.add<edm::InputTag>( "digiTag", edm::InputTag( "ctppsDiamondRawToDigi", "TimingDiamond" ) )
94  ->setComment( "input digis collection to retrieve" );
95  desc.add<std::string>( "timingCalibrationTag", "GlobalTag:PPSDiamondTimingCalibration" )
96  ->setComment( "input tag for timing calibrations retrieval" );
97  desc.add<double>( "timeSliceNs", 25.0/1024.0 )
98  ->setComment( "conversion constant between HPTDC timing bin size and nanoseconds" );
99  desc.add<int>( "timeShift", 0 ) // to be determined at calibration level, will be replaced by a map channel id -> time shift
100  ->setComment( "overall time offset to apply on all hits in all channels" );
101 
102  descr.add( "ctppsDiamondRecHits", desc );
103 }
104 
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:125
void build(const CTPPSGeometry &, const edm::DetSetVector< CTPPSDiamondDigi > &, edm::DetSetVector< CTPPSDiamondRecHit > &)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
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.
EventSetup record for TOTEM/PPS timing calibration information.
int iEvent
Definition: GenABIO.cc:224
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:52
ESHandle< TrackerGeometry > geometry
HLT enums.
T get() const
Definition: EventSetup.h:71
CTPPSDiamondRecHitProducerAlgorithm algo_
CTPPSDiamondRecHitProducer(const edm::ParameterSet &)
edm::ESWatcher< PPSTimingCalibrationRcd > calibWatcher_
A watcher to detect timing calibration changes.
def move(src, dest)
Definition: eostools.py:511
edm::ESInputTag timingCalibrationTag_
Label to timing calibration tag.