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

CalDetTOFId.cxx

Go to the documentation of this file.
00001 
00002 //$Id: CalDetTOFId.cxx,v 1.5 2006/05/22 20:59:49 rhatcher Exp $
00003 //
00004 //CalDetTOFId.cxx
00005 //
00006 //CalDetTOFId is a class to id particles in the CalDet using time of
00007 //flight information 
00008 //
00009 //Author:  B. Rebel 7/2001
00011 
00012 #include "CalDetPIDSR/CalDetTOFId.h"
00013 #include "MessageService/MsgService.h"
00014 #include "TMath.h"
00015 #include "Conventions/Munits.h"
00016 
00017 ClassImp(CalDetTOFId)
00018 
00019 //______________________________________________________________________
00020 CVSID("$Id: CalDetTOFId.cxx,v 1.5 2006/05/22 20:59:49 rhatcher Exp $");
00021 
00022 //----------------------------------------------------------------------
00023 CalDetTOFId::CalDetTOFId()
00024 {
00025 }
00026 
00027 //----------------------------------------------------------------------
00028 CalDetTOFId::CalDetTOFId(Double_t paddleSeparation, Double_t tdcGain1, 
00029                          Double_t tdcGain2, 
00030                          Int_t tdcPedestal1, Int_t tdcPedestal2, 
00031                          Int_t /* firstPaddle */,  Int_t /* secondPaddle */,
00032                          RawTOFDigit rtofd) :
00033   fBeta(0.),
00034   fTOFDigit(rtofd),
00035   fTOF(0.)
00036 {
00037   //insert code that takes the raw time of flight digit and gets the 
00038   //time values here.  when the actual digit layout is known, you can
00039   //put in an if statement to pick out the right tdc values based on 
00040   //the paddle's to used given by firstPaddle and secondPaddle
00041 
00042   //i am assuming that the conversion give times in units of ns.
00043   
00044   Double_t tdc1=0;
00045   Double_t tdc2=0;
00046 
00047   // warn that we've set tdc1/tdc2 to zero (as opposed to completely unset),
00048   // firstPaddle/secondPaddle are unused and that the ctor look unfinished.
00049   MSG("CalDetTOFId",Msg::kError)
00050     << "CalDetTOFId ctor code is incomplete!" << endl;
00051 
00052   Double_t time1 = tdcGain1 * (tdc1 - (1.0*tdcPedestal1));
00053   Double_t time2 = tdcGain2 * (tdc2 - (1.0*tdcPedestal2));
00054  
00055   //find the time of flight
00056 
00057   Double_t fTOF = (time1 - time2);
00058 
00059   //calculate beta here
00060 
00061   fBeta = paddleSeparation / (fTOF * Munits::c_light);
00062 }
00063 
00064 //----------------------------------------------------------------------
00065 CalDetTOFId::~CalDetTOFId()
00066 {
00067   //destructor
00068 }
00069 
00070 //----------------------------------------------------------------------
00071 Double_t CalDetTOFId::GetParticleMassSquared(Double_t momentum) const
00072 {
00073   Double_t massSquared = -1.;
00074 
00075   //use momentum and beta to get the particle's energy
00076   Double_t energy = 0.;
00077   if(fBeta > 0.){ 
00078     energy = momentum / fBeta;
00079 
00080     //solve for mass using E = Sqrt(p*p + m*m);
00081     massSquared = (energy*energy) - (momentum*momentum);
00082   }
00083 
00084   return massSquared;
00085 
00086 }
00087 
00088 //----------------------------------------------------------------------
00089 Double_t CalDetTOFId::GetTOF() const
00090 {
00091   return fTOF;
00092 }
00093 
00094 //----------------------------------------------------------------------
00095 Double_t CalDetTOFId::GetBeta() const
00096 {
00097   return fBeta;
00098 }
00099 
00100 
00101 

Generated on Mon Feb 15 11:06:27 2010 for loon by  doxygen 1.3.9.1