AlgTrackCam Class Reference

#include <AlgTrackCam.h>

Inheritance diagram for AlgTrackCam:

AlgBase AlgReco AlgTrack List of all members.

Public Member Functions

 AlgTrackCam ()
virtual ~AlgTrackCam ()
virtual void RunAlg (AlgConfig &ac, CandHandle &ch, CandContext &cx)
virtual void Trace (const char *c) const

Private Member Functions

void CalculateTimingFits (double &dir, double &mytimeoffset, CandTrackHandle &cth)
bool CalculateTrace (double *m, double *c, double *Coord, double *Trace)
void DetectorSides (double *m, double *c, double *position, int side)
void ExtractHitProperties (const TrackCam *trkc, const int &bpln, CandTrackHandle &cth)
void InterpolateTrackPosition ()
void SetTrackCoordinates (const int &bpln, int &plnm, int &plnp)
void SetupTimingInfo (UgliGeomHandle *ugh, const double &fFibreIndex)
void SetVertexEndProperties (double *Coord, double *Dir, const int &end, const int &coordpln)
void WeightsForTimingFits ()

Private Attributes

vector< TrkPlaneInfofPlaneInfo
vector< HitCam * > fHitArr [500]
int ModuleType
int MaxPlane
int MinPlane
int begplane1
int begplane2
int endplane2
int endplane1
double StripListTime
bool BeamFlag
bool PassTrack

Detailed Description

Definition at line 42 of file AlgTrackCam.h.


Constructor & Destructor Documentation

AlgTrackCam::AlgTrackCam (  ) 

Definition at line 54 of file AlgTrackCam.cxx.

00055 {
00056 }

AlgTrackCam::~AlgTrackCam (  )  [virtual]

Definition at line 61 of file AlgTrackCam.cxx.

00062 {
00063 }


Member Function Documentation

void AlgTrackCam::CalculateTimingFits ( double &  dir,
double &  mytimeoffset,
CandTrackHandle cth 
) [private]

Definition at line 825 of file AlgTrackCam.cxx.

References Munits::cm, fPlaneInfo, Msg::kDebug, MSG, CandTrackHandle::SetTimeBackwardFitNDOF(), CandTrackHandle::SetTimeBackwardFitRMS(), CandTrackHandle::SetTimeForwardFitNDOF(), CandTrackHandle::SetTimeForwardFitRMS(), CandRecoHandle::SetTimeOffset(), CandRecoHandle::SetTimeSlope(), StripListTime, and WeightsForTimingFits().

Referenced by RunAlg().

