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 hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () 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(), reco::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 = std::unique_ptr<TrackerSeedGenerator>{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:191
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
T get(const Candidate &c)
Definition: component.h:55
TSGFromL2Muon::~TSGFromL2Muon ( )
overridedefault

Referenced by TSGFromL2Muon().

Member Function Documentation

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

Definition at line 49 of file TSGFromL2Muon.cc.

References theSeedCleaner, theService, and theTkSeedGenerator.

49  {
50  //update muon proxy service
51  theService->update(es);
52  theTkSeedGenerator->init(theService.get());
53  if (theSeedCleaner) theSeedCleaner->init(theService.get());
54 }
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 124 of file TSGFromL2Muon.cc.

References edm::ParameterSetDescription::setAllowAnything().

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

Definition at line 57 of file TSGFromL2Muon.cc.

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

57  {
58  auto result = std::make_unique<L3MuonTrajectorySeedCollection>();
59 
60  //Retrieve tracker topology from geometry
62  es.get<TrackerTopologyRcd>().get(tTopoHand);
63  const TrackerTopology *tTopo=tTopoHand.product();
64 
65  //intialize tools
66  theService->update(es);
67  theTkSeedGenerator->setEvent(ev);
68  if (theRegionBuilder) theRegionBuilder->setEvent(ev);
69  if (theSeedCleaner) 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
84  || muRef->innerMomentum().Rho() < thePtCut
85  || muRef->innerMomentum().R() < thePCut ) continue;
86 
87  //define the region of interest
88  std::unique_ptr<RectangularEtaPhiTrackingRegion> region;
89  if(theRegionBuilder){
90  region = theRegionBuilder->region(muRef);
91  }
92 
93  //Make seeds container
94  std::vector<TrajectorySeed> tkSeeds;
95 
96  //Make TrackCand
97  std::pair<const Trajectory*,reco::TrackRef> staCand((Trajectory*)nullptr, muRef);
98 
99  //Run seed generator to fill seed container
100  theTkSeedGenerator->trackerSeeds(staCand, *region, tTopo,tkSeeds);
101 
102  //Seed Cleaner From Direction
103  if(theSeedCleaner){
104  theSeedCleaner->clean(muRef,*region,tkSeeds);
105  }
106 
107  for (unsigned int is=0; is != tkSeeds.size(); ++is){
108  result->push_back( L3MuonTrajectorySeed(tkSeeds[is], muRef));
109  }
110 
111  }
112 
113 
114  //ADDME: remove seed duplicate, keeping the ref to L2
115 
116  LogDebug("TSGFromL2Muon")<<result->size()<<" trajectory seeds to the events";
117 
118  //put in the event
119  ev.put(std::move(result));
120 }
#define LogDebug(id)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:125
std::unique_ptr< TrackerSeedGenerator > theTkSeedGenerator
Definition: TSGFromL2Muon.h:37
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
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:71
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().