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

AlgFitTrackCam Class Reference

#include <AlgFitTrackCam.h>

Inheritance diagram for AlgFitTrackCam:

AlgBase AlgReco AlgTrack List of all members.

Public Member Functions

 AlgFitTrackCam ()
virtual ~AlgFitTrackCam ()
virtual void RunAlg (AlgConfig &ac, CandHandle &ch, CandContext &cx)
void InitialFramework (const CandSliceHandle *slice, CandContext &cx)
void RunTheFitter (CandFitTrackCamHandle &cth)
void StoreFilteredData (const int NewPlane)
void FillGapsInTrack ()
bool FindTheStrips (CandFitTrackCamHandle &cth, bool MakeTheTrack)
void GetFitData (int Plane1, int Plane2)
void ShowerStrips ()
void RemoveTrkHitsInShw ()
void ShowerSwim ()
void GoBackwards ()
void GoForwards ()
bool GetCombiPropagator (const int Plane, const int NewPlane, const bool GoForward)
bool Swim (double *StateVector, double *Output, const int Plane, const int NewPlane, const bool GoForward, double *dS=0, double *Range=0, double *dE=0)
bool Swim (double *StateVector, double *Output, const double zbeg, const int NewPlane, const bool GoForward, double *dS=0, double *Range=0, double *dE=0)
bool Swim (double *StateVector, double *Output, const int Plane, const double zend, const bool GoForward, double *dS=0, double *Range=0, double *dE=0)
void GetInitialCovarianceMatrix (const bool FirstIteration)
void GetNoiseMatrix (const int Plane, const int NewPlane)
void ExtrapCovMatrix ()
void CalcKalmanGain (const int NewPlane)
void UpdateStateVector (const int Plane, const int NewPlane, const bool GoForward)
void UpdateCovMatrix ()
void MoveArrays ()
void CheckValues (double *Input, const int NewPlane)
void SetTrackProperties (CandFitTrackCamHandle &cth)
void SetPropertiesFromFinderTrack (CandFitTrackCamHandle &cth)
void TimingFit (CandFitTrackCamHandle &cth)
void SetRangeAnddS (CandFitTrackCamHandle &cth)
void SpectrometerSwim (CandFitTrackCamHandle &cth)
void CleanNDLists (CandFitTrackHandle &cth, CandContext &cx)
bool NDPlaneIsActive (int plane, float u, float v, float projErr)
void GenerateNDSpectStrips (const CandSliceHandle *slice, CandContext &cx)
virtual void Trace (const char *c) const
void ResetCovarianceMatrix ()
double NDStripBegTime (CandStripHandle *Strip, double U=0, double V=0)

Private Attributes

vector< StripStructSlcStripData [490]
vector< StripStructInitTrkStripData [490]
vector< TrkDataStructTrkStripData [490]
vector< FiltDataStructFilteredData [490]
Int_t nbfield
Double_t bave
Bool_t EndofRange
Int_t EndofRangePlane
Bool_t LastIteration
double x_k4_biased
int UseGeoSwimmer
double x_k [5]
double x_k_minus [5]
double C_k [5][5]
double C_k_minus [5][5]
double C_k_intermediate [5][5]
double F_k [5][5]
double F_k_minus [5][5]
double Q_k [5][5]
double Q_k_minus [5][5]
double K_k [5]
int H_k [5]
int Identity [5][5]
double VtxCov [5]
double EndCov [5]
int MaxPlane
int MinPlane
double DeltaZ
double DeltaPlane
VldContextvldc
const CandTrackHandletrack
bool debug
bool ZIncreasesWithTime
bool PassTrack
bool SaveData
bool SwimThroughShower
int ShowerEntryPlane
int NIter
int TotalNSwimFail
int NumFinderStrips
double MeanTrackTime
PlaneOutline fPL
double StripListTime

Constructor & Destructor Documentation

AlgFitTrackCam::AlgFitTrackCam  ) 
 

Definition at line 71 of file AlgFitTrackCam.cxx.

00072 {
00073 }

AlgFitTrackCam::~AlgFitTrackCam  )  [virtual]
 

Definition at line 78 of file AlgFitTrackCam.cxx.

00079 {
00080 }


Member Function Documentation

void AlgFitTrackCam::CalcKalmanGain const int  NewPlane  ) 
 

Definition at line 1968 of file AlgFitTrackCam.cxx.

References C_k_intermediate, H_k, K_k, MSG, and TrkStripData.

Referenced by GoBackwards(), GoForwards(), ShowerSwim(), and SpectrometerSwim().

01969 {
01970   // K_k = C_k_intermediate * H_k^T * ( V_k + H_k * C_k_intermediate * H_k^T )^-1
01971   MSG("AlgFitTrackCam",Msg::kDebug) << "CalcKalmanGain" << endl;
01972 
01973   double Denominator=0;
01974 
01975   // H_k has only one non-zero element, so we can reduce matrix multiplication required
01976   if(TrkStripData[NewPlane][0].PlaneView==2) {Denominator=C_k_intermediate[0][0];}
01977   else {Denominator=C_k_intermediate[1][1];}
01978   
01979 
01980   // Add uncertainty in measurement
01981   Denominator+=TrkStripData[NewPlane][0].TPosError;
01982 
01983   MSG("AlgFitTrackCam",Msg::kVerbose) << "V_k " << TrkStripData[NewPlane][0].TPosError 
01984                                       << ", Kalman Gain Denominator " << Denominator << endl;
01985 
01986   if (Denominator!=0.) {
01987     for (int i=0; i<5; ++i) {
01988       K_k[i]=0;
01989       
01990       for (int m=0; m<5; ++m) {K_k[i]+=(C_k_intermediate[i][m])*(H_k[m]);}
01991       
01992       K_k[i]=K_k[i]/Denominator;
01993     }
01994 
01995     MSG("AlgFitTrackCam",Msg::kVerbose) << "Kalman Gain: " 
01996                                         << K_k[0] << " " << K_k[1] << " " << K_k[2] << " "
01997                                         << K_k[3] << " " << K_k[4] << endl;
01998   }
01999   else MSG("AlgFitTrackCam",Msg::kDebug) << "V_k + (H_k * C_k_intermediate * H_k_transpose) is zero!" << endl;
02000 }

void AlgFitTrackCam::CheckValues double *  Input,
const int  NewPlane
 

Definition at line 2200 of file AlgFitTrackCam.cxx.

References EndofRange, CandTrackHandle::GetRange(), MSG, PassTrack, and track.

Referenced by UpdateStateVector().

02201 {
02202   // Make range and gradient corrections
02203   // Possible source of offset in q/p resolutions
02204 
02205   // Range check
02206     
02207   double Maxqp=4.; double Maxqpfrac=1.2;
02208   double Range=track->GetRange(NewPlane);
02209 
02210   //JAM signal end of range found
02211   if(fabs(Input[4])>10.0) EndofRange=true; 
02212 
02213    if(Range>0. && (Maxqpfrac*500/Range)<Maxqp) {Maxqp=(Maxqpfrac*500/Range);}
02214   MSG("AlgFitTrackCam",Msg::kVerbose) << " Range " << Range << " Maxqp " << Maxqp << endl;
02215 
02216 
02217 
02218   if(LastIteration) Maxqp=40;
02219   if(fabs(Input[4])>Maxqp){
02220     //    cout << " CheckValues: Range check correction " << Input[4] << " " << Maxqp << endl;
02221     MSG("AlgFitTrackCam",Msg::kVerbose) << "CheckValues, Range check correction" << endl;
02222     Input[4]=(Input[4]>0 ? Maxqp : -Maxqp);
02223   }
02224   
02225   
02226   // Gradient check
02227   double Maxgradient=25.;
02228 
02229   if(fabs(Input[2])>Maxgradient) {
02230     MSG("AlgFitTrackCam",Msg::kVerbose) << "CheckValues, Gradient correction, U" << endl;
02231     Input[2]=(Input[2]>0 ? Maxgradient : -Maxgradient);
02232   }
02233 
02234   if(fabs(Input[3])>Maxgradient) {
02235     MSG("AlgFitTrackCam",Msg::kVerbose) << "CheckValues, Gradient correction, V" << endl;
02236     Input[3]=(Input[3]>0 ? Maxgradient : -Maxgradient);
02237   }
02238   
02239 
02240   // Check u and v values are not rubbish
02241   if(fabs(Input[0])<5000. && fabs(Input[1])<5000.) {PassTrack=true;}
02242   else {
02243     PassTrack=false;
02244   }
02245 }

void AlgFitTrackCam::CleanNDLists CandFitTrackHandle cth,
CandContext cx
 

Definition at line 3427 of file AlgFitTrackCam.cxx.

References CandHandle::AddDaughterLink(), digit(), CandDigitListHandle::DupHandle(), CandStripListHandle::DupHandle(), CandRecord::FindCandHandle(), CandRecoHandle::GetCandSliceWritable(), CandDigitHandle::GetChannelId(), CandDigitHandle::GetCharge(), CandStripHandle::GetCharge(), CandHandle::GetDaughterIterator(), MomNavigator::GetFragment(), CandContext::GetMom(), CandStripHandle::GetPlane(), CandHandle::IsEqual(), CandHandle::IsSlushyEnabled(), CandHandle::RemoveDaughter(), CandHandle::SetSlushyEnabled(), and SlcStripData.

Referenced by RunAlg().

03428 {
03429 
03430 
03431   // Sort out the lists for the ND spectrometer
03432 
03433   // Delete the strip handles created in GenerateNDSpectStrips.
03434   // All strip handles not added to a track daughter list are deleted here.
03436   for(int iplane=121; iplane<=290; ++iplane){
03437     for(unsigned int i=0; i<SlcStripData[iplane].size(); ++i){
03438       CandStripHandle* delstrip = SlcStripData[iplane][i].csh;
03439       delete delstrip; 
03440     }
03441   }
03443 
03444   bool SlushyOnEntry = CandHandle::IsSlushyEnabled();
03445   CandHandle::SetSlushyEnabled(kTRUE);
03446 
03447   // Get DigitList and StripList from CandRecord
03449   const MomNavigator* mom = cx.GetMom();
03450   CandRecord* crec = dynamic_cast<CandRecord *> (mom->GetFragment("CandRecord", "PrimaryCandidateRecord"));
03451 
03452   // DupHandle step added by gmieg.  Must delete StripList and DigitList.
03453   CandStripListHandle* StripListOH = dynamic_cast<CandStripListHandle *>
03454     (crec->FindCandHandle("CandStripListHandle"));
03455   CandStripListHandle* StripList = StripListOH->DupHandle();
03456 
03457   CandDigitListHandle* DigitListOH = dynamic_cast<CandDigitListHandle *>
03458     (crec->FindCandHandle("CandDigitListHandle","canddigitlist"));
03459   CandDigitListHandle* DigitList = DigitListOH->DupHandle();
03460 
03461   CandSliceHandle* Slice = dynamic_cast<CandSliceHandle*>(cth.GetCandSliceWritable());
03463 
03464  
03465   // Compare new fitted track, with DeMuxed spectrometer strips, 
03466   // to StripList, Slice and DigitList
03468   vector<CandStripHandle*> StripsToAdd;
03469   vector<CandStripHandle*> StripsToRemove;
03470 
03471   vector<CandStripHandle*> SliceStripsToAdd;
03472   vector<CandStripHandle*> SliceStripsToRemove;
03473 
03474   vector<CandDigitHandle*> DigitsToAdd;
03475   vector<CandDigitHandle*> DigitsToRemove;
03476 
03477 
03478   CandStripHandleItr TrkStripItr(cth.GetDaughterIterator());
03479   for(CandStripHandle* TrkStrip=TrkStripItr(); TrkStrip; TrkStrip=TrkStripItr()){
03480 
03481     if(TrkStrip->GetPlane()>120 ) {
03482       CandDigitHandleItr TrkDigitItr(TrkStrip->GetDaughterIterator());
03483       CandDigitHandle* TrkDigit = dynamic_cast<CandDigitHandle*>(TrkDigitItr());
03484 
03485       // Sort out StripList
03487       if(StripList) {
03488         bool AddedTrkStrip = false;
03489         CandStripHandleItr stripItr(StripList->GetDaughterIterator());
03490         
03491         for(CandStripHandle* strip=stripItr(); strip ; strip=stripItr()) {
03492           if(strip->GetPlane()==TrkStrip->GetPlane()){
03493             CandDigitHandleItr digitItr(strip->GetDaughterIterator());
03494             CandDigitHandle* digit = dynamic_cast<CandDigitHandle*>(digitItr());
03495             bool SameCandStrip = false;
03496             bool SameHit = false;
03497             
03498             if(TrkStrip->IsEqual(strip)) {SameCandStrip = true;}
03499             
03500             if(digit->GetChannelId()==TrkDigit->GetChannelId() &&
03501                strip->GetCharge(CalDigitType::kNone)==TrkStrip->GetCharge(CalDigitType::kNone))
03502               {SameHit=true;}
03503             
03504             if(!SameCandStrip && SameHit) {
03505               StripsToRemove.push_back(strip);
03506               if(!AddedTrkStrip) {StripsToAdd.push_back(TrkStrip);}
03507               AddedTrkStrip=true;
03508             }
03509           }
03510         }
03511       }
03513       
03514 
03515 
03516       // Sort out Slice
03518       if(Slice){
03519         bool AddedTrkStrip = false;
03520         CandStripHandleItr stripItr(Slice->GetDaughterIterator());
03521 
03522         for(CandStripHandle* strip=stripItr(); strip; strip=stripItr()) {
03523           if(strip->GetPlane()==TrkStrip->GetPlane()){
03524             CandDigitHandleItr digitItr(strip->GetDaughterIterator());
03525             CandDigitHandle* digit = dynamic_cast<CandDigitHandle*>(digitItr());
03526             bool SameCandStrip = false;
03527             bool SameHit = false;
03528 
03529             if(TrkStrip->IsEqual(strip)) {SameCandStrip=true;}
03530 
03531             if(digit->GetChannelId()==TrkDigit->GetChannelId() &&
03532                strip->GetCharge(CalDigitType::kNone)==TrkStrip->GetCharge(CalDigitType::kNone))
03533               {SameHit=true;}
03534 
03535             if(!SameCandStrip && SameHit) {
03536               SliceStripsToRemove.push_back(strip);
03537               if(!AddedTrkStrip) {SliceStripsToAdd.push_back(TrkStrip);}
03538               AddedTrkStrip=true;
03539             }
03540           }
03541         }
03542       }
03544 
03545 
03546       // Loop over track strip Digits, and rationalise DigitList
03548       if(DigitList) {
03549         CandDigitHandleItr TrkDigitItr2(TrkStrip->GetDaughterIterator());
03550         for(TrkDigit=TrkDigitItr2(); TrkDigit ; TrkDigit=TrkDigitItr2()) {
03551           bool AddedTrkDigit=false;
03552           CandDigitHandleItr DigitItr(DigitList->GetDaughterIterator());
03553 
03554           for(CandDigitHandle* digit=DigitItr(); digit; digit=DigitItr()) {
03555             bool SameCandDigit=false;
03556             bool SameHit=false;
03557 
03558             if(TrkDigit->IsEqual(digit)) {SameCandDigit=true;}
03559 
03560             if(digit->GetChannelId()==TrkDigit->GetChannelId() &&
03561                digit->GetCharge(CalDigitType::kNone)==TrkDigit->GetCharge(CalDigitType::kNone))
03562               {SameHit=true;}
03563 
03564             if(!SameCandDigit && SameHit) {
03565               DigitsToRemove.push_back(digit);
03566               if(!AddedTrkDigit) {DigitsToAdd.push_back(TrkDigit);}
03567               AddedTrkDigit=true;
03568             }
03569           }
03570         }
03571       }
03573     
03575     }
03576   } // End loop over track strips
03577 
03578 
03579   // Now make the actual modifications to the lists
03581   for(unsigned int i=0; i<StripsToAdd.size(); ++i) {StripList->AddDaughterLink(*(StripsToAdd[i]));}
03582   for(unsigned int i=0; i<StripsToRemove.size(); ++i) {StripList->RemoveDaughter(StripsToRemove[i]);}
03583   StripsToAdd.clear();
03584   StripsToRemove.clear();
03585 
03586   for(unsigned int i=0; i<SliceStripsToAdd.size(); ++i) {Slice->AddDaughterLink(*(SliceStripsToAdd[i]));}
03587   for(unsigned int i=0; i<SliceStripsToRemove.size(); ++i) {Slice->RemoveDaughter(SliceStripsToRemove[i]);}
03588   SliceStripsToAdd.clear();
03589   SliceStripsToRemove.clear();
03590 
03591   for(unsigned int i=0; i<DigitsToAdd.size(); ++i) {DigitList->AddDaughterLink(*(DigitsToAdd[i]));}
03592   for(unsigned int i=0; i<DigitsToRemove.size(); ++i) {DigitList->RemoveDaughter(DigitsToRemove[i]);}
03593   DigitsToAdd.clear();
03594   DigitsToRemove.clear();
03596 
03597   
03599 
03600   // Must delete DupHandle StripList and Digitlist (gmieg)
03601   delete StripList;
03602   delete DigitList;
03603 
03604   if(!SlushyOnEntry) CandHandle::SetSlushyEnabled(kFALSE); 
03605 }

void AlgFitTrackCam::ExtrapCovMatrix  ) 
 

Definition at line 1919 of file AlgFitTrackCam.cxx.

References C_k_intermediate, C_k_minus, F_k_minus, MSG, and Q_k_minus.

Referenced by GoBackwards(), GoForwards(), ShowerSwim(), and SpectrometerSwim().

01920 {
01921   // C_k_intermediate = (F_k_minus * C_k_minus * F_k_minus^T) + Q_k_minus
01922   MSG("AlgFitTrackCam",Msg::kDebug) << "ExtrapCovMatrix" << endl;
01923 
01924   for (int i=0; i<5; ++i) {
01925     for (int j=0; j<5; ++j) {  
01926       C_k_intermediate[i][j]=0;
01927       
01928       for (int l=0; l<5; ++l) {
01929         for (int m=0; m<5; ++m) {   
01930           C_k_intermediate[i][j]+=F_k_minus[i][m]*C_k_minus[m][l]*F_k_minus[j][l];
01931         }
01932       }
01933 
01934       C_k_intermediate[i][j]+=Q_k_minus[i][j];
01935     }
01936     
01937   }
01938 
01939 
01940   // Diagonal elements should be positive
01941   double covlim = 1.e-8;
01942 
01943   for(int i=0; i<5; ++i) {
01944     if(C_k_intermediate[i][i]<covlim) {
01945       MSG("AlgFitTrackCam",Msg::kVerbose) << "Negative diagonal element in C_k_intermediate" << endl;
01946       C_k_intermediate[i][i]=covlim;
01947     }
01948   }
01949 
01950 
01951   // Display
01952   if(debug) {
01953     cout << "C_k_intermediate" << endl;
01954     for(int i=0; i<5; ++i) {
01955       for(int j=0; j<5; ++j) {
01956         cout << C_k_intermediate[i][j] << " ";
01957       }
01958       cout << endl;
01959     }
01960   }
01961   
01962 }

void AlgFitTrackCam::FillGapsInTrack  ) 
 

Definition at line 798 of file AlgFitTrackCam.cxx.

References FilteredData, MaxPlane, MinPlane, MSG, SlcStripData, Swim(), FiltDataStruct::x_k0, FiltDataStruct::x_k1, FiltDataStruct::x_k2, FiltDataStruct::x_k3, FiltDataStruct::x_k4, and ZIncreasesWithTime.

Referenced by RunTheFitter().

00799 {
00800   // If there is no filtered data for a plane (between MinPlane and MaxPlane),
00801   // but this plane has hits in the slice, we interpolate from the nearest 
00802   // state vectors
00803   //
00804   // As with all filtered data, the interpolated data will be compared to
00805   // strip positions in the FindTheStrips method
00806   MSG("AlgFitTrackCam",Msg::kDebug) << "FillGapsInTrack" << endl;
00807 
00808 
00809   int CurrentPlane; int ForwardsPlane; int BackwardsPlane;
00810   int Plane; int NewPlane;  bool GoForward;
00811   double StateVector[5]; double Prediction[5]; bool GetPrediction;
00812   for(int i=0; i<5; i++) { Prediction[i]=0.; }
00813 
00814 
00815   for (int i=MinPlane; i<=MaxPlane; ++i) {   
00816     if(SlcStripData[i].size()>0) {
00817  
00818       if(FilteredData[i].size()==0) {
00819 
00820 
00821         // Find nearest filtered state vectors (within two planes) and ZPos differences
00823         // Forwards
00824         CurrentPlane=i+1; ForwardsPlane=-99;
00825 
00826         while(CurrentPlane<=MaxPlane && CurrentPlane<=(i+2)) {
00827           if(FilteredData[CurrentPlane].size()>0) {ForwardsPlane=CurrentPlane; break;}
00828           else {CurrentPlane++;}
00829         }
00830 
00831         // Backwards
00832         CurrentPlane=i-1; BackwardsPlane=-99;
00833 
00834         while(CurrentPlane>=MinPlane && CurrentPlane>=(i-2) ) {
00835           if(FilteredData[CurrentPlane].size()>0) {BackwardsPlane=CurrentPlane; break;}
00836           else {CurrentPlane--;}
00837         }
00839 
00840 
00841         // Find and store possible new filtered data, range and dS
00843         if(ForwardsPlane!=-99 && BackwardsPlane!=-99) {
00844 
00845           // Swimmer method
00846           GetPrediction=false;
00847           NewPlane=i;
00848           if(ZIncreasesWithTime==true) {Plane=ForwardsPlane; GoForward=false;}
00849           else{Plane=BackwardsPlane; GoForward=true;}
00850           if(FilteredData[Plane].size()>0) {
00851             StateVector[0] = FilteredData[Plane][0].x_k0;
00852             StateVector[1] = FilteredData[Plane][0].x_k1;
00853             StateVector[2] = FilteredData[Plane][0].x_k2;
00854             StateVector[3] = FilteredData[Plane][0].x_k3;
00855             StateVector[4] = FilteredData[Plane][0].x_k4;           
00856             GetPrediction=Swim(StateVector, Prediction, Plane, NewPlane, GoForward);
00857             
00858             if(GetPrediction==true) {
00859               // Store possible new state vector
00860               FiltDataStruct temp;
00861               temp.x_k0 = Prediction[0];
00862               temp.x_k1 = Prediction[1];
00863               temp.x_k2 = Prediction[2]; 
00864               temp.x_k3 = Prediction[3];
00865               temp.x_k4 = Prediction[4];              
00866               FilteredData[i].push_back(temp);
00867             }
00868           }
00869 
00870         }
00872       }
00873     }
00874   }
00875 
00876 }

bool AlgFitTrackCam::FindTheStrips CandFitTrackCamHandle cth,
bool  MakeTheTrack
 

Definition at line 882 of file AlgFitTrackCam.cxx.

References abs(), CandHandle::AddDaughterLink(), StripStruct::csh, FilteredData, CandStripHandle::GetCharge(), CandStripHandle::GetPlane(), InitTrkStripData, MaxPlane, MinPlane, CandHandle::RemoveDaughter(), SlcStripData, FiltDataStruct::x_k0, FiltDataStruct::x_k1, and ZIncreasesWithTime.

Referenced by RunTheFitter().

