CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
TSGFromL2Muon Class Reference

#include <TSGFromL2Muon.h>

Inheritance diagram for TSGFromL2Muon:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

virtual void beginRun (const edm::Run &run, const edm::EventSetup &es) override
 
virtual void produce (edm::Event &ev, const edm::EventSetup &es) override
 
 TSGFromL2Muon (const edm::ParameterSet &cfg)
 
virtual ~TSGFromL2Muon ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

edm::EDGetTokenT
< reco::TrackCollection
l2muonToken
 
edm::ParameterSet theConfig
 
edm::InputTag theL2CollectionLabel
 
double thePCut
 
double thePtCut
 
MuonTrackingRegionBuildertheRegionBuilder
 
TrackerSeedCleanertheSeedCleaner
 
MuonServiceProxytheService
 
TrackerSeedGeneratortheTkSeedGenerator
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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 41 of file TSGFromL2Muon.h.

Constructor & Destructor Documentation

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

Definition at line 3 of file TSGFromL2Muon.cc.

References edm::EDConsumerBase::consumesCollector(), edm::ParameterSet::empty(), reco::get(), edm::ParameterSet::getParameter(), l2muonToken, MuonServiceProxy_cff::MuonServiceProxy, AlCaHLTBitMon_QueryRunRegistry::string, theConfig, theL2CollectionLabel, thePCut, thePtCut, theRegionBuilder, theSeedCleaner, theService, and theTkSeedGenerator.

5 {
6  produces<L3MuonTrajectorySeedCollection>();
7 
8  edm::ParameterSet serviceParameters = cfg.getParameter<edm::ParameterSet>("ServiceParameters");
9  theService = new MuonServiceProxy(serviceParameters);
10 
11  thePtCut = cfg.getParameter<double>("PtCut");
12  thePCut = cfg.getParameter<double>("PCut");
13 
14  theL2CollectionLabel = cfg.getParameter<edm::InputTag>("MuonCollectionLabel");
15 
17 
18  //region builder
19  edm::ParameterSet regionBuilderPSet = theConfig.getParameter<edm::ParameterSet>("MuonTrackingRegionBuilder");
20  //ability to no define a region
21  if (!regionBuilderPSet.empty()){
22  theRegionBuilder = new MuonTrackingRegionBuilder(regionBuilderPSet, iC);
23  }
24 
25  //seed generator
26  //std::string seedGenPSetLabel = theConfig.getParameter<std::string>("tkSeedGenerator");
27  //edm::ParameterSet seedGenPSet = theConfig.getParameter<edm::ParameterSet>(seedGenPSetLabel);
28  edm::ParameterSet seedGenPSet = theConfig.getParameter<edm::ParameterSet>("TkSeedGenerator");
29  std::string seedGenName = seedGenPSet.getParameter<std::string>("ComponentName");
30 
31  theTkSeedGenerator = TrackerSeedGeneratorFactory::get()->create(seedGenName, seedGenPSet,iC);
32 
33  //seed cleaner
34  edm::ParameterSet trackerSeedCleanerPSet = theConfig.getParameter<edm::ParameterSet>("TrackerSeedCleaner");
35  //to activate or not the cleaner
36  if (!trackerSeedCleanerPSet.empty()){
37  theSeedCleaner = new TrackerSeedCleaner(trackerSeedCleanerPSet,iC);
38  }
39 
40 
41  l2muonToken = consumes<reco::TrackCollection>(theL2CollectionLabel);
42 }
T getParameter(std::string const &) const
bool empty() const
Definition: ParameterSet.h:216
MuonTrackingRegionBuilder * theRegionBuilder
Definition: TSGFromL2Muon.h:54
TrackerSeedCleaner * theSeedCleaner
Definition: TSGFromL2Muon.h:56
edm::EDGetTokenT< reco::TrackCollection > l2muonToken
Definition: TSGFromL2Muon.h:59
edm::InputTag theL2CollectionLabel
Definition: TSGFromL2Muon.h:50
MuonServiceProxy * theService
Definition: TSGFromL2Muon.h:52
edm::ParameterSet theConfig
Definition: TSGFromL2Muon.h:49
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
TrackerSeedGenerator * theTkSeedGenerator
Definition: TSGFromL2Muon.h:55
T get(const Candidate &c)
Definition: component.h:55
TSGFromL2Muon::~TSGFromL2Muon ( )
virtual