00826 {
00827   WeightsForTimingFits();
00828   const int npln = (int)fPlaneInfo.size();
00829 
00830   //Timeslope
00831   double ctimeslope=0.0,ctimeoffset=0.0,ctimeaverage=0.0, RMS=0.0, CTCut=0.0, MinCT=-3000.;
00832   double Sq,Sqs,Sqss,Sqt,Sqtt,Sqst;
00833   double s,t,w;
00834   int npts=0;
00835   int* SkipM = new int[npln];
00836   int* SkipP = new int[npln];
00837   for(int i=0;i<npln;i++) { SkipM[i]=0; SkipP[i]=0; }
00838   Sq=0.0; Sqs=0.0; Sqss=0.0; Sqt=0.0; Sqtt=0.0; Sqst=0.0;
00839 
00840 
00841   // On first iteration, carry out simple fit. Remove outlying points on subsequent passes.
00842   for(int itr=0; itr<3; ++itr) {
00843 
00844     for(int i=0;i<npln;i++) {
00845 
00846       if( fPlaneInfo[i].plnvuw>-1 ) {
00847 
00848         // For negative strip ends
00849         if( fPlaneInfo[i].Wm>0.0 && fPlaneInfo[i].CTm>MinCT ) {
00850           s=fPlaneInfo[i].dS; t=fPlaneInfo[i].CTm; w=fPlaneInfo[i].Wm;
00851 
00852           if(itr==0) {
00853             Sqs+=w*s; Sqss+=w*s*s; Sqt+=w*t; Sqtt+=w*t*t; Sqst+=w*s*t;
00854             Sq+=w; npts++;
00855           }
00856           else if(fabs(t-ctimeoffset-(s*ctimeslope))>CTCut && SkipM[i]==0) {
00857             Sqs-=w*s; Sqss-=w*s*s; Sqt-=w*t; Sqtt-=w*t*t; Sqst-=w*s*t;
00858             Sq-=w; npts--; SkipM[i]=1;
00859           }
00860         }
00861 
00862         // For positive strip ends
00863         if( fPlaneInfo[i].Wp>0.0 && fPlaneInfo[i].CTp>MinCT ) {
00864           s=fPlaneInfo[i].dS; t=fPlaneInfo[i].CTp; w=fPlaneInfo[i].Wp;
00865 
00866           if(itr==0) {
00867             Sqs+=w*s; Sqss+=w*s*s; Sqt+=w*t; Sqtt+=w*t*t; Sqst+=w*s*t;
00868             Sq+=w; npts++;
00869           }
00870           else if(fabs(t-ctimeoffset-(s*ctimeslope))>CTCut && SkipP[i]==0) {
00871             Sqs-=w*s; Sqss-=w*s*s; Sqt-=w*t; Sqtt-=w*t*t; Sqst-=w*s*t;
00872             Sq-=w; npts--; SkipP[i]=1;
00873           }
00874         }
00875 
00876       }
00877     }
00878   
00879     if(npts>2){
00880       ctimeslope=(Sq*Sqst-Sqs*Sqt)/(Sq*Sqss-Sqs*Sqs); 
00881       ctimeoffset=(Sqt*Sqss-Sqs*Sqst)/(Sq*Sqss-Sqs*Sqs);
00882       ctimeaverage=(Sqt/Sq);
00883       if( ((Sqtt/Sq)-((Sqt/Sq)*(Sqt/Sq)))>0.0 ) {
00884         RMS = pow((Sqtt/Sq)-((Sqt/Sq)*(Sqt/Sq)),0.5);
00885         CTCut = 3.+RMS;
00886       }
00887       else {CTCut = 3.5;}
00888     }
00889 
00890   }
00891 
00892   delete[] SkipM;
00893   delete[] SkipP;
00895 
00896 
00897   //Fits to S = cT0 +ct and S = cT0 -cT
00898   double Sw[2],Swt[2],Swtt[2];
00899   double chisqp=0.0,chisqm=0.0;
00900   int chisqndfp=0,chisqndfm=0;
00901   double time_score=0.0;
00902   double CTIntercept[2], Csigma[2],Ctrunc[2]; 
00903   double cp,cm;
00904   int Npts[2];
00905   MSG("AlgTrackCam", Msg::kDebug) << " POSITIVE FIT: " << endl;
00906   chisqp=-99999.9; cp=-99999.9;
00907   chisqm=-99999.9; cm=-99999.9;
00908   CTIntercept[0]=ctimeaverage; Csigma[0]=-99999.9; Ctrunc[0]=-99999.9;
00909   CTIntercept[1]=ctimeaverage; Csigma[1]=-99999.9; Ctrunc[1]=-99999.9;
00910 
00911   for(int itr=0;itr<2;itr++)
00912     {
00913       Swtt[0]=0.0; Swt[0]=0.0; Sw[0]=0.0; Npts[0]=0;
00914       Swtt[1]=0.0; Swt[1]=0.0; Sw[1]=0.0; Npts[1]=0;
00915       for(int pln=0;pln<npln;pln++)
00916         {
00917           if( fPlaneInfo[pln].plnvuw>-1 )
00918             {
00919 
00920               if( fPlaneInfo[pln].Wm>0.0 && fPlaneInfo[pln].CTm>MinCT )
00921                 {
00922                   w=fPlaneInfo[pln].Wm; 
00923                   //Fit to S = cT0 +ct
00924                   t=fPlaneInfo[pln].CTm-fPlaneInfo[pln].dS+CTIntercept[0];
00925                   if( Ctrunc[0]<0.0 || fabs(t)<Ctrunc[0] ) { Swtt[0]+=w*t*t; Swt[0]+=w*t; Sw[0]+=w; Npts[0]++; }
00926                   //Fit to S = cT0 -ct
00927                   t=fPlaneInfo[pln].CTm+fPlaneInfo[pln].dS+CTIntercept[1];
00928                   if( Ctrunc[1]<0.0 || fabs(t)<Ctrunc[1] ) { Swtt[1]+=w*t*t; Swt[1]+=w*t; Sw[1]+=w; Npts[1]++; }
00929                 }
00930               if( fPlaneInfo[pln].Wp>0.0 && fPlaneInfo[pln].CTp>MinCT )
00931                 {
00932                   w=fPlaneInfo[pln].Wp; 
00933                   //Fit to S = cT0 +ct
00934                   t=fPlaneInfo[pln].CTp-fPlaneInfo[pln].dS+CTIntercept[0];
00935                   if( Ctrunc[0]<0.0 || fabs(t)<Ctrunc[0] ) { Swtt[0]+=w*t*t; Swt[0]+=w*t; Sw[0]+=w; Npts[0]++; }
00936                   //Fit to S = cT0 -ct
00937                   t=fPlaneInfo[pln].CTp+fPlaneInfo[pln].dS+CTIntercept[1];
00938                   if( Ctrunc[1]<0.0 || fabs(t)<Ctrunc[1] ) { Swtt[1]+=w*t*t; Swt[1]+=w*t; Sw[1]+=w; Npts[1]++; }
00939                 }
00940             }
00941         }
00942       if(Npts[0]>1)//Fit to S = cT0 +ct
00943         {
00944           CTIntercept[0]=CTIntercept[0]-Swt[0]/Sw[0]; Csigma[0]=0.0; 
00945           if((Swtt[0]/Sw[0])-(Swt[0]/Sw[0])*(Swt[0]/Sw[0])>0.0)
00946             {
00947               Csigma[0]=sqrt((Swtt[0]/Sw[0])-(Swt[0]/Sw[0])*(Swt[0]/Sw[0]));
00948             }
00949           chisqp=Csigma[0]; chisqndfp=Npts[0]-1; cp=-CTIntercept[0];
00950           Ctrunc[0]=Csigma[0]+3.0;
00951         }
00952       if(Npts[1]>1)//Fit to S = cT0 -ct
00953         {
00954           CTIntercept[1]=CTIntercept[1]-Swt[1]/Sw[1]; Csigma[1]=0.0;
00955           if((Swtt[1]/Sw[1])-(Swt[1]/Sw[1])*(Swt[1]/Sw[1])>0.0)
00956             {
00957               Csigma[1]=sqrt((Swtt[1]/Sw[1])-(Swt[1]/Sw[1])*(Swt[1]/Sw[1]));
00958             }
00959           chisqm=Csigma[1]; chisqndfm=Npts[1]-1; cm=-CTIntercept[1];
00960           Ctrunc[1]=Csigma[1]+3.0;
00961         }
00962     }
00963   MSG("AlgTrackCam", Msg::kDebug) << " *** CTIntercept[0]=" << CTIntercept[0] << " Csigma[0]=" << Csigma[0] << " *** " << endl;
00964   MSG("AlgTrackCam", Msg::kDebug) << " *** CTIntercept[1]=" << CTIntercept[1] << " Csigma[1]=" << Csigma[1] << " *** " << endl;
00965   
00966 
00967   dir=0.0; 
00968   time_score=0.0; mytimeoffset=0.0;
00969   if(chisqm>0.0 && chisqp>0.0)
00970     {
00971       if(chisqp>chisqm) { dir=-1.0; time_score=1-chisqm/chisqp; mytimeoffset=cm; }
00972       else { dir=+1.0; time_score=1-chisqp/chisqm; mytimeoffset=cp; }
00973       time_score=dir*time_score;
00974     }
00975   if(time_score>0.0) dir=1.0; if(time_score<0.0) dir=-1.0;
00976 
00977   MSG("AlgTrackCam", Msg::kDebug) << " timing parameters " << endl
00978                                   << " chisqp=" << chisqp << " (" << chisqndfp << ") " 
00979                                   << " chisqm=" << chisqm << " (" << chisqndfm << ") " << endl
00980                                   << " score=" << time_score << endl;
00981 
00982 
00983   cth.SetTimeSlope((ctimeslope)/(3.0e8));
00984   cth.SetTimeOffset((ctimeoffset+StripListTime)/(3.0e8));
00985   cth.SetTimeForwardFitRMS(chisqp);
00986   cth.SetTimeForwardFitNDOF(chisqndfp);
00987   cth.SetTimeBackwardFitRMS(chisqm);
00988   cth.SetTimeBackwardFitNDOF(chisqndfm);
00989 
00990   return;
00991 }

bool AlgTrackCam::CalculateTrace ( double *  m,
double *  c,
double *  Coord,
double *  Trace 
) [private]

Definition at line 585 of file AlgTrackCam.cxx.

References DetectorSides(), Msg::kDebug, and MSG.

Referenced by RunAlg().

00586 { 
00587   MSG("AlgTrackCam",Msg::kDebug) << "CalculateTrace" << endl;
00588 
00589   bool TraceSuccess=false;
00590   double TempTrace[3]={0.,0.,0.}; double TempSum=0.;
00591   double TraceLength(1.e99);
00592 
00593   for(int i=0; i<8; ++i) { // Consider the eight sides in turn
00594     TempSum=0.;
00595       
00596     DetectorSides(m,c,TempTrace, i);
00597       
00598     for(int j=0; j<3; ++j) {TempSum+=pow(Coord[j]-TempTrace[j],2);}
00599     TempSum=pow(TempSum,0.5);
00600       
00601     if(TempSum<TraceLength) {
00602       for(int j=0; j<3; ++j) {Trace[j]=TempTrace[j]-Coord[j];}
00603       TraceLength=TempSum;
00604       TraceSuccess=true;
00605     }
00606   }
00607 
00608   return TraceSuccess;
00609 }

