BOSS 7.0.7
BESIII Offline Software System
Loading...
Searching...
No Matches
ValidRecMucTrackAlg.cxx
Go to the documentation of this file.
2#include "GaudiKernel/MsgStream.h"
3#include "GaudiKernel/SmartDataPtr.h"
4//#include "GaudiKernel/IHistogramSvc.h"
5
7
8
9ValidRecMucTrackAlg::ValidRecMucTrackAlg(const std::string& name, ISvcLocator* pSvcLocator) :
10 Algorithm(name, pSvcLocator) {
11
12 m_tuple1 = 0;
13}
14
16
17 StatusCode status;
18 MsgStream log( msgSvc(), name() );
19 log << MSG::INFO << "Booking Histograms" << endreq;
20
21 // Book N-tuple 1
22 NTuplePtr nt1(ntupleSvc(), "FILE105/T");
23 if ( nt1 ) m_tuple1 = nt1;
24 else {
25 m_tuple1 = ntupleSvc()->book ("FILE105/T", CLID_RowWiseTuple, "MucTrack parameter");
26 if ( m_tuple1 ) {
27 status = m_tuple1->addItem("depth",m_depth);
28 status = m_tuple1->addItem("distance",m_distance);
29 status = m_tuple1->addItem("deltaPhi",m_deltaPhi);
30 status = m_tuple1->addItem("maxHits",m_maxHits);
31 status = m_tuple1->addItem("numLayers",m_numLayers);
32 status = m_tuple1->addItem("numHits",m_numHits);
33 status = m_tuple1->addItem("chi2",m_chi2);
34 status = m_tuple1->addItem("xPos",m_xPos);
35 status = m_tuple1->addItem("yPos",m_yPos);
36 status = m_tuple1->addItem("zPos",m_zPos);
37 }
38 else { // did not manage to book the N tuple....
39 log << MSG::ERROR << " Cannot book N-tuple:" << long(m_tuple1) << endmsg;
40 //return StatusCode::FAILURE;
41 }
42 }
43 log << MSG::INFO << "Finished booking NTuples" << endmsg;
44
45
46 return StatusCode::SUCCESS;
47
48
49}
50
51
53 MsgStream log(msgSvc(), name());
54 SmartDataPtr<RecMucTrackCol> mucTracks(eventSvc(),"/Event/Recon/RecMucTrackCol");
55 if( ! mucTracks )
56 {
57 log << MSG::ERROR << "Unable to retrieve RecMucTrackCol" << endreq;
58 return StatusCode::FAILURE;
59 } else {
60 log << MSG::DEBUG << "RecMucTrackCol retrieved of size "<< mucTracks->size() << endreq;
61 for(RecMucTrackCol::iterator it=mucTracks->begin(); it!=mucTracks->end(); it++)
62 {
63
64 m_depth = (*it)->depth();
65 m_distance = (*it)->distance();
66 m_deltaPhi = (*it)->deltaPhi();
67 m_maxHits = (*it)->maxHitsInLayer();
68 m_numLayers= (*it)->numLayers();
69 m_numHits = (*it)->numHits();
70 m_chi2 = (*it)->chi2();
71 m_xPos = (*it)->xPos();
72 m_yPos = (*it)->yPos();
73 m_zPos = (*it)->zPos();
74
75 StatusCode status1 = m_tuple1->write();
76 if ( status1.isFailure() ) {
77 log << MSG::ERROR << "Cannot fill Ntuple1" << endreq;
78 }
79 }
80 }
81 return StatusCode::SUCCESS;
82}
83
84
86
87 MsgStream log(msgSvc(), name());
88 log << MSG::INFO << "Finalizing..." << endreq;
89
90}
91
92
93
INTupleSvc * ntupleSvc()
IMessageSvc * msgSvc()
ValidRecMucTrackAlg(const std::string &name, ISvcLocator *pSvcLocator)