CMS 3D CMS Logo

ME0RecHitProducer.cc
Go to the documentation of this file.
1 
8 #include "ME0RecHitProducer.h"
9 
10 
12 
13  produces<ME0RecHitCollection>();
14 
15  m_token = consumes<ME0DigiPreRecoCollection>( config.getParameter<edm::InputTag>("me0DigiLabel") );
16 
17 
18  // Get the concrete reconstruction algo from the factory
19 
20  std::string theAlgoName = config.getParameter<std::string>("recAlgo");
21  theAlgo = ME0RecHitAlgoFactory::get()->create(theAlgoName,
22  config.getParameter<edm::ParameterSet>("recAlgoConfig"));
23 }
24 
25 
27  delete theAlgo;
28 }
29 
30 
31 
33 }
34 
35 
36 
38 
39  // Get the ME0 Geometry
41  setup.get<MuonGeometryRecord>().get(me0Geom);
42 
43  // Get the digis from the event
44 
46  event.getByToken(m_token,digis);
47 
48  // Pass the EventSetup to the algo
49 
50  theAlgo->setES(setup);
51 
52  // Create the pointer to the collection which will store the rechits
53 
54  auto recHitCollection = std::make_unique<ME0RecHitCollection>();
55 
56  // Iterate through all digi collections ordered by LayerId
57 
59  for (me0dgIt = digis->begin(); me0dgIt != digis->end();
60  ++me0dgIt){
61 
62  // The layerId
63  const ME0DetId& me0Id = (*me0dgIt).first;
64 
65 
66  // Get the iterators over the digis associated with this LayerId
67  const ME0DigiPreRecoCollection::Range& range = (*me0dgIt).second;
68 
69  // Call the reconstruction algorithm
70 
72  theAlgo->reconstruct(me0Id, range);
73 
74  if(!recHits.empty())
75  recHitCollection->put(me0Id, recHits.begin(), recHits.end());
76  }
77 
78  event.put(std::move(recHitCollection));
79 
80 }
81 
T getParameter(std::string const &) const
virtual void setES(const edm::EventSetup &setup)=0
Pass the Event Setup to the algo at each event.
def setup(process, global_tag, zero_tesla=False)
Definition: GeneralSetup.py:1
Definition: config.py:1
edm::EDGetTokenT< ME0DigiPreRecoCollection > m_token
iterator begin()
Definition: OwnVector.h:244
void produce(edm::Event &event, const edm::EventSetup &setup) override
The method which produces the rechits.
bool empty() const
Definition: OwnVector.h:269
ME0RecHitBaseAlgo * theAlgo
virtual edm::OwnVector< ME0RecHit > reconstruct(const ME0DetId &me0Id, const ME0DigiPreRecoCollection::Range &digiRange)
Build all hits in the range associated to the me0Id, at the 1st step.
iterator end()
Definition: OwnVector.h:249
const T & get() const
Definition: EventSetup.h:59
~ME0RecHitProducer() override
Destructor.
std::pair< const_iterator, const_iterator > Range
ME0RecHitProducer(const edm::ParameterSet &config)
Constructor.
void beginRun(const edm::Run &, const edm::EventSetup &) override
def move(src, dest)
Definition: eostools.py:510
T get(const Candidate &c)
Definition: component.h:55
Definition: event.py:1
Definition: Run.h:43