Definition at line 44 of file TSGFromL2Muon.cc.

References theRegionBuilder, theSeedCleaner, theService, and theTkSeedGenerator.

45 {
46  delete theService;
47  if (theSeedCleaner) delete theSeedCleaner;
48  delete theTkSeedGenerator;
50 }
MuonTrackingRegionBuilder * theRegionBuilder
Definition: TSGFromL2Muon.h:54
TrackerSeedCleaner * theSeedCleaner
Definition: TSGFromL2Muon.h:56
MuonServiceProxy * theService
Definition: TSGFromL2Muon.h:52
TrackerSeedGenerator * theTkSeedGenerator
Definition: TSGFromL2Muon.h:55

Member Function Documentation

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

Reimplemented from edm::EDProducer.

Definition at line 52 of file TSGFromL2Muon.cc.

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

53 {
54  //update muon proxy service
55  theService->update(es);
56 
60 
61 }
void update(const edm::EventSetup &setup)
update the services each event
MuonTrackingRegionBuilder * theRegionBuilder
Definition: TSGFromL2Muon.h:54
TrackerSeedCleaner * theSeedCleaner
Definition: TSGFromL2Muon.h:56
MuonServiceProxy * theService
Definition: TSGFromL2Muon.h:52
virtual void init(const MuonServiceProxy *service)
void init(const MuonServiceProxy *)
virtual void init(const MuonServiceProxy *service)
intizialization
TrackerSeedGenerator * theTkSeedGenerator
Definition: TSGFromL2Muon.h:55
void TSGFromL2Muon::produce ( edm::Event ev,
const edm::EventSetup es 
)
overridevirtual

Implements edm::EDProducer.

Definition at line 63 of file TSGFromL2Muon.cc.

References TrackerSeedCleaner::clean(), edm::EventSetup::get(), edm::Event::getByToken(), l2muonToken, LogDebug, edm::ESHandle< class >::product(), edm::Event::put(), MuonTrackingRegionBuilder::region(), query::result, TrackerSeedGenerator::setEvent(), MuonTrackingRegionBuilder::setEvent(), TrackerSeedCleaner::setEvent(), thePCut, thePtCut, theRegionBuilder, theSeedCleaner, theService, theTkSeedGenerator, TrackerSeedGenerator::trackerSeeds(), and MuonServiceProxy::update().

