Numass run 2016_10

This commit is contained in:
Alexander Nozik 2016-10-22 22:01:24 +03:00
parent 7d56682994
commit 3b5dbe34af
12 changed files with 34 additions and 74 deletions

View File

@ -47,5 +47,6 @@ task repl(dependsOn: classes, type: JavaExec) {
description "Start Grind repl" description "Start Grind repl"
standardInput = System.in standardInput = System.in
standardOutput = System.out standardOutput = System.out
args ["--config",]
group "numass" group "numass"
} }

View File

@ -7,9 +7,16 @@ import hep.dataforge.grind.GrindWorkspaceBuilder
* Created by darksnake on 29-Aug-16. * Created by darksnake on 29-Aug-16.
*/ */
def cli = new CliBuilder()
cli.c(longOpt: "config", args: 1, "The name of configuration file")
println cli.usage
String cfgPath = cli.parse(args).c;
println "Loading config file from $cfgPath"
new GrindShell().start { new GrindShell().start {
GrindWorkspaceBuilder numass = new GrindWorkspaceBuilder() GrindWorkspaceBuilder numass = new GrindWorkspaceBuilder()
.withSpec(NumassWorkspaceSpec) .withSpec(NumassWorkspaceSpec)
.from(new File("D:\\Work\\Numass\\sterile2016\\workspace.groovy")) .from(new File(cfgPath))
bind("numass", numass) bind("numass", numass)
} }

View File

