CMS 3D CMS Logo

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

#include <TSGFromL2Muon.h>

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

Public Member Functions

void beginRun (const edm::Run &run, const edm::EventSetup &es) override
 
void produce (edm::Event &ev, const edm::EventSetup &es) override
 
 TSGFromL2Muon (const edm::ParameterSet &cfg)
 
 ~TSGFromL2Muon () 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
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Attributes

edm::EDGetTokenT< reco::TrackCollectionl2muonToken
 
edm::InputTag theL2CollectionLabel
 
double thePCut
 
double thePtCut
 
std::unique_ptr< MuonTrackingRegionBuildertheRegionBuilder
 
std::unique_ptr< TrackerSeedCleanertheSeedCleaner
 
std::unique_ptr< MuonServiceProxytheService
 
std::unique_ptr< TrackerSeedGeneratortheTkSeedGenerator
 
edm::ESGetToken< TrackerTopology, TrackerTopologyRcdtheTTopoToken
 

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

Definition at line 25 of file TSGFromL2Muon.h.

Constructor & Destructor Documentation

◆ TSGFromL2Muon()

TSGFromL2Muon::TSGFromL2Muon ( const edm::ParameterSet cfg)

Definition at line 10 of file TSGFromL2Muon.cc.

References looper::cfg, edm::ParameterSet::empty(), deDxTools::esConsumes(), get, edm::ParameterSet::getParameter(), l2muonToken, MuonServiceProxy::RunAndEvent, AlCaHLTBitMon_QueryRunRegistry::string, theL2CollectionLabel, thePCut, thePtCut, theRegionBuilder, theSeedCleaner, theService, theTkSeedGenerator, and theTTopoToken.

10  {
11  produces<L3MuonTrajectorySeedCollection>();
12 
13  edm::ConsumesCollector iC = consumesCollector();
14 
15  edm::ParameterSet serviceParameters = cfg.getParameter<edm::ParameterSet>("ServiceParameters");
16  theService = std::make_unique<MuonServiceProxy>(
17  serviceParameters, consumesCollector(), MuonServiceProxy::UseEventSetupIn::RunAndEvent);
18 
19  //Pt and P cuts
20  thePtCut = cfg.getParameter<double>("PtCut");
21  thePCut = cfg.getParameter<double>("PCut");
22 
23  //Region builder
24  edm::ParameterSet regionBuilderPSet = cfg.getParameter<edm::ParameterSet>("MuonTrackingRegionBuilder");
25  //ability to no define a region
26  if (!regionBuilderPSet.empty()) {
27  theRegionBuilder = std::make_unique<MuonTrackingRegionBuilder>(regionBuilderPSet, iC);
28  }
29 
30  //Seed generator
31  edm::ParameterSet seedGenPSet = cfg.getParameter<edm::ParameterSet>("TkSeedGenerator");
32  std::string seedGenName = seedGenPSet.getParameter<std::string>("ComponentName");
33  theTkSeedGenerator = TrackerSeedGeneratorFactory::get()->create(seedGenName, seedGenPSet, iC);
34 
35  //Seed cleaner
36  edm::ParameterSet trackerSeedCleanerPSet = cfg.getParameter<edm::ParameterSet>("TrackerSeedCleaner");
37  //To activate or not the cleaner
38  if (!trackerSeedCleanerPSet.empty()) {
39  theSeedCleaner = std::make_unique<TrackerSeedCleaner>(trackerSeedCleanerPSet, iC);
40  }
41 
42  //L2 collection
43  theL2CollectionLabel = cfg.getParameter<edm::InputTag>("MuonCollectionLabel");
44  l2muonToken = consumes<reco::TrackCollection>(theL2CollectionLabel);
45 
47 }
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > theTTopoToken
Definition: TSGFromL2Muon.h:41
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
std::unique_ptr< TrackerSeedGenerator > theTkSeedGenerator
Definition: TSGFromL2Muon.h:38
std::unique_ptr< MuonTrackingRegionBuilder > theRegionBuilder
Definition: TSGFromL2Muon.h:37
edm::EDGetTokenT< reco::TrackCollection > l2muonToken
Definition: TSGFromL2Muon.h:40
edm::InputTag theL2CollectionLabel
Definition: TSGFromL2Muon.h:34
std::unique_ptr< TrackerSeedCleaner > theSeedCleaner
Definition: TSGFromL2Muon.h:39
bool empty() const
Definition: ParameterSet.h:202
std::unique_ptr< MuonServiceProxy > theService
Definition: TSGFromL2Muon.h:35
#define get

◆ ~TSGFromL2Muon()

TSGFromL2Muon::~TSGFromL2Muon ( )
overridedefault

Member Function Documentation

◆ beginRun()

void TSGFromL2Muon::beginRun ( const edm::Run run,
const edm::EventSetup es 
)
override

Definition at line 51 of file TSGFromL2Muon.cc.

References theSeedCleaner, theService, and theTkSeedGenerator.

51  {
52  //update muon proxy service
53  bool duringEvent = false;
54  theService->update(es, duringEvent);
55  theTkSeedGenerator->init(theService.get());
56  if (theSeedCleaner)
57  theSeedCleaner->init(theService.get());
58 }
std::unique_ptr< TrackerSeedGenerator > theTkSeedGenerator
Definition: TSGFromL2Muon.h:38
std::unique_ptr< TrackerSeedCleaner > theSeedCleaner
Definition: TSGFromL2Muon.h:39
std::unique_ptr< MuonServiceProxy > theService
Definition: TSGFromL2Muon.h:35

◆ fillDescriptions()

void TSGFromL2Muon::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 125 of file TSGFromL2Muon.cc.

