CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DTRecSegment4DProducer.cc
Go to the documentation of this file.
1 
8 
14 
17 
20 
22 
23 using namespace edm;
24 using namespace std;
25 
27  produces<DTRecSegment4DCollection>();
28 
29  // debug parameter
30  debug = pset.getUntrackedParameter<bool>("debug", false);
31 
32  if(debug)
33  cout << "[DTRecSegment4DProducer] Constructor called" << endl;
34 
35  // the name of the 1D rec hits collection
36  recHits1DToken_ = consumes<DTRecHitCollection>(pset.getParameter<InputTag>("recHits1DLabel"));
37 
38  // the name of the 2D rec hits collection
39  recHits2DToken_ = consumes<DTRecSegment2DCollection>(pset.getParameter<InputTag>("recHits2DLabel"));
40 
41  // Get the concrete 4D-segments reconstruction algo from the factory
42  string theReco4DAlgoName = pset.getParameter<string>("Reco4DAlgoName");
43  if(debug) cout << "the Reco4D AlgoName is " << theReco4DAlgoName << endl;
44  the4DAlgo = DTRecSegment4DAlgoFactory::get()->create(theReco4DAlgoName,
45  pset.getParameter<ParameterSet>("Reco4DAlgoConfig"));
46 }
47 
50  if(debug)
51  cout << "[DTRecSegment4DProducer] Destructor called" << endl;
52  delete the4DAlgo;
53 }
54 
56 
57  // Get the 1D rechits from the event
58  Handle<DTRecHitCollection> all1DHits;
59  event.getByToken(recHits1DToken_, all1DHits);
60 
61  // Get the 2D rechits from the event
63  if(the4DAlgo->wants2DSegments())
64  event.getByToken(recHits2DToken_, all2DSegments);
65 
66  // Create the pointer to the collection which will store the rechits
67  auto_ptr<DTRecSegment4DCollection> segments4DCollection(new DTRecSegment4DCollection());
68 
69  // get the geometry
70  ESHandle<DTGeometry> theGeom;
71  setup.get<MuonGeometryRecord>().get(theGeom);
72 
73  // Percolate the setup
74  the4DAlgo->setES(setup);
75 
76  // Iterate over all hit collections ordered by layerId
77  DTRecHitCollection::id_iterator dtLayerIt;
78 
79  DTChamberId oldChId;
80 
81  for (dtLayerIt = all1DHits->id_begin(); dtLayerIt != all1DHits->id_end(); ++dtLayerIt){
82 
83  // Check the DTChamberId
84  const DTChamberId chId = (*dtLayerIt).chamberId();
85  if (chId==oldChId) continue; // I'm on the same Chamber as before
86  oldChId = chId;
87  if(debug) cout << "ChamberId: "<< chId << endl;
88  the4DAlgo->setChamber(chId);
89 
90  if(debug) cout<<"Take the DTRecHits1D and set them in the reconstructor"<<endl;
91 
92  the4DAlgo->setDTRecHit1DContainer(all1DHits);
93 
94  if(debug) cout<<"Take the DTRecSegments2D and set them in the reconstructor"<<endl;
95 
96  the4DAlgo->setDTRecSegment2DContainer(all2DSegments);
97 
98  if(debug) cout << "Start 4D-Segments Reco " << endl;
99 
100  OwnVector<DTRecSegment4D> segments4D = the4DAlgo->reconstruct();
101 
102  if(debug) {
103  cout << "Number of reconstructed 4D-segments " << segments4D.size() << endl;
104  copy(segments4D.begin(), segments4D.end(),
105  ostream_iterator<DTRecSegment4D>(cout, "\n"));
106  }
107 
108  if (segments4D.size() > 0 )
109  // convert the OwnVector into a Collection
110  segments4DCollection->put(chId, segments4D.begin(),segments4D.end());
111  }
112  // Load the output in the Event
113  event.put(segments4DCollection);
114 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
virtual ~DTRecSegment4DProducer()
Destructor.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
size_type size() const
Definition: OwnVector.h:264
iterator begin()
Definition: OwnVector.h:244
DTRecSegment4DProducer(const edm::ParameterSet &)
Constructor.
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:249
#define debug
Definition: HDRShower.cc:19
const T & get() const
Definition: EventSetup.h:56
virtual void produce(edm::Event &event, const edm::EventSetup &setup)
The method which produces the 4D rec segments.
edm::RangeMap< DTChamberId, edm::OwnVector< DTRecSegment4D > > DTRecSegment4DCollection
tuple cout
Definition: gather_cfg.py:145
T get(const Candidate &c)
Definition: component.h:55