ArrivalTime Class Reference

#include <ArrivalTime.h>

List of all members.

Public Member Functions

 ArrivalTime ()
virtual ~ArrivalTime ()
Double_t Uncertainty (Double_t npe) const
Double_t Weight (Double_t npe) const
Double_t PDF (Double_t npe, Double_t t) const
void SetTimeWindow (Double_t t0, Double_t t1)
void SetMinimumProbability (Double_t prob)

Private Member Functions

void Renormalize ()

Private Attributes

Double_t minprob
Double_t timewindow [2]
Double_t a0 [16]
Double_t a1 [16]
Double_t a2 [16]
Double_t a3 [16]
Double_t tab [16]
Double_t b0 [16]
Double_t b1 [16]
Int_t pe [16]

Detailed Description

Definition at line 23 of file ArrivalTime.h.


Constructor & Destructor Documentation

ArrivalTime::ArrivalTime (  ) 

Definition at line 24 of file ArrivalTime.cxx.

00025 {
00026   minprob = .01;
00027   timewindow[0] = -100.;
00028   timewindow[1] =  200.;
00029 
00030   pe[ 0] = 1;
00031   pe[ 1] = 2;
00032   pe[ 2] = 3;
00033   pe[ 3] = 4;
00034   pe[ 4] = 5;
00035   pe[ 5] = 6;
00036   pe[ 6] = 7;
00037   pe[ 7] = 8;
00038   pe[ 8] = 9;
00039   pe[ 9] = 10;
00040   pe[10] = 15;
00041   pe[11] = 20;
00042   pe[12] = 25;
00043   pe[13] = 50;
00044   pe[14] = 100;
00045   pe[15] = 250;
00046 
00047   tab[ 0] = 2.0;
00048   tab[ 1] = 1.8;
00049   tab[ 2] = 1.9;
00050   tab[ 3] = 2.0;
00051   tab[ 4] = 2.1;
00052   tab[ 5] = 2.2;
00053   tab[ 6] = 2.3;
00054   tab[ 7] = 2.4;
00055   tab[ 8] = 2.4;
00056   tab[ 9] = 2.4;
00057   tab[10] = 2.0;
00058   tab[11] = 1.8;
00059   tab[12] = 1.8;
00060   tab[13] = 1.7;
00061   tab[14] = 1.05;
00062   tab[15] = 0.55;
00063 
00064 /*
00065 
00066   a0[ 0] = 38.18;
00067   a0[ 1] = -0.52543;
00068   a0[ 2] = -10.35;
00069   a0[ 3] = -11.864;
00070   a0[ 4] = -6.9668;
00071   a0[ 5] = -19.561;
00072   a0[ 6] = -8.7371;
00073   a0[ 7] = -18.341;
00074   a0[ 8] = -10.916;
00075   a0[ 9] = -16.503;
00076   a0[10] = -5.0758;
00077   a0[11] = -3.5335;
00078   a0[12] = -8.4337;
00079   a0[13] = -10.632;
00080   a0[14] = -15.17;
00081   a0[15] = -12.953;
00082 
00083   a1[ 0] = 486.1;
00084   a1[ 1] = 646.86;
00085   a1[ 2] = 723.69;
00086   a1[ 3] = 796.31;
00087   a1[ 4] = 773.12;
00088   a1[ 5] = 838.15;
00089   a1[ 6] = 861.29;
00090   a1[ 7] = 886.74;
00091   a1[ 8] = 860.61;
00092   a1[ 9] = 822.71;
00093   a1[10] = 950.38;
00094   a1[11] = 1018.3;
00095   a1[12] = 1061.3;
00096   a1[13] = 1660.9;
00097   a1[14] = 2444.1;
00098   a1[15] = 3592.2;
00099 
00100   a2[ 0] = 0.;
00101   a2[ 1] = 0.;
00102   a2[ 2] = -94.136;
00103   a2[ 3] = -176.51;
00104   a2[ 4] = -172.8;
00105   a2[ 5] = -236.41;
00106   a2[ 6] = -262.85;
00107   a2[ 7] = -289.62;
00108   a2[ 8] = -295.83;
00109   a2[ 9] = -293.62;
00110   a2[10] = -397.63;
00111   a2[11] = -496.42;
00112   a2[12] = -766.46;
00113   a2[13] = -1889.4;
00114   a2[14] = -3903.9;
00115   a2[15] = -8204.4;
00116 
00117   a3[ 0] = 0.;
00118   a3[ 1] = 0.;
00119   a3[ 2] = 0.;
00120   a3[ 3] = 0.;
00121   a3[ 4] = 0.;
00122   a3[ 5] = 0.;
00123   a3[ 6] = 0.;
00124   a3[ 7] = 0.;
00125   a3[ 8] = 0.;
00126   a3[ 9] = 0.;
00127   a3[10] = 0.;
00128   a3[11] = 0.;
00129   a3[12] = 125.01;
00130   a3[13] = 547.77;
00131   a3[14] = 1579.8;
00132   a3[15] = 4121.3;
00133 
00134   b0[ 0] = 7.288;
00135   b0[ 1] = 7.5345;
00136   b0[ 2] = 7.6679;
00137   b0[ 3] = 7.87;
00138   b0[ 4] = 8.0165;
00139   b0[ 5] = 8.2466;
00140   b0[ 6] = 8.284;
00141   b0[ 7] = 8.5896;
00142   b0[ 8] = 8.5376;
00143   b0[ 9] = 8.7022;
00144   b0[10] = 9.6703;
00145   b0[11] = 10.092;
00146   b0[12] = 10.573;
00147   b0[13] = 15.05;
00148   b0[14] = 11.199;
00149   b0[15] = 10.245;
00150 
00151   b1[ 0] = -0.12743;
00152   b1[ 1] = -0.24693;
00153   b1[ 2] = -0.36993;
00154   b1[ 3] = -0.50634;
00155   b1[ 4] = -0.64232;
00156   b1[ 5] = -0.7944;
00157   b1[ 6] = -0.88006;
00158   b1[ 7] = -1.0483;
00159   b1[ 8] = -1.1270;
00160   b1[ 9] = -1.2819;
00161   b1[10] = -1.946;
00162   b1[11] = -2.4642;
00163   b1[12] = -3.0376;
00164   b1[13] = -6.6758;
00165   b1[14] = -6.4324;
00166   b1[15] = -8.943;
00167 
00168 */
00169 
00170 
00171 // the following have already been renormalized
00172 
00173   a0[0] = 0.00380099;
00174   a0[1] = -8.80699e-05;
00175   a0[2] = -0.00260464;
00176   a0[3] = -0.00394667;
00177   a0[4] = -0.00289652;
00178   a0[5] = -0.0097678;
00179   a0[6] = -0.00484191;
00180   a0[7] = -0.0114235;
00181   a0[8] = -0.0077634;
00182   a0[9] = -0.0136922;
00183   a0[10] = -0.00504345;
00184   a0[11] = -0.00440376;
00185   a0[12] = -0.0139975;
00186   a0[13] = -0.0240564;
00187   a0[14] = -0.0471868;
00188   a0[15] = -0.0646101;
00189   
00190   a1[0] = 0.0483934;
00191   a1[1] = 0.108423;
00192   a1[2] = 0.182121;
00193   a1[3] = 0.2649;
00194   a1[4] = 0.321433;
00195   a1[5] = 0.418531;
00196   a1[6] = 0.477308;
00197   a1[7] = 0.552298;
00198   a1[8] = 0.612061;
00199   a1[9] = 0.682585;
00200   a1[10] = 0.944322;
00201   a1[11] = 1.26909;
00202   a1[12] = 1.76145;
00203   a1[13] = 3.75802;
00204   a1[14] = 7.60245;
00205   a1[15] = 17.9181;
00206   
00207   a2[0] = 0;
00208   a2[1] = 0;
00209   a2[2] = -0.0236899;
00210   a2[3] = -0.0587177;
00211   a2[4] = -0.0718435;
00212   a2[5] = -0.118051;
00213   a2[6] = -0.145666;
00214   a2[7] = -0.180387;
00215   a2[8] = -0.210393;
00216   a2[9] = -0.24361;
00217   a2[10] = -0.395095;
00218   a2[11] = -0.618682;
00219   a2[12] = -1.2721;
00220   a2[13] = -4.27503;
00221   a2[14] = -12.1432;
00222   a2[15] = -40.9239;
00223   
00224   a3[0] = 0;
00225   a3[1] = 0;
00226   a3[2] = 0;
00227   a3[3] = 0;
00228   a3[4] = 0;
00229   a3[5] = 0;
00230   a3[6] = 0;
00231   a3[7] = 0;
00232   a3[8] = 0;
00233   a3[9] = 0;
00234   a3[10] = 0;
00235   a3[11] = 0;
00236   a3[12] = 0.207481;
00237   a3[13] = 1.23941;
00238   a3[14] = 4.91402;
00239   a3[15] = 20.5572;
00240   
00241   b0[0] = -1.92681;
00242   b0[1] = -1.15934;
00243   b0[2] = -0.619546;
00244   b0[3] = -0.138392;
00245   b0[4] = 0.2311;
00246   b0[5] = 0.644398;
00247   b0[6] = 0.785976;
00248   b0[7] = 1.20838;
00249   b0[8] = 1.28904;
00250   b0[9] = 1.60773;
00251   b0[10] = 2.75615;
00252   b0[11] = 3.40441;
00253   b0[12] = 4.17189;
00254   b0[13] = 8.95878;
00255   b0[14] = 5.42604;
00256   b0[15] = 4.94429;
00257 
00258   b1[ 0] = -0.12743;
00259   b1[ 1] = -0.24693;
00260   b1[ 2] = -0.36993;
00261   b1[ 3] = -0.50634;
00262   b1[ 4] = -0.64232;
00263   b1[ 5] = -0.7944;
00264   b1[ 6] = -0.88006;
00265   b1[ 7] = -1.0483;
00266   b1[ 8] = -1.1270;
00267   b1[ 9] = -1.2819;
00268   b1[10] = -1.946;
00269   b1[11] = -2.4642;
00270   b1[12] = -3.0376;
00271   b1[13] = -6.6758;
00272   b1[14] = -6.4324;
00273   b1[15] = -8.943;
00274 
00275 
00276 //  Renormalize();
00277 
00278 }