void AlgTrackCam::DetectorSides ( double *  m,
double *  c,
double *  position,
int  side 
) [private]

Definition at line 615 of file AlgTrackCam.cxx.

Referenced by CalculateTrace().

00616 {
00617   position[2]=-1.e99;
00618   
00619   double tol=1.e-10;
00620   switch(side) {
00621   case 0: if(fabs(m[0]+m[1])>tol) {position[2] = (pow(32.,0.5)-c[0]-c[1])/(m[0]+m[1]);}  break;
00622   case 1: if(fabs(m[0])>tol)    {position[2] = (4.-c[0])/m[0];}                        break;
00623   case 2: if(fabs(m[0]-m[1])>tol)  {position[2] = (pow(32.,0.5)-c[0]+c[1])/(m[0]-m[1]);}  break;
00624   case 3: if(fabs(m[1])>tol)    {position[2] = (-4.-c[1])/m[1];}                       break;
00625   case 4: if(fabs(m[0]+m[1])>tol) {position[2] = (-pow(32.,0.5)-c[0]-c[1])/(m[0]+m[1]);} break;
00626   case 5: if(fabs(m[0])>tol)    {position[2] = (-4.-c[0])/m[0];}                       break;
00627   case 6: if(fabs(m[0]-m[1])>tol)  {position[2] = (-pow(32.,0.5)-c[0]+c[1])/(m[0]-m[1]);} break;
00628   case 7: if(fabs(m[1])>tol)    {position[2] = (4.-c[1])/m[1];}                        break;
00629   default: position[2] = -1.e99; break;
00630   }
00631   
00632   if(position[2]>-1.e90) {
00633     position[0]=m[0]*position[2]+c[0];
00634     position[1]=m[1]*position[2]+c[1];  
00635   }
00636   else {position[0]=-1.e99; position[1]=-1.e99;}
00637 
00638   return;
00639 }

void AlgTrackCam::ExtractHitProperties ( const TrackCam trkc,
const int &  bpln,
CandTrackHandle cth 
) [private]

Definition at line 527 of file AlgTrackCam.cxx.

References CandHandle::AddDaughterLink(), begplane1, endplane1, fHitArr, fPlaneInfo, TrackCam::GetBegTPos(), TrackCam::GetEndTPos(), TrackCam::GetEntries(), TrackCam::GetHit(), TrackCam::GetPartner(), HitCam::GetPlane(), MaxPlane, MinPlane, ModuleType, and PassTrack.

Referenced by RunAlg().

00528 {
00529   //Loop over all the HitCam objects in this TrackCam object
00530   //Extract U/V/Z postion info as will as charge from each one
00531   //Add daughter links for the strips they represent to the CandTrackHandle.
00532   unsigned int nhits = trkc->GetEntries();
00533   int pln, hitplane;
00534   double PartnerBegTPos, PartnerEndTPos;
00535 
00536   int Counter=0;
00537 
00538   TrackCam* Partner = trkc->GetPartner();
00539   PartnerBegTPos=fabs(Partner->GetBegTPos());
00540   PartnerEndTPos=fabs(Partner->GetEndTPos());
00541 
00542 
00543   for(unsigned int i=0; i<nhits; ++i) {
00544     HitCam* hit = trkc->GetHit(i);
00545 
00546     if(hit->GetUID()<0) {continue;}
00547 
00548     hitplane=hit->GetPlane();
00549     
00550     // UV matching for FD cosmics
00551     if( ModuleType==1 && !BeamFlag && ( (PartnerBegTPos<3.9 && PartnerBegTPos>0.2 && hitplane<begplane1-4) 
00552                                         || (PartnerEndTPos<3.9 && PartnerEndTPos>0.2 && hitplane>endplane1+4) ) ) {continue;}
00553     
00554     CandStripHandle* strip = hit->GetCandStripHandle();
00555     
00556     pln = hitplane-bpln;
00557     fHitArr[pln].push_back(hit);
00558     if(fPlaneInfo[pln].plnvuw<0) {
00559       fPlaneInfo[pln].plnvuw = hit->GetPlaneView();
00560       fPlaneInfo[pln].Z = hit->GetZPos();
00561     }
00562 
00563     if(fPlaneInfo[pln].plnvuw==0) fPlaneInfo[pln].U += hit->GetCharge()*hit->GetTPos();
00564     if(fPlaneInfo[pln].plnvuw==1) fPlaneInfo[pln].V += hit->GetCharge()*hit->GetTPos();
00565     fPlaneInfo[pln].Q += hit->GetCharge();
00566     cth.AddDaughterLink(*strip); 
00567     Counter++;
00568 
00569     if(hitplane>MaxPlane) {MaxPlane=hitplane;}
00570     if(hitplane<MinPlane) {MinPlane=hitplane;}
00571 
00572     (fPlaneInfo[pln].plnnum)++; 
00573   }
00574 
00575   if(Counter<2) {PassTrack=false;}
00576 
00577 
00578   return;
00579 }

void AlgTrackCam::InterpolateTrackPosition (  )  [private]

Definition at line 435 of file AlgTrackCam.cxx.

References fPlaneInfo, Munits::km2, and MinosMaterial::Z().

Referenced by RunAlg().

