CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DTRecHitProducer.cc
Go to the documentation of this file.
1 
6 #include "DTRecHitProducer.h"
7 
8 
12 
14 
20 
24 #include <string>
25 
26 
27 using namespace edm;
28 using namespace std;
29 
30 
31 
32 
34  // Set verbose output
35  debug(config.getUntrackedParameter<bool>("debug", false))
36 {
37  if(debug)
38  cout << "[DTRecHitProducer] Constructor called" << endl;
39 
40  produces<DTRecHitCollection>();
41 
42  DTDigiToken_ = consumes<DTDigiCollection>(config.getParameter<InputTag>("dtDigiLabel"));
43 
44  // Get the concrete reconstruction algo from the factory
45  string theAlgoName = config.getParameter<string>("recAlgo");
46  theAlgo = DTRecHitAlgoFactory::get()->create(theAlgoName,
47  config.getParameter<ParameterSet>("recAlgoConfig"));
48 }
49 
51  if(debug)
52  cout << "[DTRecHitProducer] Destructor called" << endl;
53  delete theAlgo;
54 }
55 
56 
57 
59  // Get the DT Geometry
60  ESHandle<DTGeometry> dtGeom;
61  setup.get<MuonGeometryRecord>().get(dtGeom);
62 
63  // Get the digis from the event
65  event.getByToken(DTDigiToken_, digis);
66 
67  // Pass the EventSetup to the algo
68  theAlgo->setES(setup);
69 
70  // Create the pointer to the collection which will store the rechits
71  auto_ptr<DTRecHitCollection> recHitCollection(new DTRecHitCollection());
72 
73 
74  // Iterate through all digi collections ordered by LayerId
76  for (dtLayerIt = digis->begin();
77  dtLayerIt != digis->end();
78  ++dtLayerIt){
79  // The layerId
80  const DTLayerId& layerId = (*dtLayerIt).first;
81  // Get the GeomDet from the setup
82  const DTLayer* layer = dtGeom->layer(layerId);
83 
84  // Get the iterators over the digis associated with this LayerId
85  const DTDigiCollection::Range& range = (*dtLayerIt).second;
86 
88  theAlgo->reconstruct(layer, layerId, range);
89 
90  if(debug)
91  cout << "Number of hits in this layer: " << recHits.size() << endl;
92  if(recHits.size() > 0) //FIXME: is it really needed?
93  recHitCollection->put(layerId, recHits.begin(), recHits.end());
94  }
95 
96  event.put(recHitCollection);
97 }
T getParameter(std::string const &) const
edm::RangeMap< DTLayerId, edm::OwnVector< DTRecHit1DPair > > DTRecHitCollection
virtual edm::OwnVector< DTRecHit1DPair > reconstruct(const DTLayer *layer, const DTLayerId &layerId, const DTDigiCollection::Range &digiRange)
Build all hits in the range associated to the layerId, at the 1st step.
edm::EDGetTokenT< DTDigiCollection > DTDigiToken_
size_type size() const
Definition: OwnVector.h:264
iterator begin()
Definition: OwnVector.h:244
virtual void setES(const edm::EventSetup &setup)=0
Pass the Event Setup to the algo at each event.
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
DTRecHitBaseAlgo * theAlgo
iterator end()
Definition: OwnVector.h:249
#define debug
Definition: HDRShower.cc:19
DTRecHitProducer(const edm::ParameterSet &)
Constructor.
const T & get() const
Definition: EventSetup.h:56
virtual ~DTRecHitProducer()
Destructor.
std::pair< const_iterator, const_iterator > Range
tuple cout
Definition: gather_cfg.py:145
volatile std::atomic< bool > shutdown_flag false
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
T get(const Candidate &c)
Definition: component.h:55
virtual void produce(edm::Event &event, const edm::EventSetup &setup)
The method which produces the rechits.