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
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Private Attributes

const bool debug
 
edm::EDGetTokenT< DTDigiCollectionDTDigiToken_
 
edm::ESGetToken< DTGeometry, MuonGeometryRecorddtGeomToken_
 
std::unique_ptr< DTRecHitBaseAlgotheAlgo
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::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 26 of file DTRecHitProducer.h.

Constructor & Destructor Documentation

◆ DTRecHitProducer()

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

Constructor.

Definition at line 29 of file DTRecHitProducer.cc.

References get.

30  : // Set verbose output
31  debug(config.getUntrackedParameter<bool>("debug", false)),
33  // Get the concrete reconstruction algo from the factory
34  theAlgo{DTRecHitAlgoFactory::get()->create(config.getParameter<string>("recAlgo"),
35  config.getParameter<ParameterSet>("recAlgoConfig"),
36  consumesCollector())} {
37  if (debug)
38  cout << "[DTRecHitProducer] Constructor called" << endl;
39 
40  produces<DTRecHitCollection>();
41 
42  DTDigiToken_ = consumes<DTDigiCollection>(config.getParameter<InputTag>("dtDigiLabel"));
43 }
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
edm::EDGetTokenT< DTDigiCollection > DTDigiToken_
Definition: config.py:1
#define get
std::unique_ptr< DTRecHitBaseAlgo > theAlgo
edm::ESGetToken< DTGeometry, MuonGeometryRecord > dtGeomToken_

◆ ~DTRecHitProducer()

DTRecHitProducer::~DTRecHitProducer ( )
override

Destructor.

Definition at line 45 of file DTRecHitProducer.cc.

References gather_cfg::cout, and debug.

45  {
46  if (debug)
47  cout << "[DTRecHitProducer] Destructor called" << endl;
48 }

Member Function Documentation

◆ produce()

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

The method which produces the rechits.

Definition at line 50 of file DTRecHitProducer.cc.

References gather_cfg::cout, debug, DTDigiToken_, dtGeomToken_, nano_mu_digi_cff::layer, DTGeometry::layer(), eostools::move(), isotrackApplyRegressor::range, FastTrackerRecHitMaskProducer_cfi::recHits, singleTopDQM_cfi::setup, and theAlgo.

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

Member Data Documentation

◆ debug

const bool DTRecHitProducer::debug
private

◆ DTDigiToken_

edm::EDGetTokenT<DTDigiCollection> DTRecHitProducer::DTDigiToken_
private

Definition at line 41 of file DTRecHitProducer.h.

Referenced by produce().

◆ dtGeomToken_

edm::ESGetToken<DTGeometry, MuonGeometryRecord> DTRecHitProducer::dtGeomToken_
private

Definition at line 42 of file DTRecHitProducer.h.

Referenced by produce().

◆ theAlgo

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

Definition at line 44 of file DTRecHitProducer.h.

Referenced by produce().