@ -1,43 +0,0 @@
/*
* Copyright 2015 Alexander Nozik.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package inr.numass.scripts
import org.apache.commons.io.FilenameUtils
import static groovy.io.FileType.FILES
File dir = new File("D:\\loss-2014\\");
File resultDir = new File(dir, ".dataforge\\showLoss\\");
if(!resultDir.exists()){
resultDir.mkdirs()
}
File resultFile = new File(resultDir,"summary");
resultFile.setText("name\tX\tX_err\texPos\texPos_err\tionPos\tionPos_err\texW\texW_err\tionW\tionW_err\texIonRatio\texIonRatio_err\tionRatio\tionRatioErr\tchi\r\n");
dir.eachFileMatch FILES, {it ==~ /[dh]2_\d\d_\d(?:_bkg)?\.xml/}, {
try{
inr.numass.Main.main("-c", it.getAbsolutePath())
File outFile = new File(resultDir, FilenameUtils.getBaseName(it.getName()) + "_loss.onComplete")
resultFile.append(outFile.readLines().get(50));
resultFile.append("\r\n");
} catch(Exception ex){
ex.printStackTrace();
}
}

View File

@ -6,26 +6,21 @@
package inr.numass.scripts package inr.numass.scripts
import inr.numass.storage.NMFile import hep.dataforge.io.ColumnedDataWriter
import inr.numass.storage.NMPoint import hep.dataforge.tables.Table
import inr.numass.storage.NumassData import inr.numass.storage.NumassData
import inr.numass.storage.NumassDataLoader import inr.numass.storage.NumassDataLoader
import inr.numass.utils.UnderflowCorrection import inr.numass.utils.UnderflowCorrection
import hep.dataforge.meta.Meta
import hep.dataforge.tables.Table
import inr.numass.actions.PileupSimulationAction
import hep.dataforge.grind.GrindMetaBuilder
import hep.dataforge.io.ColumnedDataWriter
//File dataDir = new File("D:\\Work\\Numass\\data\\2016_04\\T2_data\\Fill_2_2\\set_7_b2a3433e54010000") //File dataDir = new File("D:\\Work\\Numass\\data\\2016_04\\T2_data\\Fill_2_2\\set_7_b2a3433e54010000")
//File dataDir = new File("D:\\Work\\Numass\\data\\2016_04\\T2_data\\Fill_2_2\\set_6_e26d123e54010000") //File dataDir = new File("D:\\Work\\Numass\\data\\2016_04\\T2_data\\Fill_2_2\\set_6_e26d123e54010000")
//if(!dataDir.exists()){ File dataDir = new File("D:\\Work\\Numass\\data\\2016_10\\Fill_1\\set_2")
// println "dataDir directory does not exist" if(!dataDir.exists()){
//} println "dataDir directory does not exist"
//NumassData data = NumassDataLoader.fromLocalDir(null, dataDir) }
NumassData data = NMFile.readFile(new File("D:\\Work\\Numass\\sterilie2013-2014\\dat\\2013\\SCAN06.DAT" )) NumassData data = NumassDataLoader.fromLocalDir(null, dataDir)
//NumassData data = NMFile.readFile(new File("D:\\Work\\Numass\\sterilie2013-2014\\dat\\2013\\SCAN06.DAT" ))
Table t = new UnderflowCorrection().fitAllPoints(data, 700, 1000,1800, 20); Table t = new UnderflowCorrection().fitAllPoints(data, 450, 1000, 1700, 20);
ColumnedDataWriter.writeDataSet(System.out, t, "underflow parameters") ColumnedDataWriter.writeDataSet(System.out, t, "underflow parameters")

View File

@ -47,13 +47,13 @@ public class NumassFitScanSummaryTask extends AbstractTask<Table> {
@Override @Override
protected TaskModel transformModel(TaskModel model) { protected TaskModel transformModel(TaskModel model) {
//Transmit meta as-is //Transmit meta as-is
model.dependsOn("numass.fitscan", model.meta(), "fitscan"); model.dependsOn("fitscan", model.meta(), "fitscan");
return model; return model;
} }
@Override @Override
public String getName() { public String getName() {
return "numass.scansum"; return "scansum";
} }
@TypedActionDef(name = "sterileSummary", inputType = FitState.class, outputType = Table.class) @TypedActionDef(name = "sterileSummary", inputType = FitState.class, outputType = Table.class)

View File

@ -80,16 +80,16 @@ public class NumassFitScanTask extends AbstractTask<FitState> {
//Transmit meta as-is //Transmit meta as-is
MetaBuilder metaBuilder = new MetaBuilder(model.meta()).removeNode("fit").removeNode("scan"); MetaBuilder metaBuilder = new MetaBuilder(model.meta()).removeNode("fit").removeNode("scan");
if (model.meta().hasMeta("filter")) { if (model.meta().hasMeta("filter")) {
model.dependsOn("numass.filter", metaBuilder.build(), "prepare"); model.dependsOn("filter", metaBuilder.build(), "prepare");
} else { } else {
model.dependsOn("numass.prepare", metaBuilder.build(), "prepare"); model.dependsOn("prepare", metaBuilder.build(), "prepare");
} }
return model; return model;
} }
@Override @Override
public String getName() { public String getName() {
return "numass.fitscan"; return "fitscan";
} }
} }

View File

@ -32,7 +32,7 @@ import inr.numass.actions.SummaryAction;
public class NumassFitSummaryTask extends SingleActionTask<FitState, Table> { public class NumassFitSummaryTask extends SingleActionTask<FitState, Table> {
@Override @Override
public String getName() { public String getName() {
return "numass.summary"; return "summary";
} }
@Override @Override
@ -54,7 +54,7 @@ public class NumassFitSummaryTask extends SingleActionTask<FitState, Table> {
protected TaskModel transformModel(TaskModel model) { protected TaskModel transformModel(TaskModel model) {
//Transmit meta as-is //Transmit meta as-is
MetaBuilder meta = model.meta().getBuilder().removeNode("summary"); MetaBuilder meta = model.meta().getBuilder().removeNode("summary");
model.dependsOn("numass.fit", meta.build(), "fit"); model.dependsOn("fit", meta.build(), "fit");
return model; return model;
} }

View File

@ -33,7 +33,7 @@ public class NumassFitTask extends SingleActionTask<Table, FitState> {
@Override @Override
public String getName() { public String getName() {
return "numass.fit"; return "fit";
} }
@Override @Override
@ -63,9 +63,9 @@ public class NumassFitTask extends SingleActionTask<Table, FitState> {
//Transmit meta as-is //Transmit meta as-is
MetaBuilder metaBuilder = new MetaBuilder(model.meta()).removeNode("fit"); MetaBuilder metaBuilder = new MetaBuilder(model.meta()).removeNode("fit");
if (model.meta().hasMeta("filter")) { if (model.meta().hasMeta("filter")) {
model.dependsOn("numass.filter", metaBuilder.build(), "prepare"); model.dependsOn("filter", metaBuilder.build(), "prepare");
} else { } else {
model.dependsOn("numass.prepare", metaBuilder.build(), "prepare"); model.dependsOn("prepare", metaBuilder.build(), "prepare");
} }
return model; return model;
} }

View File

@ -165,7 +165,7 @@ public class NumassPrepareTask extends AbstractTask<Table> {
@Override @Override
public String getName() { public String getName() {
return "numass.prepare"; return "prepare";
} }
@Override @Override

View File

@ -38,7 +38,7 @@ import java.util.Optional;
public class NumassSubstractEmptySourceTask extends AbstractTask<Table> { public class NumassSubstractEmptySourceTask extends AbstractTask<Table> {
@Override @Override
public String getName() { public String getName() {
return "numass.substractEmpty"; return "substractEmpty";
} }
@Override @Override
@ -64,7 +64,7 @@ public class NumassSubstractEmptySourceTask extends AbstractTask<Table> {
@Override @Override
protected TaskModel transformModel(TaskModel model) { protected TaskModel transformModel(TaskModel model) {
model.dependsOn("numass.prepare", model.meta(), "prepare"); model.dependsOn("prepare", model.meta(), "prepare");
return model; return model;
} }

View File

@ -17,7 +17,7 @@ public class NumassTableFilterTask extends SingleActionTask<Table, Table> {
@Override @Override
public String getName() { public String getName() {
return "numass.filter"; return "filter";
} }
@Override @Override
@ -29,9 +29,9 @@ public class NumassTableFilterTask extends SingleActionTask<Table, Table> {
protected TaskModel transformModel(TaskModel model) { protected TaskModel transformModel(TaskModel model) {
MetaBuilder metaBuilder = new MetaBuilder(model.meta()).removeNode("filter"); MetaBuilder metaBuilder = new MetaBuilder(model.meta()).removeNode("filter");
if (model.meta().hasMeta("empty")) { if (model.meta().hasMeta("empty")) {
model.dependsOn("numass.substractEmpty", metaBuilder.build(), "prepare"); model.dependsOn("substractEmpty", metaBuilder.build(), "prepare");
} else { } else {
model.dependsOn("numass.prepare", metaBuilder.build(), "prepare"); model.dependsOn("prepare", metaBuilder.build(), "prepare");
} }
return model; return model;
} }