64 {
65  std::auto_ptr<L3MuonTrajectorySeedCollection> result(new L3MuonTrajectorySeedCollection());
66 
67  //Retrieve tracker topology from geometry
69  es.get<IdealGeometryRecord>().get(tTopoHand);
70  const TrackerTopology *tTopo=tTopoHand.product();
71 
72 
73  //intialize tools
74  theService->update(es);
78 
79  //retrieve L2 track collection
81  ev.getByToken(l2muonToken ,l2muonH);
82 
83  // produce trajectoryseed collection
84  unsigned int imu=0;
85  unsigned int imuMax=l2muonH->size();
86  LogDebug("TSGFromL2Muon")<<imuMax<<" l2 tracks.";
87 
88  for (;imu!=imuMax;++imu){
89  //make a ref to l2 muon
90  reco::TrackRef muRef(l2muonH, imu);
91 
92  // cut on muons with low momenta
93  if ( muRef->pt() < thePtCut
94  || muRef->innerMomentum().Rho() < thePtCut
95  || muRef->innerMomentum().R() < thePCut ) continue;
96 
97  //define the region of interest
98  std::unique_ptr<RectangularEtaPhiTrackingRegion> region;
99  if(theRegionBuilder){
100  region.reset(theRegionBuilder->region(muRef));
101  }
102 
103  //get the seeds
104  std::vector<TrajectorySeed> tkSeeds;
105  //make this stupid TrackCand
106  std::pair<const Trajectory*,reco::TrackRef> staCand((Trajectory*)(0), muRef);
107  theTkSeedGenerator->trackerSeeds(staCand, *region, tTopo,tkSeeds);
108 
109  //Seed Cleaner From Direction
110  //clean them internatly
111  if(theSeedCleaner){
112  theSeedCleaner->clean(muRef,*region,tkSeeds);
113  LogDebug("TSGFromL2Muon") << tkSeeds.size() << " seeds for this L2 afther cleaning.";
114  }
115 
116  unsigned int is=0;
117  unsigned int isMax=tkSeeds.size();
118  LogDebug("TSGFromL2Muon")<<isMax<<" seeds for this L2.";
119  for (;is!=isMax;++is){
120  result->push_back( L3MuonTrajectorySeed(tkSeeds[is], muRef));
121  }//tkseed loop
122 
123  }//l2muon loop
124 
125 
126  //ADDME
127  //remove seed duplicate, keeping the ref to L2
128 
129  LogDebug("TSGFromL2Muon")<<result->size()<<" trajectory seeds to the events";
130 
131  //put in the event
132  ev.put(result);
133 }
#define LogDebug(id)
void update(const edm::EventSetup &setup)
update the services each event
RectangularEtaPhiTrackingRegion * region(const reco::TrackRef &) const
define tracking region
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:446
MuonTrackingRegionBuilder * theRegionBuilder
Definition: TSGFromL2Muon.h:54
TrackerSeedCleaner * theSeedCleaner
Definition: TSGFromL2Muon.h:56
virtual void setEvent(const edm::Event &)
pass the Event to the algo at each event
std::vector< L3MuonTrajectorySeed > L3MuonTrajectorySeedCollection
edm::EDGetTokenT< reco::TrackCollection > l2muonToken
Definition: TSGFromL2Muon.h:59
virtual void trackerSeeds(const TrackCand &, const TrackingRegion &, const TrackerTopology *, BTSeedCollection &)
virtual void setEvent(const edm::Event &)
setEvent
MuonServiceProxy * theService
Definition: TSGFromL2Muon.h:52
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:113
tuple result
Definition: query.py:137
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:86
TrackerSeedGenerator * theTkSeedGenerator
Definition: TSGFromL2Muon.h:55
virtual void setEvent(const edm::Event &)
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 59 of file TSGFromL2Muon.h.

Referenced by produce(), and TSGFromL2Muon().

edm::ParameterSet TSGFromL2Muon::theConfig
private

Definition at line 49 of file TSGFromL2Muon.h.

Referenced by TSGFromL2Muon().

edm::InputTag TSGFromL2Muon::theL2CollectionLabel
private

Definition at line 50 of file TSGFromL2Muon.h.

Referenced by TSGFromL2Muon().

double TSGFromL2Muon::thePCut
private

Definition at line 53 of file TSGFromL2Muon.h.

Referenced by produce(), and TSGFromL2Muon().

double TSGFromL2Muon::thePtCut
private

Definition at line 53 of file TSGFromL2Muon.h.

Referenced by produce(), and TSGFromL2Muon().

MuonTrackingRegionBuilder* TSGFromL2Muon::theRegionBuilder
private

Definition at line 54 of file TSGFromL2Muon.h.

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

TrackerSeedCleaner* TSGFromL2Muon::theSeedCleaner
private

Definition at line 56 of file TSGFromL2Muon.h.

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

MuonServiceProxy* TSGFromL2Muon::theService
private

Definition at line 52 of file TSGFromL2Muon.h.

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

TrackerSeedGenerator* TSGFromL2Muon::theTkSeedGenerator
private

Definition at line 55 of file TSGFromL2Muon.h.

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