Main Page | Namespace List | Class Hierarchy | Compound List | File List | Compound Members | File Members | Related Pages

GcrReconValsTool.cxx

Go to the documentation of this file.
00001     
00009 // Include files
00010 
00011 
00012 #include "ValBase.h"
00013 
00014 #include "GaudiKernel/MsgStream.h"
00015 #include "GaudiKernel/IDataProviderSvc.h"
00016 #include "GaudiKernel/SmartDataPtr.h"
00017 #include "GaudiKernel/ToolFactory.h"
00018 #include "GaudiKernel/IToolSvc.h"
00019 
00020 #include "Event/TopLevel/EventModel.h"
00021 #include "Event/TopLevel/Event.h"
00022 
00023 #include "Event/Recon/TkrRecon/TkrCluster.h"
00024 #include "Event/Recon/TkrRecon/TkrTrack.h"
00025 #include "Event/Recon/TkrRecon/TkrVertex.h"
00026 #include "Event/Recon/CalRecon/CalCluster.h"
00027 #include "Event/Recon/CalRecon/CalEventEnergy.h"
00028 #include "Event/Recon/CalRecon/CalParams.h"
00029 #include "Event/Recon/CalRecon/CalXtalRecData.h"
00030 //@@@FP 07/09/05
00031 #include "Event/Recon/CalRecon/CalMipClasses.h"
00032 //@@@FP 07/09/05
00033 
00034 //@@@CL 06/26/06
00035 #include "Event/Recon/CalRecon/GcrReconClasses.h"
00036 //@@@CL 06/26/06
00037 
00038 #include "geometry/Ray.h"
00039 
00040 #include "GlastSvc/Reco/IPropagatorTool.h"
00041 #include "GlastSvc/Reco/IPropagator.h" 
00042 
00043 #include "GlastSvc/GlastDetSvc/IGlastDetSvc.h"
00044 #include "TkrUtil/ITkrGeometrySvc.h"
00045 
00046 #include "idents/TowerId.h" 
00047 #include "idents/VolumeIdentifier.h"
00048 
00049 #include "CLHEP/Geometry/Transform3D.h"
00050 #include "CLHEP/Vector/Rotation.h"
00051 
00052 #include "geometry/Ray.h"
00053 
00054 #include "TMath.h"
00055 
00062 class GcrReconValsTool :   public ValBase
00063 {
00064 public:  
00065     GcrReconValsTool( const std::string& type, 
00066                     const std::string& name, 
00067                     const IInterface* parent);
00068       
00069     virtual ~GcrReconValsTool() { }
00070       
00071     StatusCode initialize();
00072       
00073     StatusCode calculate();
00074       
00075 private:
00076 
00077     static const int NTOW = 16;
00078     static const int NLAY = 8;
00079     static const int NCOL = 12;
00080 
00081     double m_gcrRecon[NTOW*NLAY*NCOL]; 
00082     float m_inferedZ;
00083     
00084 };
00085   
00086 // Static factory for instantiation of algtool objects
00087 static ToolFactory<GcrReconValsTool> s_factory;
00088 const IToolFactory& GcrReconValsToolFactory = s_factory;
00089   
00090 // Standard Constructor
00091 GcrReconValsTool::GcrReconValsTool(const std::string& type, 
00092                                const std::string& name, 
00093                                const IInterface* parent)
00094                : ValBase( type, name, parent )
00095 {    
00096     // Declare additional interface
00097     declareInterface<IValsTool>(this); 
00098 }
00099   
00100 StatusCode GcrReconValsTool::initialize()
00101 {
00102 
00103 
00104 //std::cout << "BEGIN initialize in GcrReconValsTool" << std::endl;
00105     StatusCode sc = StatusCode::SUCCESS;
00106     
00107     MsgStream log(msgSvc(), name());
00108     
00109     if( ValBase::initialize().isFailure()) return StatusCode::FAILURE;
00110 
00111 
00112     
00113     addItem("GcrRecon[1536]",     m_gcrRecon);
00114 //std::cout << "END initialize in GcrReconValsTool" << std::endl;
00115  
00116     return sc;
00117 }
00118 
00119 StatusCode GcrReconValsTool::calculate()
00120 {
00121     StatusCode sc = StatusCode::SUCCESS;
00122 
00123     // Retrieve the calMipTrack collection   
00124 
00125     MsgStream log(msgSvc(), name());
00126     //log << MSG::INFO << "BEGIN calculate in GcrReconValsTool" << endreq;
00127     
00128     //INITIALISATION OF m_gcrRecon
00129     int j;
00130    for(int itow=0; itow<NTOW;itow++) 
00131       for (int ilay=0;ilay<NLAY;ilay++)
00132         for(int icol=0;icol<NCOL;icol++)
00133         {
00134           j=(itow*NLAY+ilay)*NCOL+icol;
00135           m_gcrRecon[j]=-1000;
00136     
00137         }
00138         
00139     
00140     SmartDataPtr<Event::GcrXtalCol> p_gcrXtalCol(m_pEventSvc, EventModel::CalRecon::GcrXtalCol); 
00141     m_inferedZ=-1000;
00142     if(p_gcrXtalCol){
00143             int i=0;
00144             int itow,ilay,icol;
00145             for(Event::GcrXtalCol::const_iterator gcrXtalIter=p_gcrXtalCol->begin(); gcrXtalIter != p_gcrXtalCol->end(); gcrXtalIter++)
00146             {
00147               Event::GcrXtal* p_gcrXtal = *gcrXtalIter;
00148               
00149               //Event::CalXtalRecData* xtalData = p_gcrSelectedXtal->getXtal();
00150               idents::CalXtalId xtalId = p_gcrXtal->getXtalId();
00151               itow = xtalId.getTower();
00152               ilay = xtalId.getLayer();
00153               icol = xtalId.getColumn();
00154 
00155               i=(itow*NLAY+ilay)*NCOL+icol;
00156               //log << MSG::INFO << "GcrSelValsTool::calculate p_gcrSelectedXtal->getInferedZ()=" <<  p_gcrSelectedXtal->getInferedZ()<< endreq;
00157               
00161               m_gcrRecon[i] = p_gcrXtal->getPathLength();
00162           
00163             }
00164 
00165     }
00166     else{
00167       log << MSG::INFO << "no gcrXtalCol found " << endreq;
00168       
00169       }
00182     //log << MSG::INFO << "END calculate in GcrReconValsTool End  " << endreq;
00183     return sc;
00184 }
00185 
00186 

Generated on Wed Nov 26 14:03:21 2008 by doxygen 1.3.3