CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
DTRecSegment2DProducer Class Reference

#include <DTRecSegment2DProducer.h>

Inheritance diagram for DTRecSegment2DProducer:
edm::stream::EDProducer<>

Public Member Functions

 DTRecSegment2DProducer (const edm::ParameterSet &)
 Constructor. More...
 
void produce (edm::Event &event, const edm::EventSetup &setup) override
 The method which produces the 2D-segments. More...
 
 ~DTRecSegment2DProducer () override
 Destructor. More...
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 

Private Attributes

bool debug
 
edm::EDGetTokenT< DTRecHitCollectionrecHits1DToken_
 
DTRecSegment2DBaseAlgotheAlgo
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

Producer for DT segment in one projection.

Author
Stefano Lacaprara - INFN Legnaro stefa.nosp@m.no.l.nosp@m.acapr.nosp@m.ara@.nosp@m.pd.in.nosp@m.fn.i.nosp@m.t
Riccardo Bellan - INFN TO ricca.nosp@m.rdo..nosp@m.bella.nosp@m.n@ce.nosp@m.rn.ch

Definition at line 31 of file DTRecSegment2DProducer.h.

Constructor & Destructor Documentation

DTRecSegment2DProducer::DTRecSegment2DProducer ( const edm::ParameterSet pset)

Constructor.

Definition at line 36 of file DTRecSegment2DProducer.cc.

References gather_cfg::cout, debug, reco::get(), edm::ParameterSet::getParameter(), and edm::ParameterSet::getUntrackedParameter().

36  {
37  // Set verbose output
38  debug = pset.getUntrackedParameter<bool>("debug");
39 
40  // the name of the 1D rec hits collection
41  recHits1DToken_ = consumes<DTRecHitCollection>(pset.getParameter<InputTag>("recHits1DLabel"));
42 
43  if(debug)
44  cout << "[DTRecSegment2DProducer] Constructor called" << endl;
45 
46  produces<DTRecSegment2DCollection>();
47 
48  // Get the concrete reconstruction algo from the factory
49  string theAlgoName = pset.getParameter<string>("Reco2DAlgoName");
50  if(debug) cout << "the Reco2D AlgoName is " << theAlgoName << endl;
51  theAlgo = DTRecSegment2DAlgoFactory::get()->create(theAlgoName,
52  pset.getParameter<ParameterSet>("Reco2DAlgoConfig"));
53 }
edm::EDGetTokenT< DTRecHitCollection > recHits1DToken_
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
DTRecSegment2DBaseAlgo * theAlgo
T get(const Candidate &c)
Definition: component.h:55
DTRecSegment2DProducer::~DTRecSegment2DProducer ( )
override

Destructor.

Definition at line 56 of file DTRecSegment2DProducer.cc.

References gather_cfg::cout, and debug.

56  {
57  if(debug)
58  cout << "[DTRecSegment2DProducer] Destructor called" << endl;
59  delete theAlgo;
60 }
DTRecSegment2DBaseAlgo * theAlgo

Member Function Documentation

void DTRecSegment2DProducer::produce ( edm::Event event,
const edm::EventSetup setup 
)
override

The method which produces the 2D-segments.

Definition at line 63 of file DTRecSegment2DProducer.cc.

References edm::OwnVector< T, P >::begin(), gather_cfg::cout, debug, edm::OwnVector< T, P >::empty(), edm::OwnVector< T, P >::end(), edm::EventSetup::get(), DTRangeMapAccessor::layersBySuperLayer(), eostools::move(), edm::OwnVector< T, P >::size(), DTGeometry::superLayer(), and DTLayerId::superlayerId().

64  {
65  if(debug)
66  cout << "[DTRecSegment2DProducer] 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.getByToken(recHits1DToken_, allHits);
76 
77  // Create the pointer to the collection which will store the rechits
78  auto segments = std::make_unique<DTRecSegment2DCollection>();
79 
80  // Iterate through all hit collections ordered by LayerId
81  DTRecHitCollection::id_iterator dtLayerIt;
82  DTSuperLayerId oldSlId;
83  for (dtLayerIt = allHits->id_begin(); dtLayerIt != allHits->id_end(); ++dtLayerIt){
84  // The layerId
85  DTLayerId layerId = (*dtLayerIt);
86  const DTSuperLayerId SLId = layerId.superlayerId();
87  if (SLId==oldSlId) continue; // I'm on the same SL as before
88  oldSlId = SLId;
89 
90  if(debug) cout <<"Reconstructing the 2D segments in "<< SLId << endl;
91 
92  const DTSuperLayer* sl = dtGeom->superLayer(SLId);
93 
94  // Get all the rec hit in the same superLayer in which layerId relies
96  allHits->get(DTRangeMapAccessor::layersBySuperLayer(SLId));
97 
98  // Fill the vector with the 1D RecHit
99  vector<DTRecHit1DPair> pairs(range.first,range.second);
100 
101  if(debug) cout << "Number of 1D-RecHit pairs " << pairs.size() << endl;
102 
103  if(debug) cout << "Start the 2D-segments Reco "<< endl;
105  if(debug) cout << "Number of Reconstructed segments: " << segs.size() << endl;
106 
107  if (!segs.empty() )
108  segments->put(SLId, segs.begin(),segs.end());
109  }
110  event.put(std::move(segments));
111 }
edm::EDGetTokenT< DTRecHitCollection > recHits1DToken_
std::pair< const_iterator, const_iterator > range
iterator range
Definition: RangeMap.h:50
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:264
DTSuperLayerId superlayerId() const
Return the corresponding SuperLayerId.
Definition: DTLayerId.h:59
iterator begin()
Definition: OwnVector.h:244
virtual void setES(const edm::EventSetup &setup)=0
virtual edm::OwnVector< DTSLRecSegment2D > reconstruct(const DTSuperLayer *sl, const std::vector< DTRecHit1DPair > &hits)=0
bool empty() const
Definition: OwnVector.h:269
DTRecSegment2DBaseAlgo * theAlgo
iterator end()
Definition: OwnVector.h:249
T get() const
Definition: EventSetup.h:68
def move(src, dest)
Definition: eostools.py:511
const DTSuperLayer * superLayer(const DTSuperLayerId &id) const
Return a DTSuperLayer given its id.
Definition: DTGeometry.cc:122

Member Data Documentation

bool DTRecSegment2DProducer::debug
private
edm::EDGetTokenT<DTRecHitCollection> DTRecSegment2DProducer::recHits1DToken_
private

Definition at line 56 of file DTRecSegment2DProducer.h.

DTRecSegment2DBaseAlgo* DTRecSegment2DProducer::theAlgo
private

Definition at line 53 of file DTRecSegment2DProducer.h.