CMS 3D CMS Logo

DTRecHitProducer.cc
Go to the documentation of this file.
1 
6 #include "DTRecHitProducer.h"
7 
11 
13 
19 
23 #include <string>
24 
25 using namespace edm;
26 using namespace std;
27 
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 }
41 
43  if (debug)
44  cout << "[DTRecHitProducer] Destructor called" << endl;
45 }
46 
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 }
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
electrons_cff.bool
bool
Definition: electrons_cff.py:372
funct::false
false
Definition: Factorize.h:34
DTRecHitProducer::produce
void produce(edm::Event &event, const edm::EventSetup &setup) override
The method which produces the rechits.
Definition: DTRecHitProducer.cc:47
ESHandle.h
DTRecHitCollection.h
DTLayerId.h
edm
HLT enums.
Definition: AlignableModifier.h:19
gather_cfg.cout
cout
Definition: gather_cfg.py:144
DTRecHitBaseAlgo.h
edm::Handle< DTDigiCollection >
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
config
Definition: config.py:1
debug
#define debug
Definition: HDRShower.cc:19
DTRecHitProducer.h
edm::ESHandle< DTGeometry >
DTLayerId
Definition: DTLayerId.h:12
DTLayer.h
DTGeometry.h
FastTrackerRecHitMaskProducer_cfi.recHits
recHits
Definition: FastTrackerRecHitMaskProducer_cfi.py:8
DTRecHitProducer::debug
const bool debug
Definition: DTRecHitProducer.h:37
DTRecHitProducer::theAlgo
std::unique_ptr< DTRecHitBaseAlgo > theAlgo
Definition: DTRecHitProducer.h:41
edm::ParameterSet
Definition: ParameterSet.h:36
DTGeometry::layer
const DTLayer * layer(const DTLayerId &id) const
Return a layer given its id.
Definition: DTGeometry.cc:96
Event.h
DTRecHitAlgoFactory.h
DTRecHit1DPair.h
edm::EventSetup
Definition: EventSetup.h:57
get
#define get
DTLayer
Definition: DTLayer.h:25
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
MuonDigiCollection::Range
std::pair< const_iterator, const_iterator > Range
Definition: MuonDigiCollection.h:95
DTRecHitProducer::DTRecHitProducer
DTRecHitProducer(const edm::ParameterSet &)
Constructor.
Definition: DTRecHitProducer.cc:28
DTRecHitProducer::~DTRecHitProducer
~DTRecHitProducer() override
Destructor.
Definition: DTRecHitProducer.cc:42
DTDigiCollection.h
ParameterSet.h
MuonGeometryRecord.h
event
Definition: event.py:1
DigiContainerIterator
Definition: MuonDigiCollection.h:30
edm::Event
Definition: Event.h:73
MuonGeometryRecord
Definition: MuonGeometryRecord.h:34
edm::InputTag
Definition: InputTag.h:15
DTRecHitProducer::DTDigiToken_
edm::EDGetTokenT< DTDigiCollection > DTDigiToken_
Definition: DTRecHitProducer.h:39
edm::OwnVector
Definition: OwnVector.h:24