From d2f8a50705de5a99ecd47a9cd8ba0db5d9345cc3 Mon Sep 17 00:00:00 2001 From: Ryan McCarthy Date: Tue, 28 May 2024 13:21:47 +0200 Subject: [PATCH] Removing Displaced Vertexing Analyzer macro --- .../test/Analyzer_DisplacedMuon.C | 3526 ----------------- 1 file changed, 3526 deletions(-) delete mode 100644 L1Trigger/L1TTrackMatch/test/Analyzer_DisplacedMuon.C diff --git a/L1Trigger/L1TTrackMatch/test/Analyzer_DisplacedMuon.C b/L1Trigger/L1TTrackMatch/test/Analyzer_DisplacedMuon.C deleted file mode 100644 index 24ac4179b9974..0000000000000 --- a/L1Trigger/L1TTrackMatch/test/Analyzer_DisplacedMuon.C +++ /dev/null @@ -1,3526 +0,0 @@ - -// // ---------------------------------------------------------------------------------------------------------------- -// // Feasibility study of using L1 Tracks to identify Displaced Vertex -// // -// // By Bharadwaj Harikrishnan, May 2021 -// // Edited by Ryan McCarthy, Sept 2021 -// // ---------------------------------------------------------------------------------------------------------------- - -#include -#include -#include -#include -#include -#include -#include "TFile.h" -#include "TTree.h" -#include "TChain.h" -#include "TBranch.h" -#include "TLeaf.h" -#include -#include "TLegend.h" -#include "TH1.h" -#include "TH2.h" -#include "TF1.h" -#include "TGraph.h" -#include "TMath.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -using namespace std; - -bool detailedPlots = false; -float d0_res = 0.02152; //cm - -void SetPlotStyle(); -void mySmallText(Double_t x, Double_t y, Color_t color, char *text); -void removeFlows(TH1F* h); -void removeFlows(TH2F* h); - -class Track_Parameters -{ -public: - float pt; - float d0; - float dxy = -99999; - float z0; - float eta; - float phi; - float charge; - float rho; - int index; - int pdgid = -99999; - float vx; - float vy; - float vz; - Track_Parameters* tp; - float x0; - float y0; - int nstubs; - float chi2rphi; - float chi2rz; - float bendchi2; - float MVA1; - float MVA2; - - float dist_calc(float x_dv, float y_dv, float x, float y){ - dxy = TMath::Sqrt((x_dv-x)*(x_dv-x) + (y_dv-y)*(y_dv-y)); - return dxy; - } - float x(float phi_T=0){ - return (-charge * rho * TMath::Sin(phi - charge*phi_T) + (d0 + charge * rho) * TMath::Sin(phi)); - } - float y(float phi_T=0){ - return ( charge * rho * TMath::Cos(phi - charge*phi_T) - (d0 + charge * rho) * TMath::Cos(phi)); - } - float z(float phi_T=0){ - float theta = 2 * TMath::ATan(TMath::Exp(-eta)); - return (z0 + rho*phi_T/TMath::Tan(theta)); - } - float deltaPhi_T(Double_t phi1, Double_t phi2) - { - Double_t dPhi = phi1 - phi2; - if (dPhi >= TMath::Pi()) - dPhi -= 2. * TMath::Pi(); - if (dPhi <= -TMath::Pi()) - dPhi += 2. * TMath::Pi(); - return dPhi; - } - float phi_T(float x, float y){ - float num = x - (d0 + charge * rho) * TMath::Sin(phi); - float den = y + (d0 + charge * rho) * TMath::Cos(phi); - return ((phi-TMath::ATan2(num,-den))/charge); - } - float z(float x, float y){ - float t = std::sinh(eta); - float r = TMath::Sqrt(pow(x,2)+pow(y,2)); - return (z0+(t*r*(1+(pow(d0,2)/pow(r,2))+(1.0/6.0)*pow(r/(2*rho),2)))); // can do higher order terms if necessary from displaced math - } - Track_Parameters(float pt_in, float d0_in, float z0_in, float eta_in, float phi_in, int pdgid_in, float vx_in, float vy_in, float vz_in, float charge_in=0, int index_in=-1, Track_Parameters* tp_in=nullptr, int nstubs_in=0, float chi2rphi_in=0, float chi2rz_in=0, float bendchi2_in=0, float MVA1_in=0, float MVA2_in=0) - { - pt = pt_in; - d0 = d0_in; - z0 = z0_in; - eta = eta_in; - phi = phi_in; - if(charge_in > 0){ - charge = 1; - } - else if (charge_in < 0){ - charge = -1; - } - else{ - charge = 0; - } - index = index_in; - pdgid = pdgid_in; - vx = vx_in; - vy = vy_in; - vz = vz_in; - tp = tp_in; - rho = fabs(1/charge_in); - x0 = (rho+charge*d0)*TMath::Cos(phi-(charge*TMath::Pi()/2)); - y0 = (rho+charge*d0)*TMath::Sin(phi-(charge*TMath::Pi()/2)); - nstubs = nstubs_in; - chi2rphi = chi2rphi_in; - chi2rz = chi2rz_in; - bendchi2 = bendchi2_in; - MVA1 = MVA1_in; - MVA2 = MVA2_in; - } - Track_Parameters(){}; - ~Track_Parameters(){}; -}; - -constexpr bool operator==(const Track_Parameters* lhs, const Track_Parameters& rhs) -{ - return (lhs->pt==rhs.pt && lhs->d0==rhs.d0 && lhs->z0==rhs.z0 && lhs->eta==rhs.eta && lhs->phi==rhs.phi); -} -constexpr bool operator==(const Track_Parameters& lhs, const Track_Parameters* rhs) -{ - return (lhs.pt==rhs->pt && lhs.d0==rhs->d0 && lhs.z0==rhs->z0 && lhs.eta==rhs->eta && lhs.phi==rhs->phi); -} -constexpr bool operator==(const Track_Parameters& lhs, const Track_Parameters& rhs) -{ - return (lhs.pt==rhs.pt && lhs.d0==rhs.d0 && lhs.z0==rhs.z0 && lhs.eta==rhs.eta && lhs.phi==rhs.phi); -} - -std::valarray calcPVec(Track_Parameters a, double_t v_x, double_t v_y) -{ - std::valarray r_vec = {float(v_x)-a.x0,float(v_y)-a.y0}; - std::valarray p_vec = {-r_vec[1],r_vec[0]}; - if(a.charge>0){ - p_vec *= -1; - } - p_vec /= TMath::Sqrt(pow(p_vec[0],2)+pow(p_vec[1],2)); - p_vec *= a.pt; - return p_vec; -} - -class Vertex_Parameters -{ -public: - Double_t x_dv; - Double_t y_dv; - Double_t z_dv; - float score; - Track_Parameters a; - Track_Parameters b; - int inTraj; - bool matched = false; - std::vector tracks = {}; - float p_mag; - float p2_mag; - float openingAngle; - float R_T; - float cos_T; - float alpha_T; - float d_T; - float chi2rphidofSum; - float chi2rzdofSum; - float bendchi2Sum; - float MVA1Sum; - float MVA2Sum; - int numStubsSum; - float delta_z; - float delta_eta; - float phi; - Vertex_Parameters(Double_t x_dv_in, Double_t y_dv_in, Double_t z_dv_in, Track_Parameters a_in, Track_Parameters b_in, float score_in=-1, int inTraj_in=4): - a(a_in), - b(b_in) - { - x_dv = x_dv_in; - y_dv = y_dv_in; - z_dv = z_dv_in; - score = score_in; - tracks.push_back(a_in); - tracks.push_back(b_in); - inTraj = inTraj_in; - std::valarray p_trk_1 = calcPVec(a_in,x_dv_in,y_dv_in); - std::valarray p_trk_2 = calcPVec(b_in,x_dv_in,y_dv_in); - std::valarray p_tot = p_trk_1+p_trk_2; - p_mag = TMath::Sqrt(pow(p_tot[0],2)+pow(p_tot[1],2)); - openingAngle = (p_trk_1[0]*p_trk_2[0]+p_trk_1[1]*p_trk_2[1]) / (TMath::Sqrt(pow(p_trk_1[0],2)+pow(p_trk_1[1],2))*TMath::Sqrt(pow(p_trk_2[0],2)+pow(p_trk_2[1],2))); - R_T = TMath::Sqrt(pow(x_dv_in,2)+pow(y_dv_in,2)); - cos_T = (p_tot[0]*x_dv_in+p_tot[1]*y_dv_in)/(R_T*TMath::Sqrt(pow(p_tot[0],2)+pow(p_tot[1],2))); - alpha_T = acos(cos_T); - phi = atan2(p_tot[1],p_tot[0]); - d_T = fabs(cos(phi)*y_dv_in-sin(phi)*x_dv_in); - float chi2rphidof_1 = a_in.chi2rphi; - float chi2rzdof_1 = a_in.chi2rz; - float bendchi2_1 = a_in.bendchi2; - float chi2rphidof_2 = b_in.chi2rphi; - float chi2rzdof_2 = b_in.chi2rz; - float bendchi2_2 = b_in.bendchi2; - chi2rphidofSum = chi2rphidof_1 + chi2rphidof_2; - chi2rzdofSum = chi2rzdof_1 + chi2rzdof_2; - bendchi2Sum = bendchi2_1 + bendchi2_2; - MVA1Sum = a_in.MVA1 + b_in.MVA1; - MVA2Sum = a_in.MVA2 + b_in.MVA2; - numStubsSum = a_in.nstubs + b_in.nstubs; - p2_mag = pow(a_in.pt,2)+pow(b_in.pt,2); - delta_z = fabs(a_in.z(x_dv_in,y_dv_in)-b_in.z(x_dv_in,y_dv_in)); - delta_eta = fabs(a_in.eta-b_in.eta); - } - - void addTrack(Track_Parameters trk){ - tracks.push_back(trk); - std::valarray p_tot = {0,0}; - for(auto track : tracks){ - p_tot+= calcPVec(track,x_dv,y_dv); - } - p_mag = TMath::Sqrt(pow(p_tot[0],2)+pow(p_tot[1],2)); - cos_T = (p_tot[0]*x_dv+p_tot[1]*y_dv)/(R_T*TMath::Sqrt(pow(p_tot[0],2)+pow(p_tot[1],2))); - alpha_T = acos(cos_T); - phi = atan2(p_tot[1],p_tot[0]); - d_T = fabs(cos(phi)*y_dv-sin(phi)*x_dv); - float chi2rphidof = trk.chi2rphi; - float chi2rzdof = trk.chi2rz; - float bendchi2 = trk.bendchi2; - chi2rphidofSum+= chi2rphidof; - chi2rzdofSum+= chi2rzdof; - bendchi2Sum+= bendchi2; - numStubsSum+= trk.nstubs; - p2_mag+= pow(trk.pt,2); - MVA1Sum+= trk.MVA1; - MVA2Sum+= trk.MVA2; - } - - Vertex_Parameters(){}; - ~Vertex_Parameters(){}; -}; - -constexpr bool operator==(const Vertex_Parameters& lhs, const Vertex_Parameters& rhs) -{ - return (lhs.x_dv==rhs.x_dv && lhs.y_dv==rhs.y_dv && lhs.z_dv==rhs.z_dv); -} - -class Cut { -public: - virtual ~Cut() = default; - virtual TString getCutName() const = 0; - virtual TString getCutLabel() const = 0; - virtual float getParam(int it) const = 0; - virtual float getCutValue() const = 0; - virtual float getDoPlot() const = 0; -}; - -template -class TypedCut : public Cut -{ -public: - TString cutName; - TString cutLabel; - std::vector** params; - T cutValue; - bool doPlot; - - TypedCut(TString cutName_in, TString cutLabel_in, std::vector** params_in, T cutValue_in, bool doPlot_in): cutName(cutName_in), cutLabel(cutLabel_in), params(params_in), cutValue(cutValue_in), doPlot(doPlot_in) {} - TypedCut(){}; - ~TypedCut(){}; - TString getCutName() const - { - return cutName; - } - TString getCutLabel() const - { - return cutLabel; - } - float getParam(int it) const - { - T param = (*params)->at(it); - return float(param); - } - float getCutValue() const - { - return float(cutValue); - } - float getDoPlot() const - { - return doPlot; - } -}; - -class Plot { -public: - virtual ~Plot() = default; - virtual TString getVarName() const = 0; - virtual TString getUnit() const = 0; - virtual float getParam(int it) const = 0; - virtual int getNumBins() const = 0; - virtual float getMinBin() const = 0; - virtual float getMaxBin() const = 0; - virtual std::vector getBins() const = 0; - virtual bool getBool() const = 0; -}; - -template -class TypedPlot : public Plot -{ -public: - TString varName; - TString unit; - std::vector** params; - int numBins; - float minBin; - float maxBin; - std::vector bins; - bool variableBins; - - TypedPlot(TString varName_in, TString unit_in, std::vector** params_in, int numBins_in, float minBin_in, float maxBin_in): varName(varName_in), unit(unit_in), params(params_in), numBins(numBins_in), minBin(minBin_in), maxBin(maxBin_in){ - variableBins = false; - } - TypedPlot(TString varName_in, TString unit_in, std::vector** params_in, int numBins_in, std::vector bins_in): varName(varName_in), unit(unit_in), params(params_in), numBins(numBins_in), bins(bins_in) { - variableBins = true; - } - TypedPlot(){}; - ~TypedPlot(){}; - TString getVarName() const - { - return varName; - } - TString getUnit() const - { - return unit; - } - float getParam(int it) const - { - T param = (*params)->at(it); - return float(param); - } - int getNumBins() const - { - return numBins; - } - float getMinBin() const - { - return minBin; - } - float getMaxBin() const - { - return maxBin; - } - std::vector getBins() const - { - return bins; - } - bool getBool() const - { - return variableBins; - } -}; - -void displayProgress(long current, long max) -{ - using std::cerr; - if (max < 2500) - return; - if (current % (max / 2500) != 0 && current < max - 1) - return; - - int width = 52; // Hope the terminal is at least that wide. - int barWidth = width - 2; - cerr << "\x1B[2K"; // Clear line - cerr << "\x1B[2000D"; // Cursor left - cerr << '['; - for (int i = 0; i < barWidth; ++i) - { - if (i < barWidth * current / max) - { - cerr << '='; - } - else - { - cerr << ' '; - } - } - cerr << ']'; - cerr << " " << Form("%8d/%8d (%5.2f%%)", (int)current, (int)max, 100.0 * current / max); - cerr.flush(); -} - -template -void raiseMax(T *hist1, S *hist2=nullptr, T *hist3=nullptr, T *hist4=nullptr) -{ - Double_t max = hist1->GetBinContent(hist1->GetMaximumBin()); - if(hist2!=nullptr){ - Double_t max2 = hist2->GetBinContent(hist2->GetMaximumBin()); - if(max2>max) max = max2; - } - if(hist3!=nullptr){ - Double_t max3 = hist3->GetBinContent(hist3->GetMaximumBin()); - if(max3>max) max = max3; - } - if(hist4!=nullptr){ - Double_t max4 = hist4->GetBinContent(hist4->GetMaximumBin()); - if(max4>max) max = max4; - } - if(max>0.0){ - hist1->GetYaxis()->SetRangeUser(0.,1.2*max); - if(hist2!=nullptr) hist2->GetYaxis()->SetRangeUser(0.,1.2*max); - if(hist3!=nullptr) hist3->GetYaxis()->SetRangeUser(0.,1.2*max); - if(hist4!=nullptr) hist4->GetYaxis()->SetRangeUser(0.,1.2*max); - } -} - -void raiseMaxStack(TH1F* hist, THStack* stack) -{ - Double_t max = hist->GetMaximum(); - Double_t max2 = stack->GetMaximum(); - if(max2>max) max = max2; - - if(max>0.0){ - hist->GetYaxis()->SetRangeUser(0.,1.2*max); - stack->GetYaxis()->SetRangeUser(0.,1.2*max); - } - -} - -template -void drawSame(T *hist1, S *hist2, T *hist3=nullptr, T *hist4=nullptr) -{ - if(hist1->GetBinContent(hist1->GetMaximumBin())!=0.0){ - hist1->Draw("HIST"); - hist2->Draw("HIST,SAME"); - if(hist3!=nullptr) hist3->Draw("HIST,SAME"); - if(hist4!=nullptr) hist4->Draw("HIST,SAME"); - } - else if(hist2->GetBinContent(hist2->GetMaximumBin())!=0.0){ - hist2->Draw("HIST"); - if(hist3!=nullptr) hist3->Draw("HIST,SAME"); - if(hist4!=nullptr) hist4->Draw("HIST,SAME"); - } - else if(hist3!=nullptr){ - if(hist3->GetBinContent(hist3->GetMaximumBin())!=0.0){ - hist3->Draw("HIST"); - if(hist4!=nullptr) hist4->Draw("HIST,SAME"); - } - } - else if(hist4!=nullptr){ - if(hist4->GetBinContent(hist4->GetMaximumBin())!=0.0){ - hist4->Draw("HIST"); - } - } - else{ - hist1->Draw("HIST"); - } -} - -void drawSameStack(TH1F* hist, THStack* stack) -{ - if(hist->GetMaximum()!=0.0){ - hist->Draw("HIST"); - stack->Draw("HIST,SAME"); - } - else if(stack->GetMaximum()!=0.0){ - stack->Draw("HIST"); - } - else{ - hist->Draw("HIST"); - } -} - -bool ComparePtTrack(Track_Parameters a, Track_Parameters b) { return a.pt > b.pt; } -bool CompareZ0Track(Track_Parameters a, Track_Parameters b) { return a.z0 > b.z0; } -bool CompareD0Track(Track_Parameters a, Track_Parameters b) { return a.d0 > b.d0; } -bool ComparePtVert(Vertex_Parameters v1, Vertex_Parameters v2) {return v1.a.pt > v2.a.pt; } -bool CompareDelzVert(Vertex_Parameters v1, Vertex_Parameters v2) {return v1.delta_z > v2.delta_z; } -bool CompareDtVert(Vertex_Parameters v1, Vertex_Parameters v2) {return v1.d_T > v2.d_T; } -bool CompareChi2rphidofSumVert(Vertex_Parameters v1, Vertex_Parameters v2) {return v1.chi2rphidofSum > v2.chi2rphidofSum; } -bool CompareRtVert(Vertex_Parameters v1, Vertex_Parameters v2) {return v1.R_T > v2.R_T; } - -template -std::vector linspace(T start, T end, int num){ - std::vector out; - T delta = (end - start) / (num-1); - for(int i=0; i logspace(const float &a, const float &b, const int &k) -{ - std::vector bins; - float delta = (log10(b) - log10(a)) / k; - for (int i = 0; i < (k+1); i++) - { - bins.push_back(pow(10, log10(a) + (i * delta))); - } - //std::cout<<"logspace bins: "; - for(uint j=0; j TMath::Pi()) - dPhi -= 2. * TMath::Pi(); - if (dPhi < -TMath::Pi()) - dPhi += 2. * TMath::Pi(); - return dPhi; -} - -Double_t deltaR(Double_t eta1, Double_t phi1, Double_t eta2, Double_t phi2) -{ - Double_t dEta, dPhi; - dEta = eta1 - eta2; - dPhi = deltaPhi(phi1, phi2); - return sqrt(dEta * dEta + dPhi * dPhi); -} - -Double_t dist(Double_t x1, Double_t y1 , Double_t x2=0, Double_t y2=0){ // Distance between 2 points - return (TMath::Sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2))); -} - -Double_t dist_Vertex(Double_t x_vtx, Double_t y_vtx, Track_Parameters a){ // Distance between track and displaced vertex - float R = dist(x_vtx,y_vtx,a.x0,a.y0); - return (fabs(R-(a.rho))); -} - -Double_t dist_TPs(Track_Parameters* a, Track_Parameters* b); // Closest distance between 2 tracks -Double_t dist_TPs(Track_Parameters a, Track_Parameters b); // Closest distance between 2 tracks -bool CompareDeltaXY(Vertex_Parameters v1, Vertex_Parameters v2) {return dist_TPs(v1.a,v1.b) < dist_TPs(v2.a,v2.b); } - -Int_t calcVertex(Track_Parameters a, Track_Parameters b, Double_t &x_vtx, Double_t &y_vtx, Double_t &z_vtx); -// Identify the displaced vertex (x_vtx,y_vtx,z_vtx) and return the status -//-2 = Circles with same center. No Intersection -//-1 = Circles don't Intersect. A point on the line connecting the centers is chosen. -// 0 = Only 1 Intersection not satisfying Z cutoff -// 1 = Only 1 Intersection satisfying Z cutoff -// 2 = Only 1 Intersection detectable dist(x,y)<20 -// 3 = 2 Intersections - -void Analyzer_DisplacedMuon(TString inputFilePath, - TString outputDir, - float TP_maxD0 = 1.9, - float TP_minD0 = 0.0004196) -{ - TChain *tree = new TChain("L1TrackNtuple/eventTree"); - tree->Add(inputFilePath); - //TChain *vertTree = new TChain("L1TrackNtuple/dispVertTree"); - //vertTree->Add(inputFilePath); - std::string inputFileString(inputFilePath.Data()); - inputFileString = inputFileString.substr(inputFileString.find_last_of("/")+1); - TString inputFile(inputFileString); - std::cout<<"input: "<SetBatch(); - gErrorIgnoreLevel = kWarning; - - SetPlotStyle(); - float barrelEta = 0.95; - - //Vertex parameter vectors - vector *trkVert_firstIndexTrk; - vector *trkVert_secondIndexTrk; - vector *trkVert_firstIndexPt; - vector *trkVert_secondIndexPt; - vector *trkVert_inTraj; - vector *trkVert_d_T; - vector *trkVert_R_T; - vector *trkVert_cos_T; - vector *trkVert_del_Z; - vector *trkVert_x; - vector *trkVert_y; - vector *trkVert_z; - vector *trkVert_openingAngle; - vector *trkVert_parentPt; - vector *trkVert_delIndexPt; - vector *trkVert_isReal; - vector *trkVert_score; - - vector *tpVert_d_T; - vector *tpVert_R_T; - vector *tpVert_cos_T; - vector *tpVert_x; - vector *tpVert_y; - vector *tpVert_z; - vector *tpVert_openingAngle; - vector *tpVert_parentPt; - - vector *trk_pt; - vector *trk_eta; - vector *trk_phi; - vector *trk_d0; - vector *trk_rinv; - vector *trk_z0; - vector *trk_chi2; - vector *trk_chi2rphi; - vector *trk_chi2rz; - vector *trk_bendchi2; - vector *trk_nstub; - vector *trk_lhits; - vector *trk_dhits; - vector *trk_seed; - vector *trk_hitpattern; - vector *trk_phiSector; - vector *trk_genuine; - vector *trk_loose; - vector *trk_unknown; - vector *trk_combinatoric; - vector *trkExt_fake; - vector *trk_MVA1; - vector *trk_MVA2; - vector *trk_matchtp_pdgid; - vector *trk_matchtp_isHToMu; - vector *trk_matchtp_isHToB; - vector *trk_matchtp_pt; - vector *trk_matchtp_eta; - vector *trk_matchtp_phi; - vector *trk_matchtp_z0; - vector *trk_matchtp_dxy; - vector *trk_matchtp_d0; - vector *trk_matchtp_x; - vector *trk_matchtp_y; - vector *trk_matchtp_z; - vector *tp_pt; - vector *tp_eta; - vector *tp_phi; - vector *tp_dxy; - vector *tp_d0; - vector *tp_z0; - vector *tp_x; - vector *tp_y; - vector *tp_z; - vector *tp_d0_prod; - vector *tp_z0_prod; - vector *tp_pdgid; - vector *tp_isHToMu; - vector *tp_isHToB; - vector *tp_nmatch; - vector *tp_nstub; - vector *tp_eventid; - vector *tp_charge; - vector *matchtrk_pt; - vector *matchtrk_eta; - vector *matchtrk_phi; - vector *matchtrk_z0; - vector *matchtrk_d0; - vector *matchtrk_rinv; - vector *matchtrk_chi2; - vector *matchtrk_chi2rphi; - vector *matchtrk_chi2rz; - vector *matchtrk_bendchi2; - vector *matchtrk_MVA1; - vector *matchtrk_MVA2; - vector *matchtrk_nstub; - vector *matchtrk_lhits; - vector *matchtrk_dhits; - vector *matchtrk_seed; - vector *matchtrk_hitpattern; - - TBranch *b_trkVert_firstIndexTrk; - TBranch *b_trkVert_secondIndexTrk; - TBranch *b_trkVert_firstIndexPt; - TBranch *b_trkVert_secondIndexPt; - TBranch *b_trkVert_inTraj; - TBranch *b_trkVert_d_T; - TBranch *b_trkVert_R_T; - TBranch *b_trkVert_cos_T; - TBranch *b_trkVert_del_Z; - TBranch *b_trkVert_x; - TBranch *b_trkVert_y; - TBranch *b_trkVert_z; - TBranch *b_trkVert_openingAngle; - TBranch *b_trkVert_parentPt; - TBranch *b_trkVert_delIndexPt; - TBranch *b_trkVert_isReal; - TBranch *b_trkVert_score; - TBranch *b_trk_pt; - TBranch *b_trk_eta; - TBranch *b_trk_phi; - TBranch *b_trk_d0; - TBranch *b_trk_rinv; - TBranch *b_trk_z0; - TBranch *b_trk_chi2; - TBranch *b_trk_chi2rphi; - TBranch *b_trk_chi2rz; - TBranch *b_trk_bendchi2; - TBranch *b_trk_nstub; - TBranch *b_trk_lhits; - TBranch *b_trk_dhits; - TBranch *b_trk_seed; - TBranch *b_trk_hitpattern; - TBranch *b_trk_phiSector; - TBranch *b_trk_genuine; - TBranch *b_trk_loose; - TBranch *b_trk_unknown; - TBranch *b_trk_combinatoric; - TBranch *b_trkExt_fake; - TBranch *b_trk_MVA1; - TBranch *b_trk_MVA2; - TBranch *b_trk_matchtp_pdgid; - TBranch *b_trk_matchtp_isHToMu; - TBranch *b_trk_matchtp_isHToB; - TBranch *b_trk_matchtp_pt; - TBranch *b_trk_matchtp_eta; - TBranch *b_trk_matchtp_phi; - TBranch *b_trk_matchtp_z0; - TBranch *b_trk_matchtp_dxy; - TBranch *b_trk_matchtp_d0; - TBranch *b_trk_matchtp_x; - TBranch *b_trk_matchtp_y; - TBranch *b_trk_matchtp_z; - TBranch *b_tp_pt; - TBranch *b_tp_eta; - TBranch *b_tp_phi; - TBranch *b_tp_dxy; - TBranch *b_tp_d0; - TBranch *b_tp_z0; - TBranch *b_tp_x; - TBranch *b_tp_y; - TBranch *b_tp_z; - TBranch *b_tp_d0_prod; - TBranch *b_tp_z0_prod; - TBranch *b_tp_pdgid; - TBranch *b_tp_isHToMu; - TBranch *b_tp_isHToB; - TBranch *b_tp_nmatch; - TBranch *b_tp_nstub; - TBranch *b_tp_eventid; - TBranch *b_tp_charge; - TBranch *b_matchtrk_pt; - TBranch *b_matchtrk_eta; - TBranch *b_matchtrk_phi; - TBranch *b_matchtrk_z0; - TBranch *b_matchtrk_d0; - TBranch *b_matchtrk_rinv; - TBranch *b_matchtrk_chi2; - TBranch *b_matchtrk_chi2rphi; - TBranch *b_matchtrk_chi2rz; - TBranch *b_matchtrk_bendchi2; - TBranch *b_matchtrk_MVA1; - TBranch *b_matchtrk_MVA2; - TBranch *b_matchtrk_nstub; - TBranch *b_matchtrk_lhits; - TBranch *b_matchtrk_dhits; - TBranch *b_matchtrk_seed; - TBranch *b_matchtrk_hitpattern; - - trkVert_firstIndexTrk = 0; - trkVert_secondIndexTrk = 0; - trkVert_firstIndexPt = 0; - trkVert_secondIndexPt = 0; - trkVert_inTraj = 0; - trkVert_d_T = 0; - trkVert_R_T = 0; - trkVert_cos_T = 0; - trkVert_del_Z = 0; - trkVert_x = 0; - trkVert_y = 0; - trkVert_z = 0; - trkVert_openingAngle = 0; - trkVert_parentPt = 0; - trkVert_delIndexPt = 0; - trkVert_isReal = 0; - trkVert_score = 0; - trk_pt = 0; - trk_eta = 0; - trk_phi = 0; - trk_d0 = 0; - trk_rinv = 0; - trk_z0 = 0; - trk_chi2 = 0; - trk_chi2rphi = 0; - trk_chi2rz = 0; - trk_bendchi2 = 0; - trk_nstub = 0; - trk_lhits = 0; - trk_dhits = 0; - trk_seed = 0; - trk_hitpattern = 0; - trk_phiSector = 0; - trk_genuine = 0; - trk_loose = 0; - trk_unknown = 0; - trk_combinatoric = 0; - trkExt_fake = 0; - trk_MVA1 = 0; - trk_MVA2 = 0; - trk_matchtp_pdgid = 0; - trk_matchtp_isHToMu = 0; - trk_matchtp_isHToB = 0; - trk_matchtp_pt = 0; - trk_matchtp_eta = 0; - trk_matchtp_phi = 0; - trk_matchtp_z0 = 0; - trk_matchtp_dxy = 0; - trk_matchtp_d0 = 0; - trk_matchtp_x = 0; - trk_matchtp_y = 0; - trk_matchtp_z = 0; - tp_pt = 0; - tp_eta = 0; - tp_phi = 0; - tp_dxy = 0; - tp_d0 = 0; - tp_z0 = 0; - tp_x = 0; - tp_y = 0; - tp_z = 0; - tp_d0_prod = 0; - tp_z0_prod = 0; - tp_pdgid = 0; - tp_isHToMu = 0; - tp_isHToB = 0; - tp_nmatch = 0; - tp_nstub = 0; - tp_eventid = 0; - tp_charge = 0; - matchtrk_pt = 0; - matchtrk_eta = 0; - matchtrk_phi = 0; - matchtrk_z0 = 0; - matchtrk_d0 = 0; - matchtrk_rinv = 0; - matchtrk_chi2 = 0; - matchtrk_chi2rphi = 0; - matchtrk_chi2rz = 0; - matchtrk_bendchi2 = 0; - matchtrk_MVA1 = 0; - matchtrk_MVA2 = 0; - matchtrk_nstub = 0; - matchtrk_lhits = 0; - matchtrk_dhits = 0; - matchtrk_seed = 0; - matchtrk_hitpattern = 0; - - //tree->SetMakeClass(1); - tree->SetBranchAddress("dv_firstIndexTrk", &trkVert_firstIndexTrk, &b_trkVert_firstIndexTrk); - tree->SetBranchAddress("dv_secondIndexTrk", &trkVert_secondIndexTrk, &b_trkVert_secondIndexTrk); - tree->SetBranchAddress("dv_firstIndexPt", &trkVert_firstIndexPt, &b_trkVert_firstIndexPt); - tree->SetBranchAddress("dv_secondIndexPt", &trkVert_secondIndexPt, &b_trkVert_secondIndexPt); - tree->SetBranchAddress("dv_inTraj", &trkVert_inTraj, &b_trkVert_inTraj); - tree->SetBranchAddress("dv_d_T", &trkVert_d_T, &b_trkVert_d_T); - tree->SetBranchAddress("dv_R_T", &trkVert_R_T, &b_trkVert_R_T); - tree->SetBranchAddress("dv_cos_T", &trkVert_cos_T, &b_trkVert_cos_T); - tree->SetBranchAddress("dv_del_Z", &trkVert_del_Z, &b_trkVert_del_Z); - tree->SetBranchAddress("dv_x", &trkVert_x, &b_trkVert_x); - tree->SetBranchAddress("dv_y", &trkVert_y, &b_trkVert_y); - tree->SetBranchAddress("dv_z", &trkVert_z, &b_trkVert_z); - tree->SetBranchAddress("dv_openingAngle", &trkVert_openingAngle, &b_trkVert_openingAngle); - tree->SetBranchAddress("dv_parentPt", &trkVert_parentPt, &b_trkVert_parentPt); - tree->SetBranchAddress("dv_delIndexPt", &trkVert_delIndexPt, &b_trkVert_delIndexPt); - tree->SetBranchAddress("dv_isReal", &trkVert_isReal, &b_trkVert_isReal); - tree->SetBranchAddress("dv_score", &trkVert_score, &b_trkVert_score); - tree->SetBranchAddress("trkExt_pt", &trk_pt, &b_trk_pt); - tree->SetBranchAddress("trkExt_eta", &trk_eta, &b_trk_eta); - tree->SetBranchAddress("trkExt_phi", &trk_phi, &b_trk_phi); - tree->SetBranchAddress("trkExt_d0", &trk_d0, &b_trk_d0); - tree->SetBranchAddress("trkExt_rinv", &trk_rinv, &b_trk_rinv); - tree->SetBranchAddress("trkExt_z0", &trk_z0, &b_trk_z0); - tree->SetBranchAddress("trkExt_chi2", &trk_chi2, &b_trk_chi2); - tree->SetBranchAddress("trkExt_chi2rphi", &trk_chi2rphi, &b_trk_chi2rphi); - tree->SetBranchAddress("trkExt_chi2rz", &trk_chi2rz, &b_trk_chi2rz); - tree->SetBranchAddress("trkExt_bendchi2", &trk_bendchi2, &b_trk_bendchi2); - tree->SetBranchAddress("trkExt_nstub", &trk_nstub, &b_trk_nstub); - tree->SetBranchAddress("trkExt_lhits", &trk_lhits, &b_trk_lhits); - tree->SetBranchAddress("trkExt_dhits", &trk_dhits, &b_trk_dhits); - tree->SetBranchAddress("trkExt_seed", &trk_seed, &b_trk_seed); - tree->SetBranchAddress("trkExt_hitpattern", &trk_hitpattern, &b_trk_hitpattern); - tree->SetBranchAddress("trkExt_phiSector", &trk_phiSector, &b_trk_phiSector); - tree->SetBranchAddress("trkExt_genuine", &trk_genuine, &b_trk_genuine); - tree->SetBranchAddress("trkExt_loose", &trk_loose, &b_trk_loose); - tree->SetBranchAddress("trkExt_unknown", &trk_unknown, &b_trk_unknown); - tree->SetBranchAddress("trkExt_combinatoric", &trk_combinatoric, &b_trk_combinatoric); - tree->SetBranchAddress("trkExt_fake", &trkExt_fake, &b_trkExt_fake); - tree->SetBranchAddress("trkExt_MVA", &trk_MVA1, &b_trk_MVA1); - tree->SetBranchAddress("trkExt_MVA2", &trk_MVA2, &b_trk_MVA2); - tree->SetBranchAddress("trkExt_matchtp_pdgid", &trk_matchtp_pdgid, &b_trk_matchtp_pdgid); - tree->SetBranchAddress("trkExt_matchtp_isHToMu", &trk_matchtp_isHToMu, &b_trk_matchtp_isHToMu); - tree->SetBranchAddress("trkExt_matchtp_isHToB", &trk_matchtp_isHToB, &b_trk_matchtp_isHToB); - tree->SetBranchAddress("trkExt_matchtp_pt", &trk_matchtp_pt, &b_trk_matchtp_pt); - tree->SetBranchAddress("trkExt_matchtp_eta", &trk_matchtp_eta, &b_trk_matchtp_eta); - tree->SetBranchAddress("trkExt_matchtp_phi", &trk_matchtp_phi, &b_trk_matchtp_phi); - tree->SetBranchAddress("trkExt_matchtp_z0", &trk_matchtp_z0, &b_trk_matchtp_z0); - tree->SetBranchAddress("trkExt_matchtp_dxy", &trk_matchtp_dxy, &b_trk_matchtp_dxy); - tree->SetBranchAddress("trkExt_matchtp_d0", &trk_matchtp_d0, &b_trk_matchtp_d0); - tree->SetBranchAddress("trkExt_matchtp_x", &trk_matchtp_x, &b_trk_matchtp_x); - tree->SetBranchAddress("trkExt_matchtp_y", &trk_matchtp_y, &b_trk_matchtp_y); - tree->SetBranchAddress("trkExt_matchtp_z", &trk_matchtp_z, &b_trk_matchtp_z); - tree->SetBranchAddress("tp_pt", &tp_pt, &b_tp_pt); - tree->SetBranchAddress("tp_eta", &tp_eta, &b_tp_eta); - tree->SetBranchAddress("tp_phi", &tp_phi, &b_tp_phi); - tree->SetBranchAddress("tp_dxy", &tp_dxy, &b_tp_dxy); - tree->SetBranchAddress("tp_d0", &tp_d0, &b_tp_d0); - tree->SetBranchAddress("tp_z0", &tp_z0, &b_tp_z0); - tree->SetBranchAddress("tp_x", &tp_x, &b_tp_x); - tree->SetBranchAddress("tp_y", &tp_y, &b_tp_y); - tree->SetBranchAddress("tp_z", &tp_z, &b_tp_z); - tree->SetBranchAddress("tp_d0_prod", &tp_d0_prod, &b_tp_d0_prod); - tree->SetBranchAddress("tp_z0_prod", &tp_z0_prod, &b_tp_z0_prod); - tree->SetBranchAddress("tp_pdgid", &tp_pdgid, &b_tp_pdgid); - tree->SetBranchAddress("tp_isHToMu", &tp_isHToMu, &b_tp_isHToMu); - tree->SetBranchAddress("tp_isHToB", &tp_isHToB, &b_tp_isHToB); - tree->SetBranchAddress("tp_nmatch", &tp_nmatch, &b_tp_nmatch); - tree->SetBranchAddress("tp_nstub", &tp_nstub, &b_tp_nstub); - tree->SetBranchAddress("tp_eventid", &tp_eventid, &b_tp_eventid); - tree->SetBranchAddress("tp_charge", &tp_charge, &b_tp_charge); - tree->SetBranchAddress("matchtrkExt_pt", &matchtrk_pt, &b_matchtrk_pt); - tree->SetBranchAddress("matchtrkExt_eta", &matchtrk_eta, &b_matchtrk_eta); - tree->SetBranchAddress("matchtrkExt_phi", &matchtrk_phi, &b_matchtrk_phi); - tree->SetBranchAddress("matchtrkExt_z0", &matchtrk_z0, &b_matchtrk_z0); - tree->SetBranchAddress("matchtrkExt_d0", &matchtrk_d0, &b_matchtrk_d0); - tree->SetBranchAddress("matchtrkExt_rinv", &matchtrk_rinv, &b_matchtrk_rinv); - tree->SetBranchAddress("matchtrkExt_chi2", &matchtrk_chi2, &b_matchtrk_chi2); - tree->SetBranchAddress("matchtrkExt_chi2rphi", &matchtrk_chi2rphi, &b_matchtrk_chi2rphi); - tree->SetBranchAddress("matchtrkExt_chi2rz", &matchtrk_chi2rz, &b_matchtrk_chi2rz); - tree->SetBranchAddress("matchtrkExt_bendchi2", &matchtrk_bendchi2, &b_matchtrk_bendchi2); - tree->SetBranchAddress("matchtrkExt_MVA", &matchtrk_MVA1, &b_matchtrk_MVA1); - tree->SetBranchAddress("matchtrkExt_MVA2", &matchtrk_MVA2, &b_matchtrk_MVA2); - tree->SetBranchAddress("matchtrkExt_nstub", &matchtrk_nstub, &b_matchtrk_nstub); - tree->SetBranchAddress("matchtrkExt_lhits", &matchtrk_lhits, &b_matchtrk_lhits); - tree->SetBranchAddress("matchtrkExt_dhits", &matchtrk_dhits, &b_matchtrk_dhits); - tree->SetBranchAddress("matchtrkExt_seed", &matchtrk_seed, &b_matchtrk_seed); - tree->SetBranchAddress("matchtrkExt_hitpattern", &matchtrk_hitpattern, &b_matchtrk_hitpattern); - - //preselection cuts and plots definitions - // Cut assumptions: first cut is maxEta - std::vector> preselCuts; - std::unique_ptr> cut0(new TypedCut("maxEta","max #eta",&trk_eta,2.4,true)); - preselCuts.push_back(std::move(cut0)); - std::unique_ptr> cut1(new TypedCut("maxChi2rzdof","max #chi^{2}_{rz}",&trk_chi2rz,3.0,false)); - preselCuts.push_back(std::move(cut1)); - std::unique_ptr> cut3(new TypedCut("minMVA2","min MVA2",&trk_MVA2,0.2,false)); - preselCuts.push_back(std::move(cut3)); - std::unique_ptr> cut4(new TypedCut("minMVA1","min MVA1",&trk_MVA1,0.2,false)); - preselCuts.push_back(std::move(cut4)); - std::unique_ptr> cut5(new TypedCut("minMVA1_D","min MVA1 D",&trk_MVA1,0.5,false)); - preselCuts.push_back(std::move(cut5)); - std::unique_ptr> cut6(new TypedCut("minNumStub_overlap","Quality",&trk_nstub,5,true)); - preselCuts.push_back(std::move(cut6)); - std::unique_ptr> cut7(new TypedCut("minPt","min p_{T}",&trk_pt,3.0,true)); - preselCuts.push_back(std::move(cut7)); - std::unique_ptr> cut8(new TypedCut("minD0_barrel","min d_{0} Bar",&trk_d0,0.06,false)); - preselCuts.push_back(std::move(cut8)); - std::unique_ptr> cut9(new TypedCut("minD0_disk","min d_{0}",&trk_d0,0.08,true)); - preselCuts.push_back(std::move(cut9)); - - std::vector> preselCutsTP; - std::unique_ptr> tpCut0(new TypedCut("maxEta","max #eta",&tp_eta,2.4,true)); - preselCutsTP.push_back(std::move(tpCut0)); - std::unique_ptr> tpCut1(new TypedCut("minPt","min p_{T}",&tp_pt,3.0,true)); - preselCutsTP.push_back(std::move(tpCut1)); - std::unique_ptr> tpCut2(new TypedCut("minD0_barrel","min d_{0} Barrel",&tp_d0,0.06,true)); - preselCutsTP.push_back(std::move(tpCut2)); - std::unique_ptr> tpCut3(new TypedCut("minD0_disk","min d_{0} Disk",&tp_d0,0.08,true)); - preselCutsTP.push_back(std::move(tpCut3)); - - std::vector> varCutFlows; - std::unique_ptr> plot0(new TypedPlot("d0","cm",&trk_d0,20,logspace(0.01,10.0,20))); - varCutFlows.push_back(std::move(plot0)); - std::unique_ptr> plot1(new TypedPlot("pt","GeV",&trk_pt,20,logspace(2.0,100.0,20))); - varCutFlows.push_back(std::move(plot1)); - std::unique_ptr> plot2(new TypedPlot("eta","",&trk_eta,50,-2.5,2.5)); - varCutFlows.push_back(std::move(plot2)); - std::unique_ptr> plot3(new TypedPlot("z0","cm",&trk_z0,100,-20.0,20.0)); - varCutFlows.push_back(std::move(plot3)); - std::unique_ptr> plot4(new TypedPlot("phi","",&trk_phi,100,-2*TMath::Pi(),2*TMath::Pi())); - varCutFlows.push_back(std::move(plot4)); - std::unique_ptr> plot6(new TypedPlot("MVA1","",&trk_MVA1,100,0.0,1.0)); - varCutFlows.push_back(std::move(plot6)); - std::unique_ptr> plot7(new TypedPlot("MVA2","",&trk_MVA2,100,0.0,1.0)); - varCutFlows.push_back(std::move(plot7)); - std::unique_ptr> plot8(new TypedPlot("chi2rphidof","",&trk_chi2rphi,100,0.0,6.0)); - varCutFlows.push_back(std::move(plot8)); - std::unique_ptr> plot9(new TypedPlot("chi2rzdof","",&trk_chi2rz,100,0.0,6.0)); - varCutFlows.push_back(std::move(plot9)); - std::unique_ptr> plot10(new TypedPlot("bendchi2","",&trk_bendchi2,100,0.0,10.0)); - varCutFlows.push_back(std::move(plot10)); - - std::vector> varCutFlowsTP; - std::unique_ptr> tpPlot0(new TypedPlot("d0","cm",&tp_d0,20,logspace(0.01,10.0,20))); - varCutFlowsTP.push_back(std::move(tpPlot0)); - std::unique_ptr> tpPlot1(new TypedPlot("pt","GeV",&tp_pt,20,logspace(2.0,100.0,20))); - varCutFlowsTP.push_back(std::move(tpPlot1)); - std::unique_ptr> tpPlot2(new TypedPlot("eta","",&tp_eta,50,-2.5,2.5)); - varCutFlowsTP.push_back(std::move(tpPlot2)); - std::unique_ptr> tpPlot3(new TypedPlot("z0","cm",&tp_z0,100,-20.0,20.0)); - varCutFlowsTP.push_back(std::move(tpPlot3)); - std::unique_ptr> tpPlot4(new TypedPlot("phi","",&tp_phi,100,-2*TMath::Pi(),2*TMath::Pi())); - varCutFlowsTP.push_back(std::move(tpPlot4)); - std::unique_ptr> tpPlot6(new TypedPlot("dxy","cm",&tp_dxy,50,-2.0,2.0)); - varCutFlowsTP.push_back(std::move(tpPlot6)); - - std::vector,std::unique_ptr > > varCutFlows2D; - std::unique_ptr> plot0X(new TypedPlot("d0","cm",&trk_d0,200,-2.0,2.0)); - std::unique_ptr> plot0Y(new TypedPlot("pt","GeV",&trk_pt,200,0.0,30.0)); - varCutFlows2D.push_back({std::move(plot0X),std::move(plot0Y)}); - std::unique_ptr> plot1X(new TypedPlot("eta","",&trk_eta,200,-2.4,2.4)); - std::unique_ptr> plot1Y(new TypedPlot("pt","GeV",&trk_pt,200,0.0,30.0)); - varCutFlows2D.push_back({std::move(plot1X),std::move(plot1Y)}); - std::unique_ptr> plot2X(new TypedPlot("d0","cm",&trk_d0,200,-2.0,2.0)); - std::unique_ptr> plot2Y(new TypedPlot("eta","",&trk_eta,200,-2.4,2.4)); - varCutFlows2D.push_back({std::move(plot2X),std::move(plot2Y)}); - std::unique_ptr> plot3X(new TypedPlot("eta","",&trk_eta,200,-2.4,2.4)); - std::unique_ptr> plot3Y(new TypedPlot("nstub","",&trk_nstub,7,0.0,7.0)); - varCutFlows2D.push_back({std::move(plot3X),std::move(plot3Y)}); - - std::vector,std::unique_ptr > > varCutFlowsTP2D; - std::unique_ptr> tpPlot0X(new TypedPlot("d0","cm",&tp_d0,200,-2.0,2.0)); - std::unique_ptr> tpPlot0Y(new TypedPlot("pt","GeV",&tp_pt,200,0.0,30.0)); - varCutFlowsTP2D.push_back({std::move(tpPlot0X),std::move(tpPlot0Y)}); - std::unique_ptr> tpPlot1X(new TypedPlot("eta","",&tp_eta,200,-2.4,2.4)); - std::unique_ptr> tpPlot1Y(new TypedPlot("pt","GeV",&tp_pt,200,0.0,30.0)); - varCutFlowsTP2D.push_back({std::move(tpPlot1X),std::move(tpPlot1Y)}); - std::unique_ptr> tpPlot2X(new TypedPlot("d0","cm",&tp_d0,200,-2.0,2.0)); - std::unique_ptr> tpPlot2Y(new TypedPlot("eta","",&tp_eta,200,-2.4,2.4)); - varCutFlowsTP2D.push_back({std::move(tpPlot2X),std::move(tpPlot2Y)}); - std::unique_ptr> tpPlot3X(new TypedPlot("eta","",&tp_eta,200,-2.4,2.4)); - std::unique_ptr> tpPlot3Y(new TypedPlot("nstub","",&tp_nstub,7,0.0,7.0)); - varCutFlowsTP2D.push_back({std::move(tpPlot3X),std::move(tpPlot3Y)}); - - //std::vector trackType = {"primary","np","fake","PU","notHiggs"}; - std::vector trackType = {"primary","np"}; - //std::vector tpType = {"primary","np","PU","notHiggs","match",""}; - std::vector tpType = {"primary","np","match",""}; - std::vector plotModifiers = {"","_H","_L","_P","_D","_barrel","_disk"}; - if(!detailedPlots) plotModifiers = {""}; - uint preselCutsSize = 0; - for(uint i=0; igetDoPlot()) preselCutsSize++; - } - TH1F* preselCutFlows[varCutFlows.size()][trackType.size()][preselCutsSize][plotModifiers.size()]; - TH2F* preselCutFlows2D[varCutFlows2D.size()][trackType.size()][preselCutsSize][plotModifiers.size()]; - TH1F* preselCutFlowsTP[varCutFlowsTP.size()][tpType.size()][preselCutsTP.size()][plotModifiers.size()]; - TH2F* preselCutFlowsTP2D[varCutFlowsTP2D.size()][tpType.size()][preselCutsTP.size()][plotModifiers.size()]; - //std::map numPartCutFlows[trackType.size()][preselCuts.size()]; - //std::map numPartCutFlowsTP[tpType.size()][preselCutsTP.size()]; - - for(uint it=0; itgetDoPlot()){ - i_plot++; - } - else{ - continue; - } - for(uint j=0; jgetVarName()+"_"+trackType[i]+"_"+preselCuts[jt]->getCutName()+"Cut"+plotModifiers[j]; - //std::cout<<"name: "<getBool()){ - //std::cout<<"setting bins"<getVarName()+" ("+varCutFlows[it]->getUnit()+") ; Events "; - std::vector bins = varCutFlows[it]->getBins(); - TH1F* hist = new TH1F(name,labels,varCutFlows[it]->getNumBins(),bins.data()); - preselCutFlows[it][i][i_plot][j] = hist; - TString varString = varCutFlows[it]->getVarName(); - if(varString.Contains("d0") || varString.Contains("pt")){ - //std::cout<<"labels: "<GetNbinsX()+1); ibin++){ - binValues+=to_string(preselCutFlows[it][i][i_plot][j]->GetBinContent(ibin)) + ", "; - binWidths+=to_string(preselCutFlows[it][i][i_plot][j]->GetBinWidth(ibin)) + ", "; - - } - binValues+="]"; - binWidths+="]"; - - //std::cout<<"binValues: "<getMaxBin() - varCutFlows[it]->getMinBin()) / varCutFlows[it]->getNumBins(); - TString binLabel = std::to_string(binWidth); - TString labels = name+"; Track "+varCutFlows[it]->getVarName()+" ("+varCutFlows[it]->getUnit()+") ; Events / "+binLabel+" "+varCutFlows[it]->getUnit(); - TH1F* hist = new TH1F(name,labels,varCutFlows[it]->getNumBins(),varCutFlows[it]->getMinBin(),varCutFlows[it]->getMaxBin()); - preselCutFlows[it][i][i_plot][j] = hist; - } - } - } - } - } - - for(uint it=0; itgetDoPlot()){ - i_plot++; - } - else{ - continue; - } - for(uint j=0; jgetVarName()+"_vs_"+varCutFlows2D[it].first->getVarName()+"_"+trackType[i]+"_"+preselCuts[jt]->getCutName()+"Cut"+plotModifiers[j]; - TString labels = name+"; Track "+varCutFlows2D[it].first->getVarName()+" ("+varCutFlows2D[it].first->getUnit()+") ; Track "+varCutFlows2D[it].second->getVarName()+" ("+varCutFlows2D[it].second->getUnit()+")"; - TH2F* hist = new TH2F(name,labels,varCutFlows2D[it].first->getNumBins(),varCutFlows2D[it].first->getMinBin(),varCutFlows2D[it].first->getMaxBin(),varCutFlows2D[it].second->getNumBins(),varCutFlows2D[it].second->getMinBin(),varCutFlows2D[it].second->getMaxBin()); - preselCutFlows2D[it][i][i_plot][j] = hist; - } - } - } - } - - for(uint it=0; itgetVarName()+"_"+tpType[i]+"_"+preselCutsTP[jt]->getCutName()+"Cut"+plotModifiers[j]; - if(varCutFlowsTP[it]->getMaxBin()==varCutFlowsTP[it]->getMinBin()){ - TString labels = name+"; Tp "+varCutFlowsTP[it]->getVarName()+" ("+varCutFlowsTP[it]->getUnit()+") ; Events "; - std::vector bins = varCutFlowsTP[it]->getBins(); - TH1F* hist = new TH1F(name,labels,varCutFlowsTP[it]->getNumBins(),bins.data()); - preselCutFlowsTP[it][i][jt][j] = hist; - } - else{ - float binWidth = (varCutFlowsTP[it]->getMaxBin() - varCutFlowsTP[it]->getMinBin()) / varCutFlowsTP[it]->getNumBins(); - TString binLabel = std::to_string(binWidth); - TString labels = name+"; Tp "+varCutFlowsTP[it]->getVarName()+" ("+varCutFlowsTP[it]->getUnit()+") ; Events / "+binLabel+" "+varCutFlowsTP[it]->getUnit(); - TH1F* hist = new TH1F(name,labels,varCutFlowsTP[it]->getNumBins(),varCutFlowsTP[it]->getMinBin(),varCutFlowsTP[it]->getMaxBin()); - preselCutFlowsTP[it][i][jt][j] = hist; - } - } - } - } - } - - for(uint it=0; itgetVarName()+"_vs_"+varCutFlowsTP2D[it].first->getVarName()+"_"+tpType[i]+"_"+preselCutsTP[jt]->getCutName()+"Cut"+plotModifiers[j]; - TString labels = name+"; Tp "+varCutFlowsTP2D[it].first->getVarName()+" ("+varCutFlowsTP2D[it].first->getUnit()+") ; Tp "+varCutFlowsTP2D[it].second->getVarName()+" ("+varCutFlowsTP2D[it].second->getUnit()+")"; - TH2F* hist = new TH2F(name,labels,varCutFlowsTP2D[it].first->getNumBins(),varCutFlowsTP2D[it].first->getMinBin(),varCutFlowsTP2D[it].first->getMaxBin(),varCutFlowsTP2D[it].second->getNumBins(),varCutFlowsTP2D[it].second->getMinBin(),varCutFlowsTP2D[it].second->getMaxBin()); - preselCutFlowsTP2D[it][i][jt][j] = hist; - } - } - } - } - - //vertex cuts and plots definitions - std::vector> vertCuts; - std::unique_ptr> vertCut0(new TypedCut("minR_T_Res","min R_{T} #sigma_{d0}",&trkVert_R_T,d0_res,true)); - vertCuts.push_back(std::move(vertCut0)); - std::unique_ptr> vertCut1(new TypedCut("maxR_T","max R_{T}",&trkVert_R_T,20.0,true)); - vertCuts.push_back(std::move(vertCut1)); - std::unique_ptr> vertCut2(new TypedCut("max_trk_sumCharge","max #Sigma q",&trk_rinv,0,true)); - vertCuts.push_back(std::move(vertCut2)); - std::unique_ptr> vertCut3(new TypedCut("min_trk_sumCharge","min #Sigma q",&trk_rinv,0,true)); - vertCuts.push_back(std::move(vertCut3)); -#if 0 - std::unique_ptr> vertCut4(new TypedCut("max_trk_sumBendChi2","max #Sigma #chi^{2}_{bend}",&trk_bendchi2,14.0,true)); - vertCuts.push_back(std::move(vertCut4)); - std::unique_ptr> vertCut5(new TypedCut("minCos_T","min cos_{T}",&trkVert_cos_T,0.96,true)); - vertCuts.push_back(std::move(vertCut5)); - std::unique_ptr> vertCut6(new TypedCut("max_trk_deltaEta","max #Delta #eta",&trk_eta,2.0,true)); - vertCuts.push_back(std::move(vertCut6)); - std::unique_ptr> vertCut7(new TypedCut("max_delZ","max #Delta z",&trkVert_del_Z,0.5,true)); - vertCuts.push_back(std::move(vertCut7)); - std::unique_ptr> vertCut8(new TypedCut("minR_T","min R_{T}",&trkVert_R_T,0.25,true)); - vertCuts.push_back(std::move(vertCut8)); - std::unique_ptr> vertCut9(new TypedCut("min_trk_highPt","min lead p_{T}",&trk_pt,13.0,true)); - vertCuts.push_back(std::move(vertCut9)); - std::unique_ptr> vertCut10(new TypedCut("max_trk_sumChi2rphidof","max #Sigma #chi^{2}_{r#phi}",&trk_chi2rphi,6.0,true)); - vertCuts.push_back(std::move(vertCut10)); - std::unique_ptr> vertCut11(new TypedCut("min_trk_sumNumStubs","min #Sigma n_{stub}",&trk_nstub,11,true)); - vertCuts.push_back(std::move(vertCut11)); - std::unique_ptr> vertCut12(new TypedCut("min_trk_highD0","min d_{0}",&trk_d0,0.3,true)); - vertCuts.push_back(std::move(vertCut12)); -#endif - std::unique_ptr> vertCut4(new TypedCut("min_score0p8","score>0.8",&trkVert_score,0.8,true)); - vertCuts.push_back(std::move(vertCut4)); - std::unique_ptr> vertCut5(new TypedCut("min_score0p9","score>0.9",&trkVert_score,0.9,true)); - vertCuts.push_back(std::move(vertCut5)); - std::unique_ptr> vertCut6(new TypedCut("min_score0p95","score>0.95",&trkVert_score,0.95,true)); - vertCuts.push_back(std::move(vertCut6)); - std::unique_ptr> vertCut7(new TypedCut("min_score0p96","score>0.96",&trkVert_score,0.96,true)); - vertCuts.push_back(std::move(vertCut7)); - std::unique_ptr> vertCut8(new TypedCut("min_score0p97","score>0.97",&trkVert_score,0.97,true)); - vertCuts.push_back(std::move(vertCut8)); - std::unique_ptr> vertCut9(new TypedCut("min_score0p98","score>0.98",&trkVert_score,0.98,true)); - vertCuts.push_back(std::move(vertCut9)); - std::unique_ptr> vertCut10(new TypedCut("min_score0p99","score>0.99",&trkVert_score,0.99,true)); - vertCuts.push_back(std::move(vertCut10)); - std::unique_ptr> vertCut11(new TypedCut("min_score0p992","score>0.992",&trkVert_score,0.992,true)); - vertCuts.push_back(std::move(vertCut11)); - std::unique_ptr> vertCut12(new TypedCut("min_score0p994","score>0.994",&trkVert_score,0.994,true)); - vertCuts.push_back(std::move(vertCut12)); - std::unique_ptr> vertCut13(new TypedCut("min_score0p996","score>0.996",&trkVert_score,0.996,true)); - vertCuts.push_back(std::move(vertCut13)); - std::unique_ptr> vertCut14(new TypedCut("min_score0p998","score>0.998",&trkVert_score,0.998,true)); - vertCuts.push_back(std::move(vertCut14)); - - std::vector> vertCutFlows; - std::unique_ptr> vertPlot0(new TypedPlot("x","cm",&trkVert_x,100,-5.0,5.0)); - vertCutFlows.push_back(std::move(vertPlot0)); - std::unique_ptr> vertPlot1(new TypedPlot("y","cm",&trkVert_y,100,-5.0,5.0)); - vertCutFlows.push_back(std::move(vertPlot1)); - std::unique_ptr> vertPlot2(new TypedPlot("z","cm",&trkVert_z,100,-50.0,50.0)); - vertCutFlows.push_back(std::move(vertPlot2)); - std::unique_ptr> vertPlot3(new TypedPlot("firstIndexPt","",&trkVert_firstIndexPt,50,0.0,50.0)); - vertCutFlows.push_back(std::move(vertPlot3)); - std::unique_ptr> vertPlot4(new TypedPlot("secondIndexPt","",&trkVert_secondIndexPt,50,0.0,50.0)); - vertCutFlows.push_back(std::move(vertPlot4)); - std::unique_ptr> vertPlot5(new TypedPlot("cos_T","",&trkVert_cos_T,40,-1.0,1.0)); - vertCutFlows.push_back(std::move(vertPlot5)); - std::unique_ptr> vertPlot6(new TypedPlot("openingAngle","",&trkVert_openingAngle,40,-3.14,3.14)); - vertCutFlows.push_back(std::move(vertPlot6)); - std::unique_ptr> vertPlot7(new TypedPlot("parentPt","GeV",&trkVert_parentPt,200,0.0,200.0)); - vertCutFlows.push_back(std::move(vertPlot7)); - std::unique_ptr> vertPlot8(new TypedPlot("d_T","cm",&trkVert_d_T,40,0.0,1.0)); - vertCutFlows.push_back(std::move(vertPlot8)); - std::unique_ptr> vertPlot9(new TypedPlot("R_T","cm",&trkVert_R_T,20,logspace(0.1,20.0,20))); - vertCutFlows.push_back(std::move(vertPlot9)); - std::unique_ptr> vertPlot10(new TypedPlot("highPt","GeV",&trk_pt,20,logspace(2.0,100.0,20))); - vertCutFlows.push_back(std::move(vertPlot10)); - std::unique_ptr> vertPlot11(new TypedPlot("lowPt","GeV",&trk_pt,100,0.0,100.0)); - vertCutFlows.push_back(std::move(vertPlot11)); - std::unique_ptr> vertPlot12(new TypedPlot("highD0","cm",&trk_d0,80,-2.0,2.0)); - vertCutFlows.push_back(std::move(vertPlot12)); - std::unique_ptr> vertPlot13(new TypedPlot("lowD0","cm",&trk_d0,80,-2.0,2.0)); - vertCutFlows.push_back(std::move(vertPlot13)); - std::unique_ptr> vertPlot14(new TypedPlot("delZ","cm",&trkVert_del_Z,100,0.0,1.5)); - vertCutFlows.push_back(std::move(vertPlot14)); - std::unique_ptr> vertPlot15(new TypedPlot("deltaZ0","cm",&trk_z0,100,0.0,10.0)); - vertCutFlows.push_back(std::move(vertPlot15)); - std::unique_ptr> vertPlot16(new TypedPlot("deltaEta","",&trk_eta,100,0.0,2.4)); - vertCutFlows.push_back(std::move(vertPlot16)); - std::unique_ptr> vertPlot17(new TypedPlot("deltaD0","cm",&trk_d0,100,0.0,10.0)); - vertCutFlows.push_back(std::move(vertPlot17)); - std::unique_ptr> vertPlot18(new TypedPlot("deltaPhi","",&trk_phi,100,0.0,6.3)); - vertCutFlows.push_back(std::move(vertPlot18)); - std::unique_ptr> vertPlot19(new TypedPlot("delIndexPt","",&trkVert_delIndexPt,20,0.0,20.0)); - vertCutFlows.push_back(std::move(vertPlot19)); - std::unique_ptr> vertPlot20(new TypedPlot("sumNumStubs","",&trk_nstub,12,0.0,12.0)); - vertCutFlows.push_back(std::move(vertPlot20)); - std::unique_ptr> vertPlot21(new TypedPlot("sumChi2rphidof","",&trk_chi2rphi,200,0.0,8.0)); - vertCutFlows.push_back(std::move(vertPlot21)); - std::unique_ptr> vertPlot22(new TypedPlot("sumChi2rzdof","",&trk_chi2rz,200,0.0,3.0)); - vertCutFlows.push_back(std::move(vertPlot22)); - std::unique_ptr> vertPlot23(new TypedPlot("sumBendChi2","",&trk_bendchi2,200,0.0,14.0)); - vertCutFlows.push_back(std::move(vertPlot23)); - std::unique_ptr> vertPlot24(new TypedPlot("sumMVA1","",&trk_MVA1,100,0.0,2.0)); - vertCutFlows.push_back(std::move(vertPlot24)); - std::unique_ptr> vertPlot25(new TypedPlot("sumMVA2","",&trk_MVA2,100,0.0,2.0)); - vertCutFlows.push_back(std::move(vertPlot25)); - std::unique_ptr> vertPlot26(new TypedPlot("leadEta","",&trk_eta,50,-2.4,2.4)); - vertCutFlows.push_back(std::move(vertPlot26)); - std::unique_ptr> vertPlot27(new TypedPlot("score","",&trkVert_score,50,0.0,1.0)); - vertCutFlows.push_back(std::move(vertPlot27)); - - std::vector> vertCutFlowsTP; - std::unique_ptr> vertPlotTP0(new TypedPlot("x","cm",&tpVert_x,100,-5.0,5.0)); - vertCutFlowsTP.push_back(std::move(vertPlotTP0)); - std::unique_ptr> vertPlotTP1(new TypedPlot("y","cm",&tpVert_y,100,-5.0,5.0)); - vertCutFlowsTP.push_back(std::move(vertPlotTP1)); - std::unique_ptr> vertPlotTP2(new TypedPlot("z","cm",&tpVert_z,100,-50.0,50.0)); - vertCutFlowsTP.push_back(std::move(vertPlotTP2)); - std::unique_ptr> vertPlotTP4(new TypedPlot("cos_T","",&tpVert_cos_T,40,-1.0,1.0)); - vertCutFlowsTP.push_back(std::move(vertPlotTP4)); - std::unique_ptr> vertPlotTP5(new TypedPlot("openingAngle","",&tpVert_openingAngle,40,-3.14,3.14)); - vertCutFlowsTP.push_back(std::move(vertPlotTP5)); - std::unique_ptr> vertPlotTP6(new TypedPlot("parentPt","GeV",&tpVert_parentPt,200,0.0,200.0)); - vertCutFlowsTP.push_back(std::move(vertPlotTP6)); - std::unique_ptr> vertPlotTP7(new TypedPlot("d_T","cm",&tpVert_d_T,40,0.0,0.2)); - vertCutFlowsTP.push_back(std::move(vertPlotTP7)); - std::unique_ptr> vertPlotTP8(new TypedPlot("R_T","cm",&tpVert_R_T,20,logspace(0.1,20.0,20))); - vertCutFlowsTP.push_back(std::move(vertPlotTP8)); - std::unique_ptr> vertPlotTP9(new TypedPlot("highPt","GeV",&tp_pt,20,logspace(2.0,100.0,20))); - vertCutFlowsTP.push_back(std::move(vertPlotTP9)); - std::unique_ptr> vertPlotTP10(new TypedPlot("lowPt","GeV",&tp_pt,100,0.0,100.0)); - vertCutFlowsTP.push_back(std::move(vertPlotTP10)); - std::unique_ptr> vertPlotTP11(new TypedPlot("highD0","cm",&tp_d0,80,-2.0,2.0)); - vertCutFlowsTP.push_back(std::move(vertPlotTP11)); - std::unique_ptr> vertPlotTP12(new TypedPlot("lowD0","cm",&tp_d0,80,-2.0,2.0)); - vertCutFlowsTP.push_back(std::move(vertPlotTP12)); - std::unique_ptr> vertPlotTP13(new TypedPlot("deltaZ0","cm",&tp_z0,100,0.0,10.0)); - vertCutFlowsTP.push_back(std::move(vertPlotTP13)); - std::unique_ptr> vertPlotTP14(new TypedPlot("deltaEta","",&tp_eta,100,0.0,2.4)); - vertCutFlowsTP.push_back(std::move(vertPlotTP14)); - std::unique_ptr> vertPlotTP15(new TypedPlot("deltaD0","cm",&tp_d0,100,0.0,10.0)); - vertCutFlowsTP.push_back(std::move(vertPlotTP15)); - std::unique_ptr> vertPlotTP16(new TypedPlot("deltaPhi","",&tp_phi,100,0.0,6.3)); - vertCutFlowsTP.push_back(std::move(vertPlotTP16)); - std::unique_ptr> vertPlotTP17(new TypedPlot("leadEta","",&tp_eta,50,-2.4,2.4)); - vertCutFlowsTP.push_back(std::move(vertPlotTP17)); - - std::vector vertType = {"matched","unmatched"}; - std::vector vertTypeTP = {"matched","all"}; - std::vector vertPlotTPModifiers = {"","_oneMatch"}; - - TH1F* vertexCutFlows[vertCutFlows.size()][vertType.size()][vertCuts.size()]; - TH1F* vertexCutFlowsMatchTP[vertCutFlowsTP.size()][vertCuts.size()][vertPlotTPModifiers.size()]; - TH1F* vertexCutFlowsTP[vertCutFlowsTP.size()][vertPlotTPModifiers.size()]; - TH1F* vertexNumVertices[vertCuts.size()]; - - for(uint i=0; igetVarName()+"_"+vertType[j]+"_"+vertCuts[k]->getCutName()+"Cut"; - if(vertCutFlows[i]->getMaxBin()==vertCutFlows[i]->getMinBin()){ - TString labels = name+"; Track Vertex "+vertCutFlows[i]->getVarName()+" ("+vertCutFlows[i]->getUnit()+") ; Events "; - std::vector bins = vertCutFlows[i]->getBins(); - TH1F* hist = new TH1F(name,labels,vertCutFlows[i]->getNumBins(),bins.data()); - vertexCutFlows[i][j][k] = hist; - } - else{ - float binWidth = (vertCutFlows[i]->getMaxBin() - vertCutFlows[i]->getMinBin()) / vertCutFlows[i]->getNumBins(); - TString binLabel = std::to_string(binWidth); - TString labels = name+"; Track Vertex "+vertCutFlows[i]->getVarName()+" ("+vertCutFlows[i]->getUnit()+") ; Events / "+binLabel+" "+vertCutFlows[i]->getUnit(); - TH1F* hist = new TH1F(name,labels,vertCutFlows[i]->getNumBins(),vertCutFlows[i]->getMinBin(),vertCutFlows[i]->getMaxBin()); - vertexCutFlows[i][j][k] = hist; - } - } - } - } - - for(uint i=0; igetVarName()+"_"+vertTypeTP[0]+"_"+vertCuts[k]->getCutName()+"Cut"+vertPlotTPModifiers[m]; - if(vertCutFlowsTP[i]->getMaxBin()==vertCutFlowsTP[i]->getMinBin()){ - TString labels = name+"; True Vertex "+vertCutFlowsTP[i]->getVarName()+" ("+vertCutFlowsTP[i]->getUnit()+") ; Events "; - std::vector bins = vertCutFlowsTP[i]->getBins(); - TH1F* hist = new TH1F(name,labels,vertCutFlowsTP[i]->getNumBins(),bins.data()); - vertexCutFlowsMatchTP[i][k][m] = hist; - } - else{ - float binWidth = (vertCutFlowsTP[i]->getMaxBin() - vertCutFlowsTP[i]->getMinBin()) / vertCutFlowsTP[i]->getNumBins(); - TString binLabel = std::to_string(binWidth); - TString labels = name+"; True Vertex "+vertCutFlowsTP[i]->getVarName()+" ("+vertCutFlowsTP[i]->getUnit()+") ; Events / "+binLabel+" "+vertCutFlowsTP[i]->getUnit(); - TH1F* hist = new TH1F(name,labels,vertCutFlowsTP[i]->getNumBins(),vertCutFlowsTP[i]->getMinBin(),vertCutFlowsTP[i]->getMaxBin()); - vertexCutFlowsMatchTP[i][k][m] = hist; - } - } - } - } - - for(uint i=0; igetVarName()+"_"+vertTypeTP[1]+vertPlotTPModifiers[k]; - if(vertCutFlowsTP[i]->getMaxBin()==vertCutFlowsTP[i]->getMinBin()){ - TString labels = name+"; True Vertex "+vertCutFlowsTP[i]->getVarName()+" ("+vertCutFlowsTP[i]->getUnit()+") ; Events "; - std::vector bins = vertCutFlowsTP[i]->getBins(); - TH1F* hist = new TH1F(name,labels,vertCutFlowsTP[i]->getNumBins(),bins.data()); - vertexCutFlowsTP[i][k] = hist; - } - else{ - float binWidth = (vertCutFlowsTP[i]->getMaxBin() - vertCutFlowsTP[i]->getMinBin()) / vertCutFlowsTP[i]->getNumBins(); - TString binLabel = std::to_string(binWidth); - TString labels = name+"; True Vertex "+vertCutFlowsTP[i]->getVarName()+" ("+vertCutFlowsTP[i]->getUnit()+") ; Events / "+binLabel+" "+vertCutFlowsTP[i]->getUnit(); - TH1F* hist = new TH1F(name,labels,vertCutFlowsTP[i]->getNumBins(),vertCutFlowsTP[i]->getMinBin(),vertCutFlowsTP[i]->getMaxBin()); - vertexCutFlowsTP[i][k] = hist; - } - } - } - - for(uint k=0; kgetCutName()+"Cut"; - TString labels = name+"; Number of Track Vertices"+" ; Events / 1.0"; - TH1F* hist = new TH1F(name,labels,40,0,40); - vertexNumVertices[k] = hist; - } - - - TH1F *h_numSelectedTrks = new TH1F("h_numSelectedTrks","h_numSelectedTrks; Number of Selected Tracks; Events / 1.0",100,0,100); - TH1F *h_numSelectedTrks_zoomOut = new TH1F("h_numSelectedTrks_zoomOut","h_numSelectedTrks_zoomOut; Number of Selected Tracks; Events / 10.0",100,0,1000); - TH1F *h_trk_H_T = new TH1F("h_trk_H_T","h_trk_H_T; Event Track Scalar p_{T} Sum [GeV]; Events / 10.0",100,0,1000); - TH1F *h_trk_MET = new TH1F("h_trk_MET","h_trk_MET; Event Track Missing E_{T} [GeV]; Events / 4.0",100,0,400); - TH1F *h_trk_oneMatch_H_T = new TH1F("h_trk_oneMatch_H_T","h_trk_oneMatch_H_T; Event Track Scalar p_{T} Sum [GeV]; Events / 10.0",100,0,1000); - TH1F *h_trk_oneMatch_MET = new TH1F("h_trk_oneMatch_MET","h_trk_oneMatch_MET; Event Track Missing E_{T} [GeV]; Events / 4.0",100,0,400); - TH1F *h_tp_H_T = new TH1F("h_tp_H_T","h_tp_H_T; Event TP Scalar p_{T} Sum [GeV]; Events / 10.0",100,0,1000); - TH1F *h_tp_MET = new TH1F("h_tp_MET","h_tp_MET; Event TP Missing E_{T} [GeV]; Events / 4.0",100,0,400); - TH1F *h_trueVertex_numAllCuts = new TH1F("h_trueVertex_numAllCuts","h_trueVertex_numAllCuts; TP Vertices; Events / 1.0",40,0,40); - TH1F *h_trueVertex_numTPs = new TH1F("h_trueVertex_numTPs","h_trueVertex_numTPs; TPs Associated with Vertex; Events / 1.0",6,0,6); - TH1F *h_trackVertexBranch_numAllCuts = new TH1F("h_trackVertexBranch_numAllCuts","h_trackVertexBranch_numAllCuts; Track Vertices; Events / 1.0",40,0,40); - - // Displaced Vertex Plots - TH1F *h_res_tp_trk_x = new TH1F("h_res_tp_trk_x","h_res_tp_trk_x; x residual of vertex (cm) ; Events / 0.02 cm",100,-1,1); - TH1F *h_res_tp_trk_y = new TH1F("h_res_tp_trk_y","h_res_tp_trk_y; y residual of vertex (cm) ; Events / 0.02 cm",100,-1,1); - TH1F *h_res_tp_trk_x_zoomOut = new TH1F("h_res_tp_trk_x_zoomOut","h_res_tp_trk_x_zoomOut; x residual of vertex (cm) ; Events / 0.04 cm",500,-10,10); - TH1F *h_res_tp_trk_y_zoomOut = new TH1F("h_res_tp_trk_y_zoomOut","h_res_tp_trk_y_zoomOut; y residual of vertex (cm) ; Events / 0.04 cm",500,-10,10); - TH1F *h_res_tp_trk_z = new TH1F("h_res_tp_trk_z","h_res_tp_trk_z; z residual of vertex (cm) ; Events / 0.05 cm",400,-10,10); - TH1F *h_res_tp_trk_r = new TH1F("h_res_tp_trk_r","h_res_tp_trk_r; r residual of vertex (cm) ; Events / 0.02 cm",100,-1,1); - TH1F *h_res_tp_trk_phi = new TH1F("h_res_tp_trk_phi","h_res_tp_trk_phi; phi residual of vertex ; Events / 0.02",100,-1,1); - - TH2F *h_trueVertex_charge_vs_numTPs = new TH2F("h_trueVertex_charge_vs_numTPs","h_trueVertex_charge_vs_numTPs; TPs Associated with Vertex; Net Charge",6,0,6,12,-6,6); - TH2F *h_correct_trackVertex_charge_vs_numTracks = new TH2F("h_correct_trackVertex_charge_vs_numTracks","h_correct_trackVertex_charge_vs_numTracks; Tracks Associated with Vertex; Net Charge",20,0,20,40,-20,20); - TH2F *h_false_trackVertex_charge_vs_numTracks = new TH2F("h_false_trackVertex_charge_vs_numTracks","h_false_trackVertex_charge_vs_numTracks; Tracks Associated with Vertex; Net Charge",20,0,20,40,-20,20); - - std::string binVariable = ""; - std::vector> track_bins = {{-1,1}}; - std::vector> z0_bins; - double z0_bin_min = -20.0; - double z0_bin_width = 4.0; - double z0_bin_max = z0_bin_min+z0_bin_width; - while(z0_bin_max<20.0){ - z0_bins.push_back({z0_bin_min,z0_bin_max}); - z0_bin_min += (z0_bin_width/2); - z0_bin_max += (z0_bin_width/2); - } - std::vector> phi_bins; - double phi_bin_min = -TMath::Pi(); - double phi_bin_width = 0.6; - double phi_bin_max = phi_bin_min+phi_bin_width; - while(phi_bin_max numPart_primary_noCuts{}; - std::map numPart_primary_chi2rzdofCuts{}; - std::map numPart_primary_bendchi2Cuts{}; - std::map numPart_primary_chi2rphidofCuts{}; - std::map numPart_primary_nstubCuts{}; - std::map numPart_primary_ptCuts{}; - std::map numPart_primary_d0Cuts{}; - std::map numPart_primary_z0Cuts{}; - std::map numPart_np_noCuts{}; - std::map numPart_np_chi2rzdofCuts{}; - std::map numPart_np_bendchi2Cuts{}; - std::map numPart_np_chi2rphidofCuts{}; - std::map numPart_np_nstubCuts{}; - std::map numPart_np_ptCuts{}; - std::map numPart_np_d0Cuts{}; - std::map numPart_np_z0Cuts{}; - - if (tree == 0) return; - Long64_t nevt = tree->GetEntries(); - //nevt = 100; - Vertex_Parameters geomTrackVertex; - Vertex_Parameters geomTrueVertex; - auto trackLoopTime = 0.; - auto tpLoopTime = 0.; - auto trueVertLoopTime = 0.; - auto trueVertPlotLoopTime = 0.; - auto trackVertLoopTime = 0.; - auto matchLoopTime = 0.; - auto trackVertPlotLoopTime = 0.; - //std::cout<<"before event loop"<GetEntry(i_evnt); - displayProgress(i_evnt, nevt); - std::vector> binnedSelectedTracks; - for(uint i=0; i selectedTracks; // Tracks - std::deque selectedTPs; // Tracking particles - std::vector trueVertices; - int maxPT_i = 0; - bool oneMatch = false; - std::valarray trkMET = {0.0,0.0}; - float trkH_T = 0.0; - - vector> tpVert_indexTPs; - vector trkVert_indexMatch; - tpVert_d_T = new vector (); - tpVert_R_T = new vector (); - tpVert_cos_T = new vector (); - tpVert_x = new vector (); - tpVert_y = new vector (); - tpVert_z = new vector (); - tpVert_openingAngle = new vector (); - tpVert_parentPt = new vector (); - - // ---------------------------------------------------------------------------------------------------------------- - // track loop - //std::cout<<"starting track loop"<size(); ++it){ - bool isPrimary = true; - if(inputFile.Contains("DarkPhoton")){ - isPrimary = trk_matchtp_isHToMu->at(it); - } - if(inputFile.Contains("DisplacedTrackJet")){ - isPrimary = trk_matchtp_isHToB->at(it); - } - //std::cout<<"track pt: "<at(it)<<" eta: "<at(it)<<" d0 : "<at(it)<<" phi: "<at(it)<<" z0: "<at(it)<<" nstub: "<getDoPlot()){ - i_plot++; - } - bool mods = true; - TString cutName = preselCuts[icut]->getCutName(); - float cutValue = preselCuts[icut]->getCutValue(); - float param = preselCuts[icut]->getParam(it); - if(cutName.Contains("D0") || cutName.Contains("Eta")) param = fabs(param); - //std::cout<<"cutName: "<at(it))>barrelEta) mods = false; - if(cutName.Contains("disk") && fabs(trk_eta->at(it))<=barrelEta) mods = false; - if(cutName.Contains("_H") && trk_pt->at(it)<=10) mods = false; - if(cutName.Contains("_L") && trk_pt->at(it)>10) mods = false; - if(cutName.Contains("_P") && fabs(trk_d0->at(it))>1) mods = false; - if(cutName.Contains("_D") && fabs(trk_d0->at(it))<=1 ) mods = false; - if(cutName.Contains("overlap") && (fabs(trk_eta->at(it))<=1.1 || fabs(trk_eta->at(it))>=1.7)) mods = false; - if(mods){ - if(cutName.Contains("max") && param>cutValue) break; - if(cutName.Contains("min") && paramgetDoPlot()) continue; - for(uint i=0; iat(it)==1 && isPrimary; - if(trackType[i]=="primary" && !primary) continue; - if(trackType[i]=="np" && primary) continue; - if(trackType[i]=="fake" && trkExt_fake->at(it)!=0) continue; - if(trackType[i]=="PU" && trkExt_fake->at(it)!=2) continue; - if(trackType[i]=="notHiggs" && !(trkExt_fake->at(it)==1 && !isPrimary)) continue; - string partId = to_string(trk_matchtp_pdgid->at(it)); - //numPartCutFlows[i][icut][partId]++; - for(uint j=0; jat(it)<=10) continue; - if(plotModifiers[j]=="_L" && trk_pt->at(it)>10) continue; - if(plotModifiers[j]=="_P" && fabs(trk_d0->at(it))>1) continue; - if(plotModifiers[j]=="_D" && fabs(trk_d0->at(it))<=1) continue; - if(plotModifiers[j]=="_barrel" && fabs(trk_eta->at(it))>barrelEta) continue; - if(plotModifiers[j]=="_disk" && fabs(trk_eta->at(it))<=barrelEta) continue; - for(uint ivar=0; ivargetParam(it); - TString varName = varCutFlows[ivar]->getVarName(); - if(varName.Contains("sector")){ - while (param < -TMath::Pi()/9 ) param += 2*TMath::Pi(); - while (param > TMath::Pi()*2 ) param -= 2*TMath::Pi(); - while (param > TMath::Pi()/9) param -= 2*TMath::Pi()/9; - } - if(varName.Contains("d0")){ - param = fabs(param); - } - preselCutFlows[ivar][i][i_plot][j]->Fill(param); - } - for(uint ivar2D=0; ivar2DgetParam(it); - float param2 = varCutFlows2D[ivar2D].second->getParam(it); - TString varName1 = varCutFlows2D[ivar2D].first->getVarName(); - TString varName2 = varCutFlows2D[ivar2D].second->getVarName(); - if(varName1.Contains("sector")){ - while (param1 < -TMath::Pi()/9 ) param1 += 2*TMath::Pi(); - while (param1 > TMath::Pi()*2 ) param1 -= 2*TMath::Pi(); - while (param1 > TMath::Pi()/9) param1 -= 2*TMath::Pi()/9; - } - if(varName2.Contains("sector")){ - while (param2 < -TMath::Pi()/9 ) param2 += 2*TMath::Pi(); - while (param2 > TMath::Pi()*2 ) param2 -= 2*TMath::Pi(); - while (param2 > TMath::Pi()/9) param2 -= 2*TMath::Pi()/9; - } - preselCutFlows2D[ivar2D][i][i_plot][j]->Fill(param1,param2); - } - } - } - } - if(icut==preselCuts.size()){ - Track_Parameters* tp_params = new Track_Parameters(trk_matchtp_pt->at(it), trk_matchtp_d0->at(it), trk_matchtp_z0->at(it), trk_matchtp_eta->at(it), trk_matchtp_phi->at(it), trk_matchtp_pdgid->at(it), trk_matchtp_x->at(it), trk_matchtp_y->at(it), trk_matchtp_z->at(it)); - for(uint i=0; iat(it); - if (binVariable=="z0") trkVariable = fabs(trk_z0->at(it)); - if(trkVariabletrack_bins[i][0] ){ - binnedSelectedTracks[i].push_back(Track_Parameters(trk_pt->at(it), -trk_d0->at(it), trk_z0->at(it), trk_eta->at(it), trk_phi->at(it), -99999, -999., -999., -999., trk_rinv->at(it), it, tp_params, trk_nstub->at(it), trk_chi2rphi->at(it), trk_chi2rz->at(it), trk_bendchi2->at(it), trk_MVA1->at(it), trk_MVA2->at(it))); - } - } - - - //std::cout<<"track params: "<at(it)<<" "<<-trk_d0->at(it)<<" "<at(it)<<" "<at(it)<<" "<at(it)<<" "<at(it)<<" "<at(it)<<" "<at(it)<<" "<at(it)<<" "<at(it)<<" "<at(it)<<" "<at(it)<at(it), -trk_d0->at(it), trk_z0->at(it), trk_eta->at(it), trk_phi->at(it), -99999, -999., -999., -999., trk_rinv->at(it), it, tp_params, trk_nstub->at(it), trk_chi2rphi->at(it), trk_chi2rz->at(it), trk_bendchi2->at(it), trk_MVA1->at(it), trk_MVA2->at(it) )); - trkH_T += trk_pt->at(it); - std::valarray trackPtVec = {trk_pt->at(it)*cos(trk_phi->at(it)),trk_pt->at(it)*sin(trk_phi->at(it))}; - trkMET -= trackPtVec; - } - } - std::chrono::steady_clock::time_point end = std::chrono::steady_clock::now(); - trackLoopTime += std::chrono::duration_cast(end - begin).count(); - h_trk_H_T->Fill(trkH_T); - h_trk_MET->Fill(TMath::Sqrt(pow(trkMET[0],2)+pow(trkMET[1],2))); - h_numSelectedTrks->Fill(selectedTracks.size()); - //std::cout<<"num selected tracks: "<Fill(selectedTracks.size()); - - // ---------------------------------------------------------------------------------------------------------------- - // tracking particle loop - float tpH_T = 0.0; - std::valarray tpMET = {0.0,0.0}; - //std::cout<<"tp_pt size: "<size()<size(); it++){ - - float tmp_d0 = tp_d0->at(it); // Sign difference in the NTupleMaker - float tmp_z0 = tp_z0->at(it); - - bool isPrimary = true; - if(inputFile.Contains("DarkPhoton")) isPrimary = tp_isHToMu->at(it); - if(inputFile.Contains("DisplacedTrackJet")) isPrimary = tp_isHToB->at(it); - - uint icut=0; - for(icut=0; icutgetParam(it); - TString cutName = preselCutsTP[icut]->getCutName(); - if(cutName.Contains("D0") || cutName.Contains("Eta")) param = fabs(param); - float cutValue = preselCutsTP[icut]->getCutValue(); - //std::cout<<"cutName: "<at(it))>barrelEta) mods = false; - if(cutName.Contains("disk") && fabs(tp_eta->at(it))<=barrelEta) mods = false; - if(cutName.Contains("_H") && tp_pt->at(it)<=10) mods = false; - if(cutName.Contains("_L") && tp_pt->at(it)>10) mods = false; - if(cutName.Contains("_P") && fabs(tp_d0->at(it))>1) mods = false; - if(cutName.Contains("_D") && fabs(tp_d0->at(it))<=1 ) mods = false; - if(cutName.Contains("overlap") && (fabs(tp_eta->at(it))<=1.1 || fabs(tp_eta->at(it))>=1.7)) mods = false; - if(mods){ - if(cutName.Contains("max") && param>cutValue) break; - if(cutName.Contains("min") && paramat(it)==0 && isPrimary; - if(tpType[i]=="primary" && !primary) continue; - if(tpType[i]=="np" && primary) continue; - if(tpType[i]=="PU" && tp_eventid->at(it)==0) continue; - if(tpType[i]=="notHiggs" && !(tp_eventid->at(it)==0 && !isPrimary)) continue; - if(tpType[i]=="match" && tp_nmatch->at(it)==0) continue; - string partId = to_string(tp_pdgid->at(it)); - //numPartCutFlowsTP[i][icut][partId]++; - for(uint j=0; jat(it)<=10) continue; - if(plotModifiers[j]=="_L" && tp_pt->at(it)>10) continue; - if(plotModifiers[j]=="_P" && fabs(tp_d0->at(it))>1) continue; - if(plotModifiers[j]=="_D" && fabs(tp_d0->at(it))<=1) continue; - if(plotModifiers[j]=="_barrel" && fabs(tp_eta->at(it))>barrelEta) continue; - if(plotModifiers[j]=="_disk" && fabs(tp_eta->at(it))<=barrelEta) continue; - for(uint ivar=0; ivargetParam(it); - TString varName = varCutFlowsTP[ivar]->getVarName(); - if(varName.Contains("sector")){ - while (param < -TMath::Pi()/9 ) param += 2*TMath::Pi(); - while (param > TMath::Pi()*2 ) param -= 2*TMath::Pi(); - while (param > TMath::Pi()/9) param -= 2*TMath::Pi()/9; - } - if(varName.Contains("d0")){ - param = fabs(param); - } - preselCutFlowsTP[ivar][i][icut][j]->Fill(param); - } - for(uint ivar2D=0; ivar2DgetParam(it); - float param2 = varCutFlowsTP2D[ivar2D].second->getParam(it); - TString varName1 = varCutFlowsTP2D[ivar2D].first->getVarName(); - TString varName2 = varCutFlowsTP2D[ivar2D].second->getVarName(); - if(varName1.Contains("sector")){ - while (param1 < -TMath::Pi()/9 ) param1 += 2*TMath::Pi(); - while (param1 > TMath::Pi()*2 ) param1 -= 2*TMath::Pi(); - while (param1 > TMath::Pi()/9) param1 -= 2*TMath::Pi()/9; - } - if(varName2.Contains("sector")){ - while (param2 < -TMath::Pi()/9 ) param2 += 2*TMath::Pi(); - while (param2 > TMath::Pi()*2 ) param2 -= 2*TMath::Pi(); - while (param2 > TMath::Pi()/9) param2 -= 2*TMath::Pi()/9; - } - preselCutFlowsTP2D[ivar2D][i][icut][j]->Fill(param1,param2); - } - } - } - } - if(icut==preselCutsTP.size() && tp_eventid->at(it)==0 && isPrimary==true){ - selectedTPs.push_back(Track_Parameters(tp_pt->at(it), tmp_d0, tmp_z0, tp_eta->at(it), tp_phi->at(it), tp_pdgid->at(it), tp_x->at(it), tp_y->at(it), tp_z->at(it), tp_charge->at(it), it)); - if (tp_eventid->at(it)>0){ - tpH_T += tp_pt->at(it); - std::valarray tpPtVec = {tp_pt->at(it)*cos(tp_phi->at(it)),tp_pt->at(it)*sin(tp_phi->at(it))}; - tpMET -= tpPtVec; - } - } - } - end = std::chrono::steady_clock::now(); - tpLoopTime += std::chrono::duration_cast(end - begin).count(); - h_tp_H_T->Fill(tpH_T); - h_tp_MET->Fill(TMath::Sqrt(pow(tpMET[0],2)+pow(tpMET[1],2))); - - // -------------------------------------------------------------------------------------------- - // Vertex finding in Tracking Particles - // -------------------------------------------------------------------------------------------- - if (!(selectedTracks.size() >= 2)) continue; - double_t x_dv = -9999.0;// (tp_x->at((*selectedTPs)[0]->index));//+tp_x->at((*selectedTPs)[1]->index))/2.0; - double_t y_dv = -9999.0;// (tp_y->at((*selectedTPs)[0]->index));//+tp_y->at((*selectedTPs)[1]->index))/2.0; - double_t z_dv = -9999.0;// (tp_z->at((*selectedTPs)[0]->index));//+tp_z->at((*selectedTPs)[1]->index))/2.0; - - if(selectedTPs.size()>=2){ - begin = std::chrono::steady_clock::now(); - //std::cout<<"vertex finding in TPs"<1){ - bool foundTrueVertex = false; - for( uint i=1; iat(index0)-tp_x->at(index1))<0.0001 && fabs(tp_y->at(index0)-tp_y->at(index1))<0.0001 && fabs(tp_z->at(index0)-tp_z->at(index1))<0.0001 ){ - x_dv = tp_x->at(index0); - y_dv = tp_y->at(index0); - z_dv = tp_z->at(index0); - if(dist(x_dv,y_dv)>d0_res && dist(x_dv,y_dv)<20){ - //std::cout<<"true vertex: "<at(selectedTPs[0].index)<<" "<at(selectedTPs[i].index)<Fill(trueVertices.size()); - float maxPT = 0.0; - // loop through trueVertices and fill ntuple branches - for(uint i=0; imaxPT){ - maxPT = trueVertices[i].a.pt; - maxPT_i = i; - } - - std::vector itps; - for(uint itrack=0; itrackpush_back(trueVertices[i].d_T); - tpVert_cos_T->push_back(trueVertices[i].cos_T); - tpVert_R_T->push_back(trueVertices[i].R_T); - tpVert_x->push_back(trueVertices[i].x_dv); - tpVert_y->push_back(trueVertices[i].y_dv); - tpVert_z->push_back(trueVertices[i].z_dv); - tpVert_openingAngle->push_back(trueVertices[i].openingAngle); - tpVert_parentPt->push_back(trueVertices[i].p_mag); - - float netCharge = 0; - for(uint itrack=0; itrackFill(trueVertices[i].tracks.size()); - h_trueVertex_charge_vs_numTPs->Fill(trueVertices[i].tracks.size(),netCharge); - } - end = std::chrono::steady_clock::now(); - trueVertLoopTime += std::chrono::duration_cast(end - begin).count(); - begin = std::chrono::steady_clock::now(); - // fill true vertex plots using ntuple branches - for (int it = 0; it < (int)tpVert_d_T->size(); it++){ - for(uint i=0; igetVarName(); - if(varName.Contains("delta")){ - float param1 = vertCutFlowsTP[i]->getParam(tpVert_indexTPs[it][0]); - for(uint iTP=1; iTPgetParam(tpVert_indexTPs[it][iTP]); - param = fabs(param1 - param2); - vertexCutFlowsTP[i][k]->Fill(param); - } - continue; - } - else if(varName.Contains("high")){ - param = vertCutFlowsTP[i]->getParam(tpVert_indexTPs[it][0]); - for(uint iTP=1; iTPgetParam(tpVert_indexTPs[it][iTP]); - if(fabs(param2)>fabs(param)) param = param2; - } - } - else if(varName.Contains("low")){ - param = vertCutFlowsTP[i]->getParam(tpVert_indexTPs[it][0]); - for(uint iTP=1; iTPgetParam(tpVert_indexTPs[it][iTP]); - if(fabs(param2)getParam(tpVert_indexTPs[it][0]); - } - else{ - param = vertCutFlowsTP[i]->getParam(it); - } - vertexCutFlowsTP[i][k]->Fill(param); - } - } - } - end = std::chrono::steady_clock::now(); - trueVertPlotLoopTime += std::chrono::duration_cast(end - begin).count(); - - } - - // -------------------------------------------------------------------------------------------- - // Vertex finding in Tracks - // -------------------------------------------------------------------------------------------- - //std::cout<<"vertex finding in tracks"< lastBinVertices; - for(auto trackBin : binnedSelectedTracks){ - std::vector binVertices; - if(trackBin.size()<2) continue; - sort(trackBin.begin(), trackBin.end(), ComparePtTrack); - for(uint i=0; ipush_back(trackBin[i].index); - //trkVert_secondIndexTrk->push_back(trackBin[j].index); - //trkVert_firstIndexPt->push_back(i); - //trkVert_secondIndexPt->push_back(j); - //trkVert_inTraj->push_back(inTraj); - //trkVert_d_T->push_back(vertex.d_T); - //trkVert_R_T->push_back(vertex.R_T); - //trkVert_cos_T->push_back(vertex.cos_T); - //trkVert_del_Z->push_back(vertex.delta_z); - //trkVert_x->push_back(vertex.x_dv); - //trkVert_y->push_back(vertex.y_dv); - //trkVert_z->push_back(vertex.z_dv); - //trkVert_openingAngle->push_back(vertex.openingAngle); - //trkVert_parentPt->push_back(vertex.p_mag); - //trkVert_delIndexPt->push_back(fabs(i-j)); - //std::cout<<"found vertex"<push_back(x_trk_alt); - //trkVert_alt_y->push_back(y_trk_alt); - //trkVert_leadingCharge->push_back(vertex.a.charge); - //trkVert_subleadingCharge->push_back(vertex.b.charge); - } - } - } - lastBinVertices = binVertices; - } - end = std::chrono::steady_clock::now(); - trackVertLoopTime += std::chrono::duration_cast(end - begin).count(); - begin = std::chrono::steady_clock::now(); - //std::cout<<"match track and true vertices"<size(); it++){ - int itp = trkVert_firstIndexTrk->at(it); - //std::cout<<"match vertices first track index: "<at(itp), trk_matchtp_d0->at(itp), trk_matchtp_z0->at(itp), trk_matchtp_eta->at(itp), trk_matchtp_phi->at(itp), trk_matchtp_pdgid->at(itp), trk_matchtp_x->at(itp), trk_matchtp_y->at(itp), trk_matchtp_z->at(itp)); - //std::cout<<"trkVert xyz: "<at(it)<<" "<at(it)<<" "<at(it)<<" tp 1 params: "<at(itp)<<" "<at(itp)<<" "<at(itp)<<" "<at(itp)<<" "<at(itp)<<" "<at(itp)<<" "<at(itp)<<" "<at(itp)<<" "<at(itp)<at(it); - //std::cout<<"match vertices second track index: "<at(itp), trk_matchtp_d0->at(itp), trk_matchtp_z0->at(itp), trk_matchtp_eta->at(itp), trk_matchtp_phi->at(itp), trk_matchtp_pdgid->at(itp), trk_matchtp_x->at(itp), trk_matchtp_y->at(itp), trk_matchtp_z->at(itp)); - //std::cout<<"trkVert xyz: "<at(it)<<" "<at(it)<<" "<at(it)<<" tp 2 params: "<at(itp)<<" "<at(itp)<<" "<at(itp)<<" "<at(itp)<<" "<at(itp)<<" "<at(itp)<<" "<at(itp)<<" "<at(itp)<<" "<at(itp)<=2){ - trkVert_indexMatch.push_back(i); - foundMatch = true; - break; - } - } - if(!foundMatch) trkVert_indexMatch.push_back(-1); - } - end = std::chrono::steady_clock::now(); - matchLoopTime += std::chrono::duration_cast(end - begin).count(); - begin = std::chrono::steady_clock::now(); - bool filledOneMatch[vertCuts.size()]; - bool isMatchedVec[trueVertices.size()][vertCuts.size()]; - uint numVertices[vertCuts.size()]; - for(uint i = 0; isize(); it++){ - for(uint i=0; igetCutName(); - float cutValue = vertCuts[i]->getCutValue(); - //std::cout<<"cutName: "<at(it)<<" "<at(it)<getParam(trkVert_firstIndexTrk->at(it)); - float param2 = vertCuts[i]->getParam(trkVert_secondIndexTrk->at(it)); - param = fabs(param1 - param2); - } - else if(cutName.Contains("sum")){ - float param1 = vertCuts[i]->getParam(trkVert_firstIndexTrk->at(it)); - float param2 = vertCuts[i]->getParam(trkVert_secondIndexTrk->at(it)); - if(cutName.Contains("Charge")){ - if(param1>0.0) param1 = 1.0; - if(param1<0.0) param1 = -1.0; - if(param2>0.0) param2 = 1.0; - if(param2<0.0) param2 = -1.0; - } - param = param1 + param2; - } - else if(cutName.Contains("high")){ - param = vertCuts[i]->getParam(trkVert_firstIndexTrk->at(it)); - float param2 = vertCuts[i]->getParam(trkVert_secondIndexTrk->at(it)); - if(fabs(param2)>fabs(param)) param = param2; - if(cutName.Contains("D0") || cutName.Contains("Eta")) param = fabs(param); - } - else if(cutName.Contains("low")){ - param = vertCuts[i]->getParam(trkVert_firstIndexTrk->at(it)); - float param2 = vertCuts[i]->getParam(trkVert_secondIndexTrk->at(it)); - if(fabs(param2)getParam(trkVert_firstIndexTrk->at(it)); - if(cutName.Contains("D0") || cutName.Contains("Eta")) param = fabs(param); - } - else{ - param = vertCuts[i]->getParam(it); - } - //std::cout<<"trackVert cutName: "<cutValue) break; - if(cutName.Contains("min") && paramgetVarName(); - if(varName.Contains("delta")){ - float param1 = vertCutFlows[k]->getParam(trkVert_firstIndexTrk->at(it)); - float param2 = vertCutFlows[k]->getParam(trkVert_secondIndexTrk->at(it)); - param = fabs(param1 - param2); - } - else if(varName.Contains("sum")){ - float param1 = vertCutFlows[k]->getParam(trkVert_firstIndexTrk->at(it)); - float param2 = vertCutFlows[k]->getParam(trkVert_secondIndexTrk->at(it)); - if(varName.Contains("charge")){ - if(param1>0.0) param1 = 1.0; - if(param1<0.0) param1 = -1.0; - if(param2>0.0) param2 = 1.0; - if(param2<0.0) param2 = -1.0; - } - param = param1 + param2; - } - else if(varName.Contains("high")){ - param = vertCutFlows[k]->getParam(trkVert_firstIndexTrk->at(it)); - float param2 = vertCutFlows[k]->getParam(trkVert_secondIndexTrk->at(it)); - if(fabs(param2)>fabs(param)) param = param2; - } - else if(varName.Contains("low")){ - param = vertCutFlows[k]->getParam(trkVert_firstIndexTrk->at(it)); - float param2 = vertCutFlows[k]->getParam(trkVert_secondIndexTrk->at(it)); - if(fabs(param2)getParam(trkVert_firstIndexTrk->at(it)); - } - else{ - param = vertCutFlows[k]->getParam(it); - } - vertexCutFlows[k][j][i]->Fill(param); - } - if(vertType[j]=="matched"){ - for(uint k=0; kFill(tpVert_x->at(jt)-trkVert_x->at(it)); - h_res_tp_trk_x_zoomOut->Fill(tpVert_x->at(jt)-trkVert_x->at(it)); - h_res_tp_trk_y->Fill(tpVert_y->at(jt)-trkVert_y->at(it)); - h_res_tp_trk_y_zoomOut->Fill(tpVert_y->at(jt)-trkVert_y->at(it)); - h_res_tp_trk_z->Fill(tpVert_z->at(jt)-trkVert_z->at(it)); - } - - for(uint m=0; mgetVarName(); - if(varName.Contains("delta")){ - float param1 = vertCutFlowsTP[m]->getParam(tpVert_indexTPs[jt][0]); - for(uint iTP=1; iTPgetParam(tpVert_indexTPs[jt][iTP]); - param = fabs(param1 - param2); - vertexCutFlowsMatchTP[m][i][k]->Fill(param); - } - continue; - } - else if(varName.Contains("high")){ - param = vertCutFlowsTP[m]->getParam(tpVert_indexTPs[jt][0]); - for(uint iTP=1; iTPgetParam(tpVert_indexTPs[jt][iTP]); - if(fabs(param2)>fabs(param)) param = param2; - } - } - else if(varName.Contains("low")){ - param = vertCutFlowsTP[m]->getParam(tpVert_indexTPs[jt][0]); - for(uint iTP=1; iTPgetParam(tpVert_indexTPs[jt][iTP]); - if(fabs(param2)getParam(tpVert_indexTPs[jt][0]); - } - else{ - param = vertCutFlowsTP[m]->getParam(jt); - } - vertexCutFlowsMatchTP[m][i][k]->Fill(param); - } - } - break; - } - } - } - } - end = std::chrono::steady_clock::now(); - trackVertPlotLoopTime += std::chrono::duration_cast(end - begin).count(); - - h_trackVertexBranch_numAllCuts->Fill(numVertices[vertCuts.size()-1]); - //std::cout<<"num vertices: "<Fill(numVertices[i]); - } - - delete tpVert_d_T; - delete tpVert_R_T; - delete tpVert_cos_T; - delete tpVert_x; - delete tpVert_y; - delete tpVert_z; - delete tpVert_openingAngle; - delete tpVert_parentPt; -#if 0 - delete trkVert_firstIndexTrk; - delete trkVert_secondIndexTrk; - delete trkVert_firstIndexPt; - delete trkVert_secondIndexPt; - delete trkVert_inTraj; - delete trkVert_d_T; - delete trkVert_R_T; - delete trkVert_cos_T; - delete trkVert_del_Z; - delete trkVert_x; - delete trkVert_y; - delete trkVert_z; - delete trkVert_openingAngle; - delete trkVert_parentPt; - delete trkVert_delIndexPt; -#endif - - - } // End of Event Loop - - std::cout<<"nevt: "<Exec(mkDIR); - TString PRESELDIR = DIR + "/PreselectionPlots"; - TString makedirPreSel = "mkdir -p " + PRESELDIR; - const char *mkDIRPRESEL = makedirPreSel.Data(); - gSystem->Exec(mkDIRPRESEL); - TString VERTDIR = DIR + "/VertexPlots"; - TString makedirVert = "mkdir -p " + VERTDIR; - const char *mkDIRVERT = makedirVert.Data(); - gSystem->Exec(mkDIRVERT); - - TFile *fout; - fout = new TFile(outputDir + "output_" + inputFile, "recreate"); - TLegend* l = new TLegend(0.82,0.3,0.98,0.7); - l->SetFillColor(0); - l->SetLineColor(0); - l->SetTextSize(0.04); - l->SetTextFont(42); - - std::cout<<"trkEffOverlay"<Clear(); - TH1F* h_trkEff[preselCutsSize]; - uint i_plot = 0; - for(uint mcut=1; mcutgetDoPlot()){ - i_plot++; - } - else{ - continue; - } - //std::cout<<"trkEffOverlay i j m k: "<Clone(); - h_trkEff[i_plot]->GetYaxis()->SetNoExponent(kTRUE); - removeFlows(h_trkEff[i_plot]); - h_trkEff[i_plot]->SetStats(0); - removeFlows(preselCutFlows[ivar][j][i_plot][k]); - TString cutLabel = preselCuts[mcut]->getCutLabel(); - TString varString = varCutFlows[ivar]->getVarName(); - h_trkEff[i_plot]->Divide(preselCutFlows[ivar][j][i_plot][k],h_trkEff[i_plot],1.0,1.0,"B"); - if(i_plot!=10){ - h_trkEff[i_plot]->SetLineColor(i_plot); - h_trkEff[i_plot]->SetMarkerColor(i_plot); - } - else{ - h_trkEff[i_plot]->SetLineColor(40); - h_trkEff[i_plot]->SetMarkerColor(40); - } - //TString cutLabel = preselCuts[mcut]->getCutLabel(); - //std::cout<<"cutName: "<AddEntry(h_trkEff[i_plot],cutLabel,"lp"); - //TString varString = varCutFlows[ivar]->getVarName(); - if(varString.Contains("d0") || varString.Contains("pt")){ - //std::cout<<"h_trkEffOverlay_"+varCutFlows[ivar]->getVarName()+"_"+trackType[j]+plotModifiers[k]+".pdf"<GetNbinsX()+1); ibin++){ - binValues+=to_string(h_trkEff[i_plot]->GetBinContent(ibin)) + ", "; - binWidths+=to_string(h_trkEff[i_plot]->GetBinWidth(ibin)) + ", "; - binErrors+=to_string(h_trkEff[i_plot]->GetBinError(ibin)) + ", "; - binCenters+=to_string(h_trkEff[i_plot]->GetBinCenter(ibin)) + ", "; - } - binValues+="]"; - binWidths+="]"; - binErrors+="]"; - binCenters+="]"; - //std::cout<<"binValues: "<Draw(); - } - else{ - h_trkEff[i_plot]->Draw("SAME"); - } - } - mySmallText(0.3, 0.9, 1, ctxt); - l->Draw(); - /* - TString label_cms="CMS"; - TLatex* Label_cms = new TLatex(0.15,0.92,label_cms); - Label_cms->SetNDC(); - Label_cms->SetTextFont(61); - Label_cms->SetTextSize(0.065); - Label_cms->Draw(); - TString label_cms1="Simulation Phase-2 Preliminary"; - TLatex* Label_cms1 = new TLatex(0.232,0.92,label_cms1); - Label_cms1->SetNDC(); - Label_cms1->SetTextSize(0.051); - Label_cms1->SetTextFont(52); - Label_cms1->Draw();*/ - c.SaveAs(PRESELDIR + "/h_trkEffOverlay_"+varCutFlows[ivar]->getVarName()+"_"+trackType[j]+plotModifiers[k]+".pdf"); - /*std::cout << "trkEffOverlay took " - << std::chrono::duration_cast(finish - start).count() - << " milliseconds\n";*/ - } - } - } - - std::cout<<"signalvsbg"<getDoPlot()){ - i_plot++; - } - else{ - continue; - } - for(uint j=0; jgetCutName(); - auto h_stack = new THStack("hs_"+varCutFlows[kvar]->getVarName()+"_"+cutName+"Cut"+plotModifiers[j],"Stacked BG histograms"); - float integralSum = 0; - l->Clear(); - for(uint m=0; mGetYaxis()->SetNoExponent(kTRUE); - removeFlows(preselCutFlows[kvar][m][i_plot][j]); - if(detailedPlots){ - raiseMax(preselCutFlows[kvar][m][i_plot][j]); - preselCutFlows[kvar][m][i_plot][j]->Draw(); - mySmallText(0.3, 0.9, 1, ctxt); - //preselCutFlows[kvar][m][icut][j]->Write("", TObject::kOverwrite); - c.SaveAs(PRESELDIR + "/"+ preselCutFlows[kvar][m][i_plot][j]->GetName() + ".pdf"); - } - if(m!=9){ - preselCutFlows[kvar][m][i_plot][j]->SetLineColor(m+1); - preselCutFlows[kvar][m][i_plot][j]->SetMarkerColor(m+1); - } - else{ - preselCutFlows[kvar][m][i_plot][j]->SetLineColor(40); - preselCutFlows[kvar][m][i_plot][j]->SetMarkerColor(40); - } - if(trackType[m]=="fake" || trackType[m]=="PU" || trackType[m]=="notHiggs"){ - integralSum+=preselCutFlows[kvar][m][i_plot][j]->Integral(); - } - /*std::cout << "preselCutFlows took " - << std::chrono::duration_cast(finish - start).count() - << " milliseconds\n";*/ - } - for(uint m=0; mScale(1./integralSum); - h_stack->Add(preselCutFlows[kvar][m][i_plot][j]); - } - } - - //h_stack->Draw("HIST"); - preselCutFlows[kvar][m_primary][i_plot][j]->Scale(1./preselCutFlows[kvar][m_primary][i_plot][j]->Integral()); - /* - raiseMaxStack(preselCutFlows[kvar][m_primary][icut][j],h_stack); - drawSameStack(preselCutFlows[kvar][m_primary][icut][j],h_stack); - mySmallText(0.3, 0.9, 1, ctxt); - l->Clear(); - l->AddEntry(preselCutFlows[kvar][m_primary][icut][j],"Primary","l"); - l->AddEntry(preselCutFlows[kvar][m_fake][icut][j],"Fake","l"); - l->AddEntry(preselCutFlows[kvar][m_PU][icut][j],"PU","l"); - l->AddEntry(preselCutFlows[kvar][m_notHiggs][icut][j],"notHiggs","l"); - l->Draw(); - c.SaveAs(PRESELDIR + "/h_signalVsBGStack_"+varCutFlows[kvar]->getVarName()+"_"+preselCuts[icut]->getCutName()+"Cut"+plotModifiers[j]+".pdf"); - */ - delete h_stack; - for(uint m=0; mScale(1./preselCutFlows[kvar][m][i_plot][j]->Integral()); - preselCutFlows[kvar][m][i_plot][j]->SetStats(0); - } - /* - raiseMax(preselCutFlows[kvar][m_primary][icut][j],preselCutFlows[kvar][m_fake][icut][j],preselCutFlows[kvar][m_PU][icut][j],preselCutFlows[kvar][m_notHiggs][icut][j]); - drawSame(preselCutFlows[kvar][m_primary][icut][j],preselCutFlows[kvar][m_fake][icut][j],preselCutFlows[kvar][m_PU][icut][j],preselCutFlows[kvar][m_notHiggs][icut][j]); - mySmallText(0.3, 0.9, 1, ctxt); - l->Draw(); - //std::cout<<"signalvsBGOverlay primary fake PU notHiggs: "<getVarName()+"_"+preselCuts[icut]->getCutName()+"Cut"+plotModifiers[j]+".pdf"); - std::cout << "signalVsBGOverlay took " - << std::chrono::duration_cast(finish - start).count() - << " milliseconds\n"; - */ - raiseMax(preselCutFlows[kvar][m_primary][i_plot][j],preselCutFlows[kvar][m_np][i_plot][j]); - drawSame(preselCutFlows[kvar][m_primary][i_plot][j],preselCutFlows[kvar][m_np][i_plot][j]); - mySmallText(0.3, 0.9, 1, ctxt); - l->Clear(); - l->AddEntry(preselCutFlows[kvar][m_primary][i_plot][j],"Primary","l"); - l->AddEntry(preselCutFlows[kvar][m_np][i_plot][j],"NP","l"); - l->Draw(); - preselCutFlows[kvar][m_primary][i_plot][j]->Write("", TObject::kOverwrite); - preselCutFlows[kvar][m_np][i_plot][j]->Write("", TObject::kOverwrite); - c.SaveAs(PRESELDIR + "/h_signalVsBG_"+varCutFlows[kvar]->getVarName()+"_"+preselCuts[icut]->getCutName()+"Cut"+plotModifiers[j]+".pdf"); - } - } - } - std::cout<<"trackFindingEff"<getCutName(); - for(uint j=0; jGetYaxis()->SetNoExponent(kTRUE); - removeFlows(preselCutFlowsTP[kvar][m][icut][j]); - if(detailedPlots){ - raiseMax(preselCutFlowsTP[kvar][m][icut][j]); - preselCutFlowsTP[kvar][m][icut][j]->Draw(); - mySmallText(0.3, 0.9, 1, ctxt); - //preselCutFlowsTP[kvar][m][icut][j]->Write("", TObject::kOverwrite); - c.SaveAs(PRESELDIR + "/"+ preselCutFlowsTP[kvar][m][icut][j]->GetName() + ".pdf"); - } - } - preselCutFlowsTP[kvar][m_match][icut][j]->Divide(preselCutFlowsTP[kvar][m_match][icut][j],preselCutFlowsTP[kvar][m_tp][icut][j]); - raiseMax(preselCutFlowsTP[kvar][m_match][icut][j]); - preselCutFlowsTP[kvar][m_match][icut][j]->Draw(); - mySmallText(0.3, 0.9, 1, ctxt); - c.SaveAs(PRESELDIR + "/h_trackFindingEff_"+varCutFlowsTP[kvar]->getVarName()+"_"+cutName+"Cut"+plotModifiers[j]+".pdf"); - } - } - } - - i_plot = -1; - for(uint icut=0; icutgetDoPlot()){ - i_plot++; - } - else{ - continue; - } - TString cutName = preselCuts[icut]->getCutName(); - for(uint j=0; jDraw("COLZ"); - mySmallText(0.3, 0.9, 1, ctxt); - c.SaveAs(PRESELDIR + "/"+ preselCutFlows2D[kvar][m][i_plot][j]->GetName() + ".pdf"); - } - } - } - } - std::cout<<"preselCutFlowsTP2D"<getCutName(); - for(uint j=0; jDraw("COLZ"); - mySmallText(0.3, 0.9, 1, ctxt); - c.SaveAs(PRESELDIR + "/"+ preselCutFlowsTP2D[kvar][m][icut][j]->GetName() + ".pdf"); - } - } - } - } - } - std::cout<<"eff_trueVertex"<getVarName().Contains("highPt")) std::cout<<"onematch entries: "<GetEntries()<<" "<GetEntries()<Clone(); - h_eff->Divide(vertexCutFlowsMatchTP[j][vertCuts.size()-1][i],vertexCutFlowsTP[j][i],1.0,1.0,"B"); - raiseMax(h_eff); - h_eff->SetStats(0); - h_eff->SetAxisRange(0, 1.1, "Y"); - h_eff->Draw(); - mySmallText(0.3, 0.9, 1, ctxt); - c.SaveAs(VERTDIR + "/h_eff_trueVertex_" + vertCutFlowsTP[j]->getVarName() + "_" + vertPlotTPModifiers[i] + ".pdf"); - } - } - std::cout<<"findEff_trueVertex"<Clear(); - for(uint j=0; jClone(); - h_findEff->Divide(vertexCutFlowsMatchTP[i][j][0],vertexCutFlowsTP[i][0],1.0,1.0,"B"); - h_findEff->SetStats(0); - if(j!=9){ - h_findEff->SetLineColor(j+1); - h_findEff->SetMarkerColor(j+1); - } - else{ - h_findEff->SetLineColor(40); - h_findEff->SetMarkerColor(40); - } - l->AddEntry(h_findEff,vertCuts[j]->getCutLabel(),"lp"); - TString varString = vertCutFlowsTP[i]->getVarName(); - if(varString.Contains("R_T") || varString.Contains("highPt")){ - //std::cout<<"/h_findEff_trueVertex_" + vertCutFlowsTP[i]->getVarName() + ".pdf"<getCutLabel()<GetNbinsX()+1); ibin++){ - binValues+=to_string(h_findEff->GetBinContent(ibin)) + ", "; - binWidths+=to_string(h_findEff->GetBinWidth(ibin)) + ", "; - binErrors+=to_string(h_findEff->GetBinError(ibin)) + ", "; - binCenters+=to_string(h_findEff->GetBinCenter(ibin)) + ", "; - } - binValues+="]"; - binWidths+="]"; - binErrors+="]"; - binCenters+="]"; - //std::cout<<"binValues: "<SetAxisRange(0, 1.1, "Y"); - h_findEff->Draw(); - } - else{ - h_findEff->Draw("SAME"); - } - } - mySmallText(0.3, 0.9, 1, ctxt); - l->Draw(); - c.SaveAs(VERTDIR + "/h_findEff_trueVertex_" + vertCutFlowsTP[i]->getVarName() + ".pdf"); - } - std::cout<<"fakeEff_trackVertex"<Clear(); - for(uint j=1; jClone(); - h_fakeEff->Divide(vertexCutFlows[i][1][j],vertexCutFlows[i][1][0],1.0,1.0,"B"); - h_fakeEff->SetStats(0); - if(j!=10){ - h_fakeEff->SetLineColor(j); - h_fakeEff->SetMarkerColor(j); - } - else{ - h_fakeEff->SetLineColor(40); - h_fakeEff->SetMarkerColor(40); - } - l->AddEntry(h_fakeEff,vertCuts[j]->getCutLabel(),"lp"); - if(j==1){ - raiseMax(h_fakeEff); - h_fakeEff->Draw(); - } - else{ - h_fakeEff->Draw("SAME"); - } - } - mySmallText(0.3, 0.9, 1, ctxt); - l->Draw(); - c.SaveAs(VERTDIR + "/h_fakeEff_trackVertex_" + vertCutFlows[i]->getVarName() + ".pdf"); - } - std::cout<<"correctVsFalse"<Clear(); - for(uint k=0; kSetStats(0); - vertexCutFlows[i][k][j]->Scale(1./vertexCutFlows[i][k][j]->Integral()); - TString varString = vertCutFlows[i]->getVarName(); - if(varString.Contains("score")){ - //std::cout<<"/h_correctVsFalse_" + vertCutFlows[i]->getVarName() + "_" + vertCuts[j]->getCutName() + "Cut.pdf"<GetNbinsX()+1); ibin++){ - binValues+=to_string(vertexCutFlows[i][k][j]->GetBinContent(ibin)) + ", "; - } - binValues+="]"; - //std::cout<<"binValues: "<SetLineColor(k+1); - vertexCutFlows[i][k][j]->SetMarkerColor(k+1); - } - else{ - vertexCutFlows[i][k][j]->SetLineColor(40); - vertexCutFlows[i][k][j]->SetMarkerColor(40); - } - l->AddEntry(vertexCutFlows[i][k][j],vertType[k],"l"); - if(k==0){ - removeFlows(vertexCutFlows[i][k+1][j]); - vertexCutFlows[i][k+1][j]->Scale(1./vertexCutFlows[i][k+1][j]->Integral()); - raiseMax(vertexCutFlows[i][k][j],vertexCutFlows[i][k+1][j]); - vertexCutFlows[i][k][j]->Draw("HIST"); - } - else{ - vertexCutFlows[i][k][j]->Draw("HIST,SAME"); - } - } - mySmallText(0.3, 0.9, 1, ctxt); - l->Draw(); - c.SaveAs(VERTDIR + "/h_correctVsFalse_" + vertCutFlows[i]->getVarName() + "_" + vertCuts[j]->getCutName() + "Cut.pdf"); - } - } - std::cout<<"trueVertex_charge_vs_numTPs"<GetYaxis()->SetNoExponent(kTRUE); - removeFlows(h_trueVertex_charge_vs_numTPs); - h_trueVertex_charge_vs_numTPs->SetStats(0); - c.SetLogz(); - h_trueVertex_charge_vs_numTPs->Draw("COLZ"); - mySmallText(0.4, 0.82, 1, ctxt); - c.SaveAs(DIR + "/h_trueVertex_charge_vs_numTPs.pdf"); - delete h_trueVertex_charge_vs_numTPs; - c.SetLogz(0); - - std::cout<<"numSelectedTrks"<GetYaxis()->SetNoExponent(kTRUE); - removeFlows(h_numSelectedTrks); - h_numSelectedTrks->Draw(); - mySmallText(0.4, 0.82, 1, ctxt); - h_numSelectedTrks->Write("", TObject::kOverwrite); - c.SaveAs(DIR + "/"+ h_numSelectedTrks->GetName() + ".pdf"); - h_numSelectedTrks->SetStats(0); - h_numSelectedTrks->Draw(); - mySmallText(0.4, 0.82, 1, ctxt); - c.SaveAs(DIR + "/"+ h_numSelectedTrks->GetName() + "_noStatBox.pdf"); - delete h_numSelectedTrks; - - h_numSelectedTrks_zoomOut->GetYaxis()->SetNoExponent(kTRUE); - removeFlows(h_numSelectedTrks_zoomOut); - h_numSelectedTrks_zoomOut->Draw(); - mySmallText(0.4, 0.82, 1, ctxt); - h_numSelectedTrks_zoomOut->Write("", TObject::kOverwrite); - c.SaveAs(DIR + "/"+ h_numSelectedTrks_zoomOut->GetName() + ".pdf"); - h_numSelectedTrks_zoomOut->SetStats(0); - h_numSelectedTrks_zoomOut->Draw(); - mySmallText(0.4, 0.82, 1, ctxt); - c.SaveAs(DIR + "/"+ h_numSelectedTrks_zoomOut->GetName() + "_noStatBox.pdf"); - delete h_numSelectedTrks_zoomOut; - - std::cout<<"trk H_T"<GetYaxis()->SetNoExponent(kTRUE); - removeFlows(h_trk_H_T); - h_trk_H_T->Draw(); - mySmallText(0.4, 0.82, 1, ctxt); - h_trk_H_T->Write("", TObject::kOverwrite); - c.SaveAs(DIR + "/"+ h_trk_H_T->GetName() + ".pdf"); - delete h_trk_H_T; - - h_trk_oneMatch_H_T->GetYaxis()->SetNoExponent(kTRUE); - removeFlows(h_trk_oneMatch_H_T); - h_trk_oneMatch_H_T->Draw(); - mySmallText(0.4, 0.82, 1, ctxt); - h_trk_oneMatch_H_T->Write("", TObject::kOverwrite); - c.SaveAs(DIR + "/"+ h_trk_oneMatch_H_T->GetName() + ".pdf"); - delete h_trk_oneMatch_H_T; - - std::cout<<"trkMET"<GetYaxis()->SetNoExponent(kTRUE); - removeFlows(h_trk_MET); - h_trk_MET->Draw(); - mySmallText(0.4, 0.82, 1, ctxt); - h_trk_MET->Write("", TObject::kOverwrite); - c.SaveAs(DIR + "/"+ h_trk_MET->GetName() + ".pdf"); - delete h_trk_MET; - - h_trk_oneMatch_MET->GetYaxis()->SetNoExponent(kTRUE); - removeFlows(h_trk_oneMatch_MET); - h_trk_oneMatch_MET->Draw(); - mySmallText(0.4, 0.82, 1, ctxt); - h_trk_oneMatch_MET->Write("", TObject::kOverwrite); - c.SaveAs(DIR + "/"+ h_trk_oneMatch_MET->GetName() + ".pdf"); - delete h_trk_oneMatch_MET; - - std::cout<<"tp HT"<GetYaxis()->SetNoExponent(kTRUE); - removeFlows(h_tp_H_T); - h_tp_H_T->Draw(); - mySmallText(0.4, 0.82, 1, ctxt); - h_tp_H_T->Write("", TObject::kOverwrite); - c.SaveAs(DIR + "/"+ h_tp_H_T->GetName() + ".pdf"); - delete h_tp_H_T; - std::cout<<"tp MET"<GetYaxis()->SetNoExponent(kTRUE); - removeFlows(h_tp_MET); - h_tp_MET->Draw(); - mySmallText(0.4, 0.82, 1, ctxt); - h_tp_MET->Write("", TObject::kOverwrite); - c.SaveAs(DIR + "/"+ h_tp_MET->GetName() + ".pdf"); - delete h_tp_MET; -#if 0 - int numPart = numPart_primary_noCuts.size(); - TH1F *h_numPart_primary_noCuts = new TH1F("h_numPart_primary_noCuts","h_numPart_primary_noCuts; pdgid; Number of Particles",numPart,0,numPart); - TH1F *h_numPart_primary_chi2rzdofCuts = new TH1F("h_numPart_primary_chi2rzdofCuts","h_numPart_primary_chi2rzdofCuts; pdgid; Number of Particles",numPart,0,numPart); - TH1F *h_numPart_primary_bendchi2Cuts = new TH1F("h_numPart_primary_bendchi2Cuts","h_numPart_primary_bendchi2Cuts; pdgid; Number of Particles",numPart,0,numPart); - TH1F *h_numPart_primary_chi2rphidofCuts = new TH1F("h_numPart_primary_chi2rphidofCuts","h_numPart_primary_chi2rphidofCuts; pdgid; Number of Particles",numPart,0,numPart); - TH1F *h_numPart_primary_nstubCuts = new TH1F("h_numPart_primary_nstubCuts","h_numPart_primary_nstubCuts; pdgid; Number of Particles",numPart,0,numPart); - TH1F *h_numPart_primary_ptCuts = new TH1F("h_numPart_primary_ptCuts","h_numPart_primary_ptCuts; pdgid; Number of Particles",numPart,0,numPart); - TH1F *h_numPart_primary_d0Cuts = new TH1F("h_numPart_primary_d0Cuts","h_numPart_primary_d0Cuts; pdgid; Number of Particles",numPart,0,numPart); - TH1F *h_numPart_primary_z0Cuts = new TH1F("h_numPart_primary_z0Cuts","h_numPart_primary_z0Cuts; pdgid; Number of Particles",numPart,0,numPart); - - int binNum = 1; - for(const auto & [key, value] : numPart_primary_noCuts){ - h_numPart_primary_noCuts->SetBinContent(binNum,value); - h_numPart_primary_noCuts->GetXaxis()->SetBinLabel(binNum,key.c_str()); - binNum++; - } - h_numPart_primary_noCuts->GetYaxis()->SetNoExponent(kTRUE); - removeFlows(h_numPart_primary_noCuts); - binNum = 1; - for(const auto & [key, value] : numPart_primary_ptCuts){ - h_numPart_primary_ptCuts->SetBinContent(binNum,value); - h_numPart_primary_ptCuts->GetXaxis()->SetBinLabel(binNum,key.c_str()); - binNum++; - } - h_numPart_primary_ptCuts->GetYaxis()->SetNoExponent(kTRUE); - removeFlows(h_numPart_primary_ptCuts); - binNum = 1; - for(const auto & [key, value] : numPart_primary_d0Cuts){ - h_numPart_primary_d0Cuts->SetBinContent(binNum,value); - h_numPart_primary_d0Cuts->GetXaxis()->SetBinLabel(binNum,key.c_str()); - binNum++; - } - h_numPart_primary_d0Cuts->GetYaxis()->SetNoExponent(kTRUE); - removeFlows(h_numPart_primary_d0Cuts); - binNum = 1; - for(const auto & [key, value] : numPart_primary_chi2rzdofCuts){ - h_numPart_primary_chi2rzdofCuts->SetBinContent(binNum,value); - h_numPart_primary_chi2rzdofCuts->GetXaxis()->SetBinLabel(binNum,key.c_str()); - binNum++; - } - h_numPart_primary_chi2rzdofCuts->GetYaxis()->SetNoExponent(kTRUE); - removeFlows(h_numPart_primary_chi2rzdofCuts); - binNum = 1; - for(const auto & [key, value] : numPart_primary_bendchi2Cuts){ - h_numPart_primary_bendchi2Cuts->SetBinContent(binNum,value); - h_numPart_primary_bendchi2Cuts->GetXaxis()->SetBinLabel(binNum,key.c_str()); - binNum++; - } - h_numPart_primary_bendchi2Cuts->GetYaxis()->SetNoExponent(kTRUE); - removeFlows(h_numPart_primary_bendchi2Cuts); - binNum = 1; - for(const auto & [key, value] : numPart_primary_chi2rphidofCuts){ - h_numPart_primary_chi2rphidofCuts->SetBinContent(binNum,value); - h_numPart_primary_chi2rphidofCuts->GetXaxis()->SetBinLabel(binNum,key.c_str()); - binNum++; - } - h_numPart_primary_chi2rphidofCuts->GetYaxis()->SetNoExponent(kTRUE); - removeFlows(h_numPart_primary_chi2rphidofCuts); - binNum = 1; - for(const auto & [key, value] : numPart_primary_nstubCuts){ - h_numPart_primary_nstubCuts->SetBinContent(binNum,value); - h_numPart_primary_nstubCuts->GetXaxis()->SetBinLabel(binNum,key.c_str()); - binNum++; - } - h_numPart_primary_nstubCuts->GetYaxis()->SetNoExponent(kTRUE); - removeFlows(h_numPart_primary_nstubCuts); - binNum = 1; - for(const auto & [key, value] : numPart_primary_z0Cuts){ - h_numPart_primary_z0Cuts->SetBinContent(binNum,value); - h_numPart_primary_z0Cuts->GetXaxis()->SetBinLabel(binNum,key.c_str()); - binNum++; - } - h_numPart_primary_z0Cuts->GetYaxis()->SetNoExponent(kTRUE); - removeFlows(h_numPart_primary_z0Cuts); - h_numPart_primary_chi2rzdofCuts->SetName("partEff_pt_primary"); - h_numPart_primary_chi2rzdofCuts->GetXaxis()->SetTitle("pdgid"); - h_numPart_primary_chi2rzdofCuts->GetYaxis()->SetTitle("Cut Efficiency"); - h_numPart_primary_chi2rzdofCuts->Divide(h_numPart_primary_chi2rzdofCuts,h_numPart_primary_noCuts,1.0,1.0,"B"); - h_numPart_primary_chi2rzdofCuts->SetLineColor(1); - h_numPart_primary_chi2rzdofCuts->SetMarkerColor(1); - h_numPart_primary_chi2rzdofCuts->SetStats(0); - h_numPart_primary_chi2rzdofCuts->GetYaxis()->SetRangeUser(0,1); - h_numPart_primary_chi2rzdofCuts->GetXaxis()->SetRangeUser(0,numPart); - h_numPart_primary_chi2rzdofCuts->Draw(); - h_numPart_primary_bendchi2Cuts->Divide(h_numPart_primary_bendchi2Cuts,h_numPart_primary_noCuts,1.0,1.0,"B"); - h_numPart_primary_bendchi2Cuts->SetLineColor(2); - h_numPart_primary_bendchi2Cuts->SetMarkerColor(2); - h_numPart_primary_bendchi2Cuts->SetStats(0); - h_numPart_primary_bendchi2Cuts->Draw("SAME"); - h_numPart_primary_chi2rphidofCuts->Divide(h_numPart_primary_chi2rphidofCuts,h_numPart_primary_noCuts,1.0,1.0,"B"); - h_numPart_primary_chi2rphidofCuts->SetLineColor(3); - h_numPart_primary_chi2rphidofCuts->SetMarkerColor(3); - h_numPart_primary_chi2rphidofCuts->SetStats(0); - h_numPart_primary_chi2rphidofCuts->Draw("SAME"); - h_numPart_primary_nstubCuts->Divide(h_numPart_primary_nstubCuts,h_numPart_primary_noCuts,1.0,1.0,"B"); - h_numPart_primary_nstubCuts->SetLineColor(4); - h_numPart_primary_nstubCuts->SetMarkerColor(4); - h_numPart_primary_nstubCuts->SetStats(0); - h_numPart_primary_nstubCuts->Draw("SAME"); - h_numPart_primary_ptCuts->Divide(h_numPart_primary_ptCuts,h_numPart_primary_noCuts,1.0,1.0,"B"); - h_numPart_primary_ptCuts->SetLineColor(5); - h_numPart_primary_ptCuts->SetMarkerColor(5); - h_numPart_primary_ptCuts->SetStats(0); - h_numPart_primary_ptCuts->Draw("SAME"); - h_numPart_primary_d0Cuts->Divide(h_numPart_primary_d0Cuts,h_numPart_primary_noCuts,1.0,1.0,"B"); - h_numPart_primary_d0Cuts->SetLineColor(6); - h_numPart_primary_d0Cuts->SetMarkerColor(6); - h_numPart_primary_d0Cuts->SetStats(0); - h_numPart_primary_d0Cuts->Draw("SAME"); - h_numPart_primary_z0Cuts->Divide(h_numPart_primary_z0Cuts,h_numPart_primary_noCuts,1.0,1.0,"B"); - h_numPart_primary_z0Cuts->SetLineColor(7); - h_numPart_primary_z0Cuts->SetMarkerColor(7); - h_numPart_primary_z0Cuts->SetStats(0); - h_numPart_primary_z0Cuts->Draw("SAME"); - mySmallText(0.4, 0.82, 1, ctxt); - l->Clear(); - l->AddEntry(h_numPart_primary_chi2rzdofCuts,"#chi^{2}_{rz}/d.o.f Cut","lp"); - l->AddEntry(h_numPart_primary_bendchi2Cuts,"#chi^{2}_{bend} Cut","lp"); - l->AddEntry(h_numPart_primary_chi2rphidofCuts,"#chi^{2}_{r#phi}/d.o.f Cut","lp"); - l->AddEntry(h_numPart_primary_nstubCuts,"n_{stub} Cut","lp"); - l->AddEntry(h_numPart_primary_ptCuts,"p_{T} Cut","lp"); - l->AddEntry(h_numPart_primary_d0Cuts,"d_{0} Cut","lp"); - l->AddEntry(h_numPart_primary_z0Cuts,"z_{0} Cut","lp"); - l->Draw(); - c.SaveAs(DIR + "/h_partEffOverlay_pt_primary.pdf"); - delete h_numPart_primary_noCuts; - delete h_numPart_primary_ptCuts; - delete h_numPart_primary_d0Cuts; - delete h_numPart_primary_chi2rzdofCuts; - delete h_numPart_primary_bendchi2Cuts; - delete h_numPart_primary_chi2rphidofCuts; - delete h_numPart_primary_nstubCuts; - delete h_numPart_primary_z0Cuts; - - numPart = numPart_np_noCuts.size(); - TH1F *h_numPart_np_noCuts = new TH1F("h_numPart_np_noCuts","h_numPart_np_noCuts; pdgid; Number of Particles",numPart,0,numPart); - TH1F *h_numPart_np_chi2rzdofCuts = new TH1F("h_numPart_np_chi2rzdofCuts","h_numPart_np_chi2rzdofCuts; pdgid; Number of Particles",numPart,0,numPart); - TH1F *h_numPart_np_bendchi2Cuts = new TH1F("h_numPart_np_bendchi2Cuts","h_numPart_np_bendchi2Cuts; pdgid; Number of Particles",numPart,0,numPart); - TH1F *h_numPart_np_chi2rphidofCuts = new TH1F("h_numPart_np_chi2rphidofCuts","h_numPart_np_chi2rphidofCuts; pdgid; Number of Particles",numPart,0,numPart); - TH1F *h_numPart_np_nstubCuts = new TH1F("h_numPart_np_nstubCuts","h_numPart_np_nstubCuts; pdgid; Number of Particles",numPart,0,numPart); - TH1F *h_numPart_np_ptCuts = new TH1F("h_numPart_np_ptCuts","h_numPart_np_ptCuts; pdgid; Number of Particles",numPart,0,numPart); - TH1F *h_numPart_np_d0Cuts = new TH1F("h_numPart_np_d0Cuts","h_numPart_np_d0Cuts; pdgid; Number of Particles",numPart,0,numPart); - TH1F *h_numPart_np_z0Cuts = new TH1F("h_numPart_np_z0Cuts","h_numPart_np_z0Cuts; pdgid; Number of Particles",numPart,0,numPart); - - binNum = 1; - for(const auto & [key, value] : numPart_np_noCuts){ - h_numPart_np_noCuts->SetBinContent(binNum,value); - h_numPart_np_noCuts->GetXaxis()->SetBinLabel(binNum,key.c_str()); - binNum++; - } - h_numPart_np_noCuts->GetYaxis()->SetNoExponent(kTRUE); - removeFlows(h_numPart_np_noCuts); - binNum = 1; - for(const auto & [key, value] : numPart_np_ptCuts){ - h_numPart_np_ptCuts->SetBinContent(binNum,value); - h_numPart_np_ptCuts->GetXaxis()->SetBinLabel(binNum,key.c_str()); - binNum++; - } - h_numPart_np_ptCuts->GetYaxis()->SetNoExponent(kTRUE); - removeFlows(h_numPart_np_ptCuts); - binNum = 1; - for(const auto & [key, value] : numPart_np_d0Cuts){ - h_numPart_np_d0Cuts->SetBinContent(binNum,value); - h_numPart_np_d0Cuts->GetXaxis()->SetBinLabel(binNum,key.c_str()); - binNum++; - } - h_numPart_np_d0Cuts->GetYaxis()->SetNoExponent(kTRUE); - removeFlows(h_numPart_np_d0Cuts); - binNum = 1; - for(const auto & [key, value] : numPart_np_chi2rzdofCuts){ - h_numPart_np_chi2rzdofCuts->SetBinContent(binNum,value); - h_numPart_np_chi2rzdofCuts->GetXaxis()->SetBinLabel(binNum,key.c_str()); - binNum++; - } - h_numPart_np_chi2rzdofCuts->GetYaxis()->SetNoExponent(kTRUE); - removeFlows(h_numPart_np_chi2rzdofCuts); - binNum = 1; - for(const auto & [key, value] : numPart_np_bendchi2Cuts){ - h_numPart_np_bendchi2Cuts->SetBinContent(binNum,value); - h_numPart_np_bendchi2Cuts->GetXaxis()->SetBinLabel(binNum,key.c_str()); - binNum++; - } - h_numPart_np_bendchi2Cuts->GetYaxis()->SetNoExponent(kTRUE); - removeFlows(h_numPart_np_bendchi2Cuts); - binNum = 1; - for(const auto & [key, value] : numPart_np_chi2rphidofCuts){ - h_numPart_np_chi2rphidofCuts->SetBinContent(binNum,value); - h_numPart_np_chi2rphidofCuts->GetXaxis()->SetBinLabel(binNum,key.c_str()); - binNum++; - } - h_numPart_np_chi2rphidofCuts->GetYaxis()->SetNoExponent(kTRUE); - removeFlows(h_numPart_np_chi2rphidofCuts); - binNum = 1; - for(const auto & [key, value] : numPart_np_nstubCuts){ - h_numPart_np_nstubCuts->SetBinContent(binNum,value); - h_numPart_np_nstubCuts->GetXaxis()->SetBinLabel(binNum,key.c_str()); - binNum++; - } - h_numPart_np_nstubCuts->GetYaxis()->SetNoExponent(kTRUE); - removeFlows(h_numPart_np_nstubCuts); - binNum = 1; - for(const auto & [key, value] : numPart_np_z0Cuts){ - h_numPart_np_z0Cuts->SetBinContent(binNum,value); - h_numPart_np_z0Cuts->GetXaxis()->SetBinLabel(binNum,key.c_str()); - binNum++; - } - h_numPart_np_z0Cuts->GetYaxis()->SetNoExponent(kTRUE); - removeFlows(h_numPart_np_z0Cuts); - h_numPart_np_chi2rzdofCuts->SetName("partEff_pt_np"); - h_numPart_np_chi2rzdofCuts->GetXaxis()->SetTitle("pdgid"); - h_numPart_np_chi2rzdofCuts->GetYaxis()->SetTitle("Cut Efficiency"); - h_numPart_np_chi2rzdofCuts->Divide(h_numPart_np_chi2rzdofCuts,h_numPart_np_noCuts,1.0,1.0,"B"); - h_numPart_np_chi2rzdofCuts->SetLineColor(1); - h_numPart_np_chi2rzdofCuts->SetMarkerColor(1); - h_numPart_np_chi2rzdofCuts->SetStats(0); - h_numPart_np_chi2rzdofCuts->GetYaxis()->SetRangeUser(0,1); - h_numPart_np_chi2rzdofCuts->GetXaxis()->SetRangeUser(0,numPart); - h_numPart_np_chi2rzdofCuts->Draw(); - h_numPart_np_bendchi2Cuts->Divide(h_numPart_np_bendchi2Cuts,h_numPart_np_noCuts,1.0,1.0,"B"); - h_numPart_np_bendchi2Cuts->SetLineColor(2); - h_numPart_np_bendchi2Cuts->SetMarkerColor(2); - h_numPart_np_bendchi2Cuts->SetStats(0); - h_numPart_np_bendchi2Cuts->Draw("SAME"); - h_numPart_np_chi2rphidofCuts->Divide(h_numPart_np_chi2rphidofCuts,h_numPart_np_noCuts,1.0,1.0,"B"); - h_numPart_np_chi2rphidofCuts->SetLineColor(3); - h_numPart_np_chi2rphidofCuts->SetMarkerColor(3); - h_numPart_np_chi2rphidofCuts->SetStats(0); - h_numPart_np_chi2rphidofCuts->Draw("SAME"); - h_numPart_np_nstubCuts->Divide(h_numPart_np_nstubCuts,h_numPart_np_noCuts,1.0,1.0,"B"); - h_numPart_np_nstubCuts->SetLineColor(4); - h_numPart_np_nstubCuts->SetMarkerColor(4); - h_numPart_np_nstubCuts->SetStats(0); - h_numPart_np_nstubCuts->Draw("SAME"); - h_numPart_np_ptCuts->Divide(h_numPart_np_ptCuts,h_numPart_np_noCuts,1.0,1.0,"B"); - h_numPart_np_ptCuts->SetLineColor(5); - h_numPart_np_ptCuts->SetMarkerColor(5); - h_numPart_np_ptCuts->SetStats(0); - h_numPart_np_ptCuts->Draw("SAME"); - h_numPart_np_d0Cuts->Divide(h_numPart_np_d0Cuts,h_numPart_np_noCuts,1.0,1.0,"B"); - h_numPart_np_d0Cuts->SetLineColor(6); - h_numPart_np_d0Cuts->SetMarkerColor(6); - h_numPart_np_d0Cuts->SetStats(0); - h_numPart_np_d0Cuts->Draw("SAME"); - h_numPart_np_z0Cuts->Divide(h_numPart_np_z0Cuts,h_numPart_np_noCuts,1.0,1.0,"B"); - h_numPart_np_z0Cuts->SetLineColor(7); - h_numPart_np_z0Cuts->SetMarkerColor(7); - h_numPart_np_z0Cuts->SetStats(0); - h_numPart_np_z0Cuts->Draw("SAME"); - mySmallText(0.4, 0.82, 1, ctxt); - l->Clear(); - l->AddEntry(h_numPart_np_chi2rzdofCuts,"#chi^{2}_{rz}/d.o.f Cut","lp"); - l->AddEntry(h_numPart_np_bendchi2Cuts,"#chi^{2}_{bend} Cut","lp"); - l->AddEntry(h_numPart_np_chi2rphidofCuts,"#chi^{2}_{r#phi}/d.o.f Cut","lp"); - l->AddEntry(h_numPart_np_nstubCuts,"n_{stub} Cut","lp"); - l->AddEntry(h_numPart_np_ptCuts,"p_{T} Cut","lp"); - l->AddEntry(h_numPart_np_d0Cuts,"d_{0} Cut","lp"); - l->AddEntry(h_numPart_np_z0Cuts,"z_{0} Cut","lp"); - l->Draw(); - c.SaveAs(DIR + "/h_partEffOverlay_pt_np.pdf"); - delete h_numPart_np_noCuts; - delete h_numPart_np_ptCuts; - delete h_numPart_np_d0Cuts; - delete h_numPart_np_chi2rzdofCuts; - delete h_numPart_np_bendchi2Cuts; - delete h_numPart_np_chi2rphidofCuts; - delete h_numPart_np_nstubCuts; - delete h_numPart_np_z0Cuts; -#endif - h_trueVertex_numAllCuts->GetYaxis()->SetNoExponent(kTRUE); - removeFlows(h_trueVertex_numAllCuts); - h_trueVertex_numAllCuts->SetStats(0); - h_trueVertex_numAllCuts->Draw(); - mySmallText(0.4, 0.82, 1, ctxt); - h_trueVertex_numAllCuts->Write("", TObject::kOverwrite); - c.SaveAs(DIR + "/"+ h_trueVertex_numAllCuts->GetName() + ".pdf"); - delete h_trueVertex_numAllCuts; - - h_trackVertexBranch_numAllCuts->GetYaxis()->SetNoExponent(kTRUE); - removeFlows(h_trackVertexBranch_numAllCuts); - c.SetLogy(); - h_trackVertexBranch_numAllCuts->SetStats(0); - h_trackVertexBranch_numAllCuts->Draw(); - mySmallText(0.4, 0.82, 1, ctxt); - h_trackVertexBranch_numAllCuts->Write("", TObject::kOverwrite); - c.SaveAs(DIR + "/"+ h_trackVertexBranch_numAllCuts->GetName() + ".pdf"); - delete h_trackVertexBranch_numAllCuts; - c.SetLogy(0); - std::cout<<"triggerEff"<GetNbinsX()+1); j++){ - numTriggers += vertexNumVertices[i]->GetBinContent(j); - } - std::cout<<"i cut: "<SetBinContent(i,numTriggers/nevt); - h_triggerEff->GetXaxis()->SetBinLabel(i,vertCuts[i]->getCutName()); - } - raiseMax(h_triggerEff); - h_triggerEff->SetStats(0); - h_triggerEff->Draw("HIST, TEXT"); - mySmallText(0.4, 0.82, 1, ctxt); - c.SaveAs(DIR + "/"+ h_triggerEff->GetName() + ".pdf"); - delete h_triggerEff; - for(uint i=0; iFit("fit","R"); - h_res_tp_trk_x->SetStats(0); - h_res_tp_trk_x->Draw(); - rms = fit->GetParameter(2); - sprintf(res, "RMS = %.4f", rms); - mySmallText(0.22, 0.82, 1, res); - mySmallText(0.4, 0.42, 1, ctxt); - h_res_tp_trk_x->Write("", TObject::kOverwrite); - - std::cout<<"h_res_tp_trk_x"<GetNbinsX()+1); ibin++){ - binValues+=to_string(h_res_tp_trk_x->GetBinContent(ibin)) + ", "; - binCenters+=to_string(h_res_tp_trk_x->GetBinCenter(ibin)) + ", "; - fitValues+=to_string(fit->Eval(h_res_tp_trk_x->GetBinCenter(ibin))) + ", "; - } - binValues+="]"; - binCenters+="]"; - fitValues+="]"; - //std::cout<<"binValues: "<GetName() + ".pdf"); - delete h_res_tp_trk_x; - delete fit; - - fit = new TF1("fit", "gaus", -1, 1); - removeFlows(h_res_tp_trk_x_zoomOut); - h_res_tp_trk_x_zoomOut->Fit("fit","R"); - h_res_tp_trk_x_zoomOut->Draw(); - rms = fit->GetParameter(2); - sprintf(res, "RMS = %.4f", rms); - mySmallText(0.22, 0.82, 1, res); - mySmallText(0.4, 0.42, 1, ctxt); - h_res_tp_trk_x_zoomOut->Write("", TObject::kOverwrite); - c.SaveAs(DIR + "/"+ h_res_tp_trk_x_zoomOut->GetName() + ".pdf"); - delete h_res_tp_trk_x_zoomOut; - delete fit; - - fit = new TF1("fit", "gaus", -1, 1); - removeFlows(h_res_tp_trk_y); - h_res_tp_trk_y->Fit("fit","R"); - h_res_tp_trk_y->SetStats(0); - h_res_tp_trk_y->Draw(); - rms = fit->GetParameter(2); - sprintf(res, "RMS = %.4f", rms); - mySmallText(0.22, 0.82, 1, res); - mySmallText(0.4, 0.42, 1, ctxt); - h_res_tp_trk_y->Write("", TObject::kOverwrite); - std::cout<<"h_res_tp_trk_y"<GetNbinsX()+1); ibin++){ - binValues+=to_string(h_res_tp_trk_y->GetBinContent(ibin)) + ", "; - binCenters+=to_string(h_res_tp_trk_y->GetBinCenter(ibin)) + ", "; - fitValues+=to_string(fit->Eval(h_res_tp_trk_y->GetBinCenter(ibin))) + ", "; - } - binValues+="]"; - binCenters+="]"; - fitValues+="]"; - //std::cout<<"binValues: "<GetName() + ".pdf"); - delete h_res_tp_trk_y; - delete fit; - - fit = new TF1("fit", "gaus", -1, 1); - removeFlows(h_res_tp_trk_y_zoomOut); - h_res_tp_trk_y_zoomOut->Fit("fit","R"); - h_res_tp_trk_y_zoomOut->Draw(); - rms = fit->GetParameter(2); - sprintf(res, "RMS = %.4f", rms); - mySmallText(0.22, 0.82, 1, res); - mySmallText(0.4, 0.42, 1, ctxt); - h_res_tp_trk_y_zoomOut->Write("", TObject::kOverwrite); - c.SaveAs(DIR + "/"+ h_res_tp_trk_y_zoomOut->GetName() + ".pdf"); - delete h_res_tp_trk_y_zoomOut; - delete fit; - - fit = new TF1("fit", "gaus", -1, 1); - removeFlows(h_res_tp_trk_r); - h_res_tp_trk_r->Fit("fit"); - h_res_tp_trk_r->Draw(); - rms = fit->GetParameter(2); - sprintf(res, "RMS = %.4f", rms); - mySmallText(0.22, 0.82, 1, res); - mySmallText(0.4, 0.42, 1, ctxt); - h_res_tp_trk_r->Write("", TObject::kOverwrite); - c.SaveAs(DIR + "/"+ h_res_tp_trk_r->GetName() + ".pdf"); - delete h_res_tp_trk_r; - delete fit; - - fit = new TF1("fit", "gaus", -1, 1); - removeFlows(h_res_tp_trk_phi); - h_res_tp_trk_phi->Fit("fit"); - h_res_tp_trk_phi->Draw(); - rms = fit->GetParameter(2); - sprintf(res, "RMS = %.4f", rms); - mySmallText(0.22, 0.82, 1, res); - mySmallText(0.4, 0.42, 1, ctxt); - h_res_tp_trk_phi->Write("", TObject::kOverwrite); - c.SaveAs(DIR + "/"+ h_res_tp_trk_phi->GetName() + ".pdf"); - delete h_res_tp_trk_phi; - delete fit; - - fit = new TF1("fit", "gaus", -10, 10); - removeFlows(h_res_tp_trk_z); - h_res_tp_trk_z->Fit("fit"); - h_res_tp_trk_z->SetStats(0); - h_res_tp_trk_z->Draw(); - rms = fit->GetParameter(2); - sprintf(res, "RMS = %.4f", rms); - mySmallText(0.22, 0.82, 1, res); - mySmallText(0.4, 0.42, 1, ctxt); - h_res_tp_trk_z->Write("", TObject::kOverwrite); - std::cout<<"h_res_tp_trk_z"<GetNbinsX()+1); ibin++){ - binValues+=to_string(h_res_tp_trk_z->GetBinContent(ibin)) + ", "; - binCenters+=to_string(h_res_tp_trk_z->GetBinCenter(ibin)) + ", "; - fitValues+=to_string(fit->Eval(h_res_tp_trk_z->GetBinCenter(ibin))) + ", "; - } - binValues+="]"; - binCenters+="]"; - fitValues+="]"; - //std::cout<<"binValues: "<GetName() + ".pdf"); - delete h_res_tp_trk_z; - delete fit; - - //Geometric plot of circle projections and vertex locations - /*Double_t x_min=0; - Double_t x_max=0; - Double_t y_min=0; - Double_t y_max=0; - Double_t x_values[6] = {geomTrackVertex.a.x0-geomTrackVertex.a.rho,geomTrackVertex.a.x0+geomTrackVertex.a.rho,geomTrackVertex.b.x0-geomTrackVertex.b.rho,geomTrackVertex.b.x0+geomTrackVertex.b.rho,geomTrackVertex.x_dv,geomTrueVertex.x_dv}; - Double_t y_values[6] = {geomTrackVertex.a.y0-geomTrackVertex.a.rho,geomTrackVertex.a.y0+geomTrackVertex.a.rho,geomTrackVertex.b.y0-geomTrackVertex.b.rho,geomTrackVertex.b.y0+geomTrackVertex.b.rho,geomTrackVertex.y_dv,geomTrueVertex.y_dv}; - for(uint i=0;i<6;i++){ - if(x_values[i]x_max) x_max = x_values[i]; - if(y_values[i]y_max) y_max = y_values[i]; - } - x_min*=1.1; - x_max*=1.1; - y_min*=1.1; - y_max*=1.1; - c.DrawFrame(x_min,y_min,x_max,y_max); - float trk1_POCA_x = geomTrackVertex.a.d0*sin(geomTrackVertex.a.phi); - float trk1_POCA_y = -1*geomTrackVertex.a.d0*cos(geomTrackVertex.a.phi); - float trk2_POCA_x = geomTrackVertex.b.d0*sin(geomTrackVertex.b.phi); - float trk2_POCA_y = -1*geomTrackVertex.b.d0*cos(geomTrackVertex.b.phi); - TEllipse *circleTrk1 = new TEllipse(geomTrackVertex.a.x0,geomTrackVertex.a.y0,geomTrackVertex.a.rho,geomTrackVertex.a.rho); - circleTrk1->SetLineColor(kGreen); - circleTrk1->SetFillStyle(0); - TEllipse *circleTrk2 = new TEllipse(geomTrackVertex.b.x0,geomTrackVertex.b.y0,geomTrackVertex.b.rho,geomTrackVertex.b.rho); - circleTrk2->SetLineColor(kBlack); - circleTrk2->SetFillStyle(0); - auto trackTraj1 = new TF1("trackTraj1","((sin([0])/cos([0]))*(x-[1]))+[2]",x_min,x_max); - trackTraj1->SetParameters(geomTrackVertex.a.phi,trk1_POCA_x,trk1_POCA_y); - trackTraj1->SetLineColor(kGreen); - auto trackTraj2 = new TF1("trackTraj2","((sin([0])/cos([0]))*(x-[1]))+[2]",x_min,x_max); - trackTraj2->SetParameters(geomTrackVertex.b.phi,trk2_POCA_x,trk2_POCA_y); - trackTraj2->SetLineColor(kBlack); - TMarker m1(geomTrackVertex.x_dv,geomTrackVertex.y_dv,8); - TMarker m2(geomTrueVertex.x_dv,geomTrueVertex.y_dv,8); - TMarker m3(trk1_POCA_x,trk1_POCA_y,5); - TMarker m4(trk2_POCA_x,trk2_POCA_y,5); - //std::cout<<"trk1 POCA: "<Draw("SAME"); - circleTrk2->Draw("SAME"); - trackTraj1->Draw("SAME"); - trackTraj2->Draw("SAME"); - m1.Draw("SAME"); - m2.Draw("SAME"); - m3.Draw("SAME"); - m4.Draw("SAME"); - c.SaveAs(DIR + "/h_circleFitGeom.pdf"); - c.SaveAs(DIR + "/h_circleFitGeom.pdf"); - x_min = geomTrackVertex.x_dv; - x_max = geomTrueVertex.x_dv; - y_min = geomTrackVertex.y_dv; - y_max = geomTrueVertex.y_dv; - if(geomTrueVertex.x_dvDraw("SAME"); - circleTrk2->Draw("SAME"); - //trackTraj1->Draw("SAME"); - //trackTraj2->Draw("SAME"); - m1.Draw("SAME"); - m2.Draw("SAME"); - m3.Draw("SAME"); - m4.Draw("SAME"); - c.SaveAs(DIR + "/h_circleFitGeomZoom.pdf"); - c.SaveAs(DIR + "/h_circleFitGeomZoom.pdf"); - x_min=geomTrackVertex.x_dv; - x_max=geomTrackVertex.x_dv; - y_min=geomTrackVertex.y_dv; - y_max=geomTrackVertex.y_dv; - Double_t x_values_POCA[4] = {geomTrackVertex.x_dv,geomTrueVertex.x_dv,trk1_POCA_x,trk2_POCA_x}; - Double_t y_values_POCA[4] = {geomTrackVertex.y_dv,geomTrueVertex.y_dv,trk1_POCA_y,trk2_POCA_y}; - for(uint i=0;i<4;i++){ - if(x_values_POCA[i]x_max) x_max = x_values_POCA[i]; - if(y_values_POCA[i]y_max) y_max = y_values_POCA[i]; - } - x_min-=1; - x_max+=1; - y_min-=1; - y_max+=1; - c.DrawFrame(x_min,y_min,x_max,y_max); - circleTrk1->Draw("SAME"); - circleTrk2->Draw("SAME"); - trackTraj1->Draw("SAME"); - trackTraj2->Draw("SAME"); - m1.Draw("SAME"); - m2.Draw("SAME"); - m3.Draw("SAME"); - m4.Draw("SAME"); - c.SaveAs(DIR + "/h_circleFitGeomPOCA.pdf"); - c.SaveAs(DIR + "/h_circleFitGeomPOCA.pdf"); - fout->Close()*/; - - for(uint i=0; ix0; // Centers of the circles - float y1 = a->y0; // - float x2 = b->x0; // - float y2 = b->y0; // - float R1 = a->rho; // Radii of the circles - float R2 = b->rho; - float R = dist(x1,y1,x2,y2); // Distance between centers - if((R>=(R1-R2)) && (R<=(R1+R2))){ - return (0); - } - else if(R==0){ - return (-99999.0); - } - else{ - - return(R-R1-R2); - } -} - -Double_t dist_TPs(Track_Parameters a, Track_Parameters b){ - float x1 = a.x0; // Centers of the circles - float y1 = a.y0; // - float x2 = b.x0; // - float y2 = b.y0; // - float R1 = a.rho; // Radii of the circles - float R2 = b.rho; - float R = dist(x1,y1,x2,y2); // Distance between centers - if((R>=(R1-R2)) && (R<=(R1+R2))){ - return (0); - } - else if(R==0){ - return (-99999.0); - } - else{ - - return(R-R1-R2); - } -} - -Int_t calcVertex(Track_Parameters a, Track_Parameters b, Double_t &x_vtx, Double_t &y_vtx, Double_t &z_vtx){ - float x1 = a.x0; // Centers of the circles - float y1 = a.y0; // - float x2 = b.x0; // - float y2 = b.y0; // - float R1 = a.rho; // Radii of the circles - float R2 = b.rho; - float R = dist(x1,y1,x2,y2); // Distance between centers - if(R==0) return -1; - float co1 = (pow(R1,2)-pow(R2,2))/(2*pow(R,2)); - float radicand = (2/pow(R,2))*(pow(R1,2)+pow(R2,2))-(pow(pow(R1,2)-pow(R2,2),2)/pow(R,4))-1; - float co2 = 0; - if(radicand>0) co2 = 0.5*TMath::Sqrt(radicand); - float ix1_x = 0.5*(x1+x2)+co1*(x2-x1)+co2*(y2-y1); - float ix2_x = 0.5*(x1+x2)+co1*(x2-x1)-co2*(y2-y1); - float ix1_y = 0.5*(y1+y2)+co1*(y2-y1)+co2*(x1-x2); - float ix2_y = 0.5*(y1+y2)+co1*(y2-y1)-co2*(x1-x2); - float ix1_z1 = a.z(ix1_x,ix1_y); - float ix1_z2 = b.z(ix1_x,ix1_y); - float ix1_delz = fabs(ix1_z1-ix1_z2); - float ix2_z1 = a.z(ix2_x,ix2_y); - float ix2_z2 = b.z(ix2_x,ix2_y); - float ix2_delz = fabs(ix2_z1-ix2_z2); - //std::cout<<"R: "<0) ? true : false; - bool trk1_ix2_inTraj = ((trk1_ix2_delxy[0]*trk1_traj[0]+trk1_ix2_delxy[1]*trk1_traj[1])>0) ? true : false; - bool trk2_ix1_inTraj = ((trk2_ix1_delxy[0]*trk2_traj[0]+trk2_ix1_delxy[1]*trk2_traj[1])>0) ? true : false; - bool trk2_ix2_inTraj = ((trk2_ix2_delxy[0]*trk2_traj[0]+trk2_ix2_delxy[1]*trk2_traj[1])>0) ? true : false; - //std::cout<<"ix1 inTraj: "<SetFrameBorderMode(0); - gStyle->SetFrameFillColor(0); - gStyle->SetCanvasBorderMode(0); - gStyle->SetCanvasColor(0); - gStyle->SetPadBorderMode(0); - gStyle->SetPadColor(0); - gStyle->SetStatColor(0); - gStyle->SetHistLineColor(1); - - gStyle->SetPalette(1); - - // set the paper & margin sizes - gStyle->SetPaperSize(20, 26); - gStyle->SetPadTopMargin(0.05); - gStyle->SetPadRightMargin(0.19); - gStyle->SetPadBottomMargin(0.16); - gStyle->SetPadLeftMargin(0.12); - - // set title offsets (for axis label) - gStyle->SetTitleXOffset(1.4); - gStyle->SetTitleYOffset(1.0); - - // use large fonts - gStyle->SetTextFont(42); - gStyle->SetTextSize(0.05); - gStyle->SetLabelFont(42, "x"); - gStyle->SetTitleFont(42, "x"); - gStyle->SetLabelFont(42, "y"); - gStyle->SetTitleFont(42, "y"); - gStyle->SetLabelFont(42, "z"); - gStyle->SetTitleFont(42, "z"); - gStyle->SetLabelSize(0.05, "x"); - gStyle->SetTitleSize(0.05, "x"); - gStyle->SetLabelSize(0.05, "y"); - gStyle->SetTitleSize(0.05, "y"); - gStyle->SetLabelSize(0.05, "z"); - gStyle->SetTitleSize(0.05, "z"); - - // use bold lines and markers - gStyle->SetMarkerStyle(20); - gStyle->SetMarkerSize(1.2); - gStyle->SetHistLineWidth(2.); - gStyle->SetLineStyleString(2, "[12 12]"); - - // get rid of error bar caps - gStyle->SetEndErrorSize(0.); - - // do not display any of the standard histogram decorations - gStyle->SetOptTitle(0); - //gStyle->SetOptStat(0); - gStyle->SetOptFit(0); - - // put tick marks on top and RHS of plots - gStyle->SetPadTickX(1); - gStyle->SetPadTickY(1); -} - -void mySmallText(Double_t x, Double_t y, Color_t color, char *text) -{ - Double_t tsize = 0.044; - TLatex l; - l.SetTextSize(tsize); - l.SetNDC(); - l.SetTextColor(color); - l.DrawLatex(x, y, text); -} - -void removeFlows(TH1F* h) -{ - int nbins = h->GetNbinsX(); - double underflow = h->GetBinContent(0); - double overflow = h->GetBinContent(nbins+1); - h->AddBinContent(1,underflow); - h->AddBinContent(nbins,overflow); - h->SetBinContent(0,0); - h->SetBinContent(nbins+1,0); -} - -void removeFlows(TH2F* h) -{ -}