00883 { 
00884   // Given output data from Kalman filter, we find the strips that match most closely
00885   // and store the CandStripHandles in plane order in InitTrkStripData
00886   //
00887   // At end of track fitting, method is called with MakeTheTrack==true, so fit track
00888   // strips are finalised
00889 
00890   // JM ADDED 6/07:  Add pulse height requirement for first 3 hits at track vertex, and 
00891   //                 remove isolated single hit at vertex. This reduces tendency to add 
00892   //                 extra hits upstream of vertex.
00893   
00894   // Initialisations
00896   for (unsigned int i=0; i<490; ++i) {InitTrkStripData[i].clear();}
00897 
00898   double Extrem1=0; double Extrem2=0;
00899   double StripCentre=0;
00900   double StripWidth=4.108e-2;
00901   double HalfStripWidth=0.5*StripWidth;
00902   double TwoStripWidth=2.*StripWidth;  
00903   double PEthresh = 4.0;
00904   double MinDistanceToStrip;
00906   
00907   int NoOfHitPlanes=0; int Counter=0; int PlanesAdded=0;
00908   Bool_t foundMIP=false;
00909   for (int i=MinPlane; i<=MaxPlane; ++i) {if(FilteredData[i].size()>0) {NoOfHitPlanes++;} }
00910 
00911   // Loop over the entire output from Kalman filter
00913   
00914   if(ZIncreasesWithTime==true){
00915     for (int i=MinPlane; i<=MaxPlane; ++i) {   
00916       if(FilteredData[i].size()>0) {
00917         Counter++;
00918         int numStrips = 0;
00919         
00920         // Mark the possible extremities in transverse position within scintillator
00921         // by multiplying gradient by half scintillator thickness and adding or subtracting
00922         if(SlcStripData[i][0].csh->GetPlaneView()==2) {
00923           Extrem1=FilteredData[i][0].x_k0 + (0.0055*FilteredData[i][0].x_k2);
00924           Extrem2=FilteredData[i][0].x_k0 - (0.0055*FilteredData[i][0].x_k2);
00925         }
00926         else {
00927           Extrem1=FilteredData[i][0].x_k1 + (0.0055*FilteredData[i][0].x_k3);
00928           Extrem2=FilteredData[i][0].x_k1 - (0.0055*FilteredData[i][0].x_k3);
00929         }
00930         
00931         // Add strips in the case that only one strip can have its centre within 
00932         // half a strip width of an extremal position...
00934         if(fabs(Extrem1-Extrem2)<StripWidth) {
00935           for(unsigned int j=0; j<SlcStripData[i].size(); ++j) {
00936             StripCentre=SlcStripData[i][j].csh->GetTPos();
00937             
00938             if(fabs(StripCentre-Extrem1)<HalfStripWidth || fabs(StripCentre-Extrem2)<HalfStripWidth) {
00939               if(Counter>1 || SlcStripData[i][j].csh->GetCharge()>PEthresh || foundMIP==true){
00940                 foundMIP=true;
00941                 if(MakeTheTrack==true) {cth.AddDaughterLink(*SlcStripData[i][j].csh);}        
00942                 InitTrkStripData[i].push_back(SlcStripData[i][j]);
00943         
00944                 if(j==0)PlanesAdded++;          
00945               } 
00946               
00947               numStrips++;
00948             }
00949           }
00950         }
00952         
00953         
00954         // ...Otherwise, cover the cases where multiple strips can have their centre
00955         // within half a strip width of an extremal position
00957         else {
00958           for(unsigned int j=0; j<SlcStripData[i].size(); ++j) {
00959             StripCentre=SlcStripData[i][j].csh->GetTPos();
00960             
00961             if( fabs(StripCentre-Extrem1)<HalfStripWidth || fabs(StripCentre-Extrem2)<HalfStripWidth
00962                 || (Extrem1>StripCentre && Extrem2<StripCentre) 
00963                 || (Extrem1<StripCentre && Extrem2>StripCentre) ) {
00964               if(Counter>1 || SlcStripData[i][j].csh->GetCharge()>PEthresh || foundMIP==true){
00965                 foundMIP=true;
00966                 if(MakeTheTrack==true) {cth.AddDaughterLink(*SlcStripData[i][j].csh);}
00967                 InitTrkStripData[i].push_back(SlcStripData[i][j]);
00968                 if(j==0)PlanesAdded++;
00969               }
00970               numStrips++;            
00971 
00972             }
00973           }
00974         }
00976         // If we have found no strips, we consider looking further, finding the closest  
00977         // strip within a distance 'MinDistanceToStrip' of an extremal position
00979         if(numStrips==0) {
00980           CandStripHandle* CurrentStrip=0;
00981           
00982           // Be more demanding near track vertex
00983           if(Counter>2) {
00984             MinDistanceToStrip = TwoStripWidth;
00985             if(MakeTheTrack==true) MinDistanceToStrip = 2*TwoStripWidth;
00986           }
00987           else {MinDistanceToStrip=StripWidth;}
00988           for(unsigned int j=0; j<SlcStripData[i].size(); ++j) {
00989             StripCentre=SlcStripData[i][j].csh->GetTPos();
00990             
00991             // Find the closest strip and temporarily store its CandStripHandle
00992             if(fabs(StripCentre-Extrem1)<MinDistanceToStrip) {
00993               MinDistanceToStrip=StripCentre-Extrem1;
00994               CurrentStrip=SlcStripData[i][j].csh;
00995             }
00996             if(fabs(StripCentre-Extrem2)<MinDistanceToStrip) {
00997               MinDistanceToStrip=StripCentre-Extrem2;
00998               CurrentStrip=SlcStripData[i][j].csh;
00999             }
01000           }
01001           
01002           // If we have found a strip then we add it
01003           if(CurrentStrip) {
01004             if(Counter>1 || CurrentStrip->GetCharge()>PEthresh || foundMIP==true){
01005               foundMIP=true;
01006               if(MakeTheTrack==true) {cth.AddDaughterLink(*CurrentStrip);}          
01007               StripStruct temp;
01008               temp.csh = CurrentStrip;
01009               InitTrkStripData[i].push_back(temp);
01010               PlanesAdded++;
01011             }
01012           }
01013         }
01015       }
01016       if(PlanesAdded==3 ){  // remove first hit if it is separated by >1 plane from second
01017         Int_t np = 0;
01018         Int_t planebuf[3];
01019         Int_t pln = MinPlane;
01020         while(np<3 && pln<490){
01021           if(InitTrkStripData[pln].size()>0){
01022             planebuf[np] = InitTrkStripData[pln][0].csh->GetPlane();
01023             np++;
01024           }
01025           pln++;
01026         }
01027         if(np==3){
01028           if(abs(planebuf[1]-planebuf[0])/abs(planebuf[2]-planebuf[1])>1.5){
01029             for(unsigned int j=0; j<InitTrkStripData[planebuf[0]].size(); ++j) {
01030               CandStripHandle* Strip = InitTrkStripData[planebuf[0]][j].csh;     
01031               cth.RemoveDaughter(Strip);
01032             }
01033             InitTrkStripData[planebuf[0]].clear();
01034           }
01035         }
01036       }
01037     }
01038   }
01039   else{
01040     for (int i=MaxPlane; i>=MinPlane; --i) {   
01041       if(FilteredData[i].size()>0) {
01042         Counter++;
01043         int numStrips=0;
01044         
01045         
01046         // Mark the possible extremities in transverse position within scintillator
01047         // by multiplying gradient by half scintillator thickness and adding or subtracting
01048         if(SlcStripData[i][0].csh->GetPlaneView()==2) {
01049           Extrem1=FilteredData[i][0].x_k0 + (0.0055*FilteredData[i][0].x_k2);
01050           Extrem2=FilteredData[i][0].x_k0 - (0.0055*FilteredData[i][0].x_k2);
01051         }
01052         else {
01053           Extrem1=FilteredData[i][0].x_k1 + (0.0055*FilteredData[i][0].x_k3);
01054           Extrem2=FilteredData[i][0].x_k1 - (0.0055*FilteredData[i][0].x_k3);
01055         }
01056         
01057         
01058         // Add strips in the case that only one strip can have its centre within 
01059         // half a strip width of an extremal position...
01061         if(fabs(Extrem1-Extrem2)<StripWidth) {
01062           for(unsigned int j=0; j<SlcStripData[i].size(); ++j) {
01063             StripCentre=SlcStripData[i][j].csh->GetTPos();
01064             
01065             if(fabs(StripCentre-Extrem1)<HalfStripWidth || fabs(StripCentre-Extrem2)<HalfStripWidth) {
01066               if(Counter>1 || SlcStripData[i][j].csh->GetCharge()>PEthresh || foundMIP){
01067                 foundMIP=true;
01068                 if(MakeTheTrack==true) {cth.AddDaughterLink(*SlcStripData[i][j].csh);}
01069                 InitTrkStripData[i].push_back(SlcStripData[i][j]);
01070                 numStrips++;
01071                 if(j==0)PlanesAdded++;
01072               }      
01073             }
01074           }
01075         }
01077         
01078         
01079         // ...Otherwise, cover the cases where multiple strips can have their centre
01080         // within half a strip width of an extremal position
01082         else {
01083           for(unsigned int j=0; j<SlcStripData[i].size(); ++j) {
01084             StripCentre=SlcStripData[i][j].csh->GetTPos();
01085             
01086             if( fabs(StripCentre-Extrem1)<HalfStripWidth || fabs(StripCentre-Extrem2)<HalfStripWidth
01087                 || (Extrem1>StripCentre && Extrem2<StripCentre) 
01088                 || (Extrem1<StripCentre && Extrem2>StripCentre) ) {
01089               if(Counter>1 || SlcStripData[i][j].csh->GetCharge()>PEthresh || foundMIP){
01090                 foundMIP=true;
01091                 if(MakeTheTrack==true) {cth.AddDaughterLink(*SlcStripData[i][j].csh);}          
01092                 InitTrkStripData[i].push_back(SlcStripData[i][j]);
01093                 numStrips++;
01094                 if(j==0)PlanesAdded++;
01095               }
01096             }
01097           }
01098         }
01100         
01101         // If we have found no strips, we consider looking further, finding the closest  
01102         // strip within a distance 'MinDistanceToStrip' of an extremal position
01104         if(numStrips==0) {
01105           CandStripHandle* CurrentStrip=0;
01106           
01107           // Be more demanding near track vertex
01108           if(Counter>2) {
01109             MinDistanceToStrip = TwoStripWidth;
01110             if(MakeTheTrack==true) MinDistanceToStrip = 2*TwoStripWidth;
01111           }
01112           else {MinDistanceToStrip=StripWidth;}
01113           
01114           for(unsigned int j=0; j<SlcStripData[i].size(); ++j) {
01115             StripCentre=SlcStripData[i][j].csh->GetTPos();
01116             
01117             // Find the closest strip and temporarily store its CandStripHandle
01118             if(fabs(StripCentre-Extrem1)<MinDistanceToStrip) {
01119               MinDistanceToStrip=StripCentre-Extrem1;
01120               CurrentStrip=SlcStripData[i][j].csh;
01121             }
01122             if(fabs(StripCentre-Extrem2)<MinDistanceToStrip) {
01123               MinDistanceToStrip=StripCentre-Extrem2;
01124               CurrentStrip=SlcStripData[i][j].csh;
01125             }
01126           }
01127           
01128           // If we have found a strip then we add it
01129           if(CurrentStrip) {
01130             if(Counter>1 || CurrentStrip->GetCharge()>PEthresh || foundMIP){
01131               foundMIP=true;    
01132               if(MakeTheTrack==true) {cth.AddDaughterLink(*CurrentStrip);}
01133               StripStruct temp;
01134               temp.csh = CurrentStrip;
01135               InitTrkStripData[i].push_back(temp);
01136               PlanesAdded++;
01137             }
01138           }
01139         }
01141       }
01142      if(PlanesAdded==3 ){  // remove first hit if it is separated by >1 plane from second
01143         Int_t np = 0;
01144         Int_t planebuf[3];
01145         Int_t pln = MaxPlane;
01146         while(np<3 && pln>=0){
01147           if(InitTrkStripData[pln].size()>0){
01148             planebuf[np]= InitTrkStripData[pln][0].csh->GetPlane();
01149             np++;
01150           }
01151           pln--;
01152         }
01153         if(np==3){
01154           if(abs(planebuf[1]-planebuf[0])/abs(planebuf[2]-planebuf[1])>1.5){
01155           for(unsigned int j=0; j<InitTrkStripData[planebuf[0]].size(); ++j) {
01156             CandStripHandle* Strip = InitTrkStripData[planebuf[0]][j].csh;       
01157             cth.RemoveDaughter(Strip);
01158           }
01159           InitTrkStripData[planebuf[0]].clear();
01160           }
01161         }
01162       }
01163     }  
01164   }
01166   
01167 
01168   // Find new max and min planes
01169   MaxPlane=-20; MinPlane=500;
01170   for (int i=0; i<490; ++i) {   
01171     if(InitTrkStripData[i].size()>0) {
01172       if(i>MaxPlane) {MaxPlane=i;}
01173       if(i<MinPlane) {MinPlane=i;}
01174     }
01175   }
01176 
01177   if(MaxPlane==-20 || MinPlane==500) {return false;}
01178   else {return true;}
01179 
01180 }

void AlgFitTrackCam::GenerateNDSpectStrips const CandSliceHandle slice,
CandContext cx
 

Definition at line 3122 of file AlgFitTrackCam.cxx.

References StripStruct::csh, CandDigitHandle::DupHandle(), AlgFactory::GetAlgHandle(), PlexSEIdAltL::GetBestWeight(), CandHandle::GetCandRecord(), CandHandle::GetDaughterIterator(), AlgFactory::GetInstance(), CandContext::GetMom(), CandStripHandle::GetPlane(), CandStripHandle::GetPlaneView(), CandDigitHandle::GetPlexSEIdAltL(), CandDigitHandle::GetPlexSEIdAltLWritable(), CandStrip::MakeCandidate(), MSG, NumFinderStrips, CandHandle::SetCandRecord(), and SlcStripData.

Referenced by InitialFramework().

03123 {
03124   MSG("AlgFitTrackCam",Msg::kDebug) << "GenerateNDSpectStrips" << endl;
03125 
03126   bool AlreadyAssigned;
03127 
03128 
03129   CandContext cxx(this,cx.GetMom());
03130 
03131   // Get singleton instance of AlgFactory
03132   AlgFactory &af = AlgFactory::GetInstance();
03133   AlgHandle stripah = af.GetAlgHandle("AlgStripSR","default");
03134 
03135   // Store CandStripHandles and make the strips accessible by plane number
03136   TIter SlcStripItr = slice->GetDaughterIterator();
03137   StripStruct temp;
03138   
03139   // Store all strips in slice
03140   while(CandStripHandle* SlcStrip = dynamic_cast<CandStripHandle*>(SlcStripItr()))  {
03141     if (SlcStrip->GetPlane()>120 && (SlcStrip->GetPlaneView()==PlaneView::kU || SlcStrip->GetPlaneView()==PlaneView::kV) ) {
03142       AlreadyAssigned=false;
03143       
03144       TIter digitItr(SlcStrip->GetDaughterIterator());
03145       CandDigitHandle* dig = dynamic_cast<CandDigitHandle*>(digitItr());              
03146       const PlexSEIdAltL& altl = dig->GetPlexSEIdAltL();
03147       int siz = altl.size();
03148       
03149       for (int ind = 0; ind<siz; ++ind) {
03150         // Only want to make the single copy of an assigned strip
03151         if(AlreadyAssigned) {break;}
03152         
03153         TObjArray diglist;  
03154         TIter newstripdauItr(SlcStrip->GetDaughterIterator());
03155         
03156         while(CandDigitHandle* olddig = dynamic_cast<CandDigitHandle*>(newstripdauItr())) {
03157           CandDigitHandle* newdig = olddig->DupHandle();
03158           PlexSEIdAltL& newaltl = newdig->GetPlexSEIdAltLWritable(); 
03159           
03160           // Don't make any strips which have already been assigned to a 'better' track
03161           if(NumFinderStrips<=newaltl.GetBestWeight()) {AlreadyAssigned=true; delete newdig;}
03162           else {
03163             for (int newind = 0; newind < siz; ++newind) {
03164               if(newind==ind){newaltl[newind].SetWeight((float)NumFinderStrips);}
03165               else{newaltl[newind].SetWeight((float)0.);}
03166             }
03167             
03168             newdig->SetCandRecord(olddig->GetCandRecord());
03169             diglist.Add(newdig);   // diglist does not own newdig. These must be explicitly deleted 
03170           }
03171         
03172         }
03173         // Only make a new strip if we have any digits  
03174         if(1+diglist.GetLast()>0) {
03175           cxx.SetDataIn(&diglist);
03176           CandStripHandle newstrip = CandStrip::MakeCandidate(stripah,cxx);
03177           newstrip.SetCandRecord(slice->GetCandRecord());
03178           CandStripHandle* daustrip = new CandStripHandle(newstrip);
03179           
03180           for (int i=0; i<=diglist.GetLast(); ++i) {
03181             CandDigitHandle* deldig =  dynamic_cast<CandDigitHandle*>(diglist.At(i));
03182             delete deldig;
03183           }
03184           temp.csh=daustrip;      
03185           SlcStripData[SlcStrip->GetPlane()].push_back(temp);
03186         }
03187       }
03188     }
03189   }
03190   SlcStripItr.Reset();
03191 }

bool AlgFitTrackCam::GetCombiPropagator const int  Plane,
const int  NewPlane,
const bool  GoForward
 

Definition at line 1350 of file AlgFitTrackCam.cxx.

References abs(), DeltaPlane, DeltaZ, F_k_minus, MSG, Swim(), TotalNSwimFail, TrkStripData, and x_k_minus.

Referenced by GoBackwards(), GoForwards(), ShowerSwim(), and SpectrometerSwim().

01351 {
01352   // Combination propagator, essentially same as SR propagator, but
01353   // generation of matrix reduces calls to swimmer by 80%
01354   MSG("AlgFitTrackCam",Msg::kDebug) << "GetCombiPropagator" << endl;
01355 
01356   for (int i=0; i<5; ++i) {
01357     for (int j=0; j<5; ++j) {
01358       F_k_minus[i][j]=0;  
01359     }
01360   }
01361 
01362   F_k_minus[0][0]=1; F_k_minus[1][1]=1; 
01363   F_k_minus[2][2]=1; F_k_minus[3][3]=1;
01364   
01365   DeltaZ=fabs(TrkStripData[NewPlane][0].ZPos-TrkStripData[Plane][0].ZPos);
01366   DeltaPlane=abs(NewPlane-Plane);
01367 
01368   // Swimmer section for last column
01369   double PState[5];  double NState[5];  double StateVector[5];
01370   double Increment=0.01;
01371   bool SwimInc=false; bool SwimDec=false;
01372   int nswimfail=0;
01373   
01374   if(GoForward==true) {F_k_minus[0][2]=DeltaZ; F_k_minus[1][3]=DeltaZ;}
01375   else if(GoForward==false) {F_k_minus[0][2]=-DeltaZ; F_k_minus[1][3]=-DeltaZ;}
01376   
01377   
01378   // Give swimmer fixed number of opportunities for successful swim
01379   while((SwimInc==false || SwimDec==false) && nswimfail<=10) {
01380     
01381     Increment=0.05*fabs(x_k_minus[4]); 
01382     if(Increment<.01) {Increment=.01;}
01383        
01384     for(int j=0; j<5; ++j) {StateVector[j]=x_k_minus[j];}  
01385     
01386     // Increment then swim
01387     StateVector[4]+=Increment;
01388     SwimInc=Swim(StateVector, NState, Plane, NewPlane, GoForward);
01389     
01390     StateVector[4]=x_k_minus[4];
01391     
01392     // Decrement then swim
01393     StateVector[4]-=Increment;
01394     SwimDec=Swim(StateVector, PState, Plane, NewPlane, GoForward);
01395     
01396     // If swim failed, double momentum and swim again
01397     if(SwimInc==false || SwimDec==false) {
01398       MSG("AlgFitTrackCam",Msg::kVerbose) << "GetCombiPropagator, Swim failed - Double momentum and swim again" << endl;
01399       x_k_minus[4]*=0.5;
01400       nswimfail++; TotalNSwimFail++;
01401       break;
01402     }
01403     
01404     // Form last row of propagator matrix.  Need to transpose to get proper Kalman F_k_minus
01405     else {
01406       if(Increment!=0.) {
01407         for(int j=0; j<5; ++j) {
01408           F_k_minus[j][4] = (NState[j]-PState[j]) / (2*Increment);
01409         }
01410       }
01411       else {F_k_minus[4][4]=1;}
01412     }
01413     
01414   } // End while statement
01415   
01416   if(nswimfail>10) {MSG("AlgFitTrackCam",Msg::kDebug) << "GetCombiPropagator, nswimfail>10, fail track" << endl; return false;}
01417 
01418 
01419   // Display
01420   if(debug) {
01421     cout << "Combi F_k_minus" << endl;
01422     for(int i=0; i<5; ++i) {  
01423       for(int j=0; j<5; ++j) {
01424         cout << F_k_minus[i][j] << " ";
01425       }
01426       cout << endl;
01427     }
01428   }
01429   
01430   return true;
01431 }

void AlgFitTrackCam::GetFitData int  Plane1,
int  Plane2
 

Definition at line 703 of file AlgFitTrackCam.cxx.

References CandRecoHandle::GetCharge(), Plane::GetStrip(), CandTrackHandle::GetU(), CandTrackHandle::GetV(), InitTrkStripData, MSG, TrkDataStruct::PlaneView, SlcStripData, TrkDataStruct::TPos, TrkDataStruct::TPosError, track, TrkStripData, and TrkDataStruct::ZPos.

Referenced by RunAlg(), RunTheFitter(), SetTrackProperties(), ShowerSwim(), and SpectrometerSwim().

00704 {
00705   // Loop over the initial track strip data and create the final data for fitting
00706   MSG("AlgFitTrackCam",Msg::kDebug) << "GetFitData" << endl;
00707 
00708   // Initialisations
00709   double MisalignmentError=4e-6;  // Squared error for misalignment of strips
00710   double SumChargeTPos=0; double SumCharge=0; int MaxStrip=-20; int MinStrip=200;
00711   bool NewStripFound=true;
00712 
00713   int ThisStrip;
00714 
00715   // Get the data for region between the planes specified
00716   for(int i=Plane1; i<=Plane2; ++i) {
00717     if(InitTrkStripData[i].size()>0) {     
00718       
00719       // Find max and min strip numbers for strips in plane
00720       for(unsigned int j=0; j<InitTrkStripData[i].size(); ++j) {
00721         if(InitTrkStripData[i][j].csh->GetStrip()<MinStrip) {MinStrip=InitTrkStripData[i][j].csh->GetStrip();}
00722         if(InitTrkStripData[i][j].csh->GetStrip()>MaxStrip) {MaxStrip=InitTrkStripData[i][j].csh->GetStrip();}  
00723       }
00724 
00725 
00726       // Find continuous groups of strips
00728       NewStripFound=true;
00729       
00730       while(NewStripFound==true) {
00731         
00732         NewStripFound=false;
00733         
00734         for(unsigned int j=0; j<SlcStripData[i].size(); ++j) {
00735 
00736           ThisStrip=SlcStripData[i][j].csh->GetStrip();
00737 
00738           if( ThisStrip==(MaxStrip+1) ) {
00739             MaxStrip+=1;
00740             NewStripFound=true;
00741             
00742             InitTrkStripData[i].push_back(SlcStripData[i][j]);
00743           }
00744           
00745           if( ThisStrip==(MinStrip-1) ) {
00746             MinStrip-=1;
00747             NewStripFound=true;
00748             
00749             InitTrkStripData[i].push_back(SlcStripData[i][j]);
00750           }
00751         }
00752       }
00754 
00755 
00756 
00757       // Get the data for fitting
00759       for(unsigned int j=0; j<InitTrkStripData[i].size(); ++j) {
00760         SumCharge+=InitTrkStripData[i][j].csh->GetCharge();
00761 
00762         // JAM 11/08:  Change to support strip rotations
00763         PlaneView::PlaneView_t plnvw =InitTrkStripData[i][j].csh->GetPlaneView();
00764         Double_t orthopos = track->GetV(InitTrkStripData[i][j].csh->GetPlane());
00765         if(plnvw == PlaneView::kV){
00766           orthopos = track->GetU(InitTrkStripData[i][j].csh->GetPlane());
00767         }
00768         // JAM 11/08:  to activate strip rotation support add orthopos as argument to GetTPos()
00769         SumChargeTPos+=InitTrkStripData[i][j].csh->GetCharge()*InitTrkStripData[i][j].csh->GetTPos();
00770       }
00771 
00772       // Charge weighted TPos and Flat distribution error
00773       if(SumCharge!=0.) {
00774         TrkDataStruct temp;
00775         
00776         temp.ZPos=InitTrkStripData[i][0].csh->GetZPos();
00777         temp.PlaneView=InitTrkStripData[i][0].csh->GetPlaneView();
00778 
00779         temp.TPos=SumChargeTPos/SumCharge;
00780         temp.TPosError=( (1.406305333e-4 * (1 + MaxStrip-MinStrip) )+ MisalignmentError);
00781         
00782         TrkStripData[i].push_back(temp);
00783       }
00785 
00786 
00787       // Reset      
00788       SumChargeTPos=0; SumCharge=0; MaxStrip=-20; MinStrip=200;
00789     }
00790   }
00791   
00792 }

void AlgFitTrackCam::GetInitialCovarianceMatrix const bool  FirstIteration  ) 
 

Definition at line 1734 of file AlgFitTrackCam.cxx.

References C_k_minus, min, MSG, and ZIncreasesWithTime.

Referenced by ResetCovarianceMatrix(), and RunTheFitter().

