52 std::string PackedRawDataCnvSvc_Name(
"PackedRawDataCnvSvc");
53 std::string RawDataInputSvc_Name(
"RawDataInputSvc");
54 std::string RawDataTofMcHitCnv_Name(
"RawDataTofMcHitCnv");
59 SmartIF<IService> pCnvSvc(conversionSvc());
60 if (isGaudiThreaded(pCnvSvc->name())){
61 PackedRawDataCnvSvc_Name += getGaudiThreadIDfromName(pCnvSvc->name());
62 RawDataInputSvc_Name += getGaudiThreadIDfromName(pCnvSvc->name());
63 RawDataTofMcHitCnv_Name += getGaudiThreadIDfromName(pCnvSvc->name());
67 MsgStream log(messageService(), RawDataTofMcHitCnv_Name.c_str());
70 if (StatusCode::SUCCESS != sc) {
71 log << MSG::ERROR <<
"RawDataBaseCnv: Cant initialize PackedRawDataCnvSvc" << endreq;
77 sc = serviceLocator()->service(PackedRawDataCnvSvc_Name.c_str(), isvc,
true);
78 if (sc != StatusCode::SUCCESS) {
79 log << MSG::ERROR <<
"Cant get PackedRawDataCnvSvc" << endreq;
83 if (m_RawDataAccess == 0 ) {
84 log << MSG::ERROR <<
"RawDataTofCnv: Cant cast to RawDataCnvSvc " << endreq;
85 return StatusCode::FAILURE;
88 sc = serviceLocator()->getService(RawDataInputSvc_Name.c_str(), isvc);
89 if (sc != StatusCode::SUCCESS ) {
90 log << MSG::WARNING <<
"Cant get RawDataInputSvc " << endreq;
95 if (m_inputSvc == 0 ) {
96 log << MSG::WARNING <<
"Cant cast to RawDataInputSvc " << endreq;
97 return StatusCode::FAILURE ;
100 return StatusCode::SUCCESS;
116 MsgStream log(
msgSvc(),
"RawDataTofMcHitCnv");
125 return StatusCode::FAILURE;
133 std::vector<uint32_t>::const_iterator
iter = evt->
getTofTruth().begin();
134 std::vector<uint32_t>::const_iterator eiter = evt->
getTofTruth().end();
136 for (
int tofMcHitId = 0;
iter != eiter; tofMcHitId++) {
138 m_tofMcHitBuilder.
unPack(
iter, eiter, m_TofTruth);
141 unsigned int barrel_ec = m_TofTruth.
partId;
143 if( barrel_ec>=0 && barrel_ec<=2 ) {
144 unsigned int layer = 0;
152 else if( barrel_ec>=3 ) {
153 unsigned int endcap = 0;
154 if( barrel_ec==4 ) { endcap = 1; }
158 log << MSG::ERROR <<
"barrel_ec is not correct! barrel_ec=" << barrel_ec << endreq;
163 m_TofTruth.
x/(m_tofMcHitBuilder.
m_xCoeff*1.0),
164 m_TofTruth.
y/(m_tofMcHitBuilder.
m_yCoeff*1.0),
165 m_TofTruth.
z/(m_tofMcHitBuilder.
m_zCoeff*1.0),
172 tofMcHitCol->push_back(tofMcHit);
175 return StatusCode::SUCCESS;