98 {
99 MsgStream log(
msgSvc(), name());
100
101 log << MSG::INFO << "in initialize()" << endmsg;
102
103 m_bhabhaEmcECut=0.7*m_ecm;
104 m_bhabhaMaxECut=0.3*m_ecm;
105 m_bhabhaSecECut=0.1*m_ecm;
106 m_dimuEHighCut=0.27*m_ecm;
107 m_dimuELowCut=0.027*m_ecm;
108 m_diphotonEmcECut=0.7*m_ecm;
109 m_diphotonSecECut=0.3*m_ecm;
110 m_hadronChaECut=0.3*m_ecm;
111 m_hadronNeuECut=0.3*m_ecm;
112
113
114 if (m_ecm==2.4) {
115 m_bhabhaEmcECut=0.7*m_ecm;
116 m_bhabhaMaxECut=0.15*m_ecm;
117 m_bhabhaSecECut=0.05*m_ecm;
118 m_diphotonEmcECut=0.7*m_ecm;
119 m_diphotonSecECut=0.2*m_ecm;
120
121 }
122
123
124
125 StatusCode sc;
126
127 log << MSG::INFO << "creating sub-algorithms...." << endreq;
128
129 if(m_selectBhabha) {
130 sc = createSubAlgorithm( "EventWriter", "SelectBarrelBhabha", m_subalg1);
131 if( sc.isFailure() ) {
132 log << MSG::ERROR << "Error creating Sub-Algorithm SelectBhabhaBarrel" <<endreq;
133 return sc;
134 } else {
135 log << MSG::INFO << "Success creating Sub-Algorithm SelectBhabhaBarrel" <<endreq;
136 }
137 sc = createSubAlgorithm( "EventWriter", "SelectEndcapBhabha", m_subalg2);
138 if( sc.isFailure() ) {
139 log << MSG::ERROR << "Error creating Sub-Algorithm SelectBhabhaEndcap" <<endreq;
140 return sc;
141 } else {
142 log << MSG::INFO << "Success creating Sub-Algorithm SelectBhabhaEndcap" <<endreq;
143 }
144 }
145
146 if(m_selectDimu) {
148 sc = createSubAlgorithm( "EventWriter", "SelectBarrelDimu", m_subalg3);
149 if( sc.isFailure() ) {
150 log << MSG::ERROR << "Error creating Sub-Algorithm SelectDimuBarrel" <<endreq;
151 return sc;
152 } else {
153 log << MSG::INFO << "Success creating Sub-Algorithm SelectDimuBarrel" <<endreq;
154 }
155 sc = createSubAlgorithm( "EventWriter", "SelectEndcapDimu", m_subalg4);
156 if( sc.isFailure() ) {
157 log << MSG::ERROR << "Error creating Sub-Algorithm SelectDimuEndcap" <<endreq;
158 return sc;
159 } else {
160 log << MSG::INFO << "Success creating Sub-Algorithm SelectDimuEndap" <<endreq;
161 }
162 }
163
164 if(m_selectHadron) {
165 sc = createSubAlgorithm( "EventWriter", "SelectHadron", m_subalg5);
166 if( sc.isFailure() ) {
167 log << MSG::ERROR << "Error creating Sub-Algorithm SelectHadron" <<endreq;
168 return sc;
169 } else {
170 log << MSG::INFO << "Success creating Sub-Algorithm SelectHadron" <<endreq;
171 }
172 }
173
174 if(m_selectDiphoton) {
175 sc = createSubAlgorithm( "EventWriter", "SelectBarrelDiphoton", m_subalg6);
176 if( sc.isFailure() ) {
177 log << MSG::ERROR << "Error creating Sub-Algorithm SelectDiphotonBarrel" <<endreq;
178 return sc;
179 } else {
180 log << MSG::INFO << "Success creating Sub-Algorithm SelectDiphotonBarrel" <<endreq;
181 }
182 sc = createSubAlgorithm( "EventWriter", "SelectEndcapDiphoton", m_subalg7);
183 if( sc.isFailure() ) {
184 log << MSG::ERROR << "Error creating Sub-Algorithm SelectDiphotonEndcap" <<endreq;
185 return sc;
186 } else {
187 log << MSG::INFO << "Success creating Sub-Algorithm SelectDiphotonEndcap" <<endreq;
188 }
189 }
190
191 if(m_writeDst) {
192 sc = createSubAlgorithm( "EventWriter", "WriteDst", m_subalg8);
193 if( sc.isFailure() ) {
194 log << MSG::ERROR << "Error creating Sub-Algorithm WriteDst" <<endreq;
195 return sc;
196 } else {
197 log << MSG::INFO << "Success creating Sub-Algorithm WriteDst" <<endreq;
198 }
199 }
200
201 if(m_writeRec) {
202 sc = createSubAlgorithm( "EventWriter", "WriteRec", m_subalg9);
203 if( sc.isFailure() ) {
204 log << MSG::ERROR << "Error creating Sub-Algorithm WriteRec" <<endreq;
205 return sc;
206 } else {
207 log << MSG::INFO << "Success creating Sub-Algorithm WriteRec" <<endreq;
208 }
209 }
210
211 if(m_output) {
212 StatusCode status;
213 NTuplePtr nt0(
ntupleSvc(),
"FILE1/hadron");
214 if ( nt0 ) m_tuple0 = nt0;
215 else {
216 m_tuple0 =
ntupleSvc()->book (
"FILE1/hadron", CLID_ColumnWiseTuple,
"N-Tuple example");
217 if ( m_tuple0 ) {
218 status = m_tuple0->addItem ("esum", m_esum);
219 status = m_tuple0->addItem ("eemc", m_eemc);
220 status = m_tuple0->addItem ("etot", m_etot);
221 status = m_tuple0->addItem ("nGood", m_nGood);
222 status = m_tuple0->addItem ("nCharge", m_nCharge);
223 status = m_tuple0->addItem ("nGam", m_nGam);
224 status = m_tuple0->addItem ("ptot", m_ptot);
225 status = m_tuple0->addItem ("pp", m_pp);
226 status = m_tuple0->addItem ("pm", m_pm);
227 status = m_tuple0->addItem ("run", m_runnb);
228 status = m_tuple0->addItem ("event", m_evtnb);
229 status = m_tuple0->addItem ("maxE", m_maxE);
230 status = m_tuple0->addItem ("secE", m_secE);
231 status = m_tuple0->addItem ("dthe", m_dThe);
232 status = m_tuple0->addItem ("dphi", m_dPhi);
233 status = m_tuple0->addItem ("mdcHit1", m_mdcHit1);
234 status = m_tuple0->addItem ("mdcHit2", m_mdcHit2);
235 }
236 else {
237 log << MSG::ERROR << " Cannot book N-tuple:" << long(m_tuple0) << endmsg;
238 return StatusCode::FAILURE;
239 }
240 }
241
242 NTuplePtr nt1(
ntupleSvc(),
"FILE1/vxyz");
243 if ( nt1 ) m_tuple1 = nt1;
244 else {
245 m_tuple1 =
ntupleSvc()->book (
"FILE1/vxyz", CLID_ColumnWiseTuple,
"ks N-Tuple example");
246 if ( m_tuple1 ) {
247 status = m_tuple1->addItem ("vx0", m_vx0);
248 status = m_tuple1->addItem ("vy0", m_vy0);
249 status = m_tuple1->addItem ("vz0", m_vz0);
250 status = m_tuple1->addItem ("vr0", m_vr0);
251 status = m_tuple1->addItem ("theta0", m_theta0);
252 status = m_tuple1->addItem ("p0", m_p0);
253 status = m_tuple1->addItem ("pt0", m_pt0);
254 }
255 else {
256 log << MSG::ERROR << " Cannot book N-tuple:" << long(m_tuple1) << endmsg;
257 return StatusCode::FAILURE;
258 }
259 }
260
261 NTuplePtr nt2(
ntupleSvc(),
"FILE1/photon");
262 if ( nt2 ) m_tuple2 = nt2;
263 else {
264 m_tuple2 =
ntupleSvc()->book (
"FILE1/photon", CLID_ColumnWiseTuple,
"ks N-Tuple example");
265 if ( m_tuple2 ) {
266 status = m_tuple2->addItem ("dthe", m_dthe);
267 status = m_tuple2->addItem ("dphi", m_dphi);
268 status = m_tuple2->addItem ("dang", m_dang);
269 status = m_tuple2->addItem ("eraw", m_eraw);
270 }
271 else {
272 log << MSG::ERROR << " Cannot book N-tuple:" << long(m_tuple2) << endmsg;
273 return StatusCode::FAILURE;
274 }
275 }
276
277 if(m_selectDimu) {
278 NTuplePtr nt3(
ntupleSvc(),
"FILE1/dimu");
279 if ( nt3 ) m_tuple3 = nt3;
280 else {
281 m_tuple3 =
ntupleSvc()->book (
"FILE1/dimu", CLID_ColumnWiseTuple,
"ks N-Tuple example");
282 if ( m_tuple3 ) {
284 }
285 else {
286 log << MSG::ERROR << " Cannot book N-tuple:" << long(m_tuple3) << endmsg;
287 return StatusCode::FAILURE;
288 }
289 }
290 }
291 }
292
293
294
295
296 m_events=0;
297 m_barrelBhabhaNumber=0;
298 m_endcapBhabhaNumber=0;
299 m_barrelDimuNumber=0;
300 m_endcapDimuNumber=0;
301 m_hadronNumber=0;
302 m_barrelDiphotonNumber=0;
303 m_endcapDiphotonNumber=0;
304
305 log << MSG::INFO << "successfully return from initialize()" <<endmsg;
306 return StatusCode::SUCCESS;
307
308}
void BookNtuple(NTuple::Tuple *&tuple)