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 
8 #include "DTRecHitProducer.h"
9 
10 
14 
16 
22 
26 #include <string>
27 
28 
29 using namespace edm;
30 using namespace std;
31 
32 
33 
34 
36  // Set verbose output
37  debug = config.getUntrackedParameter<bool>("debug", false);
38 
39  if(debug)
40  cout << "[DTRecHitProducer] Constructor called" << endl;
41 
42  produces<DTRecHitCollection>();
43 
44  theDTDigiLabel = config.getParameter<InputTag>("dtDigiLabel");
45 
46  // Get the concrete reconstruction algo from the factory
47  string theAlgoName = config.getParameter<string>("recAlgo");
48  theAlgo = DTRecHitAlgoFactory::get()->create(theAlgoName,
49  config.getParameter<ParameterSet>("recAlgoConfig"));
50 }
51 
53  if(debug)
54  cout << "[DTRecHitProducer] Destructor called" << endl;
55  delete theAlgo;
56 }
57 
58 
59 
61  // Get the DT Geometry
62  ESHandle<DTGeometry> dtGeom;
63  setup.get<MuonGeometryRecord>().get(dtGeom);
64 
65  // Get the digis from the event
67  event.getByLabel(theDTDigiLabel, digis);
68 
69  // Pass the EventSetup to the algo
70  theAlgo->setES(setup);
71 
72  // Create the pointer to the collection which will store the rechits
73  auto_ptr<DTRecHitCollection> recHitCollection(new DTRecHitCollection());
74 
75 
76  // Iterate through all digi collections ordered by LayerId
78  for (dtLayerIt = digis->begin();
79  dtLayerIt != digis->end();
80  ++dtLayerIt){
81  // The layerId
82  const DTLayerId& layerId = (*dtLayerIt).first;
83  // Get the GeomDet from the setup
84  const DTLayer* layer = dtGeom->layer(layerId);
85 
86  // Get the iterators over the digis associated with this LayerId
87  const DTDigiCollection::Range& range = (*dtLayerIt).second;
88 
90  theAlgo->reconstruct(layer, layerId, range);
91 
92  if(debug)
93  cout << "Number of hits in this layer: " << recHits.size() << endl;
94  if(recHits.size() > 0) //FIXME: is it really needed?
95  recHitCollection->put(layerId, recHits.begin(), recHits.end());
96  }
97 
98  event.put(recHitCollection);
99 }
100 
101 
102 
103 bool
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::RangeMap< DTLayerId, edm::OwnVector< DTRecHit1DPair > > DTRecHitCollection
size_type size() const
Definition: OwnVector.h:247
iterator begin()
Definition: OwnVector.h:227
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
iterator end()
Definition: OwnVector.h:232
DTRecHitProducer(const edm::ParameterSet &)
Constructor.
const T & get() const
Definition: EventSetup.h:55
virtual ~DTRecHitProducer()
Destructor.
std::pair< const_iterator, const_iterator > Range
tuple cout
Definition: gather_cfg.py:121
#define debug
Definition: MEtoEDMFormat.h:34
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
T get(const Candidate &c)
Definition: component.h:56
virtual void produce(edm::Event &event, const edm::EventSetup &setup)
The method which produces the rechits.