source: trunk/MagicSoft/Mars/mtemp/mucm/classes/MDataSetIter.cc@ 6691

Last change on this file since 6691 was 6691, checked in by marcos, 20 years ago
*** empty log message ***
File size: 22.8 KB
Line 
1/* ======================================================================== *\
2!
3! *
4! * This file is part of MARS, the MAGIC Analysis and Reconstruction
5! * Software. It is distributed to you in the hope that it can be a useful
6! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
7! * It is distributed WITHOUT ANY WARRANTY.
8! *
9! * Permission to use, copy, modify and distribute this software and its
10! * documentation for any purpose is hereby granted without fee,
11! * provided that the above copyright notice appear in all copies and
12! * that both that copyright notice and this permission notice appear
13! * in supporting documentation. It is provided "as is" without express
14! * or implied warranty.
15! *
16!
17!
18! Author(s): Marcos Lopez, 4/2004 <mailto:marcos@gae.ucm.es>
19!
20! Copyright: MAGIC Software Development, 2000-2004
21!
22!
23\* ======================================================================== */
24
25/////////////////////////////////////////////////////////////////////////////
26//
27// MDataSetIter
28//
29// This class serves to divide all the data taking during a given night
30// (i.e, all the root files of a given directory),
31// into different data sets of files to be analyzed together. A data set is a
32// set of Data runs, along which their closer Ped and Cal runs.
33//
34// Usage:
35// ------
36// - To specify the directory/ies where the data are use:
37// AddDirectory()
38//
39// - To specify only those files for a given source name (all the files with
40// a name different from the ones in the source-name-list will be ignored)
41// use:
42// SelectSourceName()
43// You can select several src names.
44// By default, if any explict source name is specified, all are valid.
45//
46// - To retrieve the next data set (Ped, Cal, and Data runs) use:
47// NextDataSet()
48// GetPefDataRuns()
49// GetCalRuns()
50// GetDatRuns()
51//
52// Two problems:
53// -Sources not desired : ZetaTauri
54// - Not P/C runs before data runs
55//
56//
57/////////////////////////////////////////////////////////////////////////////
58#include "MDataSetIter.h"
59
60#include "MLog.h"
61#include "MLogManip.h"
62
63#include "MRunIter.h"
64#include "MSequence.h"
65
66#include "TObjArray.h"
67
68#include <TSystem.h>
69#include <fstream>
70
71ClassImp(MDataSetIter);
72
73using namespace std;
74
75
76
77// ----------------------------------------------------------------------------
78//
79// Default constructor.
80//
81MDataSetIter::MDataSetIter()
82 : fInitialRun(-1), fEndRun(-1), fLastProcessedDataRun(0), fLastDataRun(0), fDefCalRun(0), fDefCalRunPath(""), fLog(&gLog)
83{
84 fPedRuns = new MRunIter;
85 fCalRuns = new MRunIter;
86 fDataRuns = new MRunIter;
87 fSequence = new MSequence;
88}
89
90
91// ---------------------------------------------------------------------------
92//
93// Add all the files inside a given directory to the fFileList.
94//
95void MDataSetIter::AddToFileList(MDirIter& dir)
96{
97 TString name;
98
99 while (!(name=dir.Next()).IsNull())
100 fFileList.Add((TObject*)(new TNamed((const char*)name, "")));
101
102
103 //
104 // Sort File List by name
105 //
106 fFileList.Sort();
107
108 //
109 // Find last Data runnumber of the filelist to be processed
110 //
111 FindLastDataRun();
112}
113
114
115// -------------------------------------------------------------------------
116//
117// Find last Data runnumber of the filelist to be processed
118//
119void MDataSetIter::FindLastDataRun()
120{
121
122 if(fFileList.GetLast()==-1)
123 return;
124
125
126 TIter next(&fFileList,kIterBackward);
127 TNamed* n;
128
129 while ( (n=(TNamed*)next()) )
130 {
131 TString name, path, date, src;
132 Int_t run;
133 char type;
134
135 ScanFileName(n->GetName(), name, path, date, src, &run, &type);
136
137 if(type!='D')
138 continue;
139
140
141 if(fEndRun==-1)
142 {
143 if(run>fLastDataRun)
144 fLastDataRun = run;
145
146 break;
147 }
148 else
149 {
150 if(run<=fEndRun)
151 {
152 if(run>fLastDataRun)
153 fLastDataRun = run;
154
155 break;
156 }
157
158 }
159 }
160
161}
162
163
164// ----------------------------------------------------------------------------
165//
166// Overload MDirIter::AddDirectory
167//
168// Each time a new directory is added, all the files inside that directory
169// are added to the fFileList.
170//
171// Returns the number of directories added
172//
173Int_t MDataSetIter::AddDirectory(const char *dir, const char *filter, Int_t recursive)
174{
175 const Int_t rc = MDirIter::AddDirectory(dir, filter, recursive);
176 if (rc==0)
177 return 0;
178
179 //
180 // Add the files inside that directory to the fFileList. In order to
181 // add only the files inside the new directory added, we create
182 // and MDirIter with only that directory. Otherwise, it we call
183 // directly this.Next() inside FillFileList the new files and the
184 // previously existing one will be again adde to the fFileList.
185 //
186 MDirIter next(dir,filter,recursive);
187 AddToFileList(next);
188
189 next.Print() ;
190
191 return kTRUE;
192}
193
194
195// ----------------------------------------------------------------------------
196//
197// Add a source name to the list of selected source names.
198//
199void MDataSetIter::SelectSourceName(const char *src)
200{
201 fSrcList.Add((TObject*)(new TNamed(src, src)));
202}
203
204
205// ----------------------------------------------------------------------------
206//
207// Check wheather the source name is inside the list of selected source names.
208// If not any source name has been selected, by default, any source name is
209// valid.
210// Return:
211// kTRUE: this run has to be selected
212// kFALSE: this run has to be skipped
213//
214Int_t MDataSetIter::CheckSourceName(TString& src)
215{
216
217 // If any source has been especified, all sorce name are accepted
218 if(fSrcList.GetLast()==-1)
219 return kTRUE;
220
221
222 //
223 // For skipping Ped and Cal runs with CL (aftet June 2004)
224 //
225 if(src.Contains("CL") || src.Contains("ContL"))
226 {
227 *fLog << warn << "Skipping CL run [" << src << "]" << endl;
228 return kFALSE;
229 }
230
231 //
232 // Skip Green and Blue calib
233 //
234 if(src.Contains("Blue",TString::kIgnoreCase) || src.Contains("Green",TString::kIgnoreCase))
235 {
236 *fLog << warn << "Skipping Blue/Green run [" << src << "]" << endl;
237 return kFALSE;
238 }
239
240
241
242 //
243 // For dealing with the new calibration files nomenclature
244 // (after 23-3-2004) of the type "CrabNebula-5blue", and for off data
245 // like OffMrk421-1, OffMrk421-3 etc, we assume that any source name
246 // can be made up of two parts separated by a dash: the source name and
247 // a suffix indicated for instance the calibration colot of kind of off
248 // data. This suffix is then ignored for checking the source name, ie.,
249 // any suffix is valid !
250 //
251 if(src.Contains("-"))
252 {
253 //*fLog << warn << "For source [" << src << "] ignoring suffix ["
254 // << src( src.First("-")+1, src.Length() ) << "]" << endl;
255 src.Remove(src.First("-"));
256 }
257
258
259 //
260 // Loop
261 //
262 TIter next(&fSrcList);
263
264 TString ValidSrc;
265 TNamed* n;
266 while ( (n=(TNamed*)next()) )
267 {
268 ValidSrc = n->GetName();
269
270 if (src==ValidSrc) // For dealing with new calib files as Mrk421blue5
271 //if (src.Contains(ValidSrc))
272 return kTRUE;
273 }
274
275 *fLog << warn << "Source [" << src << "] is not in the list of selected source names." << endl;
276
277 return kFALSE;
278}
279
280// -------------------------------------------------------------------
281//
282// Compare two source names
283//
284Int_t MDataSetIter::CompareSourceNames(TString& src1, TString& src2)
285{
286 if(src1.Contains("-"))
287 {
288 //*fLog << warn << "For source [" << src << "] ignoring suffix ["
289 // << src( src.First("-")+1, src.Length() ) << "]" << endl;
290 src1.Remove(src1.First("-"));
291 }
292
293
294 if(src2.Contains("-"))
295 {
296 //*fLog << warn << "For source [" << src << "] ignoring suffix ["
297 // << src( src.First("-")+1, src.Length() ) << "]" << endl;
298 src2.Remove(src2.First("-"));
299 }
300
301 return (src1.CompareTo(src2)==0) ? kTRUE : kFALSE;
302}
303
304// ---------------------------------------------------------------------------
305//
306// Scan a file name.
307//
308void MDataSetIter::ScanFileName(const TString& file, TString& name, TString& path, TString& date, TString& src, Int_t* run, char* type)
309{
310 const Int_t slash = file.Last('/');
311
312 // Get File name and Path
313 path = file(0,slash+1);
314 name = file(slash+1,file.Length());
315
316 TString tmp = name;
317
318
319 // Get date
320 date = tmp(0,tmp.First('_'));
321 tmp = tmp.Remove(0,tmp.First('_')+1);
322
323
324 // Get run number
325 const TString runstr = tmp(0,tmp.First('_'));
326 *run = atoi(runstr.Data());
327 tmp = tmp.Remove(0,tmp.First('_')+1);
328
329
330 // Get run type
331 *type = tmp[0];
332 tmp = tmp.Remove(0,tmp.First('_')+1);
333
334
335 // Get source name
336 //src = tmp(0,tmp.First('_'));
337 //
338 // To deal with 4C15 with filemames doesn't include '_E' (18-11-2004)
339 //
340 if (tmp.Contains('_'))
341 src = tmp(0,tmp.First('_'));
342 else
343 src = tmp(0,tmp.First('.'));
344}
345
346
347// ----------------------------------------------------------------------------
348//
349// First check that previous run was not empty, and then that it contains
350// runs for the current source (fSrcName)
351//
352Int_t MDataSetIter::IsPreviousRunUsable(MRunIter& oldRuns)
353{
354 if( oldRuns.GetNumRuns() == 0)
355 {
356 *fLog << warn << "Doesn't exist previous set." << endl;
357 return kFALSE;
358 }
359
360 //
361 // Go back to ther first entry
362 //
363 oldRuns.Reset();
364
365 //
366 // Check that the previous runs were for the same source name
367 //
368 TString name, path, date, src;
369 Int_t run;
370 char type;
371
372 ScanFileName(oldRuns.Next(), name, path, date, src, &run, &type);
373
374
375 if ( !CompareSourceNames(src,fSrcName) )
376 //
377 // For dealing with calibration color we just ask than the srcname
378 // contains the FirstSrcName
379 //
380 //if( !src.Contains(fSrcName) )
381 {
382 *fLog << warn << "Previous runs were for a diffrent source [" << src << "] vs [" << fSrcName << "] ...exit." << endl;
383 return kFALSE;
384 }
385
386
387 return kTRUE;
388}
389
390
391// ---------------------------------------------------------------------------
392//
393// Assumes that a data set has the following structure:
394// P/C,P/C,P/C, ...
395// D,D,D, ...
396//
397// After finishing the loop, it checks that were found at least one Ped, one
398// Cal and one Data runs.
399//
400// Start from the last processed run, looking for Ped, Cal and Dat runs. As
401// soon a Data run is found, it start to look only for Data runs, finishing
402// the loop when a run of different type of Data run is found.
403//
404// Process all the runs which runnumber is later to the last processed run
405// (the first time this function is call fLastProcessedDataRun is 0, so it start
406// processing from the beginning)
407//
408// NOTE: This FAILS if the directory doesn't start with at lead one P and one
409// C runs
410//
411Int_t MDataSetIter::NextDataSet()
412{
413
414 if(fFileList.GetLast()==-1)
415 {
416 *fLog << warn << "File list empty." << endl;
417 return kFALSE;
418 }
419
420
421 //
422 // Save temporaly prvious data set;
423 //
424 MRunIter* oldDataRuns = 0;
425 MRunIter* oldPedRuns = 0;
426 MRunIter* oldCalRuns = 0;
427
428 if(fDataRuns)
429 oldDataRuns = (MRunIter*)fDataRuns->Clone();
430 if(fPedRuns)
431 oldPedRuns = (MRunIter*)fPedRuns->Clone();
432 if(fCalRuns)
433 oldCalRuns = (MRunIter*)fCalRuns->Clone();
434
435
436
437 //
438 // Retrieve next data set P,C and D runs
439 //
440 Loop("dataset");
441
442
443 //
444 // If no data runs were found, is because we were already at the end of
445 // the directory. Then Return kFALSE
446 //
447 if ( fDataRuns->GetNumRuns()==0 )
448 {
449 *fLog << warn << "No more Data runs left." << endl;
450 return kFALSE;
451 }
452
453
454 //
455 // If no new P runs found, use the previous one, if they were for the
456 // same source
457 //
458 if ( fPedRuns->GetNumRuns()==0 )
459 {
460
461 *fLog << warn << "No Ped runs were found before data runs." << endl;
462
463
464 //
465 // Trying to Use previous pedestal, if there were
466 //
467 if ( IsPreviousRunUsable(*oldPedRuns) )
468 {
469 *fLog << warn << "Using Previous Ped runs." << endl;
470 fPedRuns->Delete();
471 fPedRuns = (MRunIter*)oldPedRuns->Clone();
472 }
473 else
474 {
475 *fLog << warn << "Previous Ped runs exists but for a different source." << endl;
476
477
478 //
479 // Found next P after D runs
480 //
481 *fLog << warn << "Looking for new Ped runs after last data run..." << endl;
482
483 oldDataRuns = (MRunIter*)fDataRuns->Clone();
484 oldCalRuns = (MRunIter*)fCalRuns->Clone();
485
486 Loop("P",fSrcName);
487
488 // fDataRuns and fCalRuns has been overwriteen when calling Loop
489 fDataRuns->Delete();
490 fDataRuns = (MRunIter*)oldDataRuns->Clone();
491
492 fCalRuns->Delete();
493 fCalRuns = (MRunIter*)oldCalRuns->Clone();
494
495
496 //
497 // Last check
498 //
499 if ( fPedRuns->GetNumRuns() == 0 )
500 {
501 *fLog << err << "ERROR: Unable to found Ped runs for this source [" << fSrcName << "] ... exit." << endl;
502 return kFALSE;
503 }
504 }
505
506 }
507
508
509 //
510 // If no new C runs found, use the previous one, if they were for the
511 // same source
512 //
513 if ( fCalRuns->GetNumRuns()==0 )
514 {
515 *fLog << warn << "No Cal runs were found before data runs." << endl;
516
517 //
518 // Trying to Use previous pedestal, if there were
519 //
520 if ( IsPreviousRunUsable(*oldCalRuns) )
521 {
522 *fLog << warn << "Using Previous Cal runs." << endl;
523 fCalRuns->Delete();
524 fCalRuns = (MRunIter*)oldCalRuns->Clone();
525 }
526 else
527 {
528
529 //
530 // Found next P after D runs
531 //
532 *fLog << warn << "Looking for new Cal runs after last data run..." << endl;
533
534
535 oldDataRuns = (MRunIter*)fDataRuns->Clone();
536 oldPedRuns = (MRunIter*)fPedRuns->Clone();
537
538 Loop("C",fSrcName);
539
540
541 // fDataRuns and fPedRuns has been overwriteen when calling Loop
542 fDataRuns->Delete();
543 fDataRuns = (MRunIter*)oldDataRuns->Clone();
544
545 fPedRuns->Delete();
546 fPedRuns = (MRunIter*)oldPedRuns->Clone();
547
548
549
550 //
551 // Last check
552 //
553 if ( fCalRuns->GetNumRuns() == 0 )
554 {
555 *fLog << err << "ERROR: Unable to found Cal runs for this source [" << fSrcName << "] ... exit." << endl;
556
557 //
558 // Using a default Cal run
559 //
560 if( fDefCalRun != 0)
561 {
562 *fLog << warn << "WARN: Using a default calibration run: " << fDefCalRunPath << fDefCalRun << endl;
563 fCalRuns->AddRun(fDefCalRun,fDefCalRunPath.Data());
564 }
565 else
566 return kFALSE;
567 }
568 }
569 }
570
571
572
573
574 //
575 // Print the runs of this data set
576 //
577 //Print();
578
579
580 oldDataRuns->Delete();
581 oldPedRuns->Delete();
582 oldCalRuns->Delete();
583
584
585 return kTRUE;
586}
587
588
589// -----------------------------------------------------------------------
590//
591// Write an ASCII file with the sequence info.
592// The name of the file is 'sequenceRunNum.txt' where
593// RunNum is the run number of the first data file to analyse. We use
594// the data runnumber instead of calib run because several sequences can
595// have the same calib run (just the P can change)
596//
597Int_t MDataSetIter::WriteSequence()
598{
599 //
600 // Sequence
601 //
602 //fSequence->SetupDatRuns(fDataRuns, fPathData, "D");
603 //fSequence->SetupPedRuns(fPedRuns, fPathData, "P");
604 //fSequence->SetupCalRuns(fCalRuns, fPathData, "C");
605
606 //fSequence->Print();
607
608 TString sped = fPedRuns->GetRunsAsFileName();
609 TString scal = fCalRuns->GetRunsAsFileName();
610 TString sdata = fDataRuns->GetRunsAsFileName();
611
612 sped.ReplaceAll("_"," ");
613 scal.ReplaceAll("_"," ");
614 sdata.ReplaceAll("_"," ");
615
616
617 Int_t seqnum;
618 //sscanf(scal.Data(),"%d",&seqnum);
619 sscanf(sdata.Data(),"%d",&seqnum);
620
621 TString fname = Form("sequence_%s_%d.txt",fDate.Data(), seqnum);
622 ofstream out(fname);
623
624
625 TString date = fDate;
626 date.Insert(4,"-");
627 date.Insert(7,"-");
628
629
630 //out << "# Sequence number (identifier)" <<endl;
631 out << "Sequence: " << seqnum << endl;
632 //out << endl;
633 //out << "# date of sunrise of the observation night" << endl;
634 //out << "Night: 2004-09-21" << endl;
635 out << "Night: " << date << endl;
636 out << endl;
637 //out << "# Source name of all runs of sequence" << endl;
638 //out << "Source: " << fSrcName << endl;
639 //out << endl;
640 //out << "# List of all runs of this sequence" << endl;
641 //out << "Runs: " << scal << " " << sped << " "<< sdata << endl;
642 //out << endl;
643 //out << "# List of all calibration runs of this sequence" << endl;
644 out << "CalRuns: " << scal << endl;
645 //out << "# List of all pedestal runs of this sequence" << endl;
646 out << "PedRuns: " << sped << endl;
647 //out << "# List of all data runs of this sequence" << endl;
648 out << "DatRuns: "<< sdata << endl;
649 out.close();
650
651
652 return kTRUE;
653}
654
655
656
657// ---------------------------------------------------------------------------
658//
659// Look for a set of consecutive runs of a given type (P/C/D), starting from
660// the last processed data run. The runs found are stored in
661// f[Data/Ped/Cal]Runs.
662//
663// If option="P" look for a set of consecutive P runs. The same for C and D
664// runs.
665// If options="dataset", look for set of consecutive D runs, but also retrieve
666// all the P and C runs between the last processed run, and the first data
667// run.
668//
669// Method:
670// -------
671// Loop over all the files, and forechs does:
672// First, performs 2 tests
673// - run number: must be larger than the last processed data run
674// - source name: must be one of the selected source names
675// then
676// - add this run, but before, check that it correspond to the same
677// src name than the previously addded runs.
678//
679Int_t MDataSetIter::Loop(TString option, TString LockSrcName)
680{
681
682 //
683 // Delete previous data runs
684 //
685 fDataRuns->Delete();
686 fDataRuns = new MRunIter();
687
688 fPedRuns->Delete();
689 fPedRuns = new MRunIter();
690
691 fCalRuns->Delete();
692 fCalRuns = new MRunIter();
693
694 //
695 // Init
696 //
697 TString FirstSrcName = ""; // SrcName of the first run found
698 Bool_t RunFound = kFALSE;
699 Bool_t DataRunFound = kFALSE;
700 Bool_t CalRunFound = kFALSE;
701 Bool_t PedRunFound = kFALSE;
702
703
704
705
706 //
707 // Check option
708 //
709 if ( option.CompareTo("dataset",TString::kIgnoreCase) &&
710 option.CompareTo("P",TString::kIgnoreCase) &&
711 option.CompareTo("C",TString::kIgnoreCase) &&
712 option.CompareTo("D",TString::kIgnoreCase) )
713 {
714 *fLog << err << "ERROR: option [" << option << "] invalid...exit" << endl;
715 return kFALSE;
716 }
717
718 char SelectedType = !option.CompareTo("dataset",TString::kIgnoreCase) ? 'D' : option[0];
719
720
721
722
723 //
724 // Loop over all the files in the directory
725 //
726 TIter next(&fFileList);;
727 TNamed* n;
728 while ( (n=(TNamed*)next()) )
729 {
730 TString name, path, date, src;
731 Int_t run;
732 char type;
733
734 ScanFileName(n->GetName(), name, path, date, src, &run, &type);
735
736
737 //
738 // Check that runnumber is inside the desire range of range to analyse [fInitialRun,fEndRun]
739 //
740 if(fEndRun !=-1 && run > fEndRun)
741 break;
742 if(run < fInitialRun)
743 continue;
744
745
746 //
747 // Skip until finding the following run after the last processed one, fLastDataRun
748 //
749 if( run <= fLastProcessedDataRun )
750 continue;
751
752 //
753 // Check that the source name is among one of the selected source names
754 //
755 if( LockSrcName != "")
756 {
757 FirstSrcName = LockSrcName;
758 }
759
760 if( !CheckSourceName(src) )
761 continue;
762
763
764 //
765 // If a Data run has already be found, the next files has to be only
766 // of type Data, if not finish.
767 //
768 if( !option.CompareTo("dataset",TString::kIgnoreCase) && DataRunFound==kTRUE && type!=SelectedType )
769 break;
770
771 else if( !option.CompareTo("P",TString::kIgnoreCase) && PedRunFound==kTRUE && type!=SelectedType )
772 break;
773
774 else if( !option.CompareTo("C",TString::kIgnoreCase) && CalRunFound==kTRUE && type!=SelectedType )
775 break;
776
777 else if( !option.CompareTo("D",TString::kIgnoreCase) && DataRunFound==kTRUE && type!=SelectedType)
778 break;
779
780
781
782 //
783 // For Checking that this run has the same name that the first one of
784 // this set
785 //
786 if (RunFound==kFALSE)
787 {
788 RunFound = kTRUE;
789 FirstSrcName = src;
790 }
791
792
793 if( !CompareSourceNames(src,FirstSrcName) )
794 {
795 *fLog << err << "ERROR: Source Name differs inside data set ("
796 << src << " vs. " << FirstSrcName << ") ...exit." << endl;
797 return kFALSE;
798 }
799
800
801
802 //
803 // Add this run to its corresponding MRunIter
804 //
805 switch (type)
806 {
807 case 'D':
808 if( !option.CompareTo("dataset",TString::kIgnoreCase) ||
809 !option.CompareTo("D",TString::kIgnoreCase) )
810 {
811 *fLog << "Adding Data run: " << run << " [" << src << "]" << endl;
812
813 fDataRuns->AddRun(run,path.Data());
814
815 fSrcName = src;
816 fDate = date;
817
818 DataRunFound = kTRUE;
819
820 fLastProcessedDataRun = run;
821 }
822 break;
823
824 case 'P':
825 if( !option.CompareTo("dataset",TString::kIgnoreCase) ||
826 !option.CompareTo("P",TString::kIgnoreCase) )
827 {
828 *fLog << "Adding Ped run: "<< run << " [" << src << "]" << endl;
829
830 PedRunFound = kTRUE;
831
832 fPedRuns->AddRun(run,path.Data());
833 }
834 break;
835
836 case 'C':
837 if( !option.CompareTo("dataset",TString::kIgnoreCase) ||
838 !option.CompareTo("C",TString::kIgnoreCase) )
839 {
840
841 if(CalRunFound==kFALSE)
842 {
843 *fLog << "Adding Cal run: "<< run << " [" << src << "]" << endl;
844 CalRunFound = kTRUE;
845
846 fCalRuns->AddRun(run,path.Data());
847 }
848 else
849 *fLog << "SKIPPING Cal run: "<< run << " [" << src << "]" << endl;
850
851
852 }
853 break;
854 }
855
856
857 } // End loop
858
859
860 return kTRUE;
861}
862
863
864
865
866
867// ---------------------------------------------------------------------------
868//
869// By default print the P,C and D runs of the current data set. With the
870// option "all" print only all the files in the FileList.
871//
872void MDataSetIter::Print(const Option_t *option) const
873{
874
875 //
876 // Print all the files in the FileList.
877 //
878 TString s(option);
879 if (s.Contains("all", TString::kIgnoreCase))
880 {
881 fFileList.Print();
882 return;
883 }
884
885
886 //
887 // Reset
888 //
889 fPedRuns->Reset();
890 fCalRuns->Reset();
891 fDataRuns->Reset();
892
893
894 //
895 // Print the runs of this data set
896 //
897 TString file;
898
899 *fLog << all << endl << " pedestal runs: " << endl;
900 *fLog << "---------------" << endl;
901 while( !(file=fPedRuns->Next()).IsNull() )
902 *fLog << file << endl;
903
904
905 *fLog << endl << " calibration runs: " << endl;
906 *fLog << "------------------" << endl;
907 while( !(file=fCalRuns->Next()).IsNull() )
908 *fLog << file << endl;
909
910
911 *fLog << endl << " data runs: " << endl;
912 *fLog << "-----------" << endl;
913 while( !(file=fDataRuns->Next()).IsNull() )
914 *fLog << file << endl;
915
916
917 *fLog << endl;
918
919
920 //
921 // Reset
922 //
923 fPedRuns->Reset();
924 fCalRuns->Reset();
925 fDataRuns->Reset();
926
927}
928
929
930// ------------------------------------------------------------------------------------
931//
932// Deterimines wheather of data runs has been processed or not
933//
934Bool_t MDataSetIter::HasFinishedSuccesfully()
935{
936
937 if(fEndRun==-1)
938 *fLog << "LastDataRun = " << fLastDataRun << endl;
939 else
940 *fLog << "EndRun = " << fEndRun << endl;
941
942 *fLog << "LastProcessedDataRun = " << fLastProcessedDataRun << endl;
943
944
945 if(fEndRun==-1)
946 return fLastProcessedDataRun==fLastDataRun ? kTRUE : kFALSE;
947 else
948 return fLastProcessedDataRun==fEndRun ? kTRUE : kFALSE;
949
950}
Note: See TracBrowser for help on using the repository browser.