ShowerTrace Class Reference

#include <ShowerTrace.h>

List of all members.

Public Member Functions

 ShowerTrace ()
 ShowerTrace (const AtmosShower *shower)
void Zero ()
void Fill (const AtmosShower *)
double MaxTrace () const
double MinTrace () const
double MaxTraceZ () const
double MinTraceZ () const

Public Attributes

double TraceVtx [3]
double Trace
double TraceZ
int Side
double ReTraceVtx [3]
double ReTrace
double ReTraceZ
int ReSide
double UpTraceVtx [3]
double UpTrace
double UpTraceZ
int UpSide

Detailed Description

Definition at line 6 of file ShowerTrace.h.


Constructor & Destructor Documentation

ShowerTrace::ShowerTrace (  )  [inline]

Definition at line 8 of file ShowerTrace.h.

References Zero().

00008 {Zero();}

ShowerTrace::ShowerTrace ( const AtmosShower shower  )  [inline]

Definition at line 9 of file ShowerTrace.h.

References Fill(), and Zero().

00009 {Zero(); Fill(shower);}


Member Function Documentation

void ShowerTrace::Fill ( const AtmosShower shower  ) 

Definition at line 42 of file ShowerTrace.cxx.

References C45, MuELoss::e, HalfSideL, Msg::kError, MSG, ReSide, ReTrace, ReTraceVtx, ReTraceZ, SM1EdgesZ, SM2EdgesZ, Trace, TraceVtx, TraceZ, UpSide, UpTrace, UpTraceVtx, UpTraceZ, AtmosShower::VtxDirCosU, AtmosShower::VtxDirCosV, AtmosShower::VtxDirCosX, AtmosShower::VtxDirCosY, AtmosShower::VtxDirCosZ, AtmosShower::VtxPlane, AtmosShower::VtxU, AtmosShower::VtxV, AtmosShower::VtxX, AtmosShower::VtxY, and AtmosShower::VtxZ.

Referenced by ShowerTrace().

