CMS 3D CMS Logo

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

#include <RecoMuon/MuonSeedGenerator/src/RPCSeedGenerator.cc>

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

Public Member Functions

 RPCSeedGenerator (const edm::ParameterSet &iConfig)
 
 ~RPCSeedGenerator () override
 
- 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 Member Functions

void beginRun (const edm::Run &, const edm::EventSetup &iSetup) override
 
void beginStream (edm::StreamID) override
 
void endStream () override
 
void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 

Private Attributes

const edm::ESGetToken< RPCGeometry, MuonGeometryRecordbrRPCGeometryToken
 
std::vector< weightedTrajectorySeedcandidateweightedSeeds
 
RPCCosmicSeedrecHitFinder CosmicrecHitFinder
 
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecordfieldToken
 
RPCSeedFinder Finder
 
std::vector< weightedTrajectorySeedgoodweightedSeeds
 
RPCSeedLayerFinder LayerFinder
 
const edm::ESGetToken< MuonDetLayerGeometry, MuonRecoGeometryRecordmuonLayersToken
 
std::unique_ptr< MuonDetLayerMeasurementsmuonMeasurements
 
RPCSeedOverlapper Overlapper
 
RPCSeedrecHitFinder recHitFinder
 
const edm::ESGetToken< RPCGeometry, MuonGeometryRecordrpcGeometryToken
 
edm::InputTag theRPCRecHits
 

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

Description: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>="">

Definition at line 86 of file RPCSeedGenerator.cc.

Constructor & Destructor Documentation

◆ RPCSeedGenerator()

RPCSeedGenerator::RPCSeedGenerator ( const edm::ParameterSet iConfig)
explicit

Definition at line 125 of file RPCSeedGenerator.cc.

References edm::BeginRun, RPCSeedOverlapper::configure(), RPCSeedFinder::configure(), RPCSeedrecHitFinder::configure(), RPCSeedLayerFinder::configure(), RPCCosmicSeedrecHitFinder::configure(), CosmicrecHitFinder, gather_cfg::cout, Finder, edm::ParameterSet::getParameter(), ProducerED_cfi::InputTag, LayerFinder, muonMeasurements, Overlapper, recHitFinder, and theRPCRecHits.

126  : brRPCGeometryToken(esConsumes<edm::Transition::BeginRun>()),
130  //register your products
131  /* Examples
132  produces<ExampleData2>();
133 
134  //if do put with a label
135  produces<ExampleData2>("label");
136  */
137 
138  // Now do what ever other initialization is needed
139  // Configure other modules
140  Finder.configure(iConfig);
141  recHitFinder.configure(iConfig);
142  CosmicrecHitFinder.configure(iConfig);
143  LayerFinder.configure(iConfig);
144  Overlapper.configure(iConfig);
145  // Register the production
146  produces<TrajectorySeedCollection>("goodSeeds");
147  produces<TrajectorySeedCollection>("candidateSeeds");
148  // Get event data Tag
149  theRPCRecHits = iConfig.getParameter<edm::InputTag>("RPCRecHitsLabel");
150 
151  // Get RPC recHits by MuonDetLayerMeasurements, while CSC and DT is set to false and with empty InputTag
152  edm::ConsumesCollector iC = consumesCollector();
153 
154  muonMeasurements = std::make_unique<MuonDetLayerMeasurements>(edm::InputTag(),
155  edm::InputTag(),
157  edm::InputTag(),
158  edm::InputTag(),
159  iC,
160  false,
161  false,
162  true,
163  false,
164  false);
165 
166  cout << endl << "[RPCSeedGenerator] --> Constructor called" << endl;
167 }
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > fieldToken
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
edm::InputTag theRPCRecHits
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
void configure(const edm::ParameterSet &iConfig)
RPCCosmicSeedrecHitFinder CosmicrecHitFinder
RPCSeedrecHitFinder recHitFinder
const edm::ESGetToken< RPCGeometry, MuonGeometryRecord > brRPCGeometryToken
std::unique_ptr< MuonDetLayerMeasurements > muonMeasurements
void configure(const edm::ParameterSet &iConfig)
void configure(const edm::ParameterSet &iConfig)
const edm::ESGetToken< RPCGeometry, MuonGeometryRecord > rpcGeometryToken
void configure(const edm::ParameterSet &iConfig)
RPCSeedOverlapper Overlapper
RPCSeedFinder Finder
const edm::ESGetToken< MuonDetLayerGeometry, MuonRecoGeometryRecord > muonLayersToken
RPCSeedLayerFinder LayerFinder
void configure(const edm::ParameterSet &iConfig)

◆ ~RPCSeedGenerator()

RPCSeedGenerator::~RPCSeedGenerator ( )
override

Definition at line 169 of file RPCSeedGenerator.cc.

