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

SwimObj3 Class Reference

#include <SwimObj3.h>

List of all members.

Public Member Functions

 SwimObj3 (Double_t u, Double_t v, Double_t z, Double_t dudz, Double_t dvdz, Double_t qp, Int_t izfor, const VldContext *vldc)
 ~SwimObj3 ()
Int_t SwimTo (Double_t zfin, Bool_t docheck=0)
Double_t GetTheta ()
Double_t GetPath ()
Double_t GetRange ()

Public Attributes

Double_t fu
Double_t fv
Double_t fz
Double_t fdudz
Double_t fdvdz
Double_t fqp
Int_t fizfor

Private Member Functions

Int_t SwimToIron (Double_t, Bool_t docheck)
Int_t SwimToVacuum (Double_t)
Bool_t DoCheck ()

Private Attributes

Double_t fTfe
Double_t fTair
Double_t fTsc
Double_t fStartu
Double_t fStartv
Double_t fStartz
Double_t fPmag
UgliGeomHandlefugh
VldContextfvldc
TObjArray fInterface


Constructor & Destructor Documentation

SwimObj3::SwimObj3 Double_t  u,
Double_t  v,
Double_t  z,
Double_t  dudz,
Double_t  dvdz,
Double_t  qp,
Int_t  izfor,
const VldContext vldc
 

Definition at line 47 of file SwimObj3.cxx.

References Detector::AsString(), fdudz, fdvdz, fizfor, fqp, fTair, fTfe, fTsc, fu, fugh, fv, fvldc, fz, VldContext::GetDetector(), and MSG.

00048 {
00049    MSG("FitTrack3",Msg::kVerbose)
00050         << "SwimObj3::SwimObj3( "
00051         << "u= "  << u << " , "
00052         << "v= "  << v << " , "
00053         << "z= "  << z << " , "
00054         << "dudz= "  << dudz << " , "
00055         << "dvdz= "  << dvdz << " , "
00056         << "qp= "  << qp << " , "
00057         << "izfor= "  << izfor << endl;
00058       
00059       
00060 
00061 
00062   fu = u;
00063   fv = v;
00064   fz = z;
00065   fdudz = dudz;
00066   fdvdz = dvdz;
00067   fqp = qp;
00068   fizfor = izfor;
00069   
00070   fTfe=0;
00071   fTair=0;
00072   fTsc=0;
00073 
00074   fvldc = const_cast<VldContext*>(vldc);
00075   fugh = new UgliGeomHandle(*fvldc);
00076 
00077   Int_t iplnmax = 0;
00078   Int_t iplngap0 = 9999;
00079   Int_t iplngap1 = -1;
00080   switch(fvldc->GetDetector()) {
00081   case Detector::kFar:
00082     iplnmax = 482;
00083     iplngap0 = 240;
00084     iplngap1 = 243;
00085     break;
00086   case Detector::kNear:
00087     iplnmax = 281;
00088     break;
00089   case Detector::kCalib:
00090     iplnmax = 60;
00091     break;
00092   default:
00093      MSG("FitTrack3",Msg::kError)
00094         << "BFieldSR does not support the "
00095         << Detector::AsString(vldc->GetDetector())
00096         << " detector " << endl;
00097      assert(0);
00098 
00099   }
00100 
00101 }

SwimObj3::~SwimObj3  ) 
 

Definition at line 103 of file SwimObj3.cxx.

References fugh.

00104 {
00105   assert(fugh);
00106   delete fugh;
00107 }


Member Function Documentation

Bool_t SwimObj3::DoCheck  )  [private]
 

Double_t SwimObj3::GetPath  ) 
 

Definition at line 109 of file SwimObj3.cxx.

References fStartu, fStartv, fStartz, fTair, fTfe, fTsc, fu, fv, fz, and MSG.

Referenced by AlgFitTrack3::SwimAndFillMaps().

