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

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
 

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

Definition at line 24 of file TSGFromL2Muon.h.

Constructor & Destructor Documentation

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

Definition at line 9 of file TSGFromL2Muon.cc.

References edm::ParameterSet::empty(), timingPdfMaker::get, edm::ParameterSet::getParameter(), l2muonToken, AlCaHLTBitMon_QueryRunRegistry::string, theL2CollectionLabel, thePCut, thePtCut, theRegionBuilder, theSeedCleaner, theService, theTkSeedGenerator, and ~TSGFromL2Muon().

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

Referenced by TSGFromL2Muon().

Member Function Documentation

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

Definition at line 47 of file TSGFromL2Muon.cc.

References theSeedCleaner, theService, and theTkSeedGenerator.

47  {
48  //update muon proxy service
49  theService->update(es);
50  theTkSeedGenerator->init(theService.get());
51  if (theSeedCleaner)
52  theSeedCleaner->init(theService.get());
53 }
std::unique_ptr< TrackerSeedGenerator > theTkSeedGenerator
Definition: TSGFromL2Muon.h:37
std::unique_ptr< TrackerSeedCleaner > theSeedCleaner
Definition: TSGFromL2Muon.h:38
std::unique_ptr< MuonServiceProxy > theService
Definition: TSGFromL2Muon.h:34
void TSGFromL2Muon::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 120 of file TSGFromL2Muon.cc.

References edm::ParameterSetDescription::setAllowAnything().

120  {
122  desc.setAllowAnything();
123 }
void setAllowAnything()
allow any parameter label/value pairs
void TSGFromL2Muon::produce ( edm::Event ev,
const edm::EventSetup es 
)
override

Definition at line 55 of file TSGFromL2Muon.cc.

References edm::EventSetup::get(), edm::Event::getByToken(), l2muonToken, LogDebug, eostools::move(), edm::Event::put(), HLT_2018_cff::region, mps_fire::result, thePCut, thePtCut, theRegionBuilder, theSeedCleaner, theService, and theTkSeedGenerator.

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

Member Data Documentation

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

Definition at line 39 of file TSGFromL2Muon.h.

Referenced by produce(), and TSGFromL2Muon().

edm::InputTag TSGFromL2Muon::theL2CollectionLabel
private

Definition at line 33 of file TSGFromL2Muon.h.

Referenced by TSGFromL2Muon().

double TSGFromL2Muon::thePCut
private

Definition at line 35 of file TSGFromL2Muon.h.

Referenced by produce(), and TSGFromL2Muon().

double TSGFromL2Muon::thePtCut
private

Definition at line 35 of file TSGFromL2Muon.h.

Referenced by produce(), and TSGFromL2Muon().

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

Definition at line 36 of file TSGFromL2Muon.h.

Referenced by produce(), and TSGFromL2Muon().

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

Definition at line 38 of file TSGFromL2Muon.h.

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

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

Definition at line 34 of file TSGFromL2Muon.h.

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

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

Definition at line 37 of file TSGFromL2Muon.h.

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