28 m_muon = muonGmtPair.
m_muon;
31 m_eta = muonGmtPair.
m_eta;
37 float dEta = m_regMu ? (m_regMu->eta() -
eta()) : 999.;
38 float dPhi = m_regMu ? (m_regMu->phi() - phi()) : 999.;
39 return sqrt(dEta*dEta + dPhi*dPhi);
48 TrackRef standaloneMuon = m_muon->outerTrack();
50 trajectory = cylExtrapTrkSam(standaloneMuon, 500);
55 trajectory = surfExtrapTrkSam(standaloneMuon, 790);
60 trajectory = surfExtrapTrkSam(standaloneMuon, -790);
75 recoProp = m_propagatorAlong->propagate(recoStart, *myCylinder);
77 recoProp = m_propagatorOpposite->propagate(recoStart, *myCylinder);
90 recoProp = m_propagatorAlong->propagate(recoStart, *myPlane);
92 recoProp = m_propagatorOpposite->propagate(recoStart, *myPlane);
99 GlobalPoint innerPoint(track->innerPosition().x(), track->innerPosition().y(), track->innerPosition().z());
100 GlobalVector innerVec (track->innerMomentum().x(), track->innerMomentum().y(), track->innerMomentum().z());
107 m_verbose(ps.getUntrackedParameter<bool>(
"verbose")),
108 m_HistFolder(ps.getUntrackedParameter<
string>(
"histFolder")),
109 m_GmtPtCuts(ps.getUntrackedParameter< vector<
int> >(
"gmtPtCuts")),
113 m_BsInputTag(consumes<
BeamSpot>(ps.getUntrackedParameter<
InputTag>(
"bsInputTag"))),
115 m_trigProcess(ps.getUntrackedParameter<
string>(
"trigProcess")),
117 m_trigNames(ps.getUntrackedParameter<vector<
string> >(
"triggerNames")),
118 m_effVsPtBins(ps.getUntrackedParameter<
std::vector<double>>(
"efficiencyVsPtBins")),
119 m_effVsPhiBins(ps.getUntrackedParameter<
std::vector<double>>(
"efficiencyVsPhiBins")),
120 m_effVsEtaBins(ps.getUntrackedParameter<
std::vector<double>>(
"efficiencyVsEtaBins"))
122 if (
m_verbose)
cout <<
"[L1TMuonDQMOffline:] ____________ Storage initialization ____________ " << endl;
135 if (
m_verbose)
cout <<
"[L1TMuonDQMOffline:] Called beginRun." << endl;
144 vector<int>::const_iterator gmtPtCutsIt =
m_GmtPtCuts.begin();
145 vector<int>::const_iterator gmtPtCutsEnd =
m_GmtPtCuts.end();
147 for (; gmtPtCutsIt!=gmtPtCutsEnd; ++ gmtPtCutsIt) {
151 vector<string>::const_iterator trigNamesIt =
m_trigNames.begin();
152 vector<string>::const_iterator trigNamesEnd =
m_trigNames.end();
154 for (; trigNamesIt!=trigNamesEnd; ++trigNamesIt) {
155 TString tNameTmp = TString(*trigNamesIt);
156 TRegexp tNamePattern = TRegexp(tNameTmp,
true);
161 if (tmpName.Contains(tNamePattern)) {
166 if (tIndex < 0 &&
m_verbose)
cout <<
"[L1TMuonDQMOffline:] Warning: Could not find trigger " << (*trigNamesIt) << endl;
214 vector<l1t::Muon> gmtContainer;
216 for (
auto mu = gmtCands->
begin(0);
mu != gmtCands->
end(0); ++
mu) {
217 gmtContainer.push_back(*
mu);
223 if (
m_verbose)
cout <<
"[L1TMuonDQMOffline:] Computing efficiencies" << endl;
225 vector<MuonGmtPair>::const_iterator muonGmtPairsIt =
m_MuonGmtPairs.begin();
226 vector<MuonGmtPair>::const_iterator muonGmtPairsEnd =
m_MuonGmtPairs.end();
228 for(; muonGmtPairsIt!=muonGmtPairsEnd; ++muonGmtPairsIt) {
229 float eta = muonGmtPairsIt->eta();
230 float phi = muonGmtPairsIt->phi();
231 float pt = muonGmtPairsIt->pt();
233 float gmtPt = muonGmtPairsIt->gmtPt();
234 int qual = muonGmtPairsIt->gmtQual();
236 vector<int>::const_iterator gmtPtCutsIt =
m_GmtPtCuts.begin();
237 vector<int>::const_iterator gmtPtCutsEnd =
m_GmtPtCuts.end();
239 for (; gmtPtCutsIt!=gmtPtCutsEnd; ++ gmtPtCutsIt) {
240 int gmtPtCut = (*gmtPtCutsIt);
241 bool gmtAboveCut = (gmtPt > gmtPtCut);
243 stringstream ptCutToTag; ptCutToTag << gmtPtCut;
244 string ptTag = ptCutToTag.str();
255 if (qual >= 4)
m_EfficiencyHistos[gmtPtCut][
"EffvsPt_OPEN_" + ptTag +
"_Num"]->Fill(pt);
256 if (qual >= 8)
m_EfficiencyHistos[gmtPtCut][
"EffvsPt_DOUBLE_" + ptTag +
"_Num"]->Fill(pt);
257 if (qual >= 12)
m_EfficiencyHistos[gmtPtCut][
"EffvsPt_SINGLE_" + ptTag +
"_Num"]->Fill(pt);
261 if (pt > 1.25*gmtPtCut) {
296 if (
m_verbose)
cout <<
"[L1TMuonDQMOffline:] Computation finished" << endl;
301 if(
m_verbose)
cout <<
"[L1TMuonDQMOffline:] Booking Control Plot Histos" << endl;
305 string name =
"MuonGmtDeltaR";
308 name =
"NTightVsAll";
311 name =
"NProbesVsTight";
315 string name1 =
"TagMuonEta_Histo";
317 string name2 =
"TagMuonPhi_Histo";
319 string name3 =
"TagMuonPt_Histo";
322 name1 =
"ProbeMuonEta_Histo";
324 name2 =
"ProbeMuonPhi_Histo";
326 name3 =
"ProbeMuonPt_Histo";
332 if(
m_verbose)
cout <<
"[L1TMuonDQMOffline:] Booking Efficiency Plot Histos for pt cut = " << ptCut << endl;
334 stringstream ptCutToTag; ptCutToTag <<
ptCut;
335 string ptTag = ptCutToTag.str();
340 int nEffVsPtBins = effVsPtBins.size() - 1;
341 float* ptBinsArray = &(effVsPtBins[0]);
343 string name1 =
"EffvsPt_" + ptTag +
"_Den";
345 string name2 =
"EffvsPt_" + ptTag +
"_Num";
348 name1 =
"EffvsPt_OPEN_" + ptTag +
"_Den";
350 name2 =
"EffvsPt_OPEN_" + ptTag +
"_Num";
353 name1 =
"EffvsPt_DOUBLE_" + ptTag +
"_Den";
355 name2 =
"EffvsPt_DOUBLE_" + ptTag +
"_Num";
358 name1 =
"EffvsPt_SINGLE_" + ptTag +
"_Den";
360 name2 =
"EffvsPt_SINGLE_" + ptTag +
"_Num";
366 int nEffVsPhiBins = effVsPhiBins.size() - 1;
367 float* phiBinsArray = &(effVsPhiBins[0]);
370 int nEffVsEtaBins = effVsEtaBins.size() - 1;
371 float* etaBinsArray = &(effVsEtaBins[0]);
373 name1 =
"EffvsPhi_" + ptTag +
"_Den";
375 name2 =
"EffvsPhi_" + ptTag +
"_Num";
378 name1 =
"EffvsEta_" + ptTag +
"_Den";
380 name2 =
"EffvsEta_" + ptTag +
"_Num";
385 name1 =
"EffvsPhi_OPEN_" + ptTag +
"_Den";
387 name2 =
"EffvsPhi_OPEN_" + ptTag +
"_Num";
390 name1 =
"EffvsEta_OPEN_" + ptTag +
"_Den";
392 name2 =
"EffvsEta_OPEN_" + ptTag +
"_Num";
397 name1 =
"EffvsPhi_DOUBLE_" + ptTag +
"_Den";
399 name2 =
"EffvsPhi_DOUBLE_" + ptTag +
"_Num";
402 name1 =
"EffvsEta_DOUBLE_" + ptTag +
"_Den";
404 name2 =
"EffvsEta_DOUBLE_" + ptTag +
"_Num";
409 name1 =
"EffvsPhi_SINGLE_" + ptTag +
"_Den";
411 name2 =
"EffvsPhi_SINGLE_" + ptTag +
"_Num";
414 name1 =
"EffvsEta_SINGLE_" + ptTag +
"_Den";
416 name2 =
"EffvsEta_SINGLE_" + ptTag +
"_Num";
426 bool hasPrimaryVertex =
false;
429 vector<Vertex>::const_iterator vertexIt = vertex->begin();
430 vector<Vertex>::const_iterator vertexEnd = vertex->end();
432 for (;vertexIt!=vertexEnd;++vertexIt) {
433 if (vertexIt->isValid() && !vertexIt->isFake()) {
434 posVtx = vertexIt->position();
435 errVtx = vertexIt->error();
436 hasPrimaryVertex =
true;
442 if ( !hasPrimaryVertex ) {
446 errVtx(2,2) = beamSpot->
sigmaZ();
455 if (
m_verbose)
cout <<
"[L1TMuonDQMOffline:] Getting tight muons" << endl;
457 MuonCollection::const_iterator muonIt = muons->begin();
458 MuonCollection::const_iterator muonEnd = muons->end();
460 for(; muonIt!=muonEnd; ++muonIt) {
472 if (
m_verbose)
cout <<
"[L1TMuonDQMOffline:] getting probe muons" << endl;
475 vector<const reco::Muon*>::const_iterator probeCandIt =
m_TightMuons.begin();
477 vector<const reco::Muon*>::const_iterator tightMuonsEnd =
m_TightMuons.end();
479 for (; probeCandIt!=tightMuonsEnd; ++probeCandIt) {
480 bool tagHasTrig =
false;
481 vector<const reco::Muon*>::const_iterator tagCandIt =
m_TightMuons.begin();
484 for (; tagCandIt!=tightMuonsEnd; ++tagCandIt) {
485 float eta = (*tagCandIt)->eta();
486 float phi = (*tagCandIt)->phi();
487 float pt = (*tagCandIt)->pt();
488 float dEta = eta - (*probeCandIt)->eta();
489 float dPhi = phi - (*probeCandIt)->phi();
491 deltar =
sqrt(dEta*dEta + dPhi*dPhi);
493 if ( (*tagCandIt) == (*probeCandIt) || (deltar<0.7) )
continue;
494 tagHasTrig |=
matchHlt(trigEvent,(*tagCandIt));
510 if (
m_verbose)
cout <<
"[L1TMuonDQMOffline:] Getting muon GMT pairs" << endl;
512 vector<const reco::Muon*>::const_iterator probeMuIt =
m_ProbeMuons.begin();
513 vector<const reco::Muon*>::const_iterator probeMuEnd =
m_ProbeMuons.end();
514 vector<l1t::Muon> gmtContainer;
516 for (
auto mu = gmtCands->
begin(0);
mu != gmtCands->
end(0); ++
mu) {
517 gmtContainer.push_back(*
mu);
520 vector<l1t::Muon>::const_iterator gmtIt;
521 vector<l1t::Muon>::const_iterator gmtEnd = gmtContainer.end();
523 for (; probeMuIt!=probeMuEnd; ++probeMuIt) {
524 float eta = (*probeMuIt)->eta();
525 float phi = (*probeMuIt)->phi();
526 float pt = (*probeMuIt)->pt();
534 gmtIt = gmtContainer.begin();
536 for(; gmtIt!=gmtEnd; ++gmtIt) {
541 pairBestCand = pairTmpCand;
553 double matchDeltaR = 9999;
557 vector<int>::const_iterator trigIndexIt =
m_trigIndices.begin();
558 vector<int>::const_iterator trigIndexEnd =
m_trigIndices.end();
560 for(; trigIndexIt!=trigIndexEnd; ++trigIndexIt) {
565 if (hltFilterIndex < triggerEvent->sizeFilters()) {
567 const Vids triggerVids(triggerEvent->
filterIds(hltFilterIndex));
568 const unsigned nTriggers = triggerVids.size();
569 for (
size_t iTrig = 0; iTrig < nTriggers; ++iTrig) {
570 const TriggerObject trigObject = trigObjs[triggerKeys[iTrig]];
571 double dRtmp =
deltaR((*mu),trigObject);
572 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)