CMS 3D CMS Logo

HIPMonitorConfig.cc
Go to the documentation of this file.
2 
4  : cfgMonitor(cfg.getParameter<edm::ParameterSet>("monitorConfig")),
5  outfilecore(cfgMonitor.getParameter<std::string>("outfile")),
6  maxEventsPerJob(cfgMonitor.getParameter<int>("maxEventsPerJob")),
7  fillTrackMonitoring(cfgMonitor.getParameter<bool>("fillTrackMonitoring")),
8  maxTracks(cfgMonitor.getParameter<int>("maxTracks")),
9  trackmonitorvars(maxEventsPerJob, maxTracks),
10  fillTrackHitMonitoring(cfgMonitor.getParameter<bool>("fillTrackHitMonitoring")),
11  maxHits(cfgMonitor.getParameter<int>("maxHits")),
12  hitmonitorvars(maxHits),
13  eventCounter(0),
14  hitCounter(0) {
15  outfile = cfg.getParameter<std::string>("outpath") + outfilecore;
16 }
17 
19  : cfgMonitor(other.cfgMonitor),
20  outfilecore(other.outfilecore),
21  maxEventsPerJob(other.maxEventsPerJob),
22  fillTrackMonitoring(other.fillTrackMonitoring),
24  fillTrackHitMonitoring(other.fillTrackHitMonitoring),
27  eventCounter(other.eventCounter),
28  hitCounter(other.hitCounter) {}
29 
31  bool res = (maxEventsPerJob < 0 || maxEventsPerJob > eventCounter);
32  eventCounter++;
33  return res;
34 }
36  bool res = (maxHits < 0 || maxHits > hitCounter);
37  hitCounter++;
38  return res;
39 }
40 
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 }
63  if (tree != nullptr) {
64  tree->Branch("Id", &m_detId, "Id/i");
65  tree->Branch("sinTheta", &m_sinTheta);
66  tree->Branch("impactAngle", &m_angle);
67  tree->Branch("wt", &m_hitwt);
68  tree->Branch("probPresent", &m_hasHitProb);
69  tree->Branch("probXY", &m_probXY);
70  tree->Branch("probQ", &m_probQ);
71  tree->Branch("qualityWord", &m_rawQualityWord);
72  }
73 }
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 }
118  if (tree == nullptr)
119  return;
120 
121  bool doFill = (maxHitsRcd < 0 || nHits < maxHitsRcd);
122 
123  if (doFill) {
124  tree->Fill();
125  nHits++;
126  }
127 
128  resetPerHit();
129 }
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
Definition: Electron.h:6
std::vector< float > m_Pt
void bookBranches() override
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
unsigned int m_rawQualityWord
doFill
Definition: cuy.py:575
std::vector< int > m_nhTOB
const std::string outfilecore
void bookBranches() override
maxTracks
Definition: DMR_cfg.py:158
HLT enums.
std::vector< int > m_nhPXF
std::vector< float > m_dz
Definition: tree.py:1
void resizeVectors(int NewSize)
HIPMonitorConfig(const edm::ParameterSet &cfg)
std::vector< float > m_Chi2n