CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DTRecSegment2DExtendedProducer.cc
Go to the documentation of this file.
1 
6 /* This Class Header */
8 
9 /* Collaborating Class Header */
13 using namespace edm;
14 
18 
26 
28 
29 /* C++ Headers */
30 #include <string>
31 using namespace std;
32 
33 /* ====================================================================== */
34 
37  // Set verbose output
38  debug = pset.getUntrackedParameter<bool>("debug");
39 
40  // the name of the 1D rec hits collection
41  theRecHits1DLabel = pset.getParameter<InputTag>("recHits1DLabel");
42  theRecClusLabel = pset.getParameter<InputTag>("recClusLabel");
43 
44  if(debug)
45  cout << "[DTRecSegment2DExtendedProducer] Constructor called" << endl;
46 
47  produces<DTRecSegment2DCollection>();
48 
49  // Get the concrete reconstruction algo from the factory
50  theAlgo = new DTCombinatorialExtendedPatternReco(pset.getParameter<ParameterSet>("Reco2DAlgoConfig"));
51 }
52 
55  if(debug)
56  cout << "[DTRecSegment2DExtendedProducer] Destructor called" << endl;
57  delete theAlgo;
58 }
59 
60 /* Operations */
63  if(debug)
64  cout << "[DTRecSegment2DExtendedProducer] produce called" << endl;
65  // Get the DT Geometry
66  ESHandle<DTGeometry> dtGeom;
67  setup.get<MuonGeometryRecord>().get(dtGeom);
68 
69  theAlgo->setES(setup);
70 
71  // Get the 1D rechits from the event
73  event.getByLabel(theRecHits1DLabel, allHits);
74 
75  // Get the 1D clusters from the event
77  event.getByLabel(theRecClusLabel, dtClusters);
78  theAlgo->setClusters(vector<DTSLRecCluster>(dtClusters->begin(),
79  dtClusters->end()));
80 
81  // Create the pointer to the collection which will store the rechits
82  auto_ptr<DTRecSegment2DCollection> segments(new DTRecSegment2DCollection());
83 
84  // Iterate through all hit collections ordered by LayerId
85  DTRecHitCollection::id_iterator dtLayerIt;
86  DTSuperLayerId oldSlId;
87  for (dtLayerIt = allHits->id_begin(); dtLayerIt != allHits->id_end(); ++dtLayerIt){
88  // The layerId
89  DTLayerId layerId = (*dtLayerIt);
90  const DTSuperLayerId SLId = layerId.superlayerId();
91  if (SLId==oldSlId) continue; // I'm on the same SL as before
92  oldSlId = SLId;
93 
94  if(debug) cout <<"Reconstructing the 2D segments in "<< SLId << endl;
95 
96  const DTSuperLayer* sl = dtGeom->superLayer(SLId);
97 
98  // Get all the rec hit in the same superLayer in which layerId relies
100  allHits->get(DTRangeMapAccessor::layersBySuperLayer(SLId));
101 
102  // Fill the vector with the 1D RecHit
103  vector<DTRecHit1DPair> pairs(range.first,range.second);
104 
105  if(debug) cout << "Number of 1D-RecHit pairs " << pairs.size() << endl;
106 
107  //if(debug) cout << "Start the 2D-segments Reco "<< endl;
108  OwnVector<DTSLRecSegment2D> segs = theAlgo->reconstruct(sl, pairs);
109  if(debug) {
110  cout << "Number of Reconstructed segments: " << segs.size() << endl;
111  copy(segs.begin(), segs.end(),
112  ostream_iterator<DTSLRecSegment2D>(cout, "\n"));
113  }
114 
115  if (segs.size() > 0 )
116  segments->put(SLId, segs.begin(),segs.end());
117  }
118  event.put(segments);
119 }
120 
121 
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::pair< const_iterator, const_iterator > range
iterator range
Definition: RangeMap.h:50
DTRecSegment2DExtendedProducer(const edm::ParameterSet &)
Constructor.
static std::pair< DTLayerId, DTSuperLayerIdComparator > layersBySuperLayer(DTSuperLayerId slId)
Access by SL objects written into a RangeMap by layer.
size_type size() const
Definition: OwnVector.h:247
DTSuperLayerId superlayerId() const
Return the corresponding SuperLayerId.
Definition: DTLayerId.h:59
edm::RangeMap< DTSuperLayerId, edm::OwnVector< DTSLRecSegment2D > > DTRecSegment2DCollection
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
virtual void produce(edm::Event &event, const edm::EventSetup &setup)
The method which produces the 2D-segments.
iterator end()
Definition: OwnVector.h:232
#define debug
Definition: HDRShower.cc:19
const T & get() const
Definition: EventSetup.h:55
tuple cout
Definition: gather_cfg.py:121
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")