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 ()
 
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 ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

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
 
typedef WorkerT< EDProducerWorkerType
 
- 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::EDProducer
CurrentProcessingContext const * currentContext () const
 
- 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 20 of file TSGFromL2Muon.h.

Constructor & Destructor Documentation

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

Definition at line 25 of file TSGFromL2Muon.cc.

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

27 {
28  produces<L3MuonTrajectorySeedCollection>();
29 
30  edm::ParameterSet serviceParameters = cfg.getParameter<edm::ParameterSet>("ServiceParameters");
31  theService = new MuonServiceProxy(serviceParameters);
32 
33  thePtCut = cfg.getParameter<double>("PtCut");
34  thePCut = cfg.getParameter<double>("PCut");
35 
36  theL2CollectionLabel = cfg.getParameter<edm::InputTag>("MuonCollectionLabel");
37 
38  //region builder
39  edm::ParameterSet regionBuilderPSet = theConfig.getParameter<edm::ParameterSet>("MuonTrackingRegionBuilder");
40  //ability to no define a region
41  if (!regionBuilderPSet.empty()){
42  theRegionBuilder = new MuonTrackingRegionBuilder(regionBuilderPSet);
43  }
44 
45  //seed generator
46  //std::string seedGenPSetLabel = theConfig.getParameter<std::string>("tkSeedGenerator");
47  //edm::ParameterSet seedGenPSet = theConfig.getParameter<edm::ParameterSet>(seedGenPSetLabel);
48  edm::ParameterSet seedGenPSet = theConfig.getParameter<edm::ParameterSet>("TkSeedGenerator");
49  std::string seedGenName = seedGenPSet.getParameter<std::string>("ComponentName");
50 
51  theTkSeedGenerator = TrackerSeedGeneratorFactory::get()->create(seedGenName, seedGenPSet);
52 
53  //seed cleaner
54  edm::ParameterSet trackerSeedCleanerPSet = theConfig.getParameter<edm::ParameterSet>("TrackerSeedCleaner");
55  //to activate or not the cleaner
56  if (!trackerSeedCleanerPSet.empty()){
57  theSeedCleaner = new TrackerSeedCleaner(trackerSeedCleanerPSet);
58  }
59 
60 }
T getParameter(std::string const &) const
bool empty() const
Definition: ParameterSet.h:219
MuonTrackingRegionBuilder * theRegionBuilder
Definition: TSGFromL2Muon.h:33
TrackerSeedCleaner * theSeedCleaner
Definition: TSGFromL2Muon.h:35
edm::InputTag theL2CollectionLabel
Definition: TSGFromL2Muon.h:29
MuonServiceProxy * theService
Definition: TSGFromL2Muon.h:31
edm::ParameterSet theConfig
Definition: TSGFromL2Muon.h:28
TrackerSeedGenerator * theTkSeedGenerator
Definition: TSGFromL2Muon.h:34
T get(const Candidate &c)
Definition: component.h:56
TSGFromL2Muon::~TSGFromL2Muon ( )
virtual

Definition at line 62 of file TSGFromL2Muon.cc.

References theRegionBuilder, theSeedCleaner, theService, and theTkSeedGenerator.

63 {
64  delete theService;
65  if (theSeedCleaner) delete theSeedCleaner;
66  delete theTkSeedGenerator;
68 }
MuonTrackingRegionBuilder * theRegionBuilder
Definition: TSGFromL2Muon.h:33
TrackerSeedCleaner * theSeedCleaner
Definition: TSGFromL2Muon.h:35
MuonServiceProxy * theService
Definition: TSGFromL2Muon.h:31
TrackerSeedGenerator * theTkSeedGenerator
Definition: TSGFromL2Muon.h:34

Member Function Documentation

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

Reimplemented from edm::EDProducer.

Definition at line 70 of file TSGFromL2Muon.cc.

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

71 {
72  //update muon proxy service
73  theService->update(es);
74 
78 
79 }
void update(const edm::EventSetup &setup)
update the services each event
MuonTrackingRegionBuilder * theRegionBuilder
Definition: TSGFromL2Muon.h:33
TrackerSeedCleaner * theSeedCleaner
Definition: TSGFromL2Muon.h:35
MuonServiceProxy * theService
Definition: TSGFromL2Muon.h:31
virtual void init(const MuonServiceProxy *service)
void init(const MuonServiceProxy *)
virtual void init(const MuonServiceProxy *service)
intizialization
TrackerSeedGenerator * theTkSeedGenerator
Definition: TSGFromL2Muon.h:34
void TSGFromL2Muon::produce ( edm::Event ev,
const edm::EventSetup es 
)
overridevirtual

Implements edm::EDProducer.

Definition at line 81 of file TSGFromL2Muon.cc.

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

