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

VertexFinder Class Reference

#include <VertexFinder.h>

List of all members.

Public Member Functions

 VertexFinder (CandEventHandle *ceh, const VldContext *vld)
virtual ~VertexFinder ()
Int_t FindVertex ()
Float_t VtxX ()
Float_t VtxY ()
Float_t VtxZ ()
Float_t VtxU ()
Float_t VtxV ()
Int_t VtxPlane ()

Private Member Functions

Int_t FindVtxPlane ()
Int_t FindVtxUV ()
Int_t CheckTrackInfo ()
Int_t AcceptTrackInfo ()

Private Attributes

Int_t kNPlanes
const VldContextfVld
CandEventHandlefCeh
Int_t kUVPlanesBefore
Int_t kUVPlanesAfter
Float_t kNoiseCut
Float_t fTotalEnergy
Float_t fX
Float_t fY
Float_t fZ
Float_t fU
Float_t fV
Int_t fPlane


Constructor & Destructor Documentation

VertexFinder::VertexFinder CandEventHandle ceh,
const VldContext vld
 

Definition at line 28 of file VertexFinder.cxx.

References fCeh, fPlane, fTotalEnergy, fU, fV, fVld, fX, fY, kNoiseCut, kNPlanes, kUVPlanesAfter, kUVPlanesBefore, and MSG.

00029 {
00030    kUVPlanesBefore = 4;
00031    kUVPlanesAfter = 5;
00032    kNoiseCut = 2.0;
00033 
00034    fTotalEnergy = 0;
00035 
00036    fCeh=ceh;
00037    fVld = vldptr;
00038    fX = fY = fU = fV = fPlane = 0;
00039    kNPlanes = 0;
00040 
00041 
00042    if(vldptr->GetDetector() == Detector::kFar)
00043        kNPlanes = 486;
00044 
00045    if(vldptr->GetDetector() == Detector::kNear)
00046        kNPlanes = 285;
00047 
00048    if(vldptr->GetDetector() == Detector::kCalDet)
00049       kNPlanes = 64;
00050 
00051    if(kNPlanes == 0){
00052       MSG("VertexFinder",Msg::kError)
00053          <<"Detector Type is  "<<vldptr->GetDetector()
00054          <<":  VertexFinder only designed for work in Near or Far Det"<<endl;
00055    } 
00056 }

VertexFinder::~VertexFinder  )  [virtual]
 

Definition at line 59 of file VertexFinder.cxx.

00059                            {
00060 }


Member Function Documentation

Int_t VertexFinder::AcceptTrackInfo  )  [private]
 

Definition at line 247 of file VertexFinder.cxx.

References fCeh, fPlane, fU, fV, CandRecoHandle::GetBegPlane(), CandRecoHandle::GetEndPlane(), CandEventHandle::GetPrimaryTrack(), CandRecoHandle::GetVtxU(), CandRecoHandle::GetVtxV(), and MSG.

Referenced by FindVertex().

00248 {
00249    CandTrackHandle * track = fCeh->GetPrimaryTrack();
00250    if(track == 0) {
00251       MSG("VertexFinder",Msg::kError)<<"No track present, but trying to "
00252              <<"accept track info anyway - should NOT be possible"<<endl;
00253    } 
00254 
00255    Int_t plane = TMath::Min(track->GetBegPlane(), track->GetEndPlane());
00256    fU = track->GetVtxU();
00257    fV = track->GetVtxV();
00258    fPlane = plane;
00259 
00260    return 1;
00261 }

Int_t VertexFinder::CheckTrackInfo  )  [private]
 

Definition at line 213 of file VertexFinder.cxx.

References fCeh, CandRecoHandle::GetBegPlane(), CandRecoHandle::GetEndPlane(), CandRecoHandle::GetNPlane(), CandTrackHandle::GetNTrackPlane(), CandFitTrackHandle::GetPass(), and CandEventHandle::GetPrimaryTrack().

Referenced by FindVertex().