01735 {
01736   MSG("AlgFitTrackCam",Msg::kDebug) << "GetInitialCovarianceMatrix" << endl;
01737 
01738   if(FirstIteration==true) {
01739     
01740     for(int i=0; i<5; ++i) {
01741       for(int j=0; j<5; ++j) {
01742         C_k_minus[i][j]=0.;
01743       }
01744     }
01745     
01746     // Diagonal terms
01747     C_k_minus[0][0]=0.25; C_k_minus[1][1]=0.25; 
01748     C_k_minus[2][2]=100.; C_k_minus[3][3]=100.; 
01749     C_k_minus[4][4]=1.;
01750     
01751     // Off diagonal terms. Taken from SR - Origin of this?
01752     if(ZIncreasesWithTime==true) {
01753       C_k_minus[0][4]=7.5e-5;  C_k_minus[1][4]=7.5e-5;
01754       C_k_minus[4][0]=7.5e-5;  C_k_minus[4][1]=7.5e-5;
01755     }
01756     else if(ZIncreasesWithTime==false) {
01757       C_k_minus[0][4]=-7.5e-5;  C_k_minus[1][4]=-7.5e-5;
01758       C_k_minus[4][0]=-7.5e-5;  C_k_minus[4][1]=-7.5e-5;
01759     }
01760     
01761     
01762   }
01763 
01764   else if(FirstIteration==false) {
01765     // Results are very sensitive to this multiplication. A large number means
01766     // that further iterations start with the same uncertainties as the first,
01767     // albeit with improved "track finder" strips
01768     for(int i=0; i<5; ++i) {C_k_minus[i][i]*=100;}
01769     
01770     
01771     // Make sure not larger than very first covariance elements
01772     C_k_minus[0][0]=min(C_k_minus[0][0],0.25); C_k_minus[1][1]=min(C_k_minus[1][1],0.25);
01773     C_k_minus[2][2]=min(C_k_minus[2][2],100.); C_k_minus[3][3]=min(C_k_minus[3][3],100.);
01774     C_k_minus[4][4]=min(C_k_minus[4][4],1.);
01775 
01776     double cov_xqp = 7.5e-5;             // Taken from SR - Origin of this?
01777     
01778     for(int i=0; i<2; ++i){
01779       if(fabs(C_k_minus[i][4])>cov_xqp) C_k_minus[i][4] = (C_k_minus[i][4] > 0 ? cov_xqp : -cov_xqp);
01780       if(fabs(C_k_minus[4][i])>cov_xqp) C_k_minus[4][i] = (C_k_minus[4][i] > 0 ? cov_xqp : -cov_xqp);
01781     }
01782 
01783     cov_xqp /= 0.06;                     // Taken from SR - Origin of this?
01784 
01785     for(int i=2; i<4; ++i){
01786       if(fabs(C_k_minus[i][4])>cov_xqp) C_k_minus[i][4] = (C_k_minus[i][4] > 0 ? cov_xqp : -cov_xqp);
01787       if(fabs(C_k_minus[4][i])>cov_xqp) C_k_minus[4][i] = (C_k_minus[4][i] > 0 ? cov_xqp : -cov_xqp);
01788     }
01789   }
01790 
01791 
01792   // Display
01793   if(debug) {
01794     cout << "Initial covariance matrix" << endl;
01795     for(int p=0; p<5; ++p){
01796       for(int q=0; q<5; ++q){
01797         cout << C_k_minus[p][q] << " ";
01798       }  
01799       cout << endl;
01800     }
01801   }
01802 
01803 }

void AlgFitTrackCam::GetNoiseMatrix const int  Plane,
const int  NewPlane
 

Definition at line 1809 of file AlgFitTrackCam.cxx.

References DeltaPlane, DeltaZ, BField::GetBField(), UgliGeomHandle::GetNearestSteelPlnHandle(), SwimGeo::GetSteel(), SwimPlaneInterface::GetZ(), UgliSteelPlnHandle::GetZ0(), SwimGeo::Instance(), MSG, pow(), Q_k_minus, TrkStripData, vldc, and x_k_minus.

Referenced by GoBackwards(), GoForwards(), ShowerSwim(), and SpectrometerSwim().

01810 {
01811   // This method is essentially the same as in SR fitter
01812   MSG("AlgFitTrackCam",Msg::kDebug) << "GetNoiseMatrix" << endl;
01813 
01814   for (int p=0; p<5; ++p) {
01815     for (int q=0; q<5; ++q) {
01816       Q_k_minus[p][q]=0;    }
01817   }
01818   
01819   // Get gradients, etc from x_k_minus
01820   double dsdzSquared = 1.+pow(x_k_minus[2],2)+pow(x_k_minus[3],2);
01821   double dsdz = pow(dsdzSquared,0.5);
01822 
01823   // Implement noise matrix as in SR
01824   if (DeltaPlane!=-99 && DeltaZ!=-99) {  
01825     double qp = x_k_minus[4];
01826     if(fabs(qp)<0.01) qp = (qp>0 ? 0.01 : -0.01);
01827     int izdir = ((NewPlane-Plane)>0 ? 0 : 1);
01828   
01829     double LocalRadiationLength=(dsdz * double(DeltaPlane) * 1.47); // 1.47 radiation lengths per iron plane
01830 
01831     double SigmaMS=(0.0136 * fabs(qp) * pow(LocalRadiationLength,0.5)
01832                     * (1. + (0.038 * log(LocalRadiationLength)) ));
01833     double SigmaMSSquared=pow(SigmaMS,2);
01834 
01835     double Sigma33Squared=0.5*SigmaMSSquared*dsdzSquared*(1.+pow(x_k_minus[2],2));
01836 
01837     double Sigma34Squared=0.5*SigmaMSSquared*dsdzSquared*(x_k_minus[2]*x_k_minus[3]);
01838 
01839     double Sigma44Squared=0.5*SigmaMSSquared*dsdzSquared*(1.+pow(x_k_minus[3],2));;
01840 
01841 
01842     // Treat steel as discrete scatter
01843     SwimGeo *spil = SwimGeo::Instance(*(const_cast<VldContext*>(vldc))); // Get edges of steel
01844     double z1 = spil->GetSteel(TrkStripData[Plane][0].ZPos,izdir)->GetZ();
01845     double z2 = spil->GetSteel(z1,izdir)->GetZ();
01846   
01847     double dzscatter = fabs(TrkStripData[NewPlane][0].ZPos-0.5*(z1+z2));
01848     double dzscatter2 = pow(dzscatter,2);
01849   
01850     UgliGeomHandle ugh(*vldc);
01851     BField bf(*vldc,-1,0);
01852     TVector3 uvz;
01853 
01854     uvz(0) = x_k_minus[0];
01855     uvz(1) = x_k_minus[1];
01856     uvz(2) = ugh.GetNearestSteelPlnHandle(TrkStripData[Plane][0].ZPos).GetZ0();
01857 
01858     TVector3 buvz = bf.GetBField(uvz, true);
01859     buvz[0] *= 0.3;
01860     buvz[1] *= 0.3;
01861     buvz[2] *= 0.3;
01862 
01863     
01864     double eloss = 0.038 * double(DeltaPlane);
01865     double sigmaeloss2 = 0.25*eloss*dsdz*qp*qp;
01866     sigmaeloss2 *= sigmaeloss2;
01867 
01868 
01869     // Fill elements of noise matrix
01870     Q_k_minus[0][0]=dzscatter2*Sigma33Squared;
01871     Q_k_minus[0][1]=dzscatter2*Sigma34Squared;
01872     Q_k_minus[0][2]=dzscatter*Sigma33Squared;
01873     Q_k_minus[0][3]=dzscatter*Sigma34Squared;
01874     Q_k_minus[0][4]=dzscatter*sigmaeloss2*double(DeltaPlane)*buvz(1)*0.0254*dsdz*(1.+pow(x_k_minus[2],2));
01875 
01876     Q_k_minus[1][0]=dzscatter2*Sigma34Squared;
01877     Q_k_minus[1][1]=dzscatter2*Sigma44Squared;
01878     Q_k_minus[1][2]=dzscatter*Sigma34Squared;
01879     Q_k_minus[1][3]=dzscatter*Sigma44Squared;
01880     Q_k_minus[1][4]=dzscatter*sigmaeloss2*double(DeltaPlane)*buvz(0)*0.0254*dsdz*(1.+pow(x_k_minus[3],2));
01881 
01882     Q_k_minus[2][0]=dzscatter*Sigma33Squared;
01883     Q_k_minus[2][1]=dzscatter*Sigma34Squared;
01884     Q_k_minus[2][2]=Sigma33Squared;
01885     Q_k_minus[2][3]=Sigma34Squared;
01886     Q_k_minus[2][4]=sigmaeloss2*double(DeltaPlane)*buvz(1)*0.0254*dsdz*(1.+pow(x_k_minus[2],2));
01887 
01888     Q_k_minus[3][0]=dzscatter*Sigma34Squared;
01889     Q_k_minus[3][1]=dzscatter*Sigma44Squared;
01890     Q_k_minus[3][2]=Sigma34Squared;
01891     Q_k_minus[3][3]=Sigma44Squared;
01892     Q_k_minus[3][4]=sigmaeloss2*double(DeltaPlane)*buvz(0)*0.0254*dsdz*(1.+pow(x_k_minus[3],2));
01893 
01894     Q_k_minus[4][0]=dzscatter*sigmaeloss2*double(DeltaPlane)*buvz(1)*0.0254*dsdz*(1.+pow(x_k_minus[2],2));
01895     Q_k_minus[4][1]=dzscatter*sigmaeloss2*double(DeltaPlane)*buvz(0)*0.0254*dsdz*(1.+pow(x_k_minus[3],2));
01896     Q_k_minus[4][2]=sigmaeloss2*double(DeltaPlane)*buvz(1)*0.0254*dsdz*(1.+pow(x_k_minus[2],2));
01897     Q_k_minus[4][3]=sigmaeloss2*double(DeltaPlane)*buvz(0)*0.0254*dsdz*(1.+pow(x_k_minus[3],2));
01898     Q_k_minus[4][4]=sigmaeloss2;
01899   }
01900  
01901 
01902   // Display
01903   if(debug) {
01904     cout << "1e6 * Q_k_minus" << endl;
01905     for(int i=0; i<5; ++i) {
01906       for(int j=0; j<5; ++j) {
01907         cout << 1e6*Q_k_minus[i][j] << " ";
01908       }
01909       cout << endl;
01910     }
01911   }
01912 
01913 }

void AlgFitTrackCam::GoBackwards  ) 
 

Definition at line 1269 of file AlgFitTrackCam.cxx.

References C_k, CalcKalmanGain(), EndCov, EndofRange, EndofRangePlane, ExtrapCovMatrix(), GetCombiPropagator(), GetNoiseMatrix(), H_k, LastIteration, MoveArrays(), MSG, NIter, PassTrack, StoreFilteredData(), TrkStripData, UpdateCovMatrix(), UpdateStateVector(), VtxCov, x_k, and ZIncreasesWithTime.

Referenced by RunTheFitter().

01270 { 
01271   // Carry out the Kalman fit along the track in the direction of decreasing z
01272   MSG("AlgFitTrackCam",Msg::kDebug) << "GoBackwards, carry out fit in negative z direction" << endl;
01273   Int_t StartPlane = MaxPlane; Int_t EndPlane=MinPlane;
01274   if(ZIncreasesWithTime){
01275     StartPlane = EndofRangePlane;
01276   }
01277   else EndofRangePlane = MinPlane;
01278  
01279   for (int i=StartPlane; i>=EndPlane; --i) {  
01280     if (TrkStripData[i].size()>0) {
01281       if (PassTrack) {
01282 
01283         //Find Prev Plane
01284         int NewPlane=-99;
01285         int k=(i-1);
01286         while (k>=MinPlane) {
01287           if (TrkStripData[k].size()>0) {NewPlane=k; break;}
01288           --k;
01289         }
01290         
01291         
01292         if (NewPlane!=-99) {
01293           // Define measurement function
01294           if (TrkStripData[NewPlane][0].PlaneView==3) {H_k[0]=0; H_k[1]=1; H_k[2]=0; H_k[3]=0; H_k[4]=0;}         else if (TrkStripData[NewPlane][0].PlaneView==2)  {H_k[0]=1; H_k[1]=0; H_k[2]=0; H_k[3]=0; H_k[4]=0;}
01295           
01296           MSG("AlgFitTrackCam",Msg::kVerbose) << "GoBackwards, Plane " << i << " ZPos " << TrkStripData[i][0].ZPos 
01297                                               << " PlaneView " << TrkStripData[i][0].PlaneView << endl
01298                                               << " NewPlane " << NewPlane << " NewZPos " << TrkStripData[NewPlane][0].ZPos 
01299                                               << " NewPlaneView " << TrkStripData[NewPlane][0].PlaneView << endl;
01300           
01301           bool CombiPropagatorOk=GetCombiPropagator(i,NewPlane,false);
01302           
01303           if(CombiPropagatorOk ) {
01304             GetNoiseMatrix(i,NewPlane);
01305             ExtrapCovMatrix();
01306             CalcKalmanGain(NewPlane);
01307             UpdateStateVector(i,NewPlane,false);
01308             UpdateCovMatrix();
01309             MoveArrays();
01310             if(SaveData) {StoreFilteredData(NewPlane);}
01311             MSG("AlgFitTrackCam",Msg::kVerbose) << "GoBackwards, Filtered q/p " << x_k[4] << endl;
01312           }
01313           else {
01314             PassTrack=false;
01315           }
01316         }
01317         
01318       }
01319       else {MSG("AlgFitTrackCam",Msg::kDebug) << "GoBackwards, Outside detector - track failed" << endl;}
01320     }
01321     //JAM end of range found
01322     if(EndofRange && LastIteration && !ZIncreasesWithTime){
01323       EndofRangePlane = i;
01324       break;
01325     }
01326 
01327   }
01328 
01329 
01330   // Store entries from covariance matrix for use in setting track properties
01331   if(NIter==2) {
01332     if(ZIncreasesWithTime==true) {
01333       VtxCov[0]=C_k[0][0]; VtxCov[1]=C_k[1][1];
01334       VtxCov[2]=C_k[2][2]; VtxCov[3]=C_k[3][3];
01335       VtxCov[4]=C_k[4][4];
01336     }
01337     else {
01338       EndCov[0]=C_k[0][0]; EndCov[1]=C_k[1][1];
01339       EndCov[2]=C_k[2][2]; EndCov[3]=C_k[3][3];
01340       EndCov[4]=C_k[4][4];
01341     }
01342   }
01343   
01344 }

void AlgFitTrackCam::GoForwards  ) 
 

Definition at line 1186 of file AlgFitTrackCam.cxx.

References C_k, CalcKalmanGain(), EndCov, EndofRange, EndofRangePlane, ExtrapCovMatrix(), GetCombiPropagator(), GetNoiseMatrix(), H_k, LastIteration, MoveArrays(), MSG, NIter, PassTrack, StoreFilteredData(), TrkStripData, UpdateCovMatrix(), UpdateStateVector(), VtxCov, x_k, and ZIncreasesWithTime.

Referenced by RunTheFitter().

01187 { 
01188   // Carry out the Kalman fit along the track in the direction of increasing z
01189   MSG("AlgFitTrackCam",Msg::kDebug) << "GoForwards, carry out fit in positive z direction" << endl;
01190 
01191   // JAM in 2nd iteration, stop when end of range is reached.
01192  
01193   Int_t StartPlane = MinPlane; Int_t EndPlane=MaxPlane;
01194   if(!ZIncreasesWithTime){
01195     StartPlane = EndofRangePlane;
01196   }
01197   else EndofRangePlane = MaxPlane;
01198 
01199   for (int i=StartPlane; i<=EndPlane; ++i) {
01200     EndofRange = false;
01201     if (TrkStripData[i].size()>0) {
01202       if (PassTrack) {
01203         // Find Next Plane
01204         int NewPlane=-99;
01205         int k=(i+1);
01206         while (k<=MaxPlane) {
01207           if (TrkStripData[k].size()>0) {NewPlane=k; break;}
01208           ++k;
01209         }
01210         if (NewPlane!=-99) {
01211           // Define measurement function
01212           if (TrkStripData[NewPlane][0].PlaneView==3) {H_k[0]=0; H_k[1]=1; H_k[2]=0; H_k[3]=0; H_k[4]=0;}
01213           else if (TrkStripData[NewPlane][0].PlaneView==2)  {H_k[0]=1; H_k[1]=0; H_k[2]=0; H_k[3]=0; H_k[4]=0;}
01214           
01215           MSG("AlgFitTrackCam",Msg::kVerbose) << "GoForwards, Plane " << i << " ZPos " << TrkStripData[i][0].ZPos 
01216                                               << " PlaneView " << TrkStripData[i][0].PlaneView << endl
01217                                               << " NewPlane " << NewPlane << " NewZPos " << TrkStripData[NewPlane][0].ZPos 
01218                                               << " NewPlaneView " << TrkStripData[NewPlane][0].PlaneView << endl;
01219           
01220           bool CombiPropagatorOk=GetCombiPropagator(i,NewPlane,true);
01221           
01222           if(CombiPropagatorOk ) {
01223             GetNoiseMatrix(i,NewPlane);
01224             ExtrapCovMatrix();
01225             CalcKalmanGain(NewPlane);
01226             UpdateStateVector(i,NewPlane,true);
01227             UpdateCovMatrix();
01228             MoveArrays();
01229             if(SaveData) {StoreFilteredData(NewPlane);}
01230             MSG("AlgFitTrackCam",Msg::kVerbose) << "GoForwards, Filtered q/p " << x_k[4] << endl;
01231           }
01232           else 
01233             {
01234               PassTrack=false; 
01235             }
01236         }
01237         
01238       }
01239       else {MSG("AlgFitTrackCam",Msg::kDebug) << "GoForwards, Outside of detector - track failed" << endl;}
01240     }
01241     //JAM end of range found
01242     if(EndofRange && LastIteration && ZIncreasesWithTime){
01243       EndofRangePlane=i;
01244       break;
01245     }
01246   }
01247 
01248 
01249   // Store entries from covariance matrix for use in setting track properties
01250   if(NIter==2) {
01251     if(ZIncreasesWithTime==true) {
01252       EndCov[0]=C_k[0][0]; EndCov[1]=C_k[1][1];
01253       EndCov[2]=C_k[2][2]; EndCov[3]=C_k[3][3];
01254       EndCov[4]=C_k[4][4];
01255     }
01256     else {
01257       VtxCov[0]=C_k[0][0]; VtxCov[1]=C_k[1][1];
01258       VtxCov[2]=C_k[2][2]; VtxCov[3]=C_k[3][3];
01259       VtxCov[4]=C_k[4][4];
01260     }
01261   }
01262 
01263 }

void AlgFitTrackCam::InitialFramework const CandSliceHandle slice,
CandContext cx
 

Definition at line 207 of file AlgFitTrackCam.cxx.

References StripStruct::csh, GenerateNDSpectStrips(), CandHandle::GetDaughterIterator(), VldContext::GetDetector(), CandStripHandle::GetPlane(), InitTrkStripData, MaxPlane, MeanTrackTime, MinPlane, NDStripBegTime(), NumFinderStrips, SlcStripData, track, and vldc.

Referenced by RunAlg().

00208 {
00209   // Store CandStripHandles and make the strips accessible by plane number
00210   Detector::Detector_t detector = vldc->GetDetector();
00211 
00212   TIter SlcStripItr = slice->GetDaughterIterator();
00213   TIter TrkStripItr = track->GetDaughterIterator();
00214 
00215   
00216   // Store all strips in slice
00217   int SlicePlane; 
00218 
00219   while(CandStripHandle* SlcStrip = dynamic_cast<CandStripHandle*>(SlcStripItr()))
00220     {
00221       SlicePlane=SlcStrip->GetPlane();
00222       if(detector==Detector::kNear && SlicePlane>=121) {continue;}
00223 
00224       StripStruct temp;
00225       temp.csh=SlcStrip;
00226      
00227       SlcStripData[SlicePlane].push_back(temp);
00228     }
00229   SlcStripItr.Reset();
00230 
00231 
00232   // Store all track strips found, except those in the Near Spectrometer
00233   int TrackPlane; 
00234   MeanTrackTime=0;
00235 
00236   while(CandStripHandle* TrkStrip = dynamic_cast<CandStripHandle*>(TrkStripItr()))
00237     {    
00238       TrackPlane=TrkStrip->GetPlane();
00239       if(detector==Detector::kNear && TrackPlane>=121) {continue;}
00240 
00241       StripStruct temp;
00242       temp.csh=TrkStrip;
00243 
00244       InitTrkStripData[TrackPlane].push_back(temp);
00245       NumFinderStrips++;
00246       
00247       // Identify ends of initial track
00248       if (TrackPlane>MaxPlane) {MaxPlane=TrackPlane;}
00249       if (TrackPlane<MinPlane) {MinPlane=TrackPlane;}
00250 
00251       if(detector==Detector::kNear) {MeanTrackTime+=NDStripBegTime(TrkStrip);}
00252     }
00253   TrkStripItr.Reset();
00254 
00255   // For DeMuxing ND Spectrometer
00256   if(detector==Detector::kNear) {
00257     if(NumFinderStrips!=0) {MeanTrackTime/=double(NumFinderStrips);}
00258     GenerateNDSpectStrips(slice,cx);
00259   }
00260 
00261 
00262 } 

void AlgFitTrackCam::MoveArrays  ) 
 

Definition at line 2180 of file AlgFitTrackCam.cxx.

References C_k, C_k_minus, MSG, x_k, and x_k_minus.

Referenced by GoBackwards(), GoForwards(), ShowerSwim(), and SpectrometerSwim().

02181 {
02182   // Move k to k-1 ready to consider next hit
02183   MSG("AlgFitTrackCam",Msg::kDebug) << "MoveArrays" << endl;
02184 
02185   for (int i=0; i<5; ++i) {
02186     for (int j=0; j<5; ++j) { 
02187       C_k_minus[i][j]=C_k[i][j];
02188     }
02189   }
02190   
02191   for (int l=0; l<5; ++l) {
02192     x_k_minus[l]=x_k[l];
02193   }
02194 }

bool AlgFitTrackCam::NDPlaneIsActive int  plane,
float  u,
float  v,
float  projErr
 

Definition at line 3400 of file AlgFitTrackCam.cxx.

References PlaneOutline::DistanceToEdge(), fPL, PlexPlaneId::GetPlaneCoverage(), PlexPlaneId::GetPlaneView(), PlaneOutline::IsInside(), and PlexPlaneId::IsValid().

Referenced by SpectrometerSwim().

03401 { 
03402   // Method to determine whether this u/v position is active
03403 
03404   PlexPlaneId plexPlane(Detector::kNear,plane, 0); 
03405   if(!plexPlane.IsValid()) {return false;}
03406   if(plexPlane.GetPlaneCoverage()==PlaneCoverage::kNoActive) {return false;}
03407   if(projErr<0.3)projErr=0.3;
03408   float x = 0.707*(u-v);
03409   float y = 0.707*(u+v);
03410   float dist,xedge,yedge;
03411   fPL.DistanceToEdge(x, y,
03412                      plexPlane.GetPlaneView(),
03413                      plexPlane.GetPlaneCoverage(),
03414                      dist, xedge, yedge);
03415   bool isInside = fPL.IsInside(x, y,
03416                                plexPlane.GetPlaneView(),
03417                                plexPlane.GetPlaneCoverage());
03418   isInside &= dist>projErr;
03419 
03420   return isInside;
03421 }

double AlgFitTrackCam::NDStripBegTime CandStripHandle Strip,
double  U = 0,
double  V = 0
 

Definition at line 3611 of file AlgFitTrackCam.cxx.

References BegTime, UgliStripHandle::ClearFiber(), digit(), CandHandle::GetDaughterIterator(), PlexSEIdAltL::GetEnd(), UgliStripHandle::GetHalfLength(), CandStripHandle::GetPlane(), CandStripHandle::GetPlaneView(), CandDigitHandle::GetPlexSEIdAltL(), CandStripHandle::GetStripEndId(), UgliGeomHandle::GetStripHandle(), CandDigitHandle::GetSubtractedTime(), CandTrackHandle::GetU(), CandTrackHandle::GetV(), track, vldc, and UgliStripHandle::WlsPigtail().

Referenced by InitialFramework(), and SpectrometerSwim().

03612 {
03613   double BegTime=999; double Time=0;
03614   double Index=1.77; double DistFromCentre=0.; 
03615   double FibreDist=0.; double halfLength=0.;
03616 
03617   // Get from track. Otherwise, will have guessed using Swimmer
03618   if(U==0) {U=track->GetU(Strip->GetPlane());}
03619   if(V==0) {V=track->GetV(Strip->GetPlane());}
03620 
03621   StripEnd::StripEnd_t StpEnd = StripEnd::kUnknown;
03622   CandDigitHandle* digit;
03623   
03624   UgliGeomHandle ugh = UgliGeomHandle(*vldc);
03625   UgliStripHandle Striphandle;
03626 
03627   CandDigitHandleItr digitItr(Strip->GetDaughterIterator());
03628 
03629 
03630   // Loop over digits on Strip. 
03632   while( (digit = digitItr()) ) { 
03633     StpEnd=digit->GetPlexSEIdAltL().GetEnd();
03634     
03635     if(StpEnd==StripEnd::kPositive) {
03636       FibreDist = 0.; DistFromCentre = 0.; Time=0.;
03637       UgliStripHandle StripHandle = ugh.GetStripHandle(Strip->GetStripEndId());
03638       halfLength = StripHandle.GetHalfLength(); 
03639       
03640       if(Strip->GetPlaneView()==2) {DistFromCentre = V;}
03641       if(Strip->GetPlaneView()==3) {DistFromCentre = -U;}
03642               
03643       FibreDist = (halfLength + DistFromCentre + StripHandle.ClearFiber(StpEnd) 
03644                    + StripHandle.WlsPigtail(StpEnd));
03645       
03646       Time = digit->GetSubtractedTime(CalTimeType::kT0) - (Index/3.e8)*FibreDist;
03647 
03648       if(Time<BegTime) {BegTime=Time;}
03649     }
03650   }
03651   
03652   return BegTime;
03653 }

