![]() |
![]() |
#include <MuonTrackAnalyzer.h>
Analyzer of the Muon tracks
Analyzer of the StandAlone muon tracks
Definition at line 40 of file MuonTrackAnalyzer.h.
Definition at line 43 of file MuonTrackAnalyzer.h.
MuonTrackAnalyzer::MuonTrackAnalyzer | ( | const edm::ParameterSet & | pset | ) |
Constructor.
Definition at line 49 of file MuonTrackAnalyzer.cc.
References dbe_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), MuonServiceProxy_cff::MuonServiceProxy, MuonUpdatorAtVertex_cff::MuonUpdatorAtVertex, cmsCodeRules::cppFunctionSkipper::operator, and dbtoconf::out.
{ // service parameters ParameterSet serviceParameters = pset.getParameter<ParameterSet>("ServiceParameters"); // the services theService = new MuonServiceProxy(serviceParameters); theTracksLabel = pset.getParameter<InputTag>("Tracks"); doTracksAnalysis = pset.getUntrackedParameter<bool>("DoTracksAnalysis",true); doSeedsAnalysis = pset.getUntrackedParameter<bool>("DoSeedsAnalysis",false); if(doSeedsAnalysis){ theSeedsLabel = pset.getParameter<InputTag>("MuonSeed"); ParameterSet updatorPar = pset.getParameter<ParameterSet>("MuonUpdatorAtVertexParameters"); theSeedPropagatorName = updatorPar.getParameter<string>("Propagator"); theUpdator = new MuonUpdatorAtVertex(updatorPar,theService); } theCSCSimHitLabel = pset.getParameter<InputTag>("CSCSimHit"); theDTSimHitLabel = pset.getParameter<InputTag>("DTSimHit"); theRPCSimHitLabel = pset.getParameter<InputTag>("RPCSimHit"); theEtaRange = (EtaRange) pset.getParameter<int>("EtaRange"); // number of sim tracks numberOfSimTracks=0; // number of reco tracks numberOfRecTracks=0; dbe_ = edm::Service<DQMStore>().operator->(); out = pset.getUntrackedParameter<string>("rootFileName"); dirName_ = pset.getUntrackedParameter<std::string>("dirName"); }
MuonTrackAnalyzer::~MuonTrackAnalyzer | ( | ) | [virtual] |
Destructor.
Definition at line 86 of file MuonTrackAnalyzer.cc.
{ if (theService) delete theService; }
void MuonTrackAnalyzer::analyze | ( | const edm::Event & | event, |
const edm::EventSetup & | eventSetup | ||
) | [virtual] |
Implements edm::EDAnalyzer.
Definition at line 190 of file MuonTrackAnalyzer.cc.
References LogDebug, and ExpressReco_HICollisions_FallBack::seedsAnalysis.
{ LogDebug("MuonTrackAnalyzer") << "Run: " << event.id().run() << " Event: " << event.id().event(); // Update the services theService->update(eventSetup); Handle<SimTrackContainer> simTracks; event.getByLabel("g4SimHits",simTracks); fillPlots(event,simTracks); if(doTracksAnalysis) tracksAnalysis(event,eventSetup,simTracks); if(doSeedsAnalysis) seedsAnalysis(event,eventSetup,simTracks); }
void MuonTrackAnalyzer::beginJob | ( | void | ) | [virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 90 of file MuonTrackAnalyzer.cc.
References ExpressReco_HICollisions_FallBack::algo, DQMStore::book1D(), DQMStore::book2D(), DQMStore::cd(), dbe_, TrackerOfflineValidation_Dqm_cff::dirName, hChi2, edm::InputTag::instance(), edm::InputTag::label(), edm::InputTag::process(), linker::replace(), DQMStore::setCurrentFolder(), and DQMStore::showDirStructure().
{ dbe_->showDirStructure(); dbe_->cd(); InputTag algo = theTracksLabel; string dirName=dirName_; if (algo.process()!="") dirName+=algo.process()+"_"; if(algo.label()!="") dirName+=algo.label()+"_"; if(algo.instance()!="") dirName+=algo.instance()+""; if (dirName.find("Tracks")<dirName.length()){ dirName.replace(dirName.find("Tracks"),6,""); } std::replace(dirName.begin(), dirName.end(), ':', '_'); dbe_->setCurrentFolder(dirName.c_str()); //dbe_->goUp(); std::string simName = dirName; simName+="/SimTracks"; hSimTracks = new HTrackVariables(simName.c_str(),"SimTracks"); dbe_->cd(); dbe_->setCurrentFolder(dirName.c_str()); // Create the root file //theFile = new TFile(theRootFileName.c_str(), "RECREATE"); if(doSeedsAnalysis){ dbe_->cd(); dbe_->setCurrentFolder(dirName.c_str()); hRecoSeedInner = new HTrack(dirName.c_str(),"RecoSeed","Inner"); hRecoSeedPCA = new HTrack(dirName.c_str(),"RecoSeed","PCA"); } if(doTracksAnalysis){ dbe_->cd(); dbe_->setCurrentFolder(dirName.c_str()); hRecoTracksPCA = new HTrack(dirName.c_str(),"RecoTracks","PCA"); hRecoTracksInner = new HTrack(dirName.c_str(),"RecoTracks","Inner"); hRecoTracksOuter = new HTrack(dirName.c_str(),"RecoTracks","Outer"); dbe_->cd(); dbe_->setCurrentFolder(dirName.c_str()); // General Histos hChi2 = dbe_->book1D("chi2","#chi^2",200,0,200); hChi2VsEta = dbe_->book2D("chi2VsEta","#chi^2 VS #eta",120,-3.,3.,200,0,200); hChi2Norm = dbe_->book1D("chi2Norm","Normalized #chi^2",400,0,100); hChi2NormVsEta = dbe_->book2D("chi2NormVsEta","Normalized #chi^2 VS #eta",120,-3.,3.,400,0,100); hHitsPerTrack = dbe_->book1D("HitsPerTrack","Number of hits per track",55,0,55); hHitsPerTrackVsEta = dbe_->book2D("HitsPerTrackVsEta","Number of hits per track VS #eta", 120,-3.,3.,55,0,55); hDof = dbe_->book1D("dof","Number of Degree of Freedom",55,0,55); hDofVsEta = dbe_->book2D("dofVsEta","Number of Degree of Freedom VS #eta",120,-3.,3.,55,0,55); hChi2Prob = dbe_->book1D("chi2Prob","#chi^2 probability",200,0,1); hChi2ProbVsEta = dbe_->book2D("chi2ProbVsEta","#chi^2 probability VS #eta",120,-3.,3.,200,0,1); hNumberOfTracks = dbe_->book1D("NumberOfTracks","Number of reconstructed tracks per event",200,0,200); hNumberOfTracksVsEta = dbe_->book2D("NumberOfTracksVsEta", "Number of reconstructed tracks per event VS #eta", 120,-3.,3.,10,0,10); hChargeVsEta = dbe_->book2D("ChargeVsEta","Charge vs #eta gen",120,-3.,3.,4,-2.,2.); hChargeVsPt = dbe_->book2D("ChargeVsPt","Charge vs P_{T} gen",250,0,200,4,-2.,2.); hPtRecVsPtGen = dbe_->book2D("PtRecVsPtGen","P_{T} rec vs P_{T} gen",250,0,200,250,0,200); hDeltaPtVsEta = dbe_->book2D("DeltaPtVsEta","#Delta P_{t} vs #eta gen",120,-3.,3.,500,-250.,250.); hDeltaPt_In_Out_VsEta = dbe_->book2D("DeltaPt_In_Out_VsEta_","P^{in}_{t} - P^{out}_{t} vs #eta gen",120,-3.,3.,500,-250.,250.); } //theFile->cd(); }
bool MuonTrackAnalyzer::checkMuonSimHitPresence | ( | const edm::Event & | event, |
edm::Handle< edm::SimTrackContainer > | simTracks | ||
) | [private] |
Definition at line 432 of file MuonTrackAnalyzer.cc.
References abs, CoreSimTrack::trackId(), and CoreSimTrack::type().
{ // Get the SimHit collection from the event Handle<PSimHitContainer> dtSimHits; event.getByLabel(theDTSimHitLabel.instance(),theDTSimHitLabel.label(), dtSimHits); Handle<PSimHitContainer> cscSimHits; event.getByLabel(theCSCSimHitLabel.instance(),theCSCSimHitLabel.label(), cscSimHits); Handle<PSimHitContainer> rpcSimHits; event.getByLabel(theRPCSimHitLabel.instance(),theRPCSimHitLabel.label(), rpcSimHits); map<unsigned int, vector<const PSimHit*> > mapOfMuonSimHits; for(PSimHitContainer::const_iterator simhit = dtSimHits->begin(); simhit != dtSimHits->end(); ++simhit) { if (abs(simhit->particleType()) != 13) continue; mapOfMuonSimHits[simhit->trackId()].push_back(&*simhit); } for(PSimHitContainer::const_iterator simhit = cscSimHits->begin(); simhit != cscSimHits->end(); ++simhit) { if (abs(simhit->particleType()) != 13) continue; mapOfMuonSimHits[simhit->trackId()].push_back(&*simhit); } for(PSimHitContainer::const_iterator simhit = rpcSimHits->begin(); simhit != rpcSimHits->end(); ++simhit) { if (abs(simhit->particleType()) != 13) continue; mapOfMuonSimHits[simhit->trackId()].push_back(&*simhit); } bool presence = false; for (SimTrackContainer::const_iterator simTrack = simTracks->begin(); simTrack != simTracks->end(); ++simTrack){ if (abs(simTrack->type()) != 13) continue; map<unsigned int, vector<const PSimHit*> >::const_iterator mapIterator = mapOfMuonSimHits.find(simTrack->trackId()); if (mapIterator != mapOfMuonSimHits.end()) presence = true; } return presence; }
void MuonTrackAnalyzer::endJob | ( | void | ) | [virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 171 of file MuonTrackAnalyzer.cc.
References dbe_, dbtoconf::out, and DQMStore::save().
{ LogInfo("MuonTrackAnalyzer")<< "Number of Sim tracks: " << numberOfSimTracks; LogInfo("MuonTrackAnalyzer") << "Number of Reco tracks: " << numberOfRecTracks; if(doTracksAnalysis){ double eff = hRecoTracksPCA->computeEfficiency(hSimTracks); LogInfo("MuonTrackAnalyzer") <<" *Track Efficiency* = "<< eff <<"%"; } if(doSeedsAnalysis){ double eff = hRecoSeedInner->computeEfficiency(hSimTracks); LogInfo("MuonTrackAnalyzer")<<" *Seed Efficiency* = "<< eff <<"%"; } if ( out.size() != 0 && dbe_ ) dbe_->save(out); }
void MuonTrackAnalyzer::fillPlots | ( | TrajectoryStateOnSurface & | recoTSOS, |
SimTrack & | simState, | ||
HTrack * | histo, | ||
MuonPatternRecoDumper & | debug | ||
) | [private] |
Definition at line 345 of file MuonTrackAnalyzer.cc.
References HTrack::computeResolutionAndPull(), MuonPatternRecoDumper::dumpTSOS(), HTrack::Fill(), HTrack::FillDeltaR(), TrajectoryStateOnSurface::globalMomentum(), LogTrace, CoreSimTrack::momentum(), dt_offlineAnalysis_common_cff::reco, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().
{ LogTrace("MuonTrackAnalyzer") << debug.dumpTSOS(recoTSOS)<<endl; histo->Fill(recoTSOS); GlobalVector tsosVect = recoTSOS.globalMomentum(); math::XYZVectorD reco(tsosVect.x(), tsosVect.y(), tsosVect.z()); double deltaRVal = deltaR<double>(reco.eta(),reco.phi(), simTrack.momentum().eta(),simTrack.momentum().phi()); histo->FillDeltaR(deltaRVal); histo->computeResolutionAndPull(recoTSOS,simTrack); }
void MuonTrackAnalyzer::fillPlots | ( | const edm::Event & | event, |
edm::Handle< edm::SimTrackContainer > & | simTracks | ||
) | [private] |
Definition at line 296 of file MuonTrackAnalyzer.cc.
References abs, LogTrace, and mathSSE::sqrt().
{ if(!checkMuonSimHitPresence(event,simTracks)) return; // Loop over the Sim tracks SimTrackContainer::const_iterator simTrack; LogTrace("MuonTrackAnalyzer")<<"Simulated tracks: "<<simTracks->size()<<endl; for (simTrack = simTracks->begin(); simTrack != simTracks->end(); ++simTrack) if (abs((*simTrack).type()) == 13) { if( !isInTheAcceptance( (*simTrack).momentum().eta()) ) continue; // FIXME!! numberOfSimTracks++; LogTrace("MuonTrackAnalyzer")<<"Simualted muon:"<<endl; LogTrace("MuonTrackAnalyzer")<<"Sim pT: "<<sqrt((*simTrack).momentum().perp2())<<endl; LogTrace("MuonTrackAnalyzer")<<"Sim Eta: "<<(*simTrack).momentum().eta()<<endl; // FIXME hSimTracks->Fill((*simTrack).momentum().mag(), sqrt((*simTrack).momentum().perp2()), (*simTrack).momentum().eta(), (*simTrack).momentum().phi(), -(*simTrack).type()/ abs((*simTrack).type()) ); // Double FIXME LogTrace("MuonTrackAnalyzer") << "hSimTracks filled" << endl; } LogTrace("MuonTrackAnalyzer") << endl; }
void MuonTrackAnalyzer::fillPlots | ( | reco::TransientTrack & | track, |
SimTrack & | simTrack | ||
) | [private] |
Definition at line 327 of file MuonTrackAnalyzer.cc.
References reco::TransientTrack::chi2(), ChiSquaredProbability(), hChi2, LogTrace, CoreSimTrack::momentum(), reco::TransientTrack::ndof(), reco::TransientTrack::normalizedChi2(), and reco::TransientTrack::recHitsSize().
{ LogTrace("MuonTrackAnalyzer")<<"Analizer: New track, chi2: "<<track.chi2()<<" dof: "<<track.ndof()<<endl; hChi2->Fill(track.chi2()); hDof->Fill(track.ndof()); hChi2Norm->Fill(track.normalizedChi2()); hHitsPerTrack->Fill(track.recHitsSize()); hChi2Prob->Fill( ChiSquaredProbability(track.chi2(),track.ndof()) ); hChi2VsEta->Fill(simTrack.momentum().eta(),track.chi2()); hChi2NormVsEta->Fill(simTrack.momentum().eta(),track.normalizedChi2()); hChi2ProbVsEta->Fill(simTrack.momentum().eta(),ChiSquaredProbability(track.chi2(),track.ndof())); hHitsPerTrackVsEta->Fill(simTrack.momentum().eta(),track.recHitsSize()); hDofVsEta->Fill(simTrack.momentum().eta(),track.ndof()); }
void MuonTrackAnalyzer::fillPlots | ( | FreeTrajectoryState & | recoFTS, |
SimTrack & | simTrack, | ||
HTrack * | histo, | ||
MuonPatternRecoDumper & | debug | ||
) | [private] |
Definition at line 1129 of file HLTMuonMatchAndPlot.cc.
References ExpressReco_HICollisions_FallBack::beamSpot, DeDxDiscriminatorTools::charge(), debug_cff::d0, dbe_, Geom::deltaPhi(), deltaR(), reco::MuonIsolation::emEt, trigger::TriggerObject::eta(), reco::MuonIsolation::hadEt, i, edm::Ref< C, T, F >::isNonnull(), j, LogTrace, trigger::TriggerObject::phi(), ExpressReco_HICollisions_FallBack::pt, and trigger::TriggerObject::pt().
{ if (!dbe_) { LogTrace ("HLTMuonVal") << "===Warning=== You've tried to call fill plots, " << "but no DQMStore object exists... refusing to fill plots" << endl; return; } int numRecMatches = myRecMatches.size(); //double recMuonPt = -1; //======================= // DoubleMu Triggers // ---------------------- // If you're using a double mu trigger // Check to see if you found at least two reco muons // If you haven't, then skip this event! //======================== if ((theNumberOfObjects == 2) && (myRecMatches.size() < 2)) return; // Fill histograms // // RECO Matching // double maxMatchPtRec = -10.0; //std::vector <double> allRecPts; //std::vector <bool> matchedToHLT; // Look at each rec & hlt cand for ( size_t i = 0; i < myRecMatches.size(); i++ ) { LogTrace("HLTMuonVal") << "Reco Candidate loop:" << "looking at cand " << i << " out of " << myRecMatches.size() << endl; if ((isL3Path || isL2Path) && requireL1SeedForHLTPaths) { LogTrace ("HLTMuonVal") << "Checking to see if your RECO muon matched to an L1 seed" << endl; if (myRecMatches[i].l1Seed.pt() < 0) { LogTrace ("HLTMuonVal") << "No match to L1 seed, skipping this RECO muon" << endl; continue; } } double pt = myRecMatches[i].recCand->pt(); double eta = myRecMatches[i].recCand->eta(); double phi = myRecMatches[i].recCand->phi(); int recPdgId = myRecMatches[i].recCand->pdgId(); LogTrace ("HLTMuonVal") << "trying to get a global track for this muon" << endl; // old way - breaks if no global track //TrackRef theMuoGlobalTrack = myRecMatches[i].recCand->globalTrack(); TrackRef theMuonTrack = getCandTrackRef (mySelection, (*myRecMatches[i].recCand)); double d0 = -9e20; double z0 = -9e20; int charge = -99999; int plottedCharge = -99999; double d0beam = -9e20; double z0beam = -9e20; if (theMuonTrack.isNonnull() ) { d0 = theMuonTrack->d0(); z0 = theMuonTrack->dz(); // comment: // does the charge function return the // same value as the abs(pdgId) ? charge = theMuonTrack->charge(); plottedCharge = getCharge (recPdgId); if (foundBeamSpot) { d0beam = theMuonTrack->dxy(beamSpot.position()); z0beam = theMuonTrack->dz(beamSpot.position()); hBeamSpotZ0Rec[0]->Fill(beamSpot.z0()); } } else { LogTrace ("HLTMuonVal") << "... oops! that wasn't a global muon" << endl; } // For now, take out the cuts on the pt/eta, // We'll get the total efficiency and worry about // the hlt matching later. // if ( pt > theMinPtCut && fabs(eta) < theMaxEtaCut ) { //hNumObjects->getTH1()->AddBinContent(2); // fill the "all" histograms for basic muon // parameters hPassEtaRec[0]->Fill(eta); hPassPhiRec[0]->Fill(phi); hPassPtRec[0]->Fill(pt); hPhiVsEtaRec[0]->Fill(eta,phi); hPassD0Rec[0]->Fill(d0); hPassD0BeamRec[0]->Fill(d0beam); hPassZ0Rec[0]->Fill(z0); hPassZ0BeamRec[0]->Fill(z0beam); hPassCharge[0]->Fill(charge); MuonIsolation thisIso = myRecMatches[i].recCand->isolationR03(); double emEnergy = thisIso.emEt; double hadEnergy = thisIso.hadEt; double myMuonIso = (emEnergy + hadEnergy) / pt; hIsolationRec[0]->Fill(myMuonIso); if (numRecMatches == 1) { hPassPtRecExactlyOne[0]->Fill(pt); } // if you found an L1 match, fill this histo // check for L1 match using pt, not energy if ( (myRecMatches[i].l1Cand.pt() > 0) && ((useFullDebugInformation) || (isL1Path)) ) { hPassEtaRec[1]->Fill(eta); hPassPhiRec[1]->Fill(phi); hPassPtRec[1]->Fill(pt); hPhiVsEtaRec[1]->Fill(eta,phi); hPassD0Rec[1]->Fill(d0); hPassD0BeamRec[1]->Fill(d0beam); hPassZ0Rec[1]->Fill(z0); hPassZ0BeamRec[1]->Fill(z0beam); hPassCharge[1]->Fill(charge); hIsolationRec[1]->Fill(myMuonIso); double l1eta = myRecMatches[i].l1Cand.eta(); double l1phi = myRecMatches[i].l1Cand.phi(); double l1pt = myRecMatches[i].l1Cand.energy(); // Get the charges in terms of charge constants // this reduces bins in histogram. int l1plottedCharge = getCharge (myRecMatches[i].l1Cand.id()); LogTrace ("HLTMuonVal") << "The pdg id is (L1) " << myRecMatches[i].l1Cand.id() << " and the L1 plotted charge is " << l1plottedCharge; double deltaR = reco::deltaR (l1eta, l1phi, eta, phi); double deltaPhi = reco::deltaPhi (l1phi, phi); // These are matched histos // so they have no "all" histos // hDeltaRMatched[0]->Fill(deltaR); hPassMatchPtRec[0]->Fill(pt); //hPtMatchVsPtRec[0]->Fill(l1pt, pt); //hEtaMatchVsEtaRec[0]->Fill(l1eta, eta); //hPhiMatchVsPhiRec[0]->Fill(l1phi, phi); hMatchedDeltaPhi[0]->Fill(deltaPhi); //hDeltaPhiVsPhi[0]->Fill(phi, deltaPhi); //hDeltaPhiVsZ0[0]->Fill(z0, deltaPhi); //hDeltaPhiVsD0[0]->Fill(d0, deltaPhi); // Resolution histos must have hlt matches hResoPtAodRec[0]->Fill((pt - l1pt)/pt); hResoEtaAodRec[0]->Fill((eta - l1eta)/fabs(eta)); hResoPhiAodRec[0]->Fill((phi - l1phi)/fabs(phi)); hChargeFlipMatched[0]->Fill(l1plottedCharge, plottedCharge); if (numRecMatches == 1) { hPassExaclyOneMuonMaxPtRec[1]->Fill(pt); hPassPtRecExactlyOne[1]->Fill(pt); } } // bool foundAllPreviousCands = true; // Look through the hltCands and see what's going on // for ( size_t j = 0; j < myRecMatches[i].hltCands.size(); j++ ) { if ( myRecMatches[i].hltCands[j].pt() > 0 ) { double hltCand_pt = myRecMatches[i].hltCands[j].pt(); double hltCand_eta = myRecMatches[i].hltCands[j].eta(); double hltCand_phi = myRecMatches[i].hltCands[j].phi(); int hltCand_plottedCharge = getCharge(myRecMatches[i].hltCands[j].id()); // store this rec muon pt, not hlt cand pt if (theHltCollectionLabels.size() > j) { TString tempString = theHltCollectionLabels[j]; if (tempString.Contains("L3")) { maxMatchPtRec = (pt > maxMatchPtRec)? pt : maxMatchPtRec; } } // these are histos where you have // all + L1 (= displaced two indices) // Which means your HLT histos are // at index j+HLT_PLOT_OFFSET hPassEtaRec[j+HLT_PLOT_OFFSET]->Fill(eta); hPassPhiRec[j+HLT_PLOT_OFFSET]->Fill(phi); hPassPtRec[j+HLT_PLOT_OFFSET]->Fill(pt); hPhiVsEtaRec[j+HLT_PLOT_OFFSET]->Fill(eta,phi); hPassD0Rec[j+HLT_PLOT_OFFSET]->Fill(d0); hPassD0BeamRec[j+HLT_PLOT_OFFSET]->Fill(d0beam); hPassZ0Rec[j+HLT_PLOT_OFFSET]->Fill(z0); hPassZ0BeamRec[j+HLT_PLOT_OFFSET]->Fill(z0beam); hPassCharge[j+HLT_PLOT_OFFSET]->Fill(charge); hIsolationRec[j+HLT_PLOT_OFFSET]->Fill(myMuonIso); // Histograms with Match in the name only have HLT // matches possible // so there are no "all" histograms // so offset = 1 b/c of L1 histos double deltaR = reco::deltaR (hltCand_eta, hltCand_phi, eta, phi); double deltaPhi = reco::deltaPhi (hltCand_phi, phi); hDeltaRMatched[j+HLT_PLOT_OFFSET-1]->Fill(deltaR); hPassMatchPtRec[j+HLT_PLOT_OFFSET-1]->Fill(pt); //hPtMatchVsPtRec[j+HLT_PLOT_OFFSET-1]->Fill(hltCand_pt, pt); //hEtaMatchVsEtaRec[j+HLT_PLOT_OFFSET-1]->Fill(hltCand_eta, eta); //hPhiMatchVsPhiRec[j+HLT_PLOT_OFFSET-1]->Fill(hltCand_phi, phi); hMatchedDeltaPhi[j+HLT_PLOT_OFFSET-1]->Fill(deltaPhi); //hDeltaPhiVsPhi[j+HLT_PLOT_OFFSET-1]->Fill(phi, deltaPhi); //hDeltaPhiVsZ0[j+HLT_PLOT_OFFSET-1]->Fill(z0, deltaPhi); //hDeltaPhiVsD0[j+HLT_PLOT_OFFSET-1]->Fill(d0, deltaPhi); LogTrace ("HLTMuonVal") << "The pdg id is (hlt [" << j << "]) " << myRecMatches[i].hltCands[j].id() << " and the plotted charge is " << hltCand_plottedCharge << ", w/ rec charge " << charge << ", and plotted charge " << plottedCharge << "\n " << "and rec pdg id = " << recPdgId; hChargeFlipMatched[j+HLT_PLOT_OFFSET-1]->Fill( hltCand_plottedCharge, plottedCharge); // Resolution histos must have hlt matches hResoPtAodRec[j+HLT_PLOT_OFFSET-1]->Fill((pt - hltCand_pt)/pt); hResoEtaAodRec[j+HLT_PLOT_OFFSET-1]->Fill((eta - hltCand_eta)/fabs(eta)); hResoPhiAodRec[j+HLT_PLOT_OFFSET-1]->Fill((phi - hltCand_phi)/fabs(phi)); if (numRecMatches == 1 && (myRecMatches[i].hltCands.size()== 1)) { hPassExaclyOneMuonMaxPtRec[j+HLT_PLOT_OFFSET]->Fill(pt); hPassPtRecExactlyOne[j+HLT_PLOT_OFFSET]->Fill(pt); } } // end if found hlt match } // Fill some RAW histograms if (useFullDebugInformation) { LogTrace ("HLTMuonVal") << "\n.... now Filling Raw Histos"; if ( myRecMatches[i].l1RawCand.energy() > 0 ) { // you've found a L1 raw candidate rawMatchHltCandPt[1]->Fill(pt); rawMatchHltCandEta[1]->Fill(eta); rawMatchHltCandPhi[1]->Fill(phi); } LogTrace ("HLTMuonVal") << "There are " << myRecMatches[i].hltCands.size() << " hltRaw candidates that could match, starting loop" << endl; for ( size_t j = 0; j < myRecMatches[i].hltCands.size(); j++ ) { if ( myRecMatches[i].hltCands[j].pt() > 0 ) { rawMatchHltCandPt[j+HLT_PLOT_OFFSET]->Fill(pt); rawMatchHltCandEta[j+HLT_PLOT_OFFSET]->Fill(eta); rawMatchHltCandPhi[j+HLT_PLOT_OFFSET]->Fill(phi); } } } } // end RECO matching // // HLT fakes cands // LogTrace ("HLTMuonVal") << "\n.... now looping over fake cands"; for (unsigned int iHltModule = 0; iHltModule < numHltLabels; iHltModule++) { for(size_t iCand = 0; iCand < myHltFakeCands[iHltModule].size() ; iCand ++){ LogTrace ("HLTMuonVal") << "Label number : " << iHltModule << "(max = " << numHltLabels << ")\n" << "Candidate number: " << iCand << "(max = " << myHltFakeCands[iHltModule].size() << " )\n"; TriggerObject candVect = myHltFakeCands[iHltModule][iCand].myHltCand; bool candIsFake = myHltFakeCands[iHltModule][iCand].isAFake; allHltCandPt[iHltModule]->Fill(candVect.pt()); allHltCandEta[iHltModule]->Fill(candVect.eta()); allHltCandPhi[iHltModule]->Fill(candVect.phi()); if (candIsFake) { fakeHltCandPt[iHltModule]->Fill(candVect.pt()); fakeHltCandEta[iHltModule]->Fill(candVect.eta()); fakeHltCandPhi[iHltModule]->Fill(candVect.phi()); //fakeHltCandEtaPhi[iHltModule]->Fill(candVect.eta(), candVect.phi()); // JMS extra hack - print out run,event so you can look // in event display // int myRun = iEvent.id().run(); // int myEvent = iEvent.id().event(); // cout << endl << "FAKE! run = " << myRun << ", event = " // << myEvent << ", pt = " << candVect.pt() << ", eta = " // << candVect.eta() << "phi, " << candVect.phi() << endl << endl; } } } LogTrace ("HLTMuonVal") << "There are " << myRecMatches.size() << " RECO muons in this event" << endl; LogTrace ("HLTMuonVal") << "The max pt found by looking at candiates is " << maxMatchPtRec //<< "\n and the max found while storing reco was " //<< recMuonPt << endl; // // Fill MAX PT plot // // genMuonPt and maxMatchPtRec are the max values // fill these hists with the max reconstructed Pt //if ( genMuonPt > 0 ) hPassMaxPtGen[0]->Fill( genMuonPt ); if ( maxMatchPtRec > 0 ) hPassMaxPtRec[0]->Fill( maxMatchPtRec ); // there will be one hlt match for each // trigger module label // int numHltMatches = myRecMatches[i].hltCands.size(); if (numRecMatches == 1) { if (maxMatchPtRec >0) hPassExaclyOneMuonMaxPtRec[0]->Fill(maxMatchPtRec); } // Fill these if there are any L1 candidates if (useFullDebugInformation || isL1Path) { if ( numL1Cands >= theNumberOfObjects ) { //if ( genMuonPt > 0 ) hPassMaxPtGen[1]->Fill( genMuonPt ); if ( maxMatchPtRec > 0 ) hPassMaxPtRec[1]->Fill( maxMatchPtRec ); if (numRecMatches == 1 && numL1Cands == 1) { if (maxMatchPtRec >0) hPassExaclyOneMuonMaxPtRec[1]->Fill(maxMatchPtRec); } } } for ( size_t i = 0; i < numHltLabels; i++ ) { // this will only fill up if L3 // I don't think it's correct to fill // all the labels with this if (maxMatchPtRec > 0) hPassMaxPtRec[i+HLT_PLOT_OFFSET]->Fill(maxMatchPtRec); } } // end fillPlots: Done filling histograms
TrajectoryStateOnSurface MuonTrackAnalyzer::getSeedTSOS | ( | const TrajectorySeed & | seed | ) | [private] |
Definition at line 482 of file MuonTrackAnalyzer.cc.
References DetLayer::compatibleLayers(), PTrajectoryStateOnDet::detId(), TrajectoryStateOnSurface::freeState(), TrajectoryStateOnSurface::isValid(), oppositeToMomentum, query::result, TrajectorySeed::startingState(), GeometricSearchDet::surface(), and TrajectoryStateTransform::transientState().
{ // Get the Trajectory State on Det (persistent version of a TSOS) from the seed PTrajectoryStateOnDet pTSOD = seed.startingState(); // Transform it in a TrajectoryStateOnSurface TrajectoryStateTransform tsTransform; DetId seedDetId(pTSOD.detId()); const GeomDet* gdet = theService->trackingGeometry()->idToDet( seedDetId ); TrajectoryStateOnSurface initialState = tsTransform.transientState(pTSOD, &(gdet->surface()), &*theService->magneticField()); // Get the layer on which the seed relies const DetLayer *initialLayer = theService->detLayerGeometry()->idToLayer( seedDetId ); PropagationDirection detLayerOrder = oppositeToMomentum; // ask for compatible layers vector<const DetLayer*> detLayers; detLayers = initialLayer->compatibleLayers( *initialState.freeState(),detLayerOrder); TrajectoryStateOnSurface result = initialState; if(detLayers.size()){ const DetLayer* finalLayer = detLayers.back(); const TrajectoryStateOnSurface propagatedState = theService->propagator(theSeedPropagatorName)->propagate(initialState, finalLayer->surface()); if(propagatedState.isValid()) result = propagatedState; } return result; }
pair< SimTrack, double > MuonTrackAnalyzer::getSimTrack | ( | TrajectoryStateOnSurface & | tsos, |
edm::Handle< edm::SimTrackContainer > | simTracks | ||
) | [private] |
Definition at line 376 of file MuonTrackAnalyzer.cc.
References abs, TrajectoryStateOnSurface::globalMomentum(), LogTrace, query::result, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().
{ // // Loop over the Sim tracks // SimTrackContainer::const_iterator simTrack; // SimTrack result; // int mu=0; // for (simTrack = simTracks->begin(); simTrack != simTracks->end(); ++simTrack) // if (abs((*simTrack).type()) == 13) { // result = *simTrack; // ++mu; // } // if(mu != 1) LogTrace("MuonTrackAnalyzer") << "WARNING!! more than 1 simulated muon!!" <<endl; // return result; // Loop over the Sim tracks SimTrackContainer::const_iterator simTrack; SimTrack result; double bestDeltaR = 10e5; for (simTrack = simTracks->begin(); simTrack != simTracks->end(); ++simTrack){ if (abs((*simTrack).type()) != 13) continue; // double newDeltaR = tsos.globalMomentum().basicVector().deltaR(simTrack->momentum().vect()); GlobalVector tsosVect = tsos.globalMomentum(); math::XYZVectorD vect(tsosVect.x(), tsosVect.y(), tsosVect.z()); double newDeltaR = deltaR<double>(vect.eta(),vect.phi(), simTrack->momentum().eta(),simTrack->momentum().phi()); if ( newDeltaR < bestDeltaR ) { LogTrace("MuonTrackAnalyzer") << "Matching Track with DeltaR = " << newDeltaR<<endl; bestDeltaR = newDeltaR; result = *simTrack; } } return pair<SimTrack,double>(result,bestDeltaR); }
bool MuonTrackAnalyzer::isInTheAcceptance | ( | double | eta | ) | [private] |
Definition at line 419 of file MuonTrackAnalyzer.cc.
References abs, cond::ecalcond::all, Reference_intrackfit_cff::barrel, Reference_intrackfit_cff::endcap, and LogTrace.
{ switch(theEtaRange){ case all: return ( abs(eta) <= 2.4 ) ? true : false; case barrel: return ( abs(eta) < 1.1 ) ? true : false; case endcap: return ( abs(eta) >= 1.1 && abs(eta) <= 2.4 ) ? true : false; default: {LogTrace("MuonTrackAnalyzer")<<"No correct Eta range selected!! "<<endl; return false;} } }
void MuonTrackAnalyzer::seedsAnalysis | ( | const edm::Event & | event, |
const edm::EventSetup & | eventSetup, | ||
edm::Handle< edm::SimTrackContainer > | simTracks | ||
) |
Definition at line 211 of file MuonTrackAnalyzer.cc.
References debug, and LogTrace.
{ MuonPatternRecoDumper debug; // Get the RecTrack collection from the event Handle<TrajectorySeedCollection> seeds; event.getByLabel(theSeedsLabel, seeds); LogTrace("MuonTrackAnalyzer")<<"Number of reconstructed seeds: " << seeds->size()<<endl; for(TrajectorySeedCollection::const_iterator seed = seeds->begin(); seed != seeds->end(); ++seed){ TrajectoryStateOnSurface seedTSOS = getSeedTSOS(*seed); pair<SimTrack,double> sim = getSimTrack(seedTSOS,simTracks); fillPlots(seedTSOS, sim.first, hRecoSeedInner, debug); std::pair<bool,FreeTrajectoryState> propSeed = theUpdator->propagateToNominalLine(seedTSOS); if(propSeed.first) fillPlots(propSeed.second, sim.first, hRecoSeedPCA, debug); else LogTrace("MuonTrackAnalyzer")<<"Error in seed propagation"<<endl; } }
void MuonTrackAnalyzer::tracksAnalysis | ( | const edm::Event & | event, |
const edm::EventSetup & | eventSetup, | ||
edm::Handle< edm::SimTrackContainer > | simTracks | ||
) |
Definition at line 241 of file MuonTrackAnalyzer.cc.
References TrajectoryStateOnSurface::charge(), debug, TrajectoryStateOnSurface::globalMomentum(), LogTrace, CoreSimTrack::momentum(), PV3DBase< T, PVType, FrameType >::perp(), mathSSE::sqrt(), matplotRender::t, ExpressReco_HICollisions_FallBack::track, and testEve_cfg::tracks.
{ MuonPatternRecoDumper debug; // Get the RecTrack collection from the event Handle<reco::TrackCollection> tracks; event.getByLabel(theTracksLabel, tracks); LogTrace("MuonTrackAnalyzer")<<"Reconstructed tracks: " << tracks->size() << endl; hNumberOfTracks->Fill(tracks->size()); if(tracks->size()) numberOfRecTracks++; // Loop over the Rec tracks for(reco::TrackCollection::const_iterator t = tracks->begin(); t != tracks->end(); ++t) { reco::TransientTrack track(*t,&*theService->magneticField(),theService->trackingGeometry()); TrajectoryStateOnSurface outerTSOS = track.outermostMeasurementState(); TrajectoryStateOnSurface innerTSOS = track.innermostMeasurementState(); TrajectoryStateOnSurface pcaTSOS = track.impactPointState(); pair<SimTrack,double> sim = getSimTrack(pcaTSOS,simTracks); SimTrack simTrack = sim.first; hNumberOfTracksVsEta->Fill(simTrack.momentum().eta(), tracks->size()); fillPlots(track,simTrack); LogTrace("MuonTrackAnalyzer") << "State at the outer surface: " << endl; fillPlots(outerTSOS,simTrack,hRecoTracksOuter,debug); LogTrace("MuonTrackAnalyzer") << "State at the inner surface: " << endl; fillPlots(innerTSOS,simTrack,hRecoTracksInner,debug); LogTrace("MuonTrackAnalyzer") << "State at PCA: " << endl; fillPlots(pcaTSOS,simTrack,hRecoTracksPCA,debug); double deltaPt_in_out = innerTSOS.globalMomentum().perp()-outerTSOS.globalMomentum().perp(); hDeltaPt_In_Out_VsEta->Fill(simTrack.momentum().eta(),deltaPt_in_out); double deltaPt_pca_sim = pcaTSOS.globalMomentum().perp()-sqrt(simTrack.momentum().Perp2()); hDeltaPtVsEta->Fill(simTrack.momentum().eta(),deltaPt_pca_sim); hChargeVsEta->Fill(simTrack.momentum().eta(),pcaTSOS.charge()); hChargeVsPt->Fill(sqrt(simTrack.momentum().perp2()),pcaTSOS.charge()); hPtRecVsPtGen->Fill(sqrt(simTrack.momentum().perp2()),pcaTSOS.globalMomentum().perp()); } LogTrace("MuonTrackAnalyzer")<<"--------------------------------------------"<<endl; }
DQMStore* MuonTrackAnalyzer::dbe_ [private] |
Definition at line 83 of file MuonTrackAnalyzer.h.
std::string MuonTrackAnalyzer::dirName_ [private] |
Definition at line 84 of file MuonTrackAnalyzer.h.
bool MuonTrackAnalyzer::doSeedsAnalysis [private] |
Definition at line 98 of file MuonTrackAnalyzer.h.
bool MuonTrackAnalyzer::doTracksAnalysis [private] |
Definition at line 97 of file MuonTrackAnalyzer.h.
MonitorElement* MuonTrackAnalyzer::hChargeVsEta [private] |
Definition at line 113 of file MuonTrackAnalyzer.h.
MonitorElement* MuonTrackAnalyzer::hChargeVsPt [private] |
Definition at line 114 of file MuonTrackAnalyzer.h.
MonitorElement* MuonTrackAnalyzer::hChi2 [private] |
Definition at line 105 of file MuonTrackAnalyzer.h.
MonitorElement* MuonTrackAnalyzer::hChi2Norm [private] |
Definition at line 106 of file MuonTrackAnalyzer.h.
MonitorElement* MuonTrackAnalyzer::hChi2NormVsEta [private] |
Definition at line 118 of file MuonTrackAnalyzer.h.
MonitorElement* MuonTrackAnalyzer::hChi2Prob [private] |
Definition at line 109 of file MuonTrackAnalyzer.h.
MonitorElement* MuonTrackAnalyzer::hChi2ProbVsEta [private] |
Definition at line 121 of file MuonTrackAnalyzer.h.
MonitorElement* MuonTrackAnalyzer::hChi2VsEta [private] |
Definition at line 117 of file MuonTrackAnalyzer.h.
Definition at line 123 of file MuonTrackAnalyzer.h.
MonitorElement* MuonTrackAnalyzer::hDeltaPtVsEta [private] |
Definition at line 122 of file MuonTrackAnalyzer.h.
MonitorElement* MuonTrackAnalyzer::hDof [private] |
Definition at line 108 of file MuonTrackAnalyzer.h.
MonitorElement* MuonTrackAnalyzer::hDofVsEta [private] |
Definition at line 120 of file MuonTrackAnalyzer.h.
MonitorElement* MuonTrackAnalyzer::hHitsPerTrack [private] |
Definition at line 107 of file MuonTrackAnalyzer.h.
Definition at line 119 of file MuonTrackAnalyzer.h.
MonitorElement* MuonTrackAnalyzer::hNumberOfTracks [private] |
Definition at line 111 of file MuonTrackAnalyzer.h.
Definition at line 112 of file MuonTrackAnalyzer.h.
MonitorElement* MuonTrackAnalyzer::hPtRecVsPtGen [private] |
Definition at line 115 of file MuonTrackAnalyzer.h.
HTrack* MuonTrackAnalyzer::hRecoSeedInner [private] |
Definition at line 127 of file MuonTrackAnalyzer.h.
HTrack* MuonTrackAnalyzer::hRecoSeedPCA [private] |
Definition at line 128 of file MuonTrackAnalyzer.h.
HTrack* MuonTrackAnalyzer::hRecoTracksInner [private] |
Definition at line 130 of file MuonTrackAnalyzer.h.
HTrack* MuonTrackAnalyzer::hRecoTracksOuter [private] |
Definition at line 131 of file MuonTrackAnalyzer.h.
HTrack* MuonTrackAnalyzer::hRecoTracksPCA [private] |
Definition at line 129 of file MuonTrackAnalyzer.h.
HTrackVariables* MuonTrackAnalyzer::hSimTracks [private] |
Definition at line 125 of file MuonTrackAnalyzer.h.
int MuonTrackAnalyzer::numberOfRecTracks [private] |
Definition at line 135 of file MuonTrackAnalyzer.h.
int MuonTrackAnalyzer::numberOfSimTracks [private] |
Definition at line 134 of file MuonTrackAnalyzer.h.
std::string MuonTrackAnalyzer::out [private] |
Definition at line 86 of file MuonTrackAnalyzer.h.
Definition at line 93 of file MuonTrackAnalyzer.h.
Definition at line 94 of file MuonTrackAnalyzer.h.
EtaRange MuonTrackAnalyzer::theEtaRange [private] |
Definition at line 89 of file MuonTrackAnalyzer.h.
Definition at line 95 of file MuonTrackAnalyzer.h.
std::string MuonTrackAnalyzer::theSeedPropagatorName [private] |
Definition at line 99 of file MuonTrackAnalyzer.h.
Definition at line 92 of file MuonTrackAnalyzer.h.
MuonServiceProxy* MuonTrackAnalyzer::theService [private] |
Definition at line 101 of file MuonTrackAnalyzer.h.
Definition at line 91 of file MuonTrackAnalyzer.h.
MuonUpdatorAtVertex* MuonTrackAnalyzer::theUpdator [private] |
Definition at line 102 of file MuonTrackAnalyzer.h.