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 
10 
15 
18 
23 
25 
26 using namespace edm;
27 using namespace std;
28 
30  produces<DTRecSegment4DCollection>();
31 
32  // debug parameter
33  debug = pset.getUntrackedParameter<bool>("debug");
34 
35  if(debug)
36  cout << "[DTRecSegment4DProducer] Constructor called" << endl;
37 
38  // the name of the 1D rec hits collection
39  theRecHits1DLabel = pset.getParameter<InputTag>("recHits1DLabel");
40 
41  // the name of the 2D rec hits collection
42  theRecHits2DLabel = pset.getParameter<InputTag>("recHits2DLabel");
43 
44  // Get the concrete 4D-segments reconstruction algo from the factory
45  string theReco4DAlgoName = pset.getParameter<string>("Reco4DAlgoName");
46  if(debug) cout << "the Reco4D AlgoName is " << theReco4DAlgoName << endl;
47  the4DAlgo = DTRecSegment4DAlgoFactory::get()->create(theReco4DAlgoName,
48  pset.getParameter<ParameterSet>("Reco4DAlgoConfig"));
49 }
50 
53  if(debug)
54  cout << "[DTRecSegment4DProducer] Destructor called" << endl;
55  delete the4DAlgo;
56 }
57 
59 
60  // Get the 1D rechits from the event
61  Handle<DTRecHitCollection> all1DHits;
62  event.getByLabel(theRecHits1DLabel,all1DHits);
63 
64  // Get the 2D rechits from the event
66  if(the4DAlgo->wants2DSegments())
67  event.getByLabel(theRecHits2DLabel, all2DSegments);
68 
69  // Create the pointer to the collection which will store the rechits
70  auto_ptr<DTRecSegment4DCollection> segments4DCollection(new DTRecSegment4DCollection());
71 
72  // get the geometry
73  ESHandle<DTGeometry> theGeom;
74  setup.get<MuonGeometryRecord>().get(theGeom);
75 
76  // Percolate the setup
77  the4DAlgo->setES(setup);
78 
79  // Iterate over all hit collections ordered by layerId
81 
82  DTChamberId oldChId;
83 
84  for (dtLayerIt = all1DHits->id_begin(); dtLayerIt != all1DHits->id_end(); ++dtLayerIt){
85 
86  // Check the DTChamberId
87  const DTChamberId chId = (*dtLayerIt).chamberId();
88  if (chId==oldChId) continue; // I'm on the same Chamber as before
89  oldChId = chId;
90  if(debug) cout << "ChamberId: "<< chId << endl;
91  the4DAlgo->setChamber(chId);
92 
93  if(debug) cout<<"Take the DTRecHits1D and set them in the reconstructor"<<endl;
94 
95  the4DAlgo->setDTRecHit1DContainer(all1DHits);
96 
97  if(debug) cout<<"Take the DTRecSegments2D and set them in the reconstructor"<<endl;
98 
99  the4DAlgo->setDTRecSegment2DContainer(all2DSegments);
100 
101  if(debug) cout << "Start 4D-Segments Reco " << endl;
102 
103  OwnVector<DTRecSegment4D> segments4D = the4DAlgo->reconstruct();
104 
105  if(debug) {
106  cout << "Number of reconstructed 4D-segments " << segments4D.size() << endl;
107  copy(segments4D.begin(), segments4D.end(),
108  ostream_iterator<DTRecSegment4D>(cout, "\n"));
109  }
110 
111  if (segments4D.size() > 0 )
112  // convert the OwnVector into a Collection
113  segments4DCollection->put(chId, segments4D.begin(),segments4D.end());
114  }
115  // Load the output in the Event
116  event.put(segments4DCollection);
117 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
virtual ~DTRecSegment4DProducer()
Destructor.
size_type size() const
Definition: OwnVector.h:262
identifier iterator
Definition: RangeMap.h:139
iterator begin()
Definition: OwnVector.h:236
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
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:355
iterator end()
Definition: OwnVector.h:243
const T & get() const
Definition: EventSetup.h:55
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:41
#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