void AlgFitTrackCam::RemoveTrkHitsInShw  ) 
 

Definition at line 551 of file AlgFitTrackCam.cxx.

References MaxPlane, MinPlane, MSG, SwimThroughShower, TrkStripData, and ZIncreasesWithTime.

Referenced by RunTheFitter().

00552 {
00553   // If the 'clean' section of track is large enough, remove the track finding
00554   // data for planes before the ShowerEntryPlane
00555   MSG("AlgFitTrackCam",Msg::kDebug) << "RemoveTrkHitsInShw, Discard track finding data in shower" << endl;
00556 
00557   int NumTrackStripsLeft=0;
00558   
00559   if(ZIncreasesWithTime==true) {
00560     for(int i=ShowerEntryPlane; i<=MaxPlane; ++i) {
00561       if(TrkStripData[i].size()>0) {NumTrackStripsLeft++;}
00562     }
00563   }
00564   else if(ZIncreasesWithTime==false) {
00565     for(int i=MinPlane; i<=ShowerEntryPlane; ++i) {
00566       if(TrkStripData[i].size()>0) {NumTrackStripsLeft++;}
00567     }
00568   }
00569   
00570   // Carry out removal if there will be 6 or more strips left afterwards
00571   if(NumTrackStripsLeft>5) { 
00572     if(ZIncreasesWithTime==true) {
00573       for(int i=MinPlane; i<=ShowerEntryPlane; ++i) {TrkStripData[i].clear();}
00574     }   
00575     else if(ZIncreasesWithTime==false) {
00576       for(int i=ShowerEntryPlane; i<=MaxPlane; ++i) {TrkStripData[i].clear();    }
00577     }
00578   } 
00579   // Otherwise note that we should not run the ShowerSwim method
00580   else {
00581     MSG("AlgFitTrackCam",Msg::kDebug) << "RemoveTrkHitsInShw, not enough hits after removal. Must use all finder data." << endl;
00582     SwimThroughShower=false;
00583   }
00584   
00585   
00586   // Find the new max and min planes
00587   MaxPlane=-20; MinPlane=500;
00588   for (int i=0; i<490; ++i) {   
00589     if(TrkStripData[i].size()>0) {
00590       if(i>MaxPlane) {MaxPlane=i;}
00591       if(i<MinPlane) {MinPlane=i;}
00592     }
00593   }
00594   
00595 }

void AlgFitTrackCam::ResetCovarianceMatrix  ) 
 

Definition at line 1722 of file AlgFitTrackCam.cxx.

References DeltaPlane, DeltaZ, and GetInitialCovarianceMatrix().

Referenced by RunTheFitter().

01723 {
01724   // Simple method reset variables/arrays to allow propagation again
01725 
01726   DeltaPlane=0; DeltaZ=0; 
01727   GetInitialCovarianceMatrix(false);
01728 }

void AlgFitTrackCam::RunAlg AlgConfig ac,
CandHandle ch,
CandContext cx
[virtual]
 

Implements AlgBase.

Definition at line 85 of file AlgFitTrackCam.cxx.

References bave, C_k, C_k_intermediate, C_k_minus, CleanNDLists(), debug, DeltaPlane, DeltaZ, EndCov, F_k, F_k_minus, FilteredData, Registry::Get(), CandRecord::GetCandHeader(), CandContext::GetCandRecord(), CandRecoHandle::GetCandSlice(), CandContext::GetDataIn(), CandHandle::GetDaughterIterator(), VldContext::GetDetector(), CandRecoHandle::GetEndZ(), GetFitData(), CandHandle::GetNDaughters(), CandHeader::GetRun(), CandHeader::GetSnarl(), RecMinos::GetVldContext(), CandRecoHandle::GetVtxDirCosU(), CandRecoHandle::GetVtxDirCosV(), CandRecoHandle::GetVtxDirCosZ(), CandRecoHandle::GetVtxU(), CandRecoHandle::GetVtxV(), CandRecoHandle::GetVtxZ(), H_k, Identity, InitialFramework(), InitTrkStripData, K_k, MaxPlane, MinPlane, MSG, nbfield, NIter, NumFinderStrips, PassTrack, Q_k, Q_k_minus, CandHandle::RemoveDaughter(), RunTheFitter(), SaveData, CandRecoHandle::SetCandSlice(), CandFitTrackHandle::SetFinderTrack(), ShowerEntryPlane, SlcStripData, SwimThroughShower, TotalNSwimFail, track, TrkStripData, UseGeoSwimmer, vldc, VtxCov, x_k, x_k4_biased, x_k_minus, and ZIncreasesWithTime.

00087 {
00088   // get alg parameters
00089   if(!ac.Get("UseGeoSwimmer",UseGeoSwimmer)) cout << "Couldn't Get\n";
00090 
00091  // Standard set-up
00092 
00093   assert(ch.InheritsFrom("CandFitTrackCamHandle"));
00094   CandFitTrackCamHandle &cth = dynamic_cast<CandFitTrackCamHandle &>(ch);
00095   
00096   nbfield=0;
00097   bave=0;
00098   TIter FitTrackStripItr = cth.GetDaughterIterator();
00099   while(CandStripHandle* FitTrackStrip = dynamic_cast<CandStripHandle*>(FitTrackStripItr())) cth.RemoveDaughter(FitTrackStrip);
00100   
00101   assert(cx.GetDataIn());
00102   
00103   // Get the track from the track finder
00104   assert(cx.GetDataIn()->InheritsFrom("CandTrackHandle"));
00105   track = dynamic_cast<const CandTrackHandle*>(cx.GetDataIn());
00106   if( !track || track->GetNDaughters()<1 )  { return; }
00107   cth.SetFinderTrack((CandTrackHandle*)(track));
00108   
00109   const CandSliceHandle* slice = dynamic_cast<const CandSliceHandle*>(track->GetCandSlice());
00110   assert(slice);
00111   cth.SetCandSlice(slice);
00112   
00113   
00115   // Track fitter //
00117   // Switch for screen output
00118   debug=false;
00119   
00120   // Initialisations
00122   if( track->GetEndZ() > track->GetVtxZ() )  {ZIncreasesWithTime=true;}
00123   else {ZIncreasesWithTime=false;}
00124   
00125   SaveData=false;
00126   SwimThroughShower=false;
00127   PassTrack=true;
00128   
00129   MaxPlane=-20;
00130   MinPlane=500;
00131 
00132   DeltaZ=-99;
00133   DeltaPlane=-99;
00134   ShowerEntryPlane=-99;
00135   
00136   NIter=0; TotalNSwimFail=0; NumFinderStrips=0;
00137   
00138   for (unsigned int i=0; i<5; ++i) {
00139     x_k[i]=0; x_k_minus[i]=0; H_k[i]=0; K_k[i]=0;
00140     VtxCov[i]=-999; EndCov[i]=-999;
00141     for (unsigned int j=0; j<5; ++j) {
00142       C_k[i][j]=0; C_k_minus[i][j]=0; C_k_intermediate[i][j]=0;
00143       F_k[i][j]=0; F_k_minus[i][j]=0;
00144       Q_k[i][j]=0; Q_k_minus[i][j]=0;
00145       Identity[i][j]=0;
00146     }
00147   }
00148   
00149   Identity[0][0]=1; Identity[1][1]=1; Identity[2][2]=1; Identity[3][3]=1; Identity[4][4]=1; 
00151   
00152   
00153   // Set initial parameters
00155   x_k_minus[0]=track->GetVtxU();
00156   x_k_minus[1]=track->GetVtxV();
00157   if(track->GetVtxDirCosZ()!=0.) {
00158     x_k_minus[2]=track->GetVtxDirCosU()/track->GetVtxDirCosZ();
00159     x_k_minus[3]=track->GetVtxDirCosV()/track->GetVtxDirCosZ();
00160   }
00161   x_k_minus[4]=0.;
00162   x_k4_biased=0;
00164   
00165   
00166   // Get header information
00168   CandRecord* candrec = (CandRecord*)(cx.GetCandRecord());
00169   assert(candrec);
00170   
00171   vldc = (VldContext*)(candrec->GetVldContext());
00172   assert(vldc);
00173   
00174   CandHeader* candhead = (CandHeader*)(candrec->GetCandHeader());
00175   assert(candhead);
00176   
00177   MSG("AlgFitTrackCam",Msg::kDebug) << "RunAlg, New track, Run: " << candhead->GetRun() 
00178                                     << " Snarl: " << candhead->GetSnarl() << endl;
00180   
00181   
00182   // Run the high level methods
00184   InitialFramework(slice,cx);
00185   GetFitData(MinPlane,MaxPlane);
00186   RunTheFitter(cth);
00188   
00189   
00190   // Clear up
00192   if(vldc->GetDetector()==Detector::kNear) {CleanNDLists(cth,cx);}
00193   
00194   for (unsigned int i=0; i<490; ++i) {
00195     InitTrkStripData[i].clear();
00196     SlcStripData[i].clear();
00197     TrkStripData[i].clear();
00198     FilteredData[i].clear();
00199   }
00201 }

void AlgFitTrackCam::RunTheFitter CandFitTrackCamHandle cth  ) 
 

Definition at line 364 of file AlgFitTrackCam.cxx.

References CandHandle::AddDaughterLink(), FillGapsInTrack(), FilteredData, FindTheStrips(), CandHandle::GetDaughterIterator(), VldContext::GetDetector(), GetFitData(), GetInitialCovarianceMatrix(), CandStripHandle::GetPlaneView(), GoBackwards(), GoForwards(), LastIteration, MaxPlane, MinPlane, MSG, NIter, PassTrack, CandHandle::RemoveDaughter(), RemoveTrkHitsInShw(), ResetCovarianceMatrix(), SaveData, CandFitTrackHandle::SetEMCharge(), CandFitTrackHandle::SetMomentumCurve(), CandFitTrackHandle::SetPass(), SetPropertiesFromFinderTrack(), SetTrackProperties(), CandFitTrackHandle::SetVtxQPError(), ShowerStrips(), ShowerSwim(), SpectrometerSwim(), StoreFilteredData(), SwimThroughShower, track, TrkStripData, vldc, x_k, x_k4_biased, and ZIncreasesWithTime.

Referenced by RunAlg().

00365 {
00366   MSG("AlgFitTrackCam",Msg::kDebug) << "RunTheFitter, Call methods in the appropriate order" << endl;
00367   GetInitialCovarianceMatrix(true);
00368   
00369   
00370   // Control the iterations backwards and forwards
00372   Detector::Detector_t detector = vldc->GetDetector();
00373 
00374   // Control iterations over a track for which ZIncreasesWithTime
00375   if(ZIncreasesWithTime==true)
00376     {
00377       // First iteration
00378       NIter++;
00379   
00380       // Vtx to End
00381 
00382       SaveData=true; StoreFilteredData(MinPlane); 
00383       LastIteration=false;
00384       GoForwards(); ResetCovarianceMatrix();
00385       
00386 
00387       // End back to vtx, swimming through any large vtx shower
00388       ShowerStrips();  // Try to identify vtx showers, now we have an idea of gradient
00389       if(SwimThroughShower==true) {RemoveTrkHitsInShw();}
00390       
00391       for (unsigned int i=0; i<490; ++i) {FilteredData[i].clear();}
00392       StoreFilteredData(MaxPlane); GoBackwards();
00393       
00394       if(SwimThroughShower==true) {ShowerSwim();}
00395       ResetCovarianceMatrix();
00396 
00397       bool StripsFound = FindTheStrips(cth,false);
00398       
00399       // Second iteration
00400       if(StripsFound==true) { // Guard against finding no strips
00401         for(int nint=0;nint<=1;nint++){  
00402           NIter++;
00403           if(nint==1)LastIteration = true;        
00404           // Vtx to End again, identifying any strips in ND spectrometer
00405           for (unsigned int i=0; i<490; ++i) {TrkStripData[i].clear();} 
00406           GetFitData(MinPlane,MaxPlane);        
00407           SaveData=false; GoForwards();
00408           
00409           if(detector==Detector::kNear && nint==0) {SpectrometerSwim(cth);}
00410           ResetCovarianceMatrix();
00411           
00412           // End back to vtx again
00413           for (unsigned int i=0; i<490; ++i) {FilteredData[i].clear();}
00414           if(nint==1) SaveData=true;  
00415           StoreFilteredData(MaxPlane);    
00416           GoBackwards();    ResetCovarianceMatrix();
00417           if(nint==0) x_k4_biased= x_k[4];
00418         }
00419       }
00420       else {PassTrack=false;}
00421     }
00422   
00423   
00424   // Control iterations over a track for which ZDecreasesWithTime
00425   else
00426     {
00427       // First iteration
00428       NIter++;
00429 
00430       // Vtx to End
00431       SaveData=true; StoreFilteredData(MaxPlane); 
00432       LastIteration=false;
00433 
00434       GoBackwards(); ResetCovarianceMatrix();
00435  
00436       // End back to vtx, swimming through any large vtx shower and
00437       // identifying any strips in ND spectrometer
00438       ShowerStrips();  // Try to identify vtx showers, now we have an idea of gradient
00439       if(SwimThroughShower==true) {RemoveTrkHitsInShw();}
00440 
00441       for (unsigned int i=0; i<490; ++i) {FilteredData[i].clear();}
00442       StoreFilteredData(MinPlane); GoForwards();
00443 
00444       if(SwimThroughShower==true) {ShowerSwim();}
00445 
00446       if(detector==Detector::kNear) {SpectrometerSwim(cth);}
00447       ResetCovarianceMatrix();
00448 
00449       bool StripsFound = FindTheStrips(cth,false);
00450 
00451       // Second iteration
00452       if(StripsFound==true) { // Guard against finding no strips
00453         for(int nint=0;nint<=1;nint++){  
00454           if(nint==1)LastIteration = true;                
00455           NIter++;
00456           // Vtx to End again
00457           for (unsigned int i=0; i<490; ++i) {TrkStripData[i].clear();} 
00458           GetFitData(MinPlane,MaxPlane);          
00459           SaveData=false; GoBackwards(); ResetCovarianceMatrix();
00460           
00461           // End to Vtx again
00462           for (unsigned int i=0; i<490; ++i) {FilteredData[i].clear();}
00463           if(nint==1)SaveData=true;  
00464           StoreFilteredData(MinPlane);
00465           GoForwards(); ResetCovarianceMatrix();
00466           if(nint==0) x_k4_biased= x_k[4];
00467         }
00468       }
00469       else {PassTrack=false;}
00470     }
00472   
00473   
00474 
00475   // Organise the output
00477 
00478   // If the fit was successful
00479   if(x_k[4]!=0. && PassTrack==true) {
00480         
00481     //JAM modify tweak following range bias removal
00482     // Tweak q/p to remove offset
00483     //    x_k[4]*=1.01+(0.1*fabs(x_k[4]));
00484 
00485     x_k4_biased *=1.01+(0.1*fabs(x_k[4]));
00486     x_k[4] *=1.013;
00487 
00488     // Find final strips and add them to the fitted track
00489     FillGapsInTrack();
00490     bool FinalStripsFound = FindTheStrips(cth,true);
00491     
00492     // If final strips found, set the fitted track properties
00493     if(FinalStripsFound==true) {
00494 
00495       // Check there is >1 strip in each view. If not, then fail track.
00496       int NumInUView=0; int NumInVView=0;
00497       
00498       TIter FitTrackStripItr = cth.GetDaughterIterator();
00499       while(CandStripHandle* FitTrackStrip = dynamic_cast<CandStripHandle*>(FitTrackStripItr()))
00500         {
00501           if(FitTrackStrip->GetPlaneView()==2) {NumInUView++;}
00502           else if(FitTrackStrip->GetPlaneView()==3) {NumInVView++;}
00503           
00504           if(NumInUView>1 && NumInVView>1) {break;}
00505         }
00506       
00507       if(NumInUView>1 && NumInVView>1) {
00508         cth.SetPass(1);
00509         SetTrackProperties(cth);
00510       }
00511       else {
00512         PassTrack=false;
00513       }
00514       
00515     }
00516     // Otherwise fail the track at this final stage
00517     else {
00518       PassTrack=false;
00519     }
00520   }
00521   
00522   
00523   // If the fit has failed (e.g. q/p is zero and/or u, v are nonsense)
00524   if(x_k[4]==0. || PassTrack==false) {
00525  
00526     // Remove any existing strips in the failed fitted track
00527     vector<CandStripHandle*> Daughters;
00528 
00529     TIter FitTrackStripItr = cth.GetDaughterIterator();
00530     while(CandStripHandle* FitTrackStrip = dynamic_cast<CandStripHandle*>(FitTrackStripItr()))
00531       {Daughters.push_back(FitTrackStrip);}
00532 
00533     for(unsigned int i=0; i<Daughters.size(); ++i) {cth.RemoveDaughter(Daughters[i]);}
00534     Daughters.clear();
00535 
00536 
00537     // Put strips from track finder in failed fitted track
00538     TIter TrkStripItr = track->GetDaughterIterator();
00539     while(CandStripHandle* TrkStrip = dynamic_cast<CandStripHandle*>(TrkStripItr()))
00540       {cth.AddDaughterLink(*TrkStrip);}
00541     
00542     // Set position/direction properties using the finder track
00543     cth.SetPass(0); 
00544     cth.SetMomentumCurve(0.); cth.SetEMCharge(0); cth.SetVtxQPError(-999.);
00545     SetPropertiesFromFinderTrack(cth);
00546   }
00548 }  

void AlgFitTrackCam::SetPropertiesFromFinderTrack CandFitTrackCamHandle cth  ) 
 

Definition at line 3057 of file AlgFitTrackCam.cxx.

References AlgTrack::CalculateTrace(), AlgReco::Calibrate(), CandRecoHandle::GetDirCosU(), CandRecoHandle::GetDirCosV(), CandRecoHandle::GetDirCosZ(), CandTrackHandle::GetdS(), CandRecoHandle::GetEndDirCosU(), CandRecoHandle::GetEndDirCosV(), CandRecoHandle::GetEndDirCosZ(), CandRecoHandle::GetEndPlane(), CandRecoHandle::GetEndT(), CandRecoHandle::GetEndU(), CandRecoHandle::GetEndV(), CandRecoHandle::GetEndZ(), CandTrackHandle::GetMomentum(), CandTrackHandle::GetNTimeFitDigit(), CandTrackHandle::GetRange(), CandTrackHandle::GetTimeBackwardFitNDOF(), CandTrackHandle::GetTimeBackwardFitRMS(), CandTrackHandle::GetTimeFitChi2(), CandTrackHandle::GetTimeForwardFitNDOF(), CandTrackHandle::GetTimeForwardFitRMS(), CandRecoHandle::GetTimeOffset(), CandRecoHandle::GetTimeSlope(), CandTrackHandle::GetTrackPointError(), CandTrackHandle::GetU(), CandTrackHandle::GetV(), CandRecoHandle::GetVtxPlane(), CandRecoHandle::GetVtxT(), CandRecoHandle::GetVtxU(), CandRecoHandle::GetVtxV(), CandRecoHandle::GetVtxZ(), Calibrator::Instance(), CandTrackHandle::IsTPosValid(), MSG, Calibrator::ReInitialise(), CandRecoHandle::SetDirCosU(), CandRecoHandle::SetDirCosV(), CandRecoHandle::SetDirCosZ(), CandTrackHandle::SetdS(), CandRecoHandle::SetEndDirCosU(), CandRecoHandle::SetEndDirCosV(), CandRecoHandle::SetEndDirCosZ(), CandRecoHandle::SetEndPlane(), CandRecoHandle::SetEndT(), CandRecoHandle::SetEndU(), CandRecoHandle::SetEndV(), CandRecoHandle::SetEndZ(), CandTrackHandle::SetMomentum(), CandFitTrackHandle::SetMomentumRange(), CandTrackHandle::SetNTimeFitDigit(), CandTrackHandle::SetRange(), AlgTrack::SetT(), CandTrackHandle::SetTimeBackwardFitNDOF(), CandTrackHandle::SetTimeBackwardFitRMS(), CandTrackHandle::SetTimeFitChi2(), CandTrackHandle::SetTimeForwardFitNDOF(), CandTrackHandle::SetTimeForwardFitRMS(), CandRecoHandle::SetTimeOffset(), CandRecoHandle::SetTimeSlope(), CandTrackHandle::SetTrackPointError(), CandTrackHandle::SetU(), CandTrackHandle::SetV(), CandRecoHandle::SetVtxPlane(), CandRecoHandle::SetVtxT(), CandRecoHandle::SetVtxU(), CandRecoHandle::SetVtxV(), CandRecoHandle::SetVtxZ(), track, vldc, and ZIncreasesWithTime.

Referenced by RunTheFitter().

03058 {
03059   // This method is only called if the fit fails. We set properties from finder track.
03060   // This clearly does not include fitted properties such as q/p or QPVtxError.
03061  MSG("AlgFitTrackCam",Msg::kDebug) << "SetPropertiesFromFinderTrack" << endl;
03062   cth.SetDirCosU(track->GetDirCosU());
03063   cth.SetDirCosV(track->GetDirCosV());
03064   cth.SetDirCosZ(track->GetDirCosZ());
03065   cth.SetVtxU(track->GetVtxU());
03066   cth.SetVtxV(track->GetVtxV());
03067   cth.SetVtxZ(track->GetVtxZ());
03068   cth.SetVtxT(track->GetVtxT());
03069   cth.SetVtxPlane(track->GetVtxPlane());
03070 
03071   cth.SetEndDirCosU(track->GetEndDirCosU());
03072   cth.SetEndDirCosV(track->GetEndDirCosV());
03073   cth.SetEndDirCosZ(track->GetEndDirCosZ());
03074   cth.SetEndU(track->GetEndU());
03075   cth.SetEndV(track->GetEndV());
03076   cth.SetEndZ(track->GetEndZ());
03077   cth.SetEndT(track->GetEndT());
03078   cth.SetEndPlane(track->GetEndPlane());
03079 
03080   cth.SetMomentumRange(track->GetMomentum());
03081   cth.SetMomentum(track->GetMomentum());
03082 
03083   cth.SetTimeSlope(track->GetTimeSlope());
03084   cth.SetTimeOffset(track->GetTimeOffset());
03085   cth.SetTimeFitChi2(track->GetTimeFitChi2());
03086   cth.SetNTimeFitDigit(track->GetNTimeFitDigit());
03087   cth.SetTimeForwardFitRMS(track->GetTimeForwardFitRMS());
03088   cth.SetTimeForwardFitNDOF(track->GetTimeForwardFitNDOF());
03089   cth.SetTimeBackwardFitRMS(track->GetTimeBackwardFitRMS());
03090   cth.SetTimeBackwardFitNDOF(track->GetTimeBackwardFitNDOF());
03091 
03092 
03093   // Set quantities required at each plane in finder track
03094   int direction=1;
03095   if(ZIncreasesWithTime==false) {direction=-1;}
03096 
03097   for(int i=cth.GetVtxPlane(); i*direction<=cth.GetEndPlane()*direction; i+=direction){
03098     if(track->IsTPosValid(i)) {
03099       cth.SetTrackPointError(i,track->GetTrackPointError(i));
03100       cth.SetdS(i,track->GetdS(i));
03101       cth.SetRange(i,track->GetRange(i));
03102       cth.SetU(i,track->GetU(i));
03103       cth.SetV(i,track->GetV(i));
03104     }
03105   }
03106 
03107   CalculateTrace(cth);  
03108   SetT(&cth);
03109 
03110   Calibrator& cal = Calibrator::Instance();
03111   cal.ReInitialise(*vldc);
03112   Calibrate(&cth);
03113 
03114 
03115 }

void AlgFitTrackCam::SetRangeAnddS CandFitTrackCamHandle cth  ) 
 

Definition at line 2791 of file AlgFitTrackCam.cxx.

References abs(), done(), FilteredData, fPL, PlexPlaneId::GetAdjoinScint(), PlexPlaneId::GetAdjoinSteel(), VldContext::GetDetector(), CandFitTrackHandle::GetFinderTrack(), UgliSteelPlnHandle::GetHalfThickness(), UgliPlnHandle::GetHalfThickness(), CandTrackHandle::GetMomentum(), PlexPlaneId::GetPlaneView(), UgliGeomHandle::GetScintPlnHandle(), VldContext::GetSimFlag(), UgliGeomHandle::GetSteelPlnHandle(), UgliSteelPlnHandle::GetZ0(), UgliPlnHandle::GetZ0(), UgliGeomHandle::GetZExtent(), PlaneOutline::IsInside(), PlexPlaneId::IsValid(), UgliScintPlnHandle::IsValid(), MSG, pow(), CandTrackHandle::SetdS(), CandFitTrackHandle::SetMomentumRange(), CandTrackHandle::SetRange(), SlcStripData, Swim(), vldc, and ZIncreasesWithTime.

