29 m_muon = muonGmtPair.
m_muon;
32 m_eta = muonGmtPair.
m_eta;
38 float dEta = m_regMu ? (m_regMu->eta() -
eta()) : 999.;
39 float dPhi = m_regMu ? (m_regMu->phi() - phi()) : 999.;
40 return sqrt(dEta*dEta + dPhi*dPhi);
49 TrackRef standaloneMuon = m_muon->outerTrack();
51 trajectory = cylExtrapTrkSam(standaloneMuon, 500);
56 trajectory = surfExtrapTrkSam(standaloneMuon, 790);
61 trajectory = surfExtrapTrkSam(standaloneMuon, -790);
76 recoProp = m_propagatorAlong->propagate(recoStart, *myCylinder);
78 recoProp = m_propagatorOpposite->propagate(recoStart, *myCylinder);
91 recoProp = m_propagatorAlong->propagate(recoStart, *myPlane);
93 recoProp = m_propagatorOpposite->propagate(recoStart, *myPlane);
100 GlobalPoint innerPoint(track->innerPosition().x(), track->innerPosition().y(), track->innerPosition().z());
101 GlobalVector innerVec (track->innerMomentum().x(), track->innerMomentum().y(), track->innerMomentum().z());
108 m_verbose(ps.getUntrackedParameter<bool>(
"verbose")),
109 m_HistFolder(ps.getUntrackedParameter<
string>(
"histFolder")),
110 m_GmtPtCuts(ps.getUntrackedParameter< vector<
int> >(
"gmtPtCuts")),
114 m_BsInputTag(consumes<
BeamSpot>(ps.getUntrackedParameter<
InputTag>(
"bsInputTag"))),
116 m_trigProcess(ps.getUntrackedParameter<
string>(
"trigProcess")),
118 m_trigNames(ps.getUntrackedParameter<vector<
string> >(
"triggerNames")),
119 m_effVsPtBins(ps.getUntrackedParameter<
std::vector<double>>(
"efficiencyVsPtBins")),
120 m_effVsPhiBins(ps.getUntrackedParameter<
std::vector<double>>(
"efficiencyVsPhiBins")),
121 m_effVsEtaBins(ps.getUntrackedParameter<
std::vector<double>>(
"efficiencyVsEtaBins"))
123 if (
m_verbose)
cout <<
"[L1TMuonDQMOffline:] ____________ Storage initialization ____________ " << endl;
136 if (
m_verbose)
cout <<
"[L1TMuonDQMOffline:] Called beginRun." << endl;
145 vector<int>::const_iterator gmtPtCutsIt =
m_GmtPtCuts.begin();
146 vector<int>::const_iterator gmtPtCutsEnd =
m_GmtPtCuts.end();
148 for (; gmtPtCutsIt!=gmtPtCutsEnd; ++ gmtPtCutsIt) {
152 vector<string>::const_iterator trigNamesIt =
m_trigNames.begin();
153 vector<string>::const_iterator trigNamesEnd =
m_trigNames.end();
155 for (; trigNamesIt!=trigNamesEnd; ++trigNamesIt) {
156 TString tNameTmp = TString(*trigNamesIt);
157 TRegexp tNamePattern = TRegexp(tNameTmp,
true);
162 if (tmpName.Contains(tNamePattern)) {
167 if (tIndex < 0 &&
m_verbose)
cout <<
"[L1TMuonDQMOffline:] Warning: Could not find trigger " << (*trigNamesIt) << endl;
215 vector<l1t::Muon> gmtContainer;
217 for (
auto mu = gmtCands->
begin(0);
mu != gmtCands->
end(0); ++
mu) {
218 gmtContainer.push_back(*
mu);
224 if (
m_verbose)
cout <<
"[L1TMuonDQMOffline:] Computing efficiencies" << endl;
226 vector<MuonGmtPair>::const_iterator muonGmtPairsIt =
m_MuonGmtPairs.begin();
227 vector<MuonGmtPair>::const_iterator muonGmtPairsEnd =
m_MuonGmtPairs.end();
229 for(; muonGmtPairsIt!=muonGmtPairsEnd; ++muonGmtPairsIt) {
230 float eta = muonGmtPairsIt->eta();
231 float phi = muonGmtPairsIt->phi();
232 float pt = muonGmtPairsIt->pt();
234 float gmtPt = muonGmtPairsIt->gmtPt();
235 int qual = muonGmtPairsIt->gmtQual();
237 vector<int>::const_iterator gmtPtCutsIt =
m_GmtPtCuts.begin();
238 vector<int>::const_iterator gmtPtCutsEnd =
m_GmtPtCuts.end();
240 for (; gmtPtCutsIt!=gmtPtCutsEnd; ++ gmtPtCutsIt) {
241 int gmtPtCut = (*gmtPtCutsIt);
242 bool gmtAboveCut = (gmtPt > gmtPtCut);
244 stringstream ptCutToTag; ptCutToTag << gmtPtCut;
245 string ptTag = ptCutToTag.str();
256 if (qual >= 4)
m_EfficiencyHistos[gmtPtCut][
"EffvsPt_OPEN_" + ptTag +
"_Num"]->Fill(pt);
257 if (qual >= 8)
m_EfficiencyHistos[gmtPtCut][
"EffvsPt_DOUBLE_" + ptTag +
"_Num"]->Fill(pt);
258 if (qual >= 12)
m_EfficiencyHistos[gmtPtCut][
"EffvsPt_SINGLE_" + ptTag +
"_Num"]->Fill(pt);
262 if (pt > 1.25*gmtPtCut) {
297 if (
m_verbose)
cout <<
"[L1TMuonDQMOffline:] Computation finished" << endl;
302 if(
m_verbose)
cout <<
"[L1TMuonDQMOffline:] Booking Control Plot Histos" << endl;
306 string name =
"MuonGmtDeltaR";
309 name =
"NTightVsAll";
312 name =
"NProbesVsTight";
316 string name1 =
"TagMuonEta_Histo";
318 string name2 =
"TagMuonPhi_Histo";
320 string name3 =
"TagMuonPt_Histo";
323 name1 =
"ProbeMuonEta_Histo";
325 name2 =
"ProbeMuonPhi_Histo";
327 name3 =
"ProbeMuonPt_Histo";
333 if(
m_verbose)
cout <<
"[L1TMuonDQMOffline:] Booking Efficiency Plot Histos for pt cut = " << ptCut << endl;
335 stringstream ptCutToTag; ptCutToTag <<
ptCut;
336 string ptTag = ptCutToTag.str();
341 int nEffVsPtBins = effVsPtBins.size() - 1;
342 float* ptBinsArray = &(effVsPtBins[0]);
344 string name1 =
"EffvsPt_" + ptTag +
"_Den";
346 string name2 =
"EffvsPt_" + ptTag +
"_Num";
349 name1 =
"EffvsPt_OPEN_" + ptTag +
"_Den";
351 name2 =
"EffvsPt_OPEN_" + ptTag +
"_Num";
354 name1 =
"EffvsPt_DOUBLE_" + ptTag +
"_Den";
356 name2 =
"EffvsPt_DOUBLE_" + ptTag +
"_Num";
359 name1 =
"EffvsPt_SINGLE_" + ptTag +
"_Den";
361 name2 =
"EffvsPt_SINGLE_" + ptTag +
"_Num";
367 int nEffVsPhiBins = effVsPhiBins.size() - 1;
368 float* phiBinsArray = &(effVsPhiBins[0]);
371 int nEffVsEtaBins = effVsEtaBins.size() - 1;
372 float* etaBinsArray = &(effVsEtaBins[0]);
374 name1 =
"EffvsPhi_" + ptTag +
"_Den";
376 name2 =
"EffvsPhi_" + ptTag +
"_Num";
379 name1 =
"EffvsEta_" + ptTag +
"_Den";
381 name2 =
"EffvsEta_" + ptTag +
"_Num";
386 name1 =
"EffvsPhi_OPEN_" + ptTag +
"_Den";
388 name2 =
"EffvsPhi_OPEN_" + ptTag +
"_Num";
391 name1 =
"EffvsEta_OPEN_" + ptTag +
"_Den";
393 name2 =
"EffvsEta_OPEN_" + ptTag +
"_Num";
398 name1 =
"EffvsPhi_DOUBLE_" + ptTag +
"_Den";
400 name2 =
"EffvsPhi_DOUBLE_" + ptTag +
"_Num";
403 name1 =
"EffvsEta_DOUBLE_" + ptTag +
"_Den";
405 name2 =
"EffvsEta_DOUBLE_" + ptTag +
"_Num";
410 name1 =
"EffvsPhi_SINGLE_" + ptTag +
"_Den";
412 name2 =
"EffvsPhi_SINGLE_" + ptTag +
"_Num";
415 name1 =
"EffvsEta_SINGLE_" + ptTag +
"_Den";
417 name2 =
"EffvsEta_SINGLE_" + ptTag +
"_Num";
427 bool hasPrimaryVertex =
false;
430 vector<Vertex>::const_iterator vertexIt = vertex->begin();
431 vector<Vertex>::const_iterator vertexEnd = vertex->end();
433 for (;vertexIt!=vertexEnd;++vertexIt) {
434 if (vertexIt->isValid() && !vertexIt->isFake()) {
435 posVtx = vertexIt->position();
436 errVtx = vertexIt->error();
437 hasPrimaryVertex =
true;
443 if ( !hasPrimaryVertex ) {
447 errVtx(2,2) = beamSpot->
sigmaZ();
456 if (
m_verbose)
cout <<
"[L1TMuonDQMOffline:] Getting tight muons" << endl;
458 MuonCollection::const_iterator muonIt = muons->begin();
459 MuonCollection::const_iterator muonEnd = muons->end();
461 for(; muonIt!=muonEnd; ++muonIt) {
473 if (
m_verbose)
cout <<
"[L1TMuonDQMOffline:] getting probe muons" << endl;
476 vector<const reco::Muon*>::const_iterator probeCandIt =
m_TightMuons.begin();
478 vector<const reco::Muon*>::const_iterator tightMuonsEnd =
m_TightMuons.end();
480 for (; probeCandIt!=tightMuonsEnd; ++probeCandIt) {
481 bool tagHasTrig =
false;
482 vector<const reco::Muon*>::const_iterator tagCandIt =
m_TightMuons.begin();
485 for (; tagCandIt!=tightMuonsEnd; ++tagCandIt) {
486 float eta = (*tagCandIt)->eta();
487 float phi = (*tagCandIt)->phi();
488 float pt = (*tagCandIt)->pt();
489 float dEta = eta - (*probeCandIt)->eta();
490 float dPhi = phi - (*probeCandIt)->phi();
492 deltar =
sqrt(dEta*dEta + dPhi*dPhi);
494 if ( (*tagCandIt) == (*probeCandIt) || (deltar<0.7) )
continue;
495 tagHasTrig |=
matchHlt(trigEvent,(*tagCandIt));
511 if (
m_verbose)
cout <<
"[L1TMuonDQMOffline:] Getting muon GMT pairs" << endl;
513 vector<const reco::Muon*>::const_iterator probeMuIt =
m_ProbeMuons.begin();
514 vector<const reco::Muon*>::const_iterator probeMuEnd =
m_ProbeMuons.end();
515 vector<l1t::Muon> gmtContainer;
517 for (
auto mu = gmtCands->
begin(0);
mu != gmtCands->
end(0); ++
mu) {
518 gmtContainer.push_back(*
mu);
521 vector<l1t::Muon>::const_iterator gmtIt;
522 vector<l1t::Muon>::const_iterator gmtEnd = gmtContainer.end();
524 for (; probeMuIt!=probeMuEnd; ++probeMuIt) {
525 float eta = (*probeMuIt)->eta();
526 float phi = (*probeMuIt)->phi();
527 float pt = (*probeMuIt)->pt();
535 gmtIt = gmtContainer.begin();
537 for(; gmtIt!=gmtEnd; ++gmtIt) {
542 pairBestCand = pairTmpCand;
554 double matchDeltaR = 9999;
558 vector<int>::const_iterator trigIndexIt =
m_trigIndices.begin();
559 vector<int>::const_iterator trigIndexEnd =
m_trigIndices.end();
561 for(; trigIndexIt!=trigIndexEnd; ++trigIndexIt) {
566 if (hltFilterIndex < triggerEvent->sizeFilters()) {
568 const Vids triggerVids(triggerEvent->
filterIds(hltFilterIndex));
569 const unsigned nTriggers = triggerVids.size();
570 for (
size_t iTrig = 0; iTrig < nTriggers; ++iTrig) {
571 const TriggerObject trigObject = trigObjs[triggerKeys[iTrig]];
572 double dRtmp =
deltaR((*mu),trigObject);
573 if (dRtmp < matchDeltaR) matchDeltaR = dRtmp;
unsigned int size() const
number of trigger paths in trigger table
LuminosityBlockID id() const
const_iterator end(int bx) const
edm::ESHandle< Propagator > m_propagatorOpposite
edm::EDGetTokenT< reco::BeamSpot > m_BsInputTag
edm::EDGetTokenT< reco::MuonCollection > m_MuonInputTag
The single EDProduct to be saved for each event (AOD case)
const std::string & triggerName(unsigned int triggerIndex) const
virtual void bookEfficiencyHistos(DQMStore::IBooker &ibooker, int ptCut)
edm::EDGetTokenT< edm::TriggerResults > m_trigProcess_token
bool getByToken(EDGetToken token, Handle< PROD > &result) const
virtual void beginLuminosityBlock(edm::LuminosityBlock const &lumiBlock, edm::EventSetup const &c) override
void analyze(const edm::Event &e, const edm::EventSetup &c) override
#define DEFINE_FWK_MODULE(type)
const Keys & filterKeys(trigger::size_type index) const
Geom::Phi< T > phi() const
virtual void dqmEndLuminosityBlock(edm::LuminosityBlock const &lumiBlock, edm::EventSetup const &c)
virtual ~L1TMuonDQMOffline()
trigger::size_type filterIndex(const edm::InputTag &filterTag) const
find index of filter in data-member vector from filter tag
std::vector< double > m_effVsPhiBins
math::Error< dimension >::type Error
covariance error matrix (3x3)
GlobalPoint globalPosition() const
std::vector< Vertex > VertexCollection
collection of Vertex objects
bool matchHlt(edm::Handle< trigger::TriggerEvent > &triggerEvent, const reco::Muon *mu)
std::vector< Muon > MuonCollection
collection of Muon objects
std::vector< const reco::Muon * > m_ProbeMuons
void getProbeMuons(edm::Handle< edm::TriggerResults > &trigResults, edm::Handle< trigger::TriggerEvent > &trigEvent)
std::vector< std::string > m_trigNames
virtual void bookControlHistos(DQMStore::IBooker &)
std::string m_trigProcess
static CylinderPointer build(const PositionType &pos, const RotationType &rot, Scalar radius, Bounds *bounds=0)
const l1t::Muon * m_regMu
const Vids & filterIds(trigger::size_type index) const
edm::EDGetTokenT< l1t::MuonBxCollection > m_GmtInputTag
const TriggerObjectCollection & getObjects() const
std::vector< double > m_effVsPtBins
virtual void bookHistograms(DQMStore::IBooker &ibooker, const edm::Run &run, const edm::EventSetup &iSetup) override
static PlanePointer build(Args &&...args)
TrajectoryStateOnSurface cylExtrapTrkSam(reco::TrackRef track, double rho)
const reco::Muon * m_muon
MonitorElement * book1D(Args &&...args)
std::map< int, std::map< std::string, MonitorElement * > > m_EfficiencyHistos
math::XYZPoint Point
point in the space
double BeamWidthX() const
beam width X
std::vector< MuonGmtPair > m_MuonGmtPairs
edm::ESHandle< MagneticField > m_BField
edm::ESHandle< Propagator > m_propagatorAlong
const std::vector< std::string > & moduleLabels(unsigned int trigger) const
label(s) of module(s) on a trigger path
double deltaR(double eta1, double eta2, double phi1, double phi2)
std::vector< TriggerObject > TriggerObjectCollection
collection of trigger physics objects (e.g., all isolated muons)
L1TMuonDQMOffline(const edm::ParameterSet &ps)
FreeTrajectoryState freeTrajStateMuon(reco::TrackRef track)
void getMuonGmtPairs(edm::Handle< l1t::MuonBxCollection > &gmtCands)
void setCurrentFolder(const std::string &fullpath)
MonitorElement * book2D(Args &&...args)
void propagate(edm::ESHandle< MagneticField > bField, edm::ESHandle< Propagator > propagatorAlong, edm::ESHandle< Propagator > propagatorOpposite)
std::vector< size_type > Keys
TrajectoryStateOnSurface surfExtrapTrkSam(reco::TrackRef track, double z)
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d'tor
double sigmaZ() const
sigma z
std::vector< int > m_GmtPtCuts
double BeamWidthY() const
beam width Y
HLTConfigProvider m_hltConfig
LuminosityBlockNumber_t luminosityBlock() const
const reco::Vertex getPrimaryVertex(edm::Handle< reco::VertexCollection > &vertex, edm::Handle< reco::BeamSpot > &beamSpot)
MuonGmtPair(const reco::Muon *muon, const l1t::Muon *regMu)
std::vector< double > m_effVsEtaBins
std::vector< const reco::Muon * > m_TightMuons
std::map< std::string, MonitorElement * > m_ControlHistos
virtual void dqmBeginRun(const edm::Run &run, const edm::EventSetup &iSetup) override
edm::EDGetTokenT< reco::VertexCollection > m_VtxInputTag
edm::EDGetTokenT< trigger::TriggerEvent > m_trigInputTag
const Point & position() const
position
bool isTightMuon(const reco::Muon &, const reco::Vertex &)
const_iterator begin(int bx) const
std::vector< int > m_trigIndices
void getTightMuons(edm::Handle< reco::MuonCollection > &muons, const reco::Vertex &vertex)