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