References gather_cfg::cout.

169  {
170  // do anything here that needs to be done at desctruction time
171  // (e.g. close files, deallocate resources etc.)
172  cout << "[RPCSeedGenerator] --> Destructor called" << endl;
173 }

Member Function Documentation

◆ beginRun()

void RPCSeedGenerator::beginRun ( const edm::Run ,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 283 of file RPCSeedGenerator.cc.

References brRPCGeometryToken, candidateweightedSeeds, CosmicrecHitFinder, edm::EventSetup::getData(), goodweightedSeeds, Overlapper, RPCCosmicSeedrecHitFinder::setEdge(), RPCSeedOverlapper::setGeometry(), and RPCSeedOverlapper::setIO().

283  {
284  // Get RPCGeometry
285  RPCGeometry const& rpcGeometry = iSetup.getData(brRPCGeometryToken);
286 
287  CosmicrecHitFinder.setEdge(rpcGeometry);
288  Overlapper.setGeometry(rpcGeometry);
290 }
void setEdge(const RPCGeometry &)
void setGeometry(const RPCGeometry &iGeom)
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
RPCCosmicSeedrecHitFinder CosmicrecHitFinder
const edm::ESGetToken< RPCGeometry, MuonGeometryRecord > brRPCGeometryToken
RPCSeedOverlapper Overlapper
std::vector< weightedTrajectorySeed > goodweightedSeeds
std::vector< weightedTrajectorySeed > candidateweightedSeeds
void setIO(std::vector< weightedTrajectorySeed > *goodweightedRef, std::vector< weightedTrajectorySeed > *candidateweightedRef)

◆ beginStream()

void RPCSeedGenerator::beginStream ( edm::StreamID  )
overrideprivate

Definition at line 272 of file RPCSeedGenerator.cc.

References candidateweightedSeeds, CosmicrecHitFinder, gather_cfg::cout, Finder, goodweightedSeeds, LayerFinder, recHitFinder, RPCSeedFinder::setOutput(), RPCSeedrecHitFinder::setOutput(), RPCSeedLayerFinder::setOutput(), and RPCCosmicSeedrecHitFinder::setOutput().

272  {
273  // Set link and EventSetup of RPCSeedFinder, PCSeedrecHitFinder, CosmicrecHitFinder, RPCSeedLayerFinder
274  cout << "set link and Geometry EventSetup of RPCSeedFinder, RPCSeedrecHitFinder, RPCCosmicSeedrecHitFinder, "
275  "RPCSeedLayerFinder and RPCSeedOverlapper"
276  << endl;
277 
282 }
RPCCosmicSeedrecHitFinder CosmicrecHitFinder
void setOutput(std::vector< weightedTrajectorySeed > *goodweightedRef, std::vector< weightedTrajectorySeed > *candidateweightedRef)
RPCSeedrecHitFinder recHitFinder
void setOutput(RPCSeedrecHitFinder *Ref, RPCCosmicSeedrecHitFinder *CosmicRef)
void setOutput(RPCSeedFinder *Seed)
void setOutput(RPCSeedFinder *Seed)
RPCSeedFinder Finder
std::vector< weightedTrajectorySeed > goodweightedSeeds
std::vector< weightedTrajectorySeed > candidateweightedSeeds
RPCSeedLayerFinder LayerFinder

◆ endStream()

void RPCSeedGenerator::endStream ( )
overrideprivate

Definition at line 292 of file RPCSeedGenerator.cc.

References gather_cfg::cout.

292 { cout << "All jobs completed" << endl; }

◆ produce()

void RPCSeedGenerator::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 180 of file RPCSeedGenerator.cc.

References candidateweightedSeeds, CosmicrecHitFinder, gather_cfg::cout, fieldToken, RPCSeedLayerFinder::fill(), Finder, edm::EventSetup::getData(), goodweightedSeeds, iEvent, LayerFinder, eostools::move(), muonLayersToken, muonMeasurements, Overlapper, recHitFinder, rpcGeometryToken, RPCLayerNumber, RPCSeedOverlapper::run(), RPCSeedFinder::setEventSetup(), RPCSeedrecHitFinder::setInput(), RPCSeedLayerFinder::setInput(), RPCCosmicSeedrecHitFinder::setInput(), RPCSeedrecHitFinder::unsetInput(), RPCSeedLayerFinder::unsetInput(), and RPCCosmicSeedrecHitFinder::unsetInput().

180  {
181  using namespace edm;
182  goodweightedSeeds.clear();
183  candidateweightedSeeds.clear();
184 
185  // Create the pointer to the Seed container
186  auto goodCollection = std::make_unique<TrajectorySeedCollection>();
187  auto candidateCollection = std::make_unique<TrajectorySeedCollection>();
188 
189  // Muon Geometry - DT, CSC and RPC
190  MuonDetLayerGeometry const& muonLayers = iSetup.getData(muonLayersToken);
191 
192  // Get the RPC layers
193  vector<const DetLayer*> RPCBarrelLayers = muonLayers.barrelRPCLayers();
194  const DetLayer* RB4L = RPCBarrelLayers[5];
195  const DetLayer* RB3L = RPCBarrelLayers[4];
196  const DetLayer* RB22L = RPCBarrelLayers[3];
197  const DetLayer* RB21L = RPCBarrelLayers[2];
198  const DetLayer* RB12L = RPCBarrelLayers[1];
199  const DetLayer* RB11L = RPCBarrelLayers[0];
200  vector<const DetLayer*> RPCEndcapLayers = muonLayers.endcapRPCLayers();
201  const DetLayer* REM3L = RPCEndcapLayers[0];
202  const DetLayer* REM2L = RPCEndcapLayers[1];
203  const DetLayer* REM1L = RPCEndcapLayers[2];
204  const DetLayer* REP1L = RPCEndcapLayers[3];
205  const DetLayer* REP2L = RPCEndcapLayers[4];
206  const DetLayer* REP3L = RPCEndcapLayers[5];
207 
208  // Dispatch RPC recHits to the corresponding DetLayer, 6 layers for barrel and 3 layers for each endcap
210  recHitsRPC[0] = muonMeasurements->recHits(RB11L, iEvent);
211  recHitsRPC[1] = muonMeasurements->recHits(RB12L, iEvent);
212  recHitsRPC[2] = muonMeasurements->recHits(RB21L, iEvent);
213  recHitsRPC[3] = muonMeasurements->recHits(RB22L, iEvent);
214  recHitsRPC[4] = muonMeasurements->recHits(RB3L, iEvent);
215  recHitsRPC[5] = muonMeasurements->recHits(RB4L, iEvent);
216  recHitsRPC[6] = muonMeasurements->recHits(REM1L, iEvent);
217  recHitsRPC[7] = muonMeasurements->recHits(REM2L, iEvent);
218  recHitsRPC[8] = muonMeasurements->recHits(REM3L, iEvent);
219  recHitsRPC[9] = muonMeasurements->recHits(REP1L, iEvent);
220  recHitsRPC[10] = muonMeasurements->recHits(REP2L, iEvent);
221  recHitsRPC[11] = muonMeasurements->recHits(REP3L, iEvent);
222 
223  // Print the size of recHits in each DetLayer
224  cout << "RB1in " << recHitsRPC[0].size() << " recHits" << endl;
225  cout << "RB1out " << recHitsRPC[1].size() << " recHits" << endl;
226  cout << "RB2in " << recHitsRPC[2].size() << " recHits" << endl;
227  cout << "RB2out " << recHitsRPC[3].size() << " recHits" << endl;
228  cout << "RB3 " << recHitsRPC[4].size() << " recHits" << endl;
229  cout << "RB4 " << recHitsRPC[5].size() << " recHits" << endl;
230  cout << "REM1 " << recHitsRPC[6].size() << " recHits" << endl;
231  cout << "REM2 " << recHitsRPC[7].size() << " recHits" << endl;
232  cout << "REM3 " << recHitsRPC[8].size() << " recHits" << endl;
233  cout << "REP1 " << recHitsRPC[9].size() << " recHits" << endl;
234  cout << "REP2 " << recHitsRPC[10].size() << " recHits" << endl;
235  cout << "REP3 " << recHitsRPC[11].size() << " recHits" << endl;
236 
237  // Set Input of RPCSeedFinder, PCSeedrecHitFinder, CosmicrecHitFinder, RPCSeedLayerFinder
238  recHitFinder.setInput(recHitsRPC);
239  CosmicrecHitFinder.setInput(recHitsRPC);
240  LayerFinder.setInput(recHitsRPC);
241 
242  // Set Magnetic Field EventSetup of RPCSeedFinder
243  const MagneticField& Field = iSetup.getData(fieldToken);
244 
245  const RPCGeometry& rpcGeom = iSetup.getData(rpcGeometryToken);
246  Finder.setEventSetup(Field, rpcGeom);
247 
248  // Start from filling layers to filling seeds
249  LayerFinder.fill();
250  Overlapper.run();
251 
252  // Save seeds to event
253  for (vector<weightedTrajectorySeed>::iterator weightedseed = goodweightedSeeds.begin();
254  weightedseed != goodweightedSeeds.end();
255  ++weightedseed)
256  goodCollection->push_back((*weightedseed).first);
257  for (vector<weightedTrajectorySeed>::iterator weightedseed = candidateweightedSeeds.begin();
258  weightedseed != candidateweightedSeeds.end();
259  ++weightedseed)
260  candidateCollection->push_back((*weightedseed).first);
261 
262  // Put the seed to event
263  iEvent.put(std::move(goodCollection), "goodSeeds");
264  iEvent.put(std::move(candidateCollection), "candidateSeeds");
265 
266  // Unset the input of RPCSeedFinder, PCSeedrecHitFinder, RPCSeedLayerFinder
270 }
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > fieldToken
void setInput(MuonRecHitContainer(&recHits)[12])
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
RPCCosmicSeedrecHitFinder CosmicrecHitFinder
RPCSeedrecHitFinder recHitFinder
void setInput(MuonRecHitContainer(&recHits)[12])
std::unique_ptr< MuonDetLayerMeasurements > muonMeasurements
#define RPCLayerNumber
int iEvent
Definition: GenABIO.cc:224
void setInput(MuonRecHitContainer(&recHitsRPC)[12])
void setEventSetup(const MagneticField &field, const RPCGeometry &rpcGeom)
const edm::ESGetToken< RPCGeometry, MuonGeometryRecord > rpcGeometryToken
RPCSeedOverlapper Overlapper
HLT enums.
MuonTransientTrackingRecHit::MuonRecHitContainer MuonRecHitContainer
RPCSeedFinder Finder
std::vector< weightedTrajectorySeed > goodweightedSeeds
std::vector< weightedTrajectorySeed > candidateweightedSeeds
def move(src, dest)
Definition: eostools.py:511
const edm::ESGetToken< MuonDetLayerGeometry, MuonRecoGeometryRecord > muonLayersToken
RPCSeedLayerFinder LayerFinder

Member Data Documentation

◆ brRPCGeometryToken

const edm::ESGetToken<RPCGeometry, MuonGeometryRecord> RPCSeedGenerator::brRPCGeometryToken
private

Definition at line 108 of file RPCSeedGenerator.cc.

Referenced by beginRun().

◆ candidateweightedSeeds

std::vector<weightedTrajectorySeed> RPCSeedGenerator::candidateweightedSeeds
private

Definition at line 103 of file RPCSeedGenerator.cc.

Referenced by beginRun(), beginStream(), and produce().

◆ CosmicrecHitFinder

RPCCosmicSeedrecHitFinder RPCSeedGenerator::CosmicrecHitFinder
private

Definition at line 100 of file RPCSeedGenerator.cc.

Referenced by beginRun(), beginStream(), produce(), and RPCSeedGenerator().

◆ fieldToken

const edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> RPCSeedGenerator::fieldToken
private

Definition at line 110 of file RPCSeedGenerator.cc.

Referenced by produce().

◆ Finder

RPCSeedFinder RPCSeedGenerator::Finder
private

Definition at line 98 of file RPCSeedGenerator.cc.

Referenced by beginStream(), produce(), and RPCSeedGenerator().

◆ goodweightedSeeds

std::vector<weightedTrajectorySeed> RPCSeedGenerator::goodweightedSeeds
private

Definition at line 104 of file RPCSeedGenerator.cc.

Referenced by beginRun(), beginStream(), and produce().

◆ LayerFinder

RPCSeedLayerFinder RPCSeedGenerator::LayerFinder
private

Definition at line 101 of file RPCSeedGenerator.cc.

Referenced by beginStream(), produce(), and RPCSeedGenerator().

◆ muonLayersToken

const edm::ESGetToken<MuonDetLayerGeometry, MuonRecoGeometryRecord> RPCSeedGenerator::muonLayersToken
private

Definition at line 109 of file RPCSeedGenerator.cc.

Referenced by produce().

◆ muonMeasurements

std::unique_ptr<MuonDetLayerMeasurements> RPCSeedGenerator::muonMeasurements
private

Definition at line 106 of file RPCSeedGenerator.cc.

Referenced by produce(), and RPCSeedGenerator().

◆ Overlapper

RPCSeedOverlapper RPCSeedGenerator::Overlapper
private

Definition at line 102 of file RPCSeedGenerator.cc.

Referenced by beginRun(), produce(), and RPCSeedGenerator().

◆ recHitFinder

RPCSeedrecHitFinder RPCSeedGenerator::recHitFinder
private

Definition at line 99 of file RPCSeedGenerator.cc.

Referenced by beginStream(), produce(), and RPCSeedGenerator().

◆ rpcGeometryToken

const edm::ESGetToken<RPCGeometry, MuonGeometryRecord> RPCSeedGenerator::rpcGeometryToken
private

Definition at line 111 of file RPCSeedGenerator.cc.

Referenced by produce().

◆ theRPCRecHits

edm::InputTag RPCSeedGenerator::theRPCRecHits
private

Definition at line 105 of file RPCSeedGenerator.cc.

Referenced by RPCSeedGenerator().