References submitPVResolutionJobs::desc.

◆ produce()

void TSGFromL2Muon::produce ( edm::Event ev,
const edm::EventSetup es 
)
override

Definition at line 60 of file TSGFromL2Muon.cc.

References makeMEIFBenchmarkPlots::ev, edm::EventSetup::getData(), l2muonToken, LogDebug, eostools::move(), HLT_2023v12_cff::region, mps_fire::result, thePCut, thePtCut, theRegionBuilder, theSeedCleaner, theService, theTkSeedGenerator, and theTTopoToken.

60  {
61  auto result = std::make_unique<L3MuonTrajectorySeedCollection>();
62 
63  //Retrieve tracker topology from geometry
64  const TrackerTopology* tTopo = &es.getData(theTTopoToken);
65 
66  //intialize tools
67  theService->update(es);
68  theTkSeedGenerator->setEvent(ev);
69  if (theRegionBuilder)
70  theRegionBuilder->setEvent(ev, es);
71  if (theSeedCleaner)
72  theSeedCleaner->setEvent(ev);
73 
74  //retrieve L2 track collection
76  ev.getByToken(l2muonToken, l2muonH);
77 
78  // produce trajectory seed collection
79  LogDebug("TSGFromL2Muon") << l2muonH->size() << " l2 tracks.";
80 
81  for (unsigned int imu = 0; imu != l2muonH->size(); ++imu) {
82  //make a ref to l2 muon
83  reco::TrackRef muRef(l2muonH, imu);
84 
85  // cut on muons with low momenta
86  if (muRef->pt() < thePtCut || muRef->innerMomentum().Rho() < thePtCut || muRef->innerMomentum().R() < thePCut)
87  continue;
88 
89  //define the region of interest
90  std::unique_ptr<RectangularEtaPhiTrackingRegion> region;
91  if (theRegionBuilder) {
92  region = theRegionBuilder->region(muRef);
93  } else {
94  region = std::make_unique<RectangularEtaPhiTrackingRegion>();
95  }
96 
97  //Make seeds container
98  std::vector<TrajectorySeed> tkSeeds;
99 
100  //Make TrackCand
101  std::pair<const Trajectory*, reco::TrackRef> staCand((Trajectory*)nullptr, muRef);
102 
103  //Run seed generator to fill seed container
104  theTkSeedGenerator->trackerSeeds(staCand, *region, tTopo, tkSeeds);
105 
106  //Seed Cleaner From Direction
107  if (theSeedCleaner) {
108  theSeedCleaner->clean(muRef, *region, tkSeeds);
109  }
110 
111  for (unsigned int is = 0; is != tkSeeds.size(); ++is) {
112  result->push_back(L3MuonTrajectorySeed(tkSeeds[is], muRef));
113  }
114  }
115 
116  //ADDME: remove seed duplicate, keeping the ref to L2
117 
118  LogDebug("TSGFromL2Muon") << result->size() << " trajectory seeds to the events";
119 
120  //put in the event
121  ev.put(std::move(result));
122 }
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > theTTopoToken
Definition: TSGFromL2Muon.h:41
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
std::unique_ptr< TrackerSeedGenerator > theTkSeedGenerator
Definition: TSGFromL2Muon.h:38
std::unique_ptr< MuonTrackingRegionBuilder > theRegionBuilder
Definition: TSGFromL2Muon.h:37
edm::EDGetTokenT< reco::TrackCollection > l2muonToken
Definition: TSGFromL2Muon.h:40
std::unique_ptr< TrackerSeedCleaner > theSeedCleaner
Definition: TSGFromL2Muon.h:39
std::unique_ptr< MuonServiceProxy > theService
Definition: TSGFromL2Muon.h:35
def move(src, dest)
Definition: eostools.py:511
#define LogDebug(id)

Member Data Documentation

◆ l2muonToken

edm::EDGetTokenT<reco::TrackCollection> TSGFromL2Muon::l2muonToken
private

Definition at line 40 of file TSGFromL2Muon.h.

Referenced by produce(), and TSGFromL2Muon().

◆ theL2CollectionLabel

edm::InputTag TSGFromL2Muon::theL2CollectionLabel
private

Definition at line 34 of file TSGFromL2Muon.h.

Referenced by TSGFromL2Muon().

◆ thePCut

double TSGFromL2Muon::thePCut
private

Definition at line 36 of file TSGFromL2Muon.h.

Referenced by produce(), and TSGFromL2Muon().

◆ thePtCut

double TSGFromL2Muon::thePtCut
private

Definition at line 36 of file TSGFromL2Muon.h.

Referenced by produce(), and TSGFromL2Muon().

◆ theRegionBuilder

std::unique_ptr<MuonTrackingRegionBuilder> TSGFromL2Muon::theRegionBuilder
private

Definition at line 37 of file TSGFromL2Muon.h.

Referenced by produce(), and TSGFromL2Muon().

◆ theSeedCleaner

std::unique_ptr<TrackerSeedCleaner> TSGFromL2Muon::theSeedCleaner
private

Definition at line 39 of file TSGFromL2Muon.h.

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

◆ theService

std::unique_ptr<MuonServiceProxy> TSGFromL2Muon::theService
private

Definition at line 35 of file TSGFromL2Muon.h.

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

◆ theTkSeedGenerator

std::unique_ptr<TrackerSeedGenerator> TSGFromL2Muon::theTkSeedGenerator
private

Definition at line 38 of file TSGFromL2Muon.h.

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

◆ theTTopoToken

edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> TSGFromL2Muon::theTTopoToken
private

Definition at line 41 of file TSGFromL2Muon.h.

Referenced by produce(), and TSGFromL2Muon().