CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes | Protected Member Functions
HIPTrackMonitorVariables Class Reference

#include <HIPMonitorConfig.h>

Inheritance diagram for HIPTrackMonitorVariables:
HIPMonitorVariables

Public Member Functions

void bookBranches () override
 
void fill () override
 
 HIPTrackMonitorVariables (int maxNEvents_=-1, int maxTracksRcd_=-1)
 
- Public Member Functions inherited from HIPMonitorVariables
 HIPMonitorVariables ()
 
void setTree (TTree *tree_)
 
virtual ~HIPMonitorVariables ()
 

Public Attributes

std::vector< float > m_Chi2n
 
std::vector< float > m_d0
 
std::vector< float > m_dz
 
std::vector< float > m_Eta
 
std::vector< int > m_Nhits
 
std::vector< int > m_nhPXB
 
std::vector< int > m_nhPXF
 
std::vector< int > m_nhTEC
 
std::vector< int > m_nhTIB
 
std::vector< int > m_nhTID
 
std::vector< int > m_nhTOB
 
int m_Ntracks
 
std::vector< float > m_P
 
std::vector< float > m_Phi
 
std::vector< float > m_Pt
 
std::vector< float > m_wt
 
const int maxNEvents
 
const int maxTracksRcd
 
int nEvents
 
int nTracks
 

Protected Member Functions

void resetPerEvent ()
 
void resizeVectors (int NewSize)
 

Additional Inherited Members

- Protected Attributes inherited from HIPMonitorVariables
TTree * tree
 

Detailed Description

Definition at line 22 of file HIPMonitorConfig.h.

Constructor & Destructor Documentation

◆ HIPTrackMonitorVariables()

HIPTrackMonitorVariables::HIPTrackMonitorVariables ( int  maxNEvents_ = -1,
int  maxTracksRcd_ = -1 
)
inline

Definition at line 32 of file HIPMonitorConfig.h.

Member Function Documentation

◆ bookBranches()

void HIPTrackMonitorVariables::bookBranches ( )
overridevirtual

Implements HIPMonitorVariables.

Definition at line 41 of file HIPMonitorConfig.cc.

References m_Chi2n, m_d0, m_dz, m_Eta, m_Nhits, m_nhPXB, m_nhPXF, m_nhTEC, m_nhTIB, m_nhTID, m_nhTOB, m_Ntracks, m_P, m_Phi, m_Pt, and m_wt.

Referenced by HIPAlignmentAlgorithm::bookRoot().

41  {
42  if (tree != nullptr) {
43  tree->Branch("Ntracks", &m_Ntracks);
44  tree->Branch("Nhits", &m_Nhits);
45  //tree->Branch("DataType", &m_datatype); This is done in HIPAlignmentAlgorithm
46  tree->Branch("nhPXB", &m_nhPXB);
47  tree->Branch("nhPXF", &m_nhPXF);
48  tree->Branch("nhTIB", &m_nhTIB);
49  tree->Branch("nhTOB", &m_nhTOB);
50  tree->Branch("nhTID", &m_nhTID);
51  tree->Branch("nhTEC", &m_nhTEC);
52  tree->Branch("Pt", &m_Pt);
53  tree->Branch("P", &m_P);
54  tree->Branch("Eta", &m_Eta);
55  tree->Branch("Phi", &m_Phi);
56  tree->Branch("Chi2n", &m_Chi2n);
57  tree->Branch("d0", &m_d0);
58  tree->Branch("dz", &m_dz);
59  tree->Branch("wt", &m_wt);
60  }
61 }
std::vector< float > m_P
std::vector< int > m_nhTIB
std::vector< float > m_Eta
std::vector< float > m_d0
std::vector< int > m_Nhits
std::vector< float > m_Pt
std::vector< int > m_nhPXB
std::vector< float > m_wt
std::vector< int > m_nhTID
std::vector< float > m_Phi
std::vector< int > m_nhTEC
std::vector< int > m_nhTOB
std::vector< int > m_nhPXF
std::vector< float > m_dz
Definition: tree.py:1
std::vector< float > m_Chi2n

◆ fill()

void HIPTrackMonitorVariables::fill ( )
overridevirtual

Implements HIPMonitorVariables.

Definition at line 74 of file HIPMonitorConfig.cc.

References cuy::doFill, m_Ntracks, m_Pt, maxNEvents, maxTracksRcd, nEvents, nTracks, resetPerEvent(), and resizeVectors().

Referenced by HIPAlignmentAlgorithm::run().

74  {
75  if (tree == nullptr)
76  return;
77  if (maxNEvents >= 0 && nEvents >= maxNEvents)
78  return;
79 
80  bool doFill = false;
81  m_Ntracks = m_Pt.size();
82  if (m_Ntracks == 0)
83  return;
84 
85  if (maxTracksRcd < 0)
86  doFill = true;
87  else if (nTracks < maxTracksRcd) {
88  if ((nTracks + m_Ntracks) < maxTracksRcd)
89  doFill = true;
90  else {
91  int NewSize = maxTracksRcd - nTracks;
92  if ((int)m_Pt.size() < NewSize)
93  NewSize = m_Pt.size();
94 
95  // Do not touch m_Ntracks, just resize these vectors
96  resizeVectors(NewSize);
97 
98  doFill = true;
99  }
100  } else {
101  // Record only m_Ntracks
102  int tmpNtracks = m_Ntracks;
103  resetPerEvent();
104  m_Ntracks = tmpNtracks;
105 
106  doFill = true;
107  }
108 
109  if (doFill) {
110  tree->Fill();
111  nEvents++;
112  nTracks += m_Ntracks;
113  }
114 
115  resetPerEvent();
116 }
std::vector< float > m_Pt
doFill
Definition: cuy.py:575
Definition: tree.py:1
void resizeVectors(int NewSize)

