diff --git a/src/main/java/org/jlab/clas/timeline/analysis/alert/alert_atof_time.groovy b/src/main/java/org/jlab/clas/timeline/analysis/alert/alert_atof_time.groovy index b3462b256..6f6108f05 100644 --- a/src/main/java/org/jlab/clas/timeline/analysis/alert/alert_atof_time.groovy +++ b/src/main/java/org/jlab/clas/timeline/analysis/alert/alert_atof_time.groovy @@ -9,19 +9,7 @@ class alert_atof_time { def data = new ConcurrentHashMap() def has_data = new AtomicBoolean(false) -int sector; -int min_index; -int max_index; - - alert_atof_time(int atof_sector){ // atof_sector runs from 0 to 14. - this.sector = atof_sector; - this.min_index = 44*(atof_sector); - this.max_index = 44*(atof_sector+1); - } - def getName() { - return "${this.class.simpleName}_${String.format('%02d', sector)}" - } def processRun(dir, run) { @@ -29,21 +17,15 @@ int max_index; def trigger = dir.getObject('/TRIGGER/bits') def reference_trigger_bit = 0 // data[run].put('bits', trigger) - (min_index.. - int atof_sector = index / (11 * 4); - assert sector == atof_sector // sanity-check. this should be the same. - int layer = (index % (11 * 4)) / 11; - int component = index % 11; - def file_index = String.format('sector%02d_layer%d_component%02d', sector, layer, component) - def h1 = dir.getObject(String.format('/ALERT/ATOF_Time_%s', file_index)) + (0..<11).collect{component-> + def h1 = dir.getObject(String.format('/ALERT/ATOF_Time_component%02d', component)) if(h1!=null) { if (h1.getBinContent(h1.getMaximumBin()) > 30 && h1.getEntries()>300){ - data[run].put(String.format('atof_time_%s', file_index), h1) + data[run].put(String.format('atof_time_%02d', component), h1) def f1 = ALERTFitter.atof_time_fitter(h1,component) - data[run].put(String.format('fit_atof_time_%s', file_index), f1) - data[run].put(String.format('peak_location_atof_time_%s', file_index), f1.getParameter(1).abs()) - data[run].put(String.format('sigma_atof_time_%s', file_index), f1.getParameter(2).abs()) - data[run].put(String.format('integral_normalized_to_trigger_atof_time_%s', file_index), Math.sqrt(2*3.141597f) * f1.getParameter(0).abs() * f1.getParameter(2).abs()/trigger.getBinContent(reference_trigger_bit) ) + data[run].put(String.format('fit_atof_time_%02d', component), f1) + data[run].put(String.format('peak_location_atof_time_%02d', component), f1.getParameter(1).abs()) + data[run].put(String.format('sigma_atof_time_%02d', component), f1.getParameter(2).abs()) has_data.set(true) } } @@ -59,36 +41,31 @@ int max_index; return } - ['peak_location', 'sigma', 'integral_normalized_to_trigger'].each{variable-> - (0..<4).collect{layer-> - def names = [] - TDirectory out = new TDirectory() - out.mkdir('/timelines') - (0..<11).collect{component-> - def file_index = '' - file_index = String.format('sector%02d_layer%d_component%02d', sector, layer, component) - names << String.format('atof_time_%s', file_index) - } - names.each{ name -> - def gr = new GraphErrors(name) - gr.setTitle( String.format("ATOF Time %s sector %02d layer %d", variable.replace('_', ' '), sector, layer)) - gr.setTitleY( String.format("ATOF Time %s sector %02d layer %d (ns)", variable.replace('_', ' '), sector, layer)) - gr.setTitleX("run number") - data.sort{it.key}.each{run,it-> - out.mkdir('/'+it.run) - out.cd('/'+it.run) - if (it.containsKey(name)){ - out.addDataSet(it[name]) - out.addDataSet(it['fit_'+name]) - gr.addPoint(it.run, it[variable + '_' + name], 0, 0) - } - else if (variable=="peak_location") println(String.format("run %d: %s either does not exist or does not have enough statistics.", it.run, name)) + ['peak_location', 'sigma'].each{variable-> + TDirectory out = new TDirectory() + out.mkdir('/timelines') + (0..<11).collect{component-> + def name = String.format('atof_time_%02d', component) + + def gr = new GraphErrors(name) + + gr.setTitle( String.format("ATOF Time %s ", variable.replace('_', ' '))) + gr.setTitleY( String.format("ATOF Time %s (ns)", variable.replace('_', ' '))) + gr.setTitleX("run number") + data.sort{it.key}.each{run,it-> + out.mkdir('/'+it.run) + out.cd('/'+it.run) + if (it.containsKey(name)){ + out.addDataSet(it[name]) + out.addDataSet(it['fit_'+name]) + gr.addPoint(it.run, it[variable + '_' + name], 0, 0) } - out.cd('/timelines') - out.addDataSet(gr) + else if (variable=="peak_location") println(String.format("run %d: %s either does not exist or does not have enough statistics.", it.run, name)) } - out.writeFile(String.format('alert_atof_time_%s_sector%02d_layer%d.hipo', variable, sector, layer)) + out.cd('/timelines') + out.addDataSet(gr) } + out.writeFile(String.format('alert_atof_time_%s.hipo', variable)) } } } diff --git a/src/main/java/org/jlab/clas/timeline/histograms/ALERT.java b/src/main/java/org/jlab/clas/timeline/histograms/ALERT.java index 8926fba32..09e1eb06c 100644 --- a/src/main/java/org/jlab/clas/timeline/histograms/ALERT.java +++ b/src/main/java/org/jlab/clas/timeline/histograms/ALERT.java @@ -57,21 +57,14 @@ public ALERT(int reqrunNum, String reqOutputDir, float reqEb, boolean reqTimeBas } rf_large_integer = 1000; - ATOF_Time = new H1F[660];// ATOF Time Histograms + ATOF_Time = new H1F[11];// ATOF Time Histograms - for (int index = 0; index < 660; index++) { - int sector = 0; - int layer = 0; - int component = 0; + for (int component = 0; component < 11; component++) { - sector = index / (11 * 4); - layer = (index % (11 * 4)) / 11; - component = index % 11; - - ATOF_Time[index] = new H1F(String.format("ATOF_Time_sector%02d_layer%d_component%02d", sector, layer, component), String.format("ATOF Time sector%02d layer%d component%02d", sector, layer, component), 300, 85, 100); - ATOF_Time[index].setTitleX("ATOF Time (ns)"); - ATOF_Time[index].setTitleY("Counts"); - ATOF_Time[index].setFillColor(4); + ATOF_Time[component] = new H1F(String.format("ATOF_Time_component%02d", component), String.format("ATOF Time component%02d", component), 240, 83, 95); + ATOF_Time[component].setTitleX("ATOF Time (ns)"); + ATOF_Time[component].setTitleY("Counts"); + ATOF_Time[component].setFillColor(4); } //AHDC ADC Histograms @@ -154,13 +147,11 @@ public void fillAHDC_hits(DataBank ahdc_hits) { public void fillATOF_hits(DataBank atof_hits) { int rows = atof_hits.rows(); for (int loop = 0; loop < rows; loop++) { - int sector = atof_hits.getInt("sector", loop); - int layer = atof_hits.getInt("layer", loop); + int component = atof_hits.getInt("component", loop); float time = atof_hits.getFloat("time", loop); - int index = sector * 44 + layer * 11 + component; - ATOF_Time[index].fill(time); + ATOF_Time[component].fill(time); } } @@ -231,8 +222,8 @@ public void write() { TDirectory dirout = new TDirectory(); dirout.mkdir("/ALERT/"); dirout.cd("/ALERT/"); - for (int index = 0; index < 660; index++) { - dirout.addDataSet(ATOF_Time[index]); + for (int component = 0; component < 11; component++) { + dirout.addDataSet(ATOF_Time[component]); } for (int index = 0; index < 576; index++) { dirout.addDataSet(ADC[index], AHDC_TIME[index]); diff --git a/src/main/java/org/jlab/clas/timeline/run_analysis.groovy b/src/main/java/org/jlab/clas/timeline/run_analysis.groovy index cad186ada..738be13b8 100644 --- a/src/main/java/org/jlab/clas/timeline/run_analysis.groovy +++ b/src/main/java/org/jlab/clas/timeline/run_analysis.groovy @@ -9,7 +9,7 @@ def engines = [ *(1..8).collect {ahdc_layer_number -> new alert_ahdc_adc (ahdc_layer_number) }, new alert_ahdc_residual(), *(1..8).collect {ahdc_layer_number -> new alert_ahdc_time (ahdc_layer_number) }, - *(0..14).collect {atof_sector -> new alert_atof_time(atof_sector)}, + new alert_atof_time(), ], out_BAND: [ new band_adccor(),