00109                            {
00110    MSG("FitTrack3",Msg::kVerbose)
00111         << "tfe= "  << fTfe << " , "
00112         << "tair= "  << fTair << " , "
00113         << "tsc= "  << fTsc << endl;
00114    MSG("FitTrack3",Msg::kVerbose)
00115       << "fu "  << fu << " startU " << fStartu << endl
00116       << "fv "  << fv << " startV " << fStartv << endl
00117       << "fz "  << fz << " startZ " << fStartz << endl;
00118    
00119     Double_t dtot=fTfe+fTair+fTsc;
00120     if(dtot==0) return 0; //Maybe do something cleverer
00121 
00122     double path = TMath::Sqrt(TMath::Power((fu-fStartu),2)+
00123                               TMath::Power((fv-fStartv),2)+
00124                               TMath::Power((fz-fStartz),2));
00125    return path;
00126 
00127 }

Double_t SwimObj3::GetRange  ) 
 

Definition at line 130 of file SwimObj3.cxx.

References fStartu, fStartv, fStartz, fTair, fTfe, fTsc, fu, fv, fz, MSG, rhofe, and rhosc.

Referenced by AlgFitTrack3::SwimAndFillMaps().

00130                             {
00131    MSG("FitTrack3",Msg::kVerbose)
00132         << "tfe= "  << fTfe << " , "
00133         << "tair= "  << fTair << " , "
00134         << "tsc= "  << fTsc << endl;
00135    MSG("FitTrack3",Msg::kVerbose)
00136       << "fu "  << fu << " startU " << fStartu << endl
00137       << "fv "  << fv << " startV " << fStartv << endl
00138       << "fz "  << fz << " startZ " << fStartz << endl;
00139    
00140     Double_t dtot=fTfe+fTair+fTsc;
00141     if(dtot==0) return 0; //Maybe do something cleverer
00142 
00143     double path = TMath::Sqrt(TMath::Power((fu-fStartu),2)+
00144                               TMath::Power((fv-fStartv),2)+
00145                               TMath::Power((fz-fStartz),2));
00146 
00147     Double_t tfe=fTfe;
00148     //Double_t tair=fTair;
00149     Double_t tsc=fTsc;
00150     Double_t ffe = tfe/dtot;
00151     //Double_t fair = tair/dtot;
00152     Double_t fsc = tsc/dtot;
00153     Double_t dsc = fsc*path;
00154     //    Double_t dair = fair*path;
00155     Double_t dfe = ffe*path;
00156 
00157     Double_t range=0;
00158     range+=(dsc*rhosc)/10.0; //Converting from kg/m^2 -> g/cm^2
00159     range+=(dfe*rhofe)/10.0;
00160 
00161     MSG("FitTrack3",Msg::kVerbose)
00162        << "Returning Range: " << range << endl;
00163     return range;
00164 
00165 }

Double_t SwimObj3::GetTheta  ) 
 

Definition at line 167 of file SwimObj3.cxx.

References fPmag, fStartu, fStartv, fStartz, fTair, fTfe, fTsc, fu, fv, fz, radair, radfe, radsc, rhoair, rhofe, and rhosc.

Referenced by AlgFitTrack3::SwimAndFillMaps().

