#include <TTrackMC.h>
Public Member Functions | |
bool | charge (void) const |
returns charge matching. | |
bool | charge (void) const |
returns charge matching. | |
void | dump (const std::string &message=std::string(""), const std::string &prefix=std::string("")) const |
dumps debug information. | |
void | dump (const std::string &message=std::string(""), const std::string &prefix=std::string("")) const |
dumps debug information. | |
const TTrackHEP *const | hep (void) const |
returns a pointer to TTrackHEP. | |
const TTrackHEP *const | hep (void) const |
returns a pointer to TTrackHEP. | |
int | hepId (void) const |
returns HEP ID. | |
int | hepId (void) const |
returns HEP ID. | |
double | ptFraction (void) const |
returns pt fraction. | |
double | ptFraction (void) const |
returns pt fraction. | |
double | ptPull (void) const |
returns pull of pt. | |
double | ptPull (void) const |
returns pull of pt. | |
double | ptResidual (void) const |
returns residual of pt. | |
double | ptResidual (void) const |
returns residual of pt. | |
double | pzFraction (void) const |
returns pz fraction. | |
double | pzFraction (void) const |
returns pz fraction. | |
double | pzPull (void) const |
returns pull of pz. | |
double | pzPull (void) const |
returns pull of pz. | |
double | pzResidual (void) const |
returns residual of pz. | |
double | pzResidual (void) const |
returns residual of pz. | |
unsigned | quality (void) const |
returns quality. | |
unsigned | quality (void) const |
returns quality. | |
std::string | qualityString (void) const |
returns quality. | |
std::string | qualityString (void) const |
returns quality. | |
const Hep3Vector & | residual (void) const |
returns residual of momentum. | |
const Hep3Vector & | residual (void) const |
returns residual of momentum. | |
unsigned | state (void) const |
returns state. | |
unsigned | state (void) const |
returns state. | |
void | update (void) |
updates information. | |
void | update (void) |
updates information. | |
double | wireFraction (void) const |
returns wire fraction(F1). | |
double | wireFraction (void) const |
returns wire fraction(F1). | |
double | wireFractionHEP (void) const |
returns wire fraction(F2). | |
double | wireFractionHEP (void) const |
returns wire fraction(F2). | |
virtual | ~TTrackMC () |
Destructor. | |
virtual | ~TTrackMC () |
Destructor. | |
Private Member Functions | |
void | classify (void) |
classifies itself. | |
void | classify (void) |
classifies itself. | |
void | compare (void) |
checks matching of charge. | |
void | compare (void) |
checks matching of charge. | |
TTrackMC (const TTrack &) | |
Constructor. | |
TTrackMC (const TTrack &) | |
Constructor. | |
Private Attributes | |
bool | _charge |
double | _cosOpen |
TTrackHEP * | _hep |
TTrackHEP * | _hep |
int | _hepID |
double | _ptFraction |
double | _ptPull |
double | _ptResidual |
double | _pzFraction |
double | _pzPull |
double | _pzResidual |
unsigned | _quality |
Hep3Vector | _residual |
unsigned | _state |
const TTrack & | _t |
const TTrack & | _t |
double | _wireFraction |
double | _wireFractionHEP |
Friends | |
class | TrkReco |
|
Constructor.
00047 : _t(t), 00048 _hep(0), 00049 _hepID(-1), 00050 _wireFraction(-999.), 00051 _wireFractionHEP(-999.), 00052 _charge(false), 00053 _ptFraction(-999.), 00054 _pzFraction(-999.), 00055 _ptResidual(-999.), 00056 _pzResidual(-999.), 00057 _ptPull(-999.), 00058 _pzPull(-999.), 00059 _state(0), 00060 _quality(0) { 00061 }
|
|
Destructor.
00063 { 00064 }
|
|
Constructor.
|
|
Destructor.
|
|
returns charge matching.
|
|
returns charge matching.
00181 {
00182 return _charge;
00183 }
|
|
classifies itself.
|
|
classifies itself.
00251 { 00252 _state |= TTrackClassified; 00253 _quality = TTrackGarbage; 00254 00255 //...HEP matching... 00256 if (! _hep) return; 00257 _quality |= TTrackHep; 00258 if (fabs(_ptFraction) < .1) _quality |= TTrackPt; 00259 if (fabs(_pzFraction) < .1) _quality |= TTrackPz; 00260 float momResidual = sqrt(_ptResidual * _ptResidual + 00261 _pzResidual * _pzResidual); 00262 00263 if ((momResidual < 0.100) && (_cosOpen > 0.99)) 00264 _quality |= TTrackMatchingLoose; 00265 if ((momResidual < 0.020) && (_cosOpen > 0.998)) 00266 _quality |= TTrackMatchingTight; 00267 00268 //...Wire fraction... 00269 if (_wireFraction < 0.8) return; 00270 _quality |= TTrackWire; 00271 _quality |= TTrackCharge; 00272 00273 //...Charge matching... 00274 if (! _charge) return; 00275 _quality |= TTrackBad; 00276 00277 //...Momentum matching... 00278 if (_quality & TTrackMatchingLoose) 00279 _quality |= TTrackGhost; 00280 00281 //...TTrackGood is set by TrkReco after checking uniqueness... 00282 }
|
|
checks matching of charge.
|
|
checks matching of charge.
00159 { 00160 if (! _hep) return; 00161 00162 //...Get charge of HEP particle(This part should be done by LUCHARGE)... 00163 int id = _hep->pType(); 00164 int aId = abs(id); 00165 if (aId == 11 || aId == 13 || aId == 15) id *= -1; 00166 00167 //...Compare charge... 00168 if ((int) _t.charge() * id > 0) _charge = true; 00169 00170 //...Get hep mom. at the inner-most hit... 00171 // AList<TMLink> list = _t.cores(); 00172 AList<TMLink> list = _t.finalHits(); 00173 unsigned n = list.length(); 00174 bool found = false; 00175 Vector3 pHep; 00176 Vector3 vHep; 00177 for (unsigned i = 0; i < n; i++) { 00178 TMLink * inner = InnerMost(list); 00179 if (inner->hit()->mc()->hep() == _hep) { 00180 pHep = inner->hit()->mc()->momentum(); 00181 vHep = inner->hit()->mc()->entrance(); 00182 found = true; 00183 break; 00184 } 00185 list.remove(inner); 00186 } 00187 Helix hHep = Helix(vHep, pHep, copysign(1., id)); 00188 hHep.pivot(_t.helix().pivot()); 00189 pHep = hHep.momentum(); 00190 00191 //...For debug... 00192 if (! found) { 00193 std::cout << "TTrackMC::compare !!! something wrong with mc hits" 00194 << std::endl; 00195 00196 //...For debug... 00197 // list = _t.cores(); 00198 // for (unsigned i = 0; i < list.length(); i++) { 00199 // TMLink * inner = innerMost(list); 00200 // std::cout << i << " " << inner << ":" << inner->hit()->mc()->hep(); 00201 // std::cout << " " << _hep << std::endl; 00202 // if (inner->hit()->mc()->hep() == _hep) { 00203 // pHep = inner->hit()->mc()->momentum(); 00204 // break; 00205 // } 00206 // list.remove(inner); 00207 // } 00208 // TMLink * t = 0; 00209 // t->hit(); 00210 //...For debug end... 00211 00212 return; 00213 } 00214 00215 //...Fill caches... 00216 _residual = _t.p() - pHep; 00217 _cosOpen = pHep.unit().dot(_t.p().unit()); 00218 00219 //...Compare pt... 00220 double pt = _t.pt(); 00221 double ptHep = sqrt(pHep.x() * pHep.x() + pHep.y() * pHep.y()); 00222 _ptResidual = pt - ptHep; 00223 const Helix & h = _t.helix(); 00224 Vector dPt(5, 0); 00225 dPt[2] = - 1. / (h.kappa() * h.kappa()); 00226 double ptError2 = h.Ea().similarity(dPt); 00227 if(ptError2<0.0) { 00228 std::cout << h.kappa() << " " << h.Ea() << " dPt=" << dPt << std::endl; 00229 } 00230 double ptError = (ptError2 > 0.) ? sqrt(ptError2) : (DBL_MIN); 00231 _ptPull = (ptError2 > 0.) ? (_ptResidual) / ptError : (FLT_MAX); 00232 _ptFraction = (fabs(ptHep)>(FLT_MIN)) ? _ptResidual / ptHep : 0.0; 00233 00234 //...Compare pz... 00235 double pz = _t.pz(); 00236 double pzHep = pHep.z(); 00237 _pzResidual = pz - pzHep; 00238 Vector dPz(5, 0); 00239 dPz[2] = - h.tanl() / (h.kappa() * h.kappa()); 00240 dPz[4] = 1. / h.kappa(); 00241 double pzError2 = h.Ea().similarity(dPz); 00242 if(pzError2<0.0) { 00243 std::cout << h.kappa() << " " << h.Ea() << " dPz=" << dPz << std::endl; 00244 } 00245 double pzError = (pzError2 > 0.) ? sqrt(pzError2) : (DBL_MIN); 00246 _pzPull = (pzError2 > 0.) ? (_pzResidual) / pzError : (FLT_MAX); 00247 _pzFraction = (abs(pzHep)>FLT_MIN) ? (_pzResidual / pzHep) : (FLT_MAX); 00248 }
|
|
dumps debug information.
|
|
dumps debug information.
00141 { 00142 std::cout << msg; 00143 std::cout << _t.name() << ":"; 00144 std::cout << "state=" << _state << ":"; 00145 if (_quality & TTrackGood) std::cout << "good :"; 00146 else if (_quality & TTrackGhost) std::cout << "ghost :"; 00147 else if (_quality & TTrackBad) std::cout << "bad :"; 00148 else if (_quality & TTrackCharge) std::cout << "bad :"; 00149 else if (_quality & TTrackGarbage) std::cout << "garbage:"; 00150 else std::cout << "classification error:"; 00151 bitDisplay(_quality, 23, 15); std::cout << ":"; 00152 std::cout << _hepID << ":"; 00153 std::cout << _wireFraction << "," << _wireFractionHEP << ":"; 00154 std::cout << _ptFraction << "," << _pzFraction; 00155 std::cout << std::endl; 00156 }
|
|
returns a pointer to TTrackHEP.
|
|
returns a pointer to TTrackHEP.
00175 {
00176 return _hep;
00177 }
|
|
returns HEP ID.
|
|
returns HEP ID.
00169 {
00170 return _hepID;
00171 }
|
|
returns pt fraction.
|
|
returns pt fraction.
00187 {
00188 return _ptFraction;
00189 }
|
|
returns pull of pt.
|
|
returns pull of pt.
00241 {
00242 return _ptPull;
00243 }
|
|
returns residual of pt.
|
|
returns residual of pt.
00229 {
00230 return _ptResidual;
00231 }
|
|
returns pz fraction.
|
|
returns pz fraction.
00193 {
00194 return _pzFraction;
00195 }
|
|
returns pull of pz.
|
|
returns pull of pz.
00247 {
00248 return _pzPull;
00249 }
|
|
returns residual of pz.
|
|
returns residual of pz.
00235 {
00236 return _pzResidual;
00237 }
|
|
returns quality.
|
|
returns quality.
00217 {
00218 return _quality;
00219 }
|
|
returns quality.
|
|
returns quality.
00285 { 00286 return TrackMCQualityString(_quality); 00287 }
|
|
returns residual of momentum.
|
|
returns residual of momentum.
00223 {
00224 return _residual;
00225 }
|
|
returns state.
|
|
returns state.
00211 {
00212 return _state;
00213 }
|
|
updates information.
|
|
updates information.
00067 { 00068 _state = 0; 00069 _quality = 0; 00070 /* 00071 //...Prepare counters... 00072 unsigned nHep = TTrackHEP::list().length(); 00073 unsigned nTrk = TrkReco::getTrkReco()->tracks().length(); 00074 unsigned * N1 = (unsigned *) malloc(nHep * sizeof(unsigned)); 00075 float * F1 = (float *) malloc(nHep * sizeof(float)); 00076 unsigned N2 = 0; 00077 for (unsigned i = 0; i < nHep; i++) { 00078 N1[i] = 0; 00079 F1[i] = 0.; 00080 } 00081 00082 //...Prepare for fraction F1... 00083 // const AList<TMLink> & cores = _t.cores(); 00084 const AList<TMLink> & cores = _t.finalHits(); 00085 unsigned nCores = cores.length(); 00086 for (unsigned i = 0; i < nCores; i++) { 00087 TMLink * t = cores[i]; 00088 int hepID = t->hit()->mc()->hep()->id(); 00089 ++N1[hepID]; 00090 } 00091 00092 //...Calculate fraction F1 and find the best HEP... 00093 int bestHep = -1; 00094 TTrackHEP * hep = 0; 00095 float bestF1 = 0.; 00096 for (unsigned i = 0; i < nHep; i++) { 00097 if (nCores) F1[i] = (float) N1[i] / (float) nCores; 00098 if (F1[i] > bestF1) { 00099 bestHep = i; 00100 bestF1 = F1[i]; 00101 } 00102 } 00103 00104 //...Check HEP... 00105 float F2 = 0.; 00106 if (bestHep != -1) { 00107 hep = TTrackHEP::list()[bestHep]; 00108 unsigned nAll = 0; 00109 for (unsigned i = 0; i < hep->hits().length(); i++) { 00110 const TMDCWireHit * hit = hep->hits()[i]->hit(); 00111 if (! hit) continue; 00112 if (hit->state() & WireHitInvalidForFit) continue; 00113 00114 ++nAll; 00115 if (hit->track() == & _t) ++N2; 00116 } 00117 00118 //...Calculate fraction F2... 00119 if (nAll) F2 = (float) N2 / (float) nAll; 00120 } 00121 00122 //...Store results... 00123 _hepID = bestHep; 00124 _hep = hep; 00125 _wireFraction = bestF1; 00126 _wireFractionHEP = F2; 00127 00128 //...Compare charge and momentum... 00129 compare(); 00130 00131 //...Classification... 00132 classify(); 00133 00134 //...Termination... 00135 free(N1); 00136 free(F1); 00137 */ 00138 }
|
|
returns wire fraction(F1).
|
|
returns wire fraction(F1).
00199 {
00200 return _wireFraction;
00201 }
|
|
returns wire fraction(F2).
|
|
returns wire fraction(F2).
00205 {
00206 return _wireFractionHEP;
00207 }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|