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