CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DTRecSegment2DProducer.cc
Go to the documentation of this file.
1 
9 /* This Class Header */
11 
12 /* Collaborating Class Header */
16 using namespace edm;
17 
21 
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 
45  if(debug)
46  cout << "[DTRecSegment2DProducer] Constructor called" << endl;
47 
48  produces<DTRecSegment2DCollection>();
49 
50  // Get the concrete reconstruction algo from the factory
51  string theAlgoName = pset.getParameter<string>("Reco2DAlgoName");
52  if(debug) cout << "the Reco2D AlgoName is " << theAlgoName << endl;
53  theAlgo = DTRecSegment2DAlgoFactory::get()->create(theAlgoName,
54  pset.getParameter<ParameterSet>("Reco2DAlgoConfig"));
55 }
56 
59  if(debug)
60  cout << "[DTRecSegment2DProducer] Destructor called" << endl;
61  delete theAlgo;
62 }
63 
64 /* Operations */
67  if(debug)
68  cout << "[DTRecSegment2DProducer] produce called" << endl;
69  // Get the DT Geometry
70  ESHandle<DTGeometry> dtGeom;
71  setup.get<MuonGeometryRecord>().get(dtGeom);
72 
73  theAlgo->setES(setup);
74 
75  // Get the 1D rechits from the event
77  event.getByLabel(theRecHits1DLabel, allHits);
78 
79  // Create the pointer to the collection which will store the rechits
80  auto_ptr<DTRecSegment2DCollection> segments(new DTRecSegment2DCollection());
81 
82  // Iterate through all hit collections ordered by LayerId
84  DTSuperLayerId oldSlId;
85  for (dtLayerIt = allHits->id_begin(); dtLayerIt != allHits->id_end(); ++dtLayerIt){
86  // The layerId
87  DTLayerId layerId = (*dtLayerIt);
88  const DTSuperLayerId SLId = layerId.superlayerId();
89  if (SLId==oldSlId) continue; // I'm on the same SL as before
90  oldSlId = SLId;
91 
92  if(debug) cout <<"Reconstructing the 2D segments in "<< SLId << endl;
93 
94  const DTSuperLayer* sl = dtGeom->superLayer(SLId);
95 
96  // Get all the rec hit in the same superLayer in which layerId relies
98  allHits->get(DTRangeMapAccessor::layersBySuperLayer(SLId));
99 
100  // Fill the vector with the 1D RecHit
101  vector<DTRecHit1DPair> pairs(range.first,range.second);
102 
103  if(debug) cout << "Number of 1D-RecHit pairs " << pairs.size() << endl;
104 
105  if(debug) cout << "Start the 2D-segments Reco "<< endl;
106  OwnVector<DTSLRecSegment2D> segs = theAlgo->reconstruct(sl, pairs);
107  if(debug) cout << "Number of Reconstructed segments: " << segs.size() << endl;
108 
109  if (segs.size() > 0 )
110  segments->put(SLId, segs.begin(),segs.end());
111  }
112  event.put(segments);
113 }
114 
115 
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:53
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:262
identifier iterator
Definition: RangeMap.h:139
DTSuperLayerId superlayerId() const
Return the corresponding SuperLayerId.
Definition: DTLayerId.h:61
edm::RangeMap< DTSuperLayerId, edm::OwnVector< DTSLRecSegment2D > > DTRecSegment2DCollection
iterator begin()
Definition: OwnVector.h:236
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
iterator end()
Definition: OwnVector.h:243
virtual ~DTRecSegment2DProducer()
Destructor.
const T & get() const
Definition: EventSetup.h:55
tuple cout
Definition: gather_cfg.py:41
DTRecSegment2DProducer(const edm::ParameterSet &)
Constructor.
#define debug
Definition: MEtoEDMFormat.h:34
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
virtual void produce(edm::Event &event, const edm::EventSetup &setup)
The method which produces the 2D-segments.
T get(const Candidate &c)
Definition: component.h:56