82 {
83  std::auto_ptr<L3MuonTrajectorySeedCollection> result(new L3MuonTrajectorySeedCollection());
84 
85  //Retrieve tracker topology from geometry
87  es.get<IdealGeometryRecord>().get(tTopoHand);
88  const TrackerTopology *tTopo=tTopoHand.product();
89 
90 
91  //intialize tools
92  theService->update(es);
96 
97  //retrieve L2 track collection
99  ev.getByLabel(theL2CollectionLabel ,l2muonH);
100 
101  // produce trajectoryseed collection
102  unsigned int imu=0;
103  unsigned int imuMax=l2muonH->size();
104  LogDebug("TSGFromL2Muon")<<imuMax<<" l2 tracks.";
105 
106  for (;imu!=imuMax;++imu){
107  //make a ref to l2 muon
108  reco::TrackRef muRef(l2muonH, imu);
109 
110  // cut on muons with low momenta
111  if ( muRef->pt() < thePtCut
112  || muRef->innerMomentum().Rho() < thePtCut
113  || muRef->innerMomentum().R() < thePCut ) continue;
114 
115  //define the region of interest
116  std::unique_ptr<RectangularEtaPhiTrackingRegion> region;
117  if(theRegionBuilder){
118  region.reset(theRegionBuilder->region(muRef));
119  }
120 
121  //get the seeds
122  std::vector<TrajectorySeed> tkSeeds;
123  //make this stupid TrackCand
124  std::pair<const Trajectory*,reco::TrackRef> staCand((Trajectory*)(0), muRef);
125  theTkSeedGenerator->trackerSeeds(staCand, *region, tTopo,tkSeeds);
126 
127  //Seed Cleaner From Direction
128  //clean them internatly
129  if(theSeedCleaner){
130  theSeedCleaner->clean(muRef,*region,tkSeeds);
131  LogDebug("TSGFromL2Muon") << tkSeeds.size() << " seeds for this L2 afther cleaning.";
132  }
133 
134  unsigned int is=0;
135  unsigned int isMax=tkSeeds.size();
136  LogDebug("TSGFromL2Muon")<<isMax<<" seeds for this L2.";
137  for (;is!=isMax;++is){
138  result->push_back( L3MuonTrajectorySeed(tkSeeds[is], muRef));
139  }//tkseed loop
140 
141  }//l2muon loop
142 
143 
144  //ADDME
145  //remove seed duplicate, keeping the ref to L2
146 
147  LogDebug("TSGFromL2Muon")<<result->size()<<" trajectory seeds to the events";
148 
149  //put in the event
150  ev.put(result);
151 }
#define LogDebug(id)
void update(const edm::EventSetup &setup)
update the services each event
RectangularEtaPhiTrackingRegion * region(const reco::TrackRef &) const
define tracking region
MuonTrackingRegionBuilder * theRegionBuilder
Definition: TSGFromL2Muon.h:33
TrackerSeedCleaner * theSeedCleaner
Definition: TSGFromL2Muon.h:35
virtual void setEvent(const edm::Event &)
pass the Event to the algo at each event
std::vector< L3MuonTrajectorySeed > L3MuonTrajectorySeedCollection
virtual void trackerSeeds(const TrackCand &, const TrackingRegion &, const TrackerTopology *, BTSeedCollection &)
virtual void setEvent(const edm::Event &)
setEvent
edm::InputTag theL2CollectionLabel
Definition: TSGFromL2Muon.h:29
MuonServiceProxy * theService
Definition: TSGFromL2Muon.h:31
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:94
tuple result
Definition: query.py:137
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
TrackerSeedGenerator * theTkSeedGenerator
Definition: TSGFromL2Muon.h:34
virtual void setEvent(const edm::Event &)
virtual void clean(const reco::TrackRef &, const RectangularEtaPhiTrackingRegion &region, tkSeeds &)
the cleaner

Member Data Documentation

edm::ParameterSet TSGFromL2Muon::theConfig
private

Definition at line 28 of file TSGFromL2Muon.h.

Referenced by TSGFromL2Muon().

edm::InputTag TSGFromL2Muon::theL2CollectionLabel
private

Definition at line 29 of file TSGFromL2Muon.h.

Referenced by produce(), and TSGFromL2Muon().

double TSGFromL2Muon::thePCut
private

Definition at line 32 of file TSGFromL2Muon.h.

Referenced by produce(), and TSGFromL2Muon().

double TSGFromL2Muon::thePtCut
private

Definition at line 32 of file TSGFromL2Muon.h.

Referenced by produce(), and TSGFromL2Muon().

MuonTrackingRegionBuilder* TSGFromL2Muon::theRegionBuilder
private

Definition at line 33 of file TSGFromL2Muon.h.

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

TrackerSeedCleaner* TSGFromL2Muon::theSeedCleaner
private

Definition at line 35 of file TSGFromL2Muon.h.

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

MuonServiceProxy* TSGFromL2Muon::theService
private

Definition at line 31 of file TSGFromL2Muon.h.

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

TrackerSeedGenerator* TSGFromL2Muon::theTkSeedGenerator
private

Definition at line 34 of file TSGFromL2Muon.h.

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