00436 {
00437   // interpolate between views for U,V
00438   const int npln = (int)fPlaneInfo.size();
00439 
00440   int flag,vuw;
00441   int pln;
00442   int k,km1,kp1,km2,kp2;
00443 
00444   for(pln=0;pln<npln;pln++) {
00445 
00446     if(fPlaneInfo[pln].plnvuw>-1) {
00447       flag=0;
00448       vuw=fPlaneInfo[pln].plnvuw;
00449       k=0; km1=-1; km2=-1;
00450 
00451       while(pln-k>0 && km2<0) {
00452         k++; 
00453         if(fPlaneInfo[pln-k].plnvuw>-1 && fPlaneInfo[pln-k].plnvuw!=vuw) {
00454           if(km1<0) km1=k; else km2=k;
00455         }
00456       }
00457         
00458       k=0; kp1=-1; kp2=-1;
00459 
00460       while(pln+k<npln-1 && kp2<0) {
00461         k++;
00462 
00463         if(fPlaneInfo[pln+k].plnvuw>-1 && fPlaneInfo[pln+k].plnvuw!=vuw) {
00464           if(kp1<0) kp1=k; else kp2=k;
00465         }
00466       }
00467 
00468       if(km1>0 && kp1>0) { 
00469         if(vuw==0) fPlaneInfo[pln].V=fPlaneInfo[pln-km1].V
00470                      +((fPlaneInfo[pln+kp1].V-fPlaneInfo[pln-km1].V)/(fPlaneInfo[pln+kp1].Z-fPlaneInfo[pln-km1].Z))
00471                      *(fPlaneInfo[pln].Z-fPlaneInfo[pln-km1].Z);
00472 
00473         if(vuw==1) fPlaneInfo[pln].U=fPlaneInfo[pln-km1].U
00474                      +((fPlaneInfo[pln+kp1].U-fPlaneInfo[pln-km1].U)/(fPlaneInfo[pln+kp1].Z-fPlaneInfo[pln-km1].Z))
00475                      *(fPlaneInfo[pln].Z-fPlaneInfo[pln-km1].Z);
00476         flag=1;
00477       }
00478       else {
00479         if(km1>0) {
00480           if(vuw==0) {
00481             if(km2>0) {fPlaneInfo[pln].V=fPlaneInfo[pln-km1].V
00482                          +(fPlaneInfo[pln].Z-fPlaneInfo[pln-km1].Z)
00483                          *(fPlaneInfo[pln-km1].V-fPlaneInfo[pln-km2].V)/(fPlaneInfo[pln-km1].Z-fPlaneInfo[pln-km2].Z);}
00484             else {fPlaneInfo[pln].V=fPlaneInfo[pln-km1].V;}
00485           }
00486           
00487           if(vuw==1) {
00488             if(km2>0) {fPlaneInfo[pln].U=fPlaneInfo[pln-km1].U
00489                          +(fPlaneInfo[pln].Z-fPlaneInfo[pln-km1].Z)
00490                          *(fPlaneInfo[pln-km1].U-fPlaneInfo[pln-km2].U)/(fPlaneInfo[pln-km1].Z-fPlaneInfo[pln-km2].Z);}
00491             else {fPlaneInfo[pln].U=fPlaneInfo[pln-km1].U;}
00492           }
00493 
00494           flag=1;
00495         }
00496          
00497         if(kp1>0) {
00498           if(vuw==0) {
00499             if(kp2>0) {fPlaneInfo[pln].V=fPlaneInfo[pln+kp1].V
00500                          +(fPlaneInfo[pln].Z-fPlaneInfo[pln+kp1].Z)
00501                          *(fPlaneInfo[pln+kp1].V-fPlaneInfo[pln+kp2].V)/(fPlaneInfo[pln+kp1].Z-fPlaneInfo[pln+kp2].Z);}
00502             else {fPlaneInfo[pln].V=fPlaneInfo[pln+kp1].V;}
00503           }
00504           
00505           if(vuw==1) {
00506             if(kp2>0) {fPlaneInfo[pln].U=fPlaneInfo[pln+kp1].U
00507                          +(fPlaneInfo[pln].Z-fPlaneInfo[pln+kp1].Z)
00508                          *(fPlaneInfo[pln+kp1].U-fPlaneInfo[pln+kp2].U)/(fPlaneInfo[pln+kp1].Z-fPlaneInfo[pln+kp2].Z);}
00509             else {fPlaneInfo[pln].U=fPlaneInfo[pln+kp1].U;}
00510           }
00511           
00512           flag=1;
00513         }
00514       }
00515       
00516       if(flag==0){ fPlaneInfo[pln].plnvuw=-1; }
00517     }
00518   }
00519   
00520   return;
00521 }

void AlgTrackCam::RunAlg ( AlgConfig ac,
CandHandle ch,
CandContext cx 
) [virtual]

Implements AlgBase.

Definition at line 68 of file AlgTrackCam.cxx.

References BeamFlag, begplane1, begplane2, Munits::c_light, CalculateTimingFits(), CalculateTrace(), AlgReco::Calibrate(), BeamSummary::clear(), TrkPlaneInfo::CTm, TrkPlaneInfo::CTp, endplane1, endplane2, ExtractHitProperties(), fHitArr, fPlaneInfo, TrackCam::GetBegPlane(), CandContext::GetCandRecord(), CandContext::GetDataIn(), TrackCam::GetEndPlane(), Registry::GetInt(), GetMomFromRange(), RecMinos::GetVldContext(), Calibrator::Instance(), InterpolateTrackPosition(), Detector::kCalDet, Msg::kDebug, Registry::KeyExists(), Detector::kFar, Detector::kNear, Munits::m, MaxPlane, MinPlane, ModuleType, MSG, PassTrack, TrkPlaneInfo::plnnum, TrkPlaneInfo::plnvuw, TrkPlaneInfo::Q, TrkPlaneInfo::Qm, TrkPlaneInfo::Qp, Calibrator::ReInitialise(), AlgTrack::SetdS(), AlgTrack::SetT(), SetTrackCoordinates(), SetupTimingInfo(), AlgTrack::SetUVZ(), SetVertexEndProperties(), SoL, StripListTime, Trace(), TrkPlaneInfo::U, TrkPlaneInfo::V, PropagationVelocity::Velocity(), TrkPlaneInfo::Wm, TrkPlaneInfo::Wp, and TrkPlaneInfo::Z.

