Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

ActiveDistance.cxx

Go to the documentation of this file.
00001 // $Id: ActiveDistance.cxx,v 1.6 2000/12/11 16:38:44 burnett Exp $
00002 // 
00003 //  Original author: Sawyer Gillespie
00004 //                   hgillesp@u.washington.edu
00005 //
00006 
00007 #include "reconstruction/ActiveDistance.h"    // include class declaration
00008 
00009 #include "reconstruction/GlastFit.h"
00010 #include "reconstruction/GlastRecon.h"
00011 #include "reconstruction/LbldData.h"
00012 #include "reconstruction/TrackerRecon.h"
00013 
00014 // implementation of the ActiveDistance class
00015 
00016 ActiveDistance::ActiveDistance (GlastRecon* r)
00017 : ReconAnalysis (r)
00018 {
00019 }
00020 
00021 ActiveDistance::~ActiveDistance ()
00022 {
00023 }
00024 
00025 void    ActiveDistance::setUpData ()
00026 {
00027     i_activeDist = data()->addElement("Active_Dist");
00028 }
00029 
00030 void    ActiveDistance::compute ()
00031 {
00032     // get the TrackerRecon object which has reconstructed the
00033     // data within the silicon tracker
00034     TrackerRecon*   tr = recon()->getTracker();
00035     
00036     // declare local variables
00037 
00038     // get the gamma-ray fit from TrackerRecon
00039     GFgamma*    gamma = tr->gammaFit ();
00040 
00041     // get the vertex of the gamma conversion & direction of gamma
00042     Vector  t0 = gamma->direction();
00043     Point   x0 = gamma->vertex();
00044 
00045     // native code - this code has been brought in from TrackerRecon
00046     // -------------------------------------------------------------
00047     float activeDist = -20.;
00048     Point firstHit = gamma->getFirstHit();
00049     Ray prjRay(firstHit, -t0);
00050     Point x_prj;
00051     
00052 #if 0 // need to figure out how to  do this
00053     GlastMed *glast = GlastMed::instance();
00054     
00055     int istLayer = gamma->firstLayer();
00056     
00057     float firstProp = 0.;
00058     if (istLayer > 0) { //go to next gap up + espsilon
00059         firstProp = SiTracker::traySpacing()/fabs(t0.z());
00060         x_prj = prjRay.position(firstProp);
00061     }
00062     else {
00063         x_prj = firstHit;
00064         firstProp = 0.;
00065     }
00066     
00067     const Medium *med0 = glast->inside(x_prj);
00068     prjRay = Ray(x_prj, -t0);
00069     const Medium *detMed = 0;
00070     if(med0){
00071         firstProp = med0->distanceToLeave(prjRay, detMed, 100.);
00072         activeDist = -2. - firstProp;
00073     }
00074     
00075     Detector *det =  0;
00076     if(detMed) {
00077         med0 = detMed;
00078         x_prj = prjRay.position(firstProp);
00079         prjRay = Ray(x_prj, -t0);
00080         firstProp = med0->distanceToLeave(prjRay, detMed, 100.);
00081         activeDist = -4. - firstProp;
00082         if(detMed) det = detMed->detector();
00083         if(det) {
00084             if(!strcmp(det->nameOf(), "SiDetector")) {
00085                 x_prj = prjRay.position(firstProp);
00086                 activeDist = static_cast<const SiDetectorMed*>(det)->data().insideActiveArea(x_prj);
00087             }
00088         }
00089     }
00090     //-----------------------------------------------------------
00091     // end native code
00092   #endif    
00093   
00094     // set the state of this object to reflect the results of the
00095     // computation
00096     ReconAnalysis::result (new Result(activeDist));
00097 
00098     // add the data to the list of archival data elements.
00099     tr->data.addData(i_activeDist, activeDist);
00100 }
00101 

Generated at Wed Nov 21 12:20:43 2001 by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000