TPerfectFinder Class Reference

A class to find tracks using MC info. More...

#include <TPerfectFinder.h>

Inheritance diagram for TPerfectFinder:

TFinderBase List of all members.

Public Member Functions

 TPerfectFinder (int perfectFitting, float maxSigma, float maxSigmaStereo, unsigned fittingFlag)
 Constructor.
virtual ~TPerfectFinder ()
 Destructor.
std::string name (void) const
 returns name.
std::string version (void) const
 returns version.
void dump (const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
 dumps debug information.
void clear (void)
 clear internal information.
bool perfectFitting (bool)
 gets perfect momentum from MC info.
int doit (const AList< TMDCWireHit > &axialHits, const AList< TMDCWireHit > &stereoHits, AList< TTrack > &tracks, AList< TTrack > &tracks2D)
 finds tracks.
virtual int debugLevel (void) const
 returns debug level.
virtual int debugLevel (int)
 sets debug level.
virtual bool doStereo (bool)
 sets flag to reconstruct 3D.
virtual bool doSalvage (bool)
 sets flag to salvage hits.

Private Member Functions

float charge (int pType) const

Private Attributes

bool _perfectFitting
AList< TMLink_links
float _maxSigma
float _maxSigmaStereo
unsigned _fittingFlag
TBuilder _builder
THelixFitter _fitter

Detailed Description

A class to find tracks using MC info.

Definition at line 28 of file TPerfectFinder.h.


Constructor & Destructor Documentation

TPerfectFinder::TPerfectFinder ( int  perfectFitting,
float  maxSigma,
float  maxSigmaStereo,
unsigned  fittingFlag 
)

Constructor.

Definition at line 21 of file TPerfectFinder.cxx.

00025 : _perfectFitting(perfectFitting),
00026   _builder("conformal builder",
00027            maxSigma,
00028            maxSigmaStereo,
00029            0,
00030            0,
00031            0,
00032            fittingFlag),
00033   _fitter("helix fitter") {
00034 }

TPerfectFinder::~TPerfectFinder (  )  [virtual]

Destructor.

Definition at line 36 of file TPerfectFinder.cxx.

00036                                 {
00037 }


Member Function Documentation

float TPerfectFinder::charge ( int  pType  )  const [private]

Definition at line 209 of file TPerfectFinder.cxx.

Referenced by doit().

00209                                       {
00210     float chg;
00211 
00212     if (pType == 11) chg = -1;
00213     else if (pType == -11) chg = 1;
00214     else if (pType == 13) chg = -1;
00215     else if (pType == -13) chg = 1;
00216     else if (pType == 211) chg = 1;
00217     else if (pType == -211) chg = -1;
00218     else if (pType == 321) chg = 1;
00219     else if (pType == -321) chg = -1;
00220     else if (pType == 2212) chg = 1;
00221     else if (pType == -2212) chg = -1;
00222     else {
00223         std::cout << "TPerfectFinder !!! charge of particle type=";
00224         std::cout << pType << " is unknown" << std::endl;
00225     }
00226 
00227     return chg;
00228 }

void TPerfectFinder::clear ( void   )  [virtual]

clear internal information.

Implements TFinderBase.

Definition at line 204 of file TPerfectFinder.cxx.

References _links.

00204                           {
00205     HepAListDeleteAll(_links);
00206 }

int TFinderBase::debugLevel ( int   )  [inline, virtual, inherited]

sets debug level.

Definition at line 96 of file TFinderBase.h.

References TFinderBase::_debugLevel.

00096                              {
00097     return _debugLevel = a;
00098 }

int TFinderBase::debugLevel ( void   )  const [inline, virtual, inherited]

returns debug level.

Definition at line 90 of file TFinderBase.h.

References TFinderBase::_debugLevel.

Referenced by TConformalFinder0::doit(), TConformalFinder::doit(), TrkReco::initialize(), TConformalFinder0::specialFinding(), and TConformalFinder0::standardFinding().

00090                                   {
00091     return _debugLevel;
00092 }

int TPerfectFinder::doit ( const AList< TMDCWireHit > &  axialHits,
const AList< TMDCWireHit > &  stereoHits,
AList< TTrack > &  tracks,
AList< TTrack > &  tracks2D 
) [virtual]

finds tracks.

Implements TFinderBase.

Definition at line 51 of file TPerfectFinder.cxx.

References _fitter, _links, _perfectFitting, charge(), THelixFitter::fit(), TMDC::getTMDC(), TMDC::hitsMC(), genRecEmupikp::i, ganga-rec::j, TMLink::leftRight(), Helix::pivot(), t(), TMLink::wire(), and TMDCWire::xyPosition().

00054                                                {
00055 
00056     //...Preparations...
00057     static const HepPoint3D dummy(0, 0, 0);
00058     CAList<TMDCWireHit> hits;
00059     hits.append(axialHits);
00060     hits.append(stereoHits);
00061 
00062     //...Make a list of HEP track...
00063     CAList<TTrackHEP> heps;
00064     const unsigned nHits = hits.length();
00065     for (unsigned i = 0; i < nHits; i++) {
00066         const TMDCWireHitMC * const mc = hits[i]->mc();
00067         if (! mc) continue;
00068         const TTrackHEP * const hep = mc->hep();
00069 
00070         if (! hep) continue;
00071         heps.append(hep);
00072     }
00073     heps.purge();
00074 
00075     //...Create tracks...
00076     const AList<TMDCWireHitMC> & mcHits = TMDC::getTMDC()->hitsMC();
00077     const unsigned nHitsMC = mcHits.length();
00078     const unsigned nHeps = heps.length();
00079     for (unsigned i = 0; i < nHeps; i++) {
00080         const TTrackHEP & hep = * heps[i];
00081         const float chg = charge(hep.pType());
00082         AList<TMLink> hepLinks;
00083         HepPoint3D posIn, posOut;
00084         HepVector3D momIn, momOut;
00085         float rMin = 99999;
00086         float rMax = 0.;
00087         TMLink * linkIn;
00088         unsigned lastLayer = 0;
00089         for (unsigned j = 0; j < mcHits.length(); j++) {
00090             const TMDCWireHitMC * const mc = mcHits[j];
00091             if (! mc) continue;
00092             if (! mc->hit()) continue;
00093             if (& hep != mc->hep()) continue;
00094             if (! hits.hasMember(mc->hit())) continue;
00095 
00096             //...Remove hits by curl back...(assuming order of mc hits)
00097             if (mc->wire()->layerId() < lastLayer) break;
00098             lastLayer = mc->wire()->layerId();
00099             HepPoint3D ent = mc->entrance();
00100             HepVector3D dir = mc->direction();
00101             ent.setZ(0.);
00102             dir.setZ(0.);
00103             if ((ent.unit()).dot(dir.unit()) < 0.5) continue;
00104 
00105             //...Hit...
00106             TMLink * l = new TMLink(0, mc->hit(), dummy);
00107             l->leftRight(mc->leftRight());
00108             hepLinks.append(l);
00109             _links.append(l);
00110 
00111             //...Check r to get MC mom...
00112             const float r = ent.mag();
00113             if (r < rMin) {
00114                 posIn = mc->entrance();
00115                 momIn = mc->momentum();
00116                 rMin = r;
00117                 linkIn = l;
00118             }
00119             if (r > rMax) {
00120                 posOut = mc->entrance();
00121                 momOut = mc->momentum();
00122                 rMax = r;
00123             }
00124         }
00125         if (_links.length() == 0) continue;
00126 
00127         //...Do perfect fitting...
00128         TTrack * t = 0;
00129 //          Helix h(posIn, momIn, chg);
00130         Helix h(posOut, momOut, chg);
00131 //          h.pivot(posIn);
00132         h.pivot(linkIn->wire()->xyPosition());
00133         t = new TTrack(h);
00134         t->append(hepLinks);
00135         t->assign(0);
00136 
00137 //          Helix hX(posOut, momOut, chg);
00138         
00139 //          std::cout << "    gen@cdc i = " << h.a() << std::endl;
00140 //          std::cout << "       pivot  = " << h.pivot() << std::endl;
00141 //          std::cout << "       mom    = " << h.momentum() << std::endl;
00142 //          std::cout << "    gen@cdc o = " << hX.a() << std::endl;
00143 //          std::cout << "       pivot  = " << hX.pivot() << std::endl;
00144 //          std::cout << "       mom    = " << hX.momentum() << std::endl;
00145 //          std::cout << "    momOut    = " << momOut << std::endl;
00146 //          std::cout << "    posOut    = " << posOut << std::endl;
00147 //          std::cout << "    ptOut     = " << momOut.perp() << std::endl;
00148 //          std::cout << "    costhOut  = " << momOut.z() / momOut.mag();
00149 //          std::cout << std::endl;
00150 
00151         if (_perfectFitting == 0) {
00152             std::cout << "special test in perfect finder" << std::endl;
00153             AList<TMLink> tmp;
00154             for (unsigned i = 0; i < t->nLinks(); i++) {
00155                 bool rem = false;
00156                 if (t->links()[i]->wire()->name() == "0-56")
00157                     rem = true;
00158                 else if (t->links()[i]->wire()->name() == "2-56")
00159                     rem = true;
00160                 else if (t->links()[i]->wire()->name() == "5-57")
00161                     rem = true;
00162                 else if (t->links()[i]->wire()->name() == "6=68")
00163                     rem = true;
00164                 else if (t->links()[i]->wire()->name() == "7=69")
00165                     rem = true;
00166                 else if (t->links()[i]->wire()->name() == "8=68")
00167                     rem = true;
00168                 else if (t->links()[i]->wire()->name() == "10-85")
00169                     rem = true;
00170                 else if (t->links()[i]->wire()->name() == "20-126")
00171                     rem = true;
00172                 else if (t->links()[i]->wire()->name() == "39-210")
00173                     rem = true;
00174                 else if (t->links()[i]->wire()->name() == "41=221")
00175                     rem = true;
00176                 else if (t->links()[i]->wire()->name() == "43=221")
00177                     rem = true;
00178                 else if (t->links()[i]->wire()->name() == "46-251")
00179                     rem = true;
00180                 else if (t->links()[i]->wire()->name() == "48-251")
00181                     rem = true;
00182                 if (rem) {
00183                     std::cout << t->links()[i]->wire()->name() << " removed" << std::endl;
00184                     tmp.append(* t->links()[i]);
00185                 }
00186             }
00187             t->remove(tmp);
00188             t->dump("detail","@lastHit");
00189             Helix & h = (Helix &) t->helix();
00190             h.pivot(HepVector3D(0., 0., 0.));
00191             t->dump("detail","@origin ");
00192             _fitter.fit(* t);
00193             t->dump("detail","fitted  ");
00194             static const HepVector3D p0(1.226, -1.025, 0.120);
00195             std::cout << "Pdif mag=" << (t->p() - p0).mag() << std::endl;
00196         }
00197 
00198         tracks.append(t);
00199     }
00200     return 0;
00201 }

bool TFinderBase::doSalvage ( bool   )  [inline, virtual, inherited]

sets flag to salvage hits.

Reimplemented in TConformalFinder0.

Definition at line 108 of file TFinderBase.h.

Referenced by TrkReco::initialize().

00108                              {
00109     return a;
00110 }

bool TFinderBase::doStereo ( bool   )  [inline, virtual, inherited]

sets flag to reconstruct 3D.

Reimplemented in TConformalFinder0.

Definition at line 102 of file TFinderBase.h.

Referenced by TrkReco::initialize().

00102                             {
00103     return a;
00104 }

void TPerfectFinder::dump ( const std::string message = std::string(""),
const std::string prefix = std::string("") 
) const [virtual]

dumps debug information.

Reimplemented from TFinderBase.

Definition at line 45 of file TPerfectFinder.cxx.

References TFinderBase::dump().

00045                                                                        {
00046     std::cout << pre;
00047     TFinderBase::dump(msg);
00048 }

std::string TPerfectFinder::name ( void   )  const [inline, virtual]

returns name.

Implements TFinderBase.

Definition at line 90 of file TPerfectFinder.h.

00090                                {
00091     return "Perfect Finder";
00092 }

bool TPerfectFinder::perfectFitting ( bool   )  [inline]

gets perfect momentum from MC info.

Definition at line 96 of file TPerfectFinder.h.

References _perfectFitting.

00096                                      {
00097     return _perfectFitting = a;
00098 }

std::string TPerfectFinder::version ( void   )  const [virtual]

returns version.

Implements TFinderBase.

Definition at line 40 of file TPerfectFinder.cxx.

00040                                   {
00041     return "2.04";
00042 }


Member Data Documentation

TBuilder TPerfectFinder::_builder [private]

Definition at line 73 of file TPerfectFinder.h.

THelixFitter TPerfectFinder::_fitter [private]

Definition at line 74 of file TPerfectFinder.h.

Referenced by doit().

unsigned TPerfectFinder::_fittingFlag [private]

Definition at line 72 of file TPerfectFinder.h.

AList<TMLink> TPerfectFinder::_links [private]

Definition at line 69 of file TPerfectFinder.h.

Referenced by clear(), and doit().

float TPerfectFinder::_maxSigma [private]

Definition at line 70 of file TPerfectFinder.h.

float TPerfectFinder::_maxSigmaStereo [private]

Definition at line 71 of file TPerfectFinder.h.

bool TPerfectFinder::_perfectFitting [private]

Definition at line 68 of file TPerfectFinder.h.

Referenced by doit(), and perfectFitting().


Generated on Tue Nov 29 23:36:08 2016 for BOSS_7.0.2 by  doxygen 1.4.7