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::ParameterSet theConfig
 
edm::InputTag theL2CollectionLabel
 
double thePCut
 
double thePtCut
 
MuonTrackingRegionBuildertheRegionBuilder
 
TrackerSeedCleanertheSeedCleaner
 
MuonServiceProxytheService
 
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, MuonServiceProxy_cff::MuonServiceProxy, HiRegitMuonDetachedTripletStep_cff::MuonTrackingRegionBuilder, AlCaHLTBitMon_QueryRunRegistry::string, theConfig, theL2CollectionLabel, thePCut, thePtCut, theRegionBuilder, theSeedCleaner, theService, theTkSeedGenerator, and TrackerSeedCleaner_cfi::TrackerSeedCleaner.

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

Definition at line 47 of file TSGFromL2Muon.cc.

References theRegionBuilder, theSeedCleaner, theService, and theTkSeedGenerator.

47  {
48  delete theService;
49  if (theSeedCleaner) delete theSeedCleaner;
50  delete theTkSeedGenerator;
52 }
MuonTrackingRegionBuilder * theRegionBuilder
Definition: TSGFromL2Muon.h:37
TrackerSeedCleaner * theSeedCleaner
Definition: TSGFromL2Muon.h:39
MuonServiceProxy * theService
Definition: TSGFromL2Muon.h:35
TrackerSeedGenerator * theTkSeedGenerator
Definition: TSGFromL2Muon.h:38

Member Function Documentation

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

Definition at line 55 of file TSGFromL2Muon.cc.

References TrackerSeedGenerator::init(), TrackerSeedCleaner::init(), theSeedCleaner, theService, theTkSeedGenerator, and MuonServiceProxy::update().

55  {
56  //update muon proxy service
57  theService->update(es);
60 }
void update(const edm::EventSetup &setup)
update the services each event
TrackerSeedCleaner * theSeedCleaner
Definition: TSGFromL2Muon.h:39
MuonServiceProxy * theService
Definition: TSGFromL2Muon.h:35
virtual void init(const MuonServiceProxy *service)
virtual void init(const MuonServiceProxy *service)
intizialization
TrackerSeedGenerator * theTkSeedGenerator
Definition: TSGFromL2Muon.h:38
void TSGFromL2Muon::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 130 of file TSGFromL2Muon.cc.

References edm::ParameterSetDescription::setAllowAnything().

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

Definition at line 63 of file TSGFromL2Muon.cc.

References TrackerSeedCleaner::clean(), edm::EventSetup::get(), edm::Event::getByToken(), l2muonToken, LogDebug, eostools::move(), edm::Event::put(), MuonTrackingRegionBuilder::region(), mps_fire::result, TrackerSeedGenerator::setEvent(), TrackerSeedCleaner::setEvent(), MuonTrackingRegionBuilder::setEvent(), thePCut, thePtCut, theRegionBuilder, theSeedCleaner, theService, theTkSeedGenerator, TrackerSeedGenerator::trackerSeeds(), and MuonServiceProxy::update().

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

Member Data Documentation

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

Definition at line 40 of file TSGFromL2Muon.h.

Referenced by produce(), and TSGFromL2Muon().

edm::ParameterSet TSGFromL2Muon::theConfig
private

Definition at line 33 of file TSGFromL2Muon.h.

Referenced by TSGFromL2Muon().

edm::InputTag TSGFromL2Muon::theL2CollectionLabel
private

Definition at line 34 of file TSGFromL2Muon.h.

Referenced by TSGFromL2Muon().

double TSGFromL2Muon::thePCut
private

Definition at line 36 of file TSGFromL2Muon.h.

Referenced by produce(), and TSGFromL2Muon().

double TSGFromL2Muon::thePtCut
private

Definition at line 36 of file TSGFromL2Muon.h.

Referenced by produce(), and TSGFromL2Muon().

MuonTrackingRegionBuilder* TSGFromL2Muon::theRegionBuilder
private

Definition at line 37 of file TSGFromL2Muon.h.

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

TrackerSeedCleaner* TSGFromL2Muon::theSeedCleaner
private

Definition at line 39 of file TSGFromL2Muon.h.

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

MuonServiceProxy* TSGFromL2Muon::theService
private

Definition at line 35 of file TSGFromL2Muon.h.

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

TrackerSeedGenerator* TSGFromL2Muon::theTkSeedGenerator
private

Definition at line 38 of file TSGFromL2Muon.h.

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