StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StHbtIOBinary.cc
1 /**********************************************************
2  *
3  * Here are defined the input/output stream operators for
4  * StHbtEvent and associated classes
5  *
6  *********************************************************/
7 
8 #include "StHbtMaker/Infrastructure/StHbtIOBinary.hh"
9 
10 
11 StHbtIOBinary::StHbtIOBinary(const char* dirName, const char* fileName, const char* appendix, const char* readWrite)
12  : mDebug(0), mOStream(0), mIStream(0) {
13  //cout << " StHbtIOBinary(const char* fileName, const char* readWrite " << endl;
14  byteCounterTotal=0;
15  byteCounterEvent=0;
16  if (((*readWrite)=='w')|| ((*readWrite)=='W')){ // this object will be a writer
17  mOStream = new ofstream( parseDirFile(dirName, fileName, appendix) );
18  if ( !mOStream ){
19  cout << "StHbtIOBinary::Init() - Cannot open output file! " << endl;
20  exit(ioERROpen);
21  }
22  cout << "StHbtIOBinary::Init() - being configured as a Writer " << readWrite << endl;
23  }
24  else {
25  mIStream = new ifstream( parseDirFile( dirName, fileName, appendix) );
26  if ( !mIStream ){
27  cout << "StHbtIOBinary::Init() - Cannot open input file! " << endl;
28  exit(ioERROpen);
29  }
30  cout << fileName << " open " << endl;
31  cout << "StHbtIOBinary::Init() - being configured as a Reader " << readWrite << endl;
32  }
33 }
34 
35 StHbtIOBinary::~StHbtIOBinary() {
36  cout << " StHbtIOBinary::~StHbtIOBinary() " << endl;
37  if (mOStream) {
38  mOStream->close();
39  delete mOStream;
40  }
41  if (mIStream) {
42  mIStream->close();
43  delete mIStream;
44  }
45 }
46 
47 int StHbtIOBinary::readHeader(StHbtString& header){
48  return readString( header );
49 }
50 
51 int StHbtIOBinary::writeHeader(const StHbtString& header){
52  return writeString( header );
53 }
54 
55 int StHbtIOBinary::bytesWritten() { return byteCounterTotal; }
56 int StHbtIOBinary::bytesRead() { return byteCounterTotal; }
57 
58 // **********************************************************************
59 const char* StHbtIOBinary::parseDirFile(const char* dir, const char* file, const char* appendix) {
60  if (dir) cout << " StHbtIOBinary::parseDirFile() - dir " << dir << endl;
61  if (file) cout << " StHbtIOBinary::parseDirFile() - file " << file << endl;
62  if (appendix) cout << " StHbtIOBinary::parseDirFile() - appendix " << appendix << endl;
63 
64  if (!dir || !appendix) return file; // no dir specified
65  StHbtString theDir = (char*)dir;
66  StHbtString theFile = (char*)file;
67  StHbtString theAppendix = (char*)appendix;
68  while ( theFile.find("/") != string::npos ) {
69 #ifdef STHBTDEBUG
70  cout << theFile.c_str() << " ";
71 #endif
72  string::size_type pos = theFile.find("/");
73 #ifdef STHBTDEBUG
74  cout << pos << endl;
75 #endif
76  theFile.erase(0, pos+1 );
77 #ifdef STHBTDEBUG
78  cout << theFile.c_str() << endl;
79 #endif
80  }
81  if(mDebug) cout << " StHbtIOBinary::parseDirFile() ---" << (theDir+theFile+theAppendix).c_str() << "---" << endl;
82  return (theDir+theFile+theAppendix).c_str();
83 }
84 
85 #include "StHbtMaker/Infrastructure/StHbtTypes.hh"
86 #include "SystemOfUnits.h"
87 //------------------------- trackList ----------------------------------
88 int StHbtIOBinary::readTrackList(StHbtEvent& ev, unsigned short trVersion){
89  int iret;
90  ev.TrackCollection()->clear();
91  colSizeType NtracksInCollection;
92  iret = read(NtracksInCollection);
93  if(mDebug) cout << " reading " << NtracksInCollection << " tracks " << endl;
94  if (NtracksInCollection > 1e6) {
95  for ( int i=0; i<10; i++) {
96  cout << " StHbtIOBinaryReader::readTrackList(...) - unreasonable number of tracks, returning ioERR " << endl;
97  }
98  return(ioERR);
99  }
100  StHbtThreeVector rVertexPosition(ev.PrimVertPos());
102  for (colSizeType itrk=0; itrk <NtracksInCollection; itrk++){
103  StHbtTrack* trk = new StHbtTrack;
104  iret = read( *trk, trVersion);
105  ev.TrackCollection()->push_back(trk); // ?ok?
106  if(mDebug) {
107  cout << " track read " << *trk << endl;
108  cout << " " << itrk << "/" << NtracksInCollection;
109  cout << " track pushed " << endl;
110  }
111  }
112 
113  return iret;
114 }
115 int StHbtIOBinary::writeTrackList(const StHbtEvent& ev, unsigned short trVersion){
116  int iret;
117  colSizeType colSize = (colSizeType) ev.TrackCollection()->size();
118  iret = write( colSize );
119  for (StHbtTrackIterator iter=ev.TrackCollection()->begin(); iter != ev.TrackCollection()->end(); iter++){
120  iret = write( **iter, trVersion);
121  }
122  return iret;
123 }
124 //------------------------- v0list ----------------------------------
125 int StHbtIOBinary::readV0List(StHbtEvent& ev, unsigned short v0Version){
126  int iret;
127  ev.V0Collection()->clear();
128  colSizeType NV0sInCollection;
129  iret = read( NV0sInCollection);
130  if (mDebug) cout << " reading " << NV0sInCollection << " V0s " << endl;
131  if ( !(mIStream->good()) ) {
132  cout << "StHbtEvent input operator finds stream in bad state ! " << endl;
133  return ioERR;
134  }
135  if (NV0sInCollection > 1e6) {
136  for ( int i=0; i<10; i++) {
137  cout << " StHbtIOBinaryReader::readV0List(...) - unreasonable number of V0s, returning ioERR " << endl;
138  }
139  return(ioERR);
140  }
141  for (unsigned int iv0=0; iv0<NV0sInCollection; iv0++){
142  StHbtV0* v0 = new StHbtV0;
143  iret = read( *v0, v0Version);
144  ev.V0Collection()->push_back(v0);
145  }
146  return iret;
147 }
148 int StHbtIOBinary::writeV0List(const StHbtEvent& ev, unsigned short v0Version){
149  int iret;
150  colSizeType colSize = (colSizeType) ev.V0Collection()->size();
151  iret = write( colSize );
152  for (StHbtV0Iterator iterv0=ev.V0Collection()->begin(); iterv0 != ev.V0Collection()->end(); iterv0++){
153  iret = write( **iterv0, v0Version);
154  }
155  return iret;
156 }
157 
158 
159 //------------------------- string ----------------------------------
160 int StHbtIOBinary::writeString(const StHbtString& Message){
161  *mOStream << Message.c_str();
162  *mOStream << endl;
163  *mOStream << "-*-*-*-* End of Input Reader Report" << endl; // write THIS out even if there is no report
164  byteCounterEvent += Message.size();
165  return (!mOStream->good());
166 }
167 int StHbtIOBinary::readString(StHbtString& Message){
168  char temp[200] = "";
169  Message = "";
170  string stemp;
171  do {
172  Message += stemp;
173  Message += "\n";
174  mIStream->getline(temp,200);
175  stemp = temp;
176  // cout << stemp.c_str() << endl;
177  } while (stemp != "-*-*-*-* End of Input Reader Report" && mIStream->good() );
178  cout << "Here is the message that was at the beginning of the file...\n";
179  cout << Message.c_str();
180  byteCounterEvent += Message.size();
181  return (!mIStream->good());
182 }
183 
184 //------------------------- StHbtEvent -----------------------------------
185 int StHbtIOBinary::read(StHbtEvent& ev, unsigned short evVersion, unsigned short trVersion, unsigned short v0Version){
186  if (mDebug) cout << " StHbtIOBinary::read(StHbtEvent& ev, ...) - Versions: " << evVersion << " " << trVersion << " " << v0Version << endl;
187  int iret;
188  byteCounterEvent = 0;
189  switch ( (int)evVersion ) {
190  case 0: iret = read_V0( ev, trVersion, v0Version); break;
191  case 1: iret = read_V1( ev, trVersion, v0Version); break;
192  case 2: iret = read_V2( ev, trVersion, v0Version); break;
193  default:
194  iret = ioERR;
195  cout << " StHbtIOBinary::read(StHbtEvent& ev, ...) - can not read this event version " << endl;
196  break;
197  }
198  byteCounterTotal += byteCounterEvent;
199  if (mDebug) cout << " StHbtIOBinary::read(StHbtEvent& ev, ...) - byteCounterTotal= " << byteCounterTotal << " byteCounterEvent = " << byteCounterEvent << endl;
200  return iret;
201 }
202 
203 //------------------------- StHbtEvent -----------------------------------
204 int StHbtIOBinary::write( const StHbtEvent& ev, unsigned short evVersion, unsigned short trVersion, unsigned short v0Version){
205  if (mDebug) cout << " StHbtIOBinary::write(StHbtEvent& ev, ...) - Versions: " << evVersion << " " << trVersion << " " << v0Version << endl;
206  int iret;
207  byteCounterEvent = 0;
208  switch ( (int)evVersion ) {
209  case 0: iret = write_V0( ev, trVersion, v0Version); break;
210  case 1: iret = write_V1( ev, trVersion, v0Version); break;
211  case 2: iret = write_V2( ev, trVersion, v0Version); break;
212  default:
213  iret = ioERR;
214  cout << " StHbtIOBinary::write(StHbtEvent& ev, ...) - can not write this event version " << endl;
215  break;
216  }
217  byteCounterTotal += byteCounterEvent;
218  if (mDebug) cout << " StHbtIOBinary::write(StHbtEvent& ev, ...) - byteCounterTotal= " << byteCounterTotal << " byteCounterEvent = " << byteCounterEvent << endl;
219  return iret;
220 }
221 
222 //------------------------- StHbtTrack -----------------------------------
223 int StHbtIOBinary::read( StHbtTrack& x, unsigned short version){
224  if (mDebug>1) cout << " StHbtIOBinary::readTrack() - Version : " << version << endl;
225  int iret;
226  switch ( (int)version ) {
227  case 0:
228  case 1: iret = read_V1( x ); break;
229  case 2: iret = read_V2( x ); break;
230  default:
231  cout << " can not write this track version " << endl;
232  return ioERR;
233  }
234 
235  return ioOK;
236 }
237 
238 //------------------------- StHbtTrack -----------------------------------
239 int StHbtIOBinary::write( const StHbtTrack& x, unsigned short version){
240  if (mDebug>1) cout << " StHbtIOBinary::writeTrack() - Version : " << version << endl;
241  int iret;
242  switch ( (int)version ) {
243  case 0:
244  case 1: iret = write_V1( x ); break;
245  case 2: iret = write_V2( x ); break;
246  default:
247  cout << " can not write this track version " << endl;
248  return ioERR;
249  }
250  return ioOK;
251 }
252 
253 //------------------------- StHbtV0 -----------------------------------
254 int StHbtIOBinary::read( StHbtV0& x, unsigned short version){
255  if (mDebug>1) cout << " StHbtIOBinary::readV0(...) - Version : " << version << endl;
256  int iret;
257  switch ( (int)version ) {
258  case 0:
259  case 1: iret = read_V1( x ); break;
260  case 2: iret = read_V2( x); break;
261  case 3: iret = read_V3( x); break;
262  default:
263  cout << " can not read this V0 version " << endl;
264  return ioERR;
265  }
266 
267  return ioOK;
268 }
269 
270 //------------------------- StHbtV0 -----------------------------------
271 int StHbtIOBinary::write(const StHbtV0& x, unsigned short version){
272  if (mDebug>0) cout << " StHbtIOBinary::writeV0(...) - Version : " << version << endl;
273  int iret;
274  switch ( (int)version ) {
275  case 0:
276  case 1: iret = write_V1( x ); break;
277  case 2: iret = write_V2( x ); break;
278  case 3: iret = write_V3( x ); break;
279  default:
280  cout << " can not write this V0 version " << endl;
281  return ioERR;
282  }
283  return ioOK;
284 }
285 
286 
287 //------------------------- StHbtEvent Versions -----------------------------------
288 //------------------------- StHbtEvent Versions -----------------------------------
289 //------------------------- StHbtEvent Versions -----------------------------------
290 //------------------------- StHbtEvent Versions -----------------------------------
291 //------------------------- StHbtEvent Versions -----------------------------------
292 int StHbtIOBinary::read_V0(StHbtEvent& ev, unsigned short trVersion, unsigned short v0Version ) {
293  if (mDebug) cout << " StHbtIOBinary::read_V0(StHbtEvent& event, unsigned short trVersion, unsigned short v0Version )" << endl;
294  int iret;
295  int idummy = 0;
296  iret = read( ev.mEventNumber);
297  if (mIStream->eof()) {
298  cout << "Hit end of file " << endl;
299  return ioEOF;
300  }
301  iret = read( ev.mCtbMultiplicity );
302  iret = read( ev.mZdcAdc[0]);
303  iret = read( ev.mZdcAdc[1]);
304  iret = read( ev.mTpcNhits);
305  iret = read( ev.mNumberOfTracks);
306  iret = read( ev.mNumberOfGoodTracks);
307  iret = read( ev.mReactionPlane[0]);
308  iret = read( ev.mReactionPlane[1]);
309  iret = read( idummy );
310  iret = read( idummy );
311  iret = read( idummy );
312  iret = read( ev.mPrimVertPos);
313  //#ifdef STHBTDEBUG
314  cout << ev << endl;
315  //#endif
316  // OK, time to read in Track and V0 collections
317  if (!(mIStream->good())){
318  cout << "StHbtEvent input operator finds stream in bad state ! " << endl;
319  return ioERR;
320  }
321  // tracks & v0s
322  iret = readTrackList(ev,trVersion); if (iret!=ioOK) return iret;
323  iret = readV0List(ev,v0Version); if (iret!=ioOK) return iret;
324  return ioOK;
325 };
326 int StHbtIOBinary::write_V0(const StHbtEvent& ev, unsigned short trVersion, unsigned short v0Version){
327  if (mDebug) cout << " StHbtIOBinary::write_V0(const StHbtEvent& ev, unsigned short trVersion, unsigned short v0Version) " << endl;
328  int iret;
329  int idummy = 0;
330  //event properties
331  iret = write( ev.mEventNumber );
332  iret = write( ev.mCtbMultiplicity );
333  iret = write( ev.mZdcAdc[0] );
334  iret = write( ev.mZdcAdc[1] );
335  iret = write( ev.mTpcNhits );
336  iret = write( ev.mNumberOfTracks );
337  iret = write( ev.mNumberOfGoodTracks );
338  iret = write( ev.mReactionPlane[0] );
339  iret = write( ev.mReactionPlane[1] );
340  iret = write( idummy );
341  iret = write( idummy );
342  iret = write( idummy );
343  iret = write( ev.mPrimVertPos );
344  // tracks & v0s
345  iret = writeTrackList(ev,trVersion);
346  iret = writeV0List(ev,v0Version);
347  return ioOK;
348 };
349 int StHbtIOBinary::read_V1(StHbtEvent& ev, unsigned short trVersion, unsigned short v0Version ) {
350  if (mDebug) cout << " StHbtIOBinary::read_V1(StHbtEvent& event, unsigned short trVersion, unsigned short v0Version )" << endl;
351  int iret;
352  iret = read( ev.mEventNumber);
353  if (mIStream->eof()) {
354  cout << " StHbtIOBinary::read_V1(...) - Hit end of file " << endl;
355  return ioEOF;
356  }
357  iret = read( ev.mCtbMultiplicity );
358  iret = read( ev.mZdcAdc[0]);
359  iret = read( ev.mZdcAdc[1]);
360  iret = read( ev.mTpcNhits);
361  iret = read( ev.mNumberOfTracks);
362  iret = read( ev.mNumberOfGoodTracks);
363  iret = read( ev.mReactionPlane[0]);
364  iret = read( ev.mReactionPlane[1]);
365  iret = read( ev.mPrimVertPos);
366 #ifdef STHBTDEBUG
367  cout << ev << endl;
368 #endif
369  // OK, time to read in Track and V0 collections
370  if (!(mIStream->good())){
371  cout << " StHbtIOBinary::read_V1(...) - StHbtEvent input operator finds stream in bad state ! " << endl;
372  return ioERR;
373  }
374  // tracks & v0s
375  iret = readTrackList(ev,trVersion); if (iret!=ioOK) return iret;
376  iret = readV0List(ev,v0Version); if (iret!=ioOK) return iret;
377  return ioOK;
378 };
379 int StHbtIOBinary::write_V1(const StHbtEvent& ev, unsigned short trVersion, unsigned short v0Version){
380  if (mDebug) cout << " StHbtIOBinary::write_V1(const StHbtEvent& ev, unsigned short trVersion, unsigned short v0Version) " << endl;
381  int iret;
382  //event properties
383  iret = write( ev.mEventNumber );
384  iret = write( ev.mCtbMultiplicity );
385  iret = write( ev.mZdcAdc[0] );
386  iret = write( ev.mZdcAdc[1] );
387  iret = write( ev.mTpcNhits );
388  iret = write( ev.mNumberOfTracks );
389  iret = write( ev.mNumberOfGoodTracks );
390  iret = write( ev.mReactionPlane[0] );
391  iret = write( ev.mReactionPlane[1] );
392  iret = write( ev.mPrimVertPos );
393  // tracks & v0s
394  iret = writeTrackList(ev,trVersion);
395  iret = writeV0List(ev,v0Version);
396  return ioOK;
397 };
398 //------------------------- StHbtTrack Versions -----------------------------------
399 //------------------------- StHbtTrack Versions -----------------------------------
400 //------------------------- StHbtEvent Versions -----------------------------------
401 //------------------------- StHbtEvent Versions -----------------------------------
402 //------------------------- StHbtEvent Versions -----------------------------------
403 //------------------------- StHbtEvent Versions -----------------------------------
404 int StHbtIOBinary::read_V2(StHbtEvent& ev, unsigned short trVersion, unsigned short v0Version ) {
405  if (mDebug) cout << " StHbtIOBinary::read_V2(StHbtEvent& event, unsigned short trVersion, unsigned short v0Version )" << endl;
406  int iret;
407  iret = read( ev.mEventNumber);
408  if (mIStream->eof()) {
409  cout << "Hit end of file " << endl;
410  return ioEOF;
411  }
412  iret = read( ev.mCtbMultiplicity );
413  iret = read( ev.mZdcAdc[0]);
414  iret = read( ev.mZdcAdc[1]);
415  iret = read( ev.mTpcNhits);
416  iret = read( ev.mNumberOfTracks);
417  iret = read( ev.mNumberOfGoodTracks);
418  iret = read( ev.mUncorrectedNumberOfPositivePrimaries);
419  iret = read( ev.mUncorrectedNumberOfNegativePrimaries);
420  iret = read( ev.mReactionPlane[0]);
421  iret = read( ev.mReactionPlane[1]);
422  iret = read( ev.mPrimVertPos);
423 #ifdef STHBTDEBUG
424  cout << ev << endl;
425 #endif
426  // OK, time to read in Track and V0 collections
427  if (!(mIStream->good())){
428  cout << "StHbtEvent input operator finds stream in bad state ! " << endl;
429  return ioERR;
430  }
431  // tracks & v0s
432  iret = readTrackList(ev,trVersion); if (iret!=ioOK) return iret;
433  iret = readV0List(ev,v0Version); if (iret!=ioOK) return iret;
434  return ioOK;
435 };
436 int StHbtIOBinary::write_V2(const StHbtEvent& ev, unsigned short trVersion, unsigned short v0Version){
437  if (mDebug) cout << " StHbtIOBinary::write_V2(const StHbtEvent& ev, unsigned short trVersion, unsigned short v0Version)" << endl;
438  int iret;
439  //event properties
440  iret = write( ev.mEventNumber );
441  iret = write( ev.mCtbMultiplicity );
442  iret = write( ev.mZdcAdc[0] );
443  iret = write( ev.mZdcAdc[1] );
444  iret = write( ev.mTpcNhits );
445  iret = write( ev.mNumberOfTracks );
446  iret = write( ev.mNumberOfGoodTracks );
447  iret = write( ev.mUncorrectedNumberOfPositivePrimaries);
448  iret = write( ev.mUncorrectedNumberOfNegativePrimaries);
449  iret = write( ev.mReactionPlane[0] );
450  iret = write( ev.mReactionPlane[1] );
451  iret = write( ev.mPrimVertPos );
452  // tracks & v0s
453  iret = writeTrackList(ev,trVersion);
454  iret = writeV0List(ev,v0Version);
455  return ioOK;
456 };
457 //------------------------- StHbtTrack Versions -----------------------------------
458 //------------------------- StHbtTrack Versions -----------------------------------
459 //------------------------- StHbtTrack Versions -----------------------------------
460 //------------------------- StHbtTrack Versions -----------------------------------
461 int StHbtIOBinary::read_V1(StHbtTrack& x) {
462  if (mDebug>1) cout << " StHbtIOBinary::read_V1(StHbtTrack&) " << endl;
463  return read(x); // works only with in root
464 };
465 int StHbtIOBinary::write_V1(const StHbtTrack& x){
466  if (mDebug>1) cout << " StHbtIOBinary::write_V1(const StHbtTrack&)" << endl;
467  return write(x); // works only with in root
468 };
469 //------------------------- StHbtTrack Versions -----------------------------------
470 //------------------------- StHbtTrack Versions -----------------------------------
471 //------------------------- StHbtTrack Versions -----------------------------------
472 //------------------------- StHbtTrack Versions -----------------------------------
473 int StHbtIOBinary::read_V2(StHbtTrack& x) {
474  int iret;
475  iret = read( x.mCharge );
476  iret = read( x.mNHits );
477  iret = read( x.mNHitsPoss );
478  iret = read( x.mNSigmaElectron );
479  iret = read( x.mNSigmaPion );
480  iret = read( x.mNSigmaKaon );
481  iret = read( x.mNSigmaProton );
482  iret = read( x.mdEdx );
483  iret = read( x.mDCAxy );
484  iret = read( x.mDCAz );
485  iret = read( x.mChiSqXY );
486  iret = read( x.mChiSqZ );
487  iret = read( x.mMap[0] );
488  iret = read( x.mMap[1] );
489  iret = read( x.mTrackId );
490  iret = read( x.mPt );
491  iret = read( x.mP ); // use template specialisation
492  iret = read( x.mHelix ); // use template specialisation
493  return ioOK;
494 };
495 int StHbtIOBinary::write_V2(const StHbtTrack& x) {
496  int iret;
497  iret = write( x.mCharge );
498  iret = write( x.mNHits );
499  iret = write( x.mNHitsPoss );
500  iret = write( x.mNSigmaElectron );
501  iret = write( x.mNSigmaPion );
502  iret = write( x.mNSigmaKaon );
503  iret = write( x.mNSigmaProton );
504  iret = write( x.mdEdx );
505  iret = write( x.mDCAxy );
506  iret = write( x.mDCAz );
507  iret = write( x.mChiSqXY );
508  iret = write( x.mChiSqZ );
509  iret = write( x.mMap[0] );
510  iret = write( x.mMap[1] );
511  iret = write( x.mTrackId );
512  iret = write( x.mPt );
513  iret = write( x.mP ); // use template specialisation
514  iret = write( x.mHelix ); // use template specialisation
515  return ioOK;
516 };
517 //------------------------- StHbtV0 Versions -----------------------------------
518 //------------------------- StHbtV0 Versions -----------------------------------
519 //------------------------- StHbtV0 Versions -----------------------------------
520 //------------------------- StHbtV0 Versions -----------------------------------
521 int StHbtIOBinary::read_V1(StHbtV0& x) {
522  if (mDebug>1) cout << " StHbtIOBinary::read_V1(StHbtV0&) " << endl;
523  return read(x); // works only with in root
524 };
525 int StHbtIOBinary::write_V1(const StHbtV0& x){
526  if (mDebug>1) cout << " StHbtIOBinary::write_V1(const StHbtV0&) " << endl;
527  return write(x); // works only with in root
528 };
529 //------------------------- StHbtV0 Versions -----------------------------------
530 //------------------------- StHbtV0 Versions -----------------------------------
531 //------------------------- StHbtV0 Versions -----------------------------------
532 //------------------------- StHbtV0 Versions -----------------------------------
533 int StHbtIOBinary::read_V2(StHbtV0& x) {
534  int iret;
535  iret = read( x.mDecayLengthV0 );
536  iret = read( x.mDecayVertexV0 );
537  iret = read( x.mDcaV0Daughters );
538  iret = read( x.mDcaV0ToPrimVertex );
539  iret = read( x.mDcaPosToPrimVertex );
540  iret = read( x.mDcaNegToPrimVertex );
541  iret = read( x.mMomPos );
542  iret = read( x.mMomNeg );
543  iret = read( x.mTpcHitsPos );
544  iret = read( x.mTpcHitsNeg );
545  iret = read( x.mRapLambda );
546  iret = read( x.mRapK0Short );
547  iret = read( x.mCTauLambda );
548  iret = read( x.mCTauK0Short );
549  iret = read( x.mKeyPos );
550  iret = read( x.mKeyNeg );
551  iret = read( x.mTrackTopologyMapPos[0] );
552  iret = read( x.mTrackTopologyMapPos[1] );
553  iret = read( x.mTrackTopologyMapNeg[0] );
554  iret = read( x.mTrackTopologyMapNeg[1] );
555  // cout << " pos track id = " << x.midPos << " neg track id = " << x.midNeg << endl;
556  x.UpdateV0();
557  return ioOK;
558 };
559 int StHbtIOBinary::write_V2(const StHbtV0& x) {
560  int iret;
561  iret = write( x.mDecayLengthV0 );
562  iret = write( x.mDecayVertexV0 );
563  iret = write( x.mDcaV0Daughters );
564  iret = write( x.mDcaV0ToPrimVertex );
565  iret = write( x.mDcaPosToPrimVertex );
566  iret = write( x.mDcaNegToPrimVertex );
567  iret = write( x.mMomPos );
568  iret = write( x.mMomNeg );
569  iret = write( x.mTpcHitsPos );
570  iret = write( x.mTpcHitsNeg );
571  iret = write( x.mRapLambda );
572  iret = write( x.mRapK0Short );
573  iret = write( x.mCTauLambda );
574  iret = write( x.mCTauK0Short );
575  iret = write( x.mKeyPos );
576  iret = write( x.mKeyNeg );
577  iret = write( x.mTrackTopologyMapPos[0] );
578  iret = write( x.mTrackTopologyMapPos[1] );
579  iret = write( x.mTrackTopologyMapNeg[0] );
580  iret = write( x.mTrackTopologyMapNeg[1] );
581  // cout << " pos track id = " << x.midPos << " neg track id = " << x.midNeg << endl;
582  return ioOK;
583 };
584 //------------------------- StHbtV0 Versions -----------------------------------
585 //------------------------- StHbtV0 Versions -----------------------------------
586 //------------------------- StHbtV0 Versions -----------------------------------
587 //------------------------- StHbtV0 Versions -----------------------------------
588 int StHbtIOBinary::read_V3(StHbtV0& x) {
589  int iret;
590  iret = read( x.mDecayLengthV0 );
591  iret = read( x.mDecayVertexV0 );
592  iret = read( x.mDcaV0Daughters );
593  iret = read( x.mDcaV0ToPrimVertex );
594  iret = read( x.mDcaPosToPrimVertex );
595  iret = read( x.mDcaNegToPrimVertex );
596  iret = read( x.mMomPos );
597  iret = read( x.mMomNeg );
598  iret = read( x.mTpcHitsPos );
599  iret = read( x.mTpcHitsNeg );
600  iret = read( x.mRapLambda );
601  iret = read( x.mRapK0Short );
602  iret = read( x.mCTauLambda );
603  iret = read( x.mCTauK0Short );
604  iret = read( x.mKeyPos );
605  iret = read( x.mKeyNeg );
606  iret = read( x.mTrackTopologyMapPos[0] );
607  iret = read( x.mTrackTopologyMapPos[1] );
608  iret = read( x.mTrackTopologyMapNeg[0] );
609  iret = read( x.mTrackTopologyMapNeg[1] );
610  iret = read( x.mDedxPos );
611  iret = read( x.mDedxNeg );
612  x.UpdateV0();
613  return ioOK;
614 };
615 int StHbtIOBinary::write_V3(const StHbtV0& x) {
616  int iret;
617  iret = write( x.mDecayLengthV0 );
618  iret = write( x.mDecayVertexV0 );
619  iret = write( x.mDcaV0Daughters );
620  iret = write( x.mDcaV0ToPrimVertex );
621  iret = write( x.mDcaPosToPrimVertex );
622  iret = write( x.mDcaNegToPrimVertex );
623  iret = write( x.mMomPos );
624  iret = write( x.mMomNeg );
625  iret = write( x.mTpcHitsPos );
626  iret = write( x.mTpcHitsNeg );
627  iret = write( x.mRapLambda );
628  iret = write( x.mRapK0Short );
629  iret = write( x.mCTauLambda );
630  iret = write( x.mCTauK0Short );
631  iret = write( x.mKeyPos );
632  iret = write( x.mKeyNeg );
633  iret = write( x.mTrackTopologyMapPos[0] );
634  iret = write( x.mTrackTopologyMapPos[1] );
635  iret = write( x.mTrackTopologyMapNeg[0] );
636  iret = write( x.mTrackTopologyMapNeg[1] );
637  iret = write( x.mDedxPos );
638  iret = write( x.mDedxNeg );
639  // cout << " pos track id = " << x.midPos << " neg track id = " << x.midNeg << endl;
640  return ioOK;
641 };
642 
643 
644 
645 
646 
647 
648 
649