From 00dc0f16deda3c33a6ac0e9c81c7226a9fae8c66 Mon Sep 17 00:00:00 2001 From: Raffaella De Vita Date: Fri, 12 Apr 2024 13:49:56 -0400 Subject: [PATCH 1/2] New wagon for dc alignment --- .../custom-services/DCAlignmentWagon.java | 74 +++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 src/main/java/org/jlab/jnp/grapes/custom-services/DCAlignmentWagon.java diff --git a/src/main/java/org/jlab/jnp/grapes/custom-services/DCAlignmentWagon.java b/src/main/java/org/jlab/jnp/grapes/custom-services/DCAlignmentWagon.java new file mode 100644 index 0000000..1606e4b --- /dev/null +++ b/src/main/java/org/jlab/jnp/grapes/custom-services/DCAlignmentWagon.java @@ -0,0 +1,74 @@ +package org.jlab.jnp.grapes.services; + +import org.jlab.jnp.hipo4.data.Bank; +import org.jlab.jnp.hipo4.data.Event; +import org.jlab.jnp.hipo4.data.SchemaFactory; + +/** + * + * Skim for DC alignment + * + * Determine whether an electron candidate, defined as a track with associated + * Cherenkov and calorimter clusters, was detected. + * + * @author devita + */ +public class DCAlignmentWagon extends Wagon { + + static final double VZMIN = -35; + static final double VZMAX = 35; + static final double ECALMIN = 0; + static final double NPHEMIN = 2.0; + + public DCAlignmentWagon(){ + super("DCAlignmentWagon","devita","0.9"); + } + + @Override + public boolean init(String jsonString) { + return true; + } + + @Override + public boolean processDataEvent(Event event, SchemaFactory factory) { + + Bank particles = new Bank(factory.getSchema("REC::Particle")); + Bank calorimeters = new Bank(factory.getSchema("REC::Calorimeter")); + Bank cherenkovs = new Bank(factory.getSchema("REC::Cherenkov")); + event.read(particles); + event.read(calorimeters); + event.read(cherenkovs); + if (particles.getRows()<1) return false; + if (calorimeters.getRows()<1) return false; + if (cherenkovs.getRows()<1) return false; + + for(int ipart=0; ipart0 && + vz>VZMIN && vzNPHEMIN && + energy>ECALMIN) { + return true; + } + } + + return false; + } +} From 37deb67fe4c300f5c84f77c289b2b50a1e45a07c Mon Sep 17 00:00:00 2001 From: Raffaella De Vita Date: Fri, 19 Apr 2024 15:12:40 -0400 Subject: [PATCH 2/2] using part2detector Util class maps in DCAlignment wagon --- .../custom-services/DCAlignmentWagon.java | 34 +++++++++++-------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/src/main/java/org/jlab/jnp/grapes/custom-services/DCAlignmentWagon.java b/src/main/java/org/jlab/jnp/grapes/custom-services/DCAlignmentWagon.java index 1606e4b..ee5360c 100644 --- a/src/main/java/org/jlab/jnp/grapes/custom-services/DCAlignmentWagon.java +++ b/src/main/java/org/jlab/jnp/grapes/custom-services/DCAlignmentWagon.java @@ -1,5 +1,9 @@ package org.jlab.jnp.grapes.services; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.jlab.jnp.hipo4.data.Bank; import org.jlab.jnp.hipo4.data.Event; import org.jlab.jnp.hipo4.data.SchemaFactory; @@ -42,29 +46,29 @@ public boolean processDataEvent(Event event, SchemaFactory factory) { if (calorimeters.getRows()<1) return false; if (cherenkovs.getRows()<1) return false; + HashMap> part2ecal = Util.mapByIndex(calorimeters); + HashMap> part2cher = Util.mapByIndex(cherenkovs); + for(int ipart=0; ipart0 && - vz>VZMIN && vzNPHEMIN && - energy>ECALMIN) { + if( beta>0 && + vz>VZMIN && vzNPHEMIN && + energy>ECALMIN ) { return true; } }