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 229 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().

229  {
230  if (!Config::silent) {
231  std::lock_guard<std::mutex> printlock(Event::printmutex);
232  std::cout << "found tracks=" << m_cnt << " in pT 10%=" << m_cnt1 << " in pT 20%=" << m_cnt2
233  << " no_mc_assoc=" << m_cnt_nomc << std::endl;
234  std::cout << " nH >= 80% =" << m_cnt_8 << " in pT 10%=" << m_cnt1_8 << " in pT 20%=" << m_cnt2_8
235  << std::endl;
236  }
237  }
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 133 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::StdSeq::track_print(), mkfit::TrackBase::x(), and mkfit::TrackBase::y().

Referenced by quality_val().

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

114  {
115  quality_reset();
116 
117  std::map<int, int> cmsswLabelToPos;
119  for (size_t itrack = 0; itrack < event->cmsswTracks_.size(); itrack++) {
120  cmsswLabelToPos[event->cmsswTracks_[itrack].label()] = itrack;
121  }
122  }
123 
124  for (size_t itrack = 0; itrack < event->candidateTracks_.size(); itrack++) {
125  quality_process(event, event->candidateTracks_[itrack], itrack, cmsswLabelToPos);
126  }
127 
128  quality_print();
129  }
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().