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 hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () 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 33 of file DTRecHitProducer.cc.

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

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

Destructor.

Definition at line 48 of file DTRecHitProducer.cc.

References gather_cfg::cout, and debug.

48  {
49  if(debug)
50  cout << "[DTRecHitProducer] Destructor called" << endl;
51 }

Member Function Documentation

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

The method which produces the rechits.

Definition at line 55 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(), edm::OwnVector< T, P >::size(), and theAlgo.

55  {
56  // Get the DT Geometry
57  ESHandle<DTGeometry> dtGeom;
58  setup.get<MuonGeometryRecord>().get(dtGeom);
59 
60  // Get the digis from the event
62  event.getByToken(DTDigiToken_, digis);
63 
64  // Pass the EventSetup to the algo
65  theAlgo->setES(setup);
66 
67  // Create the pointer to the collection which will store the rechits
68  auto recHitCollection = std::make_unique<DTRecHitCollection>();
69 
70 
71  // Iterate through all digi collections ordered by LayerId
73  for (dtLayerIt = digis->begin();
74  dtLayerIt != digis->end();
75  ++dtLayerIt){
76  // The layerId
77  const DTLayerId& layerId = (*dtLayerIt).first;
78  // Get the GeomDet from the setup
79  const DTLayer* layer = dtGeom->layer(layerId);
80 
81  // Get the iterators over the digis associated with this LayerId
82  const DTDigiCollection::Range& range = (*dtLayerIt).second;
83 
85  theAlgo->reconstruct(layer, layerId, range);
86 
87  if(debug)
88  cout << "Number of hits in this layer: " << recHits.size() << endl;
89  if(!recHits.empty()) //FIXME: is it really needed?
90  recHitCollection->put(layerId, recHits.begin(), recHits.end());
91  }
92 
93  event.put(std::move(recHitCollection));
94 }
edm::EDGetTokenT< DTDigiCollection > DTDigiToken_
size_type size() const
Definition: OwnVector.h:264
iterator begin()
Definition: OwnVector.h:244
bool empty() const
Definition: OwnVector.h:269
iterator end()
Definition: OwnVector.h:249
T get() const
Definition: EventSetup.h:71
std::pair< const_iterator, const_iterator > Range
const DTLayer * layer(const DTLayerId &id) const
Return a layer given its id.
Definition: DTGeometry.cc:127
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().