Skip to content

Commit

Permalink
Merge branch 'cms-sw:master' into update-bph-dqm-trigger
Browse files Browse the repository at this point in the history
  • Loading branch information
vjmastra authored Nov 21, 2022
2 parents 496fe96 + def67f9 commit 9bec91f
Show file tree
Hide file tree
Showing 1,767 changed files with 109,317 additions and 106,912 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ class AlignmentMonitorAsAnalyzer : public edm::one::EDAnalyzer<> {
const edm::ESGetToken<AlignmentErrorsExtended, CSCAlignmentErrorExtendedRcd> esTokenCSCAPE_;
const edm::ESGetToken<Alignments, GEMAlignmentRcd> esTokenGEMAl_;
const edm::ESGetToken<AlignmentErrorsExtended, GEMAlignmentErrorExtendedRcd> esTokenGEMAPE_;
const edm::EDGetTokenT<TrajTrackAssociationCollection> trajTrackToken_;
bool m_firstEvent;
};

Expand Down Expand Up @@ -134,7 +135,8 @@ AlignmentMonitorAsAnalyzer::AlignmentMonitorAsAnalyzer(const edm::ParameterSet&
esTokenCSCAl_(esConsumes()),
esTokenCSCAPE_(esConsumes()),
esTokenGEMAl_(esConsumes()),
esTokenGEMAPE_(esConsumes()) {
esTokenGEMAPE_(esConsumes()),
trajTrackToken_(consumes<TrajTrackAssociationCollection>(m_tjTag)) {
edm::ConsumesCollector consumeCollector = consumesCollector();
std::vector<std::string> monitors = iConfig.getUntrackedParameter<std::vector<std::string>>("monitors");

Expand Down Expand Up @@ -213,8 +215,7 @@ void AlignmentMonitorAsAnalyzer::analyze(const edm::Event& iEvent, const edm::Ev
}

// Retrieve trajectories and tracks from the event
edm::Handle<TrajTrackAssociationCollection> trajTracksMap;
iEvent.getByLabel(m_tjTag, trajTracksMap);
const edm::Handle<TrajTrackAssociationCollection>& trajTracksMap = iEvent.getHandle(trajTrackToken_);

// Form pairs of trajectories and tracks
ConstTrajTrackPairCollection trajTracks;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "Alignment/MuonAlignmentAlgorithms/interface/MuonResidualsFromTrack.h"

#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
#include "FWCore/Utilities/interface/InputTag.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/Framework/interface/EventSetup.h"
Expand All @@ -34,7 +35,8 @@
class AlignmentMonitorMuonSystemMap1D : public AlignmentMonitorBase {
public:
AlignmentMonitorMuonSystemMap1D(const edm::ParameterSet &cfg, edm::ConsumesCollector iC);
~AlignmentMonitorMuonSystemMap1D() override {}
~AlignmentMonitorMuonSystemMap1D() override = default;
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions);

void book() override;

Expand All @@ -54,23 +56,25 @@ class AlignmentMonitorMuonSystemMap1D : public AlignmentMonitorBase {
const MuonResidualsFromTrack::BuilderToken m_esTokenBuilder;

// parameters
edm::InputTag m_muonCollectionTag;
double m_minTrackPt;
double m_maxTrackPt;
double m_minTrackP;
double m_maxTrackP;
double m_maxDxy;
int m_minTrackerHits;
double m_maxTrackerRedChi2;
bool m_allowTIDTEC;
int m_minNCrossedChambers;
int m_minDT13Hits;
int m_minDT2Hits;
int m_minCSCHits;
bool m_doDT;
bool m_doCSC;
bool m_useStubPosition;
bool m_createNtuple;
const edm::InputTag m_muonCollectionTag;
const double m_minTrackPt;
const double m_maxTrackPt;
const double m_minTrackP;
const double m_maxTrackP;
const double m_maxDxy;
const int m_minTrackerHits;
const double m_maxTrackerRedChi2;
const bool m_allowTIDTEC;
const int m_minNCrossedChambers;
const int m_minDT13Hits;
const int m_minDT2Hits;
const int m_minCSCHits;
const bool m_doDT;
const bool m_doCSC;
const bool m_useStubPosition;
const bool m_createNtuple;
const edm::EDGetTokenT<reco::BeamSpot> bsToken_;
const edm::EDGetTokenT<reco::MuonCollection> muonToken_;

// counter
long m_counter_event;
Expand Down Expand Up @@ -173,7 +177,9 @@ AlignmentMonitorMuonSystemMap1D::AlignmentMonitorMuonSystemMap1D(const edm::Para
m_doDT(cfg.getParameter<bool>("doDT")),
m_doCSC(cfg.getParameter<bool>("doCSC")),
m_useStubPosition(cfg.getParameter<bool>("useStubPosition")),
m_createNtuple(cfg.getParameter<bool>("createNtuple")) {
m_createNtuple(cfg.getParameter<bool>("createNtuple")),
bsToken_(iC.consumes<reco::BeamSpot>(m_beamSpotTag)),
muonToken_(iC.consumes<reco::MuonCollection>(m_muonCollectionTag)) {
if (m_createNtuple) {
edm::Service<TFileService> fs;
m_cscnt = fs->make<TTree>("mualNtuple", "mualNtuple");
Expand All @@ -184,6 +190,29 @@ AlignmentMonitorMuonSystemMap1D::AlignmentMonitorMuonSystemMap1D(const edm::Para
}
}

void AlignmentMonitorMuonSystemMap1D::fillDescriptions(edm::ConfigurationDescriptions &descriptions) {
edm::ParameterSetDescription desc;
desc.add<edm::InputTag>("muonCollectionTag", edm::InputTag(""));
desc.addUntracked<edm::InputTag>("beamSpotTag", edm::InputTag("offlineBeamSpot"));
desc.add<double>("minTrackPt", 100.);
desc.add<double>("maxTrackPt", 200.);
desc.add<double>("minTrackP", 0.);
desc.add<double>("maxTrackP", 99999.);
desc.add<double>("maxDxy", 100.);
desc.add<int>("minTrackerHits", 15);
desc.add<double>("maxTrackerRedChi2", 10.);
desc.add<bool>("allowTIDTEC", true);
desc.add<int>("minNCrossedChambers", 3);
desc.add<int>("minDT13Hits", 8);
desc.add<int>("minDT2Hits", 4);
desc.add<int>("minCSCHits", 6);
desc.add<bool>("doDT", true);
desc.add<bool>("doCSC", true);
desc.add<bool>("useStubPosition", false);
desc.add<bool>("createNtuple", false);
descriptions.add("alignmentMonitorMuonSystemMap1D", desc);
}

std::string AlignmentMonitorMuonSystemMap1D::num02d(int num) {
assert(num >= 0 && num < 100);
char tmp[4];
Expand Down Expand Up @@ -266,8 +295,7 @@ void AlignmentMonitorMuonSystemMap1D::event(const edm::Event &iEvent,
const ConstTrajTrackPairCollection &trajtracks) {
m_counter_event++;

edm::Handle<reco::BeamSpot> beamSpot;
iEvent.getByLabel(m_beamSpotTag, beamSpot);
const edm::Handle<reco::BeamSpot> &beamSpot = iEvent.getHandle(bsToken_);

const GlobalTrackingGeometry *globalGeometry = &iSetup.getData(m_esTokenGBTGeom);
const DetIdAssociator *muonDetIdAssociator_ = &iSetup.getData(m_esTokenDetId);
Expand Down Expand Up @@ -296,8 +324,7 @@ void AlignmentMonitorMuonSystemMap1D::event(const edm::Event &iEvent,
} // end if track has acceptable momentum
} // end loop over tracks
} else {
edm::Handle<reco::MuonCollection> muons;
iEvent.getByLabel(m_muonCollectionTag, muons);
const edm::Handle<reco::MuonCollection> &muons = iEvent.getHandle(muonToken_);

for (reco::MuonCollection::const_iterator muon = muons->begin(); muon != muons->end(); ++muon) {
if (!(muon->isTrackerMuon() && muon->innerTrack().isNonnull()))
Expand Down Expand Up @@ -467,8 +494,7 @@ void AlignmentMonitorMuonSystemMap1D::processMuonResidualsFromTrack(MuonResidual
m_CSCvsphi_me[id.endcap() - 1][id.station() - 1][ring - 1]->fill_x(charge, phi, residual, chi2, dof);
m_CSCvsphi_me[id.endcap() - 1][id.station() - 1][ring - 1]->fill_dxdz(charge, phi, resslope, chi2, dof);

if (m_createNtuple && chi2 > 0.) // && TMath::Prob(chi2, dof) < 0.95)
{
if (m_createNtuple && chi2 > 0.) { // && TMath::Prob(chi2, dof) < 0.95)
m_id.init(id);
m_tr.q = charge;
m_tr.pt = mrft.getTrack()->pt();
Expand All @@ -489,17 +515,17 @@ void AlignmentMonitorMuonSystemMap1D::processMuonResidualsFromTrack(MuonResidual
}

void AlignmentMonitorMuonSystemMap1D::afterAlignment() {
std::cout << "AlignmentMonitorMuonSystemMap1D counters:" << std::endl;
std::cout << " monitor m_counter_event = " << m_counter_event << std::endl;
std::cout << " monitor m_counter_track = " << m_counter_track << std::endl;
std::cout << " monitor m_counter_trackppt = " << m_counter_trackmoment << std::endl;
std::cout << " monitor m_counter_trackdxy = " << m_counter_trackdxy << std::endl;
std::cout << " monitor m_counter_trackokay = " << m_counter_trackokay << std::endl;
std::cout << " monitor m_counter_dt = " << m_counter_dt << std::endl;
std::cout << " monitor m_counter_13numhits = " << m_counter_13numhits << std::endl;
std::cout << " monitor m_counter_2numhits = " << m_counter_2numhits << std::endl;
std::cout << " monitor m_counter_csc = " << m_counter_csc << std::endl;
std::cout << " monitor m_counter_cscnumhits = " << m_counter_cscnumhits << std::endl;
edm::LogVerbatim("AlignmentMuonSystemMap") << "AlignmentMonitorMuonSystemMap1D counters:";
edm::LogVerbatim("AlignmentMuonSystemMap") << " monitor m_counter_event = " << m_counter_event;
edm::LogVerbatim("AlignmentMuonSystemMap") << " monitor m_counter_track = " << m_counter_track;
edm::LogVerbatim("AlignmentMuonSystemMap") << " monitor m_counter_trackppt = " << m_counter_trackmoment;
edm::LogVerbatim("AlignmentMuonSystemMap") << " monitor m_counter_trackdxy = " << m_counter_trackdxy;
edm::LogVerbatim("AlignmentMuonSystemMap") << " monitor m_counter_trackokay = " << m_counter_trackokay;
edm::LogVerbatim("AlignmentMuonSystemMap") << " monitor m_counter_dt = " << m_counter_dt;
edm::LogVerbatim("AlignmentMuonSystemMap") << " monitor m_counter_13numhits = " << m_counter_13numhits;
edm::LogVerbatim("AlignmentMuonSystemMap") << " monitor m_counter_2numhits = " << m_counter_2numhits;
edm::LogVerbatim("AlignmentMuonSystemMap") << " monitor m_counter_csc = " << m_counter_csc;
edm::LogVerbatim("AlignmentMuonSystemMap") << " monitor m_counter_cscnumhits = " << m_counter_cscnumhits;
}

AlignmentMonitorMuonSystemMap1D::MuonSystemMapPlot1D::MuonSystemMapPlot1D(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,21 +52,24 @@ class AlignmentMonitorMuonVsCurvature : public AlignmentMonitorBase {
const MuonResidualsFromTrack::BuilderToken m_esTokenBuilder;

// parameters
edm::InputTag m_muonCollectionTag;
double m_minTrackPt;
double m_minTrackP;
int m_minTrackerHits;
double m_maxTrackerRedChi2;
bool m_allowTIDTEC;
bool m_minNCrossedChambers;
double m_maxDxy;
int m_minDT13Hits;
int m_minDT2Hits;
int m_minCSCHits;
int m_layer;
std::string m_propagator;
bool m_doDT;
bool m_doCSC;
const edm::InputTag m_muonCollectionTag;
const double m_minTrackPt;
const double m_minTrackP;
const int m_minTrackerHits;
const double m_maxTrackerRedChi2;
const bool m_allowTIDTEC;
const bool m_minNCrossedChambers;
const double m_maxDxy;
const int m_minDT13Hits;
const int m_minDT2Hits;
const int m_minCSCHits;
const int m_layer;
const std::string m_propagator;
const bool m_doDT;
const bool m_doCSC;

const edm::EDGetTokenT<reco::BeamSpot> bsToken_;
const edm::EDGetTokenT<reco::MuonCollection> muonToken_;

enum { kDeltaX = 0, kDeltaDxDz, kNumComponents };

Expand Down Expand Up @@ -104,7 +107,9 @@ AlignmentMonitorMuonVsCurvature::AlignmentMonitorMuonVsCurvature(const edm::Para
m_layer(cfg.getParameter<int>("layer")),
m_propagator(cfg.getParameter<std::string>("propagator")),
m_doDT(cfg.getParameter<bool>("doDT")),
m_doCSC(cfg.getParameter<bool>("doCSC")) {}
m_doCSC(cfg.getParameter<bool>("doCSC")),
bsToken_(iC.consumes<reco::BeamSpot>(m_beamSpotTag)),
muonToken_(iC.consumes<reco::MuonCollection>(m_muonCollectionTag)) {}

void AlignmentMonitorMuonVsCurvature::book() {
// DT
Expand Down Expand Up @@ -196,8 +201,7 @@ void AlignmentMonitorMuonVsCurvature::book() {
void AlignmentMonitorMuonVsCurvature::event(const edm::Event &iEvent,
const edm::EventSetup &iSetup,
const ConstTrajTrackPairCollection &trajtracks) {
edm::Handle<reco::BeamSpot> beamSpot;
iEvent.getByLabel(m_beamSpotTag, beamSpot);
const edm::Handle<reco::BeamSpot> &beamSpot = iEvent.getHandle(bsToken_);

const GlobalTrackingGeometry *globalGeometry = &iSetup.getData(m_esTokenGBTGeom);
const DetIdAssociator *muonDetIdAssociator_ = &iSetup.getData(m_esTokenDetId);
Expand All @@ -219,8 +223,7 @@ void AlignmentMonitorMuonVsCurvature::event(const edm::Event &iEvent,
} // end if track pT is within range
} // end loop over tracks
} else {
edm::Handle<reco::MuonCollection> muons;
iEvent.getByLabel(m_muonCollectionTag, muons);
const edm::Handle<reco::MuonCollection> &muons = iEvent.getHandle(muonToken_);

for (reco::MuonCollection::const_iterator muon = muons->begin(); muon != muons->end(); ++muon) {
if (!(muon->isTrackerMuon() && muon->innerTrack().isNonnull()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,22 @@ class AlignmentMonitorSegmentDifferences : public AlignmentMonitorBase {
const MuonResidualsFromTrack::BuilderToken m_esTokenBuilder;

// parameters
edm::InputTag m_muonCollectionTag;
double m_minTrackPt;
double m_minTrackP;
double m_maxDxy;
int m_minTrackerHits;
double m_maxTrackerRedChi2;
bool m_allowTIDTEC;
bool m_minNCrossedChambers;
int m_minDT13Hits;
int m_minDT2Hits;
int m_minCSCHits;
bool m_doDT;
bool m_doCSC;
const edm::InputTag m_muonCollectionTag;
const double m_minTrackPt;
const double m_minTrackP;
const double m_maxDxy;
const int m_minTrackerHits;
const double m_maxTrackerRedChi2;
const bool m_allowTIDTEC;
const bool m_minNCrossedChambers;
const int m_minDT13Hits;
const int m_minDT2Hits;
const int m_minCSCHits;
const bool m_doDT;
const bool m_doCSC;

const edm::EDGetTokenT<reco::BeamSpot> bsToken_;
const edm::EDGetTokenT<reco::MuonCollection> muonToken_;

// wheel, sector, stationdiff
TProfile *m_dt13_resid[5][12][3];
Expand Down Expand Up @@ -135,7 +138,9 @@ AlignmentMonitorSegmentDifferences::AlignmentMonitorSegmentDifferences(const edm
m_minDT2Hits(cfg.getParameter<int>("minDT2Hits")),
m_minCSCHits(cfg.getParameter<int>("minCSCHits")),
m_doDT(cfg.getParameter<bool>("doDT")),
m_doCSC(cfg.getParameter<bool>("doCSC")) {}
m_doCSC(cfg.getParameter<bool>("doCSC")),
bsToken_(iC.consumes<reco::BeamSpot>(m_beamSpotTag)),
muonToken_(iC.consumes<reco::MuonCollection>(m_muonCollectionTag)) {}

void AlignmentMonitorSegmentDifferences::book() {
char name[225], pos[228], neg[228];
Expand Down Expand Up @@ -371,8 +376,7 @@ void AlignmentMonitorSegmentDifferences::book() {
void AlignmentMonitorSegmentDifferences::event(const edm::Event &iEvent,
const edm::EventSetup &iSetup,
const ConstTrajTrackPairCollection &trajtracks) {
edm::Handle<reco::BeamSpot> beamSpot;
iEvent.getByLabel(m_beamSpotTag, beamSpot);
const edm::Handle<reco::BeamSpot> &beamSpot = iEvent.getHandle(bsToken_);

const GlobalTrackingGeometry *globalGeometry = &iSetup.getData(m_esTokenGBTGeom);
const DetIdAssociator *muonDetIdAssociator_ = &iSetup.getData(m_esTokenDetId);
Expand All @@ -394,8 +398,7 @@ void AlignmentMonitorSegmentDifferences::event(const edm::Event &iEvent,
}
} // end loop over tracks
} else {
edm::Handle<reco::MuonCollection> muons;
iEvent.getByLabel(m_muonCollectionTag, muons);
const edm::Handle<reco::MuonCollection> &muons = iEvent.getHandle(muonToken_);

for (reco::MuonCollection::const_iterator muon = muons->begin(); muon != muons->end(); ++muon) {
if (!(muon->isTrackerMuon() && muon->innerTrack().isNonnull()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ class AlignmentMonitorTracksFromTrajectories : public AlignmentMonitorBase {
private:
MuonServiceProxy *theMuonServiceProxy;
MuonUpdatorAtVertex *theMuonUpdatorAtVertex;
bool m_vertexConstraint;
edm::InputTag m_beamSpot;
const bool m_vertexConstraint;
const edm::InputTag m_beamSpot;
const edm::EDGetTokenT<reco::BeamSpot> bsToken_;

TH1F *m_diMuon_Z;
TH1F *m_diMuon_Zforward;
Expand Down Expand Up @@ -100,7 +101,8 @@ AlignmentMonitorTracksFromTrajectories::AlignmentMonitorTracksFromTrajectories(c
edm::ConsumesCollector iC)
: AlignmentMonitorBase(cfg, iC, "AlignmentMonitorTracksFromTrajectories"),
m_vertexConstraint(cfg.getParameter<bool>("vertexConstraint")),
m_beamSpot(cfg.getParameter<edm::InputTag>("beamSpot")) {
m_beamSpot(cfg.getParameter<edm::InputTag>("beamSpot")),
bsToken_(iC.consumes<reco::BeamSpot>(m_beamSpot)) {
theMuonServiceProxy = new MuonServiceProxy(cfg.getParameter<edm::ParameterSet>("ServiceParameters"));
theMuonUpdatorAtVertex = new MuonUpdatorAtVertex(cfg.getParameter<edm::ParameterSet>("MuonUpdatorAtVertexParameters"),
theMuonServiceProxy);
Expand Down Expand Up @@ -152,8 +154,7 @@ void AlignmentMonitorTracksFromTrajectories::event(const edm::Event &iEvent,
const ConstTrajTrackPairCollection &tracks) {
theMuonServiceProxy->update(iSetup);

edm::Handle<reco::BeamSpot> beamSpot;
iEvent.getByLabel(m_beamSpot, beamSpot);
const edm::Handle<reco::BeamSpot> &beamSpot = iEvent.getHandle(bsToken_);

GlobalVector p1, p2;
double e1 = 0.;
Expand Down
Loading

0 comments on commit 9bec91f

Please sign in to comment.