60 {
61#ifndef BEAN
62 Service::initialize();
63 MsgStream log(
msgSvc(), name());
64
65 setProperties();
66 log << MSG::INFO << "EventTagSvc initialize()" << endreq;
67 log << MSG::INFO << " pdgFile="<<m_pdtFile<<endreq;
68 log << MSG::INFO << " decayCodesFile="<<m_decayTabsFile<<endreq;
69 log << MSG::INFO << " userDecayTabsFile="<<m_userDecayTabsFile
70 <<endreq;
71 log << MSG::INFO << " buildAntiPartTable="<<m_buildAntiTabs<<endreq;
72 log << MSG::INFO << " Ignore Photons="<<m_ignorePhotons<<endreq;
73 log << MSG::INFO << " Chain trigger particles:"<<endreq;
74 for(std::vector<string>::iterator it=userChainTrig.begin();
75 it!=userChainTrig.end();it++){
76 log << MSG::INFO<<" " <<(*it)<<endreq;
77 }
78#else
79 if( verbose ) {
80 cout << "EventTagSvc initialize()" << endl;
81 cout << " pdgFile=" << m_pdtFile << endl;
82 cout << " decayCodesFile=" << m_decayTabsFile << endl;
83 cout << " userDecayTabsFile=" << m_userDecayTabsFile << endl;
84 cout << " buildAntiPartTable=" << m_buildAntiTabs << endl;
85 cout << " Ignore Photons=" << m_ignorePhotons << endl;
86 cout << " Chain trigger particles:" << endl;
87
88 for (std::vector < string >::iterator it = userChainTrig.begin ();
89 it != userChainTrig.end (); it++) {
90 cout << " " << (*it) << endl;
91 }
92 }
93#endif
94
95
96 if(readPdtFile(m_pdtFile.c_str())){
97#ifndef BEAN
98 log << MSG::ERROR<<"Can not read pdgFile "<< m_pdtFile<<endreq;
99 return StatusCode::StatusCode::FAILURE;
100#else
101 cerr << "Can not read pdgFile " << m_pdtFile << endl;
102 return false;
103#endif
104 }
105
106 if(readDecayTabFile(m_decayTabsFile)){
107#ifndef BEAN
108 log << MSG::ERROR<<"Can not read decayTabsFile "<< m_decayTabsFile<<endreq;
109 return StatusCode::StatusCode::FAILURE;
110#else
111 cerr << "Can not read decayTabsFile " << m_decayTabsFile << endl;
112 return false;
113#endif
114 }
115
116 if(m_userDecayTabsFile.size()){
117 if(readDecayTabFile(m_userDecayTabsFile)){
118#ifndef BEAN
119 log << MSG::ERROR<<"Can not read userDecayTabsFile "<<m_userDecayTabsFile
120 <<endreq;
121 return StatusCode::StatusCode::FAILURE;
122#else
123 cerr << "Can not read userDecayTabsFile " << m_userDecayTabsFile << endl;
124 return false;
125#endif
126 }
127 }
128
129 if(m_buildAntiTabs){
130 if(buildAntiPartTabs()){
131#ifndef BEAN
132 log << MSG::ERROR<<"fail to build decay code table for anti-particles"
133 <<endreq;
134 return StatusCode::StatusCode::FAILURE;
135#else
136 cerr << "fail to build decay code table for anti-particles" << endl;
137 return false;
138#endif
139 }
140 }
141
142
143 for(std::vector<string>::iterator it=userChainTrig.begin();
144 it!=userChainTrig.end();it++){
146 if(pdg==0){
147#ifndef BEAN
148 log << MSG::ERROR<<"Unknown ChainTrigger particle "<< (*it)
149 <<" ..ignoring"<<endreq;
150#else
151 cerr << "Unknown ChainTrigger particle " << (*it)
152 << " ..ignoring" << endl;
153#endif
154 continue;
155 }
156 chainTrigParticles.insert(pdg);
157 }
158
159#ifndef BEAN
160 log << MSG::DEBUG << "sorted chain trigger particles:"<<endreq;
161 for(set<long int>::iterator it=chainTrigParticles.begin();
162 it!=chainTrigParticles.end();it++){
163 log << MSG::DEBUG<<" "<<(*it)<<" "
165 }
166#else
167 if (verbose) {
168 cout << "sorted chain trigger particles:" << endl;
169 for (set < long int >::iterator it = chainTrigParticles.begin ();
170 it != chainTrigParticles.end (); it++) {
171 cout << " " << (*it) << " "
173 }
174 }
175#endif
176
177
178#ifndef BEAN
179 return StatusCode::SUCCESS;
180#else
181 return true;
182#endif
183}