Referenced by SetTrackProperties().

02792 {
02793 
02794   // Set range and dS as calculated by the swimmer
02795   MSG("AlgFitTrackCam",Msg::kDebug) << "SetRangeAnddS from swimmer values " << endl;
02796 
02797   UgliGeomHandle ugh = UgliGeomHandle(*vldc);
02798 
02799   int ZDir; int VtxPlane; int EndPlane; int Increment;
02800   Detector::Detector_t detector = vldc->GetDetector();
02801   double dS; double dRange; double dP;
02802 
02803 
02804   // Start at the end of the track and calculate the required additions to range
02806 
02807   // find ending Z position (defined as Z position where muon has 100 MeV of residual energy.  This corresponds to 1/2 inch of Fe.
02808 
02809   // NOTE: Average dP for 1" iron is 95 MeV.
02810  
02811   if(ZIncreasesWithTime==true) {ZDir=1; EndPlane=MaxPlane; VtxPlane=MinPlane; Increment=-1;}
02812   else {ZDir=-1; EndPlane=MinPlane; VtxPlane=MaxPlane; Increment=1;}
02813 
02814   PlexPlaneId plnid(detector,EndPlane,false);
02815   PlexPlaneId endplnid(detector,EndPlane,false);
02816 
02817   double Zscint = SlcStripData[EndPlane][0].csh->GetZPos();
02818   double Znextscint = Zscint;
02819 
02820   UgliScintPlnHandle scintpln = ugh.GetScintPlnHandle(plnid); 
02821   double Zend = Zscint + double(ZDir)*scintpln.GetHalfThickness();
02822 
02823   PlexPlaneId nextscint =  endplnid.GetAdjoinScint(ZDir);
02824   UgliScintPlnHandle nextscintpln = ugh.GetScintPlnHandle(nextscint);
02825   if(nextscintpln.IsValid() && nextscint.GetPlaneView()!=PlaneView::kUnknown){
02826     Znextscint = nextscintpln.GetZ0();
02827   }
02828   else{
02829     nextscint = endplnid;
02830   }
02831 
02832   plnid = plnid.GetAdjoinSteel(ZDir);
02833   if(plnid.IsValid()){
02834     UgliSteelPlnHandle steelpln = ugh.GetSteelPlnHandle(plnid);
02835     Zend = steelpln.GetZ0() - double(ZDir)*steelpln.GetHalfThickness();
02836   }
02837 
02838   // add two planes of steel for the ND spectrometer
02839   if(detector==Detector::kNear && EndPlane>=121) {
02840     for(int i=0;i<2;i++){
02841       if(plnid.GetAdjoinSteel(ZDir).IsValid()){
02842         PlexPlaneId plnid_after = plnid.GetAdjoinSteel(ZDir);
02843         if(plnid_after.IsValid()) {
02844           plnid = plnid_after;
02845           UgliSteelPlnHandle steelpln = ugh.GetSteelPlnHandle(plnid);
02846           Zend = steelpln.GetZ0() - double(ZDir)*steelpln.GetHalfThickness();
02847         }
02848       }
02849     }
02850   }
02851 
02852   // Determine whether track stops in coil
02853   float u_end = FilteredData[EndPlane][0].x_k0;
02854   float v_end = FilteredData[EndPlane][0].x_k1;
02855   float du_end = FilteredData[EndPlane][0].x_k2;
02856   float dv_end = FilteredData[EndPlane][0].x_k3;
02857   float delz = Znextscint-Zscint;
02858   float u_extrap = u_end +delz*du_end;
02859   float v_extrap = v_end +delz*dv_end;
02860   float x_extrap = 0.707*(u_extrap-v_extrap);
02861   float y_extrap = 0.707*(u_extrap+v_extrap);
02862 
02863   PlaneCoverage::PlaneCoverage_t kPC = PlaneCoverage::kComplete;
02864   if(detector==Detector::kNear) kPC=PlaneCoverage::kNearFull;
02865 
02866   bool isInOutline = fPL.IsInside(x_extrap,y_extrap,nextscint.GetPlaneView(),kPC,false);
02867   bool isInCoil = isInOutline && !fPL.IsInside(x_extrap,y_extrap,nextscint.GetPlaneView(),kPC,true);
02868 
02869   double S = 0; double Range = 0; double Prange = 0.0;
02870   double StateVector[5]; double Output[5];
02871   double chargesign = -1;
02872   bool GoForward = true; bool done=true; bool swimOK=true;
02873 
02874   // if in coil find midpoint and swim towards last hit from there
02875   if(isInCoil){
02876     float zCoil = Znextscint;
02877     float u_extrapC = u_extrap;
02878     float v_extrapC = v_extrap;
02879     float x_extrapC = x_extrap;
02880     float y_extrapC = y_extrap;
02881     while(isInCoil){
02882       zCoil -= 1.0*Munits::cm*ZDir;
02883       float delzC = zCoil - Zscint;
02884       u_extrapC = u_end +delzC*du_end;
02885       v_extrapC = v_end +delzC*dv_end;
02886       x_extrapC = 0.707*(u_extrapC-v_extrapC);
02887       y_extrapC = 0.707*(u_extrapC+v_extrapC);
02888       isInCoil = !fPL.IsInside(x_extrapC,y_extrapC,nextscint.GetPlaneView(),kPC,true) && ((zCoil>Zscint && ZDir==1) || (zCoil<Zscint && ZDir==-1)) ;        
02889     }
02890     float zMinCoil = zCoil;
02891     if(zMinCoil<Zscint && ZDir==1)  zMinCoil=Zscint;
02892     if(zMinCoil>Zscint && ZDir==-1) zMinCoil=Zscint;
02893 
02894     zCoil = Znextscint;
02895     isInCoil = true;
02896     while(isInCoil){
02897       zCoil += 1.0*Munits::cm*ZDir;
02898       float delzC = zCoil - Zscint;
02899       u_extrapC = u_end +delzC*du_end;
02900       v_extrapC = v_end +delzC*dv_end;
02901       x_extrapC = 0.707*(u_extrapC-v_extrapC);
02902       y_extrapC = 0.707*(u_extrapC+v_extrapC);
02903       float zmin; float zmax;
02904       ugh.GetZExtent(zmin,zmax);
02905       isInCoil = !fPL.IsInside(x_extrapC,y_extrapC,nextscint.GetPlaneView(),kPC,true) && ((zCoil<zmax && ZDir==1) || (zCoil>zmin && ZDir==-1));        
02906     }
02907     float zMaxCoil = zCoil;
02908     float zmin; float zmax;
02909     ugh.GetZExtent(zmin,zmax);
02910     if(zMaxCoil>zmax && ZDir==1)  zMaxCoil=zmax;
02911     if(zMaxCoil<zmin && ZDir==-1) zMaxCoil=zmin;
02912 
02913     // now swim from mid-coil back to endplane
02914     float zMidCoil = 0.5*(zMinCoil + zMaxCoil);
02915     float delzC  = zMidCoil -Zscint;
02916     u_extrapC = u_end +delzC*du_end;
02917     v_extrapC = v_end +delzC*dv_end;
02918     x_extrapC = 0.707*(u_extrapC-v_extrapC);
02919     y_extrapC = 0.707*(u_extrapC+v_extrapC);
02920     
02921     StateVector[0] = u_extrapC; Output[0]=StateVector[0];
02922     StateVector[1] = v_extrapC; Output[1]=StateVector[1];
02923     StateVector[2] = FilteredData[EndPlane][0].x_k2; Output[2]=StateVector[2];
02924     StateVector[3] = FilteredData[EndPlane][0].x_k3; Output[3]=StateVector[3];
02925     chargesign = -1;
02926     if(FilteredData[EndPlane][0].x_k4!=0.) {chargesign =  FilteredData[EndPlane][0].x_k4/fabs(FilteredData[EndPlane][0].x_k4);}
02927     
02928     GoForward = !ZIncreasesWithTime;
02929     StateVector[4] = 10.*chargesign; Output[4]=StateVector[4]; 
02930 
02931     double dsdz = pow((1. + pow(StateVector[2],2) + pow(StateVector[3],2)),0.5);    
02932     // set fallback to nominal energy loss in case coil swim fails
02933     Prange = 0.095*dsdz;
02934     if(detector==Detector::kNear && EndPlane>121) Prange = 0.2*dsdz;  
02935     Prange += 0.5*dsdz*0.1*fabs(zMaxCoil-zMinCoil)*2.357*1.97;
02936 
02937     swimOK = Swim(StateVector, Output, zMidCoil, EndPlane , GoForward, &dS, &dRange, &dP);
02938    
02939     if(swimOK ){
02940       S = dS; Range = dRange; Prange = fabs(dP);
02941       cth.SetdS(EndPlane,S); 
02942       cth.SetRange(EndPlane,Range);
02943     }
02944     if(!swimOK) {Output[4] = chargesign/Prange;}
02945   
02946   }
02947 
02948   else{
02949     // normal case - track does not end in coil
02950     if((Zend<Zscint && ZDir==1) || (Zend>Zscint && ZDir==-1)) {
02951       MSG("AlgFitTrackCam",Msg::kWarning) << " Zend on wrong side of last scint! " << endl;
02952       Zend=Zscint;
02953     }
02954     
02955     // now swim to Zend
02956     StateVector[0]=FilteredData[EndPlane][0].x_k0; Output[0]=StateVector[0];
02957     StateVector[1]=FilteredData[EndPlane][0].x_k1; Output[1]=StateVector[1];
02958     StateVector[2]=FilteredData[EndPlane][0].x_k2; Output[2]=StateVector[2];
02959     StateVector[3]=FilteredData[EndPlane][0].x_k3; Output[3]=StateVector[3];
02960     StateVector[4]=FilteredData[EndPlane][0].x_k4; Output[4]=StateVector[4];
02961     chargesign = -1;
02962     if(StateVector[4]!=0.) {chargesign = StateVector[4]/fabs(StateVector[4]);}
02963     
02964     GoForward = ZIncreasesWithTime;
02965     done = Swim(StateVector, Output, EndPlane, Zend, GoForward,  &dS, &dRange, &dP);
02966     
02967     GoForward = !ZIncreasesWithTime;
02968     double dsdz = pow((1. + pow(StateVector[2],2) + pow(StateVector[3],2)),0.5); 
02969     S = 0; Range = 10.0*dsdz; Prange = 0.095*dsdz;
02970     swimOK = false;
02971     if(done){
02972       for(int j=0;j<5;j++) {StateVector[j]=Output[j];}
02973       
02974       // now swim from Zend to EndPlane
02975       StateVector[4] = chargesign * 10.52;  // start @ P = 100 MeV (Eloss in 1/2 " Iron)
02976       swimOK = Swim(StateVector, Output, Zend, EndPlane , GoForward, &dS, &dRange, &dP);
02977       if(swimOK){
02978         S += dS; Range += dRange; Prange += fabs(dP);
02979         cth.SetdS(EndPlane,S); 
02980         cth.SetRange(EndPlane,Range);
02981       }
02982     }
02983     if(!swimOK) {Output[4] = chargesign/Prange;}
02984   }
02985   
02986   int thisplane = EndPlane;
02987   // now swim back to vertex
02988   bool firstplane=true;
02989  for(int i=EndPlane+Increment; Increment*i<=Increment*VtxPlane; i+=Increment) {
02990     if(FilteredData[i].size()>0) {
02991       double delU = FilteredData[i][0].x_k0 - StateVector[0] ;
02992       double delV = FilteredData[i][0].x_k1 - StateVector[1] ;
02993       double dSperPlane=0.;
02994       if(thisplane!=i) {dSperPlane = pow(delU*delU + delV*delV,0.5)/double(abs(thisplane-i));}
02995 
02996       // only update state vector if change in U/V is reasonable.
02997       if(dSperPlane < 1.5*Munits::m) {
02998         StateVector[0]=FilteredData[i][0].x_k0;
02999         StateVector[1]=FilteredData[i][0].x_k1;
03000         StateVector[2]=FilteredData[i][0].x_k2;
03001         StateVector[3]=FilteredData[i][0].x_k3;
03002 
03003         chargesign=-1;
03004         if(FilteredData[i][0].x_k4!=0.) {chargesign = FilteredData[i][0].x_k4/fabs(FilteredData[i][0].x_k4);}
03005       }
03006 
03007       StateVector[4] = chargesign * fabs(Output[4]);
03008       done = Swim(StateVector, Output, thisplane, i , GoForward, &dS, &dRange, &dP);
03009       if(done){
03010         S+=dS; Range+=dRange; Prange+=fabs(dP);
03011         cth.SetdS(i,S); cth.SetRange(i,Range);
03012         firstplane=false;
03013       }
03014       else {
03015         MSG("AlgFitTrackCam",Msg::kDebug) << " swim fail " << endl;
03016       }
03017       thisplane=i;
03018     }
03019   }
03020 
03021   PlexPlaneId vtxplnid(detector,VtxPlane,false);
03022   PlexPlaneId plnid_before = vtxplnid.GetAdjoinSteel(-ZDir);
03023   
03024   if(plnid_before.IsValid()) {
03025     plnid = plnid_before;
03026     UgliSteelPlnHandle steelpln = ugh.GetSteelPlnHandle(plnid);
03027     double Zstart = steelpln.GetZ0();
03028     StateVector[0]=FilteredData[VtxPlane][0].x_k0;
03029     StateVector[1]=FilteredData[VtxPlane][0].x_k1;
03030     StateVector[2]=FilteredData[VtxPlane][0].x_k2;
03031     StateVector[3]=FilteredData[VtxPlane][0].x_k3;
03032     StateVector[4]=Output[4];
03033     Swim(StateVector, Output, VtxPlane, Zstart, GoForward, &dS,&dRange,&dP);
03034     S+=dS; Range+=dRange; Prange+=fabs(dP);
03035 
03036     cth.SetRange(VtxPlane,Range);
03037     cth.SetdS(VtxPlane,S);
03038   }
03039 
03040   // if Prange < 21 GeV, use this value.  Otherwise, use finder track energy, which is somewhat less prone to gross errors.
03041  
03042   // apply fudge factor for nominal steel thickness in ND geometry.
03043   //********* !!!!!!!!!!!!! ***********
03044   float ecorr = 1.0;
03045  if(vldc->GetDetector()==Detector::kNear && vldc->GetSimFlag()==SimFlag::kData) ecorr = 1.008; 
03046   
03047   cth.SetMomentumRange(Prange*ecorr);
03048   CandTrackHandle* findertrack = cth.GetFinderTrack();
03049   if(((detector==Detector::kFar && Prange>21.) || (detector==Detector::kNear && Prange>12.)) && findertrack) {cth.SetMomentumRange(findertrack->GetMomentum());}
03050 
03051 }

void AlgFitTrackCam::SetTrackProperties CandFitTrackCamHandle cth  ) 
 

Definition at line 2269 of file AlgFitTrackCam.cxx.

References bave, AlgTrack::CalculateTrace(), AlgReco::Calibrate(), Chi2(), EndCov, FilteredData, CandHandle::GetDaughterIterator(), GetFitData(), CandFitTrackHandle::GetMomentumCurve(), CandFitTrackHandle::GetMomentumRange(), CandHandle::GetNDaughters(), CandRecoHandle::GetNDigit(), CandStripHandle::GetPlane(), Calibrator::Instance(), CandTrackHandle::IsContained(), MaxPlane, MinPlane, MSG, nbfield, NIter, pow(), Calibrator::ReInitialise(), CandFitTrackHandle::SetBave(), CandFitTrackHandle::SetChi2(), CandRecoHandle::SetDirCosU(), CandRecoHandle::SetDirCosV(), CandRecoHandle::SetDirCosZ(), CandFitTrackHandle::SetEMCharge(), CandRecoHandle::SetEndDirCosU(), CandRecoHandle::SetEndDirCosV(), CandRecoHandle::SetEndDirCosZ(), CandFitTrackHandle::SetEnddUError(), CandFitTrackHandle::SetEnddVError(), CandRecoHandle::SetEndPlane(), CandFitTrackHandle::SetEndQP(), CandFitTrackHandle::SetEndQPError(), CandRecoHandle::SetEndU(), CandFitTrackHandle::SetEndUError(), CandRecoHandle::SetEndV(), CandFitTrackHandle::SetEndVError(), CandRecoHandle::SetEndZ(), CandTrackHandle::SetInShower(), CandTrackHandle::SetMomentum(), CandFitTrackHandle::SetMomentumCurve(), CandFitTrackHandle::SetNDOF(), CandFitTrackHandle::SetNIterate(), CandFitTrackHandle::SetNSwimFail(), CandTrackHandle::SetNTrackDigit(), CandTrackHandle::SetNTrackStrip(), CandFitTrackHandle::SetPlaneChi2(), CandFitTrackHandle::SetPlaneQP(), SetRangeAnddS(), CandFitTrackCamHandle::SetRangeBiasedQP(), AlgTrack::SetT(), CandTrackHandle::SetTrackPointError(), CandTrackHandle::SetU(), CandTrackHandle::SetV(), CandRecoHandle::SetVtxDirCosU(), CandRecoHandle::SetVtxDirCosV(), CandRecoHandle::SetVtxDirCosZ(), CandFitTrackHandle::SetVtxdUError(), CandFitTrackHandle::SetVtxdVError(), CandRecoHandle::SetVtxPlane(), CandFitTrackHandle::SetVtxQPError(), CandRecoHandle::SetVtxU(), CandFitTrackHandle::SetVtxUError(), CandRecoHandle::SetVtxV(), CandFitTrackHandle::SetVtxVError(), CandRecoHandle::SetVtxZ(), ShowerEntryPlane, SlcStripData, TimingFit(), TotalNSwimFail, TrkStripData, vldc, VtxCov, x_k, x_k4_biased, and ZIncreasesWithTime.

Referenced by RunTheFitter().

02270 { 
02271 
02272   if(nbfield>0) bave /=nbfield;
02273   
02274   // Carry out the assignment of variables to the new fitted track 
02275   MSG("AlgFitTrackCam",Msg::kDebug) << "SetTrackProperties" << endl;
02276   
02277   
02278   // Momentum, charge and error on q/p
02280   if(x_k[4]!=0.) {cth.SetMomentumCurve(fabs(1./x_k[4]));}
02281   cth.SetRangeBiasedQP(x_k4_biased);
02282   if(x_k[4]>0.) {cth.SetEMCharge(1.);}
02283   else if(x_k[4]<0.) {cth.SetEMCharge(-1.);}
02284   
02285   cth.SetVtxQPError(pow(VtxCov[4],0.5));
02287   
02288   
02289   // Positions and angles  
02291   int VtxPlane;
02292   int EndPlane;
02293   double dsdz;
02294   
02295   if(ZIncreasesWithTime==true) {VtxPlane=MinPlane; EndPlane=MaxPlane;}
02296   else {VtxPlane=MaxPlane; EndPlane=MinPlane;}
02297   
02298   // Vtx and end coordinates  
02299   cth.SetVtxU(FilteredData[VtxPlane][0].x_k0);
02300   cth.SetVtxV(FilteredData[VtxPlane][0].x_k1);
02301   cth.SetVtxZ(SlcStripData[VtxPlane][0].csh->GetZPos());
02302   cth.SetVtxPlane(VtxPlane);
02303   
02304   cth.SetEndU(FilteredData[EndPlane][0].x_k0);
02305   cth.SetEndV(FilteredData[EndPlane][0].x_k1);
02306 
02307   cth.SetEndZ(SlcStripData[EndPlane][0].csh->GetZPos());
02308   cth.SetEndPlane(EndPlane);
02309   
02310   
02311   // Vtx and end direction cosines
02312   dsdz=pow(1.+pow(FilteredData[VtxPlane][0].x_k2,2)+pow(FilteredData[VtxPlane][0].x_k3,2),0.5);
02313   if(ZIncreasesWithTime==false) {dsdz=-dsdz;}
02314   
02315   cth.SetVtxDirCosU(FilteredData[VtxPlane][0].x_k2/dsdz);
02316   cth.SetVtxDirCosV(FilteredData[VtxPlane][0].x_k3/dsdz);
02317   cth.SetVtxDirCosZ(1./dsdz);
02318   
02319   cth.SetDirCosU(FilteredData[VtxPlane][0].x_k2/dsdz);
02320   cth.SetDirCosV(FilteredData[VtxPlane][0].x_k3/dsdz);
02321   cth.SetDirCosZ(1./dsdz);
02322     
02323   dsdz=pow(1.+pow(FilteredData[EndPlane][0].x_k2,2)+pow(FilteredData[EndPlane][0].x_k3,2),0.5);
02324   if(ZIncreasesWithTime==false) {dsdz=-dsdz;}
02325   
02326   cth.SetEndDirCosU(FilteredData[EndPlane][0].x_k2/dsdz);
02327   cth.SetEndDirCosV(FilteredData[EndPlane][0].x_k3/dsdz);
02328   cth.SetEndDirCosZ(1./dsdz);
02329   
02330   // End q/p value
02331   cth.SetEndQP(FilteredData[EndPlane][0].x_k4);
02332     
02333   // Errors on vtx positions and angles  
02334   cth.SetVtxUError(pow(VtxCov[0],0.5));
02335   cth.SetVtxVError(pow(VtxCov[1],0.5));
02336   cth.SetVtxdUError(pow(VtxCov[2],0.5));
02337   cth.SetVtxdVError(pow(VtxCov[3],0.5)); 
02338   
02339   // Errors on end positions, angles and q/p
02340   cth.SetEndUError(pow(EndCov[0],0.5));
02341   cth.SetEndVError(pow(EndCov[1],0.5));
02342   cth.SetEnddUError(pow(EndCov[2],0.5));
02343   cth.SetEnddVError(pow(EndCov[3],0.5)); 
02344   cth.SetEndQPError(pow(EndCov[4],0.5)); 
02345 
02347 
02348   cth.SetBave(bave);
02349 
02350   // More variables to be set, in order to ensure compatibility
02352   cth.SetNTrackStrip(cth.GetNDaughters());
02353   cth.SetNTrackDigit(cth.GetNDigit());
02354   
02355   cth.SetNIterate(NIter);
02356   cth.SetNSwimFail(TotalNSwimFail);
02357   
02358   
02359   // Obtain "fitting data" for the final track strips
02360   for (int i=0; i<490; ++i) {TrkStripData[i].clear();} 
02361   GetFitData(MinPlane,MaxPlane);
02362   
02363   
02364   // Set tpos error and Calculate chi2, NDOF
02365   double Chi2=0; double Chi2Contrib=0; int NDOF=0; double FilteredTPos=0;
02366   
02367   for(int i=MinPlane; i<=MaxPlane; ++i) {
02368     if(TrkStripData[i].size()>0) {
02369       
02370       if(TrkStripData[i][0].TPosError>0.) {
02371         cth.SetTrackPointError(i,pow(TrkStripData[i][0].TPosError,0.5));
02372         
02373         if(TrkStripData[i][0].PlaneView==2) {FilteredTPos=FilteredData[i][0].x_k0;}
02374         else {FilteredTPos=FilteredData[i][0].x_k1;}
02375         
02376         Chi2Contrib = pow((TrkStripData[i][0].TPos-FilteredTPos),2) / TrkStripData[i][0].TPosError;
02377         cth.SetPlaneChi2(i,Chi2Contrib);        
02378         
02379         Chi2+=Chi2Contrib;
02380         
02381         NDOF++;
02382       }
02383     }
02384   }
02385   cth.SetChi2(Chi2);
02386   cth.SetNDOF(NDOF-5); // Number of constraints set to 5
02387   
02388   
02389   // Assign U, V and q/p values
02390   for(int i=MinPlane; i<=MaxPlane; ++i) {
02391     if(FilteredData[i].size()>0) {
02392       cth.SetU(i,FilteredData[i][0].x_k0);
02393       cth.SetV(i,FilteredData[i][0].x_k1);
02394       cth.SetPlaneQP(i,FilteredData[i][0].x_k4);
02395     }
02396   }
02397   
02398   
02399   // Set Trace and TraceZ
02400   CalculateTrace(cth);
02401   
02402   
02403   // Fill time and range maps
02404   SetT(&cth);
02405   SetRangeAnddS(cth);
02406   
02407   
02408   // Set momentum to our best estimate (range or curvature)
02409   cth.SetMomentum(cth.GetMomentumCurve());
02410   if(cth.IsContained()){
02411     cth.SetMomentum(cth.GetMomentumRange());
02412   }
02413   
02414   
02415   // Identify track strips inside in vertex shower
02416   
02417   TIter FitTrackStripItr = cth.GetDaughterIterator();
02418   while(CandStripHandle* FitTrackStrip = dynamic_cast<CandStripHandle*>(FitTrackStripItr()))
02419     {
02420       if(ShowerEntryPlane!=-99) {
02421         if( (ZIncreasesWithTime==true && FitTrackStrip->GetPlane()<=ShowerEntryPlane)
02422             || (ZIncreasesWithTime==false && FitTrackStrip->GetPlane()>=ShowerEntryPlane) ) {
02423           cth.SetInShower(FitTrackStrip,2);
02424         }
02425         else {cth.SetInShower(FitTrackStrip,0);}
02426       }
02427       else {cth.SetInShower(FitTrackStrip,0);}
02428     }
02429   
02430   
02431   // Set all time related variables
02432   TimingFit(cth);
02433   
02434   
02435   // Calibrate, to get track pulse height in MIPs, GeV, etc
02436   Calibrator& cal = Calibrator::Instance();
02437   cal.ReInitialise(*vldc);
02438   Calibrate(&cth);
02439 
02440 
02441 }

