Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[13.0.X] Misceallaneous Tracker Alignment validation updates for 2023 data-taking #41408

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 28 additions & 26 deletions Alignment/OfflineValidation/plugins/DiMuonValidation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ class DiMuonValidation : public edm::one::EDAnalyzer<edm::one::SharedResources>
int variable_PairPt_nbins_;

edm::EDGetTokenT<reco::TrackCollection> theTrackCollectionToken_;

TH1F* th1f_mass;
TH2D* th2d_mass_variables_[varNumber_]; // actual histograms
std::string variables_name_[varNumber_] = {
"CosThetaCS", "DeltaEta", "EtaMinus", "EtaPlus", "PhiCS", "PhiMinus", "PhiPlus", "Pt"};
Expand All @@ -175,37 +177,35 @@ void DiMuonValidation::analyze(const edm::Event& iEvent, const edm::EventSetup&
const reco::TrackCollection& tC = iEvent.get(theTrackCollectionToken_);

DiMuonValid::LV LV_mother(0., 0., 0., 0.);
//for (reco::TrackCollection::const_iterator track1 = tC.begin(); track1 != tC.end(); track1++) {
for (const auto& track1 : tC) {
DiMuonValid::LV LV_track1(track1.px(),
track1.py(),
track1.pz(),
sqrt((track1.p() * track1.p()) + mu_mass2_)); //old 106

for (const auto& track2 : tC) {
if (&track1 == &track2) {
continue;
} // discard the same track

if (track1.charge() == track2.charge()) {
for (reco::TrackCollection::const_iterator track1 = tC.begin(); track1 != tC.end(); track1++) {
DiMuonValid::LV LV_track1(track1->px(),
track1->py(),
track1->pz(),
sqrt((track1->p() * track1->p()) + mu_mass2_)); //old 106

for (reco::TrackCollection::const_iterator track2 = track1 + 1; track2 != tC.end(); track2++) {
if (track1->charge() == track2->charge()) {
continue;
} // only reconstruct opposite charge pair

DiMuonValid::LV LV_track2(track2.px(), track2.py(), track2.pz(), sqrt((track2.p() * track2.p()) + mu_mass2_));
DiMuonValid::LV LV_track2(
track2->px(), track2->py(), track2->pz(), sqrt((track2->p() * track2->p()) + mu_mass2_));

LV_mother = LV_track1 + LV_track2;
double mother_mass = LV_mother.M();
th1f_mass->Fill(mother_mass);

double mother_pt = LV_mother.Pt();

int charge1 = track1.charge();
double etaMu1 = track1.eta();
double phiMu1 = track1.phi();
double ptMu1 = track1.pt();
int charge1 = track1->charge();
double etaMu1 = track1->eta();
double phiMu1 = track1->phi();
double ptMu1 = track1->pt();

int charge2 = track2.charge();
double etaMu2 = track2.eta();
double phiMu2 = track2.phi();
double ptMu2 = track2.pt();
int charge2 = track2->charge();
double etaMu2 = track2->eta();
double phiMu2 = track2->phi();
double ptMu2 = track2->pt();

if (charge1 < 0) { // use Mu+ for charge1, Mu- for charge2
std::swap(charge1, charge2);
Expand Down Expand Up @@ -263,6 +263,8 @@ void DiMuonValidation::beginJob() {
fs->file().SetCompressionSettings(compressionSettings_);
}

th1f_mass = fs->make<TH1F>("hMass", "mass;m_{#mu#mu} [GeV];events", 200, 0., 200.);

for (int i = 0; i < varNumber_; i++) {
std::string th2d_name = fmt::sprintf("th2d_mass_%s", variables_name_[i].c_str());
th2d_mass_variables_[i] = fs->make<TH2D>(th2d_name.c_str(),
Expand All @@ -288,10 +290,10 @@ void DiMuonValidation::fillDescriptions(edm::ConfigurationDescriptions& descript
desc.add<double>("Pair_mass_min", 60);
desc.add<double>("Pair_mass_max", 120);
desc.add<int>("Pair_mass_nbins", 120);
desc.add<double>("Pair_etaminpos", 60);
desc.add<double>("Pair_etamaxpos", 60);
desc.add<double>("Pair_etaminneg", 60);
desc.add<double>("Pair_etamaxneg", 60);
desc.add<double>("Pair_etaminpos", -2.4);
desc.add<double>("Pair_etamaxpos", 2.4);
desc.add<double>("Pair_etaminneg", -2.4);
desc.add<double>("Pair_etamaxneg", 2.4);

desc.add<double>("Variable_CosThetaCS_xmin", -1.);
desc.add<double>("Variable_CosThetaCS_xmax", 1.);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,15 @@ class GeneralPurposeTrackAnalyzer : public edm::one::EDAnalyzer<edm::one::WatchR
TH1D *hrun;
TH1D *hlumi;

TH1F *h_BSx0;
TH1F *h_BSy0;
TH1F *h_BSz0;
TH1F *h_Beamsigmaz;
TH1F *h_BeamWidthX;
TH1F *h_BeamWidthY;
TH1F *h_BSdxdz;
TH1F *h_BSdydz;

std::vector<TH1 *> vTrackHistos_;
std::vector<TH1 *> vTrackProfiles_;
std::vector<TH1 *> vTrack2DHistos_;
Expand Down Expand Up @@ -646,12 +655,31 @@ class GeneralPurposeTrackAnalyzer : public edm::one::EDAnalyzer<edm::one::WatchR
edm::Handle<reco::BeamSpot> beamSpotHandle = event.getHandle(beamspotToken_);
if (beamSpotHandle.isValid()) {
beamSpot = *beamSpotHandle;
math::XYZPoint point(beamSpot.x0(), beamSpot.y0(), beamSpot.z0());

double BSx0 = beamSpot.x0();
double BSy0 = beamSpot.y0();
double BSz0 = beamSpot.z0();
double Beamsigmaz = beamSpot.sigmaZ();
double Beamdxdz = beamSpot.dxdz();
double Beamdydz = beamSpot.dydz();
double BeamWidthX = beamSpot.BeamWidthX();
double BeamWidthY = beamSpot.BeamWidthY();

math::XYZPoint point(BSx0, BSy0, BSz0);
double dxy = track->dxy(point);
double dz = track->dz(point);
hdxyBS->Fill(dxy);
hd0BS->Fill(-dxy);
hdzBS->Fill(dz);

h_BSx0->Fill(BSx0);
h_BSy0->Fill(BSy0);
h_BSz0->Fill(BSz0);
h_Beamsigmaz->Fill(Beamsigmaz);
h_BeamWidthX->Fill(BeamWidthX);
h_BeamWidthY->Fill(BeamWidthY);
h_BSdxdz->Fill(Beamdxdz);
h_BSdydz->Fill(Beamdydz);
}

//dxy with respect to the primary vertex
Expand Down Expand Up @@ -843,6 +871,15 @@ class GeneralPurposeTrackAnalyzer : public edm::one::EDAnalyzer<edm::one::WatchR
hPhiEndcapPlus = book<TH1D>("h_PhiEndcapPlus", "hPhiEndcapPlus (#eta>1.4);track #phi;track", 100, -M_PI, M_PI);
hPhiEndcapMinus = book<TH1D>("h_PhiEndcapMinus", "hPhiEndcapMinus (#eta<1.4);track #phi;tracks", 100, -M_PI, M_PI);

h_BSx0 = book<TH1F>("h_BSx0", "x-coordinate of reco beamspot;x^{BS}_{0};n_{events}", 100, -0.1, 0.1);
h_BSy0 = book<TH1F>("h_BSy0", "y-coordinate of reco beamspot;y^{BS}_{0};n_{events}", 100, -0.1, 0.1);
h_BSz0 = book<TH1F>("h_BSz0", "z-coordinate of reco beamspot;z^{BS}_{0};n_{events}", 100, -1., 1.);
h_Beamsigmaz = book<TH1F>("h_Beamsigmaz", "z-coordinate beam width;#sigma_{Z}^{beam};n_{events}", 100, 0., 1.);
h_BeamWidthX = book<TH1F>("h_BeamWidthX", "x-coordinate beam width;#sigma_{X}^{beam};n_{events}", 100, 0., 0.01);
h_BeamWidthY = book<TH1F>("h_BeamWidthY", "y-coordinate beam width;#sigma_{Y}^{beam};n_{events}", 100, 0., 0.01);
h_BSdxdz = book<TH1F>("h_BSdxdz", "BeamSpot dxdz;beamspot dx/dz;n_{events}", 100, -0.0003, 0.0003);
h_BSdydz = book<TH1F>("h_BSdydz", "BeamSpot dydz;beamspot dy/dz;n_{events}", 100, -0.0003, 0.0003);

if (!isCosmics_) {
hPhp = book<TH1D>("h_P_hp", "Momentum (high purity);track momentum [GeV];tracks", 100, 0., 100.);
hPthp = book<TH1D>("h_Pt_hp", "Transverse Momentum (high purity);track p_{T} [GeV];tracks", 100, 0., 100.);
Expand Down
Loading