2#include "GaudiKernel/Kernel.h"
3#include "GaudiKernel/IInterface.h"
4#include "GaudiKernel/StatusCode.h"
5#include "GaudiKernel/SvcFactory.h"
6#include "GaudiKernel/MsgStream.h"
7#include "GaudiKernel/ISvcLocator.h"
8#include "GaudiKernel/Bootstrap.h"
9#include "GaudiKernel/IDataProviderSvc.h"
10#include "GaudiKernel/DataSvc.h"
12#include "GaudiKernel/SmartDataPtr.h"
31 base_class(name, svcloc) {
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);
45 MsgStream log(messageService(), name());
46 log << MSG::INFO <<
"MdcPrintSvc::initialize()" << endreq;
48 StatusCode sc = Service::initialize();
49 if( sc.isFailure() )
return sc;
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;
59 sc = service (
"RawDataProviderSvc", irawDataProviderSvc);
61 if ( sc.isFailure() ){
62 log << MSG::FATAL <<
"Could not load RawDataProviderSvc!" << endreq;
63 return StatusCode::FAILURE;
67 return StatusCode::SUCCESS;
71 MsgStream log(messageService(), name());
72 log << MSG::INFO <<
"MdcPrintSvc::finalize()" << endreq;
74 return StatusCode::SUCCESS;
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++ ) {
95 int tkTruth = (*iter)->getTrackIndex();
101 cout<<
",t "<<tdc<<
",c "<<adc;
104 if(iDigi%4==0) std::cout<<std::endl;
106 std::cout<<std::endl;
110 MsgStream log(messageService(), name());
112 SmartDataPtr<RecMdcTrackCol> recMdcTrackCol(eventSvc,
"/Event/Recon/RecMdcTrackCol");
113 if (!recMdcTrackCol) {
114 log << MSG::WARNING <<
"Could not find RecMdcTrackCol" << endreq;
118 std::cout<<
"//======= "<<name()<<
" RecMdcTrackCol size = "<<recMdcTrackCol->size() << std::endl;
119 RecMdcTrackCol::iterator it = recMdcTrackCol->begin();
120 for (;it!= recMdcTrackCol->end();it++){
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)
134 if(m_printTrackDetail){
135 std::cout<<
" q "<<tk->
charge()
136 <<
" theta "<<tk->
theta()
143 std::cout <<
" p "<<tk->
p()
149 std::cout<<
" tkStat "<<tk->
stat()
150 <<
" chi2 "<<tk->
chi2()
151 <<
" ndof "<<tk->
ndof()
153 <<
" nst "<<tk->
nster()
156 std::cout<<
"errmat " << std::endl;
157 for (
int i=0; i<15; i++){ std::cout<<
" "<<tk->
err(i); }
158 std::cout<<
" " << std::endl;
163 int haveDigi[43][288];
165 for(
int ii=0;ii<43;ii++){
166 for(
int jj=0;jj<43;jj++){
167 haveDigi[ii][jj]=-9999;
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++ ) {
176 haveDigi[l][
w]=(*iter)->getTrackIndex();
181 std::cout<<
"nHits=" <<
nhits<< std::endl;
183 if(m_printMcTk) cout<<
"mcTkId ";
184 cout<<
"(layer,wire,lr) stat z"<<endl;
185 for(
int ii=0; ii <
nhits ; ii++){
190 if(m_printMcTk) { cout<<haveDigi[layer][wire]; }
191 cout<<
" ("<<layer<<
","<<wire
194 <<
" "<<tk->
getVecHits()[ii]->getZhit()<<
" "<<std::endl;
196 std::cout <<
" "<< std::endl;
201 MsgStream log(messageService(), name());
203 SmartDataPtr<MdcMcHitCol> mdcMcHitCol(eventSvc,
"/Event/MC/MdcMcHitCol");
205 log << MSG::WARNING <<
"Could not find MdcMcHitCol" << endreq;
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;
214 MdcMcHitCol::iterator iter_mchit = mdcMcHitCol->begin();
215 for (;iter_mchit != mdcMcHitCol->end(); iter_mchit++,ihit++ ) {
216 const Identifier id= (*iter_mchit)->identify();
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
std::vector< MdcDigi * > MdcDigiVec
const double theta() const
const HepSymMatrix err() const
const double chi2() const
const int trackId() const
const HepVector helix() const
......
static int layer(const Identifier &id)
Values of different levels (failure returns 0)
static int wire(const Identifier &id)
void printDigi(uint32_t getDigiFlag=0) const
void printRecMdcTrack(const RecMdcTrack *tk) const
void printMdcMcHitCol() const
void printRecMdcTrackCol() const
MdcDigiVec & getMdcDigiVec(uint32_t control=0)
static double MdcTime(int timeChannel)
static double MdcCharge(int chargeChannel)
const HitRefVec getVecHits(void) const
const int getNhits() const