void AlgFitTrackCam::ShowerStrips  ) 
 

Definition at line 268 of file AlgFitTrackCam.cxx.

References abs(), FilteredData, min, MinPlane, MSG, ShowerEntryPlane, SlcStripData, SwimThroughShower, and ZIncreasesWithTime.

Referenced by RunTheFitter().

00269 {
00270   MSG("AlgFitTrackCam",Msg::kDebug) << "ShowerStrips, Look for large vertex shower" << endl;
00271      
00272   // Initialisations
00273   int Increment; int NumberOfStrips;
00274   int Plane; int NewPlane;
00275 
00276   int VtxShwWindow=8; 
00277   int StripsForShw=4;
00278   double PEThreshold=2.;
00279 
00280   if(ZIncreasesWithTime==true) {Plane=MinPlane; Increment=1;}
00281   else {Plane=MaxPlane; Increment=-1;}
00282   NewPlane=Plane;
00283 
00284 
00285   // Identify any vertex showers
00287   while(abs(Plane-NewPlane)<=VtxShwWindow && NewPlane>=MinPlane && NewPlane<=MaxPlane) {
00288 
00289     if(SlcStripData[NewPlane].size()>0) {
00290       NumberOfStrips=0;
00291 
00292 
00293       // Set the number of hits on a plane required for the plane to be identified as 'in the 
00294       // shower'. We account for the gradient of the track, with the factor of 0.25 representing
00295       // the approximate ratio of strip thickness to strip width.
00296       if(FilteredData[NewPlane].size()>0) {
00297         if(SlcStripData[NewPlane][0].csh->GetPlaneView()==2) {
00298           StripsForShw=min(7,int( 4+(0.25*fabs(FilteredData[NewPlane][0].x_k2)) ));
00299         }
00300         else {StripsForShw=min(7,int( 4+(0.25*fabs(FilteredData[NewPlane][0].x_k3)) ));}
00301       }
00302       else {StripsForShw=4;}
00303 
00304 
00305       // Count number of strips on plane with greater than 2PEs
00306       for(unsigned int j=0; j<SlcStripData[NewPlane].size(); ++j) {
00307         if(SlcStripData[NewPlane][j].csh->GetCharge()>PEThreshold) {NumberOfStrips++;}
00308       }
00309 
00310 
00311       // If a vertex shower is found, note that we should use the Swimmer
00312       // to find the most likely track strips inside the shower
00313       if(NumberOfStrips>=StripsForShw) {ShowerEntryPlane=NewPlane; SwimThroughShower=true; break;}
00314       
00315       NewPlane+=Increment;
00316     }
00317     else {NewPlane+=Increment;}
00318   }
00320 
00321 
00322  
00323   // Find the plane at which the 'clean' section of track enters the shower
00325   if(SwimThroughShower==true) {
00326     NewPlane=ShowerEntryPlane+Increment;
00327     int PlanesSinceLastHit=0;
00328     int PlaneWindow=4;
00329 
00330     while(PlanesSinceLastHit<PlaneWindow && NewPlane>=MinPlane && NewPlane<=MaxPlane) {
00331       if(SlcStripData[NewPlane].size()>0) {
00332         NumberOfStrips=0;
00333 
00334         // Account for gradient of track, as before
00335         if(FilteredData[NewPlane].size()>0) { 
00336           if(SlcStripData[NewPlane][0].csh->GetPlaneView()==2) {
00337             StripsForShw=min(7,int(4+(0.25*fabs(FilteredData[NewPlane][0].x_k2)) ));
00338           }
00339           else {StripsForShw=min(7,int(4+(0.25*fabs(FilteredData[NewPlane][0].x_k3)) ));}
00340         }
00341         else {StripsForShw=4;}
00342 
00343 
00344         // Count number of strips on plane with greater than 2PEs
00345         for(unsigned int j=0; j<SlcStripData[NewPlane].size(); ++j) {
00346           if(SlcStripData[NewPlane][j].csh->GetCharge()>PEThreshold) {NumberOfStrips++;}
00347         }
00348         if(NumberOfStrips>=StripsForShw) {
00349           ShowerEntryPlane=NewPlane; NewPlane+=Increment; PlanesSinceLastHit=0;
00350         }
00351         else {PlanesSinceLastHit++; NewPlane+=Increment;}
00352         
00353       }
00354       else {PlanesSinceLastHit++; NewPlane+=Increment;}
00355     }
00356   }
00358 }

void AlgFitTrackCam::ShowerSwim  ) 
 

Definition at line 601 of file AlgFitTrackCam.cxx.

References CalcKalmanGain(), StripStruct::csh, ExtrapCovMatrix(), GetCombiPropagator(), GetFitData(), GetNoiseMatrix(), H_k, InitTrkStripData, MaxPlane, MinPlane, MoveArrays(), MSG, SlcStripData, StoreFilteredData(), Swim(), SwimThroughShower, UpdateCovMatrix(), UpdateStateVector(), x_k, x_k_minus, and ZIncreasesWithTime.

Referenced by RunTheFitter().

00602 {
00603   // Method is called if we have a large shower near the track vertex
00604   //
00605   // The Swimmer is used to find the most likely track strip in the shower
00606   // and this strip is added to the fit
00607   MSG("AlgFitTrackCam",Msg::kDebug) << "ShowerSwim, improved track finding in shower" << endl;
00608 
00609   // Initialisations
00610   int Plane; int NewPlane;
00611   double StateVector[5]; double NState[5];
00612   bool GoForward; bool SwimBack;
00613   int PlanesSinceLastHit=0;
00614   int PlaneView;
00615   int Increment;
00616   
00617   double StripDistance; double MinDistanceToStrip;
00618   double StripWidth=4.108e-2;
00619 
00620 
00621   if(ZIncreasesWithTime==true) {GoForward=false; Plane=MinPlane; Increment=-1;}
00622   else {GoForward=true; Plane=MaxPlane; Increment=1;}
00623 
00624   NewPlane=Plane+Increment;
00625 
00626 
00627   // Continue until we reach a 4 plane window with no likely hit or we reach 
00628   // the end of the detector
00629   while(PlanesSinceLastHit<4 && NewPlane>0 && NewPlane<=485) {
00630     if(SlcStripData[NewPlane].size()>0) {
00631 
00632       if(SlcStripData[NewPlane][0].csh->GetPlaneView()==2) {PlaneView=0;}
00633       else {PlaneView=1;}
00634       
00635       for(int i=0; i<5; ++i) {StateVector[i]=x_k_minus[i];}
00636       SwimBack=Swim(StateVector, NState, Plane, NewPlane, GoForward);
00637       if(!SwimBack){break;}
00638       for(int i=0; i<5; ++i) {x_k[i]=NState[i];}
00639  
00640  
00641       // Find the closest strip (within a distance 'MinDistanceToStrip') and
00642       // temporarily store CandStripHandle
00643       // Results are very sensitive to value of MinDistanceToStrip
00644       CandStripHandle* CurrentStrip=0;
00645       MinDistanceToStrip=(1.5*StripWidth)+ fabs(0.0055*x_k[PlaneView+2]);
00646       
00647       for(unsigned int j=0; j<SlcStripData[NewPlane].size(); ++j) {
00648         StripDistance=fabs(SlcStripData[NewPlane][j].csh->GetTPos()-x_k[PlaneView]);
00649         
00650         if(StripDistance<MinDistanceToStrip) {
00651           MinDistanceToStrip=StripDistance;
00652           CurrentStrip=SlcStripData[NewPlane][j].csh;
00653         }
00654       }            
00655       
00656       // If we find a likely track strip, add it to the fit data and call the Kalman
00657       // update equations before repeating process to find next track strips in the shower
00658       if(CurrentStrip) {
00659         StripStruct temp;
00660         temp.csh = CurrentStrip;
00661         InitTrkStripData[NewPlane].push_back(temp);
00662         
00663         // Convert the strip to data required for Kalman fit
00664         GetFitData(NewPlane,NewPlane);
00665 
00666         // Carry out the Kalman fit
00667         if (PlaneView==1) {H_k[0]=0; H_k[1]=1; H_k[2]=0; H_k[3]=0; H_k[4]=0;}
00668         else {H_k[0]=1; H_k[1]=0; H_k[2]=0; H_k[3]=0; H_k[4]=0;}
00669         
00670         bool CombiPropagatorOk=GetCombiPropagator(Plane,NewPlane,GoForward);
00671         
00672         if(CombiPropagatorOk ) {
00673           GetNoiseMatrix(Plane,NewPlane);
00674           ExtrapCovMatrix();
00675           CalcKalmanGain(NewPlane);
00676           UpdateStateVector(Plane,NewPlane,GoForward);
00677           UpdateCovMatrix();
00678           MoveArrays();
00679           StoreFilteredData(NewPlane);
00680           
00681           if(ZIncreasesWithTime) {MinPlane=NewPlane; Plane=MinPlane;}
00682           else {MaxPlane=NewPlane; Plane=MaxPlane;}
00683           NewPlane=Plane+Increment;
00684           
00685           PlanesSinceLastHit=0;
00686         }
00687       }
00688       else {NewPlane+=Increment; PlanesSinceLastHit++;}
00689       
00690     }
00691     else {NewPlane+=Increment; PlanesSinceLastHit++;}
00692   }
00693   
00694   // Note that shower swim is complete
00695   SwimThroughShower=false;
00696 
00697 }

void AlgFitTrackCam::SpectrometerSwim CandFitTrackCamHandle cth  ) 
 

Definition at line 3198 of file AlgFitTrackCam.cxx.

References abs(), CandHandle::AddDaughterLink(), C_k, CalcKalmanGain(), StripStruct::csh, ExtrapCovMatrix(), FilteredData, GetCombiPropagator(), CandFitTrackHandle::GetFinderTrack(), GetFitData(), GetMomFromRange(), GetNoiseMatrix(), CandStripHandle::GetPlane(), PlexPlaneId::GetPlaneCoverage(), CandTrackHandle::GetRange(), CandStripHandle::GetZPos(), H_k, InitTrkStripData, CandHandle::IsSlushyEnabled(), PlexPlaneId::IsValid(), MaxPlane, MeanTrackTime, MoveArrays(), MSG, NDPlaneIsActive(), NDStripBegTime(), PassTrack, pow(), CandRecoHandle::SetEndDirCosU(), CandRecoHandle::SetEndDirCosV(), CandRecoHandle::SetEndDirCosZ(), CandRecoHandle::SetEndPlane(), CandRecoHandle::SetEndU(), CandRecoHandle::SetEndV(), CandRecoHandle::SetEndZ(), CandTrackHandle::SetMomentum(), CandHandle::SetSlushyEnabled(), AlgTrack::SetUVZT(), SlcStripData, StoreFilteredData(), Swim(), UpdateCovMatrix(), UpdateStateVector(), and x_k_minus.

Referenced by RunTheFitter().

03199 {
03200   MSG("AlgFitTrackCam",Msg::kDebug) << "SpectrometerSwim, improved track finding in spectrometer" << endl;
03201 
03202   // Initialisations
03203   // Sort out the lists for the ND spectrometer
03204   bool AddedStrip = false;
03205   int Plane; int NewPlane;
03206   double StateVector[5]; double NState[5]; double temp_x_k[5];
03207   bool GoForward; bool SpectSwim;
03208   int ActivePlanesSinceLastHit=0;
03209   int PlaneView; int Increment; int Counter;
03210   double LastHitTimes[2]={MeanTrackTime,MeanTrackTime};
03211   double TimeWindow=40.e-9;
03212 
03213   double StripDistance; double MinDistanceToStrip;
03214   double SwimError2;
03215   double StripWidth = 4.108e-2;
03216   double PlanePitch = 0.0594;
03217 
03218   bool TrackInActiveRegion;
03219   GoForward=true; Plane=MaxPlane; Increment=1;
03220 
03221   // Linear extrapolation from end of track to start of spectrometer.
03222   // Count number of active planes  
03223   while(ActivePlanesSinceLastHit<6 && Plane<121) {
03224     Plane += Increment;
03225     double u = x_k_minus[0] + x_k_minus[2]*(Plane-MaxPlane)*PlanePitch;
03226     double v = x_k_minus[1] + x_k_minus[3]*(Plane-MaxPlane)*PlanePitch;
03227 
03228     // 15 Feb 2008 - mitigate symptoms of a problem elsewhere - huge u and v can cause crash.
03229     if(fabs(u) > 5000 || fabs(v) > 5000){
03230       MSG("AlgFitTrackCam", Msg::kError) << "SpectrometerSwim - unexpectedly large u or v (u="
03231                                          << u << " v=" << v << ") bailing out." << endl;
03232       return;
03233     }
03234 
03235     if (NDPlaneIsActive(Plane, u, v, 0.3)) ActivePlanesSinceLastHit++;
03236   }
03237 
03238   // If we are clearly not near spectrometer, return from method
03239   if(ActivePlanesSinceLastHit>5 || abs(121-MaxPlane)>=40) {return;}
03240 
03241   // Set initial positions for swim
03242   ActivePlanesSinceLastHit=0;
03243   Plane = MaxPlane;  NewPlane = Plane+1;
03244 
03245   // Continue until we reach a 8 plane gap (counting only active planes) since prior
03246   // hit or we reach the end of the detector
03247   while(ActivePlanesSinceLastHit<8 && abs(NewPlane-Plane)<=70 && NewPlane<=290 && PassTrack==true) {
03248     
03249     PlexPlaneId plexPlane(Detector::kNear,NewPlane, 0); 
03250     if(SlcStripData[NewPlane].size()>0 && plexPlane.IsValid() && plexPlane.GetPlaneCoverage()!=PlaneCoverage::kNoActive) {
03251 
03252       if(SlcStripData[NewPlane][0].csh->GetPlaneView()==2) {PlaneView=0;}
03253       else {PlaneView=1;}
03254       
03255       for(int i=0; i<5; ++i) {StateVector[i]=x_k_minus[i];}
03256 
03257       // For the purposes of spectrometer track hit finding, don't allow track to range out before
03258       // we have swum all the hit spectrometer planes in this slice
03259       SpectSwim = Swim(StateVector, NState, Plane, NewPlane, GoForward);
03260 
03261       // If swim has failed and there is a large gap to next hit plane, stop the spectrometer swim.
03262       if(!SpectSwim && (NewPlane-Plane)>=40) {
03263         break;}
03264 
03265       // If swim has failed, but there is no large gap, make a momentum correction and swim again.
03266       if(!SpectSwim && StateVector[4]!=0) {
03267         Counter=0;
03268         // Double momentum and attempt to swim again
03269         while(!SpectSwim && Counter<2) {
03270           StateVector[4]*=0.5;  
03271           SpectSwim = Swim(StateVector, NState, Plane, NewPlane, GoForward);
03272           
03273           if(!SpectSwim) {Counter++;}
03274         }
03275       }
03276       
03277       if(!SpectSwim) {break;}
03278 
03279       for(int i=0; i<5; ++i) {temp_x_k[i]=NState[i];}
03280 
03281       // Calculate error in track extrapolation, based on covariance matrix on-diagonal elements
03282       SwimError2 = C_k[PlaneView][PlaneView] + (C_k[PlaneView+2][PlaneView+2]*PlanePitch*PlanePitch*(NewPlane-Plane)*(NewPlane-Plane)); 
03283       MinDistanceToStrip = 3.0 * pow(StripWidth*StripWidth + SwimError2,0.5);
03284       
03285 
03286       // Find the closest strip (within a distance 'MinDistanceToStrip') and temporarily store CandStripHandle
03287       CandStripHandle* CurrentStrip = 0;      
03288       for(unsigned int j=0; j<SlcStripData[NewPlane].size(); ++j) {
03289         StripDistance = fabs(SlcStripData[NewPlane][j].csh->GetTPos()-temp_x_k[PlaneView]);
03290 
03291         if(StripDistance<MinDistanceToStrip 
03292            && fabs(0.5*(LastHitTimes[0]+LastHitTimes[1])-NDStripBegTime(SlcStripData[NewPlane][j].csh,temp_x_k[0],temp_x_k[1]))<TimeWindow) {
03293           MinDistanceToStrip=StripDistance;
03294           CurrentStrip=SlcStripData[NewPlane][j].csh;
03295         }
03296       }
03297 
03298       // If we find a likely track strip, add it to the fit data and call the Kalman
03299       // update equations before repeating process to find next track strips in the shower
03300       if(CurrentStrip) {
03301         LastHitTimes[1]=LastHitTimes[0];
03302         LastHitTimes[0]=NDStripBegTime(CurrentStrip,temp_x_k[0],temp_x_k[1]);
03303 
03304         StripStruct temp;
03305         temp.csh = CurrentStrip;
03306         InitTrkStripData[NewPlane].push_back(temp);
03307         
03308         // Convert the strip to data required for Kalman fit
03309         GetFitData(NewPlane,NewPlane);
03310         
03311         // Carry out the Kalman fit
03312         if (PlaneView==1) {H_k[0]=0; H_k[1]=1; H_k[2]=0; H_k[3]=0; H_k[4]=0;}
03313         else {H_k[0]=1; H_k[1]=0; H_k[2]=0; H_k[3]=0; H_k[4]=0;}
03314         
03315         bool CombiPropagatorOk = GetCombiPropagator(Plane,NewPlane,GoForward);
03316 
03317         if(CombiPropagatorOk) {
03318           GetNoiseMatrix(Plane,NewPlane);
03319           ExtrapCovMatrix();
03320           CalcKalmanGain(NewPlane);
03321           UpdateStateVector(Plane,NewPlane,GoForward);
03322           UpdateCovMatrix();
03323           MoveArrays();
03324           StoreFilteredData(NewPlane);
03325           
03326           MaxPlane=NewPlane; Plane=MaxPlane;
03327           NewPlane=Plane+Increment;
03328           
03329           ActivePlanesSinceLastHit=0;
03330         }
03331 
03332         // Extend finder track, including the ND Spectrometer hits found in the fit
03334 
03335        
03336         CandTrackHandle * findertrack = cth.GetFinderTrack();
03337         if(findertrack) {
03338           bool SlushyOnEntry = CandHandle::IsSlushyEnabled();
03339           CandHandle::SetSlushyEnabled(kTRUE);
03340           AddedStrip = true;
03341           findertrack->AddDaughterLink(*CurrentStrip);
03342           findertrack->SetEndPlane(CurrentStrip->GetPlane());
03343           findertrack->SetEndZ(CurrentStrip->GetZPos());
03344           findertrack->SetEndU(FilteredData[CurrentStrip->GetPlane()][0].x_k0);
03345           findertrack->SetEndV(FilteredData[CurrentStrip->GetPlane()][0].x_k1);
03346           double dsdz = sqrt(1+pow(FilteredData[CurrentStrip->GetPlane()][0].x_k2,2)+pow(FilteredData[CurrentStrip->GetPlane()][0].x_k3,2));
03347           if(!ZIncreasesWithTime) dsdz=-dsdz;
03348           findertrack->SetEndDirCosU(FilteredData[CurrentStrip->GetPlane()][0].x_k2/dsdz);
03349           findertrack->SetEndDirCosV(FilteredData[CurrentStrip->GetPlane()][0].x_k3/dsdz);
03350           findertrack->SetEndDirCosZ(1/dsdz);
03351           if(!SlushyOnEntry) CandHandle::SetSlushyEnabled(kFALSE);
03352         }
03354         
03355       }
03356       else {
03357         TrackInActiveRegion=NDPlaneIsActive(NewPlane, temp_x_k[0], temp_x_k[1], 0.3);
03358         if(plexPlane.IsValid() && plexPlane.GetPlaneCoverage()!=PlaneCoverage::kNoActive && TrackInActiveRegion) 
03359           {ActivePlanesSinceLastHit++;}
03360         NewPlane+=Increment;
03361       }
03362     }
03363     else {
03364       double u = x_k_minus[0] + x_k_minus[2]*(NewPlane-Plane)*PlanePitch;
03365       double v = x_k_minus[1] + x_k_minus[3]*(NewPlane-Plane)*PlanePitch;
03366       
03367       TrackInActiveRegion=NDPlaneIsActive(NewPlane, u, v, 0.3); 
03368       
03369       if(plexPlane.IsValid() && plexPlane.GetPlaneCoverage()!=PlaneCoverage::kNoActive && TrackInActiveRegion) 
03370         {ActivePlanesSinceLastHit++;}
03371       NewPlane+=Increment; 
03372     }
03373   }
03374 
03375   
03376   // Sort out range and dS for finder track
03378   if(AddedStrip) {
03379     CandTrackHandle * findertrack = cth.GetFinderTrack();
03380     if(findertrack) {
03381       bool SlushyOnEntry = CandHandle::IsSlushyEnabled();
03382       CandHandle::SetSlushyEnabled(kTRUE);
03383       
03384       SetUVZT(findertrack);
03385       Double_t range = findertrack->GetRange();
03386       if (range>0.) {
03387         findertrack->SetMomentum(GetMomFromRange(range));   
03388       }
03389       if(!SlushyOnEntry) CandHandle::SetSlushyEnabled(kFALSE);
03390     }
03391   }
03393 
03394 }

void AlgFitTrackCam::StoreFilteredData const int  NewPlane  ) 
 

Definition at line 2251 of file AlgFitTrackCam.cxx.

References FilteredData, MSG, x_k, FiltDataStruct::x_k0, FiltDataStruct::x_k1, FiltDataStruct::x_k2, FiltDataStruct::x_k3, and FiltDataStruct::x_k4.

Referenced by GoBackwards(), GoForwards(), RunTheFitter(), ShowerSwim(), and SpectrometerSwim().

02252 {
02253   // Store the data required for matching Kalman output data to strips
02254   MSG("AlgFitTrackCam",Msg::kDebug) << "StoreFilteredData" << endl;
02255 
02256   FiltDataStruct temp;
02257   
02258   temp.x_k0=x_k[0]; temp.x_k1=x_k[1];
02259   temp.x_k2=x_k[2]; temp.x_k3=x_k[3];
02260   temp.x_k4=x_k[4];
02261 
02262   FilteredData[NewPlane].push_back(temp);
02263 }

bool AlgFitTrackCam::Swim double *  StateVector,
double *  Output,
const int  Plane,
const double  zend,
const bool  GoForward,
double *  dS = 0,
double *  Range = 0,
double *  dE = 0
 

Definition at line 1628 of file AlgFitTrackCam.cxx.

References done(), SwimParticle::GetCharge(), SwimParticle::GetDirection(), SwimParticle::GetMomentumModulus(), SwimParticle::GetPosition(), SwimParticle::GetRange(), SwimParticle::GetS(), GeoSwimmer::Initialize(), GeoSwimmer::Instance(), MSG, pow(), SwimParticle::SetCharge(), SlcStripData, SwimSwimmer::SwimBackward(), GeoSwimmer::SwimBackward(), SwimSwimmer::SwimForward(), GeoSwimmer::SwimForward(), vldc, and ZIncreasesWithTime.

