CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
JetVertexMain Class Reference

#include <JetVertexMain.h>

Public Member Functions

 JetVertexMain (const edm::ParameterSet &parameters)
 
std::pair< double, bool > Main (const reco::CaloJet &jet, edm::Handle< reco::TrackCollection > tracks, double SIGNAL_V_Z, double SIGNAL_V_Z_Error)
 
 ~JetVertexMain ()
 

Private Member Functions

double DeltaR (double eta1, double eta2, double phi1, double phi2)
 
double Track_Pt (double px, double py)
 

Private Attributes

int Algo
 
double cone_size
 
double cutDeltaZ
 
double cutSigmaZ
 
std::string cutType
 
bool discriminator
 
double threshold
 

Detailed Description

Definition at line 13 of file JetVertexMain.h.

Constructor & Destructor Documentation

◆ JetVertexMain()

JetVertexMain::JetVertexMain ( const edm::ParameterSet parameters)

Definition at line 12 of file JetVertexMain.cc.

References AlCaHLTBitMon_QueryRunRegistry::string, and remoteMonitoring_LASER_era2018_cfg::threshold.

12  {
13  cutSigmaZ = parameters.getParameter<double>("JV_sigmaZ");
14  cutDeltaZ = parameters.getParameter<double>("JV_deltaZ");
15  threshold = parameters.getParameter<double>("JV_alpha_threshold");
16  cone_size = parameters.getParameter<double>("JV_cone_size");
17  Algo = parameters.getParameter<int>("JV_type_Algo");
18  cutType = parameters.getParameter<std::string>("JV_cutType");
19 }
double cutSigmaZ
Definition: JetVertexMain.h:29
double cone_size
Definition: JetVertexMain.h:32
std::string cutType
Definition: JetVertexMain.h:34
double threshold
Definition: JetVertexMain.h:31
Definition: fakeMenu.h:6
double cutDeltaZ
Definition: JetVertexMain.h:30

◆ ~JetVertexMain()

JetVertexMain::~JetVertexMain ( )
inline

Definition at line 17 of file JetVertexMain.h.

17 {};

Member Function Documentation

◆ DeltaR()

double JetVertexMain::DeltaR ( double  eta1,
double  eta2,
double  phi1,
double  phi2 
)
private

Definition at line 88 of file JetVertexMain.cc.

References HLT_2022v12_cff::eta1, HLT_2022v12_cff::eta2, M_PI, and mathSSE::sqrt().

88  {
89  double dphi = fabs(phi1 - phi2);
90  if (dphi > M_PI)
91  dphi = 2 * M_PI - dphi;
92  double deta = fabs(eta1 - eta2);
93  return sqrt(dphi * dphi + deta * deta);
94 }
T sqrt(T t)
Definition: SSEVec.h:19
#define M_PI

◆ Main()

std::pair< double, bool > JetVertexMain::Main ( const reco::CaloJet jet,
edm::Handle< reco::TrackCollection tracks,
double  SIGNAL_V_Z,
double  SIGNAL_V_Z_Error 
)

Definition at line 21 of file JetVertexMain.cc.

References gather_cfg::cout, electronAnalyzer_cfi::DeltaR, L1TPhase2Offline_cfi::DeltaZ, PDWG_TauSkim_cff::discriminator, metsig::jet, pfMETsysShiftCorrections_cfi::parameter, mathSSE::sqrt(), remoteMonitoring_LASER_era2018_cfg::threshold, HLT_2022v12_cff::track, tracks, and common_cff::Var().

Referenced by cms::JetVertexAssociation::produce().

