Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

DQAFillEx Class Reference

#include <DQAFillEx.h>

List of all members.

Public Member Functions

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

Private Attributes

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


Constructor & Destructor Documentation

DQAFillEx::DQAFillEx const std::string &  name,
ISvcLocator *  pSvcLocator
 

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

DQAFillEx::DQAFillEx const std::string &  name,
ISvcLocator *  pSvcLocator
 


Member Function Documentation

StatusCode DQAFillEx::execute  ) 
 

StatusCode DQAFillEx::execute  ) 
 

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

StatusCode DQAFillEx::finalize  ) 
 

StatusCode DQAFillEx::finalize  ) 
 

00166                                {
00167 
00168   MsgStream log(msgSvc(), name());
00169   log << MSG::INFO << "in finalize()" << endmsg;
00170   return StatusCode::SUCCESS;
00171 }

StatusCode DQAFillEx::initialize  ) 
 

StatusCode DQAFillEx::initialize  ) 
 

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


Member Data Documentation

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

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

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

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

ITHistSvc* DQAFillEx::m_thsvc [private]
 

ITHistSvc* DQAFillEx::m_thsvc [private]
 

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

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


The documentation for this class was generated from the following files:
Generated on Wed Feb 2 15:58:56 2011 for BOSS6.5.5 by  doxygen 1.3.9.1