/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Calibration/CalibSvc/CalibTreeCnv/CalibTreeCnv-00-01-18/src/test/checkTof.cxx

Go to the documentation of this file.
00001 //$Header: /bes/bes/BossCvs/Calibration/CalibSvc/CalibTreeCnv/src/test/checkTof.cxx,v 1.2 2010/10/14 05:33:40 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/Tof/TofCalibData.h"
00010 #include "CalibData/Tof/bTofCalibBase.h"
00011 #include "CalibData/CalibModel.h"
00012 #include "GaudiKernel/DataSvc.h"
00013 #include "CalibDataSvc/ICalibTreeSvc.h"
00014 using namespace std;
00016 class checkTof : public Algorithm {
00017 
00018 public:
00019   checkTof(const std::string& name, ISvcLocator* pSvcLocator); 
00020 
00021   StatusCode initialize();
00022 
00023   StatusCode execute();
00024 
00025   StatusCode finalize();
00026 
00027 private:
00028   IDataProviderSvc* m_pCalibDataSvc;
00029   ICalibTreeSvc*    m_pTreeSvc;
00030   // Maybe something to say which kind of data to look up?
00031 
00032 };
00033 
00035 //static const AlgFactory<checkTof> Factory;
00036 //const IAlgFactory& UseCalibFactory = Factory;
00037 //const IAlgFactory& checkTofFactory = Factory;
00038 */
00039 #include "checkTof.h"
00040 checkTof::checkTof( const std::string&  name, 
00041                     ISvcLocator*        pSvcLocator )
00042   : Algorithm     ( name, pSvcLocator ), m_pCalibDataSvc(0)
00043 {
00044   // Declare properties here.
00045 
00046 }
00047 
00048 
00049 StatusCode checkTof::initialize() {
00050   StatusCode sc;
00051   MsgStream log(msgSvc(), name());
00052   log << MSG::INFO << "Initialize()" << endreq;
00053 
00054   // So far don't have any properties, but in case we do some day..
00055 //  setProperties();
00056 
00057    log<<MSG::INFO << "setProperties()" << endreq;
00058   
00059    sc = service("CalibDataSvc", m_pCalibDataSvc, true);
00060 
00061   if ( !sc.isSuccess() ) {
00062     log << MSG::ERROR 
00063         << "Could not get IDataProviderSvc interface of CalibXmlCnvSvc" 
00064         << endreq;
00065     return sc;
00066   } else {
00067     log << MSG::DEBUG 
00068         << "Retrieved IDataProviderSvc interface of CalibXmlCnvSvc" 
00069         << endreq;
00070   }
00071   
00072   sc = service("CalibTreeCnvSvc", m_pTreeSvc, true);
00073   if ( !sc.isSuccess() ) {
00074     log << MSG::ERROR 
00075         << "Could not get ICalibTreeSvc interface of CalibTreeCnvSvc" 
00076         << endreq;
00077     return sc;
00078   }
00079   // Get properties from the JobOptionsSvc
00080   
00081  sc = setProperties();
00082 
00083  return StatusCode::SUCCESS;
00084 
00085 }
00086 
00087 
00088 StatusCode checkTof::execute( ) {
00089    
00090   MsgStream log(msgSvc(), name());
00091 
00092   // Cheat for now since Windows is having trouble finding definition
00093   // of Calibdata::Test_t
00094   std::string fullPath = "/Calib/TofCal";
00095    log << MSG::INFO<<"execute() fullPath = "<<fullPath<< endreq;
00096 
00097     SmartDataPtr<CalibData::TofCalibData> btof(m_pCalibDataSvc, fullPath);
00098 
00099     for(int i =0;i<176;i++)
00100       {
00101         double bAtten0 = btof->getBTofAtten(i,0);
00102         double bAtten1 = btof->getBTofAtten(i,1);
00103       double bP0  = btof->getBTofPleft(i,0);
00104       double bP1  = btof->getBTofPleft(i,1);
00105       double bP2  = btof->getBTofPleft(i,2);
00106       double bP3 = btof->getBTofPleft(i,3);
00107       double bP4 = btof->getBTofPleft(i,4);
00108       double bP5 = btof->getBTofPleft(i,5);
00109       double bP10 = btof->getBTofPright(i,0);
00110 
00111 
00112       //      double bQ = btof->getBTofQ(i);
00113       double bSpeed0 = btof->getBTofSpeed(i,0);
00114       double bSpeed1 = btof->getBTofSpeed(i,1);
00115       //      double bW1 = btof->getBTofW(i,0);
00116       //      double bW2 = btof->getBTofW(i,1);
00117       //      double bW3 = btof->getBTofW(i,2);
00118       //      double bW4 = btof->getBTofW(i,3);
00119       std::cout<<"=========================================="<<"\n";
00120       std::cout<<"cnt ="<<i<<"\n";
00121       std::cout<<"Atten0="<<bAtten0<<"Atten1="<<bAtten1<<"Q="<<"bQ"<<"Speed0="<<bSpeed0<<"Speed1="<<bSpeed1<<"P0="<<bP0<<"P1="<<bP1<<"P2="<<bP2<<"P3="<<bP3<<"P4="<<bP4<<"P10="<<bP10;
00122       std::cout<<"\n";
00123       std::cout<<"P5="<<bP5<<"Q="<<"bQ";
00124       //      std::cout<<"W1="<<bW1<<"W2="<<bW2<<"W3="<<bW3<<"W4="<<bW4;
00125       std::cout<<"\n";
00126       
00127       /*
00128       std::cout<<"Atten[1]="<<*(bAtten+1)<<"P0[1]="<<*(bP0+1)<<"P1[1]="<<*(bP1+1)<<"P2[1]="<<*(bP2+1)<<"P3[1]="<<*(bP3+1)<<"P4[1]="<<*(bP4+1);
00129       std::cout<<"\n";
00130       std::cout<<"P5[1]="<<*(bP5+1)<<"S[1]="<<*(bS+1)<<"SS[1]="<<*(bSS+1)<<"Veff[1]="<<*(bVeff+1);
00131       */
00132       }   
00133    for(int i =0;i<96;i++)
00134       {
00135         double eAtten0 = btof->getETofAtten(i,0);
00136         double eAtten1 = btof->getETofAtten(i,1);
00137         double eP0  = btof->getETofP(i,0);
00138         double eP1  = btof->getETofP(i,1);
00139         double eP2  = btof->getETofP(i,2);
00140         double eP3 = btof->getETofP(i,3);
00141         double eP4 = btof->getETofP(i,4);
00142         double eP5 = btof->getETofP(i,5);
00143         double eP6 = btof->getETofP(i,6);
00144 
00145         double eSpeed0 = btof->getETofSpeed(i,0);
00146         double eSpeed1 = btof->getETofSpeed(i,1);
00147 
00148         std::cout<<"=========================================="<<"\n";
00149         std::cout<<"cnt ="<<i<<"\n";
00150         
00151         std::cout<<"Atten0="<<eAtten0<<"Atten1="<<eAtten1<<"Speed0="<<eSpeed0<<"Speed1="<<eSpeed1<<"P0="<<eP0<<"P1="<<eP1<<"P2="<<eP2<<"P3="<<eP3<<"P4="<<eP4<<"P6="<<eP6;
00152         std::cout<<"\n";
00153         std::cout<<"P5="<<eP5;
00154         std::cout<<"\n";
00155 
00156         }
00157        //maqm comment because cann't write 
00158       // m_pTreeSvc->writeToTree("./Tof_test.root", fullPath);
00159   
00160   return StatusCode::SUCCESS;
00161 }
00162 /*
00163 DataSvc::retrieveObject(fullPath,CalibData::CalibTest1);
00164 */
00165 StatusCode checkTof::finalize( ) {
00166 
00167   MsgStream log(msgSvc(), name());
00168   log << MSG::INFO 
00169       << "        checkTof FINALIZE!! "
00170       << endreq;
00171   
00172   return StatusCode::SUCCESS;
00173 }
00174 
00175 

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