virtual ArrivalTime::~ArrivalTime (  )  [inline, virtual]

Definition at line 29 of file ArrivalTime.h.

00029 { }


Member Function Documentation

Double_t ArrivalTime::PDF ( Double_t  npe,
Double_t  t 
) const

Definition at line 347 of file ArrivalTime.cxx.

References a0, a1, a2, a3, b0, b1, minprob, Munits::ns, pe, tab, and timewindow.

00348 {
00349 // input time is in seconds, convert into ns
00350   t /= Munits::ns;
00351   if (npe<=0. || t<timewindow[0] || t>timewindow[1]) {
00352     return 0.;
00353   }
00354   Double_t minpdf = minprob/(timewindow[1]-timewindow[0]);
00355   if (t<0.) {
00356     return minpdf;
00357   }
00358   Double_t p0[2] = { 0, 0 };
00359   Double_t pe0[2] = {-1.,1.};
00360   for (int i=0; i<16; i++) {
00361     if (npe>=pe[i]) {
00362       if (t<tab[i]) {
00363         p0[1] = a0[i]+a1[i]*t+a2[i]*t*t+a3[i]*t*t*t;
00364       }
00365       else {
00366         p0[1] = exp(b0[i]+b1[i]*t);
00367       }
00368       if (p0[1]<minpdf) p0[1] = minpdf;
00369       pe0[1] = (Double_t)(pe[i]);
00370     }
00371   }
00372   for (int i=15; i>=0; i--) {
00373     if (npe<=pe[i]) {
00374       if (t<tab[i]) {
00375         p0[0] = a0[i]+a1[i]*t+a2[i]*t*t+a3[i]*t*t*t;
00376       }
00377       else {
00378         p0[0] = exp(b0[i]+b1[i]*t);
00379       }
00380       if (p0[0]<minpdf) p0[0] = minpdf;
00381       pe0[0] = (Double_t)(pe[i]);
00382     }
00383   }
00384   if (pe0[0]==pe0[1]) {
00385     return (p0[0]+minpdf);
00386   }
00387   if (pe0[0]<0.) {
00388     return (p0[1]+minpdf);
00389   }
00390   if (pe0[1]<0.) {
00391     return (p0[0]+minpdf);
00392   }
00393   return (minpdf+ p0[0] + (p0[1]-p0[0])/(pe0[1]-pe0[0])*(npe-pe0[0]));
00394 }

