/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Calibration/CalibSvc/CalibROOTCnv/CalibROOTCnv-00-01-13/src/test/UseDedx.cxx

Go to the documentation of this file.
00001 //$Header: /bes/bes/BossCvs/Calibration/CalibSvc/CalibROOTCnv/src/test/UseDedx.cxx,v 1.7 2010/03/05 02:17:54 huangb Exp $
00002 /*#include <stdio.h>
00003 #include "GaudiKernel/Algorithm.h"
00004 #include "GaudiKernel/AlgFactory.h"
00005 #include "GaudiKernel/IDataProviderSvc.h"
00006 #include "GaudiKernel/Service.h"
00007 #include "GaudiKernel/MsgStream.h"
00008 #include "GaudiKernel/SmartDataPtr.h"
00009 #include "CalibData/Dedx/DedxCalibData.h"
00010 #include "CalibData/CalibModel.h"
00011 #include "GaudiKernel/DataSvc.h"
00012 #include "CalibDataSvc/ICalibRootSvc.h"
00013 using namespace std;
00015 class UseDedx : public Algorithm {
00016 
00017 public:
00018   UseDedx(const std::string& name, ISvcLocator* pSvcLocator); 
00019 
00020   StatusCode initialize();
00021 
00022   StatusCode execute();
00023 
00024   StatusCode finalize();
00025 
00026 private:
00027   IDataProviderSvc* m_pCalibDataSvc;
00028   ICalibRootSvc*    m_pRootSvc;
00029   // Maybe something to say which kind of data to look up?
00030 
00031 };
00032 
00034 //static const AlgFactory<UseDedx> Factory;
00035 //const IAlgFactory& UseCalibFactory = Factory;
00036 //const IAlgFactory& UseDedxFactory = Factory;
00037 */
00038 #include "UseDedx.h"
00039 UseDedx::UseDedx( const std::string&  name, 
00040                     ISvcLocator*        pSvcLocator )
00041   : Algorithm     ( name, pSvcLocator ), m_pCalibDataSvc(0)
00042 {
00043   // Declare properties here.
00044 
00045 }
00046 
00047 
00048 StatusCode UseDedx::initialize() {
00049   StatusCode sc;
00050   MsgStream log(msgSvc(), name());
00051   log << MSG::INFO << "Initialize()" << endreq;
00052 
00053   // So far don't have any properties, but in case we do some day..
00054 //  setProperties();
00055 
00056    log<<MSG::INFO << "setProperties()" << endreq;
00057   
00058    sc = service("CalibDataSvc", m_pCalibDataSvc, true);
00059 
00060   if ( !sc.isSuccess() ) {
00061     log << MSG::ERROR 
00062         << "Could not get IDataProviderSvc interface of CalibXmlCnvSvc" 
00063         << endreq;
00064     return sc;
00065   } else {
00066     log << MSG::DEBUG 
00067         << "Retrieved IDataProviderSvc interface of CalibXmlCnvSvc" 
00068         << endreq;
00069   }
00070 
00071 sc = service("CalibRootCnvSvc", m_pRootSvc, true);
00072   if ( !sc.isSuccess() ) {
00073     log << MSG::ERROR 
00074         << "Could not get ICalibRootSvc interface of CalibRootCnvSvc" 
00075         << endreq;
00076     return sc;
00077   }
00078 
00079   // Get properties from the JobOptionsSvc
00080   
00081  sc = setProperties();
00082 
00083  return StatusCode::SUCCESS;
00084 
00085 }
00086 
00087 
00088 StatusCode UseDedx::execute( ) {
00089    
00090   MsgStream log(msgSvc(), name());
00091 
00092 
00093   std::string fullPath = "/Calib/DedxCal";
00094 
00095    log << MSG::INFO<<"execute() fullPath = "<<fullPath<< endreq;
00096    
00097     SmartDataPtr<CalibData::DedxCalibData> test(m_pCalibDataSvc, fullPath);
00098     int i;
00099     int j;
00100    double ddg;
00101    double ggs;
00102    double wireg;
00103    double gain;
00104    double zdep;
00105    double resol;
00106    double layerg;
00107    double m_id_doca;
00108    double m_iner_chi;
00109    double m_iner_gain;
00110    double m_iner_hits;
00111    double m_ip_eangle;
00112    double m_out_chi;
00113    double m_out_gain;
00114    double m_out_hits;
00115 
00116     for(i=0;i<4;i++){
00117       for(j=0;j<43;j++){
00118         ddg = test->getddg(i,j);
00119         ggs = test->getggs(i,j);
00120         zdep = test->getzdep(i,j);
00121 //      std::cout<<"ddg["<<i<<"]["<<j<<"]="<<ddg;
00122 //        std::cout<<"         ggs["<<i<<"]["<<j<<"]="<<ggs;
00123 //        std::cout<<"        zdep["<<i<<"]["<<j<<"]="<<zdep;
00124 //      std::cout<<"\n";
00125       }
00126     }
00127     
00128      for(int i=0;i<1600;i++){
00129       m_id_doca = test->get_id_doca(i);
00130       m_iner_chi= test->get_iner_chi(i);
00131       m_iner_gain= test->get_iner_gain(i);
00132       m_iner_hits= test->get_iner_hits(i);
00133       m_ip_eangle= test->get_ip_eangle(i);
00134       m_out_chi= test->get_out_chi(i);
00135       m_out_gain= test->get_out_gain(i);
00136       m_out_hits= test->get_out_hits(i);
00137      std::cout<<"m_id_doca:  "<<m_id_doca<<" m_iner_chi: "<<m_iner_chi<<" m_iner_gain: "<<m_iner_gain<<" m_iner_hits:"<<m_iner_hits<<" m_ip_eangle:"<<m_ip_eangle<<"  m_out_chi="<<m_out_chi<<" m_out_gain:"<<m_out_gain<<" m_out_hits="<<m_out_hits<<std::endl;
00138       }
00139     gain = test->getgain();
00140 //    std::cout<<"gain="<<gain<<"\n";
00141      double m_costheta;
00142     for(int i=0;i<80;i++){
00143      m_costheta = test->get_costheta(i);
00144       std::cout<<" m_costheta="<<m_costheta;
00145       if(i%5==0) std::cout<<"\n"<<std::endl;
00146     }
00147     double t0,dedx;
00148     for(int i=0;i<35;i++){
00149      t0=test->get_t0(i);
00150      dedx=test->get_dedx(i);
00151      std::cout<<"t0  ="<<t0<<"  dedx="<<dedx;
00152      if(i%5==0) std::cout<<"\n"<<std::endl;
00153     }
00154 
00155     resol = test->getresol();
00156   //  std::cout<<"resol="<<resol<<"\n";
00157 
00158     for(i=0;i<43;i++)
00159      { layerg = test -> getlayerg(i);
00160   //   std::cout<<"layerg["<<i<<"]="<<layerg;
00161      }
00162 
00163     for(i=0;i<60;i++)
00164      { wireg = test -> getwireg(i);
00165     // std::cout<<"wireg["<<i<<"]="<<wireg<<"\n";
00166      }
00167     
00168     for(i=0;i<20;i++){
00169     std::cout<<"hadron "<<i<<" = "<<test->get_hadron(i);
00170      }   
00171 
00172      //for pah is error
00173      //m_pRootSvc->writeToRoot("/home/huangb/2.root", fullPath);
00174    return StatusCode::SUCCESS;
00175 }
00176 
00177 StatusCode UseDedx::finalize( ) {
00178 
00179   MsgStream log(msgSvc(), name());
00180   log << MSG::INFO 
00181       << "        UseDedx FINALIZE!! "
00182       << endreq;
00183   
00184   return StatusCode::SUCCESS;
00185 }
00186 
00187 

Generated on Tue Nov 29 22:57:51 2016 for BOSS_7.0.2 by  doxygen 1.4.7