00069 {
00070   // Standard set-up
00072   assert(ch.InheritsFrom("CandTrackCamHandle"));
00073   CandTrackCamHandle &cth = dynamic_cast<CandTrackCamHandle &>(ch);
00074 
00075   assert(cx.GetDataIn());
00076   VldContext* vldc = (VldContext*)(cx.GetCandRecord()->GetVldContext());
00077 
00078   // refractive index
00079   const double SoL = Munits::c_light;
00080   double fFibreIndex = 1.77;
00081   fFibreIndex = SoL/PropagationVelocity::Velocity(vldc->GetSimFlag());
00082 
00083   // Unpack AlgConfig
00084   BeamFlag=true;
00085   if( ac.KeyExists("BeamFlag") ) {BeamFlag = ac.GetInt("BeamFlag");}
00086   PassTrack=true;
00087 
00088   // Unpack CandContext
00089   const TObjArray* arr = dynamic_cast<const TObjArray*>(cx.GetDataIn()); 
00090   TrackCam* trku = (TrackCam*)(arr->At(0));
00091   TrackCam* trkv = (TrackCam*)(arr->At(1));
00092   CandSliceHandle* slice = (CandSliceHandle*)(arr->At(2));
00093   if(slice) cth.SetCandSlice(slice);
00094 
00095   // Get Geometry
00097   UgliGeomHandle ugh(*vldc);
00098 
00099   switch(vldc->GetDetector()){
00100   case Detector::kFar:
00101     ModuleType=1; break;
00102   case Detector::kNear:
00103     ModuleType=2; break;
00104   case Detector::kCalDet:
00105     ModuleType=3; break;
00106   default:
00107     ModuleType=-1; break;
00108   }
00110 
00111 
00112   // Find the extent of the track in planes
00114   int i,bpln,epln;
00115   if(trku->GetBegPlane()<trkv->GetBegPlane()) {bpln=trku->GetBegPlane(); begplane2=trku->GetBegPlane(); begplane1=trkv->GetBegPlane();}
00116   else {bpln=trkv->GetBegPlane(); begplane2=trkv->GetBegPlane(); begplane1=trku->GetBegPlane();}
00117 
00118   if(trku->GetEndPlane()>trkv->GetEndPlane()) {epln=trku->GetEndPlane(); endplane2=trku->GetEndPlane(); endplane1=trkv->GetEndPlane();} 
00119   else {epln=trkv->GetEndPlane(); endplane2=trkv->GetEndPlane(); endplane1=trku->GetEndPlane();}
00120 
00121   const int npln = 1+epln-bpln;
00123 
00124 
00125   // Return if track is clearly very poor quality
00127   if(npln<1 || ((ModuleType==1 || ModuleType==3) && begplane1>endplane1) || (ModuleType==2 && (begplane1-endplane1)>40)) {
00128     MSG("AlgTrackCam", Msg::kDebug) << "Not enough planes. Not Making track..." <<endl;
00129 
00130     for(int p=0; p<500; ++p) {fHitArr[p].clear();}
00131     fPlaneInfo.clear();
00132     return;
00133   }
00135  
00136 
00137   // Fill the vector with an empty TrkPlaneInfo object for each plane in the range spanned by the track
00139   TrkPlaneInfo tmpplane;
00140   tmpplane.plnvuw=-1; tmpplane.plnnum=0;
00141   tmpplane.U=0.0; tmpplane.V=0.0; tmpplane.Z=0.0; tmpplane.Q=0.0; 
00142   tmpplane.Qm=0.0; tmpplane.Qp=0.0; tmpplane.CTm=0.0; tmpplane.CTp=0.0; 
00143   tmpplane.Wm=0.0; tmpplane.Wp=0.0;
00144   for(i=0; i<npln; ++i) {fPlaneInfo.push_back(tmpplane);}
00146 
00147 
00148   // Calculate Track Co-ordinates
00149   // Add daughterlinks here
00151   MaxPlane=-20; MinPlane=500;
00152   ExtractHitProperties(trku, bpln, cth);
00153   ExtractHitProperties(trkv, bpln, cth);
00154 
00155   if(PassTrack==false) {
00156     vector<CandStripHandle*> Daughters;
00157 
00158     TIter TrackStripItr = cth.GetDaughterIterator();
00159     while(CandStripHandle* TrackStrip = dynamic_cast<CandStripHandle*>(TrackStripItr()))
00160       {Daughters.push_back(TrackStrip);}
00161 
00162     for(unsigned int i=0; i<Daughters.size(); ++i) {cth.RemoveDaughter(Daughters[i]);}
00163     Daughters.clear();
00164 
00165     for(int i=0; i<500; ++i) {fHitArr[i].clear();}
00166     fPlaneInfo.clear();
00167     return;
00168   }
00170 
00171 
00172   // Finalise charge-weighting of quantities in fPlaneInfo (used below)
00174   int nplanes=0,nstrips=0;
00175   for(i=0;i<npln;i++) {
00176     if(fPlaneInfo[i].plnvuw>-1 && fPlaneInfo[i].Q>0.0) {
00177       fPlaneInfo[i].U/=fPlaneInfo[i].Q; fPlaneInfo[i].V/=fPlaneInfo[i].Q;
00178       nstrips+=fPlaneInfo[i].plnnum; ++nplanes;
00179     }
00180   }
00182 
00183 
00184   // Temporary quantities used in timing fit
00186   // Interpolate to get V for U planes and vice versa
00187   InterpolateTrackPosition();
00188 
00189 
00190   // Calculate The Timing Info For Each Track StripEnd
00191   SetupTimingInfo(&ugh, fFibreIndex);
00192 
00193   
00194   // Set U, V and time for each plane/stripend in the track
00195   int plnm=-1; int plnp=-1;
00196   SetTrackCoordinates(bpln,plnm,plnp);
00197 
00198 
00199   // Beginning Position and Direction
00200   double begCoord[3], begDir[3];
00201   SetVertexEndProperties(begCoord,begDir,0,plnm);
00202 
00203   // End Position and Direction
00204   double endCoord[3], endDir[3];
00205   SetVertexEndProperties(endCoord,endDir,1,plnp);
00207 
00208 
00209 
00210   // Calculate a simple dS and range, assuming track is travelling in positive Z direction
00212   double utmp(0.),vtmp(0.),ztmp(0.);
00213   double dq,du,dv,dz,ds; 
00214   double range_thru_detector(0.),range_thru_steel(0.);
00215   double sumz_thru_steel(0.),sumz_thru_detector(0.);
00216   double range_thru_steel_xtra(0.), range_thru_detector_xtra(0.);
00217   int flag=0; 
00218   for(i=0;i<npln;i++) {
00219     if(fPlaneInfo[i].plnvuw>-1) {
00220       if(flag) {
00221         du=fPlaneInfo[i].U-utmp; dv=fPlaneInfo[i].V-vtmp; dz=fPlaneInfo[i].Z-ztmp;
00222         ds=sqrt(du*du+dv*dv+dz*dz);
00223         if(dz>1.0) dq=2.0; else dq=1.0;
00224         range_thru_steel+=dq*ds*(0.0254/dz);
00225         sumz_thru_steel+=dq*0.0254;
00226         range_thru_detector+=ds;
00227         sumz_thru_detector+=dz;
00228       }
00229       fPlaneInfo[i].dS=range_thru_detector;
00230       fPlaneInfo[i].dSsteel=range_thru_steel;
00231       utmp=fPlaneInfo[i].U; vtmp=fPlaneInfo[i].V; ztmp=fPlaneInfo[i].Z;
00232       flag=1;
00233     }
00234   }
00235 
00236   if(range_thru_detector>0.0) {
00237     range_thru_steel_xtra = 0.0127*(1.0/begDir[2]+1.0/endDir[2]);
00238     range_thru_detector_xtra = 0.0296*(1.0/begDir[2]+1.0/endDir[2]);
00239     range_thru_steel+=range_thru_steel_xtra;
00240     range_thru_detector+=range_thru_detector_xtra;
00241   }
00243 
00244 
00245 
00246   // If we are considering Far Detector, calculate Beg & End traces  
00248   double begtrace(0.),endtrace(0.);
00249   double begtraceZ(0.),endtraceZ(0.);
00250 
00251   if(vldc->GetDetector()==Detector::kFar) {
00252     // For beginning
00253     double m[2] = {begDir[0]/begDir[2], begDir[1]/begDir[2]};
00254     double c[2] = {begCoord[0]-(m[0]*begCoord[2]), begCoord[1]-(m[1]*begCoord[2])};
00255     double Coord[3] = {begCoord[0], begCoord[1], begCoord[2]};
00256     double Trace[3] = {1.e99,1.e99,1.e99};
00257     
00258     bool TraceSuccess = CalculateTrace(m,c,Coord,Trace);
00259     if(TraceSuccess==true) {
00260       begtrace = pow(pow(Trace[0],2) + pow(Trace[1],2) + pow(Trace[2],2), 0.5);
00261       begtraceZ = fabs(Trace[2]);
00262     }
00263 
00264     
00265     // For end
00266     m[0] = endDir[0]/endDir[2];
00267     m[1] = endDir[1]/endDir[2];
00268     c[0] = endCoord[0]-(m[0]*endCoord[2]);
00269     c[1] = endCoord[1]-(m[1]*endCoord[2]);
00270     Coord[0] = endCoord[0]; Coord[1] = endCoord[1]; Coord[2] = endCoord[2];
00271     Trace[0] = 1.e99; Trace[1]=1.e99; Trace[2]=1.e99;
00272     
00273     TraceSuccess = CalculateTrace(m,c,Coord,Trace);
00274     if(TraceSuccess==true) {
00275       endtrace = pow(pow(Trace[0],2) + pow(Trace[1],2) + pow(Trace[2],2), 0.5);
00276       endtraceZ = fabs(Trace[2]);
00277     }
00278   }
00280 
00281 
00282   // Timing Calculations
00284   double dir(0.), mytimeoffset(0.);
00285   CalculateTimingFits(dir,mytimeoffset,cth);
00287 
00288 
00289   //Set Properties In CandTrackHandle - (Can Do This Now We Know The Direction From Timing)
00291   SetUVZ(&cth);
00292 
00293   int begplane, endplane;
00294   double dt=1.;
00295 
00296   if(dir>=0 || BeamFlag) {
00297     begplane=MinPlane;
00298     endplane=MaxPlane;
00299 
00300     cth.SetVtxTrace(begtrace);
00301     cth.SetVtxTraceZ(begtraceZ);
00302 
00303     cth.SetEndTrace(endtrace);
00304     cth.SetEndTraceZ(endtraceZ);
00305 
00306     cth.SetVtxT((mytimeoffset+StripListTime)/(3.0e8));
00307     cth.SetEndT((mytimeoffset+range_thru_detector+StripListTime)/(3.0e8));
00308   }
00309   else{
00310     begplane=MaxPlane;
00311     endplane=MinPlane;
00312 
00313     cth.SetVtxTrace(endtrace);
00314     cth.SetVtxTraceZ(endtraceZ);
00315 
00316     cth.SetEndTrace(begtrace);
00317     cth.SetEndTraceZ(begtraceZ);
00318 
00319     cth.SetVtxT((mytimeoffset-range_thru_detector+StripListTime)/(3.0e8));
00320     cth.SetEndT((mytimeoffset+StripListTime)/(3.0e8));
00321 
00322     dt=-1.;
00323   }
00324 
00325   cth.SetVtxPlane(begplane);
00326   cth.SetVtxZ(cth.GetZ(begplane));
00327   cth.SetVtxU(cth.GetU(begplane));
00328   cth.SetVtxV(cth.GetV(begplane));
00329   cth.SetDirCosU(dt*cth.GetDirCosU(begplane));
00330   cth.SetDirCosV(dt*cth.GetDirCosV(begplane));
00331   cth.SetDirCosZ(dt*cth.GetDirCosZ(begplane));
00332   
00333   cth.SetEndPlane(endplane);
00334   cth.SetEndZ(cth.GetZ(endplane));
00335   cth.SetEndU(cth.GetU(endplane));
00336   cth.SetEndV(cth.GetV(endplane));
00337   cth.SetEndDirCosU(dt*cth.GetDirCosU(endplane));
00338   cth.SetEndDirCosV(dt*cth.GetDirCosV(endplane));
00339   cth.SetEndDirCosZ(dt*cth.GetDirCosZ(endplane));
00340 
00341 
00342   // Store final time values
00343   SetT(&cth);
00344 
00345   // Set Range and dS
00346   SetdS(&cth);
00347 
00348 
00349   // Momentum From Range
00350   double range = cth.GetRange();
00351   if (range>0.) {cth.SetMomentum(GetMomFromRange(range));}
00352   else {cth.SetMomentum(0.);}
00353 
00354   // Calibration, for MIPs etc.
00355   Calibrator& cal = Calibrator::Instance();
00356   cal.ReInitialise(*vldc);
00357   Calibrate(&cth);
00359 
00360 
00361   for(i=0; i<500; ++i) {fHitArr[i].clear();}
00362   fPlaneInfo.clear();
00363 
00364 
00365   return;
00366 }

