/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Validation/ValidRecMdcDedx/ValidRecMdcDedx-00-00-07-p01/src/ValidRecMdcDedxAlg.cxx

Go to the documentation of this file.
00001 #include "ValidRecMdcDedx/ValidRecMdcDedxAlg.h"
00002 #include "GaudiKernel/MsgStream.h"
00003 #include "GaudiKernel/SmartDataPtr.h"
00004 #include "GaudiKernel/IHistogramSvc.h"
00005 #include "GaudiKernel/INTupleSvc.h"
00006 
00007 #include "MdcRecEvent/RecMdcDedx.h"
00008 #include "Identifier/MdcID.h"
00009 
00010 
00011 ValidRecMdcDedxAlg::ValidRecMdcDedxAlg(const std::string& name, ISvcLocator* pSvcLocator) :
00012    Algorithm(name, pSvcLocator) {
00013     
00014      m_tuple1 = 0; 
00015        
00016    }
00017 
00018 StatusCode ValidRecMdcDedxAlg::initialize(){
00019    StatusCode status;
00020    MsgStream log( msgSvc(), name() );
00021 
00022    //  Book N-tuple 1
00023    NTuplePtr nt1(ntupleSvc(), "DedxTuples/Mdc_dedx");
00024    if ( nt1 ) m_tuple1 = nt1;
00025    else {
00026      m_tuple1 = ntupleSvc()->book ("DedxTuples/Mdc_dedx", CLID_RowWiseTuple, "Dedx parameter");
00027      if ( m_tuple1 )    {
00028        status = m_tuple1->addItem("dedx",m_dedx);
00029        status = m_tuple1->addItem("parttype",m_parttype);
00030        status = m_tuple1->addItem("chidedx",m_chidedx);
00031        status = m_tuple1->addItem("chidedxE",m_chidedxE);
00032        status = m_tuple1->addItem("chidedxMu",m_chidedxMu);
00033        status = m_tuple1->addItem("chidedxPi",m_chidedxPi);
00034        status = m_tuple1->addItem("chidedxK",m_chidedxK);
00035        status = m_tuple1->addItem("chidedxP",m_chidedxP);
00036      }
00037      else    {   // did not manage to book the N tuple....
00038        log << MSG::ERROR << "    Cannot book N-tuple:" << long(m_tuple1) << endmsg;
00039        return StatusCode::FAILURE;
00040      }
00041    }
00042    log << MSG::INFO << "Finished booking NTuples" << endmsg;
00043   return StatusCode::SUCCESS;
00044 
00045 
00046 }
00047 
00048 
00049 StatusCode ValidRecMdcDedxAlg::execute() {
00050    MsgStream log(msgSvc(), name());
00051    SmartDataPtr<RecMdcDedxCol> mdcDedx(eventSvc(),"/Event/Recon/RecMdcDedxCol");
00052    if( ! mdcDedx )
00053       {
00054          log << MSG::ERROR << "Unable to retrieve RecMdcDedxCol" << endreq;
00055          return  StatusCode::FAILURE;
00056       } else {
00057          log << MSG::DEBUG << "RecMdcDedxCol retrieved of size "<< mdcDedx->size() << endreq;
00058          int i = 0;         
00059          for(RecMdcDedxCol::iterator it=mdcDedx->begin(); it!=mdcDedx->end(); it++,i++)
00060            {  m_dedx = (*it)->probPH();
00061               pid_dedx m_pid_dedx = (*it)->particleType();       
00062               m_parttype = (int)m_pid_dedx;
00063                //cout<<"m_parttype is = "<<m_parttype<<endl;
00064               if((m_pid_dedx != electron) && (m_pid_dedx != muon) && (m_pid_dedx != pion)&& (m_pid_dedx != kaon)&& (m_pid_dedx != proton) ) continue;
00065                m_chidedx = (*it)->chi(m_parttype);
00066                m_chidedxE = (*it)->chiE();
00067                m_chidedxMu = (*it)->chiMu();
00068                m_chidedxPi = (*it)->chiPi();
00069                m_chidedxK = (*it)->chiK();
00070                m_chidedxP = (*it)->chiP();
00071              
00072                log << MSG::INFO << "particle chi="<< m_chidedx <<endreq;
00073                log << MSG::INFO << "m_dedx="<<m_dedx<<endreq;
00074                log << MSG::INFO << " m_parttype="<< m_parttype<<endreq;
00075                StatusCode status1 = m_tuple1->write();
00076                if ( status1.isFailure() )  {
00077                  log << MSG::ERROR << "Cannot fill Ntuple1" << endreq;
00078                }
00079                            
00080             }
00081       }
00082      return StatusCode::SUCCESS;
00083 }
00084 
00085 
00086 StatusCode ValidRecMdcDedxAlg::finalize() {
00087 
00088    MsgStream log(msgSvc(), name());
00089    log << MSG::INFO << "Finalizing..." << endreq;
00090 
00091 }
00092 
00093 
00094 

Generated on Tue Nov 29 23:14:45 2016 for BOSS_7.0.2 by  doxygen 1.4.7