00214 {
00215   CandTrackHandle * track = fCeh->GetPrimaryTrack();
00216   CandFitTrackHandle *fittrack = 0;
00217                                                                                 
00218   Int_t pass = 0;
00219   Int_t plane = 0;
00220   if(track){
00221      if (track->InheritsFrom("CandFitTrackHandle")) {
00222         fittrack = dynamic_cast<CandFitTrackHandle*>(track);
00223         pass = fittrack->GetPass();
00224      }
00225 
00226      Float_t nTrackPlane = static_cast<Float_t>(track->GetNPlane());
00227      Float_t nTrackLike = static_cast<Float_t>(track->GetNTrackPlane());
00228      plane = TMath::Min(track->GetBegPlane(), track->GetEndPlane());
00229        
00230      if(plane < 5 && nTrackPlane > 10) return 1;
00231 
00232      if(pass==1){
00233        if(track->GetNPlane()>45) return 1;
00234                                                                        
00235        Float_t ratio=0;
00236        if(nTrackPlane>0)  ratio = nTrackLike/nTrackPlane;
00237 
00238        if(track->GetNPlane() > 10  && ratio > 0.92)
00239           return 1;
00240 
00241      }
00242   }
00243 
00244   return 0;
00245 }

Int_t VertexFinder::FindVertex  ) 
 

Definition at line 63 of file VertexFinder.cxx.

References AcceptTrackInfo(), CheckTrackInfo(), fCeh, FindVtxPlane(), FindVtxUV(), fPlane, fU, fV, fVld, fX, fY, fZ, VldContext::GetDetector(), UgliGeomHandle::GetSteelPlnHandle(), UgliSteelPlnHandle::GetZ0(), kNPlanes, and MSG.

Referenced by AlgEventSR::RunAlg().

00064 {
00065   if(!fCeh || kNPlanes == 0) return -1;
00066  
00067   Int_t retval = FindVtxPlane();
00068   if(retval < 0) return retval; 
00069   FindVtxUV();
00070   
00071   if(CheckTrackInfo()) {
00072       AcceptTrackInfo();
00073       MSG("VertexFinder",Msg::kDebug)<<"Taking trk vtx"<<endl;
00074   }else{
00075     MSG("VertexFinder",Msg::kDebug)<<"Rejected trk vtx"<<endl;
00076   }
00077 
00078   //One Plane subtraction  
00079   if(fPlane>0){
00080     fPlane--;
00081   }
00082     
00083   if(fPlane >=0){
00084     UgliGeomHandle ugh(*fVld);
00085     PlexPlaneId plnid(fVld->GetDetector(),fPlane,true);
00086     UgliSteelPlnHandle usph = ugh.GetSteelPlnHandle(plnid);
00087     fZ = usph.GetZ0();
00088                                                                                
00089     fX = (sqrt(2.0)/2.0)*(fU - fV);
00090     fY = (sqrt(2.0)/2.0)*(fU + fV);
00091   }
00092   else return -1;
00093   
00094   return 1;
00095 }

Int_t VertexFinder::FindVtxPlane  )  [private]
 

Definition at line 98 of file VertexFinder.cxx.

References VtxClusterList::Clear(), fCeh, fPlane, fTotalEnergy, CandStripHandle::GetCharge(), CandHandle::GetDaughterIterator(), CandStripHandle::GetPlane(), kNoiseCut, kNPlanes, MSG, and VtxClusterList::Process().

Referenced by FindVertex().

00099 {
00100   if(!fCeh) return -1;
00101   Int_t retval = 1;
00102                                                                              
00103   fTotalEnergy = 0;
00104   Float_t trimEnergy = 0;
00105                                                                              
00106   vector<Float_t> longEnergy(kNPlanes, 0);
00107   TIter stripItr(fCeh->GetDaughterIterator());
00108   while (CandStripHandle *strip = 
00109                  dynamic_cast<CandStripHandle*> (stripItr())) {
00110       Double_t charge = strip->GetCharge(CalDigitType::kPE);
00111       if(charge > kNoiseCut){
00112            longEnergy[strip->GetPlane()] += charge;
00113            trimEnergy += charge;
00114      }
00115      fTotalEnergy += charge;
00116   }
00117     
00118   if(trimEnergy == 0){
00119     MSG("VertexFinder",Msg::kError)
00120            <<"Zero Energy event, I declare that bad"<<endl;
00121     return -5;
00122   }
00123 
00124   VtxClusterList* vcl = new VtxClusterList(longEnergy, kNPlanes, kNoiseCut);
00125   fPlane = vcl->Process();
00126 //  MSG("VertexFinder",Msg::kDebug)<<"Reporting "<<vcl->Report();
00127   vcl->Clear();
00128   delete vcl;                                                            
00129 
00130   return retval;
00131 }