void AlgTrackCam::SetTrackCoordinates ( const int &  bpln,
int &  plnm,
int &  plnp 
) [private]

Definition at line 799 of file AlgTrackCam.cxx.

References fPlaneInfo.

Referenced by RunAlg().

00800 {
00801   int pln;
00802   const int npln = (int)fPlaneInfo.size();
00803 
00804   for(int i=0;i<npln;i++) {
00805     pln=bpln+i;
00806     if(fPlaneInfo[i].plnvuw>-1) {
00807       if(fPlaneInfo[i].Qm>0.0) {
00808         fPlaneInfo[i].CTm/=fPlaneInfo[i].Qm;
00809       }
00810       if(fPlaneInfo[i].Qp>0.0) {
00811         fPlaneInfo[i].CTp/=fPlaneInfo[i].Qp;
00812       }
00813       if(plnm<0||i<plnm) {plnm=i;} 
00814       if(plnp<0||i>plnp) {plnp=i;}
00815     }
00816   }
00817   
00818   return;
00819 }

void AlgTrackCam::SetupTimingInfo ( UgliGeomHandle ugh,
const double &  fFibreIndex 
) [private]

Definition at line 645 of file AlgTrackCam.cxx.

References UgliStripHandle::ClearFiber(), fHitArr, fPlaneInfo, Munits::g, HitCam::GetCandStripHandle(), CandStripHandle::GetCharge(), UgliStripHandle::GetHalfLength(), CandStripHandle::GetNDigit(), CandStripHandle::GetPlaneView(), CandStripHandle::GetStripEndId(), UgliGeomHandle::GetStripHandle(), CandStripHandle::GetTime(), StripEnd::kNegative, StripEnd::kPositive, PlaneView::kU, PlaneView::kV, PlaneView::kX, PlaneView::kY, StripListTime, and UgliStripHandle::WlsPigtail().

Referenced by RunAlg().