00042                                                 {
00043   if(!shower) return;
00044 
00045   const double ShwVtxX = shower->VtxX;
00046   const double ShwVtxY = shower->VtxY;
00047   const double ShwVtxZ = shower->VtxZ;
00048   const double ShwVtxU = shower->VtxU;
00049   const double ShwVtxV = shower->VtxV;
00050   const double ShwVtxL[4] = {ShwVtxV,ShwVtxY,ShwVtxU,ShwVtxX};
00051   const int ShwVtxSM = 1 + (shower->VtxPlane/249);
00052 
00053   //For uncontained vertex, set TraceVtx to ShwVtx and return;
00054   if (fabs(ShwVtxU) > 4.0 ||
00055       fabs(ShwVtxV) > 4.0 ||
00056       fabs(ShwVtxX) > 4.0 ||
00057       fabs(ShwVtxY) > 4.0) {
00058     double ShwVtx[3] = {ShwVtxX, ShwVtxY, ShwVtxZ};
00059     for (int i=0;i<3;i++) {
00060       TraceVtx[i] = ShwVtx[i];
00061       ReTraceVtx[i] = ShwVtx[i];
00062       UpTraceVtx[i] = ShwVtx[i];
00063     }
00064     Trace = 0.; TraceZ = 0.;
00065     ReTrace = 0.; ReTraceZ = 0.;
00066     UpTrace = 0.; UpTraceZ = 0.;
00067     
00068     return;
00069   }
00070 
00071   const double ShwCosX = shower->VtxDirCosX;
00072   const double ShwCosY = shower->VtxDirCosY;
00073   const double ShwCosZ = shower->VtxDirCosZ;
00074   const double ShwCosU = shower->VtxDirCosU;
00075   const double ShwCosV = shower->VtxDirCosV;
00076   const double ShwCosL[4] = {ShwCosV,ShwCosY,ShwCosU,ShwCosX};
00077 
00078   double ZProj(0.), OProj(0.), Wall(0.);
00079 
00080   //Find the forward projection
00081   int i = 0;
00082   //loop over each octagonal edge pair (0=V, 1=Y, 2=U, 3=X)
00083   for (i=0; i<4; i++) {
00084     if(fabs(ShwCosL[i]) < 1.e-6) continue;//DirCos can't be small
00085     Wall = ShwCosL[i] > 0.0 ? 4.0 : -4.0;//Pointing up or down
00086     int j = i<2 ? i+2 : i-2;//Find the orthogonal coordinate index
00087 
00088     //OProj is the coordinate in the orthogonal 'j' coordinate where the
00089     //vertex points back to in the 'i' coordinate, if it sits outside of
00090     //the halflength of an octagonal side, move along
00091     OProj = ShwVtxL[j] + (ShwCosL[j]/ShwCosL[i])*(Wall-ShwVtxL[i]);
00092     if(fabs(OProj) > HalfSideL) continue;
00093 
00094     //Calculated the ZProj for the case that gets to this point
00095     ZProj = ShwVtxZ + (ShwCosZ/ShwCosL[i])*(Wall-ShwVtxL[i]);
00096     break;
00097   }
00098 
00099   //Firt examine the cases where the projection would land on the edge
00100   //of one of the super modules
00101   if ((i>3) || (ZProj<SM1EdgesZ[0]) || (ZProj>SM2EdgesZ[1]) ||
00102       (ZProj>SM1EdgesZ[1] && ShwVtxZ < SM1EdgesZ[1]) ||
00103       (ZProj<SM2EdgesZ[0] && ShwVtxZ > SM2EdgesZ[0])) {
00104     //Low Z edge of SM1
00105     if(ShwCosZ<0.0 && ShwVtxSM==1) {
00106       TraceVtx[2] = SM1EdgesZ[0];
00107       Side = 8;
00108     }
00109     //High Z edge of SM1
00110     else if(ShwCosZ>0.0 && ShwVtxSM==1) {
00111       TraceVtx[2] = SM1EdgesZ[1];
00112       Side = 9;
00113     }
00114     //Low Z edge of SM2
00115     else if(ShwCosZ<0.0 && ShwVtxSM==2) {
00116       TraceVtx[2] = SM2EdgesZ[0];
00117       Side = 10;
00118     }
00119     //High Z edge of SM2
00120     else if(ShwCosZ>0.0 && ShwVtxSM==2) {
00121       TraceVtx[2] = SM2EdgesZ[1];
00122       Side = 11;
00123     }
00124     //WTF edge of WTF, should crash and make a core dump
00125     else {
00126       MSG("ShowerTrace", Msg::kError) << "WTF, puking on shoes" << endl;
00127       assert(false);
00128     }
00129     TraceVtx[0] = ShwVtxX + (ShwCosX/ShwCosZ)*(TraceVtx[2]-ShwVtxZ);
00130     TraceVtx[1] = ShwVtxY + (ShwCosY/ShwCosZ)*(TraceVtx[2]-ShwVtxZ);
00131   }
00132   else {
00133     TraceVtx[2] = ZProj;
00134     Side = ShwCosL[i] > 0.0 ? i : i+4;
00135     switch(i) {
00136      //TraceVertex on V edge
00137      case 0:
00138       TraceVtx[0] = C45 * (OProj - Wall);
00139       TraceVtx[1] = C45 * (OProj + Wall);
00140       break;
00141      //TraceVertex on Y edge
00142      case 1:
00143       TraceVtx[1] = Wall;
00144       TraceVtx[0] = OProj;
00145       break;
00146      //TraceVertex on U edge
00147      case 2:
00148       TraceVtx[0] = C45 * (Wall - OProj);
00149       TraceVtx[1] = C45 * (Wall + OProj);
00150       break;
00151      //TraceVertex on X edge
00152      case 3:
00153       TraceVtx[1] = OProj;
00154       TraceVtx[0] = Wall;
00155       break;
00156      //TraceVertex on WTF edge, should crash and make a core dump
00157      default:
00158       MSG("ShowerTrace", Msg::kError) << "WTF, puking on shoes" << endl;
00159       assert(false);
00160       break;
00161     }
00162   }
00163   Trace = sqrt(
00164     (TraceVtx[0]-ShwVtxX)*(TraceVtx[0]-ShwVtxX) +
00165     (TraceVtx[1]-ShwVtxY)*(TraceVtx[1]-ShwVtxY) +
00166     (TraceVtx[2]-ShwVtxZ)*(TraceVtx[2]-ShwVtxZ));
00167   TraceZ = fabs(TraceVtx[2] - ShwVtxZ);
00168 
00169   //Find the reverse projection
00170   //loop over each octagonal edge pair (0=V, 1=Y, 2=U, 3=X)
00171   for (i=0; i<4; i++) {
00172     if(fabs(ShwCosL[i]) < 1.e-6) continue;//DirCos can't be small
00173     Wall = ShwCosL[i] > 0.0 ? -4.0 : 4.0;//Pointing up or down, pick opposite side
00174     int j = i<2 ? i+2 : i-2;
00175     //No need to negate the below angles since it would cancel in the
00176     //2-D projection, snap.
00177     OProj = ShwVtxL[j] + (ShwCosL[j]/ShwCosL[i])*(Wall-ShwVtxL[i]);
00178     if(fabs(OProj) > HalfSideL) continue;
00179     ZProj = ShwVtxZ + (ShwCosZ/ShwCosL[i])*(Wall-ShwVtxL[i]);
00180     break;
00181   }
00182 
00183   if ((i>3) || (ZProj<SM1EdgesZ[0]) || (ZProj>SM2EdgesZ[1]) ||
00184       (ZProj>SM1EdgesZ[1] && ShwVtxZ < SM1EdgesZ[1]) ||
00185       (ZProj<SM2EdgesZ[0] && ShwVtxZ > SM2EdgesZ[0])) {
00186     //Low Z edge of SM1
00187     if(ShwCosZ>0.0 && ShwVtxSM==1) {
00188       ReTraceVtx[2] = SM1EdgesZ[0];
00189       ReSide = 8;
00190     }
00191     //High Z edge of SM1
00192     else if(ShwCosZ<0.0 && ShwVtxSM==1) {
00193       ReTraceVtx[2] = SM1EdgesZ[1];
00194       ReSide = 9;
00195     }
00196     //Low Z edge of SM2
00197     else if(ShwCosZ>0.0 && ShwVtxSM==2) {
00198       ReTraceVtx[2] = SM2EdgesZ[0];
00199       ReSide = 10;
00200     }
00201     //High Z edge of SM2
00202     else if(ShwCosZ<0.0 && ShwVtxSM==2) {
00203       ReTraceVtx[2] = SM2EdgesZ[1];
00204       ReSide = 11;
00205     }
00206     //WTF edge of WTF, should crash and make a core dump
00207     else {
00208       MSG("ShowerTrace", Msg::kError) << "WTF, puking on shoes" << endl;
00209       assert(false);
00210     }
00211     ReTraceVtx[0] = ShwVtxX + (ShwCosX/ShwCosZ)*(TraceVtx[2]-ShwVtxZ);
00212     ReTraceVtx[1] = ShwVtxY + (ShwCosY/ShwCosZ)*(TraceVtx[2]-ShwVtxZ);
00213   }
00214   else {
00215     ReTraceVtx[2] = ZProj;
00216     ReSide = ShwCosL[i] < 0.0 ? i : i+4;
00217     switch(i) {
00218      //TraceVertex on V edge
00219      case 0:
00220       ReTraceVtx[0] = C45 * (OProj - Wall);
00221       ReTraceVtx[1] = C45 * (OProj + Wall);
00222       break;
00223      //TraceVertex on Y edge
00224      case 1:
00225       ReTraceVtx[1] = Wall;
00226       ReTraceVtx[0] = OProj;
00227       break;
00228      //TraceVertex on X edge
00229      case 2:
00230       ReTraceVtx[0] = C45 * (Wall - OProj);
00231       ReTraceVtx[1] = C45 * (Wall + OProj);
00232       break;
00233      //TraceVertex on U edge
00234      case 3:
00235       ReTraceVtx[1] = OProj;
00236       ReTraceVtx[0] = Wall;
00237       break;
00238      //TraceVertex on WTF edge, should crash and make a core dump
00239      default:
00240       MSG("ShowerTrace", Msg::kError) << "WTF, puking on shoes" << endl;
00241       assert(false);
00242       break;
00243     }
00244   }
00245   ReTrace = sqrt(
00246     (ReTraceVtx[0]-ShwVtxX)*(ReTraceVtx[0]-ShwVtxX) +
00247     (ReTraceVtx[1]-ShwVtxY)*(ReTraceVtx[1]-ShwVtxY) +
00248     (ReTraceVtx[2]-ShwVtxZ)*(ReTraceVtx[2]-ShwVtxZ));
00249   ReTraceZ = fabs(ReTraceVtx[2] - ShwVtxZ);
00250 
00251   //Find the up projection by the which ever trace vertex has a higher Y
00252   //coordinate
00253   if (TraceVtx[1] >= ReTraceVtx[1]) {
00254     for(int j=0; j<3; j++) UpTraceVtx[j] = TraceVtx[j];
00255     UpTrace = Trace;
00256     UpTraceZ = TraceZ;
00257     UpSide = Side;
00258   }
00259   else {
00260     for(int j=0; j<3; j++) UpTraceVtx[j] = ReTraceVtx[j];
00261     UpTrace = ReTrace;
00262     UpTraceZ = ReTraceZ;
00263     UpSide = ReSide;
00264   }
00265 }

