CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes
mkfit::StdSeq::Quality Struct Reference

#include <MkStandaloneSeqs.h>

Public Member Functions

void quality_print ()
 
void quality_process (Event *event, Track &tkcand, const int itrack, std::map< int, int > &cmsswLabelToPos)
 
void quality_reset ()
 
void quality_val (Event *event)
 

Public Attributes

int m_cnt = 0
 
int m_cnt1 = 0
 
int m_cnt1_8 = 0
 
int m_cnt2 = 0
 
int m_cnt2_8 = 0
 
int m_cnt_8 = 0
 
int m_cnt_nomc = 0
 

Detailed Description

Definition at line 29 of file MkStandaloneSeqs.h.

Member Function Documentation

◆ quality_print()

void mkfit::StdSeq::Quality::quality_print ( )

Definition at line 225 of file MkStandaloneSeqs.cc.

References gather_cfg::cout, m_cnt, m_cnt1, m_cnt1_8, m_cnt2, m_cnt2_8, m_cnt_8, m_cnt_nomc, mkfit::Event::printmutex, and mkfit::Config::silent.

Referenced by quality_val().

225  {
226  if (!Config::silent) {
227  std::lock_guard<std::mutex> printlock(Event::printmutex);
228  std::cout << "found tracks=" << m_cnt << " in pT 10%=" << m_cnt1 << " in pT 20%=" << m_cnt2
229  << " no_mc_assoc=" << m_cnt_nomc << std::endl;
230  std::cout << " nH >= 80% =" << m_cnt_8 << " in pT 10%=" << m_cnt1_8 << " in pT 20%=" << m_cnt2_8
231  << std::endl;
232  }
233  }
static std::mutex printmutex
Definition: Event.h:68

◆ quality_process()

void mkfit::StdSeq::Quality::quality_process ( Event event,
Track tkcand,
const int  itrack,
std::map< int, int > &  cmsswLabelToPos 
)

Definition at line 134 of file MkStandaloneSeqs.cc.

References mkfit::TrackBase::chi2(), dprint, mkfit::Config::dumpForPlots, mkfit::TrackExtra::findMatchingSeedHits(), label, mkfit::TrackBase::label(), m_cnt, m_cnt1, m_cnt1_8, m_cnt2, m_cnt2_8, m_cnt_8, m_cnt_nomc, mkfit::TrackExtra::mcTrackID(), mkfit::TrackBase::momEta(), mkfit::TrackBase::momPhi(), mkfit::Track::nFoundHits(), mkfit::Event::printmutex, pv::pT, mkfit::TrackBase::pT(), mkfit::Config::readCmsswTracks, fileCollector::seed, mkfit::Config::seedInput, mkfit::TrackExtra::setMCTrackIDInfo(), mkfit::Config::silent, mkfit::simSeeds, mkfit::TrackBase::x(), and mkfit::TrackBase::y().

Referenced by quality_val().