00646 {
00647   double tpos(0.), fibre, ctime, digchg;
00648 
00649   HitCam* hit = 0; CandStripHandle* strip = 0;
00650   const unsigned int npln = fPlaneInfo.size();
00651 
00652   // Time of first strip in track
00653   StripListTime=9.e30;
00654 
00655   for(unsigned int pln=0;pln<npln;pln++) {
00656 
00657     for(unsigned int g=0; g<fHitArr[pln].size(); ++g) {
00658       hit = fHitArr[pln][g];
00659       strip = hit->GetCandStripHandle();  
00660 
00661       if( strip->GetPlaneView()==PlaneView::kU
00662           || strip->GetPlaneView()==PlaneView::kX ) tpos = -fPlaneInfo[pln].V;
00663       if( strip->GetPlaneView()==PlaneView::kV
00664           || strip->GetPlaneView()==PlaneView::kY ) tpos = fPlaneInfo[pln].U;
00665       PlexStripEndId stripid = strip->GetStripEndId();
00666       UgliStripHandle striphandle = ugh->GetStripHandle(stripid);
00667       
00668       if(strip->GetNDigit(StripEnd::kPositive)>0) { 
00669         fibre = striphandle.ClearFiber(StripEnd::kPositive)+striphandle.WlsPigtail(StripEnd::kPositive)+striphandle.GetHalfLength()-tpos; 
00670         ctime = 3.0e8*strip->GetTime(StripEnd::kPositive)-fFibreIndex*fibre; 
00671         digchg=strip->GetCharge(StripEnd::kPositive); 
00672         fPlaneInfo[pln].Qp+=digchg; fPlaneInfo[pln].CTp+=digchg*ctime;
00673 
00674         if(ctime<StripListTime) {StripListTime=ctime;}
00675       }
00676       
00677       if(strip->GetNDigit(StripEnd::kNegative)>0) { 
00678         fibre = striphandle.ClearFiber(StripEnd::kNegative)+striphandle.WlsPigtail(StripEnd::kNegative)+striphandle.GetHalfLength()+tpos; 
00679         ctime = 3.0e8*strip->GetTime(StripEnd::kNegative)-fFibreIndex*fibre; 
00680         digchg=strip->GetCharge(StripEnd::kNegative); 
00681         fPlaneInfo[pln].Qm+=digchg; fPlaneInfo[pln].CTm+=digchg*ctime;
00682 
00683         if(ctime<StripListTime) {StripListTime=ctime;}
00684       }   
00685     }
00686   }
00687 
00688   // Subtract StripListTime from each time measurement
00689   if(StripListTime<8.e30) {
00690     for(unsigned int pln=0;pln<npln;pln++) {
00691       if(fPlaneInfo[pln].plnvuw>-1) {
00692         fPlaneInfo[pln].CTp-=StripListTime*fPlaneInfo[pln].Qp;
00693         fPlaneInfo[pln].CTm-=StripListTime*fPlaneInfo[pln].Qm;
00694       }
00695     }
00696   }
00697   else {StripListTime=0.;}
00698   
00699   return;
00700 }

void AlgTrackCam::SetVertexEndProperties ( double *  Coord,
double *  Dir,
const int &  end,
const int &  coordpln 
) [private]

Definition at line 372 of file AlgTrackCam.cxx.

References fPlaneInfo.

Referenced by RunAlg().

00373 {
00374   const int npln = (int)fPlaneInfo.size();
00375 
00376   //Sanity check
00377   if(coordpln<0 || coordpln>=npln) return; //don't try to access elements for a non existent plane
00378   
00379   double mu(0.0),mv(0.0),u,v,z,w,precou,precov,precos,precoz;
00380   double Uw(0.0),Uwz(0.0),Uwzz(0.0),Uwu(0.0),Uwuu(0.0),Uwzu(0.0);
00381   double Vw(0.0),Vwz(0.0),Vwzz(0.0),Vwv(0.0),Vwvv(0.0),Vwzv(0.0);
00382 
00383   int Upts(0),Vpts(0),MAXpts(4);
00384   int increment=(end==0)?1:-1;
00385   double extrapdist=(end==0)?-0.02:0.04; //extra distance we have to extrapolate the track
00386   int i=coordpln;
00387   while(i>=0 && i<npln)
00388     {
00389       if(fPlaneInfo[i].plnvuw>-1)
00390         {
00391           u=fPlaneInfo[i].U; v=fPlaneInfo[i].V; z=fPlaneInfo[i].Z; w=1.0; // remove pulse height weighting
00392           
00393           if(fPlaneInfo[i].plnvuw==0 && Upts<MAXpts)
00394             {
00395               Uw+=w;
00396               Uwu+=w*u; Uwz+=w*z; Uwuu+=w*u*u;
00397               Uwzu+=w*u*z; Uwzz+=w*z*z;
00398               ++Upts;
00399             }
00400           
00401           if(fPlaneInfo[i].plnvuw==1 && Vpts<MAXpts)
00402             {
00403               Vw+=w;
00404               Vwv+=w*v; Vwz+=w*z; Vwvv+=w*v*v;
00405               Vwzv+=w*v*z; Vwzz+=w*z*z;
00406               ++Vpts;
00407             }
00408         }
00409       if(Upts==MAXpts && Vpts==MAXpts) break;
00410       i+=increment;
00411     }
00412   
00413   if(Upts>1 && Vpts>1)
00414     {
00415       mu=(Uw*Uwzu-Uwz*Uwu)/(Uw*Uwzz-Uwz*Uwz);
00416       mv=(Vw*Vwzv-Vwz*Vwv)/(Vw*Vwzz-Vwz*Vwz);
00417     }
00418   
00419   precou=mu; precov=mv;
00420   precos=sqrt(precou*precou+precov*precov+1.0);
00421   precou=precou/precos; precov=precov/precos; precoz=1.0/precos;
00422   Dir[0]=precou; Dir[1]=precov; Dir[2]=precoz;
00423 
00424   Coord[0]=fPlaneInfo[coordpln].U+extrapdist*(Dir[0]/Dir[2]); 
00425   Coord[1]=fPlaneInfo[coordpln].V+extrapdist*(Dir[1]/Dir[2]); 
00426   Coord[2]=fPlaneInfo[coordpln].Z+extrapdist;
00427 
00428   return;
00429 }

void AlgTrackCam::Trace ( const char *  c  )  const [virtual]

Reimplemented from AlgBase.

Definition at line 997 of file AlgTrackCam.cxx.

Referenced by RunAlg().

00998 {
00999 }

void AlgTrackCam::WeightsForTimingFits (  )  [private]

Definition at line 706 of file AlgTrackCam.cxx.

References fPlaneInfo.

Referenced by CalculateTimingFits().

