CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MITConversionUtilities.cc
Go to the documentation of this file.
3 #include "TMath.h"
4 
5 namespace HWWFunctions {
6 
7  bool isMITConversion(HWW& hww, unsigned int elidx,
8  int nWrongHitsMax,
9  float probMin,
10  float dlMin,
11  bool matchCTF,
12  bool requireArbitratedMerged) {
13 
14  unsigned int nconvs = hww.convs_isConverted().size();
15  if(nconvs == 0)
16  return false;
17  bool isGoodConversion = false;
18 
19  for(unsigned int iconv = 0; iconv < nconvs; iconv++) {
20 
21  bool conversionMatchFound = false;
22  for(unsigned int itk = 0; itk < hww.convs_tkidx().at(iconv).size(); itk++) {
23 
24  if(hww.convs_tkalgo().at(iconv)[itk] == reco::TrackBase::gsf && hww.convs_tkidx().at(iconv)[itk] == hww.els_gsftrkidx().at(elidx))
25  conversionMatchFound = true;
26  if(matchCTF) {
27  switch(hww.convs_tkalgo().at(iconv)[itk]) {
36  if(hww.convs_tkidx().at(iconv)[itk] == hww.els_trkidx().at(elidx))
37  conversionMatchFound = true;
38  break;
39  default:
40  break;
41  }
42  }
43 
44  if(conversionMatchFound)
45  break;
46  }
47 
48 
49  if(conversionMatchFound==false)
50  continue;
51 
52  if( TMath::Prob( hww.convs_chi2().at(iconv), (Int_t)hww.convs_ndof().at(iconv) ) > probMin && hww.convs_dl().at(iconv) > dlMin ) isGoodConversion = true;
53  if(requireArbitratedMerged) {
54  if(hww.convs_quality().at(iconv) & 4)
55  isGoodConversion = true;
56  else
57  isGoodConversion = false;
58  }
59 
60  for(unsigned int j = 0; j < hww.convs_nHitsBeforeVtx().at(iconv).size(); j++) {
61  if(hww.convs_nHitsBeforeVtx().at(iconv)[j] > nWrongHitsMax)
62  isGoodConversion = false;
63  }
64 
65  if(isGoodConversion)
66  break;
67 
68 
69  }//loop over convserions
70 
71 
72  return isGoodConversion;
73  }
74 }
bool isMITConversion(HWW &, unsigned int elidx, int nWrongHitsMax, float probMin, float dlMin, bool matchCTF, bool requireArbitratedMerged)
std::vector< int > & els_gsftrkidx()
Definition: HWW.cc:333
std::vector< std::vector< int > > & convs_nHitsBeforeVtx()
Definition: HWW.cc:673
std::vector< std::vector< int > > & convs_tkalgo()
Definition: HWW.cc:665
int j
Definition: DBlmapReader.cc:9
std::vector< float > & convs_chi2()
Definition: HWW.cc:653
std::vector< float > & convs_ndof()
Definition: HWW.cc:649
std::vector< int > & convs_quality()
Definition: HWW.cc:677
std::vector< float > & convs_dl()
Definition: HWW.cc:657
Definition: HWW.h:12
std::vector< int > & convs_isConverted()
Definition: HWW.cc:661
std::vector< std::vector< int > > & convs_tkidx()
Definition: HWW.cc:669
std::vector< int > & els_trkidx()
Definition: HWW.cc:341