134  {
135  // KPM: Do not use this method for validating CMSSW tracks if we ever build a DumbCMSSW function for them to print out...
136  // as we would need to access seeds through map of seed ids...
137 
138  // initialize track extra (input original seed label)
139  const auto label = tkcand.label();
140  TrackExtra extra(label);
141 
142  // track_print(event, tkcand, "quality_process -> track_print:");
143 
144  // access temp seed trk and set matching seed hits
145  const auto &seed = event->seedTracks_[itrack];
146  extra.findMatchingSeedHits(tkcand, seed, event->layerHits_);
147 
148  // set mcTrackID through 50% hit matching after seed
149  extra.setMCTrackIDInfo(
150  tkcand, event->layerHits_, event->simHitsInfo_, event->simTracks_, false, (Config::seedInput == simSeeds));
151  const int mctrk = extra.mcTrackID();
152 
153  // int mctrk = tkcand.label(); // assumes 100% "efficiency"
154 
155  const float pT = tkcand.pT();
156  float pTmc = 0.f, etamc = 0.f, phimc = 0.f;
157  float pTr = 0.f;
158  int nfoundmc = -1;
159 
160  if (mctrk < 0 || static_cast<size_t>(mctrk) >= event->simTracks_.size()) {
161  ++m_cnt_nomc;
162  dprint("XX bad track idx " << mctrk << ", orig label was " << label);
163  } else {
164  auto &simtrack = event->simTracks_[mctrk];
165  pTmc = simtrack.pT();
166  etamc = simtrack.momEta();
167  phimc = simtrack.momPhi();
168  pTr = pT / pTmc;
169 
170  nfoundmc = simtrack.nUniqueLayers();
171 
172  ++m_cnt;
173  if (pTr > 0.9 && pTr < 1.1)
174  ++m_cnt1;
175  if (pTr > 0.8 && pTr < 1.2)
176  ++m_cnt2;
177 
178  if (tkcand.nFoundHits() >= 0.8f * nfoundmc) {
179  ++m_cnt_8;
180  if (pTr > 0.9 && pTr < 1.1)
181  ++m_cnt1_8;
182  if (pTr > 0.8 && pTr < 1.2)
183  ++m_cnt2_8;
184  }
185 
186  // perl -ne 'print if m/FOUND_LABEL\s+[-\d]+/o;' | sort -k2 -n
187  // grep "FOUND_LABEL" | sort -n -k 8,8 -k 2,2
188  // printf("FOUND_LABEL %6d pT_mc= %8.2f eta_mc= %8.2f event= %d\n", label, pTmc, etamc, event->evtID());
189  }
190 
191  float pTcmssw = 0.f, etacmssw = 0.f, phicmssw = 0.f;
192  int nfoundcmssw = -1;
194  if (cmsswLabelToPos.count(label)) {
195  auto &cmsswtrack = event->cmsswTracks_[cmsswLabelToPos[label]];
196  pTcmssw = cmsswtrack.pT();
197  etacmssw = cmsswtrack.momEta();
198  phicmssw = cmsswtrack.swimPhiToR(tkcand.x(), tkcand.y()); // to get rough estimate of diff in phi
199  nfoundcmssw = cmsswtrack.nUniqueLayers();
200  }
201  }
202 
204  std::lock_guard<std::mutex> printlock(Event::printmutex);
205  printf(
206  "MX - found track with chi2= %6.3f nFoundHits= %2d pT= %7.4f eta= %7.4f phi= %7.4f nfoundmc= %2d pTmc= "
207  "%7.4f etamc= %7.4f phimc= %7.4f nfoundcmssw= %2d pTcmssw= %7.4f etacmssw= %7.4f phicmssw= %7.4f lab= %d\n",
208  tkcand.chi2(),
209  tkcand.nFoundHits(),
210  pT,
211  tkcand.momEta(),
212  tkcand.momPhi(),
213  nfoundmc,
214  pTmc,
215  etamc,
216  phimc,
217  nfoundcmssw,
218  pTcmssw,
219  etacmssw,
220  phicmssw,
221  label);
222  }
223  }
char const * label
static std::mutex printmutex
Definition: Event.h:68
#define dprint(x)
Definition: Debug.h:95
Definition: event.py:1

◆ quality_reset()

void mkfit::StdSeq::Quality::quality_reset ( )

◆ quality_val()

void mkfit::StdSeq::Quality::quality_val ( Event event)

Definition at line 115 of file MkStandaloneSeqs.cc.

References mkfit::Config::dumpForPlots, quality_print(), quality_process(), quality_reset(), and mkfit::Config::readCmsswTracks.

Referenced by mkfit::runBtpCe_MultiIter(), mkfit::runBuildingTestPlexBestHit(), mkfit::runBuildingTestPlexCloneEngine(), and mkfit::runBuildingTestPlexStandard().

115  {
116  quality_reset();
117 
118  std::map<int, int> cmsswLabelToPos;
120  for (size_t itrack = 0; itrack < event->cmsswTracks_.size(); itrack++) {
121  cmsswLabelToPos[event->cmsswTracks_[itrack].label()] = itrack;
122  }
123  }
124 
125  for (size_t itrack = 0; itrack < event->candidateTracks_.size(); itrack++) {
126  quality_process(event, event->candidateTracks_[itrack], itrack, cmsswLabelToPos);
127  }
128 
129  quality_print();
130  }
void quality_process(Event *event, Track &tkcand, const int itrack, std::map< int, int > &cmsswLabelToPos)
Definition: event.py:1

Member Data Documentation

◆ m_cnt

int mkfit::StdSeq::Quality::m_cnt = 0

Definition at line 30 of file MkStandaloneSeqs.h.

Referenced by quality_print(), quality_process(), and quality_reset().

◆ m_cnt1

int mkfit::StdSeq::Quality::m_cnt1 = 0

Definition at line 30 of file MkStandaloneSeqs.h.

Referenced by quality_print(), quality_process(), and quality_reset().

◆ m_cnt1_8

int mkfit::StdSeq::Quality::m_cnt1_8 = 0

Definition at line 30 of file MkStandaloneSeqs.h.

Referenced by quality_print(), quality_process(), and quality_reset().

◆ m_cnt2

int mkfit::StdSeq::Quality::m_cnt2 = 0

Definition at line 30 of file MkStandaloneSeqs.h.

Referenced by quality_print(), quality_process(), and quality_reset().

◆ m_cnt2_8

int mkfit::StdSeq::Quality::m_cnt2_8 = 0

Definition at line 30 of file MkStandaloneSeqs.h.

Referenced by quality_print(), quality_process(), and quality_reset().

◆ m_cnt_8

int mkfit::StdSeq::Quality::m_cnt_8 = 0

Definition at line 30 of file MkStandaloneSeqs.h.

Referenced by quality_print(), quality_process(), and quality_reset().

◆ m_cnt_nomc

int mkfit::StdSeq::Quality::m_cnt_nomc = 0

Definition at line 30 of file MkStandaloneSeqs.h.

Referenced by quality_print(), quality_process(), and quality_reset().