#include <RecoMuon/TrackerSeedGenerator/plugins/TSGFromL2Muon.h>
Public Member Functions | |
virtual void | beginJob (const edm::EventSetup &es) |
virtual void | produce (edm::Event &ev, const edm::EventSetup &es) |
TSGFromL2Muon (const edm::ParameterSet &cfg) | |
virtual | ~TSGFromL2Muon () |
Private Attributes | |
TH1F * | h_nGoodSeedPerEvent |
TH1F * | h_nGoodSeedPerTrack |
TH1F * | h_nSeedPerTrack |
edm::ParameterSet | theConfig |
edm::InputTag | theL2CollectionLabel |
double | thePtCut |
MuonTrackingRegionBuilder * | theRegionBuilder |
TrackerSeedCleaner * | theSeedCleaner |
MuonServiceProxy * | theService |
TrackerSeedGenerator * | theTkSeedGenerator |
bool | useTFileService_ |
Definition at line 21 of file TSGFromL2Muon.h.
TSGFromL2Muon::TSGFromL2Muon | ( | const edm::ParameterSet & | cfg | ) |
Definition at line 28 of file TSGFromL2Muon.cc.
References edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), MuonServiceProxy_cff::MuonServiceProxy, theL2CollectionLabel, thePtCut, theService, and useTFileService_.
00029 : theConfig(cfg), theTkSeedGenerator(0) 00030 { 00031 produces<L3MuonTrajectorySeedCollection>(); 00032 00033 edm::ParameterSet serviceParameters = cfg.getParameter<edm::ParameterSet>("ServiceParameters"); 00034 theService = new MuonServiceProxy(serviceParameters); 00035 00036 thePtCut = cfg.getParameter<double>("PtCut"); 00037 00038 theL2CollectionLabel = cfg.getParameter<edm::InputTag>("MuonCollectionLabel"); 00039 useTFileService_ = cfg.getUntrackedParameter<bool>("UseTFileService",false); 00040 }
TSGFromL2Muon::~TSGFromL2Muon | ( | ) | [virtual] |
void TSGFromL2Muon::beginJob | ( | const edm::EventSetup & | es | ) | [virtual] |
Reimplemented from edm::EDProducer.
Definition at line 46 of file TSGFromL2Muon.cc.
References edm::ParameterSet::empty(), DBSPlugin::get(), edm::ParameterSet::getParameter(), h_nGoodSeedPerEvent, h_nGoodSeedPerTrack, h_nSeedPerTrack, TrackerSeedCleaner::init(), theConfig, theRegionBuilder, theSeedCleaner, theService, theTkSeedGenerator, and useTFileService_.
00047 { 00048 //update muon proxy service 00049 theService->update(es); 00050 00051 //region builder 00052 edm::ParameterSet regionBuilderPSet = theConfig.getParameter<edm::ParameterSet>("MuonTrackingRegionBuilder"); 00053 //ability to no define a region 00054 if (regionBuilderPSet.empty()){ 00055 theRegionBuilder = 0;} 00056 else{ 00057 theRegionBuilder = new MuonTrackingRegionBuilder(regionBuilderPSet,theService); 00058 } 00059 00060 //seed generator 00061 std::string seedGenPSetLabel = theConfig.getParameter<std::string>("tkSeedGenerator"); 00062 edm::ParameterSet seedGenPSet = theConfig.getParameter<edm::ParameterSet>(seedGenPSetLabel); 00063 std::string seedGenName = seedGenPSet.getParameter<std::string>("ComponentName"); 00064 seedGenPSet.addUntrackedParameter<bool>("UseTFileService",useTFileService_); 00065 theTkSeedGenerator = TrackerSeedGeneratorFactory::get()->create(seedGenName, seedGenPSet); 00066 theTkSeedGenerator->init(theService); 00067 00068 //seed cleaner 00069 edm::ParameterSet trackerSeedCleanerPSet = theConfig.getParameter<edm::ParameterSet>("TrackerSeedCleaner"); 00070 //to activate or not the cleaner 00071 if (trackerSeedCleanerPSet.empty()) 00072 theSeedCleaner=0; 00073 else{ 00074 theSeedCleaner = new TrackerSeedCleaner(trackerSeedCleanerPSet); 00075 theSeedCleaner->init(theService); 00076 } 00077 00078 if(useTFileService_) { 00079 edm::Service<TFileService> fs; 00080 h_nSeedPerTrack = fs->make<TH1F>("nSeedPerTrack","nSeedPerTrack",76,-0.5,75.5); 00081 h_nGoodSeedPerTrack = fs->make<TH1F>("nGoodSeedPerTrack","nGoodSeedPerTrack",75,-0.5,75.5); 00082 h_nGoodSeedPerEvent = fs->make<TH1F>("nGoodSeedPerEvent","nGoodSeedPerEvent",75,-0.5,75.5); 00083 } else { 00084 h_nSeedPerTrack = 0; 00085 h_nGoodSeedPerEvent = 0; 00086 h_nGoodSeedPerTrack = 0; 00087 } 00088 00089 }
void TSGFromL2Muon::produce | ( | edm::Event & | ev, | |
const edm::EventSetup & | es | |||
) | [virtual] |
Implements edm::EDProducer.
Definition at line 92 of file TSGFromL2Muon.cc.
References TrackerSeedCleaner::clean(), TrackingRegionBase::direction(), RectangularEtaPhiTrackingRegion::etaRange(), edm::Event::getByLabel(), h_nGoodSeedPerEvent, h_nGoodSeedPerTrack, h_nSeedPerTrack, LogDebug, TrackingRegionBase::origin(), TrackingRegionBase::originRBound(), TrackingRegionBase::originZBound(), RectangularEtaPhiTrackingRegion::phiMargin(), TrackingRegionBase::ptMin(), edm::Event::put(), MuonTrackingRegionBuilder::region(), HLT_VtxMuL3::result, MuonTrackingRegionBuilder::setEvent(), TrackerSeedGenerator::setEvent(), TrackerSeedCleaner::setEvent(), theL2CollectionLabel, thePtCut, theRegionBuilder, theSeedCleaner, theService, theTkSeedGenerator, and TrackerSeedGenerator::trackerSeeds().
00093 { 00094 std::auto_ptr<L3MuonTrajectorySeedCollection> result(new L3MuonTrajectorySeedCollection()); 00095 00096 //intialize tools 00097 theService->update(es); 00098 theTkSeedGenerator->setEvent(ev); 00099 if (theRegionBuilder) theRegionBuilder->setEvent(ev); 00100 if (theSeedCleaner) theSeedCleaner->setEvent(ev); 00101 00102 //retrieve L2 track collection 00103 edm::Handle<reco::TrackCollection> l2muonH; 00104 ev.getByLabel(theL2CollectionLabel ,l2muonH); 00105 00106 // produce trajectoryseed collection 00107 uint imu=0; 00108 uint imuMax=l2muonH->size(); 00109 LogDebug("TSGFromL2Muon")<<imuMax<<" l2 tracks."; 00110 00111 for (;imu!=imuMax;++imu){ 00112 //make a ref to l2 muon 00113 reco::TrackRef muRef(l2muonH, imu); 00114 00115 // cut on muons with low momenta 00116 if ( muRef->pt() < thePtCut 00117 || muRef->innerMomentum().Rho() < thePtCut 00118 || muRef->innerMomentum().R() < 2.5 ) continue; 00119 00120 //define the region of interest 00121 RectangularEtaPhiTrackingRegion region; 00122 if(theRegionBuilder){ 00123 RectangularEtaPhiTrackingRegion * region1 = theRegionBuilder->region(muRef); 00124 00125 TkTrackingRegionsMargin<float> etaMargin(fabs(region1->etaRange().min() - region1->etaRange().mean()), 00126 fabs(region1->etaRange().max() - region1->etaRange().mean())); 00127 00128 region=RectangularEtaPhiTrackingRegion(region1->direction(), 00129 region1->origin(), 00130 region1->ptMin(), 00131 region1->originRBound(), 00132 region1->originZBound(), 00133 etaMargin, 00134 region1->phiMargin()); 00135 delete region1; 00136 } 00137 00138 //get the seeds 00139 std::vector<TrajectorySeed> tkSeeds; 00140 //make this stupid TrackCand 00141 std::pair<const Trajectory*,reco::TrackRef> staCand(0, muRef); 00142 theTkSeedGenerator->trackerSeeds(staCand, region, tkSeeds); 00143 if(h_nSeedPerTrack) h_nSeedPerTrack->Fill(tkSeeds.size()); 00144 00145 //Seed Cleaner From Direction 00146 //clean them internatly 00147 if(theSeedCleaner){ 00148 theSeedCleaner->clean(muRef,region,tkSeeds); 00149 LogDebug("TSGFromL2Muon") << tkSeeds.size() << " seeds for this L2 afther cleaning."; 00150 } 00151 if(h_nGoodSeedPerTrack) h_nGoodSeedPerTrack->Fill(tkSeeds.size()); 00152 00153 uint is=0; 00154 uint isMax=tkSeeds.size(); 00155 LogDebug("TSGFromL2Muon")<<isMax<<" seeds for this L2."; 00156 for (;is!=isMax;++is){ 00157 result->push_back( L3MuonTrajectorySeed(tkSeeds[is], muRef)); 00158 }//tkseed loop 00159 00160 }//l2muon loop 00161 00162 if(h_nGoodSeedPerEvent) h_nGoodSeedPerEvent->Fill(result->size()); 00163 00164 //ADDME 00165 //remove seed duplicate, keeping the ref to L2 00166 00167 LogDebug("TSGFromL2Muon")<<result->size()<<" trajectory seeds to the events"; 00168 00169 //put in the event 00170 ev.put(result); 00171 }
TH1F* TSGFromL2Muon::h_nGoodSeedPerEvent [private] |
TH1F* TSGFromL2Muon::h_nGoodSeedPerTrack [private] |
TH1F* TSGFromL2Muon::h_nSeedPerTrack [private] |
edm::ParameterSet TSGFromL2Muon::theConfig [private] |
double TSGFromL2Muon::thePtCut [private] |
TrackerSeedCleaner* TSGFromL2Muon::theSeedCleaner [private] |
MuonServiceProxy* TSGFromL2Muon::theService [private] |
Definition at line 34 of file TSGFromL2Muon.h.
Referenced by beginJob(), produce(), and TSGFromL2Muon().
bool TSGFromL2Muon::useTFileService_ [private] |