double ShowerTrace::MaxTrace (  )  const [inline]

Definition at line 21 of file ShowerTrace.h.

References ReTrace, and Trace.

00021 {return Trace>ReTrace?Trace:ReTrace;}

double ShowerTrace::MaxTraceZ (  )  const [inline]

Definition at line 23 of file ShowerTrace.h.

References ReTraceZ, and TraceZ.

00023 {return TraceZ>ReTraceZ?TraceZ:ReTraceZ;}

double ShowerTrace::MinTrace (  )  const [inline]

Definition at line 22 of file ShowerTrace.h.

References ReTrace, and Trace.

00022 {return Trace<ReTrace?Trace:ReTrace;}

double ShowerTrace::MinTraceZ (  )  const [inline]

Definition at line 24 of file ShowerTrace.h.

References ReTraceZ, and TraceZ.

00024 {return TraceZ<ReTraceZ?TraceZ:ReTraceZ;}

void ShowerTrace::Zero (  ) 

Definition at line 24 of file ShowerTrace.cxx.

References MaxPossibleTrace, MaxPossibleTraceZ, ReSide, ReTrace, ReTraceVtx, ReTraceZ, Trace, TraceVtx, TraceZ, UpSide, UpTrace, UpTraceVtx, and UpTraceZ.

Referenced by ShowerTrace().

