CGEM BOSS 6.6.5.h
BESIII Offline Software System
Loading...
Searching...
No Matches
MdcPrintSvc Class Reference

#include <MdcPrintSvc.h>

+ Inheritance diagram for MdcPrintSvc:

Public Member Functions

 MdcPrintSvc (const std::string &name, ISvcLocator *svcloc)
 
 ~MdcPrintSvc ()
 
StatusCode initialize ()
 
StatusCode finalize ()
 
virtual StatusCode queryInterface (const InterfaceID &riid, void **ppvUnknown)
 
void printRecMdcTrackCol () const
 
void printRecMdcTrack (const RecMdcTrack *tk) const
 
void printDigi (uint32_t getDigiFlag=0) const
 
void printMdcMcHitCol () const
 
- Public Member Functions inherited from IMdcPrintSvc

Additional Inherited Members

- Static Public Member Functions inherited from IMdcPrintSvc
static const InterfaceID & interfaceID ()
 

Detailed Description

Definition at line 21 of file MdcPrintSvc.h.

Constructor & Destructor Documentation

◆ MdcPrintSvc()

MdcPrintSvc::MdcPrintSvc ( const std::string & name,
ISvcLocator * svcloc )

Definition at line 30 of file MdcPrintSvc.cxx.

30 :
31 Service (name, svcloc) {
32
33 // declare properties
34 declareProperty("printHit", m_printHit=1);
35 declareProperty("printTrackDetail", m_printTrackDetail=1);
36 declareProperty("printErrMat", m_printErrMat=0);
37 declareProperty("printTdcAdc", m_printTdcAdc=0);
38 declareProperty("printMcTk", m_printMcTk=0);
39 }

◆ ~MdcPrintSvc()

MdcPrintSvc::~MdcPrintSvc ( )

Definition at line 41 of file MdcPrintSvc.cxx.

41 {
42}

Member Function Documentation

◆ finalize()

StatusCode MdcPrintSvc::finalize ( )

Definition at line 70 of file MdcPrintSvc.cxx.

70 {
71 MsgStream log(messageService(), name());
72 log << MSG::INFO << "MdcPrintSvc::finalize()" << endreq;
73
74 return StatusCode::SUCCESS;
75}

◆ initialize()

StatusCode MdcPrintSvc::initialize ( )

Definition at line 44 of file MdcPrintSvc.cxx.

44 {
45 MsgStream log(messageService(), name());
46 log << MSG::INFO << "MdcPrintSvc::initialize()" << endreq;
47
48 StatusCode sc = Service::initialize();
49 if( sc.isFailure() ) return sc;
50
51 ISvcLocator* svcLocator = Gaudi::svcLocator();
52 svcLocator->service("EventDataSvc",eventSvc,true);
53 if (NULL == eventSvc){
54 std::cout << "ERROR Could not load service DataSvc" << std::endl;
55 return StatusCode::FAILURE;
56 }
57
58 IRawDataProviderSvc* irawDataProviderSvc;
59 sc = service ("RawDataProviderSvc", irawDataProviderSvc);
60 m_rawDataProviderSvc = dynamic_cast<RawDataProviderSvc*> (irawDataProviderSvc);
61 if ( sc.isFailure() ){
62 log << MSG::FATAL << "Could not load RawDataProviderSvc!" << endreq;
63 return StatusCode::FAILURE;
64 }
65
66
67 return StatusCode::SUCCESS;
68}

◆ printDigi()

void MdcPrintSvc::printDigi ( uint32_t getDigiFlag = 0) const
virtual

Implements IMdcPrintSvc.

Definition at line 86 of file MdcPrintSvc.cxx.

86 {
87 MdcDigiVec mdcDigiVec = m_rawDataProviderSvc->getMdcDigiVec(getDigiFlag);
88 MdcDigiCol::iterator iter = mdcDigiVec.begin();
89 std::cout<<"//==== "<<name()<<" print MdcDigiVec, nDigi="<<mdcDigiVec.size()<<" :"<<std::endl;
90 for (int iDigi=0;iter!= mdcDigiVec.end(); iter++,iDigi++ ) {
91 long l = MdcID::layer((*iter)->identify());
92 long w = MdcID::wire((*iter)->identify());
93 cout<<"("<<l<<","<<w;
94 if(m_printMcTk) {
95 int tkTruth = (*iter)->getTrackIndex();
96 cout<<";"<<tkTruth;
97 }
98 if(m_printTdcAdc) {
99 double tdc = RawDataUtil::MdcTime((*iter)->getTimeChannel());
100 double adc = RawDataUtil::MdcCharge((*iter)->getChargeChannel());
101 cout<<",t "<<tdc<<",c "<<adc;
102 }
103 cout<<")";
104 if(iDigi%4==0) std::cout<<std::endl;
105 }
106 std::cout<<std::endl;
107}
EvtStreamInputIterator< typename Generator::result_type > iter(Generator gen, int N=0)
std::vector< MdcDigi * > MdcDigiVec
static int layer(const Identifier &id)
Values of different levels (failure returns 0)
Definition MdcID.cxx:49
static int wire(const Identifier &id)
Definition MdcID.cxx:54
MdcDigiVec & getMdcDigiVec(uint32_t control=0)
static double MdcTime(int timeChannel)
Definition RawDataUtil.h:8
static double MdcCharge(int chargeChannel)
Definition RawDataUtil.h:11

