Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

TPerfectFinder Class Reference

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

#include <TPerfectFinder.h>

Inheritance diagram for TPerfectFinder:

TFinderBase TFinderBase List of all members.

Public Member Functions

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

Private Member Functions

float charge (int pType) const
float charge (int pType) const

Private Attributes

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

Detailed Description

A class to find tracks using MC info.


Constructor & Destructor Documentation

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

Constructor.

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.

00036                                 {
00037 }

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

Constructor.

virtual TPerfectFinder::~TPerfectFinder  )  [virtual]
 

Destructor.


Member Function Documentation

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

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

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.

void TPerfectFinder::clear void   )  [virtual]
 

clear internal information.

Implements TFinderBase.

00204                           {
00205     HepAListDeleteAll(_links);
00206 }

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

sets debug level.

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

returns debug level.

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

sets debug level.

00096                              {
00097     return _debugLevel = a;
00098 }

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

returns debug level.

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.

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

finds tracks.

Implements TFinderBase.

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 }

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

sets flag to salvage hits.

Reimplemented in TConformalFinder0, and TConformalFinder0.

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

sets flag to salvage hits.

Reimplemented in TConformalFinder0, and TConformalFinder0.

00108                              {
00109     return a;
00110 }

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

sets flag to reconstruct 3D.

Reimplemented in TConformalFinder0, and TConformalFinder0.

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

sets flag to reconstruct 3D.

Reimplemented in TConformalFinder0, and TConformalFinder0.

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.

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

dumps debug information.

Reimplemented from TFinderBase.

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

std::string TPerfectFinder::name void   )  const [virtual]
 

returns name.

Implements TFinderBase.

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

returns name.

Implements TFinderBase.

00090                                {
00091     return "Perfect Finder";
00092 }

bool TPerfectFinder::perfectFitting bool   ) 
 

gets perfect momentum from MC info.

bool TPerfectFinder::perfectFitting bool   )  [inline]
 

gets perfect momentum from MC info.

00096                                      {
00097     return _perfectFitting = a;
00098 }

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

returns version.

Implements TFinderBase.

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

returns version.

Implements TFinderBase.

00040                                   {
00041     return "2.04";
00042 }


Member Data Documentation

TBuilder TPerfectFinder::_builder [private]
 

THelixFitter TPerfectFinder::_fitter [private]
 

unsigned TPerfectFinder::_fittingFlag [private]
 

AList<TMLink> TPerfectFinder::_links [private]
 

AList<TMLink> TPerfectFinder::_links [private]
 

float TPerfectFinder::_maxSigma [private]
 

float TPerfectFinder::_maxSigmaStereo [private]
 

bool TPerfectFinder::_perfectFitting [private]
 


The documentation for this class was generated from the following files:
Generated on Wed Feb 2 19:01:09 2011 for BOSS6.5.5 by  doxygen 1.3.9.1