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 
8 /* This Class Header */
10 
11 /* Collaborating Class Header */
15 using namespace edm;
16 
20 
28 
30 
31 /* C++ Headers */
32 #include <string>
33 using namespace std;
34 
35 /* ====================================================================== */
36 
39  // Set verbose output
40  debug = pset.getUntrackedParameter<bool>("debug");
41 
42  // the name of the 1D rec hits collection
43  theRecHits1DLabel = pset.getParameter<InputTag>("recHits1DLabel");
44  theRecClusLabel = pset.getParameter<InputTag>("recClusLabel");
45 
46  if(debug)
47  cout << "[DTRecSegment2DExtendedProducer] Constructor called" << endl;
48 
49  produces<DTRecSegment2DCollection>();
50 
51  // Get the concrete reconstruction algo from the factory
52  theAlgo = new DTCombinatorialExtendedPatternReco(pset.getParameter<ParameterSet>("Reco2DAlgoConfig"));
53 }
54 
57  if(debug)
58  cout << "[DTRecSegment2DExtendedProducer] Destructor called" << endl;
59  delete theAlgo;
60 }
61 
62 /* Operations */
65  if(debug)
66  cout << "[DTRecSegment2DExtendedProducer] produce called" << endl;
67  // Get the DT Geometry
68  ESHandle<DTGeometry> dtGeom;
69  setup.get<MuonGeometryRecord>().get(dtGeom);
70 
71  theAlgo->setES(setup);
72 
73  // Get the 1D rechits from the event
75  event.getByLabel(theRecHits1DLabel, allHits);
76 
77  // Get the 1D clusters from the event
79  event.getByLabel(theRecClusLabel, dtClusters);
80  theAlgo->setClusters(vector<DTSLRecCluster>(dtClusters->begin(),
81  dtClusters->end()));
82 
83  // Create the pointer to the collection which will store the rechits
84  auto_ptr<DTRecSegment2DCollection> segments(new DTRecSegment2DCollection());
85 
86  // Iterate through all hit collections ordered by LayerId
88  DTSuperLayerId oldSlId;
89  for (dtLayerIt = allHits->id_begin(); dtLayerIt != allHits->id_end(); ++dtLayerIt){
90  // The layerId
91  DTLayerId layerId = (*dtLayerIt);
92  const DTSuperLayerId SLId = layerId.superlayerId();
93  if (SLId==oldSlId) continue; // I'm on the same SL as before
94  oldSlId = SLId;
95 
96  if(debug) cout <<"Reconstructing the 2D segments in "<< SLId << endl;
97 
98  const DTSuperLayer* sl = dtGeom->superLayer(SLId);
99 
100  // Get all the rec hit in the same superLayer in which layerId relies
102  allHits->get(DTRangeMapAccessor::layersBySuperLayer(SLId));
103 
104  // Fill the vector with the 1D RecHit
105  vector<DTRecHit1DPair> pairs(range.first,range.second);
106 
107  if(debug) cout << "Number of 1D-RecHit pairs " << pairs.size() << endl;
108 
109  //if(debug) cout << "Start the 2D-segments Reco "<< endl;
110  OwnVector<DTSLRecSegment2D> segs = theAlgo->reconstruct(sl, pairs);
111  if(debug) {
112  cout << "Number of Reconstructed segments: " << segs.size() << endl;
113  copy(segs.begin(), segs.end(),
114  ostream_iterator<DTSLRecSegment2D>(cout, "\n"));
115  }
116 
117  if (segs.size() > 0 )
118  segments->put(SLId, segs.begin(),segs.end());
119  }
120  event.put(segments);
121 }
122 
123 
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:52
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
identifier iterator
Definition: RangeMap.h:138
DTSuperLayerId superlayerId() const
Return the corresponding SuperLayerId.
Definition: DTLayerId.h:61
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
const T & get() const
Definition: EventSetup.h:55
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="")