CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DTRecSegment2DExtendedProducer.cc
Go to the documentation of this file.
1 
6 /* This Class Header */
8 
9 /* Collaborating Class Header */
15 using namespace edm;
16 
20 
26 
28 
29 /* C++ Headers */
30 #include <string>
31 using namespace std;
32 
33 /* ====================================================================== */
34 
37  : dtGeomToken_(esConsumes()) {
38  // Set verbose output
39  debug = pset.getUntrackedParameter<bool>("debug");
40 
41  // the name of the 1D rec hits collection
42  recHits1DToken_ = consumes<DTRecHitCollection>(pset.getParameter<InputTag>("recHits1DLabel"));
43  recClusToken_ = consumes<DTRecClusterCollection>(pset.getParameter<InputTag>("recClusLabel"));
44 
45  if (debug)
46  cout << "[DTRecSegment2DExtendedProducer] Constructor called" << endl;
47 
48  produces<DTRecSegment2DCollection>();
49 
50  // Get the concrete reconstruction algo from the factory
51  theAlgo =
52  new DTCombinatorialExtendedPatternReco(pset.getParameter<ParameterSet>("Reco2DAlgoConfig"), consumesCollector());
53 }
54 
57  if (debug)
58  cout << "[DTRecSegment2DExtendedProducer] Destructor called" << endl;
59  delete theAlgo;
60 }
61 
62 /* Operations */
64  if (debug)
65  cout << "[DTRecSegment2DExtendedProducer] produce called" << endl;
66  // Get the DT Geometry
67  const DTGeometry& dtGeom = setup.getData(dtGeomToken_);
68 
69  theAlgo->setES(setup);
70 
71  // Get the 1D rechits from the event
73  event.getByToken(recHits1DToken_, allHits);
74 
75  // Get the 1D clusters from the event
77  event.getByToken(recClusToken_, dtClusters);
78  theAlgo->setClusters(vector<DTSLRecCluster>(dtClusters->begin(), dtClusters->end()));
79 
80  // Create the pointer to the collection which will store the rechits
81  auto segments = std::make_unique<DTRecSegment2DCollection>();
82 
83  // Iterate through all hit collections ordered by LayerId
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)
91  continue; // I'm on the same SL as before
92  oldSlId = SLId;
93 
94  if (debug)
95  cout << "Reconstructing the 2D segments in " << SLId << endl;
96 
97  const DTSuperLayer* sl = dtGeom.superLayer(SLId);
98 
99  // Get all the rec hit in the same superLayer in which layerId relies
101 
102  // Fill the vector with the 1D RecHit
103  vector<DTRecHit1DPair> pairs(range.first, range.second);
104 
105  if (debug)
106  cout << "Number of 1D-RecHit pairs " << pairs.size() << endl;
107 
108  //if(debug) cout << "Start the 2D-segments Reco "<< endl;
110  if (debug) {
111  cout << "Number of Reconstructed segments: " << segs.size() << endl;
112  copy(segs.begin(), segs.end(), ostream_iterator<DTSLRecSegment2D>(cout, "\n"));
113  }
114 
115  if (!segs.empty())
116  segments->put(SLId, segs.begin(), segs.end());
117  }
118  event.put(std::move(segments));
119 }
edm::OwnVector< DTSLRecSegment2D > reconstruct(const DTSuperLayer *sl, const std::vector< DTRecHit1DPair > &hits) override
this function is called in the producer
void setClusters(const std::vector< DTSLRecCluster > &clusters)
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.
DTCombinatorialExtendedPatternReco * theAlgo
size_type size() const
Definition: OwnVector.h:300
edm::EDGetTokenT< DTRecHitCollection > recHits1DToken_
identifier iterator
Definition: RangeMap.h:130
DTSuperLayerId superlayerId() const
Return the corresponding SuperLayerId.
Definition: DTLayerId.h:45
const uint16_t range(const Frame &aFrame)
iterator begin()
Definition: OwnVector.h:280
bool getData(T &iHolder) const
Definition: EventSetup.h:128
bool empty() const
Definition: OwnVector.h:305
~DTRecSegment2DExtendedProducer() override
Destructor.
def move
Definition: eostools.py:511
void setES(const edm::EventSetup &setup) override
iterator end()
Definition: OwnVector.h:285
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const edm::ESGetToken< DTGeometry, MuonGeometryRecord > dtGeomToken_
tuple cout
Definition: gather_cfg.py:144
void produce(edm::Event &event, const edm::EventSetup &setup) override
The method which produces the 2D-segments.
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
edm::EDGetTokenT< DTRecClusterCollection > recClusToken_
const DTSuperLayer * superLayer(const DTSuperLayerId &id) const
Return a DTSuperLayer given its id.
Definition: DTGeometry.cc:92