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

Go to the documentation of this file.
00001 //$Header: /bes/bes/BossCvs/Calibration/CalibSvc/CalibROOTCnv/src/test/UseMuc.cxx,v 1.2 2008/04/09 01:02:04 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/Muc/MucCalibData.h"
00010 #include "CalibData/CalibModel.h"
00011 #include "GaudiKernel/DataSvc.h"
00012 #include "CalibDataSvc/ICalibRootSvc.h"
00013 #include "GaudiKernel/MsgStream.h"
00014 #include "CalibData/CalibModel.h"
00015 #include "CalibData/CalibBase1.h"
00016 #include "CalibData/Muc/MucCalibConst.h"
00017 //#include "CalibROOTCnv/MucIdTransform.h"
00018 //#include "MucCalibAlg/MucIdTransform.h"
00019 
00020 
00021 //using namespace std;
00023 class UseMuc : public Algorithm {
00024 
00025 public:
00026   UseMuc(const std::string& name, ISvcLocator* pSvcLocator); 
00027 
00028   StatusCode initialize();
00029 
00030   StatusCode execute();
00031 
00032   StatusCode finalize();
00033 
00034 private:
00035 
00036   IDataProviderSvc* m_pCalibDataSvc;
00037   ICalibRootSvc*    m_pRootSvc;
00038   // MucIdTransform*   m_pIdTr;
00039   // Maybe something to say which kind of data to look up?
00040 
00041 };
00042 
00044 //static const AlgFactory<UseMuc> Factory;
00045 //const IAlgFactory& UseCalibFactory = Factory;
00046 //const IAlgFactory& UseMucFactory = Factory;
00047 */
00048 #include "UseMuc.h"
00049 UseMuc::UseMuc( const std::string&  name, 
00050                     ISvcLocator*        pSvcLocator )
00051   : Algorithm     ( name, pSvcLocator ), m_pCalibDataSvc(0)
00052 {
00053   // Declare properties here.
00054 
00055 }
00056 
00057 
00058 StatusCode UseMuc::initialize() {
00059   StatusCode sc;
00060   MsgStream log(msgSvc(), name());
00061   log << MSG::INFO << "Initialize()" << endreq;
00062 
00063   // So far don't have any properties, but in case we do some day..
00064 //  setProperties();
00065 
00066    log<<MSG::INFO << "setProperties()" << endreq;
00067   
00068    sc = service("CalibDataSvc", m_pCalibDataSvc, true);
00069 
00070   if ( !sc.isSuccess() ) {
00071     log << MSG::ERROR 
00072         << "Could not get IDataProviderSvc interface of CalibXmlCnvSvc" 
00073         << endreq;
00074     return sc;
00075   } else {
00076     log << MSG::DEBUG 
00077         << "Retrieved IDataProviderSvc interface of CalibXmlCnvSvc" 
00078         << endreq;
00079   }
00080   
00081   sc = service("CalibRootCnvSvc", m_pRootSvc, true);
00082   if ( !sc.isSuccess() ) {
00083     log << MSG::ERROR 
00084         << "Could not get ICalibRootSvc interface of CalibRootCnvSvc" 
00085         << endreq;
00086     return sc;
00087   }
00088   // Get properties from the JobOptionsSvc
00089   
00090  sc = setProperties();
00091 
00092  // m_pIdTr = new MucIdTransform();
00093 
00094  return StatusCode::SUCCESS;
00095 
00096 }
00097 
00098 
00099 StatusCode UseMuc::execute( ) {
00100    
00101   MsgStream log(msgSvc(), name());
00102 /*  std::vector<double> emccalib;
00103   CalibData::MucCalibData* emc = new CalibData::MucCalibData;
00104   //set emcCalibdata--------------------------------
00105    for(i=0;i<6000;i++)
00106     {  emccalib.push_back(i);
00107     }
00108   
00109    emc->setDigiCalibConst(&emccalib);
00110    emccalib.clear();
00111   //set EnCoeff
00112    for(i=0;i<43;i++)
00113     { emccalib.push_back(1);
00114     }
00115    emc->setEnCoeff(&emccalib);
00116    emccalib.clear();  
00117    //set PosCoeff
00118   for(i=0;i<15;i++)
00119     { emccalib.push_back(0);
00120     }
00121   emc->setPosCoeff(&emccalib);
00122   emc->setrunfrm(0);
00123   emc->setrunto(0);
00124  */
00125    //register the emcCalibData into the TCDS ; nelectable
00126    std::string fullPath = "/Calib/MucCal";
00127     log << MSG::INFO<<"execute() fullPath = "<<fullPath<< endreq;
00128   //  m_pCalibDataSvc->registerObject(fullPath,emc);
00129 
00130     //write the MucCalibData to the rootfile; 
00131 //   m_pRootSvc->writeToRoot("./Muc_dat.root", fullPath);
00132    //another way,write the MucCalibData without TCDS
00133 //   m_pRootSvc->writeToRoot("./Muc_dat1.root", emc);
00134   //retrieve DataObject from the TCDS-----------------
00135   SmartDataPtr<CalibData::MucCalibData> test(m_pCalibDataSvc, fullPath);
00136   if(!test);
00137    std::cout<<"m_uniformEff="<<test->getUniformEff()<<std::endl;
00138    std::cout<<"m_UniformNos="<<test->getUniformNos()<<std::endl;
00139    std::cout<<"m_UniformClst="<<test->getUniformClst()<<std::endl;
00140    for(int i=0;i<LAYER_MAX;i++){
00141      std::cout<<"m_layerEff["<<i<<"]="<< test->getLayerEff(i)<<"  m_layerNos["<<i<<"]="<<test->getLayerNos(i)<<std::endl;
00142      for(int j=0;j<CLST_MAX;j++){
00143       std::cout<<"m_layerClstPro["<<i<<"]["<<j<<"]="<<test->getLayerClstPro(i,j)<<std::endl;
00144      }
00145    }
00146 
00147    for(int i=0; i<PART_MAX; i++)
00148         {
00149           for(int j=0; j<((i==1)?B_SEG_NUM:E_SEG_NUM); j++)
00150           {
00151             for(int k=0; k<((i==1)?B_LAY_NUM:E_LAY_NUM); k++)
00152             {
00153                     std::cout << "Box: " << i << "\t" << j << "\t" << k << "\t"
00154                     << test->getBoxEff(i, j, k) << endl;
00155             }
00156           }     
00157         }
00158 /*
00159         int strip_max;
00160         for(int i=0; i<PART_MAX; i++)
00161         {
00162           for(int j=0; j<((i==1)?B_SEG_NUM:E_SEG_NUM); j++)
00163           {
00164             for(int k=0; k<((i==1)?B_LAY_NUM:E_LAY_NUM); k++)
00165             {
00166                 strip_max = m_pIdTr->GetStripMax(i, j, k);
00167                 for(int n=0; n<strip_max; n++)
00168                 {
00169                         std::cout << "Strip: " << i << "\t" << j << "\t" << k << "\t" 
00170                             << "\t" << n << "\t" << test->getStripEff(i, j, k, n) << endl;
00171                 }
00172             }
00173           }                     
00174         }
00175 */
00176 
00177       return StatusCode::SUCCESS;
00178 }
00179 
00180 StatusCode UseMuc::finalize( ) {
00181 
00182   MsgStream log(msgSvc(), name());
00183   log << MSG::INFO 
00184       << "        UseMuc FINALIZE!! "
00185       << endreq;
00186   
00187   return StatusCode::SUCCESS;
00188 }
00189 
00190 

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