24  {
25  std::pair<double, bool> parameter;
26 
27  double jet_et = jet.et();
28  double jet_phi = jet.phi();
29  double jet_eta = jet.eta();
30 
31  // cout<<"JET: "<<jet_et<<endl;
32  double Pt_jets_X = 0.;
33  double Pt_jets_Y = 0.;
34  double Pt_jets_X_tot = 0.;
35  double Pt_jets_Y_tot = 0.;
36 
37  TrackCollection::const_iterator track = tracks->begin();
38 
39  if (!tracks->empty()) {
40  for (; track != tracks->end(); track++) {
41  double Vertex_Z = track->vz();
42  double Vertex_Z_Error = track->dzError();
43  double track_eta = track->eta();
44  double track_phi = track->phi();
45 
46  if (DeltaR(track_eta, jet_eta, track_phi, jet_phi) < cone_size) {
47  double DeltaZ = Vertex_Z - signal_vert_Z;
48  double DeltaZ_Error = sqrt((Vertex_Z_Error * Vertex_Z_Error) + (signal_vert_z_error * signal_vert_z_error));
49  Pt_jets_X_tot += track->px();
50  Pt_jets_Y_tot += track->py();
51  if (cutType == "sig")
52  discriminator = (fabs(DeltaZ) / DeltaZ_Error) <= cutSigmaZ;
53  else
54  discriminator = fabs(DeltaZ) < cutDeltaZ;
55 
56  if (discriminator) {
57  Pt_jets_X += track->px();
58  Pt_jets_Y += track->py();
59  }
60  }
61  }
62  }
63  double Var = -1;
64 
65  if (Algo == 1)
66  Var = Track_Pt(Pt_jets_X, Pt_jets_Y) / jet_et;
67  else if (Algo == 2) {
68  if (Track_Pt(Pt_jets_X_tot, Pt_jets_Y_tot) != 0)
69  Var = Track_Pt(Pt_jets_X, Pt_jets_Y) / Track_Pt(Pt_jets_X_tot, Pt_jets_Y_tot);
70  else
71  std::cout << "[Jets] JetVertexAssociation: Warning! problems for Algo = 2: possible division by zero .."
72  << std::endl;
73  } else {
74  Var = Track_Pt(Pt_jets_X, Pt_jets_Y) / jet_et;
75  std::cout << "[Jets] JetVertexAssociation: Warning! Algo = " << Algo << " not found; using Algo = 1" << std::endl;
76  }
77 
78  // cout<<"Var = "<<Var<<endl;
79 
80  if (Var >= threshold)
81  parameter = std::pair<double, bool>(Var, true);
82  else
83  parameter = std::pair<double, bool>(Var, false);
84 
85  return parameter;
86 }
double cutSigmaZ
Definition: JetVertexMain.h:29
double DeltaR(double eta1, double eta2, double phi1, double phi2)
double cone_size
Definition: JetVertexMain.h:32
double Track_Pt(double px, double py)
def Var(expr, valtype, compression=None, doc=None, mcOnly=False, precision=-1)
Definition: common_cff.py:20
std::string cutType
Definition: JetVertexMain.h:34
double threshold
Definition: JetVertexMain.h:31
T sqrt(T t)
Definition: SSEVec.h:19
auto const & tracks
cannot be loose
Definition: fakeMenu.h:6
double cutDeltaZ
Definition: JetVertexMain.h:30

◆ Track_Pt()

double JetVertexMain::Track_Pt ( double  px,
double  py 
)
private

Member Data Documentation

◆ Algo

int JetVertexMain::Algo
private

Definition at line 33 of file JetVertexMain.h.

◆ cone_size

double JetVertexMain::cone_size
private

Definition at line 32 of file JetVertexMain.h.

◆ cutDeltaZ

double JetVertexMain::cutDeltaZ
private

Definition at line 30 of file JetVertexMain.h.

◆ cutSigmaZ

double JetVertexMain::cutSigmaZ
private

Definition at line 29 of file JetVertexMain.h.

◆ cutType

std::string JetVertexMain::cutType
private

Definition at line 34 of file JetVertexMain.h.

◆ discriminator

bool JetVertexMain::discriminator
private

Definition at line 35 of file JetVertexMain.h.

◆ threshold

double JetVertexMain::threshold
private

Definition at line 31 of file JetVertexMain.h.

Referenced by utils.StatisticalTest::get_status().