00167                             {
00168 
00169     Double_t dtot=fTfe+fTair+fTsc;
00170     if(dtot==0) return 0; //Maybe do something cleverer
00171 
00172     double path = TMath::Sqrt(TMath::Power((fu-fStartu),2)+
00173                               TMath::Power((fv-fStartv),2)+
00174                               TMath::Power((fz-fStartz),2));
00175     if(path==0) return 0;
00176     Double_t tfe=fTfe;
00177     Double_t tair=fTair;
00178     Double_t tsc=fTsc;
00179 
00180     
00181     Double_t ffe = tfe/dtot;
00182     Double_t fair = tair/dtot;
00183     Double_t fsc = tsc/dtot;
00184     Double_t dsc = fsc*path;
00185     Double_t dair = fair*path;
00186     Double_t dfe = ffe*path;
00187 
00188     Double_t wtot = tfe*rhofe+tsc*rhosc+tair*rhoair;
00189     Double_t rfe = tfe*rhofe/wtot;
00190     Double_t rsc = tsc*rhosc/wtot;
00191     Double_t rair = tair*rhoair/wtot;
00192 
00193     Double_t beta = fPmag/TMath::Sqrt(fPmag*fPmag+(0.105*0.105));
00194     Double_t rhoav = ffe*rhofe+fsc*rhosc+fair*rhoair;
00195     Double_t radlen = 1.0/(rfe/radfe+rsc/radsc+rair/radair)/rhoav;
00196 
00197     Double_t theta = (0.0136/(fPmag*beta))*TMath::Sqrt((dfe+dsc+dair)/radlen)*
00198         (1.0+0.038*TMath::Log((dfe+dsc+dair)/radlen));
00199 
00200     return theta;
00201 }

Int_t SwimObj3::SwimTo Double_t  zfin,
Bool_t  docheck = 0
 

Definition at line 203 of file SwimObj3.cxx.

References done(), fdudz, fdvdz, fizfor, fPmag, fqp, fStartu, fStartv, fStartz, fTair, fTfe, fTsc, fu, fv, fvldc, fz, SwimParticle::GetDirection(), SwimGeo::GetInterfaces(), SwimPlaneInterface::GetMaterialAfter(), SwimPlaneInterface::GetMaterialBefore(), SwimParticle::GetMomentum(), SwimParticle::GetMomentumModulus(), SwimParticle::GetPosition(), SwimPlaneInterface::GetZ(), SwimGeo::Instance(), MSG, s(), SwimParticle::SetCharge(), and SwimGeo::SwimMaterial_t.

Referenced by AlgFitTrack3::SwimAndFillMaps().

