CMS 3D CMS Logo

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 */
61  if (debug)
62  cout << "[DTRecSegment2DExtendedProducer] produce called" << endl;
63  // Get the DT Geometry
64  ESHandle<DTGeometry> dtGeom;
65  setup.get<MuonGeometryRecord>().get(dtGeom);
66 
67  theAlgo->setES(setup);
68 
69  // Get the 1D rechits from the event
71  event.getByToken(recHits1DToken_, allHits);
72 
73  // Get the 1D clusters from the event
75  event.getByToken(recClusToken_, dtClusters);
76  theAlgo->setClusters(vector<DTSLRecCluster>(dtClusters->begin(), dtClusters->end()));
77 
78  // Create the pointer to the collection which will store the rechits
79  auto segments = std::make_unique<DTRecSegment2DCollection>();
80 
81  // Iterate through all hit collections ordered by LayerId
83  DTSuperLayerId oldSlId;
84  for (dtLayerIt = allHits->id_begin(); dtLayerIt != allHits->id_end(); ++dtLayerIt) {
85  // The layerId
86  DTLayerId layerId = (*dtLayerIt);
87  const DTSuperLayerId SLId = layerId.superlayerId();
88  if (SLId == oldSlId)
89  continue; // I'm on the same SL as before
90  oldSlId = SLId;
91 
92  if (debug)
93  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 
100  // Fill the vector with the 1D RecHit
101  vector<DTRecHit1DPair> pairs(range.first, range.second);
102 
103  if (debug)
104  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(), ostream_iterator<DTSLRecSegment2D>(cout, "\n"));
111  }
112 
113  if (!segs.empty())
114  segments->put(SLId, segs.begin(), segs.end());
115  }
116  event.put(std::move(segments));
117 }
DTRecSegment2DCollection.h
DTRecSegment2DExtendedProducer::DTRecSegment2DExtendedProducer
DTRecSegment2DExtendedProducer(const edm::ParameterSet &)
Constructor.
Definition: DTRecSegment2DExtendedProducer.cc:35
DTSuperLayerId
Definition: DTSuperLayerId.h:12
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
filterCSVwithJSON.copy
copy
Definition: filterCSVwithJSON.py:36
ESHandle.h
edm::OwnVector::end
iterator end()
Definition: OwnVector.h:285
DTRecHit1D.h
edm
HLT enums.
Definition: AlignableModifier.h:19
gather_cfg.cout
cout
Definition: gather_cfg.py:144
DTSuperLayer
Definition: DTSuperLayer.h:24
edm::Handle< DTRecHitCollection >
edm::RangeMap::id_iterator
identifier iterator
Definition: RangeMap.h:130
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
edm::OwnVector::empty
bool empty() const
Definition: OwnVector.h:305
debug
#define debug
Definition: HDRShower.cc:19
DTRecSegment2DExtendedProducer::produce
void produce(edm::Event &event, const edm::EventSetup &setup) override
The method which produces the 2D-segments.
Definition: DTRecSegment2DExtendedProducer.cc:60
edm::ESHandle< DTGeometry >
DTLayerId
Definition: DTLayerId.h:12
DTLayer.h
DTGeometry.h
edm::ParameterSet
Definition: ParameterSet.h:47
DTRangeMapAccessor::layersBySuperLayer
static std::pair< DTLayerId, DTSuperLayerIdComparator > layersBySuperLayer(DTSuperLayerId slId)
Access by SL objects written into a RangeMap by layer.
Definition: DTRangeMapAccessor.cc:15
Event.h
DTRangeMapAccessor.h
edm::get
T const & get(Event const &event, InputTag const &tag) noexcept(false)
Definition: Event.h:671
DTRecSegment2DExtendedProducer::~DTRecSegment2DExtendedProducer
~DTRecSegment2DExtendedProducer() override
Destructor.
Definition: DTRecSegment2DExtendedProducer.cc:53
DTRecHit1DPair.h
edm::EventSetup
Definition: EventSetup.h:57
DTCombinatorialExtendedPatternReco.h
InputTag.h
edm::RangeMap::range
std::pair< const_iterator, const_iterator > range
iterator range
Definition: RangeMap.h:50
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
DTLayerId::superlayerId
DTSuperLayerId superlayerId() const
Return the corresponding SuperLayerId.
Definition: DTLayerId.h:45
DTSLRecSegment2D.h
DTGeometry::superLayer
const DTSuperLayer * superLayer(const DTSuperLayerId &id) const
Return a DTSuperLayer given its id.
Definition: DTGeometry.cc:92
ParameterSet.h
edm::OwnVector::begin
iterator begin()
Definition: OwnVector.h:280
MuonGeometryRecord.h
event
Definition: event.py:1
DTCombinatorialExtendedPatternReco
Definition: DTCombinatorialExtendedPatternReco.h:42
edm::Event
Definition: Event.h:73
edm::OwnVector::size
size_type size() const
Definition: OwnVector.h:300
MuonGeometryRecord
Definition: MuonGeometryRecord.h:34
DTRecSegment2DExtendedProducer.h
edm::InputTag
Definition: InputTag.h:15
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
edm::OwnVector
Definition: OwnVector.h:24