diff --git a/src/main/java/org/jlab/jnp/grapes/custom-services/ElastWagon.java b/src/main/java/org/jlab/jnp/grapes/custom-services/ElastWagon.java index 0788c9c..a40e19d 100644 --- a/src/main/java/org/jlab/jnp/grapes/custom-services/ElastWagon.java +++ b/src/main/java/org/jlab/jnp/grapes/custom-services/ElastWagon.java @@ -5,75 +5,56 @@ import org.jlab.jnp.hipo4.data.Event; import org.jlab.jnp.hipo4.data.SchemaFactory; import java.util.ArrayList; +import java.util.Random; /** * * Skim for elastic e- events - * e- events are prescaled by THRESHOLD for elastic angle theta_ec=19204 && runno<19662) eb = 6.39463; //rgk-f23, rgk-s24 // if (runno>=19662 && runno<19894) eb = 8.47757; //rgk-s24 - double mp = 0.93828; - double theta_pc = Math.toRadians(THETA_PC); //proton theta cutoff - double theta_ec = 2*Math.atan(1/(Math.tan(theta_pc)*(1+eb/mp))); //electron pre-scale theta - ArrayList eleCandi = new ArrayList<>(); for (int ipart=0; ipart1) return false; @@ -83,21 +64,17 @@ public boolean processDataEvent(Event event, SchemaFactory factory) { double epz = RecPart.getFloat("pz",eleCandi.get(0)); double ee = Math.sqrt(epx*epx+epy*epy+epz*epz); - LorentzVector VVB = new LorentzVector(0,0,eb,eb); - LorentzVector VVT = new LorentzVector(0,0,0,mp); LorentzVector VVE = new LorentzVector(epx,epy,epz,ee); - double WW = Math.sqrt(getMM(VVB,VVT,VVE)); + double WW = this.getMissingVector(VVE).mass(); if (WW > W_CUT) return false; // W cut must go before theta_c cut! - if (VVE.theta() < theta_ec) { //theta_ec cut - callCount++; - if (callCount < THRESHOLD) return false; - if (callCount == THRESHOLD) callCount=0; + if (VVE.theta() < THETA_EC) { //theta_ec cut + return random.nextInt(PRESCALE)<1; } - return true; + return true; } }