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
 
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 
16  //region builder
17  edm::ParameterSet regionBuilderPSet = theConfig.getParameter<edm::ParameterSet>("MuonTrackingRegionBuilder");
18  //ability to no define a region
19  if (!regionBuilderPSet.empty()){
20  theRegionBuilder = new MuonTrackingRegionBuilder(regionBuilderPSet);
21  }
22 
23  //seed generator
24  //std::string seedGenPSetLabel = theConfig.getParameter<std::string>("tkSeedGenerator");
25  //edm::ParameterSet seedGenPSet = theConfig.getParameter<edm::ParameterSet>(seedGenPSetLabel);
26  edm::ParameterSet seedGenPSet = theConfig.getParameter<edm::ParameterSet>("TkSeedGenerator");
27  std::string seedGenName = seedGenPSet.getParameter<std::string>("ComponentName");
28 
30  theTkSeedGenerator = TrackerSeedGeneratorFactory::get()->create(seedGenName, seedGenPSet,iC);
31 
32  //seed cleaner
33  edm::ParameterSet trackerSeedCleanerPSet = theConfig.getParameter<edm::ParameterSet>("TrackerSeedCleaner");
34  //to activate or not the cleaner
35  if (!trackerSeedCleanerPSet.empty()){
36  theSeedCleaner = new TrackerSeedCleaner(trackerSeedCleanerPSet,iC);
37  }
38 
39 
40  l2muonToken = consumes<reco::TrackCollection>(theL2CollectionLabel);
41 }
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 43 of file TSGFromL2Muon.cc.

References theRegionBuilder, theSeedCleaner, theService, and theTkSeedGenerator.

44 {
45  delete theService;
46  if (theSeedCleaner) delete theSeedCleaner;
47  delete theTkSeedGenerator;
49 }
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 51 of file TSGFromL2Muon.cc.

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

52 {
53  //update muon proxy service
54  theService->update(es);
55 
59 
60 }
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 62 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().

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