Int_t VertexFinder::FindVtxUV  )  [private]
 

Definition at line 134 of file VertexFinder.cxx.

References fCeh, fPlane, fU, fV, CandStripHandle::GetCharge(), CandHandle::GetDaughterIterator(), CandStripHandle::GetPlane(), CandStripHandle::GetPlaneView(), CandStripHandle::GetTPos(), kNoiseCut, kUVPlanesAfter, kUVPlanesBefore, and MSG.

Referenced by FindVertex().

00135 {
00136   Int_t retval = 1;
00137 
00138   Int_t nbins = 200;
00139   Float_t start = -5.0;
00140   Float_t end = 5.0;
00141   
00142   TH1F *tenestu = new TH1F("tenestu","TE (U view)", nbins, start, end);
00143   TH1F *tenestv = new TH1F("tenestv","TE (V view)", nbins, start, end);
00144   TH1F *tenestuAll = new TH1F("tenestu all","TE(U)", nbins, start, end);
00145   TH1F *tenestvAll = new TH1F("tenestv all","TE(V)", nbins, start, end);
00146   TH1F *tenestuBackup = new TH1F("tenestu backup","TE(U)", nbins, start, end);
00147   TH1F *tenestvBackup = new TH1F("tenestv backup","TE(V)", nbins, start, end);
00148 
00149   bool inRange = false;
00150   Float_t delta = -1;
00151 
00152   TIter stripItr(fCeh->GetDaughterIterator());    
00153                                                             
00154   stripItr.Reset();
00155   while (CandStripHandle *strip = dynamic_cast<CandStripHandle*>
00156          (stripItr())) {
00157     Double_t charge = strip->GetCharge(CalDigitType::kPE);
00158     MSG("VertexFinder",Msg::kDebug)<<"charge deposit:"
00159                  <<charge<<"    "<<strip->GetPlane()<<"    "<<endl;
00160 
00161     if(charge > kNoiseCut){
00162       delta = strip->GetPlane()-fPlane;
00163       inRange = false;
00164       if((delta <= 0 && fabs(delta) < kUVPlanesBefore) ||
00165            (delta >= 0 && fabs(delta) < kUVPlanesAfter)){
00166               inRange = true;
00167       }
00168                                                                        
00169       if(strip->GetPlaneView()==PlaneView::kU){
00170         tenestuAll->Fill(strip->GetTPos(),charge);
00171         if(inRange)   tenestu->Fill(strip->GetTPos(),charge);
00172       }
00173       else if(strip->GetPlaneView()==PlaneView::kV){
00174         tenestvAll->Fill(strip->GetTPos(),charge);
00175         if(inRange)  tenestv->Fill(strip->GetTPos(),charge);
00176       }
00177     }
00178                                                                     
00179     if(strip->GetPlaneView()==PlaneView::kU){
00180        tenestuBackup->Fill(strip->GetTPos(),charge);
00181     }
00182     else if(strip->GetPlaneView()==PlaneView::kV){
00183        tenestvBackup->Fill(strip->GetTPos(),charge);
00184     }          
00185 
00186   }//end of strip loop 
00187 
00188   //Fill parameters for U and V direction
00189   fU = tenestu->GetMean();
00190   fV = tenestv->GetMean(); 
00191 
00192   MSG("VertexFinder",Msg::kDebug)
00193           <<tenestu->GetMaximum()<<"    "<<tenestuAll->GetMaximum()<<endl;
00194   if(tenestu->GetMaximum() < 2) fU = tenestuAll->GetMean();
00195   if(tenestv->GetMaximum() < 2) fV = tenestvAll->GetMean();
00196   if(tenestuAll->GetMaximum() < 2) fU = tenestuBackup->GetMean();
00197   if(tenestvAll->GetMaximum() < 2) fV = tenestvBackup->GetMean();
00198 
00199   MSG("VertexFinder",Msg::kDebug)<<"plane guess "<<fPlane
00200           <<" U/V: "<<fU<<"   "<<fV << endl;
00201 
00202   //clean up after myself
00203   delete tenestu;
00204   delete tenestv;
00205   delete tenestuAll;
00206   delete tenestvAll;
00207   delete tenestuBackup;
00208   delete tenestvBackup;
00209 
00210   return retval;
00211 }