00204 {
00205    if(docheck) {
00206    }
00207    
00208    MSG("FitTrack3",Msg::kVerbose)
00209       << "SwimTo(Double_t " << zfin << ") From " << fz << endl;
00210    if (fz==zfin) return 0;
00211    fTfe=0;
00212    fTair=0;
00213    fTsc=0;
00214    fStartu=fu;
00215    fStartv=fv;
00216    fStartz=fz;
00217    fPmag=fqp;
00218    Double_t charge=1;
00219    if(fPmag<0) {
00220       fPmag*=-1.0;
00221       charge=-1;
00222    }
00223    
00224    SwimSwimmer s(*fvldc);
00225    TVector3 position(fu,fv,fz);
00226    
00227    Double_t bottom=sqrt(1.0 + fdudz*fdudz+fdvdz*fdvdz);
00228    Double_t pu=fPmag*fizfor*fdudz/bottom;
00229    Double_t pv=fPmag*fizfor*fdvdz/bottom;
00230    Double_t pz=fPmag*fizfor/bottom;
00231    
00232    TVector3 momentum(pu,pv,pz);
00233    
00234    SwimParticle muon(position,momentum);
00235    muon.SetCharge(charge);
00236    SwimZCondition zc(zfin);
00237    
00238    
00239    bool done;
00240    done = s.SwimForward(muon,zc);
00241 
00242    Double_t newfu=muon.GetPosition().X();
00243    Double_t newfv=muon.GetPosition().Y();
00244    Double_t newfz=muon.GetPosition().Z();
00245    Double_t newpu=muon.GetMomentum().X();
00246    Double_t newpv=muon.GetMomentum().Y();
00247    Double_t newpz=muon.GetMomentum().Z();
00248    Double_t newpmag=muon.GetMomentumModulus();
00249    Double_t newdz=muon.GetDirection().Z();
00250    Double_t newdudz;
00251    Double_t newdvdz;
00252    if(newdz!=0) {
00253       newdudz=muon.GetDirection().X()/newdz;
00254       newdvdz=muon.GetDirection().Y()/newdz;
00255    }
00256    MSG("FitTrack3",Msg::kVerbose)
00257       << "newfu "  << newfu << " startU " << fStartu << endl
00258       << "newfv "  << newfv << " startV " << fStartv << endl
00259       << "newfz "  << newfz << " startZ " << fStartz << endl
00260       << "newpu "  << newpu << " startpu " << pu << endl
00261       << "newpv "  << newpv << " startpv " << pv << endl
00262       << "newpz "  << newpz << " startpz " << pz << endl
00263       << "newdudz " << newdudz << endl
00264       << "newdvdz " << newdvdz << endl
00265       << "newpmag " << newpmag << endl;
00266    
00267 
00268    fu=newfu;
00269    fv=newfv;
00270    fz=newfz;
00271    fdudz=newdudz;
00272    fdvdz=newdvdz;
00273    fqp=charge*newpmag;
00274    
00275 
00276 
00277 
00278    //Now look at what we just swam through
00279    Double_t oldfz=fStartz;
00280    Int_t idir = 1;
00281    if (zfin<oldfz) {
00282       idir = -1;
00283    }
00284 
00285    SwimGeo* sgeo = SwimGeo::Instance(*fvldc);
00286    
00287    Int_t found=0;
00288    SwimGeo::SwimMaterial_t begmat = SwimGeo::kAir;
00289    SwimGeo::SwimMaterial_t endmat = SwimGeo::kAir;
00290    Int_t ibeg=0;
00291    Int_t iend=0;
00292    const TObjArray& interfaces = sgeo->GetInterfaces();
00293    
00294    if (idir>0) {
00295       for (Int_t i=0; i <= interfaces.GetLast() && found<2; i++) {
00296          SwimPlaneInterface *spi = 
00297             dynamic_cast<SwimPlaneInterface*>(interfaces.At(i));
00298          if (!found && oldfz<spi->GetZ()) {
00299             begmat = spi->GetMaterialBefore();
00300             found++;
00301             ibeg = i;
00302          }
00303          if (found==1 && zfin<spi->GetZ()) {
00304             endmat = spi->GetMaterialAfter();
00305             found++;
00306             iend = i+1;
00307          }
00308       }
00309    }
00310    else {
00311       for (Int_t i = interfaces.GetLast(); i>=0 && found<2; i--) {
00312          SwimPlaneInterface *spi = 
00313             dynamic_cast<SwimPlaneInterface*>(interfaces.At(i));
00314          MSG("FitTrack3",Msg::kVerbose) 
00315             << "i " << i << " spi->GetZ " << spi->GetZ() 
00316             << " oldfz " << oldfz << " zfin " << zfin << endl;
00317          if (!found && oldfz>spi->GetZ()) {
00318             begmat = spi->GetMaterialAfter();
00319             found++;
00320             ibeg = i;
00321          }
00322          if (found==1 && zfin>spi->GetZ()) {
00323             endmat = spi->GetMaterialBefore();
00324             found++;
00325             iend = i-1;
00326          }
00327       }
00328    }
00329    
00330    if (found<2) return 1;
00331    
00332    for (Int_t i=ibeg; i!=iend; i+=idir) {
00333       SwimPlaneInterface *spi = 
00334          dynamic_cast<SwimPlaneInterface*>(interfaces.At(i));
00335       Double_t zend = spi->GetZ();
00336       if (i==iend-idir) {
00337          zend = zfin;
00338       }
00339       
00340       SwimGeo::SwimMaterial_t imat = 
00341          (idir>0) ? spi->GetMaterialBefore() : spi->GetMaterialAfter();
00342       MSG("FitTrack3",Msg::kVerbose) 
00343          << "imat " << imat << " zend " << zend << " oldfz " << oldfz << endl;
00344       Int_t flag = 0;
00345       switch (imat) {
00346       case 0: // air
00347          fTair+=fabs(zend-oldfz);
00348          oldfz=zend;
00349          break;
00350       case 1: // scintillator
00351          fTsc+=fabs(zend-oldfz);
00352          oldfz=zend;
00353          break;
00354       case 2: // iron
00355          fTfe+=fabs(zend-oldfz);
00356          oldfz=zend;
00357          break;
00358       default:
00359          MSG("FitTrack3",Msg::kError) << "undefined type " << imat << "\n";
00360          break;
00361       }
00362       if (flag!=0) return flag;
00363    }
00364    
00365    
00366   return 0;
00367 }