◆ printMdcMcHitCol()

void MdcPrintSvc::printMdcMcHitCol ( ) const
virtual

Implements IMdcPrintSvc.

Definition at line 200 of file MdcPrintSvc.cxx.

200 {
201 MsgStream log(messageService(), name());
202
203 SmartDataPtr<MdcMcHitCol> mdcMcHitCol(eventSvc,"/Event/MC/MdcMcHitCol");
204 if (!mdcMcHitCol) {
205 log << MSG::WARNING << "Could not find MdcMcHitCol" << endreq;
206 return;
207 }
208
209 int ihit= 0;
210 cout<< "//==== "<<name()<<" print MdcMcHitCol nMcHit="<<mdcMcHitCol->size()<< endl;
211 if (mdcMcHitCol->size()>0){
212 cout<<"No. (layer,wire) mcTk (x,y,z) lr driftdist(cm) energy"<<endl;
213 }
214 MdcMcHitCol::iterator iter_mchit = mdcMcHitCol->begin();
215 for (;iter_mchit != mdcMcHitCol->end(); iter_mchit++,ihit++ ) {
216 const Identifier id= (*iter_mchit)->identify();
217 int layer = MdcID::layer(id);
218 int wire = MdcID::wire(id);
219 int iMcTk = (*iter_mchit)->getTrackIndex();
220 double mcX = (*iter_mchit)->getPositionX()/10.;
221 double mcY = (*iter_mchit)->getPositionY()/10.;
222 double mcZ = (*iter_mchit)->getPositionZ()/10.;
223 double mcLR = (*iter_mchit)->getPositionFlag();
224 double mcDrift = (*iter_mchit)->getDriftDistance()/10.;
225 double mcEnergy = (*iter_mchit)->getDepositEnergy()/10.;
226 if (mcLR == 0) mcLR = -1;
227 cout<<ihit <<" ("<<layer<<","<<wire<<") "<< iMcTk
228 <<" ("<< mcX<<"," <<mcY<<","<< mcZ
229 <<") " <<mcLR
230 <<" " <<mcDrift
231 <<" " <<mcEnergy
232 <<endl;
233 }
234}

◆ printRecMdcTrack()

void MdcPrintSvc::printRecMdcTrack ( const RecMdcTrack * tk) const
virtual

Implements IMdcPrintSvc.

Definition at line 126 of file MdcPrintSvc.cxx.

