CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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

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

Definition at line 227 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().

227  {
228  if (!Config::silent) {
229  std::lock_guard<std::mutex> printlock(Event::printmutex);
230  std::cout << "found tracks=" << m_cnt << " in pT 10%=" << m_cnt1 << " in pT 20%=" << m_cnt2
231  << " no_mc_assoc=" << m_cnt_nomc << std::endl;
232  std::cout << " nH >= 80% =" << m_cnt_8 << " in pT 10%=" << m_cnt1_8 << " in pT 20%=" << m_cnt2_8
233  << std::endl;
234  }
235  }
static std::mutex printmutex
Definition: Event.h:68
tuple cout
Definition: gather_cfg.py:144
void mkfit::StdSeq::Quality::quality_process ( Event event,
Track tkcand,
const int  itrack,
std::map< int, int > &  cmsswLabelToPos 
)

Definition at line 131 of file MkStandaloneSeqs.cc.

References mkfit::TrackBase::chi2(), dprint, mkfit::Config::dumpForPlots, mkfit::TrackExtra::findMatchingSeedHits(), label, mkfit::TrackBase::label(), mkfit::Event::layerHits_, 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(), gpuVertexFinder::printf(), mkfit::Event::printmutex, PVValHelper::pT, mkfit::TrackBase::pT(), mkfit::Config::readCmsswTracks, fileCollector::seed, mkfit::Config::seedInput, mkfit::TrackExtra::setMCTrackIDInfo(), mkfit::Config::silent, mkfit::Event::simHitsInfo_, mkfit::simSeeds, mkfit::Event::simTracks_, mkfit::StdSeq::track_print(), mkfit::TrackBase::x(), and mkfit::TrackBase::y().

Referenced by quality_val().

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

Definition at line 112 of file MkStandaloneSeqs.cc.

References mkfit::Event::candidateTracks_, 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().

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

Member Data Documentation

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

Definition at line 30 of file MkStandaloneSeqs.h.

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

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

Definition at line 30 of file MkStandaloneSeqs.h.

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

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

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

Definition at line 30 of file MkStandaloneSeqs.h.

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

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

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

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