Int_t SwimObj3::SwimToIron Double_t  ,
Bool_t  docheck
[private]
 

Int_t SwimObj3::SwimToVacuum Double_t   )  [private]
 


Member Data Documentation

Double_t SwimObj3::fdudz
 

Definition at line 26 of file SwimObj3.h.

Referenced by AlgFitTrack3::SwimAndFillMaps(), SwimObj3(), and SwimTo().

Double_t SwimObj3::fdvdz
 

Definition at line 27 of file SwimObj3.h.

Referenced by AlgFitTrack3::SwimAndFillMaps(), SwimObj3(), and SwimTo().

TObjArray SwimObj3::fInterface [private]
 

Definition at line 58 of file SwimObj3.h.

Int_t SwimObj3::fizfor
 

Definition at line 36 of file SwimObj3.h.

Referenced by SwimObj3(), and SwimTo().

Double_t SwimObj3::fPmag [private]
 

Definition at line 48 of file SwimObj3.h.

Referenced by GetTheta(), and SwimTo().

Double_t SwimObj3::fqp
 

Definition at line 28 of file SwimObj3.h.

Referenced by SwimObj3(), and SwimTo().

Double_t SwimObj3::fStartu [private]
 

Definition at line 45 of file SwimObj3.h.

Referenced by GetPath(), GetRange(), GetTheta(), and SwimTo().

Double_t SwimObj3::fStartv [private]
 

Definition at line 46 of file SwimObj3.h.

Referenced by GetPath(), GetRange(), GetTheta(), and SwimTo().

Double_t SwimObj3::fStartz [private]
 

Definition at line 47 of file SwimObj3.h.

Referenced by GetPath(), GetRange(), GetTheta(), and SwimTo().

Double_t SwimObj3::fTair [private]
 

Definition at line 42 of file SwimObj3.h.

Referenced by GetPath(), GetRange(), GetTheta(), SwimObj3(), and SwimTo().

Double_t SwimObj3::fTfe [private]
 

Definition at line 41 of file SwimObj3.h.

Referenced by GetPath(), GetRange(), GetTheta(), SwimObj3(), and SwimTo().

Double_t SwimObj3::fTsc [private]
 

Definition at line 43 of file SwimObj3.h.

Referenced by GetPath(), GetRange(), GetTheta(), SwimObj3(), and SwimTo().

Double_t SwimObj3::fu
 

Definition at line 23 of file SwimObj3.h.

Referenced by GetPath(), GetRange(), GetTheta(), AlgFitTrack3::SwimAndFillMaps(), SwimObj3(), and SwimTo().

UgliGeomHandle* SwimObj3::fugh [private]
 

Definition at line 55 of file SwimObj3.h.

Referenced by SwimObj3(), and ~SwimObj3().

Double_t SwimObj3::fv
 

Definition at line 24 of file SwimObj3.h.

Referenced by GetPath(), GetRange(), GetTheta(), AlgFitTrack3::SwimAndFillMaps(), SwimObj3(), and SwimTo().

VldContext* SwimObj3::fvldc [private]
 

Definition at line 56 of file SwimObj3.h.

Referenced by SwimObj3(), and SwimTo().

Double_t SwimObj3::fz
 

Definition at line 25 of file SwimObj3.h.

Referenced by GetPath(), GetRange(), GetTheta(), SwimObj3(), and SwimTo().


The documentation for this class was generated from the following files:
Generated on Sat Mar 14 22:46:57 2009 for loon by doxygen 1.3.5