CMS 3D CMS Logo

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

#include <DTRecSegment4DProducer.h>

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

Public Member Functions

 DTRecSegment4DProducer (const edm::ParameterSet &)
 Constructor. More...
 
void produce (edm::Event &event, const edm::EventSetup &setup) override
 The method which produces the 4D rec segments. More...
 
 ~DTRecSegment4DProducer () 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_
 
edm::EDGetTokenT< DTRecSegment2DCollectionrecHits2DToken_
 
DTRecSegment4DBaseAlgothe4DAlgo
 

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

Builds the segments in the DT chambers.

Author
Riccardo Bellan - INFN Torino ricca.nosp@m.rdo..nosp@m.bella.nosp@m.n@ce.nosp@m.rn.ch

Definition at line 21 of file DTRecSegment4DProducer.h.

Constructor & Destructor Documentation

DTRecSegment4DProducer::DTRecSegment4DProducer ( const edm::ParameterSet pset)

Constructor.

Definition at line 26 of file DTRecSegment4DProducer.cc.

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

26  {
27  produces<DTRecSegment4DCollection>();
28 
29  // debug parameter
30  debug = pset.getUntrackedParameter<bool>("debug", false);
31 
32  if(debug)
33  cout << "[DTRecSegment4DProducer] Constructor called" << endl;
34 
35  // the name of the 1D rec hits collection
36  recHits1DToken_ = consumes<DTRecHitCollection>(pset.getParameter<InputTag>("recHits1DLabel"));
37 
38  // the name of the 2D rec hits collection
39  recHits2DToken_ = consumes<DTRecSegment2DCollection>(pset.getParameter<InputTag>("recHits2DLabel"));
40 
41  // Get the concrete 4D-segments reconstruction algo from the factory
42  string theReco4DAlgoName = pset.getParameter<string>("Reco4DAlgoName");
43  if(debug) cout << "the Reco4D AlgoName is " << theReco4DAlgoName << endl;
44  the4DAlgo = DTRecSegment4DAlgoFactory::get()->create(theReco4DAlgoName,
45  pset.getParameter<ParameterSet>("Reco4DAlgoConfig"));
46 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
DTRecSegment4DBaseAlgo * the4DAlgo
edm::EDGetTokenT< DTRecSegment2DCollection > recHits2DToken_
edm::EDGetTokenT< DTRecHitCollection > recHits1DToken_
T get(const Candidate &c)
Definition: component.h:55
DTRecSegment4DProducer::~DTRecSegment4DProducer ( )
override

Destructor.

Definition at line 49 of file DTRecSegment4DProducer.cc.

References gather_cfg::cout, and debug.

49  {
50  if(debug)
51  cout << "[DTRecSegment4DProducer] Destructor called" << endl;
52  delete the4DAlgo;
53 }
DTRecSegment4DBaseAlgo * the4DAlgo

Member Function Documentation

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

The method which produces the 4D rec segments.

Definition at line 55 of file DTRecSegment4DProducer.cc.

References edm::OwnVector< T, P >::begin(), popcon2dropbox::copy(), gather_cfg::cout, debug, edm::OwnVector< T, P >::empty(), edm::OwnVector< T, P >::end(), edm::EventSetup::get(), edm::Event::getByToken(), eostools::move(), and edm::OwnVector< T, P >::size().

55  {
56 
57  // Get the 1D rechits from the event
58  Handle<DTRecHitCollection> all1DHits;
59  event.getByToken(recHits1DToken_, all1DHits);
60 
61  // Get the 2D rechits from the event
64  event.getByToken(recHits2DToken_, all2DSegments);
65 
66  // Create the pointer to the collection which will store the rechits
67  auto segments4DCollection = std::make_unique<DTRecSegment4DCollection>();
68 
69  // get the geometry
70  ESHandle<DTGeometry> theGeom;
71  setup.get<MuonGeometryRecord>().get(theGeom);
72 
73  // Percolate the setup
74  the4DAlgo->setES(setup);
75 
76  // Iterate over all hit collections ordered by layerId
77  DTRecHitCollection::id_iterator dtLayerIt;
78 
79  DTChamberId oldChId;
80 
81  for (dtLayerIt = all1DHits->id_begin(); dtLayerIt != all1DHits->id_end(); ++dtLayerIt){
82 
83  // Check the DTChamberId
84  const DTChamberId chId = (*dtLayerIt).chamberId();
85  if (chId==oldChId) continue; // I'm on the same Chamber as before
86  oldChId = chId;
87  if(debug) cout << "ChamberId: "<< chId << endl;
88  the4DAlgo->setChamber(chId);
89 
90  if(debug) cout<<"Take the DTRecHits1D and set them in the reconstructor"<<endl;
91 
93 
94  if(debug) cout<<"Take the DTRecSegments2D and set them in the reconstructor"<<endl;
95 
96  the4DAlgo->setDTRecSegment2DContainer(all2DSegments);
97 
98  if(debug) cout << "Start 4D-Segments Reco " << endl;
99 
101 
102  if(debug) {
103  cout << "Number of reconstructed 4D-segments " << segments4D.size() << endl;
104  copy(segments4D.begin(), segments4D.end(),
105  ostream_iterator<DTRecSegment4D>(cout, "\n"));
106  }
107 
108  if (!segments4D.empty() )
109  // convert the OwnVector into a Collection
110  segments4DCollection->put(chId, segments4D.begin(),segments4D.end());
111  }
112  // Load the output in the Event
113  event.put(std::move(segments4DCollection));
114 }
def copy(args, dbName)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
virtual void setES(const edm::EventSetup &setup)=0
virtual edm::OwnVector< DTRecSegment4D > reconstruct()=0
size_type size() const
Definition: OwnVector.h:264
virtual void setChamber(const DTChamberId &chId)=0
iterator begin()
Definition: OwnVector.h:244
virtual void setDTRecHit1DContainer(edm::Handle< DTRecHitCollection > all1DHits)=0
DTRecSegment4DBaseAlgo * the4DAlgo
bool empty() const
Definition: OwnVector.h:269
edm::EDGetTokenT< DTRecSegment2DCollection > recHits2DToken_
virtual bool wants2DSegments()=0
iterator end()
Definition: OwnVector.h:249
edm::EDGetTokenT< DTRecHitCollection > recHits1DToken_
T get() const
Definition: EventSetup.h:68
def move(src, dest)
Definition: eostools.py:511
virtual void setDTRecSegment2DContainer(edm::Handle< DTRecSegment2DCollection > all2DSegments)=0

Member Data Documentation

bool DTRecSegment4DProducer::debug
private

Definition at line 40 of file DTRecSegment4DProducer.h.

edm::EDGetTokenT<DTRecHitCollection> DTRecSegment4DProducer::recHits1DToken_
private

Definition at line 42 of file DTRecSegment4DProducer.h.

edm::EDGetTokenT<DTRecSegment2DCollection> DTRecSegment4DProducer::recHits2DToken_
private

Definition at line 44 of file DTRecSegment4DProducer.h.

DTRecSegment4DBaseAlgo* DTRecSegment4DProducer::the4DAlgo
private

Definition at line 46 of file DTRecSegment4DProducer.h.