00024                        {
00025   Side = -1;
00026   for(int i=0;i<3;i++) TraceVtx[i] = 0.;
00027  
00028   Trace = MaxPossibleTrace;
00029   TraceZ = MaxPossibleTraceZ;
00030 
00031   ReSide = -1;
00032   for(int i=0;i<3;i++) ReTraceVtx[i] = 0.;
00033   ReTrace = MaxPossibleTrace;
00034   ReTraceZ = MaxPossibleTraceZ;
00035 
00036   UpSide = -1;
00037   for(int i=0;i<3;i++) UpTraceVtx[i] = 0.;
00038   UpTrace = MaxPossibleTrace;
00039   UpTraceZ = MaxPossibleTraceZ;
00040 }


Member Data Documentation

Definition at line 19 of file ShowerTrace.h.

Referenced by Fill(), and Zero().

Definition at line 17 of file ShowerTrace.h.

Referenced by Fill(), MaxTrace(), MinTrace(), AtmosCalculator::ShowerProperties(), and Zero().

Definition at line 16 of file ShowerTrace.h.

Referenced by Fill(), and Zero().

Definition at line 18 of file ShowerTrace.h.

Referenced by Fill(), MaxTraceZ(), MinTraceZ(), AtmosCalculator::ShowerProperties(), and Zero().

Definition at line 15 of file ShowerTrace.h.

Definition at line 13 of file ShowerTrace.h.

Referenced by Fill(), MaxTrace(), MinTrace(), AtmosCalculator::ShowerProperties(), and Zero().

Definition at line 12 of file ShowerTrace.h.

Referenced by Fill(), and Zero().

Definition at line 14 of file ShowerTrace.h.

Referenced by Fill(), MaxTraceZ(), MinTraceZ(), AtmosCalculator::ShowerProperties(), and Zero().

Definition at line 29 of file ShowerTrace.h.

Referenced by Fill(), and Zero().

Definition at line 27 of file ShowerTrace.h.

Referenced by Fill(), AtmosCalculator::ShowerProperties(), and Zero().

Definition at line 26 of file ShowerTrace.h.

Referenced by Fill(), and Zero().

Definition at line 28 of file ShowerTrace.h.

Referenced by Fill(), AtmosCalculator::ShowerProperties(), and Zero().


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1