CMS 3D CMS Logo

HIPMonitorConfig.cc
Go to the documentation of this file.
2 
3 
5 cfgMonitor(cfg.getParameter<edm::ParameterSet>("monitorConfig")),
6 outfilecore(cfgMonitor.getParameter<std::string>("outfile")),
7 maxEventsPerJob(cfgMonitor.getParameter<int>("maxEventsPerJob")),
8 fillTrackMonitoring(cfgMonitor.getParameter<bool>("fillTrackMonitoring")),
9 maxTracks(cfgMonitor.getParameter<int>("maxTracks")),
10 trackmonitorvars(maxEventsPerJob, maxTracks),
11 fillTrackHitMonitoring(cfgMonitor.getParameter<bool>("fillTrackHitMonitoring")),
12 maxHits(cfgMonitor.getParameter<int>("maxHits")),
13 hitmonitorvars(maxHits),
14 eventCounter(0),
15 hitCounter(0)
16 {
17  outfile = cfg.getParameter<std::string>("outpath") + outfilecore;
18 }
19 
21 cfgMonitor(other.cfgMonitor),
25 maxTracks(other.maxTracks),
27 maxHits(other.maxHits),
28 outfile(other.outfile),
31 {}
32 
33 bool HIPMonitorConfig::checkNevents(){ bool res = (maxEventsPerJob<0 || maxEventsPerJob>eventCounter); eventCounter++; return res; }
34 bool HIPMonitorConfig::checkNhits(){ bool res = (maxHits<0 || maxHits>hitCounter); hitCounter++; return res; }
35 
36 
38  if (tree!=nullptr){
39  tree->Branch("Ntracks", &m_Ntracks);
40  tree->Branch("Nhits", &m_Nhits);
41  //tree->Branch("DataType", &m_datatype); This is done in HIPAlignmentAlgorithm
42  tree->Branch("nhPXB", &m_nhPXB);
43  tree->Branch("nhPXF", &m_nhPXF);
44  tree->Branch("nhTIB", &m_nhTIB);
45  tree->Branch("nhTOB", &m_nhTOB);
46  tree->Branch("nhTID", &m_nhTID);
47  tree->Branch("nhTEC", &m_nhTEC);
48  tree->Branch("Pt", &m_Pt);
49  tree->Branch("P", &m_P);
50  tree->Branch("Eta", &m_Eta);
51  tree->Branch("Phi", &m_Phi);
52  tree->Branch("Chi2n", &m_Chi2n);
53  tree->Branch("d0", &m_d0);
54  tree->Branch("dz", &m_dz);
55  tree->Branch("wt", &m_wt);
56  }
57 }
59  if (tree!=nullptr){
60  tree->Branch("Id", &m_detId, "Id/i");
61  tree->Branch("sinTheta", &m_sinTheta);
62  tree->Branch("impactAngle", &m_angle);
63  tree->Branch("wt", &m_hitwt);
64  tree->Branch("probPresent", &m_hasHitProb);
65  tree->Branch("probXY", &m_probXY);
66  tree->Branch("probQ", &m_probQ);
67  tree->Branch("qualityWord", &m_rawQualityWord);
68  }
69 }
71  if (tree==nullptr) return;
72  if (maxNEvents>=0 && nEvents>=maxNEvents) return;
73 
74  bool doFill=false;
75  m_Ntracks=m_Pt.size();
76  if (m_Ntracks==0) return;
77 
78  if (maxTracksRcd<0) doFill=true;
79  else if (nTracks<maxTracksRcd){
80  if ((nTracks+m_Ntracks)<maxTracksRcd) doFill=true;
81  else{
82  int NewSize = maxTracksRcd - nTracks;
83  if ((int)m_Pt.size()<NewSize) NewSize=m_Pt.size();
84 
85  // Do not touch m_Ntracks, just resize these vectors
86  resizeVectors(NewSize);
87 
88  doFill=true;
89  }
90  }
91  else{
92  // Record only m_Ntracks
93  int tmpNtracks = m_Ntracks;
94  resetPerEvent();
95  m_Ntracks=tmpNtracks;
96 
97  doFill=true;
98  }
99 
100  if (doFill){
101  tree->Fill();
102  nEvents++;
103  nTracks+=m_Ntracks;
104  }
105 
106  resetPerEvent();
107 }
109  if (tree==nullptr) return;
110 
111  bool doFill=(maxHitsRcd<0 || nHits<maxHitsRcd);
112 
113  if (doFill){
114  tree->Fill();
115  nHits++;
116  }
117 
118  resetPerHit();
119 }
T getParameter(std::string const &) const
const unsigned int nTracks(const reco::Vertex &sv)
Definition: Electron.h:6
const bool fillTrackHitMonitoring
const edm::ParameterSet cfgMonitor
const int maxEventsPerJob
const bool fillTrackMonitoring
doFill
Definition: cuy.py:575
const std::string outfilecore
HLT enums.
Definition: tree.py:1
UInt_t nEvents
Definition: hcalCalib.cc:42
HIPMonitorConfig(const edm::ParameterSet &cfg)