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<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

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
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (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
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

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::EDConsumerBase::consumesCollector(), 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 
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
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
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:127
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:508
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
const T & get() const
Definition: EventSetup.h:55
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().