void ArrivalTime::Renormalize (  )  [private]

Definition at line 334 of file ArrivalTime.cxx.

References a0, a1, a2, a3, b0, b1, minprob, and tab.

Referenced by SetMinimumProbability(), and SetTimeWindow().

00335 {
00336   for (int i=0; i<16; i++) {
00337     Double_t integral = a0[i]*tab[i]+a1[i]*tab[i]*tab[i]/2.+a2[i]*tab[i]*tab[i]*tab[i]/3.+a3[i]*tab[i]*tab[i]*tab[i]*tab[i]/4.-exp(b0[i]+b1[i]*tab[i])/b1[i];
00338     a0[i] *= (1.-minprob)/integral;
00339     a1[i] *= (1.-minprob)/integral;
00340     a2[i] *= (1.-minprob)/integral;
00341     a3[i] *= (1.-minprob)/integral;
00342     b0[i] += log((1.-minprob)/integral);
00343   }
00344 
00345 }

void ArrivalTime::SetMinimumProbability ( Double_t  prob  ) 

Definition at line 328 of file ArrivalTime.cxx.

References minprob, and Renormalize().

00329 {
00330   minprob = prob;
00331   Renormalize();
00332 }

void ArrivalTime::SetTimeWindow ( Double_t  t0,
Double_t  t1 
)

