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 hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Private Attributes

bool debug
 
edm::EDGetTokenT< DTRecHitCollectionrecHits1DToken_
 
edm::EDGetTokenT< DTRecSegment2DCollectionrecHits2DToken_
 
std::unique_ptr< 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::DTRecSegment4DProducer ( const edm::ParameterSet pset)

Constructor.

Definition at line 26 of file DTRecSegment4DProducer.cc.

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

References get, and muonDTDigis_cfi::pset.

◆ ~DTRecSegment4DProducer()

DTRecSegment4DProducer::~DTRecSegment4DProducer ( )
override

Destructor.

Definition at line 49 of file DTRecSegment4DProducer.cc.

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

References gather_cfg::cout, and debug.

Member Function Documentation

◆ produce()

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

The method which produces the 4D rec segments.

Definition at line 54 of file DTRecSegment4DProducer.cc.

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

References edm::OwnVector< T, P >::begin(), filterCSVwithJSON::copy, gather_cfg::cout, debug, edm::OwnVector< T, P >::empty(), edm::OwnVector< T, P >::end(), get, eostools::move(), recHits1DToken_, recHits2DToken_, singleTopDQM_cfi::setup, edm::OwnVector< T, P >::size(), and the4DAlgo.

Member Data Documentation

◆ debug

bool DTRecSegment4DProducer::debug
private

◆ recHits1DToken_

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

Definition at line 39 of file DTRecSegment4DProducer.h.

Referenced by produce().

◆ recHits2DToken_

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

Definition at line 40 of file DTRecSegment4DProducer.h.

Referenced by produce().

◆ the4DAlgo

std::unique_ptr<DTRecSegment4DBaseAlgo> DTRecSegment4DProducer::the4DAlgo
private

Definition at line 42 of file DTRecSegment4DProducer.h.

Referenced by produce().

DTRecSegment4DProducer::recHits2DToken_
edm::EDGetTokenT< DTRecSegment2DCollection > recHits2DToken_
Definition: DTRecSegment4DProducer.h:40
filterCSVwithJSON.copy
copy
Definition: filterCSVwithJSON.py:36
edm::OwnVector::end
iterator end()
Definition: OwnVector.h:285
gather_cfg.cout
cout
Definition: gather_cfg.py:144
DTRecSegment4DProducer::recHits1DToken_
edm::EDGetTokenT< DTRecHitCollection > recHits1DToken_
Definition: DTRecSegment4DProducer.h:39
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
edm::ESHandle< DTGeometry >
DTRecSegment4DProducer::debug
bool debug
Definition: DTRecSegment4DProducer.h:37
edm::ParameterSet
Definition: ParameterSet.h:47
get
#define get
eostools.move
def move(src, dest)
Definition: eostools.py:511
DTRecSegment4DProducer::the4DAlgo
std::unique_ptr< DTRecSegment4DBaseAlgo > the4DAlgo
Definition: DTRecSegment4DProducer.h:42
DTChamberId
Definition: DTChamberId.h:14
edm::OwnVector::begin
iterator begin()
Definition: OwnVector.h:280
event
Definition: event.py:1
edm::OwnVector::size
size_type size() const
Definition: OwnVector.h:300
MuonGeometryRecord
Definition: MuonGeometryRecord.h:34
edm::InputTag
Definition: InputTag.h:15
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
edm::OwnVector
Definition: OwnVector.h:24