Int_t VertexFinder::VtxPlane  )  [inline]
 

Definition at line 44 of file VertexFinder.h.

References fPlane.

Referenced by AlgEventSR::RunAlg().

00044 {return fPlane;}

Float_t VertexFinder::VtxU  )  [inline]
 

Definition at line 42 of file VertexFinder.h.

References fU.

Referenced by AlgEventSR::RunAlg().

00042 {return fU;}

Float_t VertexFinder::VtxV  )  [inline]
 

Definition at line 43 of file VertexFinder.h.

References fV.

Referenced by AlgEventSR::RunAlg().

00043 {return fV;}

Float_t VertexFinder::VtxX  )  [inline]
 

Definition at line 39 of file VertexFinder.h.

References fX.

00039 {return fX;}

Float_t VertexFinder::VtxY  )  [inline]
 

Definition at line 40 of file VertexFinder.h.

References fY.

00040 {return fY;}

Float_t VertexFinder::VtxZ  )  [inline]
 

Definition at line 41 of file VertexFinder.h.

References fZ.

Referenced by AlgEventSR::RunAlg().

00041 {return fZ;}


Member Data Documentation

CandEventHandle* VertexFinder::fCeh [private]
 

Definition at line 54 of file VertexFinder.h.

Referenced by AcceptTrackInfo(), CheckTrackInfo(), FindVertex(), FindVtxPlane(), FindVtxUV(), and VertexFinder().

Int_t VertexFinder::fPlane [private]
 

Definition at line 67 of file VertexFinder.h.

Referenced by AcceptTrackInfo(), FindVertex(), FindVtxPlane(), FindVtxUV(), VertexFinder(), and VtxPlane().

Float_t VertexFinder::fTotalEnergy [private]
 

Definition at line 60 of file VertexFinder.h.

Referenced by FindVtxPlane(), and VertexFinder().

Float_t VertexFinder::fU [private]
 

Definition at line 65 of file VertexFinder.h.

Referenced by AcceptTrackInfo(), FindVertex(), FindVtxUV(), VertexFinder(), and VtxU().

Float_t VertexFinder::fV [private]
 

Definition at line 66 of file VertexFinder.h.

Referenced by AcceptTrackInfo(), FindVertex(), FindVtxUV(), VertexFinder(), and VtxV().

const VldContext* VertexFinder::fVld [private]
 

Definition at line 53 of file VertexFinder.h.

Referenced by FindVertex(), and VertexFinder().

Float_t VertexFinder::fX [private]
 

Definition at line 62 of file VertexFinder.h.

Referenced by FindVertex(), VertexFinder(), and VtxX().

Float_t VertexFinder::fY [private]
 

Definition at line 63 of file VertexFinder.h.

Referenced by FindVertex(), VertexFinder(), and VtxY().

Float_t VertexFinder::fZ [private]
 

Definition at line 64 of file VertexFinder.h.

Referenced by FindVertex(), and VtxZ().

Float_t VertexFinder::kNoiseCut [private]
 

Definition at line 58 of file VertexFinder.h.

Referenced by FindVtxPlane(), FindVtxUV(), and VertexFinder().

Int_t VertexFinder::kNPlanes [private]
 

Definition at line 52 of file VertexFinder.h.

Referenced by FindVertex(), FindVtxPlane(), and VertexFinder().

Int_t VertexFinder::kUVPlanesAfter [private]
 

Definition at line 57 of file VertexFinder.h.

Referenced by FindVtxUV(), and VertexFinder().

Int_t VertexFinder::kUVPlanesBefore [private]
 

Definition at line 56 of file VertexFinder.h.

Referenced by FindVtxUV(), and VertexFinder().


The documentation for this class was generated from the following files:
Generated on Mon Mar 16 23:05:28 2009 for loon by doxygen 1.3.5