00707 {
00708   // Timing Weights  
00709   // Parameters for time fit residual vs PEs
00710   // (consistent with AlgTrackFitCam::TimingFit(...) method)
00711   // double ErrorParam[3] = { 0.56, 0.50, -0.34 }; // (OLD)
00712   double ErrorParam[3] = { 0.58, 0.69, -0.33 }; // (NEW)
00713   double MinUncertainty = ErrorParam[0];
00714   double Uncertainty = MinUncertainty;
00715  
00716   const int npln = (int)fPlaneInfo.size();
00717 
00718   int ctflag;
00719   double ctmin,ctmax,ctave,ctrms;
00720   double sq,sqct,sqctct,swgt;
00721   double wm,wp;
00722 
00723   for(int i=0;i<npln;i++) {    
00724 
00725     fPlaneInfo[i].Wm = 0.0;
00726     fPlaneInfo[i].Wp = 0.0;
00727 
00728     if(fPlaneInfo[i].plnvuw>-1) {
00729       wm=0.0; wp=0.0;
00730       ctflag=0; ctmin=0.0; ctmax=0.0; ctave=0.0; ctrms=0.0;
00731       sq=0.0; sqct=0.0; sqctct=0.0; swgt=0.0;
00732 
00733       for(int j=-4;j<5;j++) {
00734         if( j!=0 && i+j>-1 && i+j<npln && fPlaneInfo[i+j].plnvuw>-1 ) {
00735           if( fPlaneInfo[i+j].Qm>1.0 && !( fPlaneInfo[i+j].Qp>0.0 && !(fPlaneInfo[i+j].CTm-fPlaneInfo[i+j].CTp>-4.0&&fPlaneInfo[i+j].CTm-fPlaneInfo[i+j].CTp<4.0) ) ) {
00736             if(ctflag) {
00737               if(fPlaneInfo[i+j].CTm<ctmin) {ctmin=fPlaneInfo[i+j].CTm;}
00738               if(fPlaneInfo[i+j].CTm>ctmax) {ctmax=fPlaneInfo[i+j].CTm;} 
00739             }
00740             else {ctmin=fPlaneInfo[i+j].CTm; ctmax=fPlaneInfo[i+j].CTm; ctflag=1;}
00741 
00742             sq+=fPlaneInfo[i+j].Qm; sqct+=fPlaneInfo[i+j].Qm*fPlaneInfo[i+j].CTm; 
00743             sqctct+=fPlaneInfo[i+j].Qm*fPlaneInfo[i+j].CTm*fPlaneInfo[i+j].CTm;
00744             swgt+=1.0;
00745           }
00746                 
00747           if( fPlaneInfo[i+j].Qp>1.0 && !( fPlaneInfo[i+j].Qm>0.0 && !(fPlaneInfo[i+j].CTp-fPlaneInfo[i+j].CTm>-4.0&&fPlaneInfo[i+j].CTp-fPlaneInfo[i+j].CTm<4.0) ) ) {
00748             if(ctflag) {
00749               if(fPlaneInfo[i+j].CTp<ctmin) {ctmin=fPlaneInfo[i+j].CTp;} 
00750               if(fPlaneInfo[i+j].CTp>ctmax) {ctmax=fPlaneInfo[i+j].CTp;}
00751             }
00752             else {ctmin=fPlaneInfo[i+j].CTp; ctmax=fPlaneInfo[i+j].CTp; ctflag=1;}
00753             
00754             sq+=fPlaneInfo[i+j].Qp; sqct+=fPlaneInfo[i+j].Qp*fPlaneInfo[i+j].CTp; 
00755             sqctct+=fPlaneInfo[i+j].Qp*fPlaneInfo[i+j].CTp*fPlaneInfo[i+j].CTp;
00756             swgt+=1.0;
00757           }
00758         }
00759       }
00760 
00761 
00762       if(swgt>1.0) {
00763         ctave=sqct/sq; ctrms=0.0;
00764         if((sqctct/sq)-(sqct/sq)*(sqct/sq)>0.0) {ctrms=sqrt((sqctct/sq)-(sqct/sq)*(sqct/sq));}
00765 
00766         if( (fPlaneInfo[i].Qm>1.0) && (fPlaneInfo[i].CTm-ctmin>-2.0 && fPlaneInfo[i].CTm-ctmax<2.0) 
00767             && (fPlaneInfo[i].CTm-ctave<ctrms+3.0 && fPlaneInfo[i].CTm-ctave>-ctrms-3.0) ) 
00768           {wm=fPlaneInfo[i].Qm;}
00769         
00770         if( (fPlaneInfo[i].Qp>1.0) && (fPlaneInfo[i].CTp-ctmin>-2.0 && fPlaneInfo[i].CTp-ctmax<2.0) 
00771             && (fPlaneInfo[i].CTp-ctave<ctrms+3.0 && fPlaneInfo[i].CTp-ctave>-ctrms-3.0) )
00772           {wp=fPlaneInfo[i].Qp;}
00773       }
00774   
00775       if( wm>0.0 ){
00776         if( wm<25 ) { Uncertainty = ErrorParam[0]+exp(ErrorParam[1]+ErrorParam[2]*wm); }
00777         else{ Uncertainty=MinUncertainty; }
00778         fPlaneInfo[i].Wm = 1.0/pow(Uncertainty,2.0);
00779         // fPlaneInfo[i].Wm=wm; // (old linear weighting)
00780       }
00781 
00782       if( wp>0.0 ){
00783         if (wp<25 ){ Uncertainty = ErrorParam[0]+exp(ErrorParam[1]+ErrorParam[2]*wp); }
00784         else { Uncertainty=MinUncertainty; }
00785         fPlaneInfo[i].Wp = 1.0/pow(Uncertainty,2.0);
00786         // fPlaneInfo[i].Wp=wp; // (old linear weighting)
00787       }
00788 
00789     }
00790   }
00791 
00792   return;
00793 } 


Member Data Documentation

bool AlgTrackCam::BeamFlag [private]

Definition at line 71 of file AlgTrackCam.h.

Referenced by RunAlg().

int AlgTrackCam::begplane1 [private]

Definition at line 68 of file AlgTrackCam.h.

Referenced by ExtractHitProperties(), and RunAlg().

int AlgTrackCam::begplane2 [private]

Definition at line 68 of file AlgTrackCam.h.

Referenced by RunAlg().

int AlgTrackCam::endplane1 [private]

Definition at line 68 of file AlgTrackCam.h.

Referenced by ExtractHitProperties(), and RunAlg().

int AlgTrackCam::endplane2 [private]

Definition at line 68 of file AlgTrackCam.h.

Referenced by RunAlg().

vector<HitCam*> AlgTrackCam::fHitArr[500] [private]

Definition at line 55 of file AlgTrackCam.h.

Referenced by ExtractHitProperties(), RunAlg(), and SetupTimingInfo().

vector<TrkPlaneInfo> AlgTrackCam::fPlaneInfo [private]

Definition at line 54 of file AlgTrackCam.h.

Referenced by CalculateTimingFits(), ExtractHitProperties(), InterpolateTrackPosition(), RunAlg(), SetTrackCoordinates(), SetupTimingInfo(), SetVertexEndProperties(), and WeightsForTimingFits().

int AlgTrackCam::MaxPlane [private]

Definition at line 67 of file AlgTrackCam.h.

Referenced by ExtractHitProperties(), and RunAlg().

int AlgTrackCam::MinPlane [private]

Definition at line 67 of file AlgTrackCam.h.

Referenced by ExtractHitProperties(), and RunAlg().

int AlgTrackCam::ModuleType [private]

Definition at line 67 of file AlgTrackCam.h.

Referenced by ExtractHitProperties(), and RunAlg().

bool AlgTrackCam::PassTrack [private]

Definition at line 71 of file AlgTrackCam.h.

Referenced by ExtractHitProperties(), and RunAlg().

double AlgTrackCam::StripListTime [private]

Definition at line 69 of file AlgTrackCam.h.

Referenced by CalculateTimingFits(), RunAlg(), and SetupTimingInfo().


The documentation for this class was generated from the following files:
Generated on Wed Dec 10 22:49:05 2014 for loon by  doxygen 1.4.7