01630 {
01631   MSG("AlgFitTrackCam",Msg::kDebug) << "Swim, specified end Z" << endl;
01632 
01633   // Initialisations
01634   // customize for bfield scaling.
01635 
01636   BField * bf = new BField(*vldc,-1,0);
01637   SwimSwimmer* myswimmer = new SwimSwimmer(*vldc,bf);
01638 
01639   if(UseGeoSwimmer) GeoSwimmer::Instance()->Initialize(*vldc);
01640 
01641   double invSqrt2 = pow(1./2.,0.5);
01642   double charge = 0.;
01643   bool done = false;
01644     
01645   if(fabs(StateVector[4])>1.e-10) {
01646     double modp = fabs(1./StateVector[4]);
01647     
01648     // Fix, to account for fact the cosmic muons could move in direction of negative z
01649     if(ZIncreasesWithTime==false) {modp=-modp;}
01650     
01651     double dsdz = pow((1.+pow(StateVector[2],2)+pow(StateVector[3],2)),0.5);
01652     double dxdz = invSqrt2*(StateVector[2]-StateVector[3]);
01653     double dydz = invSqrt2*(StateVector[2]+StateVector[3]);
01654   
01655     // Set up current muon details
01656     if(StateVector[4]>0.) charge = 1.;
01657     else if(StateVector[4]<0.) charge = -1.;
01658     
01659     TVector3 position(invSqrt2*(StateVector[0]-StateVector[1]),
01660                       invSqrt2*(StateVector[0]+StateVector[1]),
01661                       SlcStripData[Plane][0].csh->GetZPos());
01662 
01663 
01664     TVector3 momentum(modp*(dxdz/dsdz),
01665                       modp*(dydz/dsdz),
01666                       modp/dsdz);
01667     SwimParticle muon(position,momentum);
01668     muon.SetCharge(charge);
01669     SwimZCondition zc(Zend);
01670  
01671     // Do the swim, accounting for direction of motion w.r.t time too
01672     if( (GoForward==true && ZIncreasesWithTime==true)  || (GoForward==false && ZIncreasesWithTime==false) ) {
01673       if(UseGeoSwimmer){
01674         done = GeoSwimmer::Instance()->SwimForward(muon,Zend);
01675       } else {
01676         done = myswimmer->SwimForward(muon,zc);
01677       }   
01678     }
01679     else if( (GoForward==true && ZIncreasesWithTime==false)  || (GoForward==false && ZIncreasesWithTime==true) ) {
01680       if(UseGeoSwimmer){
01681         done = GeoSwimmer::Instance()->SwimBackward(muon,Zend);
01682       } else {
01683         done = myswimmer->SwimBackward(muon,zc);
01684       }    
01685     }
01686     if(done==true) {
01687       if(muon.GetDirection().Z()!=0. && muon.GetMomentumModulus()!=0.) {
01688         Output[0]=invSqrt2*(muon.GetPosition().Y()+muon.GetPosition().X());
01689         Output[1]=invSqrt2*(muon.GetPosition().Y()-muon.GetPosition().X());
01690         Output[2]=invSqrt2*((muon.GetDirection().Y()/muon.GetDirection().Z())+(muon.GetDirection().X()/muon.GetDirection().Z()));
01691         Output[3]=invSqrt2*((muon.GetDirection().Y()/muon.GetDirection().Z())-(muon.GetDirection().X()/muon.GetDirection().Z()));
01692         Output[4]=muon.GetCharge()/muon.GetMomentumModulus();
01693         // Get range and dS from the Swimmer
01694         if(dS) {*dS=muon.GetS();} if(Range) {*Range=muon.GetRange();} if(dE){*dE=muon.GetMomentumModulus()-momentum.Mag();}
01695       }
01696       else {done=false;}
01697     }
01698     
01699   }
01700 
01701   else{
01702     // If infinite momentum, use straight line extrapolation
01703     double delz = (Zend-SlcStripData[Plane][0].csh->GetZPos());
01704     Output[0]=StateVector[0] + StateVector[2]*delz;
01705     Output[1]=StateVector[1] + StateVector[3]*delz;
01706     Output[2]=StateVector[2];
01707     Output[3]=StateVector[3];
01708     Output[4]=StateVector[4];
01709 
01710     done=true;
01711   }    
01712   
01713   delete myswimmer;
01714   delete bf;
01715   return done;
01716 }

bool AlgFitTrackCam::Swim double *  StateVector,
double *  Output,
const double  zbeg,
const int  NewPlane,
const bool  GoForward,
double *  dS = 0,
double *  Range = 0,
double *  dE = 0
 

Definition at line 1533 of file AlgFitTrackCam.cxx.

References done(), SwimParticle::GetCharge(), SwimParticle::GetDirection(), SwimParticle::GetMomentumModulus(), SwimParticle::GetPosition(), SwimParticle::GetRange(), SwimParticle::GetS(), GeoSwimmer::Initialize(), GeoSwimmer::Instance(), MSG, pow(), SwimParticle::SetCharge(), SlcStripData, SwimSwimmer::SwimBackward(), GeoSwimmer::SwimBackward(), SwimSwimmer::SwimForward(), GeoSwimmer::SwimForward(), vldc, and ZIncreasesWithTime.

01535 {
01536   MSG("AlgFitTrackCam",Msg::kDebug) << "Swim, specified starting Z" << endl;
01537 
01538   // Initialisations
01539   // customize for bfield scaling.
01540   BField * bf = new BField(*vldc,-1,0);
01541   SwimSwimmer* myswimmer = new SwimSwimmer(*vldc,bf);
01542   
01543   if(UseGeoSwimmer) GeoSwimmer::Instance()->Initialize(*vldc);
01544 
01545   double invSqrt2 = pow(1./2.,0.5);
01546   double charge = 0.;
01547   bool done = false;
01548     
01549   if(fabs(StateVector[4])>1.e-10) {
01550     double modp = fabs(1./StateVector[4]);
01551     
01552     // Fix, to account for fact the cosmic muons could move in direction of negative z
01553     if(ZIncreasesWithTime==false) {modp=-modp;}
01554     
01555     double dsdz = pow((1.+pow(StateVector[2],2)+pow(StateVector[3],2)),0.5);
01556     double dxdz = invSqrt2*(StateVector[2]-StateVector[3]);
01557     double dydz = invSqrt2*(StateVector[2]+StateVector[3]);
01558     
01559     // Set up current muon details
01560     if(StateVector[4]>0.) charge = 1.;
01561     else if(StateVector[4]<0.) charge = -1.;
01562     
01563     TVector3 position(invSqrt2*(StateVector[0]-StateVector[1]),
01564                       invSqrt2*(StateVector[0]+StateVector[1]),
01565                       z);
01566 
01567     TVector3 momentum(modp*(dxdz/dsdz),
01568                       modp*(dydz/dsdz),
01569                       modp/dsdz);
01570     SwimParticle muon(position,momentum);
01571     muon.SetCharge(charge);
01572     SwimZCondition zc(SlcStripData[NewPlane][0].csh->GetZPos());
01573 
01574    
01575     // Do the swim, accounting for direction of motion w.r.t time too
01576     if( (GoForward==true && ZIncreasesWithTime==true)  || (GoForward==false && ZIncreasesWithTime==false) ) {
01577       if(UseGeoSwimmer) {
01578         done = GeoSwimmer::Instance()->SwimForward(muon,SlcStripData[NewPlane][0].csh->GetZPos());
01579       } else {
01580         done = myswimmer->SwimForward(muon,zc);
01581       } 
01582     }
01583     else if( (GoForward==true && ZIncreasesWithTime==false)  || (GoForward==false && ZIncreasesWithTime==true) ) {
01584       if(UseGeoSwimmer) {
01585         done = GeoSwimmer::Instance()->SwimBackward(muon,SlcStripData[NewPlane][0].csh->GetZPos());
01586 
01587       } else {
01588         done = myswimmer->SwimBackward(muon,zc);
01589       }     
01590     }
01591     if(done==true) {
01592       if(muon.GetDirection().Z()!=0. && muon.GetMomentumModulus()!=0.) {
01593         Output[0]=invSqrt2*(muon.GetPosition().Y()+muon.GetPosition().X());
01594         Output[1]=invSqrt2*(muon.GetPosition().Y()-muon.GetPosition().X());
01595         Output[2]=invSqrt2*((muon.GetDirection().Y()/muon.GetDirection().Z())+(muon.GetDirection().X()/muon.GetDirection().Z()));
01596         Output[3]=invSqrt2*((muon.GetDirection().Y()/muon.GetDirection().Z())-(muon.GetDirection().X()/muon.GetDirection().Z()));
01597         Output[4]=muon.GetCharge()/muon.GetMomentumModulus();
01598         // Get range and dS from the Swimmer
01599         if(dS) {*dS=muon.GetS();} if(Range) {*Range=muon.GetRange();} if(dE){*dE=muon.GetMomentumModulus()-momentum.Mag();} 
01600       }
01601       else {done=false;}
01602     }
01603     
01604   }
01605 
01606   else{
01607     // If infinite momentum, use straight line extrapolation
01608     double delz = (SlcStripData[NewPlane][0].csh->GetZPos()-z);
01609     Output[0]=StateVector[0] + StateVector[2]*delz;
01610     Output[1]=StateVector[1] + StateVector[3]*delz;
01611     Output[2]=StateVector[2];
01612     Output[3]=StateVector[3];
01613     Output[4]=StateVector[4];
01614 
01615     done=true;
01616   }    
01617   
01618   delete myswimmer;
01619   delete bf;
01620 
01621   return done;
01622 }

bool AlgFitTrackCam::Swim double *  StateVector,
double *  Output,
const int  Plane,
const int  NewPlane,
const bool  GoForward,
double *  dS = 0,
double *  Range = 0,
double *  dE = 0
 

Definition at line 1437 of file AlgFitTrackCam.cxx.

References bave, done(), BField::GetBField(), SwimParticle::GetCharge(), SwimParticle::GetDirection(), SwimParticle::GetMomentumModulus(), SwimParticle::GetPosition(), SwimParticle::GetRange(), SwimParticle::GetS(), GeoSwimmer::Initialize(), GeoSwimmer::Instance(), MSG, nbfield, pow(), SwimParticle::SetCharge(), SlcStripData, SwimSwimmer::SwimBackward(), GeoSwimmer::SwimBackward(), SwimSwimmer::SwimForward(), GeoSwimmer::SwimForward(), vldc, and ZIncreasesWithTime.

Referenced by FillGapsInTrack(), GetCombiPropagator(), SetRangeAnddS(), ShowerSwim(), SpectrometerSwim(), and UpdateStateVector().

01439 {
01440   MSG("AlgFitTrackCam",Msg::kDebug) << "Swim" << endl;
01441 
01442   // Initialisations
01443   // customize for bfield scaling.
01444   BField * bf = new BField(*vldc,-1,0);
01445   SwimSwimmer* myswimmer = new SwimSwimmer(*vldc,bf);
01446   
01447   if(UseGeoSwimmer) GeoSwimmer::Instance()->Initialize(*vldc);
01448  
01449   double invSqrt2 = pow(1./2.,0.5);
01450   double charge = 0.;
01451   bool done = false;
01452     
01453   if(fabs(StateVector[4])>1.e-10) {
01454     double modp = fabs(1./StateVector[4]);
01455     
01456     // Fix, to account for fact the cosmic muons could move in direction of negative z
01457     if(ZIncreasesWithTime==false) {modp=-modp;}
01458     
01459     double dsdz = pow((1.+pow(StateVector[2],2)+pow(StateVector[3],2)),0.5);
01460     double dxdz = invSqrt2*(StateVector[2]-StateVector[3]);
01461     double dydz = invSqrt2*(StateVector[2]+StateVector[3]);
01462     
01463     // Set up current muon details
01464     if(StateVector[4]>0.) charge = 1.;
01465     else if(StateVector[4]<0.) charge = -1.;
01466     
01467     TVector3 position(invSqrt2*(StateVector[0]-StateVector[1]),
01468                       invSqrt2*(StateVector[0]+StateVector[1]),
01469                       SlcStripData[Plane][0].csh->GetZPos());
01470 
01471     TVector3 momentum(modp*(dxdz/dsdz),
01472                       modp*(dydz/dsdz),
01473                       modp/dsdz);
01474 
01475     TVector3 bfield = bf->GetBField(position);
01476     bave += TMath::Sqrt(bfield[0]*bfield[0]+bfield[1]*bfield[1]+bfield[2]*bfield[2]);
01477     nbfield++;
01478 
01479     SwimParticle muon(position,momentum);
01480     muon.SetCharge(charge);
01481     SwimZCondition zc(SlcStripData[NewPlane][0].csh->GetZPos());
01482     // Do the swim, accounting for direction of motion w.r.t time too
01483     if( (GoForward==true && ZIncreasesWithTime==true)  || (GoForward==false && ZIncreasesWithTime==false) ) {
01484       if(UseGeoSwimmer) {
01485         done = GeoSwimmer::Instance()->SwimForward(muon,SlcStripData[NewPlane][0].csh->GetZPos());
01486       } else {
01487         done = myswimmer->SwimForward(muon,zc);
01488       }
01489     }
01490     else if( (GoForward==true && ZIncreasesWithTime==false)  || (GoForward==false && ZIncreasesWithTime==true) ) {
01491       if(UseGeoSwimmer) {
01492         done = GeoSwimmer::Instance()->SwimBackward(muon,SlcStripData[NewPlane][0].csh->GetZPos());
01493       } else {
01494         done = myswimmer->SwimBackward(muon,zc);
01495       }
01496     }
01497     if(done==true) {
01498       if(muon.GetDirection().Z()!=0. && muon.GetMomentumModulus()!=0.) {
01499         Output[0]=invSqrt2*(muon.GetPosition().Y()+muon.GetPosition().X());
01500         Output[1]=invSqrt2*(muon.GetPosition().Y()-muon.GetPosition().X());
01501         Output[2]=invSqrt2*((muon.GetDirection().Y()/muon.GetDirection().Z())+(muon.GetDirection().X()/muon.GetDirection().Z()));
01502         Output[3]=invSqrt2*((muon.GetDirection().Y()/muon.GetDirection().Z())-(muon.GetDirection().X()/muon.GetDirection().Z()));
01503         Output[4]=muon.GetCharge()/muon.GetMomentumModulus();
01504         // Get range and dS from the Swimmer
01505         if(dS) {*dS=muon.GetS();} if(Range) {*Range=muon.GetRange();} if(dE){*dE=muon.GetMomentumModulus()-momentum.Mag();} 
01506       }
01507       else {done=false;}
01508     }
01509     
01510   }
01511 
01512   else{
01513     // If infinite momentum, use straight line extrapolation
01514     double delz = (SlcStripData[NewPlane][0].csh->GetZPos()-SlcStripData[Plane][0].csh->GetZPos());
01515     Output[0]=StateVector[0] + StateVector[2]*delz;
01516     Output[1]=StateVector[1] + StateVector[3]*delz;
01517     Output[2]=StateVector[2];
01518     Output[3]=StateVector[3];
01519     Output[4]=StateVector[4];
01520 
01521     done=true;
01522   }    
01523   
01524   delete myswimmer;
01525   delete bf;
01526   return done;
01527 }

void AlgFitTrackCam::TimingFit CandFitTrackCamHandle cth  ) 
 

Definition at line 2447 of file AlgFitTrackCam.cxx.

References C, Chi2(), UgliStripHandle::ClearFiber(), digit(), CandDigitHandle::GetCharge(), CandStripHandle::GetCharge(), CandRecoHandle::GetCharge(), CandHandle::GetDaughterIterator(), VldContext::GetDetector(), CandTrackHandle::GetdS(), PlexSEIdAltL::GetEnd(), UgliStripHandle::GetHalfLength(), CandStripHandle::GetPlaneView(), CandDigitHandle::GetPlexSEIdAltL(), CandStripHandle::GetStripEndId(), UgliGeomHandle::GetStripHandle(), CandTrackHandle::GetT(), CandStripHandle::GetTime(), CandTrackHandle::GetU(), CandTrackHandle::GetV(), InitTrkStripData, MaxPlane, MinPlane, MSG, pow(), s(), CandRecoHandle::SetEndT(), CandTrackHandle::SetNTimeFitDigit(), CandTrackHandle::SetTimeBackwardFitNDOF(), CandTrackHandle::SetTimeBackwardFitRMS(), CandTrackHandle::SetTimeFitChi2(), CandTrackHandle::SetTimeForwardFitNDOF(), CandTrackHandle::SetTimeForwardFitRMS(), CandRecoHandle::SetTimeOffset(), CandRecoHandle::SetTimeSlope(), CandRecoHandle::SetVtxT(), StripListTime, vldc, UgliStripHandle::WlsPigtail(), and ZIncreasesWithTime.

Referenced by SetTrackProperties().

02448 {
02449   MSG("AlgFitTrackCam",Msg::kDebug) << "TimingFit" << endl;
02450 
02451   // Initialisations
02453   double s; double t; double q; int n=0; 
02454   double MinUncertainty = 0.; double MinCT=-3000.;
02455   
02456   // Time of first strip in track
02457   StripListTime=9.e30;
02458 
02459   // Create an offset such that dS=0 at the MinPlane
02460   double dSOffset=0.; double Sign=-1.; double dS[490];
02461   if(ZIncreasesWithTime==true) {dSOffset=cth.GetdS(MinPlane); Sign=1.;}
02462 
02463   // Store data needed in arrays. Charge is in PEs.
02464   double Qp[490];  double Qm[490];
02465   double CTp[490]; double CTm[490];
02466   int Skipp[490];  int Skipm[490];
02467   double C=3.e8;   
02468 
02469   double ErrorParam[3];
02470   ErrorParam[0]=0.; ErrorParam[1]=0.; ErrorParam[2]=0.;
02471 
02472   // Zero the arrays
02473   for(int i=0; i<490; ++i) { 
02474     dS[i]=0.; Qp[i]=0.; Qm[i]=0.; CTp[i]=0.; 
02475     CTm[i]=0.; Skipp[i]=0; Skipm[i]=0;
02476   }
02478 
02479 
02480 
02481   // Organise timing for the Far Detector
02483   if(vldc->GetDetector()==Detector::kFar) {  
02484     // Parameters for PE vs time fit residual
02485     MinUncertainty=0.56;
02486     ErrorParam[0]=0.56; ErrorParam[1]=0.50; ErrorParam[2]=-0.34;
02487 
02488     // Loop over all planes
02489     for(int i=MinPlane; i<=MaxPlane; ++i) {
02490         
02491       if(InitTrkStripData[i].size()>0) {
02492         dS[i]=Sign*(dSOffset-cth.GetdS(i));
02493         
02494         CTp[i]=C*cth.GetT(i,StripEnd::kPositive);
02495         CTm[i]=C*cth.GetT(i,StripEnd::kNegative);
02496         
02497         if(CTp[i]>MinCT && CTp[i]<StripListTime) {StripListTime=CTp[i];}
02498         if(CTm[i]>MinCT && CTm[i]<StripListTime) {StripListTime=CTm[i];}
02499         
02500         for(unsigned int j=0; j<InitTrkStripData[i].size(); ++j) {
02501           Qp[i]+=InitTrkStripData[i][j].csh->GetCharge(StripEnd::kPositive);
02502           Qm[i]+=InitTrkStripData[i][j].csh->GetCharge(StripEnd::kNegative);
02503         }
02504       }
02505     }
02506 
02507     // Subtract StripList time
02508     if(StripListTime<8.e30) {
02509       for(int i=MinPlane; i<=MaxPlane; ++i) {
02510         if(InitTrkStripData[i].size()>0) {
02511           CTp[i]-=StripListTime;
02512           CTm[i]-=StripListTime;
02513         }
02514       }
02515     }
02516     else {StripListTime=0.;}
02517 
02518   } // End Far Detector Section
02520 
02521 
02522 
02523   // Organise timing for the Near Detector
02525   if(vldc->GetDetector()==Detector::kNear) {
02526     // Parameters for PE vs time fit residual
02527     MinUncertainty=1.19;
02528     ErrorParam[0]=1.13; ErrorParam[1]=0.63; ErrorParam[2]=-0.21;
02529 
02530     double Index=1.77; double DistFromCentre=0.; double CTime=0.;  double FibreDist=0.;    
02531     double halfLength=0.; double DigChg=0.; double PlaneDigChg;
02532 
02533     StripEnd::StripEnd_t StpEnd = StripEnd::kUnknown;
02534     CandStripHandle* strip; CandDigitHandle* digit;
02535 
02536     UgliGeomHandle ugh = UgliGeomHandle(*vldc);
02537     UgliStripHandle striphandle;
02538 
02539 
02540     // Loop over all planes
02541     for(int i=MinPlane; i<=MaxPlane; ++i)
02542       {
02543         if(InitTrkStripData[i].size()>0) {dS[i]=Sign*(dSOffset-cth.GetdS(i));}
02544         PlaneDigChg=0.;
02545 
02546         // Loop over track strips on plane. Only +ve StripEnds should have charge.
02547         for(unsigned int j=0; j<InitTrkStripData[i].size(); ++j) {
02548           strip = InitTrkStripData[i][j].csh;
02549           CandDigitHandleItr digitItr(strip->GetDaughterIterator());
02550 
02551           Qp[i]+=strip->GetCharge(StripEnd::kPositive);
02552 
02553 
02554           // Loop over digits on strip. 
02556           while( (digit = digitItr()) ) { 
02557             StpEnd=digit->GetPlexSEIdAltL().GetEnd();
02558 
02559             if(StpEnd==StripEnd::kPositive) {
02560               FibreDist = 0.; DistFromCentre = 0.; CTime=0.; DigChg=0.;
02561               UgliStripHandle stripHandle = ugh.GetStripHandle(strip->GetStripEndId());
02562               halfLength = stripHandle.GetHalfLength(); 
02563          
02564               if(strip->GetPlaneView()==2) {DistFromCentre = cth.GetV(i);}
02565               if(strip->GetPlaneView()==3) {DistFromCentre = -cth.GetU(i);}
02566               
02567               FibreDist = (halfLength + DistFromCentre + stripHandle.ClearFiber(StpEnd) 
02568                            + stripHandle.WlsPigtail(StpEnd));
02569               
02570               CTime = C*(strip->GetTime(StpEnd)) - Index*FibreDist;
02571               DigChg=digit->GetCharge();
02572               
02573               PlaneDigChg+=DigChg; CTp[i]+=DigChg*CTime;
02574 
02575               if(CTime>MinCT && CTime<StripListTime) {StripListTime=CTime;}
02576             }
02577           }
02579         }
02580         if(PlaneDigChg>0.) CTp[i]/=PlaneDigChg;
02581       }
02582 
02583 
02584     // Subtract StripList time
02585     if(StripListTime<8.e30) {
02586       for(int i=MinPlane; i<=MaxPlane; ++i) {
02587         if(InitTrkStripData[i].size()>0) {
02588           CTp[i]-=StripListTime;
02589         }
02590       }
02591     }
02592     else {StripListTime=0.;}
02593     
02594   } // End near detector section
02596     
02597     
02598 
02599   // Carry out a simple straight line fit for T vs dS
02601   // Sqt: sum of charge*time, Sqss: sum of charge*dS*dS, etc.
02602   double Sqs=0; double Sqt=0; double Sqss=0; double Sqst=0; double Sqtt=0; double Sq=0;
02603   double TimeSlope=-999; double TimeOffset=-999; double RMS=-999;
02604   double CTCut = 0.; bool CalculateChi2=true;
02605 
02606   
02607   // On first iteration, carry out simple fit. Remove outlying points on subsequent passes.
02608   for(int itr=0; itr<3; ++itr) {
02609  
02610     for(int i=MinPlane; i<=MaxPlane; ++i) { 
02611 
02612       // Only consider planes where we found our final strips
02613       if(InitTrkStripData[i].size()>0) { 
02614         
02615         // For positive strip ends      
02616         s=dS[i]; q=Qp[i]; t=CTp[i];
02617         
02618         if(q>0. && t>MinCT && Skipp[i]==0) {
02619           if(itr==0) {Sq+=q; Sqs+=q*s; Sqt+=q*t; Sqss+=q*s*s; Sqst+=q*s*t; Sqtt+=q*t*t; n++;}
02620           
02621           else if(fabs(t-TimeOffset-(s*TimeSlope)) > CTCut) {
02622             Sqs-=q*s; Sqt-=q*t; Sqss-=q*s*s; Sqst-=q*s*t; Sqtt-=q*t*t; Sq-=q; n--; Skipp[i]=1;
02623           }
02624         }
02625 
02626 
02627         // For negative strip ends
02628         q=Qm[i]; t=CTm[i];
02629         
02630         if(q>0. && t>MinCT && Skipm[i]==0) {
02631           if(itr==0) {Sq+=q; Sqs+=q*s; Sqt+=q*t; Sqss+=q*s*s; Sqst+=q*s*t; Sqtt+=q*t*t; n++;}
02632           
02633           else if(fabs(t-TimeOffset-(s*TimeSlope)) > CTCut) {
02634             Sqs-=q*s; Sqt-=q*t; Sqss-=q*s*s; Sqst-=q*s*t; Sqtt-=q*t*t; Sq-=q; n--; Skipm[i]=1;
02635           }
02636         }
02637 
02638       }
02639     }
02640     
02641     // Calculate parameters
02642     if( (Sq*Sqss-Sqs*Sqs)!=0. && Sq!=0. ) {
02643       TimeSlope  = (Sq*Sqst-Sqs*Sqt)/(Sq*Sqss-Sqs*Sqs);
02644       TimeOffset = (Sqt*Sqss-Sqs*Sqst)/(Sq*Sqss-Sqs*Sqs);
02645       if( ((Sqtt/Sq)-((Sqt/Sq)*(Sqt/Sq)))>0. ) {
02646         RMS = pow((Sqtt/Sq)-((Sqt/Sq)*(Sqt/Sq)),0.5);
02647         CTCut = 3.+RMS;
02648       }
02649       else {CTCut = 3.5;}
02650     }
02651     else  {CalculateChi2=false; break;}
02652   }
02654 
02655 
02656 
02657   // Set timing properties for the fitted track
02659   if(n!=0 && CalculateChi2==true) {
02660 
02661     // Offset, slope and vtx/end times
02663     cth.SetTimeOffset((TimeOffset+StripListTime)/C);
02664     cth.SetTimeSlope(TimeSlope/C);
02665 
02666     if(ZIncreasesWithTime==true) {
02667       cth.SetVtxT((TimeOffset+StripListTime)/C); 
02668       cth.SetEndT((TimeOffset+StripListTime)/C+(dS[MaxPlane]*TimeSlope/C));
02669     }
02670     else {
02671       cth.SetEndT((TimeOffset+StripListTime)/C); 
02672       cth.SetVtxT((TimeOffset+StripListTime)/C+(dS[MaxPlane]*TimeSlope/C));
02673     }
02675 
02676 
02677     // Chi2
02679     double Uncertainty; double Residual2; double Chi2=0; 
02680  
02681     for(int i=MinPlane; i<=MaxPlane; ++i) { 
02682       
02683       if(InitTrkStripData[i].size()>0) { 
02684         // For positive strip ends
02685         s=dS[i]; q=Qp[i]; t=CTp[i];
02686         if(q>0. && t>MinCT && Skipp[i]==0) {
02687           Residual2=pow(t-TimeOffset-(s*TimeSlope),2);
02688 
02689           // From a rough parameterisation of uncertainty (in CT) vs number of PEs
02690           if (q<20) {Uncertainty = ErrorParam[0]+exp(ErrorParam[1]+ErrorParam[2]*q);}
02691           else {Uncertainty=MinUncertainty;}
02692 
02693           if(Uncertainty!=0.) {Chi2+=Residual2/pow(Uncertainty,2);}
02694         }
02695 
02696 
02697         // For negative strip ends
02698         q=Qm[i]; t=CTm[i];
02699         if(q>0. && t>MinCT && Skipm[i]==0) {
02700           Residual2=pow(t-TimeOffset-(s*TimeSlope),2);
02701 
02702           // From a rough parameterisation of uncertainty (in CT) vs number of PEs
02703           if (q<20) {Uncertainty = ErrorParam[0]+exp(ErrorParam[1]+ErrorParam[2]*q);}
02704           else {Uncertainty=MinUncertainty;}
02705           
02706           if(Uncertainty!=0.) {Chi2+=Residual2/pow(Uncertainty,2);}
02707         }
02708       }
02709       
02710     }
02711     // Set these properties
02712     cth.SetTimeFitChi2(Chi2);
02713     cth.SetNTimeFitDigit(n);
02714   }
02716 
02717 
02718 
02719   // Now carry out fits with gradients constrained to be +/- c
02721   double CTIntercept[2]; double Csigma[2]; double Ctrunc[2]; 
02722   double ChiSqPositive=-999; double ChiSqNegative=-999; 
02723   int ChiSqNdfPos=-999; int ChiSqNdfNeg=-999;  
02724   double Swtt[2]; double Swt[2]; double Sw[2]; int npts[2]={0,0};
02725 
02726   if(Sq!=0.) {
02727     CTIntercept[0]=Sqt/Sq; Csigma[0]=-99999.9; Ctrunc[0]=-99999.9;
02728     CTIntercept[1]=Sqt/Sq; Csigma[1]=-99999.9; Ctrunc[1]=-99999.9;
02729     
02730     for(int itr=0; itr<2; ++itr)
02731       {
02732         Swtt[0]=0.; Swt[0]=0.; Sw[0]=0.; npts[0]=0;
02733         Swtt[1]=0.; Swt[1]=0.; Sw[1]=0.; npts[1]=0;
02734         
02735         for(int i=0; i<490; ++i)
02736           {
02737             // For positive strip ends
02738             if(Qp[i]>0. && CTp[i]>MinCT) {
02739               q=Qp[i]; 
02740               
02741               t=CTp[i]-dS[i]+CTIntercept[0];
02742               if(Ctrunc[0]<0. || fabs(t)<Ctrunc[0]) {Swtt[0]+=q*t*t; Swt[0]+=q*t; Sw[0]+=q; ++npts[0];}
02743               
02744               t=CTp[i]+dS[i]+CTIntercept[1];
02745               if(Ctrunc[1]<0. || fabs(t)<Ctrunc[1]) {Swtt[1]+=q*t*t; Swt[1]+=q*t; Sw[1]+=q; ++npts[1];}
02746             }
02747             
02748             // For negative strip ends
02749             if(Qm[i]>0. && CTm[i]>MinCT) {
02750               q=Qm[i]; 
02751               
02752               t=CTm[i]-dS[i]+CTIntercept[0];
02753               if(Ctrunc[0]<0. || fabs(t)<Ctrunc[0]) {Swtt[0]+=q*t*t; Swt[0]+=q*t; Sw[0]+=q; ++npts[0];}
02754               
02755               t=CTm[i]+dS[i]+CTIntercept[1];
02756               if(Ctrunc[1]<0. || fabs(t)<Ctrunc[1]) {Swtt[1]+=q*t*t; Swt[1]+=q*t; Sw[1]+=q; ++npts[1];}
02757             }
02758           }
02759         
02760         // Results for fit with gradient +C
02761         if(npts[0]>1 && Sw[0]!=0.) {
02762           CTIntercept[0]=CTIntercept[0]-Swt[0]/Sw[0]; Csigma[0]=0.; 
02763           if((Swtt[0]/Sw[0])-(Swt[0]/Sw[0])*(Swt[0]/Sw[0])>0.) {Csigma[0]=pow((Swtt[0]/Sw[0])-(Swt[0]/Sw[0])*(Swt[0]/Sw[0]),0.5);}
02764           ChiSqPositive=Csigma[0]; ChiSqNdfPos=npts[0]-1; 
02765           Ctrunc[0]=Csigma[0]+3.;
02766         }
02767         
02768         // Results for fit with gradient -C
02769         if(npts[1]>1 && Sw[1]!=0.) {
02770           CTIntercept[1]=CTIntercept[1]-Swt[1]/Sw[1]; Csigma[1]=0.;
02771           if((Swtt[1]/Sw[1])-(Swt[1]/Sw[1])*(Swt[1]/Sw[1])>0.) {Csigma[1]=pow((Swtt[1]/Sw[1])-(Swt[1]/Sw[1])*(Swt[1]/Sw[1]),0.5);}
02772           ChiSqNegative=Csigma[1]; ChiSqNdfNeg=npts[1]-1; 
02773           Ctrunc[1]=Csigma[1]+3.;
02774         }
02775         
02776       }
02777   }
02778   // Set these properties
02779   cth.SetTimeForwardFitRMS(ChiSqPositive);
02780   cth.SetTimeForwardFitNDOF(ChiSqNdfPos);
02781   cth.SetTimeBackwardFitRMS(ChiSqNegative);
02782   cth.SetTimeBackwardFitNDOF(ChiSqNdfNeg);
02784    
02785 }

