Destructor.
65 {
66
67 MsgStream msg(
msgSvc(), name());
68
69 msg << MSG::INFO << "FieldReader intialize() has been called" << endreq;
70 StatusCode status = service("MagneticFieldSvc", m_pIMF, true);
71 if( !status.isSuccess() ) {
72 msg << MSG::FATAL << "Unable to open Magnetic field service"
73 << endreq;
74 return StatusCode::FAILURE;
75 }
76
77 msg << MSG::DEBUG << " Book ntuple" << endreq;
78
80 if(nt1) m_tuple1 = nt1;
81 else {
82 m_tuple1 =
ntupleSvc()->book(
"FILE1/n1",CLID_ColumnWiseTuple,
"Field");
83 if( m_tuple1 ) {
84 status = m_tuple1->addItem("x", m_x );
85 status = m_tuple1->addItem("y", m_y );
86 status = m_tuple1->addItem("z", m_z );
87 status = m_tuple1->addItem("r", m_r );
88 status = m_tuple1->addItem("Bx", m_Bx );
89 status = m_tuple1->addItem("By", m_By );
90 status = m_tuple1->addItem("Bz", m_Bz );
91 status = m_tuple1->addItem("SigmaBx", m_sigma_bx );
92 status = m_tuple1->addItem("SigmaBy", m_sigma_by );
93 status = m_tuple1->addItem("SigmaBz", m_sigma_bz );
94 }
95 else {
96 msg << MSG::ERROR << " Cannot book N-tuple:" <<long(m_tuple1)<< endreq;
97 return StatusCode::FAILURE;
98 }
99 }
100
102 if(nt2) m_tuple2 = nt2;
103 else {
104 m_tuple2 =
ntupleSvc()->book(
"FILE1/n2",CLID_ColumnWiseTuple,
"Field");
105 if( m_tuple2 ) {
106 status = m_tuple2->addItem("x", m_x2 );
107 status = m_tuple2->addItem("y", m_y2 );
108 status = m_tuple2->addItem("z", m_z2 );
109 status = m_tuple2->addItem("r", m_r2 );
110 status = m_tuple2->addItem("Bx", m_Bx2 );
111 status = m_tuple2->addItem("By", m_By2 );
112 status = m_tuple2->addItem("Bz", m_Bz2 );
113 }
114 else {
115 msg << MSG::ERROR << " Cannot book N-tuple:" <<long(m_tuple2)<< endreq;
116 return StatusCode::FAILURE;
117 }
118 }
119
121 if(nt3) m_tuple3 = nt3;
122 else {
123 m_tuple3 =
ntupleSvc()->book(
"FILE1/n3",CLID_ColumnWiseTuple,
"Field");
124 if( m_tuple3 ) {
125 status = m_tuple3->addItem("x", m_x3 );
126 status = m_tuple3->addItem("y", m_y3 );
127 status = m_tuple3->addItem("z", m_z3 );
128 status = m_tuple3->addItem("r", m_r3 );
129 status = m_tuple3->addItem("phi", m_phi3 );
130 status = m_tuple3->addItem("Bx", m_Bx3 );
131 status = m_tuple3->addItem("By", m_By3 );
132 status = m_tuple3->addItem("Bz", m_Bz3 );
133 }
134 else {
135 msg << MSG::ERROR << " Cannot book N-tuple:" <<long(m_tuple3)<< endreq;
136 return StatusCode::FAILURE;
137 }
138 }
139
141 if(nt4) m_tuple4 = nt4;
142 else {
143 m_tuple4 =
ntupleSvc()->book(
"FILE1/n4",CLID_ColumnWiseTuple,
"Field");
144 if( m_tuple4 ) {
145 status = m_tuple4->addItem("time", m_time );
146 }
147 else {
148 msg << MSG::ERROR << " Cannot book N-tuple:" <<long(m_tuple4)<< endreq;
149 return StatusCode::FAILURE;
150 }
151 }
152
153 status = service("BesTimerSvc", m_timersvc);
154 if (status.isFailure()) {
155 msg << MSG::ERROR << name() << ": Unable to locate BesTimer Service" << endreq;
156 return StatusCode::FAILURE;
157 }
158 m_timer = m_timersvc->
addItem(
"Read field Time");
159
160 msg << MSG::INFO << "MagFieldReader initialized" << endreq;
161 return StatusCode::SUCCESS;
162}
virtual BesTimer * addItem(const std::string &name)=0