Definition at line 315 of file ArrivalTime.cxx.

References Renormalize(), and timewindow.

00316 {
00317   if (t0<t1) {
00318     timewindow[0] = t0;
00319     timewindow[1] = t1;
00320   }
00321   else {
00322     timewindow[0] = t1;
00323     timewindow[1] = t0;
00324   }
00325   Renormalize();
00326 }

Double_t ArrivalTime::Uncertainty ( Double_t  npe  )  const

Definition at line 286 of file ArrivalTime.cxx.

References Msg::kWarning, and MSG.

Referenced by Weight().

00287 {
00288   Double_t sigma = 0.; // sigma is uncertainty in arrival of first p.e.
00289 
00290 // a simple monte carlo was done to calculate the uncertainty in the
00291 // arrival time of the first p.e. as a function of # of p.e.
00292 //
00293 // the only assumption made was about the shape of the pulse, a 2 ns risetime
00294 // and an 8 ns decay time of the fluor
00295 //
00296 // rlee feb 2002
00297 //
00298 
00299   if (npe<10.) {
00300     if (npe>0.) sigma = 0.90+8.0/npe;
00301     else {
00302       sigma = 1.0e+5;
00303       MSG("ArrivalTime", Msg::kWarning)
00304         << "Uncertainty was passed npe = " << npe
00305         << ", use sigma = " << sigma << endl;
00306     }
00307   }
00308   else {
00309     sigma = 5.0*exp(-0.5*log(npe));
00310   }
00311 
00312   return sigma;
00313 }

Double_t ArrivalTime::Weight ( Double_t  npe  )  const

Definition at line 280 of file ArrivalTime.cxx.

References Uncertainty().

Referenced by AlgFitTrackSR::FindTimingDirection(), AlgTrackSRList::FindTimingDirection(), CandTrackSRHandle::GetTimeWeight(), AlgTrack::SetT(), and AlgShowerSR::SetT().

00281 {
00282   Double_t weight = 1./Uncertainty(npe);
00283   return weight*weight;
00284 }


Member Data Documentation

Double_t ArrivalTime::a0[16] [private]

Definition at line 45 of file ArrivalTime.h.

Referenced by PDF(), and Renormalize().

Double_t ArrivalTime::a1[16] [private]

Definition at line 46 of file ArrivalTime.h.

Referenced by PDF(), and Renormalize().

Double_t ArrivalTime::a2[16] [private]

Definition at line 47 of file ArrivalTime.h.

Referenced by PDF(), and Renormalize().

Double_t ArrivalTime::a3[16] [private]

Definition at line 48 of file ArrivalTime.h.

Referenced by PDF(), and Renormalize().

Double_t ArrivalTime::b0[16] [private]

Definition at line 50 of file ArrivalTime.h.

Referenced by PDF(), and Renormalize().

Double_t ArrivalTime::b1[16] [private]

Definition at line 51 of file ArrivalTime.h.

Referenced by PDF(), and Renormalize().

Double_t ArrivalTime::minprob [private]

Definition at line 42 of file ArrivalTime.h.

Referenced by PDF(), Renormalize(), and SetMinimumProbability().

Int_t ArrivalTime::pe[16] [private]

Definition at line 52 of file ArrivalTime.h.

Referenced by PDF().

Double_t ArrivalTime::tab[16] [private]

Definition at line 49 of file ArrivalTime.h.

Referenced by PDF(), and Renormalize().

Double_t ArrivalTime::timewindow[2] [private]

Definition at line 43 of file ArrivalTime.h.

Referenced by PDF(), and SetTimeWindow().


The documentation for this class was generated from the following files:

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1