22 #include "TLorentzVector.h" 34 MEFolderName_(iConfig.getParameter<
std::
string>(
"FolderName")),
35 decayMotherName_(iConfig.getParameter<
std::
string>(
"decayMotherName")),
36 distanceScaleFactor_(iConfig.getParameter<double>(
"distanceScaleFactor")),
37 DiMuMassConfiguration_(iConfig.getParameter<
edm::
ParameterSet>(
"DiMuMassConfig")) {}
58 std::vector<const reco::Track*> myTracks;
60 if (!trackHandle.isValid()) {
61 edm::LogError(
"DiMuonMassBiasMonitor") <<
"invalid track collection encountered!";
65 for (
const auto& muonTrk : *trackHandle) {
66 myTracks.emplace_back(&muonTrk);
69 if (myTracks.size() != 2) {
70 edm::LogWarning(
"DiMuonMassBiasMonitor") <<
"There are not enough tracks to monitor!";
74 const auto&
t1 = myTracks[1]->momentum();
75 const auto&
t0 = myTracks[0]->momentum();
76 const auto& ditrack =
t1 +
t0;
78 const auto& tplus = myTracks[0]->charge() > 0 ? myTracks[0] : myTracks[1];
79 const auto& tminus = myTracks[0]->charge() < 0 ? myTracks[0] : myTracks[1];
81 TLorentzVector p4_tplus(tplus->px(), tplus->py(), tplus->pz(),
sqrt((tplus->p() * tplus->p()) +
mumass2));
82 TLorentzVector p4_tminus(tminus->px(), tminus->py(), tminus->pz(),
sqrt((tminus->p() * tminus->p()) +
mumass2));
84 const auto& Zp4 = p4_tplus + p4_tminus;
85 float track_invMass = Zp4.M();
88 std::pair<TLorentzVector, TLorentzVector> tktk_p4 = std::make_pair(p4_tplus, p4_tminus);
98 if (!vertexHandle.isValid()) {
99 edm::LogError(
"DiMuonMassBiasMonitor") <<
"invalid vertex collection encountered!";
104 const auto&
vertices = vertexHandle.product();
112 if (!beamSpotHandle.isValid()) {
115 bs = beamSpotHandle.product();
130 TString
const& componentName,
134 comp.h_pt = ibook.
book1D(componentName +
"_pt",
"track momentum ;p_{T} [GeV]", 100, 0., 100.);
135 comp.h_eta = ibook.
book1D(componentName +
"_eta",
"track rapidity;#eta", 100, -2.5, 2.5);
136 comp.h_phi = ibook.
book1D(componentName +
"_phi",
"track azimuth;#phi", 100, -
M_PI,
M_PI);
137 comp.h_dxy = ibook.
book1D(componentName +
"_dxyBS",
138 "TIP w.r.t BS;d_{xy}(BS) [cm]",
144 comp.h_dz = ibook.
book1D(componentName +
"_dzPV",
145 "LIP w.r.t PV;d_{z}(PV) [cm]",
151 comp.h_chi2 = ibook.
book1D(componentName +
"_chi2",
";#chi^{2}", 100, 0, 20);
181 std::vector<const reco::Track*>
const&
tracks,
185 edm::LogWarning(
"DiMuonVertexMonitor") <<
"There are not enough tracks to construct a vertex!";
191 std::vector<reco::TransientTrack> tks;
195 tks.push_back(trajectory);
199 mumuTransientVtx = kalman.
vertex(tks);
202 if (not svtx.isValid()) {
206 const auto& mom_t1 =
tracks[1]->momentum();
207 const auto& mom_t0 =
tracks[0]->momentum();
208 const auto& momentum = mom_t1 + mom_t0;
210 TLorentzVector p4_t0(mom_t0.x(), mom_t0.y(), mom_t0.z(),
sqrt(mom_t0.mag2() +
mumass2));
211 TLorentzVector p4_t1(mom_t1.x(), mom_t1.y(), mom_t1.z(),
sqrt(mom_t1.mag2() +
mumass2));
213 const auto& p4 = p4_t0 + p4_t1;
217 return abs(pv1.
z() - svtx.z()) <
abs(pv2.z() - svtx.z());
220 if (pvtx ==
pvs->end()) {
227 auto pvtPos = pvtx->position();
228 const auto& svtPos = svtx.position();
230 math::XYZVector displVect2D(svtPos.x() - pvtPos.x(), svtPos.y() - pvtPos.y(), 0);
231 auto cosAlpha = displVect2D.Dot(momentum) / (displVect2D.Rho() * momentum.rho());
233 auto ct = distXY.
value() * cosAlpha *
mass / momentum.rho();
235 histos.h_pointing->Fill(cosAlpha);
239 histos.h_pt->Fill(momentum.rho());
240 histos.h_eta->Fill(momentum.eta());
241 histos.h_phi->Fill(momentum.phi());
248 if (svtx.chi2() >= 0) {
249 histos.h_vertNormChi2->Fill(svtx.chi2() / svtx.ndof());
274 histos.h_dz->Fill(component->
dz(
pv->position()));
290 desc.add<
double>(
"distanceScaleFactor", 0.1);
297 psDiMuMass.
add<
int>(
"NxBins", 24);
298 psDiMuMass.
add<
int>(
"NyBins", 50);
299 psDiMuMass.
add<
double>(
"ymin", 65.);
300 psDiMuMass.
add<
double>(
"ymax", 115.);
301 psDiMuMass.
add<
double>(
"maxDeltaEta", 3.7);
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
T getParameter(std::string const &) const
dqm::reco::MonitorElement * h_displ2D
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
double z() const
z coordinate
dqm::reco::MonitorElement * h_phi
virtual void setCurrentFolder(std::string const &fullpath)
Measurement1D distance(const GlobalPoint &vtx1Position, const GlobalError &vtx1PositionError, const GlobalPoint &vtx2Position, const GlobalError &vtx2PositionError) const override
ESProducts< std::remove_reference_t< TArgs >... > products(TArgs &&... args)
static constexpr float mumass2
dqm::reco::MonitorElement * h_vertNormChi2
void bookDecayHists(DQMStore::IBooker &, DecayHists &, std::string const &, std::string const &, int, float, float, float distanceScaleFactor=1.) const
std::vector< Track > TrackCollection
collection of Tracks
std::vector< Vertex > VertexCollection
collection of Vertex objects
Log< level::Error, false > LogError
dqm::reco::MonitorElement * h_vertProb
std::vector< Vertex > VertexCollection
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
DiMuonMassBiasMonitor(const edm::ParameterSet &)
reco::Vertex const * fillDecayHistograms(DecayHists const &, std::vector< const reco::Track *> const &tracks, const reco::VertexCollection *const &pvs, const edm::EventSetup &) const
CachingVertex< 5 > vertex(const std::vector< reco::TransientTrack > &tracks) const override
reco::TransientTrack build(const reco::Track *p) const
double pt() const
track transverse momentum
void analyze(const edm::Event &, const edm::EventSetup &) override
double ndof() const
number of degrees of freedom of the fit
double dz() const
dz parameter (= dsz/cos(lambda)). This is the track z0 w.r.t (0,0,0) only if the refPoint is close to...
dqm::reco::MonitorElement * h_pointing
double dxyError() const
error on dxy
edm::ParameterSet DiMuMassConfiguration_
double dzError() const
error on dz
dqm::reco::MonitorElement * h_ct
void bookDecayComponentHistograms(DQMStore::IBooker &ibook, DecayHists &histos) const
void fillPlots(const float val, const std::pair< TLorentzVector, TLorentzVector > &momenta)
Abs< T >::type abs(const T &t)
double phi() const
azimuthal angle of momentum vector
float ChiSquaredProbability(double chiSquared, double nrDOF)
#define DEFINE_FWK_MODULE(type)
dqm::reco::MonitorElement * h_mass
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
double eta() const
pseudorapidity of momentum vector
DiLepPlotHelp::PlotsVsKinematics ZMassPlots
XYZVectorD XYZVector
spatial vector with cartesian internal representation
XYZPointD XYZPoint
point in space with cartesian internal representation
const edm::ESGetToken< TransientTrackBuilder, TransientTrackRecord > ttbESToken_
double chi2() const
chi-squared of the fit
const edm::EDGetTokenT< reco::BeamSpot > beamSpotToken_
double significance() const
void bookFromPSet(dqm::reco::DQMStore::IBooker &iBooker, const edm::ParameterSet &hpar)
const edm::EDGetTokenT< reco::VertexCollection > vertexToken_
void bookComponentHists(DQMStore::IBooker &, DecayHists &, TString const &, float distanceScaleFactor=1.) const
const double distanceScaleFactor_
Log< level::Warning, false > LogWarning
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
const edm::EDGetTokenT< reco::TrackCollection > tracksToken_
void fillComponentHistograms(ComponentHists const &histos, const reco::Track *const &component, reco::BeamSpot const *bs, reco::Vertex const *pv) const
dqm::reco::MonitorElement * h_eta
dqm::reco::MonitorElement * h_sign2D
dqm::reco::MonitorElement * h_pt
const std::string decayMotherName_
std::vector< ComponentHists > decayComponents
const std::string MEFolderName_
double dxy() const
dxy parameter. (This is the transverse impact parameter w.r.t. to (0,0,0) ONLY if refPoint is close t...