CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
DTRecHitProducer Class Reference

#include <DTRecHitProducer.h>

Inheritance diagram for DTRecHitProducer:
edm::stream::EDProducer<>

Public Member Functions

 DTRecHitProducer (const edm::ParameterSet &)
 Constructor. More...
 
void produce (edm::Event &event, const edm::EventSetup &setup) override
 The method which produces the rechits. More...
 
 ~DTRecHitProducer () override
 Destructor. More...
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Private Attributes

const bool debug
 
edm::EDGetTokenT< DTDigiCollectionDTDigiToken_
 
std::unique_ptr< DTRecHitBaseAlgotheAlgo
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

Module for 1D DTRecHitPairs production. The concrete reconstruction algorithm is specified with the parameter "recAlgo" and must be configured with the "recAlgoConfig" parameter set.

Author
G. Cerminara

Definition at line 24 of file DTRecHitProducer.h.

Constructor & Destructor Documentation

DTRecHitProducer::DTRecHitProducer ( const edm::ParameterSet config)

Constructor.

Definition at line 28 of file DTRecHitProducer.cc.

References gather_cfg::cout, debug, DTDigiToken_, timingPdfMaker::get, and edm::ParameterSet::getParameter().

29  : // Set verbose output
30  debug(config.getUntrackedParameter<bool>("debug", false)),
31  // Get the concrete reconstruction algo from the factory
32  theAlgo{DTRecHitAlgoFactory::get()->create(config.getParameter<string>("recAlgo"),
33  config.getParameter<ParameterSet>("recAlgoConfig"))} {
34  if (debug)
35  cout << "[DTRecHitProducer] Constructor called" << endl;
36 
37  produces<DTRecHitCollection>();
38 
39  DTDigiToken_ = consumes<DTDigiCollection>(config.getParameter<InputTag>("dtDigiLabel"));
40 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< DTDigiCollection > DTDigiToken_
std::unique_ptr< DTRecHitBaseAlgo > theAlgo
DTRecHitProducer::~DTRecHitProducer ( )
override

Destructor.

Definition at line 42 of file DTRecHitProducer.cc.

References gather_cfg::cout, and debug.

42  {
43  if (debug)
44  cout << "[DTRecHitProducer] Destructor called" << endl;
45 }

Member Function Documentation

void DTRecHitProducer::produce ( edm::Event event,
const edm::EventSetup setup 
)
override

The method which produces the rechits.

Definition at line 47 of file DTRecHitProducer.cc.

References edm::OwnVector< T, P >::begin(), gather_cfg::cout, debug, DTDigiToken_, edm::OwnVector< T, P >::empty(), edm::OwnVector< T, P >::end(), edm::EventSetup::get(), DTGeometry::layer(), eostools::move(), FastTimerService_cff::range, FastTrackerRecHitMaskProducer_cfi::recHits, edm::OwnVector< T, P >::size(), and theAlgo.

47  {
48  // Get the DT Geometry
49  ESHandle<DTGeometry> dtGeom;
50  setup.get<MuonGeometryRecord>().get(dtGeom);
51 
52  // Get the digis from the event
54  event.getByToken(DTDigiToken_, digis);
55 
56  // Pass the EventSetup to the algo
57  theAlgo->setES(setup);
58 
59  // Create the pointer to the collection which will store the rechits
60  auto recHitCollection = std::make_unique<DTRecHitCollection>();
61 
62  // Iterate through all digi collections ordered by LayerId
64  for (dtLayerIt = digis->begin(); dtLayerIt != digis->end(); ++dtLayerIt) {
65  // The layerId
66  const DTLayerId& layerId = (*dtLayerIt).first;
67  // Get the GeomDet from the setup
68  const DTLayer* layer = dtGeom->layer(layerId);
69 
70  // Get the iterators over the digis associated with this LayerId
71  const DTDigiCollection::Range& range = (*dtLayerIt).second;
72 
73  OwnVector<DTRecHit1DPair> recHits = theAlgo->reconstruct(layer, layerId, range);
74 
75  if (debug)
76  cout << "Number of hits in this layer: " << recHits.size() << endl;
77  if (!recHits.empty()) //FIXME: is it really needed?
78  recHitCollection->put(layerId, recHits.begin(), recHits.end());
79  }
80 
81  event.put(std::move(recHitCollection));
82 }
edm::EDGetTokenT< DTDigiCollection > DTDigiToken_
size_type size() const
Definition: OwnVector.h:300
iterator begin()
Definition: OwnVector.h:280
bool empty() const
Definition: OwnVector.h:305
iterator end()
Definition: OwnVector.h:285
std::pair< const_iterator, const_iterator > Range
T get() const
Definition: EventSetup.h:73
const DTLayer * layer(const DTLayerId &id) const
Return a layer given its id.
Definition: DTGeometry.cc:96
def move(src, dest)
Definition: eostools.py:511
std::unique_ptr< DTRecHitBaseAlgo > theAlgo

Member Data Documentation

const bool DTRecHitProducer::debug
private
edm::EDGetTokenT<DTDigiCollection> DTRecHitProducer::DTDigiToken_
private

Definition at line 39 of file DTRecHitProducer.h.

Referenced by DTRecHitProducer(), and produce().

std::unique_ptr<DTRecHitBaseAlgo> DTRecHitProducer::theAlgo
private

Definition at line 41 of file DTRecHitProducer.h.

Referenced by produce().