Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

PerValidate.cc

Go to the documentation of this file.
00001 
00002 //
00003 // PerValidate
00004 //
00005 // Package: (Per) Persistency
00006 //
00007 // S. Kasahara 07/2002
00008 //
00009 // Purpose: Class for use in validating the Persistency package.
00010 //
00012 
00013 #include <iostream>
00014 using std::cout;
00015 using std::endl;
00016 
00017 #include "MessageService/MsgStream.h"
00018 #include "MessageService/MsgService.h"
00019 #include "MinosObjectMap/MomNavigator.h"
00020 #include "RawData/RawRecord.h"
00021 
00022 #include "Persistency/test/PerValidate.h"
00023 #include "Persistency/PerInputStream.h"
00024 #include "Persistency/PerRecordTags.h"
00025 
00026 // Definition of static data members
00027 // *********************************
00028 
00029 // Definition of methods (alphabetical order)
00030 // ***************************************************
00031 
00032 PerValidate::PerValidate() : fFileName("pervld.root") {
00033   //
00034   //  Purpose:  Default constructor.
00035   //
00036   //  Arguments: none.
00037   //
00038   //  Return:    n/a.
00039   //
00040   //  Contact:   S. Kasahara
00041   // 
00042 
00043 }
00044 
00045 PerValidate::~PerValidate() {
00046   //
00047   //  Purpose:  Destructor.
00048   //
00049   //  Contact:   S. Kasahara
00050   // 
00051 
00052 }
00053 
00054 bool PerValidate::StreamTagsSeq() {
00055   //
00056   //  Purpose:  Test sequencing and grouping of record tags on individual
00057   //            streams.
00058   //
00059   //  Arguments: none.
00060   //
00061   //  Return:    pass or fail
00062   //
00063   //  Contact:   S. Kasahara
00064   // 
00065   //  Notes: Requires input data from test file "pervld.root"
00066   //
00067 
00068   bool pass = true;
00069 
00070   Int_t snlInd[5][2] = { {0,0},{1,1},{2,2},{3,3},{4,4} };
00071   Int_t monInd[5][2] = { {0,0},{1,3},{4,5},{6,7},{8,9} };
00072 
00073   PerInputStream* instream = dynamic_cast<PerInputStream*>
00074     (fInputStreamManager.GetOpenedStream("DaqSnarl"));
00075   PerRecordTags tags = instream -> NextTags();
00076   Int_t set = -1;
00077   while ( !tags.IsEnd() ) {
00078     set++;
00079     //cout << "NextTags set " << set << ")" << tags << endl;
00080     if ( tags.GetIndexLo() != snlInd[set][0] 
00081       || tags.GetIndexHi() != snlInd[set][1]) {
00082       return false;
00083     }   
00084     tags = instream -> NextTags();
00085   }
00086 
00087   tags = instream -> PrevTags();
00088   while ( !tags.IsBegin() ) {
00089     //cout << "PrevTags set " << set << ")" << tags << endl;
00090     if ( tags.GetIndexLo() != snlInd[set][0] 
00091       || tags.GetIndexHi() != snlInd[set][1]) {
00092       return false;
00093     }   
00094     tags = instream -> PrevTags();   
00095     set--;
00096   }
00097 
00098   tags = instream -> NextTags();
00099   set = -1;
00100   while ( !tags.IsEnd() ) {
00101     set++;
00102     //cout << "NextTags set " << set << ")" << tags << endl;
00103     if ( tags.GetIndexLo() != snlInd[set][0] 
00104       || tags.GetIndexHi() != snlInd[set][1]) {
00105       return false;
00106     }   
00107     tags = instream -> NextTags();
00108   }
00109 
00110   tags = instream -> PrevTags();
00111   while ( !tags.IsBegin() ) {
00112     //cout << "PrevTags set " << set << ")" << tags << endl;
00113     if ( tags.GetIndexLo() != snlInd[set][0] 
00114       || tags.GetIndexHi() != snlInd[set][1]) {
00115       return false;
00116     }   
00117     tags = instream -> PrevTags();   
00118     set--;
00119   }
00120 
00121   instream = dynamic_cast<PerInputStream*>
00122     (fInputStreamManager.GetOpenedStream("DaqMonitor"));
00123   tags = instream -> NextTags();
00124   while ( !tags.IsEnd() ) {
00125     //cout << tags << endl;
00126     set++;
00127     if ( tags.GetIndexLo() != monInd[set][0] 
00128       || tags.GetIndexHi() != monInd[set][1]) {
00129       return false;
00130     }   
00131     tags = instream -> NextTags();   
00132   }
00133 
00134   tags = instream -> PrevTags();
00135   while ( !tags.IsBegin() ) {
00136     //cout << tags << endl;
00137     if ( tags.GetIndexLo() != monInd[set][0] 
00138       || tags.GetIndexHi() != monInd[set][1]) {
00139       return false;
00140     }   
00141     tags = instream -> PrevTags();   
00142     set--;
00143   }
00144 
00145   tags = instream -> NextTags();
00146   while ( !tags.IsEnd() ) {
00147     //cout << tags << endl;
00148     set++;
00149     if ( tags.GetIndexLo() != monInd[set][0] 
00150       || tags.GetIndexHi() != monInd[set][1]) {
00151       return false;
00152     }   
00153     tags = instream -> NextTags();   
00154   }
00155 
00156   tags = instream -> PrevTags();
00157   while ( !tags.IsBegin() ) {
00158     //cout << tags << endl;
00159     if ( tags.GetIndexLo() != monInd[set][0] 
00160       || tags.GetIndexHi() != monInd[set][1]) {
00161       return false;
00162     }   
00163     tags = instream -> PrevTags();   
00164     set--;
00165   }
00166 
00167   return pass;
00168 
00169 }
00170 
00171 bool PerValidate::StreamMgrTagsSeq() {
00172   //
00173   //  Purpose:  Test sequencing and grouping of record tags on individual
00174   //            streams.
00175   //
00176   //  Arguments: none.
00177   //
00178   //  Return:    pass or fail
00179   //
00180   //  Contact:   S. Kasahara
00181   // 
00182   //  Notes: Requires input data from test file "pervld.root"
00183   //
00184 
00185   bool pass = true;
00186 
00187   Int_t fwdInd[10][2] = { {0,0},{1,3},{4,5},{0,0},{1,1},{6,7},{2,2},{3,3},
00188                                                               {4,4},{8,9} };
00189   Int_t rewInd[10][2] = { {8,9},{6,7},{4,4},{3,3},{2,2},{1,1},{0,0},{4,5},
00190                           {1,3},{0,0} };
00191 
00192   MomNavigator* mom = new MomNavigator();
00193   Int_t nadv = fInputStreamManager.Next(mom);
00194   Int_t set = -1;
00195   while ( nadv > 0 ) {
00196     set++;
00197     //cout << "Next advanced " << nadv << " record sets " << endl;
00198     //mom -> GetFragmentArray() -> Print();
00199     TIter fiter = mom ->FragmentIter();
00200     RawRecord* rawrecord;
00201     while ((rawrecord = dynamic_cast<RawRecord*>(fiter.Next())) ) {
00202       //   cout << "Received rawrecord from stream "
00203       //       << rawrecord -> GetTempTags().GetCharString("stream")
00204       //       << " tree " << rawrecord -> GetTempTags().GetCharString("tree")
00205       //       << " index " << rawrecord -> GetTempTags().GetInt("index")
00206       //       << " file " << rawrecord -> GetTempTags().GetCharString("file")
00207       //       << endl;
00208            if ( rawrecord->GetTempTags().GetInt("index") < fwdInd[set][0]
00209               ||rawrecord->GetTempTags().GetInt("index") > fwdInd[set][1] )
00210              return false;
00211     }
00212     mom -> Clear();
00213     nadv = fInputStreamManager.Next(mom);
00214   }
00215 
00216   Int_t nprev = fInputStreamManager.Previous(mom);
00217   set = -1;
00218   while ( nprev > 0 ) {
00219     set++;
00220     //    cout << "Previous rewound " << nprev << " record sets " << endl;
00221     //mom -> GetFragmentArray() -> Print();
00222     TIter fiter = mom ->FragmentIter();
00223     RawRecord* rawrecord;
00224     while ((rawrecord = dynamic_cast<RawRecord*>(fiter.Next())) ) {
00225       //   cout << "Received rawrecord from stream "
00226       //       << rawrecord -> GetTempTags().GetCharString("stream")
00227       //       << " tree " << rawrecord -> GetTempTags().GetCharString("tree")
00228       //       << " index " << rawrecord -> GetTempTags().GetInt("index")
00229       //       << " file " << rawrecord -> GetTempTags().GetCharString("file")
00230       //         << endl;
00231            if ( rawrecord->GetTempTags().GetInt("index") < rewInd[set][0]
00232               ||rawrecord->GetTempTags().GetInt("index") > rewInd[set][1] )
00233              return false;
00234     }
00235     mom -> Clear();
00236     nprev = fInputStreamManager.Previous(mom);
00237   }
00238 
00239   nadv = fInputStreamManager.Next(mom);
00240   set = -1;
00241   while ( nadv > 0 ) {
00242     set++;
00243     //cout << "Next advanced " << nadv << " record sets " << endl;
00244     //mom -> GetFragmentArray() -> Print();
00245     TIter fiter = mom ->FragmentIter();
00246     RawRecord* rawrecord;
00247     while ((rawrecord = dynamic_cast<RawRecord*>(fiter.Next())) ) {
00248       //  cout << "Received rawrecord from stream "
00249       //       << rawrecord -> GetTempTags().GetCharString("stream")
00250       //       << " tree " << rawrecord -> GetTempTags().GetCharString("tree")
00251       //       << " index " << rawrecord -> GetTempTags().GetInt("index")
00252       //       << " file " << rawrecord -> GetTempTags().GetCharString("file")
00253       //       << endl;
00254            if ( rawrecord->GetTempTags().GetInt("index") < fwdInd[set][0]
00255               ||rawrecord->GetTempTags().GetInt("index") > fwdInd[set][1] )
00256              return false;
00257     }
00258     mom -> Clear();
00259     nadv = fInputStreamManager.Next(mom);
00260   }
00261 
00262   nprev = fInputStreamManager.Previous(mom);
00263   set = -1;
00264   while ( nprev > 0 ) {
00265     set++;
00266     //    cout << "Previous rewound " << nprev << " record sets " << endl;
00267     //mom -> GetFragmentArray() -> Print();
00268     TIter fiter = mom ->FragmentIter();
00269     RawRecord* rawrecord;
00270     while ((rawrecord = dynamic_cast<RawRecord*>(fiter.Next())) ) {
00271       //     cout << "Received rawrecord from stream "
00272       //       << rawrecord -> GetTempTags().GetCharString("stream")
00273       //       << " tree " << rawrecord -> GetTempTags().GetCharString("tree")
00274       //       << " index " << rawrecord -> GetTempTags().GetInt("index")
00275       //       << " file " << rawrecord -> GetTempTags().GetCharString("file")
00276       //       << endl;
00277            if ( rawrecord->GetTempTags().GetInt("index") < rewInd[set][0]
00278               ||rawrecord->GetTempTags().GetInt("index") > rewInd[set][1] )
00279              return false;
00280     }
00281     mom -> Clear();
00282     nprev = fInputStreamManager.Previous(mom);
00283   }
00284   if ( mom ) delete mom; mom = 0;
00285 
00286   return pass;
00287 
00288 }
00289 
00290 bool PerValidate::StreamMgrParallelFileSeq() {
00291   //
00292   //  Purpose:  Test sequencing and grouping of record tags on individual
00293   //            streams when those streams are read from separate files in
00294   //            parallel.
00295   //
00296   //  Arguments: none.
00297   //
00298   //  Return:    pass or fail
00299   //
00300   //  Contact:   S. Kasahara
00301   // 
00302   //  Notes: Requires input data from test file "pervld.root" and from
00303   //         "pervld2.root"
00304   //
00305 
00306   bool pass = true;
00307 
00308   Int_t fwdInd[20][2] = { {0,0},{1,3},{4,5},{0,0},{1,1},{6,7},{2,2},{3,3},
00309                                                               {4,4},{8,9},
00310                           {0,0},{0,1},{1,1},{2,2},{3,3},{2,3},{4,5},{6,7},
00311                                                               {4,4},{5,5} };
00312   Int_t rewInd[20][2] = { {5,5},{4,4},{6,7},{4,5},{2,3},{3,3},{2,2},{1,1},
00313                           {0,1},{0,0},
00314                           {8,9},{6,7},{4,4},{3,3},{2,2},{1,1},{0,0},{4,5},
00315                           {1,3},{0,0} };
00316 
00317   fInputStreamManager.CloseFile();
00318   fInputStreamManager.AddFile("pervld.root",-1,"DaqSnarl");
00319   fInputStreamManager.AddFile("pervld2.root",-1,"DaqSnarl");
00320   fInputStreamManager.AddFile("pervld.root",-1,"DaqMonitor");
00321   fInputStreamManager.AddFile("pervld2.root",-1,"DaqMonitor");
00322 
00323   MomNavigator* mom = new MomNavigator();
00324   Int_t nadv = fInputStreamManager.Next(mom);
00325   Int_t set = -1;
00326   while ( nadv > 0 ) {
00327     set++;
00328     //cout << "Next advanced " << nadv << " record sets " << endl;
00329     TIter fiter = mom ->FragmentIter();
00330     RawRecord* rawrecord;
00331     while ((rawrecord = dynamic_cast<RawRecord*>(fiter.Next())) ) {
00332       //cout << "Received rawrecord from stream "
00333       //      << rawrecord -> GetTempTags().GetCharString("stream")
00334       //       << " tree " << rawrecord -> GetTempTags().GetCharString("tree")
00335       //       << " index " << rawrecord -> GetTempTags().GetInt("index")
00336       //       << " file " << rawrecord -> GetTempTags().GetCharString("file")
00337       //       << endl;
00338       //  cout << *(rawrecord->GetVldContext()) << endl;
00339         if ( rawrecord->GetTempTags().GetInt("index") < fwdInd[set][0]
00340               ||rawrecord->GetTempTags().GetInt("index") > fwdInd[set][1] )
00341              return false;
00342     }
00343     mom -> Clear();
00344     nadv = fInputStreamManager.Next(mom);
00345   }
00346 
00347   Int_t nprev = fInputStreamManager.Previous(mom);
00348   set = -1;
00349   while ( nprev > 0 ) {
00350     set++;
00351     //cout << "Previous rewound " << nprev << " record sets " << endl;
00352     TIter fiter = mom ->FragmentIter();
00353     RawRecord* rawrecord;
00354     while ((rawrecord = dynamic_cast<RawRecord*>(fiter.Next())) ) {
00355       //   cout << "Received rawrecord from stream "
00356       //       << rawrecord -> GetTempTags().GetCharString("stream")
00357       //       << " tree " << rawrecord -> GetTempTags().GetCharString("tree")
00358       //       << " index " << rawrecord -> GetTempTags().GetInt("index")
00359       //       << " file " << rawrecord -> GetTempTags().GetCharString("file")
00360       //       << endl;
00361       //  cout << *(rawrecord->GetVldContext()) << endl;
00362           if ( rawrecord->GetTempTags().GetInt("index") < rewInd[set][0]
00363               ||rawrecord->GetTempTags().GetInt("index") > rewInd[set][1] )
00364              return false;
00365     }
00366     mom -> Clear();
00367     nprev = fInputStreamManager.Previous(mom);
00368   }
00369 
00370   nadv = fInputStreamManager.Next(mom);
00371   set = -1;
00372   while ( nadv > 0 ) {
00373     set++;
00374     //cout << "Next advanced " << nadv << " record sets " << endl;
00375     TIter fiter = mom ->FragmentIter();
00376     RawRecord* rawrecord;
00377     while ((rawrecord = dynamic_cast<RawRecord*>(fiter.Next())) ) {
00378       //  cout << "Received rawrecord from stream "
00379       //       << rawrecord -> GetTempTags().GetCharString("stream")
00380       //       << " tree " << rawrecord -> GetTempTags().GetCharString("tree")
00381       //       << " index " << rawrecord -> GetTempTags().GetInt("index")
00382       //        << " file " << rawrecord -> GetTempTags().GetCharString("file")
00383       //       << endl;
00384            if ( rawrecord->GetTempTags().GetInt("index") < fwdInd[set][0]
00385               ||rawrecord->GetTempTags().GetInt("index") > fwdInd[set][1] )
00386              return false;
00387     }
00388     mom -> Clear();
00389     nadv = fInputStreamManager.Next(mom);
00390   }
00391 
00392   nprev = fInputStreamManager.Previous(mom);
00393   set = -1;
00394   while ( nprev > 0 ) {
00395     set++;
00396     //    cout << "Previous rewound " << nprev << " record sets " << endl;
00397     TIter fiter = mom ->FragmentIter();
00398     RawRecord* rawrecord;
00399     while ((rawrecord = dynamic_cast<RawRecord*>(fiter.Next())) ) {
00400       //        cout << "Received rawrecord from stream "
00401       //       << rawrecord -> GetTempTags().GetCharString("stream")
00402       //       << " tree " << rawrecord -> GetTempTags().GetCharString("tree")
00403       //       << " index " << rawrecord -> GetTempTags().GetInt("index")
00404       //       << " file " << rawrecord -> GetTempTags().GetCharString("file")
00405       //       << endl;
00406            if ( rawrecord->GetTempTags().GetInt("index") < rewInd[set][0]
00407               ||rawrecord->GetTempTags().GetInt("index") > rewInd[set][1] )
00408              return false;
00409     }
00410     mom -> Clear();
00411     nprev = fInputStreamManager.Previous(mom);
00412   }
00413   if ( mom ) delete mom; mom = 0;
00414 
00415   cout << "Resetting file list " << endl;
00416   fInputStreamManager.RecordsAt(0,Per::GetVldEnd());
00417   fInputStreamManager.RemoveFile();
00418 
00419   fInputStreamManager.CloseFile();
00420   fInputStreamManager.SetFile("*",fFileName,Per::kRead);
00421 
00422   return pass;
00423 
00424 }
00425 
00426 bool PerValidate::StreamMgrFileChangeSeq() {
00427   //
00428   //  Purpose:  Test sequencing and grouping of record tags on individual
00429   //            streams.
00430   //
00431   //  Arguments: none.
00432   //
00433   //  Return:    pass or fail
00434   //
00435   //  Contact:   S. Kasahara
00436   // 
00437   //  Notes: Requires input data from test file "pervld.root"
00438   //
00439 
00440   bool pass = true;
00441 
00442   Int_t fwdInd[10][2] = { {0,0},{1,3},{4,5},{0,0},{1,1},{6,7},{2,2},{3,3},
00443                                                               {4,4},{8,9} };
00444   Int_t rewInd[10][2] = { {8,9},{6,7},{4,4},{3,3},{2,2},{1,1},{0,0},{4,5},
00445                           {1,3},{0,0} };
00446 
00447   MomNavigator* mom = new MomNavigator();
00448   Int_t nadv = fInputStreamManager.Next(mom);
00449   Int_t set = -1;
00450   while ( nadv > 0 ) {
00451     set++;
00452     //cout << "Next advanced " << nadv << " record sets " << endl;
00453     //mom -> GetFragmentArray() -> Print();
00454     TIter fiter = mom ->FragmentIter();
00455     RawRecord* rawrecord;
00456     while ((rawrecord = dynamic_cast<RawRecord*>(fiter.Next())) ) {
00457       //     cout << "Received rawrecord from stream "
00458       //       << rawrecord -> GetTempTags().GetCharString("stream")
00459       //       << " tree " << rawrecord -> GetTempTags().GetCharString("tree")
00460       //       << " index " << rawrecord -> GetTempTags().GetInt("index")
00461       //       << " file " << rawrecord -> GetTempTags().GetCharString("file")
00462       //       << endl;
00463            if ( rawrecord->GetTempTags().GetInt("index") < fwdInd[set][0]
00464               ||rawrecord->GetTempTags().GetInt("index") > fwdInd[set][1] )
00465              return false;
00466     }
00467     mom -> Clear();
00468     nadv = fInputStreamManager.Next(mom);
00469   }
00470 
00471   Int_t nprev = fInputStreamManager.Previous(mom);
00472   set = -1;
00473   while ( nprev > 0 ) {
00474     set++;
00475     //    cout << "Previous rewound " << nprev << " record sets " << endl;
00476     //mom -> GetFragmentArray() -> Print();
00477     TIter fiter = mom ->FragmentIter();
00478     RawRecord* rawrecord;
00479     while ((rawrecord = dynamic_cast<RawRecord*>(fiter.Next())) ) {
00480       //     cout << "Received rawrecord from stream "
00481       //      << rawrecord -> GetTempTags().GetCharString("stream")
00482       //       << " tree " << rawrecord -> GetTempTags().GetCharString("tree")
00483       //       << " index " << rawrecord -> GetTempTags().GetInt("index")
00484       //       << " file " << rawrecord -> GetTempTags().GetCharString("file")
00485       //       << endl;
00486            if ( rawrecord->GetTempTags().GetInt("index") < rewInd[set][0]
00487               ||rawrecord->GetTempTags().GetInt("index") > rewInd[set][1] )
00488              return false;
00489     }
00490     mom -> Clear();
00491     nprev = fInputStreamManager.Previous(mom);
00492   }
00493 
00494   fInputStreamManager.CloseFile();
00495   fInputStreamManager.SetFile("*",fFileName,Per::kRead);
00496 
00497   nadv = fInputStreamManager.Next(mom);
00498   set = -1;
00499   while ( nadv > 0 ) {
00500     set++;
00501     //cout << "Next advanced " << nadv << " record sets " << endl;
00502     TIter fiter = mom ->FragmentIter();
00503     RawRecord* rawrecord;
00504     while ((rawrecord = dynamic_cast<RawRecord*>(fiter.Next())) ) {
00505       //           cout << "Received rawrecord from stream "
00506       //    << rawrecord -> GetTempTags().GetCharString("stream")
00507       //       << " tree " << rawrecord -> GetTempTags().GetCharString("tree")
00508       //       << " index " << rawrecord -> GetTempTags().GetInt("index")
00509       //       << " file " << rawrecord -> GetTempTags().GetCharString("file")
00510       //       << endl;
00511            if ( rawrecord->GetTempTags().GetInt("index") < fwdInd[set][0]
00512               ||rawrecord->GetTempTags().GetInt("index") > fwdInd[set][1] )
00513              return false;
00514     }
00515     mom -> Clear();
00516     nadv = fInputStreamManager.Next(mom);
00517   }
00518 
00519   nprev = fInputStreamManager.Previous(mom);
00520   set = -1;
00521   while ( nprev > 0 ) {
00522     set++;
00523     //cout << "Previous rewound " << nprev << " record sets " << endl;
00524     //mom -> GetFragmentArray() -> Print();
00525     TIter fiter = mom ->FragmentIter();
00526     RawRecord* rawrecord;
00527     while ((rawrecord = dynamic_cast<RawRecord*>(fiter.Next())) ) {
00528       //     cout << "Received rawrecord from stream "
00529       //         << rawrecord -> GetTempTags().GetCharString("stream")
00530       //       << " tree " << rawrecord -> GetTempTags().GetCharString("tree")
00531       //    << " index " << rawrecord -> GetTempTags().GetInt("index")
00532       //       << " file " << rawrecord -> GetTempTags().GetCharString("file")
00533       //       << endl;
00534            if ( rawrecord->GetTempTags().GetInt("index") < rewInd[set][0]
00535               ||rawrecord->GetTempTags().GetInt("index") > rewInd[set][1] )
00536              return false;
00537     }
00538     mom -> Clear();
00539     nprev = fInputStreamManager.Previous(mom);
00540   }
00541   if ( mom ) delete mom; mom = 0;
00542 
00543   return pass;
00544 
00545 }
00546 
00547 bool PerValidate::StreamMgrTagsSeqZigZag() {
00548   //
00549   //  Purpose:  Test sequencing and grouping of record tags on individual
00550   //            streams. Reverse and move forward again part-way through set.
00551   //
00552   //  Arguments: none.
00553   //
00554   //  Return:    pass or fail
00555   //
00556   //  Contact:   S. Kasahara
00557   // 
00558   //  Notes: Requires input data from test file "pervld.root"
00559   //
00560 
00561   bool pass = true;
00562 
00563   Int_t fwdInd[4][2] = { {0,0},{1,3},{4,5},{0,0} };
00564   Int_t rewInd[4][2] = { {4,5},{1,3} };
00565   Int_t fwdInd2[8][2] = { {4,5},{0,0},{1,1},{6,7},{2,2},{3,3},{4,4},{8,9} };
00566   Int_t rewInd2[10][2] = { {8,9},{6,7},{4,4},{3,3},{2,2},{1,1},{0,0},{4,5},
00567                           {1,3},{0,0} };
00568 
00569   MomNavigator* mom = new MomNavigator();
00570   Int_t nadv = fInputStreamManager.Next(mom);
00571   Int_t set = -1;
00572   while ( nadv > 0 && set < 3 ) {
00573     set++;
00574     //cout << "Next advanced " << nadv << " record sets " << endl;
00575     TIter fiter = mom ->FragmentIter();
00576     RawRecord* rawrecord;
00577     while ((rawrecord = dynamic_cast<RawRecord*>(fiter.Next())) ) {
00578       //     cout << "Received rawrecord from stream "
00579       //         << rawrecord -> GetTempTags().GetCharString("stream")
00580       //       << " tree " << rawrecord -> GetTempTags().GetCharString("tree")
00581       //       << " index " << rawrecord -> GetTempTags().GetInt("index")
00582       //       << " file " << rawrecord -> GetTempTags().GetCharString("file")
00583       //       << endl;
00584            if ( rawrecord->GetTempTags().GetInt("index") < fwdInd[set][0]
00585               ||rawrecord->GetTempTags().GetInt("index") > fwdInd[set][1] )
00586              return false;
00587     }
00588     mom -> Clear();
00589     if ( set < 3 ) nadv = fInputStreamManager.Next(mom);
00590   }
00591 
00592   Int_t nprev = fInputStreamManager.Previous(mom);
00593   set = -1;
00594   while ( nprev > 0 && set < 1 ) {
00595     set++;
00596     //cout << "Previous rewound " << nprev << " record sets " << endl;
00597     //mom -> GetFragmentArray() -> Print();
00598     TIter fiter = mom ->FragmentIter();
00599     RawRecord* rawrecord;
00600     while ((rawrecord = dynamic_cast<RawRecord*>(fiter.Next())) ) {
00601       //     cout << "Received rawrecord from stream "
00602       //       << rawrecord -> GetTempTags().GetCharString("stream")
00603       //       << " tree " << rawrecord -> GetTempTags().GetCharString("tree")
00604       //       << " index " << rawrecord -> GetTempTags().GetInt("index")
00605       //       << " file " << rawrecord -> GetTempTags().GetCharString("file")
00606       //       << endl;
00607            if ( rawrecord->GetTempTags().GetInt("index") < rewInd[set][0]
00608               ||rawrecord->GetTempTags().GetInt("index") > rewInd[set][1] )
00609              return false;
00610     }
00611     mom -> Clear();
00612     if ( set < 1 ) nprev = fInputStreamManager.Previous(mom);
00613   }
00614 
00615   nadv = fInputStreamManager.Next(mom);
00616   set = -1;
00617   while ( nadv > 0 ) {
00618     set++;
00619     //cout << "Next advanced " << nadv << " record sets " << endl;
00620     TIter fiter = mom ->FragmentIter();
00621     RawRecord* rawrecord;
00622     while ((rawrecord = dynamic_cast<RawRecord*>(fiter.Next())) ) {
00623       //    cout << "Received rawrecord from stream "
00624       //       << rawrecord -> GetTempTags().GetCharString("stream")
00625       //       << " tree " << rawrecord -> GetTempTags().GetCharString("tree")
00626       //       << " index " << rawrecord -> GetTempTags().GetInt("index")
00627       //       << " file " << rawrecord -> GetTempTags().GetCharString("file")
00628       //       << endl;
00629            if ( rawrecord->GetTempTags().GetInt("index") < fwdInd2[set][0]
00630               ||rawrecord->GetTempTags().GetInt("index") > fwdInd2[set][1] )
00631              return false;
00632     }
00633     mom -> Clear();
00634     nadv = fInputStreamManager.Next(mom);
00635   }
00636 
00637   nprev = fInputStreamManager.Previous(mom);
00638   set = -1;
00639   while ( nprev > 0 ) {
00640     set++;
00641     //cout << "Previous rewound " << nprev << " record sets " << endl;
00642     TIter fiter = mom ->FragmentIter();
00643     RawRecord* rawrecord;
00644     while ((rawrecord = dynamic_cast<RawRecord*>(fiter.Next())) ) {
00645       //     cout << "Received rawrecord from stream "
00646       //        << rawrecord -> GetTempTags().GetCharString("stream")
00647       //      << " tree " << rawrecord -> GetTempTags().GetCharString("tree")
00648       //     << " index " << rawrecord -> GetTempTags().GetInt("index")
00649       //       << " file " << rawrecord -> GetTempTags().GetCharString("file")
00650       //      << endl;
00651            if ( rawrecord->GetTempTags().GetInt("index") < rewInd2[set][0]
00652               ||rawrecord->GetTempTags().GetInt("index") > rewInd2[set][1] )
00653              return false;
00654     }
00655     mom -> Clear();
00656     nprev = fInputStreamManager.Previous(mom);
00657   }
00658   if ( mom ) delete mom; mom = 0;
00659 
00660   return pass;
00661 
00662 }
00663 
00664 bool PerValidate::StreamMgrSelectionSeq() {
00665   //
00666   //  Purpose:  Test sequencing and grouping of record tags on individual
00667   //            streams with selection cut applied.
00668   //
00669   //  Arguments: none.
00670   //
00671   //  Return:    pass or fail
00672   //
00673   //  Contact:   S. Kasahara
00674   // 
00675   //  Notes: Requires input data from test file "pervld.root"
00676   //
00677 
00678   bool pass = true;
00679 
00680   Int_t fwdInd[3][2] = { {4,5},{3,3} };
00681   Int_t rewInd[3][2] = { {4,4},{4,5} };
00682 
00683   fInputStreamManager.SetSelection("DaqSnarl",
00684                  "((RawDaqSnarlHeader*)fHeader)->GetSnarl()>1");
00685   MomNavigator* mom = new MomNavigator();
00686   Int_t nadv = fInputStreamManager.Next(mom,3);
00687   
00688   Int_t set = -1;
00689   while ( nadv > 0 ) {
00690     set++;
00691     //cout << "Next advanced " << nadv << " record sets " << endl;
00692     TIter fiter = mom ->FragmentIter();
00693     RawRecord* rawrecord;
00694     while ((rawrecord = dynamic_cast<RawRecord*>(fiter.Next())) ) {
00695       //    cout << "Received rawrecord from stream "
00696       //       << rawrecord -> GetTempTags().GetCharString("stream")
00697       //       << " tree " << rawrecord -> GetTempTags().GetCharString("tree")
00698       //       << " index " << rawrecord -> GetTempTags().GetInt("index")
00699       //       << " file " << rawrecord -> GetTempTags().GetCharString("file")
00700       //       << endl;
00701            if ( rawrecord->GetTempTags().GetInt("index") < fwdInd[set][0]
00702               ||rawrecord->GetTempTags().GetInt("index") > fwdInd[set][1] )
00703              return false;
00704     }
00705     mom -> Clear();
00706     nadv = fInputStreamManager.Next(mom,3);
00707   }
00708 
00709   Int_t nprev = fInputStreamManager.Previous(mom,3);
00710   set = -1;
00711   while ( nprev > 0 ) {
00712     set++;
00713     //    cout << "Previous rewound " << nprev << " record sets " << endl;
00714     TIter fiter = mom ->FragmentIter();
00715     RawRecord* rawrecord;
00716     while ((rawrecord = dynamic_cast<RawRecord*>(fiter.Next())) ) {
00717       //     cout << "Received rawrecord from stream "
00718       //         << rawrecord -> GetTempTags().GetCharString("stream")
00719       //       << " tree " << rawrecord -> GetTempTags().GetCharString("tree")
00720       //       << " index " << rawrecord -> GetTempTags().GetInt("index")
00721       //       << " file " << rawrecord -> GetTempTags().GetCharString("file")
00722       //       << endl;
00723            if ( rawrecord->GetTempTags().GetInt("index") < rewInd[set][0]
00724               ||rawrecord->GetTempTags().GetInt("index") > rewInd[set][1] )
00725              return false;
00726     }
00727     mom -> Clear();
00728     nprev = fInputStreamManager.Previous(mom,3);
00729   }
00730 
00731   nadv = fInputStreamManager.Next(mom,3);
00732   set = -1;
00733   while ( nadv > 0 ) {
00734     set++;
00735     //cout << "Next advanced " << nadv << " record sets " << endl;
00736     TIter fiter = mom ->FragmentIter();
00737     RawRecord* rawrecord;
00738     while ((rawrecord = dynamic_cast<RawRecord*>(fiter.Next())) ) {
00739       //   cout << "Received rawrecord from stream "
00740       //       << rawrecord -> GetTempTags().GetCharString("stream")
00741       //       << " tree " << rawrecord -> GetTempTags().GetCharString("tree")
00742       //       << " index " << rawrecord -> GetTempTags().GetInt("index")
00743       //       << " file " << rawrecord -> GetTempTags().GetCharString("file")
00744       //       << endl;
00745            if ( rawrecord->GetTempTags().GetInt("index") < fwdInd[set][0]
00746               ||rawrecord->GetTempTags().GetInt("index") > fwdInd[set][1] )
00747              return false;
00748     }
00749     mom -> Clear();
00750     nadv = fInputStreamManager.Next(mom,3);
00751   }
00752 
00753   nprev = fInputStreamManager.Previous(mom,3);
00754   set = -1;
00755   while ( nprev > 0 ) {
00756     set++;
00757     //cout << "Previous rewound " << nprev << " record sets " << endl;
00758     TIter fiter = mom ->FragmentIter();
00759     RawRecord* rawrecord;
00760     while ((rawrecord = dynamic_cast<RawRecord*>(fiter.Next())) ) {
00761       //     cout << "Received rawrecord from stream "
00762       //      << rawrecord -> GetTempTags().GetCharString("stream")
00763       //      << " tree " << rawrecord -> GetTempTags().GetCharString("tree")
00764       //     << " index " << rawrecord -> GetTempTags().GetInt("index")
00765       //       << " file " << rawrecord -> GetTempTags().GetCharString("file")
00766       //       << endl;
00767            if ( rawrecord->GetTempTags().GetInt("index") < rewInd[set][0]
00768               ||rawrecord->GetTempTags().GetInt("index") > rewInd[set][1] )
00769              return false;
00770     }
00771     mom -> Clear();
00772     nprev = fInputStreamManager.Previous(mom,3);
00773   }
00774   if ( mom ) delete mom; mom = 0;
00775 
00776   fInputStreamManager.SetSelection("DaqSnarl","");
00777 
00778   return pass;
00779 
00780 }
00781 
00782 bool PerValidate::StreamMgrSkipByTwoSeq() {
00783   //
00784   //  Purpose:  Test sequencing of records while advancing by two
00785   //
00786   //  Arguments: none.
00787   //
00788   //  Return:    pass or fail
00789   //
00790   //  Contact:   S. Kasahara
00791   // 
00792   //  Notes: Requires input data from test file "pervld.root"
00793   //
00794 
00795   bool pass = true;
00796 
00797   Int_t fwdInd[5][2] = { {1,3},{0,0},{6,7},{3,3},{8,9} };
00798   Int_t rewInd[5][2] = { {6,7},{3,3},{1,1},{4,5},{0,0} };
00799 
00800   MomNavigator* mom = new MomNavigator();
00801   Int_t nadv = fInputStreamManager.Next(mom,2);
00802   Int_t set = -1;
00803   while ( nadv > 0 ) {
00804     set++;
00805     //cout << "Next advanced " << nadv << " record sets " << endl;
00806     TIter fiter = mom ->FragmentIter();
00807     RawRecord* rawrecord;
00808     while ((rawrecord = dynamic_cast<RawRecord*>(fiter.Next())) ) {
00809       //     cout << "Received rawrecord from stream "
00810       //         << rawrecord -> GetTempTags().GetCharString("stream")
00811       //       << " tree " << rawrecord -> GetTempTags().GetCharString("tree")
00812       //      << " index " << rawrecord -> GetTempTags().GetInt("index")
00813       //       << " file " << rawrecord -> GetTempTags().GetCharString("file")
00814       //       << endl;
00815            if ( rawrecord->GetTempTags().GetInt("index") < fwdInd[set][0]
00816               ||rawrecord->GetTempTags().GetInt("index") > fwdInd[set][1] )
00817              return false;
00818     }
00819     mom -> Clear();
00820     nadv = fInputStreamManager.Next(mom,2);
00821   }
00822 
00823   Int_t nprev = fInputStreamManager.Previous(mom,2);
00824   set = -1;
00825   while ( nprev > 0 ) {
00826     set++;
00827     //cout << "Previous rewound " << nprev << " record sets " << endl;
00828     TIter fiter = mom ->FragmentIter();
00829     RawRecord* rawrecord;
00830     while ((rawrecord = dynamic_cast<RawRecord*>(fiter.Next())) ) {
00831       //      cout << "Received rawrecord from stream "
00832       //         << rawrecord -> GetTempTags().GetCharString("stream")
00833       //       << " tree " << rawrecord -> GetTempTags().GetCharString("tree")
00834       //       << " index " << rawrecord -> GetTempTags().GetInt("index")
00835       //       << " file " << rawrecord -> GetTempTags().GetCharString("file")
00836       //       << endl;
00837            if ( rawrecord->GetTempTags().GetInt("index") < rewInd[set][0]
00838               ||rawrecord->GetTempTags().GetInt("index") > rewInd[set][1] )
00839              return false;
00840     }
00841     mom -> Clear();
00842     nprev = fInputStreamManager.Previous(mom,2);
00843   }
00844 
00845   nadv = fInputStreamManager.Next(mom,2);
00846   set = -1;
00847   while ( nadv > 0 ) {
00848     set++;
00849     //cout << "Next advanced " << nadv << " record sets " << endl;
00850     TIter fiter = mom ->FragmentIter();
00851     RawRecord* rawrecord;
00852     while ((rawrecord = dynamic_cast<RawRecord*>(fiter.Next())) ) {
00853       //     cout << "Received rawrecord from stream "
00854       //       << rawrecord -> GetTempTags().GetCharString("stream")
00855       //       << " tree " << rawrecord -> GetTempTags().GetCharString("tree")
00856       //       << " index " << rawrecord -> GetTempTags().GetInt("index")
00857       //       << " file " << rawrecord -> GetTempTags().GetCharString("file")
00858       //       << endl;
00859            if ( rawrecord->GetTempTags().GetInt("index") < fwdInd[set][0]
00860               ||rawrecord->GetTempTags().GetInt("index") > fwdInd[set][1] )
00861              return false;
00862     }
00863     mom -> Clear();
00864     nadv = fInputStreamManager.Next(mom,2);
00865   }
00866 
00867   nprev = fInputStreamManager.Previous(mom,2);
00868   set = -1;
00869   while ( nprev > 0 ) {
00870     set++;
00871     //cout << "Previous rewound " << nprev << " record sets " << endl;
00872     TIter fiter = mom ->FragmentIter();
00873     RawRecord* rawrecord;
00874     while ((rawrecord = dynamic_cast<RawRecord*>(fiter.Next())) ) {
00875       //     cout << "Received rawrecord from stream "
00876       //       << rawrecord -> GetTempTags().GetCharString("stream")
00877       //       << " tree " << rawrecord -> GetTempTags().GetCharString("tree")
00878       //       << " index " << rawrecord -> GetTempTags().GetInt("index")
00879       //       << " file " << rawrecord -> GetTempTags().GetCharString("file")
00880       //       << endl;
00881            if ( rawrecord->GetTempTags().GetInt("index") < rewInd[set][0]
00882               ||rawrecord->GetTempTags().GetInt("index") > rewInd[set][1] )
00883              return false;
00884     }
00885     mom -> Clear();
00886     nprev = fInputStreamManager.Previous(mom,2);
00887   }
00888   if ( mom ) delete mom; mom = 0;
00889 
00890   return pass;
00891 
00892 }
00893 
00894 bool PerValidate::StreamMgrSkipByThreeSeq() {
00895   //
00896   //  Purpose:  Test sequencing and grouping of record tags on individual
00897   //            streams with selection cut applied.
00898   //
00899   //  Arguments: none.
00900   //
00901   //  Return:    pass or fail
00902   //
00903   //  Contact:   S. Kasahara
00904   // 
00905   //  Notes: Requires input data from test file "pervld.root"
00906   //
00907 
00908   bool pass = true;
00909 
00910   Int_t fwdInd[3][2] = { {4,5},{6,7},{4,4} };
00911   Int_t rewInd[3][2] = { {4,4},{1,1},{1,3} };
00912 
00913   MomNavigator* mom = new MomNavigator();
00914   Int_t nadv = fInputStreamManager.Next(mom,3);
00915   
00916   Int_t set = -1;
00917   while ( nadv > 0 ) {
00918     set++;
00919     //cout << "Next advanced " << nadv << " record sets " << endl;
00920     TIter fiter = mom ->FragmentIter();
00921     RawRecord* rawrecord;
00922     while ((rawrecord = dynamic_cast<RawRecord*>(fiter.Next())) ) {
00923       //     cout << "Received rawrecord from stream "
00924       //       << rawrecord -> GetTempTags().GetCharString("stream")
00925       //       << " tree " << rawrecord -> GetTempTags().GetCharString("tree")
00926       //       << " index " << rawrecord -> GetTempTags().GetInt("index")
00927       //       << " file " << rawrecord -> GetTempTags().GetCharString("file")
00928       //       << endl;
00929            if ( rawrecord->GetTempTags().GetInt("index") < fwdInd[set][0]
00930               ||rawrecord->GetTempTags().GetInt("index") > fwdInd[set][1] )
00931              return false;
00932     }
00933     mom -> Clear();
00934     nadv = fInputStreamManager.Next(mom,3);
00935   }
00936 
00937   Int_t nprev = fInputStreamManager.Previous(mom,3);
00938   set = -1;
00939   while ( nprev > 0 ) {
00940     set++;
00941     //cout << "Previous rewound " << nprev << " record sets " << endl;
00942     TIter fiter = mom ->FragmentIter();
00943     RawRecord* rawrecord;
00944     while ((rawrecord = dynamic_cast<RawRecord*>(fiter.Next())) ) {
00945       //     cout << "Received rawrecord from stream "
00946       //         << rawrecord -> GetTempTags().GetCharString("stream")
00947       //       << " tree " << rawrecord -> GetTempTags().GetCharString("tree")
00948       //       << " index " << rawrecord -> GetTempTags().GetInt("index")
00949       //       << " file " << rawrecord -> GetTempTags().GetCharString("file")
00950       //       << endl;
00951            if ( rawrecord->GetTempTags().GetInt("index") < rewInd[set][0]
00952               ||rawrecord->GetTempTags().GetInt("index") > rewInd[set][1] )
00953              return false;
00954     }
00955     mom -> Clear();
00956     nprev = fInputStreamManager.Previous(mom,3);
00957   }
00958 
00959   nadv = fInputStreamManager.Next(mom,3);
00960   set = -1;
00961   while ( nadv > 0 ) {
00962     set++;
00963     //cout << "Next advanced " << nadv << " record sets " << endl;
00964     TIter fiter = mom ->FragmentIter();
00965     RawRecord* rawrecord;
00966     while ((rawrecord = dynamic_cast<RawRecord*>(fiter.Next())) ) {
00967       //     cout << "Received rawrecord from stream "
00968       //       << rawrecord -> GetTempTags().GetCharString("stream")
00969       //       << " tree " << rawrecord -> GetTempTags().GetCharString("tree")
00970       //       << " index " << rawrecord -> GetTempTags().GetInt("index")
00971       //       << " file " << rawrecord -> GetTempTags().GetCharString("file")
00972       //       << endl;
00973            if ( rawrecord->GetTempTags().GetInt("index") < fwdInd[set][0]
00974               ||rawrecord->GetTempTags().GetInt("index") > fwdInd[set][1] )
00975              return false;
00976     }
00977     mom -> Clear();
00978     nadv = fInputStreamManager.Next(mom,3);
00979   }
00980 
00981   nprev = fInputStreamManager.Previous(mom,3);
00982   set = -1;
00983   while ( nprev > 0 ) {
00984     set++;
00985     //cout << "Previous rewound " << nprev << " record sets " << endl;
00986     TIter fiter = mom ->FragmentIter();
00987     RawRecord* rawrecord;
00988     while ((rawrecord = dynamic_cast<RawRecord*>(fiter.Next())) ) {
00989       //     cout << "Received rawrecord from stream "
00990       //       << rawrecord -> GetTempTags().GetCharString("stream")
00991       //       << " tree " << rawrecord -> GetTempTags().GetCharString("tree")
00992       //       << " index " << rawrecord -> GetTempTags().GetInt("index")
00993       //       << " file " << rawrecord -> GetTempTags().GetCharString("file")
00994       //       << endl;
00995            if ( rawrecord->GetTempTags().GetInt("index") < rewInd[set][0]
00996               ||rawrecord->GetTempTags().GetInt("index") > rewInd[set][1] )
00997              return false;
00998     }
00999     mom -> Clear();
01000     nprev = fInputStreamManager.Previous(mom,3);
01001   }
01002   if ( mom ) delete mom; mom = 0;
01003 
01004   return pass;
01005 
01006 }
01007 
01008 bool PerValidate::StreamFileAdd() {
01009   //
01010   //  Purpose:  Test addition of files to stream file list.
01011   //
01012   //  Arguments: none.
01013   //
01014   //  Return:    pass or fail
01015   //
01016   //  Contact:   S. Kasahara
01017   // 
01018 
01019    cout << "Before: " << endl;
01020   fInputStreamManager.ListFile(cout); 
01021   fInputStreamManager.AddFile("pervld.root");
01022   fInputStreamManager.AddFile("pervld2.root");
01023   fInputStreamManager.AddFile("pervld3.root",0);
01024   fInputStreamManager.AddFile("pervld4.root",1);
01025   cout << "After adding pervld at end, 2 at end, 3 at 0, 4 at 1: " << endl;
01026   fInputStreamManager.ListFile(cout);
01027 
01028   return true;
01029 
01030 }
01031 
01032 bool PerValidate::StreamFileRemove() {
01033   //
01034   //  Purpose:  Test removal of files to stream file list.
01035   //
01036   //  Arguments: none.
01037   //
01038   //  Return:    pass or fail
01039   //
01040   //  Contact:   S. Kasahara
01041   // 
01042 
01043   cout << "Before: " << endl;
01044   fInputStreamManager.ListFile(cout); 
01045   fInputStreamManager.RemoveFile("pervld.root");
01046   cout << "After removal of pervld.root: " << endl;
01047   fInputStreamManager.ListFile(cout);
01048   fInputStreamManager.RemoveFile("pervld2.root");
01049   cout << "After attempt to remove pervld2.root:" << endl;
01050   fInputStreamManager.ListFile(cout);
01051 
01052   return true;
01053 
01054 }
01055 
01056 bool PerValidate::StreamFilePrev() {
01057   //
01058   //  Purpose:  Test rewind of files to stream file list.
01059   //
01060   //  Arguments: none.
01061   //
01062   //  Return:    pass or fail
01063   //
01064   //  Contact:   S. Kasahara
01065   // 
01066 
01067    cout << "Before: " << endl;
01068   fInputStreamManager.ListFile(cout); 
01069   fInputStreamManager.PrevFile();
01070   cout << "After rewind of 1 file: " << endl;
01071   fInputStreamManager.ListFile(cout);
01072   fInputStreamManager.PrevFile(2);
01073   cout << "After rewind of 2 files:" << endl;
01074   fInputStreamManager.ListFile(cout);
01075 
01076   return true;
01077 
01078 }
01079 
01080 bool PerValidate::StreamFileNext() {
01081   //
01082   //  Purpose:  Test rewind of files to stream file list.
01083   //
01084   //  Arguments: none.
01085   //
01086   //  Return:    pass or fail
01087   //
01088   //  Contact:   S. Kasahara
01089   // 
01090 
01091    cout << "Before: " << endl;
01092   fInputStreamManager.ListFile(cout); 
01093   fInputStreamManager.NextFile(2);
01094   cout << "After advance of 2 files: " << endl;
01095   fInputStreamManager.ListFile(cout);
01096   fInputStreamManager.NextFile(4);
01097   cout << "After advance of 4 files:" << endl;
01098   fInputStreamManager.ListFile(cout);
01099   fInputStreamManager.PrevFile(1);
01100   cout << "After rewind of 1 file:" << endl;
01101   fInputStreamManager.ListFile(cout);
01102 
01103   return true;
01104 
01105 }
01106 
01107 bool PerValidate::StreamFileGoToByIndex() {
01108   //
01109   //  Purpose:  Test rewind of files to stream file list.
01110   //
01111   //  Arguments: none.
01112   //
01113   //  Return:    pass or fail
01114   //
01115   //  Contact:   S. Kasahara
01116   // 
01117 
01118    cout << "Before: " << endl;
01119   fInputStreamManager.ListFile(cout); 
01120   fInputStreamManager.GoToFile(0);
01121   cout << "After GoToFile index 0: " << endl;
01122   fInputStreamManager.ListFile(cout);
01123   fInputStreamManager.GoToFile(1);
01124   cout << "After GoToFile index 1:" << endl;
01125   fInputStreamManager.ListFile(cout);
01126   fInputStreamManager.GoToFile(-1);
01127   cout << "After GoToFile index -1:" << endl;
01128   fInputStreamManager.ListFile(cout);
01129   fInputStreamManager.GoToFile(3);
01130   cout << "After GoToFile index 3:" << endl;
01131   fInputStreamManager.ListFile(cout);
01132 
01133   return true;
01134 
01135 }
01136 
01137 bool PerValidate::StreamFileGoToByName() {
01138   //
01139   //  Purpose:  Test rewind of files to stream file list.
01140   //
01141   //  Arguments: none.
01142   //
01143   //  Return:    pass or fail
01144   //
01145   //  Contact:   S. Kasahara
01146   // 
01147 
01148   cout << "Before: " << endl;
01149   fInputStreamManager.ListFile(cout); 
01150   fInputStreamManager.GoToFile("pervld.root");
01151   cout << "After GoToFile pervld.root: " << endl;
01152   fInputStreamManager.ListFile(cout);
01153   fInputStreamManager.GoToFile("");
01154   cout << "After GoToFile null:" << endl;
01155   fInputStreamManager.ListFile(cout);
01156   fInputStreamManager.GoToFile("pervld4.root");
01157  cout << "After GoToFile pervld4.root:" << endl;
01158   fInputStreamManager.ListFile(cout);
01159 
01160   return true;
01161 
01162 }
01163 
01164 bool PerValidate::StreamMgrFileList() {
01165   //
01166   //  Purpose:  Test file listing.
01167   //
01168   //  Arguments: none.
01169   //
01170   //  Return:    pass or fail
01171   //
01172   //  Contact:   S. Kasahara
01173   // 
01174 
01175   fInputStreamManager.ListFile(cout);
01176   fInputStreamManager.ListFile(cout,"DaqSnarl");
01177   fInputStreamManager.ListFile(cout,"DaqMonitor");
01178   fInputStreamManager.ListFile(cout,"LightInjection");
01179 
01180   return true;
01181 
01182 }
01183 
01184 bool PerValidate::OutputStreamMgr() {
01185   //
01186   //  Purpose:  Test output stream manager.
01187   //
01188   //  Arguments: none.
01189   //
01190   //  Return:    pass or fail
01191   //
01192   //  Contact:   S. Kasahara
01193   // 
01194 
01195   MsgStream* msper = MsgService::Instance() -> GetStream("Per");
01196   msper -> SetLogLevel(Msg::kVerbose);
01197 
01198   fOutputStreamManager.OpenStream("DaqSnarl","mytree","RecMinos","","",
01199                             Per::kRecSplit);
01200   fOutputStreamManager.SetFile("DaqSnarl","testdaq.root",Per::kRecreate);
01201 
01202   MomNavigator* mom = new MomNavigator();
01203   RecMinos* record = new RecMinos();
01204   mom -> AdoptFragment(record);
01205   record->GetTempTags().Print();
01206   cout << "Persisting record" << endl;
01207   fOutputStreamManager.Put(mom);
01208   cout << "Persisting same record again" << endl;
01209   fOutputStreamManager.Put(mom);
01210 
01211   record -> HasBeenModified();
01212   cout << "Persisting modified record" << endl;
01213   fOutputStreamManager.Put(mom);
01214   record->GetTempTags().Print();
01215 
01216   fOutputStreamManager.Write();
01217   fOutputStreamManager.CloseFile();
01218   fOutputStreamManager.CloseStream();
01219 
01220   delete mom; mom = 0;
01221 
01222   return true;
01223 
01224 }
01225 
01226 bool PerValidate::RunAllTests() {
01227   //
01228   //  Purpose:  Run sequence of Persistency package validity tests.
01229   //
01230   //  Arguments: none.
01231   //
01232   //  Return:    pass (if all tests successful) or fail
01233   //
01234   //  Contact:   S. Kasahara
01235   // 
01236   //  Notes: Requires input data from test file "pervld.root"
01237   //
01238 
01239   bool allPassed = true;
01240 
01241   fInputStreamManager.OpenStream("DaqSnarl","DaqSnarl");
01242   fInputStreamManager.OpenStream("DaqMonitor","DaqMonitor");
01243 
01244   if ( !fInputStreamManager.SetFile("*",fFileName,Per::kRead) ) {
01245     cout << " Must run 'loon -bq Persistency/test/pervld.C' to generate file pervld.root first"
01246          << "\n Validity test aborted. " << endl;
01247     return false;
01248   }
01249 
01250   int iloop = 0;
01251   while ( iloop < 2 ) {
01252     cout << "*** Test input stream record tags sequencing *** " << endl;
01253     if ( this -> StreamTagsSeq() ) cout << "*** Passed ***" << endl;
01254     else {
01255       cout << "*** Failed ***" << endl;
01256       allPassed = false;
01257     }
01258 
01259     cout << "*** Test input stream manager record tags sequencing *** " << endl;
01260     if ( this -> StreamMgrTagsSeq() ) cout << "*** Passed ***" << endl;
01261     else {
01262       cout << "*** Failed ***" << endl;
01263       allPassed = false;
01264     }
01265 
01266     cout << "*** Test input stream manager record tags zig-zag sequencing *** " << endl;
01267     if ( this -> StreamMgrTagsSeqZigZag() ) cout << "*** Passed ***" << endl;
01268     else {
01269       cout << "*** Failed ***" << endl;
01270       allPassed = false;
01271     }
01272 
01273     cout << "*** Test input stream manager skip-by-two sequencing *** " << endl;
01274     if ( this -> StreamMgrSkipByTwoSeq() ) cout << "*** Passed ***" << endl;
01275     else {
01276       cout << "*** Failed ***" << endl;
01277       allPassed = false;
01278     }
01279 
01280     cout << "*** Test input stream manager skip-by-three sequencing *** "<< endl;
01281     if ( this -> StreamMgrSkipByThreeSeq() ) cout << "*** Passed ***" << endl;
01282     else {
01283       cout << "*** Failed ***" << endl;
01284       allPassed = false;
01285     }
01286 
01287     cout << "*** Test input stream manager selection sequencing *** "<< endl;
01288     if ( this -> StreamMgrSelectionSeq() ) cout << "*** Passed ***" << endl;
01289     else {
01290       cout << "*** Failed ***" << endl;
01291       allPassed = false;
01292     }
01293 
01294     cout << "*** Test input stream manager file change sequencing *** "<< endl;
01295     if ( this -> StreamMgrFileChangeSeq() ) cout << "*** Passed ***" << endl;
01296     else {
01297       cout << "*** Failed ***" << endl;
01298       allPassed = false;
01299     }
01300 
01301     cout << "*** Test input stream manager parallel input file seq *** "<<endl;
01302     if ( this -> StreamMgrParallelFileSeq() ) cout << "*** Passed ***" << endl;
01303     else {
01304       cout << "*** Failed ***" << endl;
01305       allPassed = false;
01306     }
01307 
01308     if ( iloop == 0 ) {
01309       cout << "*** Switching to updatemode and rerunning tests *** "<< endl;
01310       fInputStreamManager.SetUpdateMode(true);
01311     }
01312     iloop++;
01313   }
01314 
01315   cout << "*** Test input stream file management***" << endl;
01316   cout << "***StreamFileAdd***" << endl;
01317   if ( this -> StreamFileAdd() ) cout << "*** Passed ***" << endl;
01318   else {
01319      cout << "*** Failed ***" << endl;
01320      allPassed = false;
01321   }
01322 
01323  cout << "***StreamFileRemove***" << endl;
01324   if ( this -> StreamFileRemove() ) cout << "*** Passed ***" << endl;
01325   else {
01326      cout << "*** Failed ***" << endl;
01327      allPassed = false;
01328   }
01329 
01330 cout << "***StreamFilePrev***" << endl;
01331   if ( this -> StreamFilePrev() ) cout << "*** Passed ***" << endl;
01332   else {
01333      cout << "*** Failed ***" << endl;
01334      allPassed = false;
01335   }
01336 
01337 cout << "***StreamFileNext***" << endl;
01338   if ( this -> StreamFileNext() ) cout << "*** Passed ***" << endl;
01339   else {
01340      cout << "*** Failed ***" << endl;
01341      allPassed = false;
01342   }
01343 
01344 cout << "***StreamFileGoToByIndex***" << endl;
01345   if ( this -> StreamFileGoToByIndex() ) cout << "*** Passed ***" << endl;
01346   else {
01347      cout << "*** Failed ***" << endl;
01348      allPassed = false;
01349   }
01350 
01351 cout << "***StreamFileGoToByName***" << endl;
01352   if ( this -> StreamFileGoToByName() ) cout << "*** Passed ***" << endl;
01353   else {
01354      cout << "*** Failed ***" << endl;
01355      allPassed = false;
01356   }
01357 
01358   cout << "***StreamMgrFileList***" << endl;
01359   if ( this -> StreamMgrFileList() ) cout << "*** Passed ***" << endl;
01360   else {
01361      cout << "*** Failed ***" << endl;
01362      allPassed = false;
01363   }
01364 
01365   cout << "***OutputStreamMgr***" << endl;
01366   if ( this -> OutputStreamMgr() ) cout << "*** Passed ***" << endl;
01367   else {
01368      cout << "*** Failed ***" << endl;
01369      allPassed = false;
01370   }
01371 
01372   return allPassed;
01373 
01374 }
01375 
01376 
01377 
01378 
01379 
01380 
01381 
01382 
01383 
01384 
01385 
01386 
01387 
01388 
01389 
01390 
01391 
01392 

Generated on Mon Feb 15 11:07:19 2010 for loon by  doxygen 1.3.9.1