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 */
14 using namespace edm;
15 
19 
25 
27 
28 /* C++ Headers */
29 #include <string>
30 using namespace std;
31 
32 /* ====================================================================== */
33 
36  // Set verbose output
37  debug = pset.getUntrackedParameter<bool>("debug");
38 
39  // the name of the 1D rec hits collection
40  recHits1DToken_ = consumes<DTRecHitCollection>(pset.getParameter<InputTag>("recHits1DLabel"));
41  recClusToken_ = consumes<DTRecClusterCollection>(pset.getParameter<InputTag>("recClusLabel"));
42 
43  if(debug)
44  cout << "[DTRecSegment2DExtendedProducer] Constructor called" << endl;
45 
46  produces<DTRecSegment2DCollection>();
47 
48  // Get the concrete reconstruction algo from the factory
49  theAlgo = new DTCombinatorialExtendedPatternReco(pset.getParameter<ParameterSet>("Reco2DAlgoConfig"));
50 }
51 
54  if(debug)
55  cout << "[DTRecSegment2DExtendedProducer] Destructor called" << endl;
56  delete theAlgo;
57 }
58 
59 /* Operations */
62  if(debug)
63  cout << "[DTRecSegment2DExtendedProducer] produce called" << endl;
64  // Get the DT Geometry
65  ESHandle<DTGeometry> dtGeom;
66  setup.get<MuonGeometryRecord>().get(dtGeom);
67 
68  theAlgo->setES(setup);
69 
70  // Get the 1D rechits from the event
72  event.getByToken(recHits1DToken_, allHits);
73 
74  // Get the 1D clusters from the event
76  event.getByToken(recClusToken_, dtClusters);
77  theAlgo->setClusters(vector<DTSLRecCluster>(dtClusters->begin(),
78  dtClusters->end()));
79 
80  // Create the pointer to the collection which will store the rechits
81  auto_ptr<DTRecSegment2DCollection> segments(new DTRecSegment2DCollection());
82 
83  // Iterate through all hit collections ordered by LayerId
84  DTRecHitCollection::id_iterator dtLayerIt;
85  DTSuperLayerId oldSlId;
86  for (dtLayerIt = allHits->id_begin(); dtLayerIt != allHits->id_end(); ++dtLayerIt){
87  // The layerId
88  DTLayerId layerId = (*dtLayerIt);
89  const DTSuperLayerId SLId = layerId.superlayerId();
90  if (SLId==oldSlId) continue; // I'm on the same SL as before
91  oldSlId = SLId;
92 
93  if(debug) cout <<"Reconstructing the 2D segments in "<< SLId << endl;
94 
95  const DTSuperLayer* sl = dtGeom->superLayer(SLId);
96 
97  // Get all the rec hit in the same superLayer in which layerId relies
99  allHits->get(DTRangeMapAccessor::layersBySuperLayer(SLId));
100 
101  // Fill the vector with the 1D RecHit
102  vector<DTRecHit1DPair> pairs(range.first,range.second);
103 
104  if(debug) cout << "Number of 1D-RecHit pairs " << pairs.size() << endl;
105 
106  //if(debug) cout << "Start the 2D-segments Reco "<< endl;
107  OwnVector<DTSLRecSegment2D> segs = theAlgo->reconstruct(sl, pairs);
108  if(debug) {
109  cout << "Number of Reconstructed segments: " << segs.size() << endl;
110  copy(segs.begin(), segs.end(),
111  ostream_iterator<DTSLRecSegment2D>(cout, "\n"));
112  }
113 
114  if (segs.size() > 0 )
115  segments->put(SLId, segs.begin(),segs.end());
116  }
117  event.put(segments);
118 }
119 
120 
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:248
DTSuperLayerId superlayerId() const
Return the corresponding SuperLayerId.
Definition: DTLayerId.h:59
edm::RangeMap< DTSuperLayerId, edm::OwnVector< DTSLRecSegment2D > > DTRecSegment2DCollection
iterator begin()
Definition: OwnVector.h:228
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:233
#define debug
Definition: HDRShower.cc:19
const T & get() const
Definition: EventSetup.h:55
tuple cout
Definition: gather_cfg.py:121
list pairs
sort tag files by run number
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")