void AlgFitTrackCam::Trace const char *  c  )  const [virtual]
 

Reimplemented from AlgBase.

Definition at line 3659 of file AlgFitTrackCam.cxx.

03660 {
03661 }

void AlgFitTrackCam::UpdateCovMatrix  ) 
 

Definition at line 2137 of file AlgFitTrackCam.cxx.

References C_k, C_k_intermediate, H_k, Identity, K_k, and MSG.

Referenced by GoBackwards(), GoForwards(), ShowerSwim(), and SpectrometerSwim().

02138 {
02139   // C_k = (Identity - (K_k * H_k) ) * C_k_intermediate
02140   MSG("AlgFitTrackCam",Msg::kDebug) << "UpdateCovMatrix" << endl;
02141 
02142   for (int i=0; i<5; ++i) {
02143     for (int j=0; j<5; ++j) {  
02144       C_k[i][j]=0;
02145       for (int m=0; m<5; ++m) {   
02146         C_k[i][j]+=(Identity[i][m] - K_k[i]*H_k[m]) * C_k_intermediate[m][j];
02147       }
02148     }
02149   }
02150 
02151 
02152   // Diagonal elements should be positive
02153   double covlim = 1.e-8;
02154 
02155   for(int i=0; i<5; ++i) {
02156     if(C_k[i][i]<covlim) {
02157       MSG("AlgFitTrackCam",Msg::kVerbose) << "Negative diagonal element in C_k" << endl;
02158       C_k[i][i]=covlim;
02159     }
02160   }
02161 
02162 
02163   // Display
02164   if(debug) {
02165     cout << "Filtered Covariance matrix" << endl;
02166     for(int i=0; i<5; ++i) {
02167       for(int j=0; j<5; ++j) {
02168         cout << C_k[i][j] << " ";
02169       }
02170       cout << endl;  
02171     }
02172   }
02173 
02174 }

void AlgFitTrackCam::UpdateStateVector const int  Plane,
const int  NewPlane,
const bool  GoForward
 

Definition at line 2006 of file AlgFitTrackCam.cxx.

References CheckValues(), K_k, MSG, PassTrack, SlcStripData, Swim(), TotalNSwimFail, TrkStripData, x_k, x_k_minus, and ZIncreasesWithTime.

Referenced by GoBackwards(), GoForwards(), ShowerSwim(), and SpectrometerSwim().

02007 {  
02008   // x_k = (F_k_minus * x_k_minus) + K_k(m_k - (H_k * F_k_minus * x_k_minus) )
02009   MSG("AlgFitTrackCam",Msg::kDebug) << "UpdateStateVector" << endl;
02010 
02011 
02012   double HFx=0;
02013   double m_k=0;
02014   double MeasurementFactor=0;
02015   int nswimfail=0;
02016 
02017 
02018   // Calculate F_k_minus * x_k_minus, using the Swimmer
02019   // Also get an accurate measure of dS and Range from the Swimmer
02021   double StateVector[5];
02022   double Prediction[5];
02023   bool GetPrediction=false;
02024 
02025   for(int i=0; i<5; ++i) {StateVector[i]=x_k_minus[i];}
02026 
02027   // Prediction could be used without GeoSwimmer calculation. Prediction is initialized with linear extrapolation.
02028   for(int i=0; i<5; i++) {
02029     double delz = (SlcStripData[NewPlane][0].csh->GetZPos()-SlcStripData[Plane][0].csh->GetZPos());
02030     Prediction[0]=StateVector[0] + StateVector[2]*delz;
02031     Prediction[1]=StateVector[1] + StateVector[3]*delz;
02032     Prediction[2]=StateVector[2];
02033     Prediction[3]=StateVector[3];
02034     Prediction[4]=StateVector[4];
02035   }
02036 
02037   // Do the swim
02039   while(GetPrediction==false && nswimfail<=10) {
02040     MSG("AlgFitTrackCam",Msg::kVerbose) << " state " << StateVector[0] << " " 
02041                                         << StateVector[1] << " " << StateVector[2] << " " 
02042                                         << StateVector[3] << " " << StateVector[4] << endl;   
02043     
02044     GetPrediction=Swim(StateVector, Prediction, Plane, NewPlane, GoForward);
02045     
02046     MSG("AlgFitTrackCam",Msg::kVerbose) << " predict state " << Prediction[0] << " " 
02047                                         << Prediction[1] << " " << Prediction[2] << " " 
02048                                         << Prediction[3] << " " << Prediction[4] << endl;
02049 
02050     if(GetPrediction==false) {
02051       StateVector[4]*=0.5; 
02052       nswimfail++; TotalNSwimFail++;
02053       MSG("AlgFitTrackCam",Msg::kVerbose) << "UpdateStateVector, Prediction failed - Double momentum and swim again" << endl;
02054     }
02055   }
02056 
02057   if(nswimfail>10) {  // Swim shouldn't fail, as it succeeded to get the propagator
02058     MSG("AlgFitTrackCam",Msg::kDebug) << "UpdateStateVector, nswimfail>10, fail track" << endl;
02059     PassTrack=false;
02060   }
02062 
02063   
02065 
02066 
02067   MSG("AlgFitTrackCam",Msg::kDebug) << "UpdateStateVector, Check predicted state " << endl;
02068   CheckValues(Prediction, NewPlane);
02069 
02070 
02071   // Calculate H_k * F_k_minus * x_k_minus
02073   if(TrkStripData[NewPlane][0].PlaneView==2) {HFx=Prediction[0];}
02074   if(TrkStripData[NewPlane][0].PlaneView==3) {HFx=Prediction[1];}
02075 
02076   MSG("AlgFitTrackCam",Msg::kVerbose) << "HFx " << HFx << endl;
02078 
02079   
02080   // Read in measurement
02082   m_k=TrkStripData[NewPlane][0].TPos;
02083   MSG("AlgFitTrackCam",Msg::kVerbose) << "m_k " << TrkStripData[NewPlane][0].TPos << endl;
02084   
02085   MeasurementFactor=(m_k-HFx);
02087 
02088   
02089   // Calculate x_k
02091   for (int i=0; i<5; ++i) {
02092     x_k[i]=0.;
02093     x_k[i]+=Prediction[i]+(K_k[i]*MeasurementFactor);
02094   }
02096 
02097 
02098   MSG("AlgFitTrackCam",Msg::kDebug) << "UpdateStateVector, Check filtered state " << endl;
02099   CheckValues(x_k, NewPlane);
02100 
02101 
02102   // Care with multiple range corrections - do not want to flip sign
02103   // (multiple corrections mean sign changes can occur even though absolute value stays same)
02105   // JAM up to 40 from 4
02106 
02107   double Maxqp = 4.;
02108   if(fabs(x_k_minus[4])==Maxqp && 
02109      ( (GoForward==true && ZIncreasesWithTime==true) 
02110        || (GoForward==false && ZIncreasesWithTime==false) ) ) 
02111     {
02112       if(!LastIteration) x_k[4] = (x_k_minus[4]>0 ? Maxqp : -Maxqp);
02113       //      cout << " resetting in UpdateStateVector " <<  endl;
02114     }
02116 
02117   //if on last plane in forward swim, disregard sign flip
02118   if(x_k_minus[4]!=0){
02119     if ( x_k[4]/x_k_minus[4]<0 && 
02120         ( (GoForward==true && ZIncreasesWithTime==true && NewPlane >= EndofRangePlane ) 
02121           || (GoForward==false && ZIncreasesWithTime==false && NewPlane <= EndofRangePlane ) )) 
02122       {
02123         x_k[4] = -x_k[4];
02124       }
02125   }
02126   
02127   // Display
02128   MSG("AlgFitTrackCam",Msg::kVerbose) << "Filtered State vector: "
02129                                       << x_k[0] << " " << x_k[1] << " " << x_k[2] << " "
02130                                       << x_k[3] << " " << x_k[4] << endl;
02131 }


Member Data Documentation

Double_t AlgFitTrackCam::bave [private]
 

Definition at line 108 of file AlgFitTrackCam.h.

Referenced by RunAlg(), SetTrackProperties(), and Swim().

double AlgFitTrackCam::C_k[5][5] [private]
 

Definition at line 116 of file AlgFitTrackCam.h.

Referenced by GoBackwards(), GoForwards(), MoveArrays(), RunAlg(), SpectrometerSwim(), and UpdateCovMatrix().

double AlgFitTrackCam::C_k_intermediate[5][5] [private]
 

Definition at line 118 of file AlgFitTrackCam.h.

Referenced by CalcKalmanGain(), ExtrapCovMatrix(), RunAlg(), and UpdateCovMatrix().

double AlgFitTrackCam::C_k_minus[5][5] [private]
 

Definition at line 117 of file AlgFitTrackCam.h.

Referenced by ExtrapCovMatrix(), GetInitialCovarianceMatrix(), MoveArrays(), and RunAlg().

bool AlgFitTrackCam::debug [private]
 

Definition at line 140 of file AlgFitTrackCam.h.

Referenced by RunAlg().

double AlgFitTrackCam::DeltaPlane [private]
 

Definition at line 135 of file AlgFitTrackCam.h.

Referenced by GetCombiPropagator(), GetNoiseMatrix(), ResetCovarianceMatrix(), and RunAlg().

double AlgFitTrackCam::DeltaZ [private]
 

Definition at line 134 of file AlgFitTrackCam.h.

Referenced by GetCombiPropagator(), GetNoiseMatrix(), ResetCovarianceMatrix(), and RunAlg().

double AlgFitTrackCam::EndCov[5] [private]
 

Definition at line 129 of file AlgFitTrackCam.h.

Referenced by GoBackwards(), GoForwards(), RunAlg(), and SetTrackProperties().

Bool_t AlgFitTrackCam::EndofRange [private]
 

Definition at line 109 of file AlgFitTrackCam.h.

Referenced by CheckValues(), GoBackwards(), and GoForwards().

Int_t AlgFitTrackCam::EndofRangePlane [private]
 

Definition at line 110 of file AlgFitTrackCam.h.

Referenced by GoBackwards(), and GoForwards().

double AlgFitTrackCam::F_k[5][5] [private]
 

Definition at line 119 of file AlgFitTrackCam.h.

Referenced by RunAlg().

double AlgFitTrackCam::F_k_minus[5][5] [private]
 

Definition at line 120 of file AlgFitTrackCam.h.

Referenced by ExtrapCovMatrix(), GetCombiPropagator(), and RunAlg().

vector<FiltDataStruct> AlgFitTrackCam::FilteredData[490] [private]
 

Definition at line 105 of file AlgFitTrackCam.h.

Referenced by FillGapsInTrack(), FindTheStrips(), RunAlg(), RunTheFitter(), SetRangeAnddS(), SetTrackProperties(), ShowerStrips(), SpectrometerSwim(), and StoreFilteredData().

PlaneOutline AlgFitTrackCam::fPL [private]
 

Definition at line 155 of file AlgFitTrackCam.h.

Referenced by NDPlaneIsActive(), and SetRangeAnddS().

int AlgFitTrackCam::H_k[5] [private]
 

Definition at line 125 of file AlgFitTrackCam.h.

Referenced by CalcKalmanGain(), GoBackwards(), GoForwards(), RunAlg(), ShowerSwim(), SpectrometerSwim(), and UpdateCovMatrix().

int AlgFitTrackCam::Identity[5][5] [private]
 

Definition at line 126 of file AlgFitTrackCam.h.

Referenced by RunAlg(), and UpdateCovMatrix().

vector<StripStruct> AlgFitTrackCam::InitTrkStripData[490] [private]
 

Definition at line 101 of file AlgFitTrackCam.h.

Referenced by FindTheStrips(), GetFitData(), InitialFramework(), RunAlg(), ShowerSwim(), SpectrometerSwim(), and TimingFit().

double AlgFitTrackCam::K_k[5] [private]
 

Definition at line 123 of file AlgFitTrackCam.h.

Referenced by CalcKalmanGain(), RunAlg(), UpdateCovMatrix(), and UpdateStateVector().

Bool_t AlgFitTrackCam::LastIteration [private]
 

Definition at line 111 of file AlgFitTrackCam.h.

Referenced by GoBackwards(), GoForwards(), and RunTheFitter().

int AlgFitTrackCam::MaxPlane [private]
 

Definition at line 131 of file AlgFitTrackCam.h.

Referenced by FillGapsInTrack(), FindTheStrips(), InitialFramework(), RemoveTrkHitsInShw(), RunAlg(), RunTheFitter(), SetTrackProperties(), ShowerSwim(), SpectrometerSwim(), and TimingFit().

double AlgFitTrackCam::MeanTrackTime [private]
 

Definition at line 154 of file AlgFitTrackCam.h.

Referenced by InitialFramework(), and SpectrometerSwim().

int AlgFitTrackCam::MinPlane [private]
 

Definition at line 132 of file AlgFitTrackCam.h.

Referenced by FillGapsInTrack(), FindTheStrips(), InitialFramework(), RemoveTrkHitsInShw(), RunAlg(), RunTheFitter(), SetTrackProperties(), ShowerStrips(), ShowerSwim(), and TimingFit().

Int_t AlgFitTrackCam::nbfield [private]
 

Definition at line 107 of file AlgFitTrackCam.h.

Referenced by RunAlg(), SetTrackProperties(), and Swim().

int AlgFitTrackCam::NIter [private]
 

Definition at line 150 of file AlgFitTrackCam.h.

Referenced by GoBackwards(), GoForwards(), RunAlg(), RunTheFitter(), and SetTrackProperties().

int AlgFitTrackCam::NumFinderStrips [private]
 

Definition at line 153 of file AlgFitTrackCam.h.

Referenced by GenerateNDSpectStrips(), InitialFramework(), and RunAlg().

bool AlgFitTrackCam::PassTrack [private]
 

Definition at line 143 of file AlgFitTrackCam.h.

Referenced by CheckValues(), GoBackwards(), GoForwards(), RunAlg(), RunTheFitter(), SpectrometerSwim(), and UpdateStateVector().

double AlgFitTrackCam::Q_k[5][5] [private]
 

Definition at line 121 of file AlgFitTrackCam.h.

Referenced by RunAlg().

double AlgFitTrackCam::Q_k_minus[5][5] [private]
 

Definition at line 122 of file AlgFitTrackCam.h.

Referenced by ExtrapCovMatrix(), GetNoiseMatrix(), and RunAlg().

bool AlgFitTrackCam::SaveData [private]
 

Definition at line 145 of file AlgFitTrackCam.h.

Referenced by RunAlg(), and RunTheFitter().

int AlgFitTrackCam::ShowerEntryPlane [private]
 

Definition at line 148 of file AlgFitTrackCam.h.

Referenced by RunAlg(), SetTrackProperties(), and ShowerStrips().

vector<StripStruct> AlgFitTrackCam::SlcStripData[490] [private]
 

Definition at line 100 of file AlgFitTrackCam.h.

Referenced by CleanNDLists(), FillGapsInTrack(), FindTheStrips(), GenerateNDSpectStrips(), GetFitData(), InitialFramework(), RunAlg(), SetRangeAnddS(), SetTrackProperties(), ShowerStrips(), ShowerSwim(), SpectrometerSwim(), Swim(), and UpdateStateVector().

double AlgFitTrackCam::StripListTime [private]
 

Definition at line 157 of file AlgFitTrackCam.h.

Referenced by TimingFit().

bool AlgFitTrackCam::SwimThroughShower [private]
 

Definition at line 146 of file AlgFitTrackCam.h.

Referenced by RemoveTrkHitsInShw(), RunAlg(), RunTheFitter(), ShowerStrips(), and ShowerSwim().

int AlgFitTrackCam::TotalNSwimFail [private]
 

Definition at line 151 of file AlgFitTrackCam.h.

Referenced by GetCombiPropagator(), RunAlg(), SetTrackProperties(), and UpdateStateVector().

const CandTrackHandle* AlgFitTrackCam::track [private]
 

Definition at line 138 of file AlgFitTrackCam.h.

Referenced by CheckValues(), GetFitData(), InitialFramework(), NDStripBegTime(), RunAlg(), RunTheFitter(), and SetPropertiesFromFinderTrack().

vector<TrkDataStruct> AlgFitTrackCam::TrkStripData[490] [private]
 

Definition at line 103 of file AlgFitTrackCam.h.

Referenced by CalcKalmanGain(), GetCombiPropagator(), GetFitData(), GetNoiseMatrix(), GoBackwards(), GoForwards(), RemoveTrkHitsInShw(), RunAlg(), RunTheFitter(), SetTrackProperties(), and UpdateStateVector().

int AlgFitTrackCam::UseGeoSwimmer [private]
 

Definition at line 113 of file AlgFitTrackCam.h.

Referenced by RunAlg().

VldContext* AlgFitTrackCam::vldc [private]
 

Definition at line 137 of file AlgFitTrackCam.h.

Referenced by GetNoiseMatrix(), InitialFramework(), NDStripBegTime(), RunAlg(), RunTheFitter(), SetPropertiesFromFinderTrack(), SetRangeAnddS(), SetTrackProperties(), Swim(), and TimingFit().

double AlgFitTrackCam::VtxCov[5] [private]
 

Definition at line 128 of file AlgFitTrackCam.h.

Referenced by GoBackwards(), GoForwards(), RunAlg(), and SetTrackProperties().

double AlgFitTrackCam::x_k[5] [private]
 

Definition at line 114 of file AlgFitTrackCam.h.

Referenced by GoBackwards(), GoForwards(), MoveArrays(), RunAlg(), RunTheFitter(), SetTrackProperties(), ShowerSwim(), StoreFilteredData(), and UpdateStateVector().

double AlgFitTrackCam::x_k4_biased [private]
 

Definition at line 112 of file AlgFitTrackCam.h.

Referenced by RunAlg(), RunTheFitter(), and SetTrackProperties().

double AlgFitTrackCam::x_k_minus[5] [private]
 

Definition at line 115 of file AlgFitTrackCam.h.

Referenced by GetCombiPropagator(), GetNoiseMatrix(), MoveArrays(), RunAlg(), ShowerSwim(), SpectrometerSwim(), and UpdateStateVector().

bool AlgFitTrackCam::ZIncreasesWithTime [private]
 

Definition at line 142 of file AlgFitTrackCam.h.

Referenced by FillGapsInTrack(), FindTheStrips(), GetInitialCovarianceMatrix(), GoBackwards(), GoForwards(), RemoveTrkHitsInShw(), RunAlg(), RunTheFitter(), SetPropertiesFromFinderTrack(), SetRangeAnddS(), SetTrackProperties(), ShowerStrips(), ShowerSwim(), Swim(), TimingFit(), and UpdateStateVector().


The documentation for this class was generated from the following files:
Generated on Mon Jun 16 15:00:09 2008 for loon by  doxygen 1.3.9.1