DQAFillEx Class Reference

#include <DQAFillEx.h>

List of all members.

Public Member Functions

 DQAFillEx (const std::string &name, ISvcLocator *pSvcLocator)
StatusCode initialize ()
StatusCode execute ()
StatusCode finalize ()

Private Attributes

ITHistSvc * m_thsvc
NTuple::Tuple * m_tuple
NTuple::Item< long > m_runNo
NTuple::Item< long > m_event


Detailed Description

Definition at line 23 of file DQAFillEx.h.


Constructor & Destructor Documentation

DQAFillEx::DQAFillEx ( const std::string name,
ISvcLocator *  pSvcLocator 
)

Definition at line 39 of file DQAFillEx.cxx.

00039                                                                     :
00040   Algorithm(name, pSvcLocator) {
00041   
00042   //Declare the properties  
00043 }


Member Function Documentation

StatusCode DQAFillEx::execute (  ) 

Definition at line 91 of file DQAFillEx.cxx.

References DstMdcTrack::charge(), Bes_Common::DEBUG, calibUtil::ERROR, EventModel::EvtRec::EvtRecEvent, EventModel::EvtRec::EvtRecTrackCol, genRecEmupikp::i, Bes_Common::INFO, m_event, m_runNo, m_thsvc, m_tuple, msgSvc(), DstMdcTrack::x(), DstMdcTrack::y(), and DstMdcTrack::z().

00091                               {
00092   
00093   MsgStream log(msgSvc(), name());
00094   log << MSG::INFO << "in execute()" << endreq;
00095 
00096   SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
00097   m_runNo=eventHeader->runNumber();
00098   m_event=eventHeader->eventNumber();
00099   log << MSG::DEBUG <<"run, evtnum = "
00100       << m_runNo << " , "
00101       << m_event <<endreq;
00102 
00103 
00104   SmartDataPtr<EvtRecEvent> evtRecEvent(eventSvc(), EventModel::EvtRec::EvtRecEvent);
00105 
00106   SmartDataPtr<DQAEvent::DQAEvent> dqaevt(eventSvc(), "/Event/DQATag");
00107   if ( dqaevt ) {
00108       log << MSG::INFO << "success get DQAEvent" << endreq;
00109   } else {
00110       log << MSG::ERROR << "Error accessing DQAEvent" << endreq;
00111       return StatusCode::FAILURE;
00112   }
00113 
00114   log << MSG::DEBUG << "event tag = " << dqaevt->EventTag() << endreq;
00115 
00116   // get the required control sample with DQA tag
00117   if ( dqaevt->Bhabha() ) {
00118       log << MSG::INFO << "Bhabha event" << endreq;
00119       SmartDataPtr<EvtRecTrackCol> evtRecTrkCol(eventSvc(), EventModel::EvtRec::EvtRecTrackCol);
00120       for(int i = 0; i < evtRecEvent->totalCharged(); i++){
00121           EvtRecTrackIterator itTrk=evtRecTrkCol->begin() + i;
00122           log << MSG::DEBUG << i << " " << (*itTrk)->partId() << " "
00123               << (*itTrk)->quality() << endreq;
00124           // get the required particle through the track's PID
00125           // Pid: 1 - electron, 2 - muon, 3 - pion, 4 - kaon, 5 - proton
00126           // if ( (*itTrk)->partId() != 1 ) continue; // only e+, e-
00127           // PID: isElectron(), isMuon(), isPion(), isKaon(), isProton()
00128           if ( !(*itTrk)->isElectron() ) continue; // only e+, e-
00129           // if you want to do dE/dx or TOF study, select track with no bias
00130           // Quality: defined by whether dE/dx or TOF is used to identify particle
00131           // 0 - no dE/dx, no TOF (can be used for dE/dx and TOF calibration)
00132           // 1 - only dE/dx (can be used for TOF calibration)
00133           // 2 - only TOF (can be used for dE/dx calibration)
00134           // 3 - Both dE/dx and TOF          
00135           int qual = (*itTrk)->quality();
00136           if ( qual != 0 && qual != 2) continue; // no dE/dx PID is used in selection
00137 //          if ( qual != 0 && qual != 1) continue; // no TOF PID is used in the selection
00138           RecMdcTrack *mdcTrk = (*itTrk)->mdcTrack();
00139           if ( mdcTrk->charge() > 0 ) {
00140               log << MSG::DEBUG << "is electron" << endreq;
00141           } else {
00142               log << MSG::DEBUG << "is positron" << endreq;
00143           }
00144           double x0  =mdcTrk->x(); 
00145           double y0  =mdcTrk->y(); 
00146           double z0  =mdcTrk->z(); 
00147           double Rxy=sqrt(x0*x0+y0*y0);
00148           // DQA
00149           TH1 *h(0);
00150           if (m_thsvc->getHist("/DQAHist/MDC/hrxy", h).isSuccess()) {
00151               h->Fill(Rxy);
00152           } else {
00153               log << MSG::ERROR << "Couldn't retrieve hrxy" << endreq;
00154           }
00155           if (m_thsvc->getHist("/DQAHist/MDC/hz", h).isSuccess()) {
00156               h->Fill(z0);
00157           } else {
00158               log << MSG::ERROR << "Couldn't retrieve hz" << endreq;
00159           }
00160       }
00161   }
00162   
00163   m_tuple->write();
00164   
00165   return StatusCode::SUCCESS;
00166 
00167 }