◆ resetPerEvent()

void HIPTrackMonitorVariables::resetPerEvent ( )
inlineprotected

Definition at line 44 of file HIPMonitorConfig.h.

References m_Chi2n, m_d0, m_dz, m_Eta, m_Nhits, m_nhPXB, m_nhPXF, m_nhTEC, m_nhTIB, m_nhTID, m_nhTOB, m_Ntracks, m_P, m_Phi, m_Pt, and m_wt.

Referenced by fill().

44  {
45  // Do not reset nTracks
46  m_Ntracks = 0;
47  m_Pt.clear();
48  m_Eta.clear();
49  m_Phi.clear();
50  m_Chi2n.clear();
51  m_P.clear();
52  m_d0.clear();
53  m_dz.clear();
54  m_wt.clear();
55  m_Nhits.clear();
56  m_nhPXB.clear();
57  m_nhPXF.clear();
58  m_nhTIB.clear();
59  m_nhTOB.clear();
60  m_nhTID.clear();
61  m_nhTEC.clear();
62  }
std::vector< float > m_P
std::vector< int > m_nhTIB
std::vector< float > m_Eta
std::vector< float > m_d0
std::vector< int > m_Nhits
std::vector< float > m_Pt
std::vector< int > m_nhPXB
std::vector< float > m_wt
std::vector< int > m_nhTID
std::vector< float > m_Phi
std::vector< int > m_nhTEC
std::vector< int > m_nhTOB
std::vector< int > m_nhPXF
std::vector< float > m_dz
std::vector< float > m_Chi2n

◆ resizeVectors()

void HIPTrackMonitorVariables::resizeVectors ( int  NewSize)
inlineprotected

Definition at line 63 of file HIPMonitorConfig.h.

References m_Chi2n, m_d0, m_dz, m_Eta, m_Nhits, m_nhPXB, m_nhPXF, m_nhTEC, m_nhTIB, m_nhTID, m_nhTOB, m_P, m_Phi, m_Pt, and m_wt.

Referenced by fill().

63  {
64  m_Pt.resize(NewSize);
65  m_Eta.resize(NewSize);
66  m_Phi.resize(NewSize);
67  m_Chi2n.resize(NewSize);
68  m_P.resize(NewSize);
69  m_d0.resize(NewSize);
70  m_dz.resize(NewSize);
71  m_wt.resize(NewSize);
72  m_Nhits.resize(NewSize);
73  m_nhPXB.resize(NewSize);
74  m_nhPXF.resize(NewSize);
75  m_nhTIB.resize(NewSize);
76  m_nhTOB.resize(NewSize);
77  m_nhTID.resize(NewSize);
78  m_nhTEC.resize(NewSize);
79  }
std::vector< float > m_P
std::vector< int > m_nhTIB
std::vector< float > m_Eta
std::vector< float > m_d0
std::vector< int > m_Nhits
std::vector< float > m_Pt
std::vector< int > m_nhPXB
std::vector< float > m_wt
std::vector< int > m_nhTID
std::vector< float > m_Phi
std::vector< int > m_nhTEC
std::vector< int > m_nhTOB
std::vector< int > m_nhPXF
std::vector< float > m_dz
std::vector< float > m_Chi2n

Member Data Documentation

◆ m_Chi2n

std::vector<float> HIPTrackMonitorVariables::m_Chi2n

◆ m_d0

std::vector<float> HIPTrackMonitorVariables::m_d0

◆ m_dz

std::vector<float> HIPTrackMonitorVariables::m_dz

◆ m_Eta

std::vector<float> HIPTrackMonitorVariables::m_Eta

◆ m_Nhits

std::vector<int> HIPTrackMonitorVariables::m_Nhits

◆ m_nhPXB

std::vector<int> HIPTrackMonitorVariables::m_nhPXB

◆ m_nhPXF

std::vector<int> HIPTrackMonitorVariables::m_nhPXF

◆ m_nhTEC

std::vector<int> HIPTrackMonitorVariables::m_nhTEC

◆ m_nhTIB

std::vector<int> HIPTrackMonitorVariables::m_nhTIB

◆ m_nhTID

std::vector<int> HIPTrackMonitorVariables::m_nhTID

◆ m_nhTOB

std::vector<int> HIPTrackMonitorVariables::m_nhTOB

◆ m_Ntracks

int HIPTrackMonitorVariables::m_Ntracks

Definition at line 28 of file HIPMonitorConfig.h.

Referenced by bookBranches(), fill(), and resetPerEvent().

◆ m_P

std::vector<float> HIPTrackMonitorVariables::m_P

◆ m_Phi

std::vector<float> HIPTrackMonitorVariables::m_Phi

◆ m_Pt

std::vector<float> HIPTrackMonitorVariables::m_Pt

◆ m_wt

std::vector<float> HIPTrackMonitorVariables::m_wt

◆ maxNEvents

const int HIPTrackMonitorVariables::maxNEvents

Definition at line 24 of file HIPMonitorConfig.h.

Referenced by fill().

◆ maxTracksRcd

const int HIPTrackMonitorVariables::maxTracksRcd

Definition at line 25 of file HIPMonitorConfig.h.

Referenced by fill().

◆ nEvents

int HIPTrackMonitorVariables::nEvents

Definition at line 26 of file HIPMonitorConfig.h.

Referenced by fill(), and looper.Looper::loop().

◆ nTracks

int HIPTrackMonitorVariables::nTracks

Definition at line 27 of file HIPMonitorConfig.h.

Referenced by fill().