66import java .util .*;
77import java .text .SimpleDateFormat ;
88
9+ import org .jlab .detector .qadb .QadbBinSequence ;
10+ import org .jlab .detector .qadb .QadbBin ;
11+
912import org .jlab .io .base .DataEvent ;
1013import org .jlab .io .hipo .HipoDataSource ;
1114import org .jlab .groot .base .GStyle ;
@@ -32,32 +35,18 @@ public static void main(String[] args) {
3235 // get the dataset which contains this run number
3336 var dataset = RunDependentCut .findDataset (runNum );
3437
35- //// instantiate histogramming classes
36- GeneralMon ana_mon = new GeneralMon (runNum ,outputDir ,EB ,useTB );
37- DCandFTOF ana_dc_ftof = new DCandFTOF (runNum ,outputDir ,useTB );
38- CTOF ana_ctof = new CTOF (runNum ,outputDir ,useTB );
39- HTCC ana_htcc = new HTCC (runNum ,outputDir );
40- LTCC ana_ltcc = new LTCC (runNum ,outputDir ,EB ,useTB );
41- RICH ana_rich = new RICH (runNum ,outputDir ,EB ,useTB );
42- CND ana_cnd = new CND (runNum ,outputDir ,useTB );
43- CVT ana_cvt = dataset != "rgl" ? new CVT () : null ;
44- FT ana_ft = new FT (runNum ,outputDir ,useTB );
45- BAND ana_band = new BAND (runNum ,outputDir ,EB ,useTB );
46- ALERT ana_alert = dataset == "rgl" ? new ALERT (runNum ,outputDir ,EB ,useTB ) : null ;
47- helicity ana_helicity = new helicity ();
48- trigger ana_trigger = new trigger ();
49-
50- List <String > toProcessFileNames = new ArrayList <String >();
38+ // get list of input HIPO files
39+ List <String > input_file_list = new ArrayList <String >();
5140 File file = new File (filelist );
5241 Scanner read ;
5342 try {
5443 read = new Scanner (file );
55- do {
44+ do {
5645 String filename = read .next ()
5746 .replaceAll ("^file:" , "" )
5847 .replaceAll ("^mss:" , "" );
5948 if (runNum ==0 || filename .contains (String .format ("%d" ,runNum ) ) ){
60- toProcessFileNames .add (filename );
49+ input_file_list .add (filename );
6150 System .out .println ("adding " +filename );
6251 }
6352
@@ -68,22 +57,43 @@ public static void main(String[] args) {
6857 System .exit (100 );
6958 }
7059 int progresscount = 0 ;
71- int filetot = toProcessFileNames .size ();
60+ int filetot = input_file_list .size ();
7261 long startTime = System .currentTimeMillis ();
7362 long previousTime = System .currentTimeMillis ();
7463 SimpleDateFormat dateFormat = new SimpleDateFormat ("yyyy/MM/dd HH:mm:ss" );
7564
76- for (String runstrg : toProcessFileNames ) {
65+ // QADB binning
66+ QadbBinSequence <QadbBinData > qa_seq = new QadbBinSequence <>(input_file_list , 2000 , (bin_num ) -> new QadbBinData ());
67+
68+ // instantiate histogramming classes
69+ GeneralMon ana_mon = new GeneralMon (runNum ,outputDir ,EB ,useTB );
70+ DCandFTOF ana_dc_ftof = new DCandFTOF (runNum ,outputDir ,useTB );
71+ CTOF ana_ctof = new CTOF (runNum ,outputDir ,useTB );
72+ HTCC ana_htcc = new HTCC (runNum ,outputDir );
73+ LTCC ana_ltcc = new LTCC (runNum ,outputDir ,EB ,useTB );
74+ RICH ana_rich = new RICH (runNum ,outputDir ,EB ,useTB );
75+ CND ana_cnd = new CND (runNum ,outputDir ,useTB );
76+ CVT ana_cvt = dataset != "rgl" ? new CVT () : null ;
77+ FT ana_ft = new FT (runNum ,outputDir ,useTB );
78+ BAND ana_band = new BAND (runNum ,outputDir ,EB ,useTB );
79+ ALERT ana_alert = dataset == "rgl" ? new ALERT (runNum ,outputDir ,EB ,useTB ) : null ;
80+ helicity ana_helicity = new helicity ();
81+ trigger ana_trigger = new trigger ();
82+ // QADB mon histogramming
83+ ChargeMon mon_charge = new ChargeMon (qa_seq );
84+
85+ // loop over input HIPO files
86+ for (String input_file : input_file_list ) {
7787 progresscount ++;
78- System .out .println (String .format (">>>>>>>>>>>>>>>> %s" ,runstrg ));
79- File varTmpDir = new File (runstrg );
88+ System .out .println (String .format (">>>>>>>>>>>>>>>> %s" ,input_file ));
89+ File varTmpDir = new File (input_file );
8090 if (!varTmpDir .exists ()) {
81- System .err .println (String .format ("ERROR: FILE DOES NOT EXIST: '%s'" ,runstrg ));
91+ System .err .println (String .format ("ERROR: FILE DOES NOT EXIST: '%s'" ,input_file ));
8292 continue ;
8393 }
84- System .out .println ("READING NOW " +runstrg );
94+ System .out .println ("READING NOW " +input_file );
8595 HipoDataSource reader = new HipoDataSource ();
86- reader .open (runstrg );
96+ reader .open (input_file );
8797 while (reader .hasEvent ()) {
8898 DataEvent event = reader .getNextEvent ();
8999
@@ -110,7 +120,7 @@ public static void main(String[] args) {
110120 elapsedTime = elapsedTime /1000 ;
111121 totalTime = totalTime /1000 ;
112122 Date date = new Date ();
113- System .out .println (count /1000 + "k events (this is all analysis on " +runstrg +") ; time : " + dateFormat .format (date ) + " , last elapsed : " + elapsedTime + "s ; total elapsed : " + totalTime + "s ; progress : " +progresscount +"/" +filetot );
123+ System .out .println (count /1000 + "k events (this is all analysis on " +input_file +") ; time : " + dateFormat .format (date ) + " , last elapsed : " + elapsedTime + "s ; total elapsed : " + totalTime + "s ; progress : " +progresscount +"/" +filetot );
114124 previousTime = nowTime ;
115125 }
116126 }
0 commit comments