StatusCode DQAFillEx::finalize (  ) 

Definition at line 170 of file DQAFillEx.cxx.

References Bes_Common::INFO, and msgSvc().

00170                                {
00171 
00172   MsgStream log(msgSvc(), name());
00173   log << MSG::INFO << "in finalize()" << endmsg;
00174   return StatusCode::SUCCESS;
00175 }

StatusCode DQAFillEx::initialize (  ) 

Definition at line 46 of file DQAFillEx.cxx.

References calibUtil::ERROR, Bes_Common::INFO, m_event, m_runNo, m_thsvc, m_tuple, msgSvc(), and ntupleSvc().

00046                                 {
00047   MsgStream log(msgSvc(), name());
00048 
00049   log << MSG::INFO << "in initialize()" << endmsg;
00050   StatusCode status;
00051 
00052   // DQA
00053   // The first directory specifier must be "DQAFILE"
00054   // The second is the sub-system name: MDC, DEDX, TOF, EMC, MUC, TRG
00055   // user can define more directory, such as DAQFILE/MDC/Bhabha.
00056   NTuplePtr nt(ntupleSvc(), "DQAFILE/MDC");
00057   if ( nt ) m_tuple = nt;
00058   else {
00059       m_tuple = ntupleSvc()->book("DQAFILE/MDC", CLID_ColumnWiseTuple, "MDC ntuple");
00060       if( m_tuple ) {
00061           status = m_tuple->addItem("runNo", m_runNo);
00062           status = m_tuple->addItem("event", m_event);
00063       } else {
00064           log << MSG::ERROR << "Can not book N-tuple:" << long(m_tuple) << endreq;
00065       }
00066   }
00067 
00068   if(service("THistSvc", m_thsvc).isFailure()) {
00069     log << MSG::ERROR << "Couldn't get THistSvc" << endreq;
00070     return StatusCode::FAILURE;
00071   }
00072 
00073   // "DQAHist" is fixed
00074   // "Rhopi" is the sub-system name, just as ntuple case.
00075   TH1F* hrxy = new TH1F("Rxy", "Rxy distribution", 110, -1., 10.);
00076   if(m_thsvc->regHist("/DQAHist/MDC/hrxy", hrxy).isFailure()) {
00077       log << MSG::ERROR << "Couldn't register Rxy" << endreq;
00078   }
00079   TH1F* hz = new TH1F("z", "z distribution", 200, -100., 100.);
00080   if(m_thsvc->regHist("/DQAHist/MDC/hz", hz).isFailure()) {
00081       log << MSG::ERROR << "Couldn't register z" << endreq;
00082   }
00083 
00084   log << MSG::INFO << "successfully return from initialize()" <<endmsg;
00085   return StatusCode::SUCCESS;
00086 
00087 
00088 }


Member Data Documentation

NTuple::Item<long> DQAFillEx::m_event [private]

Definition at line 37 of file DQAFillEx.h.

Referenced by execute(), and initialize().

NTuple::Item<long> DQAFillEx::m_runNo [private]

Definition at line 36 of file DQAFillEx.h.

Referenced by execute(), and initialize().

ITHistSvc* DQAFillEx::m_thsvc [private]

Definition at line 33 of file DQAFillEx.h.

Referenced by execute(), and initialize().

NTuple::Tuple* DQAFillEx::m_tuple [private]

Definition at line 35 of file DQAFillEx.h.

Referenced by execute(), and initialize().


Generated on Tue Nov 29 23:18:22 2016 for BOSS_7.0.2 by  doxygen 1.4.7