126 {
127 std::cout<< "//==== "<<name()<<" print RecMdcTrack No."<<tk->trackId()<<" :"<< std::endl;
128 cout <<" dr "<<tk->helix(0)
129 <<" phi0 "<<tk->helix(1)
130 <<" cpa "<<tk->helix(2)
131 <<" z0 "<<tk->helix(3)
132 <<" tanl "<<tk->helix(4)
133 <<endl;
134 if(m_printTrackDetail){
135 std::cout<<" q "<<tk->charge()
136 <<" theta "<<tk->theta()
137 <<" phi "<<tk->phi()
138 <<" x0 "<<tk->x()
139 <<" y0 "<<tk->y()
140 <<" z0 "<<tk->z()
141 <<" r0 "<<tk->r()
142 <<endl;
143 std::cout <<" p "<<tk->p()
144 <<" pt "<<tk->pxy()
145 <<" pxyz("<<tk->px()
146 <<","<<tk->py()
147 <<","<<tk->pz()
148 <<")"<<endl;
149 std::cout<<" tkStat "<<tk->stat()
150 <<" chi2 "<<tk->chi2()
151 <<" ndof "<<tk->ndof()
152 <<" nhit "<<tk->getNhits()
153 <<" nst "<<tk->nster()
154 <<endl;
155 if(m_printErrMat){
156 std::cout<< "errmat " << std::endl;
157 for (int i=0; i<15; i++){ std::cout<< " "<<tk->err(i); }
158 std::cout<< " " << std::endl;
159 }
160 }
161
162 if(m_printHit){
163 int haveDigi[43][288];
164 if(m_printMcTk) {
165 for(int ii=0;ii<43;ii++){
166 for(int jj=0;jj<43;jj++){
167 haveDigi[ii][jj]=-9999;
168 }
169 }
170 MdcDigiVec mdcDigiVec = m_rawDataProviderSvc->getMdcDigiVec();
171 MdcDigiCol::iterator iter = mdcDigiVec.begin();
172 std::cout<<name()<<"//==== "<<name()<<" print MdcDigiVec, nDigi="<<mdcDigiVec.size()<<" :"<<std::endl;
173 for (int iDigi=0;iter!= mdcDigiVec.end(); iter++,iDigi++ ) {
174 long l = MdcID::layer((*iter)->identify());
175 long w = MdcID::wire((*iter)->identify());
176 haveDigi[l][w]=(*iter)->getTrackIndex();
177 }
178 }
179
180 int nhits = tk->getVecHits().size();
181 std::cout<<"nHits=" <<nhits<< std::endl;
182 cout<<"No. ";
183 if(m_printMcTk) cout<<"mcTkId ";
184 cout<<"(layer,wire,lr) stat z"<<endl;
185 for(int ii=0; ii <nhits ; ii++){
186 Identifier id(tk->getVecHits()[ii]->getMdcId());
187 int layer = MdcID::layer(id);
188 int wire = MdcID::wire(id);
189 cout<<ii<<":";
190 if(m_printMcTk) { cout<<haveDigi[layer][wire]; }
191 cout<<" ("<<layer<<","<<wire
192 <<","<<tk->getVecHits()[ii]->getFlagLR()
193 <<") "<<tk->getVecHits()[ii]->getStat()
194 <<" "<<tk->getVecHits()[ii]->getZhit()<< " "<<std::endl;
195 }//end of hit list
196 std::cout << " "<< std::endl;
197 }
198}
const double theta() const
Definition DstMdcTrack.h:59
const double r() const
Definition DstMdcTrack.h:64
const double py() const
Definition DstMdcTrack.h:56
const HepSymMatrix err() const
const double chi2() const
Definition DstMdcTrack.h:66
const int charge() const
Definition DstMdcTrack.h:53
const int trackId() const
Definition DstMdcTrack.h:52
const double px() const
Definition DstMdcTrack.h:55
const double phi() const
Definition DstMdcTrack.h:60
const double pz() const
Definition DstMdcTrack.h:57
const double pxy() const
Definition DstMdcTrack.h:54
const int ndof() const
Definition DstMdcTrack.h:67
const int stat() const
Definition DstMdcTrack.h:65
const HepVector helix() const
......
const double z() const
Definition DstMdcTrack.h:63
const double p() const
Definition DstMdcTrack.h:58
const int nster() const
Definition DstMdcTrack.h:68
const double y() const
Definition DstMdcTrack.h:62
const double x() const
Definition DstMdcTrack.h:61
const HitRefVec getVecHits(void) const
Definition RecMdcTrack.h:67
const int getNhits() const
Definition RecMdcTrack.h:56

Referenced by printRecMdcTrackCol().

◆ printRecMdcTrackCol()

void MdcPrintSvc::printRecMdcTrackCol ( ) const

Definition at line 109 of file MdcPrintSvc.cxx.

109 {
110 MsgStream log(messageService(), name());
111
112 SmartDataPtr<RecMdcTrackCol> recMdcTrackCol(eventSvc,"/Event/Recon/RecMdcTrackCol");
113 if (!recMdcTrackCol) {
114 log << MSG::WARNING << "Could not find RecMdcTrackCol" << endreq;
115 return;
116 }
117
118 std::cout<< "//======= "<<name()<<" RecMdcTrackCol size = "<<recMdcTrackCol->size() << std::endl;
119 RecMdcTrackCol::iterator it = recMdcTrackCol->begin();
120 for (;it!= recMdcTrackCol->end();it++){
121 printRecMdcTrack(*it);
122 }
123
124}
void printRecMdcTrack(const RecMdcTrack *tk) const

Referenced by MdcTrkRecon::execute(), and MdcxCosmicSewer::execute().

◆ queryInterface()

StatusCode MdcPrintSvc::queryInterface ( const InterfaceID & riid,
void ** ppvUnknown )
virtual

Definition at line 77 of file MdcPrintSvc.cxx.

77 {
78 if( IID_IMdcPrintSvc.versionMatch(riid) ){
79 *ppvInterface = static_cast<IMdcPrintSvc*> (this);
80 } else{
81 return Service::queryInterface(riid, ppvInterface);
82 }
83 return StatusCode::SUCCESS;
84}

The documentation for this class was generated from the following files: