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
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Private Attributes

bool debug
 
edm::EDGetTokenT< DTRecHitCollectionrecHits1DToken_
 
edm::EDGetTokenT< DTRecSegment2DCollectionrecHits2DToken_
 
std::unique_ptr< DTRecSegment4DBaseAlgothe4DAlgo
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::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.

References get, and muonDTDigis_cfi::pset.

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  consumesCollector())} {
31  produces<DTRecSegment4DCollection>();
32 
33  // debug parameter
34  debug = pset.getUntrackedParameter<bool>("debug", false);
35 
36  if (debug)
37  cout << "[DTRecSegment4DProducer] Constructor called" << endl;
38 
39  // the name of the 1D rec hits collection
40  recHits1DToken_ = consumes<DTRecHitCollection>(pset.getParameter<InputTag>("recHits1DLabel"));
41 
42  // the name of the 2D rec hits collection
43  recHits2DToken_ = consumes<DTRecSegment2DCollection>(pset.getParameter<InputTag>("recHits2DLabel"));
44 
45  if (debug)
46  cout << "the Reco4D AlgoName is " << pset.getParameter<string>("Reco4DAlgoName") << endl;
47 }
std::unique_ptr< DTRecSegment4DBaseAlgo > the4DAlgo
edm::EDGetTokenT< DTRecSegment2DCollection > recHits2DToken_
edm::EDGetTokenT< DTRecHitCollection > recHits1DToken_
#define get

◆ ~DTRecSegment4DProducer()

DTRecSegment4DProducer::~DTRecSegment4DProducer ( )
override

Destructor.

Definition at line 50 of file DTRecSegment4DProducer.cc.

References gather_cfg::cout, and debug.

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

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 55 of file DTRecSegment4DProducer.cc.

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

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

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().