114 {
115 info() << "In write()" << endmsg;
116
117
118 StatusCode sc;
119 for ( const auto& item : m_itemLists )
120 {
121 DataObject* obj = nullptr;
122 IOpaqueAddress* pAddress = nullptr;
123
124 sc = m_pDataProvider->retrieveObject( item->path(), obj );
125 if ( !sc.isSuccess() )
126 {
error() <<
"Cannot write mandatory object(s) (Not found): " << item->path() << endmsg; }
127 else
128 {
129 sc = dynamic_cast<IConversionSvc*>( m_cnvSvc )->createRep( obj, pAddress );
130
131
132 if ( !sc.isSuccess() )
133 warning() <<
"Failed to create rep for " << item->path() << endmsg;
134 }
135 }
136
137
138 if ( m_mode == 2 )
139 {
140 if ( m_st != 1 )
141 {
142 if ( m_commonData.m_rectrackEvt )
143 m_outputTree->Branch( "TRecEvent", "TRecTrackEvent", &m_commonData.m_rectrackEvt,
144 3200000, 1 );
145 if ( m_commonData.m_evtRecObject )
146 m_outputTree->Branch( "TEvtRecObject", "TEvtRecObject", &m_commonData.m_evtRecObject,
147 3200000, 1 );
148 if ( m_commonData.m_dstEvt )
149 m_outputTree->Branch( "TDstEvent", "TDstEvent", &m_commonData.m_dstEvt, 3200000, 1 );
150 if ( m_commonData.m_recEvt )
151 m_outputTree->Branch( "TDigiEvent", "TDigiEvent", &m_commonData.m_recEvt, 3200000, 1 );
152 if ( m_commonData.m_EvtHeader )
153 m_outputTree->Branch( "TEvtHeader", "TEvtHeader", &m_commonData.m_EvtHeader, 3200000,
154 1 );
155 if ( m_commonData.m_EvtNavigator )
156 m_outputTree->Branch( "TEvtNavigator", "TEvtNavigator", &m_commonData.m_EvtNavigator,
157 3200000, 1 );
158 if ( m_commonData.m_hltEvt )
159 m_outputTree->Branch( "THltEvent", "THltEvent", &m_commonData.m_hltEvt, 3200000, 1 );
160 if ( m_commonData.m_mcEvt )
161 m_outputTree->Branch( "TMcEvent", "TMcEvent", &m_commonData.m_mcEvt, 3200000, 1 );
162 if ( m_commonData.m_trigEvt )
163 m_outputTree->Branch( "TTrigEvent", "TTrigEvent", &m_commonData.m_trigEvt, 3200000,
164 1 );
165 m_jobInfoTree->Branch( "JobInfo", &m_jobInfo );
166 m_st = 1;
167 }
168
169 if ( m_outputFile->IsZombie() || !m_outputFile->IsOpen() )
170 {
171 error() <<
"Can not write to the file " << m_dofileName << endmsg;
172 return StatusCode::FAILURE;
173 }
174
175 int nb = m_outputTree->Fill();
176 if ( nb == -1 )
177 {
178 error() <<
"Error in fill tree (EventWriter) " << m_outputTree->GetName() <<
" with "
179 << nb << " bytes" << endmsg;
180 return StatusCode::FAILURE;
181 }
182
183 m_outputFile = m_outputTree->GetCurrentFile();
184 }
185 else if ( m_mode == 3 )
186 {
187 error() <<
"The DistBossMode has been deprecated!" << endmsg;
188 return StatusCode::FAILURE;
189 }
190
191 m_commonData.clear();
192
193 return StatusCode::SUCCESS;
194}