diff --git a/common-tools/clas-physics/pom.xml b/common-tools/clas-physics/pom.xml
deleted file mode 100644
index f10d001d54..0000000000
--- a/common-tools/clas-physics/pom.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
- 4.0.0
-
- org.jlab.clas
- clas-physics
- 14.1.0-SNAPSHOT
- jar
-
-
- org.jlab.clas
- common-tools
- 14.1.0-SNAPSHOT
-
-
-
-
- junit
- junit
-
-
-
-
diff --git a/common-tools/clas-physics/src/main/java/org/jlab/clas/pdg/PDGDatabase.java b/common-tools/clas-physics/src/main/java/org/jlab/clas/pdg/PDGDatabase.java
deleted file mode 100644
index e607cc34c0..0000000000
--- a/common-tools/clas-physics/src/main/java/org/jlab/clas/pdg/PDGDatabase.java
+++ /dev/null
@@ -1,223 +0,0 @@
-package org.jlab.clas.pdg;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * PDG database class. Stores particle information in a Map. Particles information can be searched by LUND ID, GEANT ID, or simply the name of the particle.
- *
- * @author gavalian
- */
-public class PDGDatabase {
-
- static final HashMap particleDatabase = initDatabase();
-
- public PDGDatabase() {
- }
-
- public static boolean isValidId(int pid) {
- return particleDatabase.containsKey(pid);
- // ArrayList ff = null;
- }
-
- public static boolean isValidPid(int pid) {
- return particleDatabase.containsKey(pid);
- }
-
- static public PDGParticle getParticleById(int pid) {
- if (particleDatabase.containsKey(pid) == true) {
- return particleDatabase.get(pid);
- }
- System.err.println("PDGDatabase::Error -> there is no particle with pid " + pid);
- return null;
- }
-
- public static void addParticle(PDGParticle part) {
- if (particleDatabase.containsKey(part.pid()) == true) {
- System.out.println("PDGDatabase::Error -> Particle with PID " + part.pid() + " already exists in the database.");
- return;
- }
-
- particleDatabase.put(part.pid(), part);
- }
-
- public static void addParticle(String name, int pid, double mass, int charge) {
- if (particleDatabase.containsKey(pid) == true) {
- System.out.println("PDGDatabase::Error -> Particle with PID " + pid + " already exists in the database.");
- return;
- }
- particleDatabase.put(pid, new PDGParticle(name, pid, mass, charge));
- }
-
- private static HashMap initDatabase() {
- HashMap particleMap = new HashMap();
- particleMap.put(11, new PDGParticle("e-", 11, 3, 0.0005, -1));
- particleMap.put(-11, new PDGParticle("e+", -11, 2, 0.0005, 1));
- particleMap.put(12, new PDGParticle("nue-", 12, 4, 0.320e-6, 0));
- particleMap.put(-12, new PDGParticle("nue+", -12, 4, 0.320e-6, 0));
- particleMap.put(13, new PDGParticle("mu-", 13, 6, 0.1056583715, -1));
- particleMap.put(-13, new PDGParticle("mu+", -13, 5, 0.1056583715, 1));
- particleMap.put(12, new PDGParticle("nue-", 14, 4, 0.320e-6, 0));
- particleMap.put(-12, new PDGParticle("nue+", -14, 4, 0.320e-6, 0));
- particleMap.put(22, new PDGParticle("gamma", 22, 1, 0.000, 0));
- particleMap.put(45, new PDGParticle("d", 45, 45,1.87705, 1)); // This is not a PDG code.
-
- //Light mesons
- particleMap.put(211, new PDGParticle("pi+", 211, 8, 0.13957018, 1));
- particleMap.put(-211, new PDGParticle("pi-", -211, 9, 0.13957018, -1));
- particleMap.put(111, new PDGParticle("pi0", 111, 7, 0.134977, 0));
- particleMap.put(321, new PDGParticle("K+", 321, 11, 0.49367716, 1));
- particleMap.put(-321, new PDGParticle("K-", -321, 12, 0.49367716, -1));
- particleMap.put(311, new PDGParticle("K0", 311,0.497611, 0));
- particleMap.put(-311, new PDGParticle("K0bar", -311, 0.497611, 0));
- particleMap.put(130, new PDGParticle("K0_L", 130, 10,0.497611, 0));
- particleMap.put(310, new PDGParticle("K0_S", 310, 16, 0.497611, 0));
- particleMap.put(221, new PDGParticle("eta", 221, 17, 0.547862, 0));
- particleMap.put(331, new PDGParticle("eta'", 331, 0.95778, 0));
- particleMap.put(223, new PDGParticle("omega", 223, 0.78265, 0));
- particleMap.put(113, new PDGParticle("rho0", 113, 0.77526, 0));
- particleMap.put(213, new PDGParticle("rho+", 213, 0.77526, 1));
- particleMap.put(-213, new PDGParticle("rho-", -213, 12, 0.77526, -1));
- particleMap.put(333, new PDGParticle("phi", 333, 1.019461, 0));
-
- // a0 scalar mesons (I=1, J^PC = 0++), mass ~ 0.980 GeV
- particleMap.put(9000211, new PDGParticle("a0(980)+", 9000211, 0.980, 1));
- particleMap.put(9000111, new PDGParticle("a0(980)0", 9000111, 0.980, 0));
- particleMap.put(-9000211, new PDGParticle("a0(980)-", -9000211, 0.980, -1));
-
- // a1 axial vector mesons (I=1, J^PC = 1++), mass ~ 1.230 GeV
- particleMap.put(20213, new PDGParticle("a1(1260)+", 20213, 1.230, 1));
- particleMap.put(20113, new PDGParticle("a1(1260)0", 20113, 1.230, 0));
- particleMap.put(-20213, new PDGParticle("a1(1260)-", -20213, 1.230, -1));
-
- // b1 axial vector mesons (I=1, J^PC = 1+−), mass ~ 1.229 GeV
- particleMap.put(10213, new PDGParticle("b1(1235)+", 10213, 1.229, 1));
- particleMap.put(10113, new PDGParticle("b1(1235)0", 10113, 1.229, 0));
- particleMap.put(-10213, new PDGParticle("b1(1235)-", -10213, 1.229, -1));
-
- // f0(980) mesons (I=0, J^PC = 0++)
- particleMap.put(9000221, new PDGParticle("f0(980)", 9000221, 0.980, 0));
- // f1 axial vector mesons (I=0, J^PC = 1++), neutral only
- particleMap.put(20223, new PDGParticle("f1(1285)", 20223, 1.2819, 0));
- particleMap.put(10333, new PDGParticle("f1(1420)", 10333, 1.4264, 0));
-
- // h1 axial vector mesons (I=0, J^PC = 1+−), neutral only
- particleMap.put(10223, new PDGParticle("h1(1170)", 10223, 1.170, 0));
- particleMap.put(10331, new PDGParticle("h1(1380)", 10331, 1.380, 0));
-
- // Excited kaon resonances (K* states)
- particleMap.put(323, new PDGParticle("K*(892)+", 323, 0.892, 1));
- particleMap.put(-323, new PDGParticle("K*(892)-", -323, 0.892, -1));
- particleMap.put(313, new PDGParticle("K*(892)0", 313, 0.892, 0));
- particleMap.put(-313, new PDGParticle("K*(892)0bar", -313, 0.892, 0));
- particleMap.put(315, new PDGParticle("K*(1410)+", 315, 1.410, 1));
- particleMap.put(-315, new PDGParticle("K*(1410)-", -315, 1.410, -1));
- particleMap.put(325, new PDGParticle("K*(1410)0", 325, 1.410, 0));
- particleMap.put(-325, new PDGParticle("K*(1410)0bar", -325, 1.410, 0));
-
- // Charmonium mesons
- // J/psi mesons (1S state, 1^-)
- particleMap.put(443, new PDGParticle("J/psi", 443, 3.0969, 0));
- // eta_c mesons (1S state, 0^-)
- particleMap.put(441, new PDGParticle("eta_c", 441, 2.981, 0));
- // chi_c0 (2P state, 0++)
- particleMap.put(444, new PDGParticle("chi_c0", 444, 3.414, 0));
- // chi_c1 (2P state, 1++)
- particleMap.put(445, new PDGParticle("chi_c1", 445, 3.510, 0));
- // chi_c2 (2P state, 2++)
- particleMap.put(446, new PDGParticle("chi_c2", 446, 3.556, 0));
- // eta_c(2S) (2S state, 0^-)
- particleMap.put(447, new PDGParticle("eta_c(2S)", 447, 3.634, 0));
- // J/psi(2S) (2S state, 1^-)
- particleMap.put(448, new PDGParticle("J/psi(2S)", 448, 3.686, 0));
- // h_c (1P state, 1^+)
- particleMap.put(4415, new PDGParticle("h_c", 4415, 3.525, 0));
- // psi(2S) (1^-)
- particleMap.put(100443, new PDGParticle("psi(2S)", 100443, 3.686, 0));
- // psi(3770) (2S state, 1^-)
- particleMap.put(100443, new PDGParticle("psi(3770)", 100443, 3.770, 0));
- // eta_c(3S) (3S state, 0^-)
- particleMap.put(100447, new PDGParticle("eta_c(3S)", 100447, 3.750, 0));
-
- // Light baryons
-
- particleMap.put(2212, new PDGParticle("p", 2212, 14, 0.938272046, 1));
- particleMap.put(-2212, new PDGParticle("pbar", -2212, 15, 0.938272046, -1));
- particleMap.put(2112, new PDGParticle("n", 2112, 13, 0.939565379, 0));
- particleMap.put(-2112, new PDGParticle("nbar", -2112, 25, 0.939565379, 0));
- particleMap.put(2224, new PDGParticle("Delta++", 2224, 1.232, 2));
- particleMap.put(2214, new PDGParticle("Delta+", 2214, 1.232, 1));
- particleMap.put(2114, new PDGParticle("Delta0", 2114, 1.232, 0));
- particleMap.put(1114, new PDGParticle("Delta-", 1114, 1.232, -1));
- particleMap.put(-2224, new PDGParticle("AntiDelta--", -2224, 1.232, -2));
- particleMap.put(-2214, new PDGParticle("AntiDelta-", -2214, 1.232, -1));
- particleMap.put(-2114, new PDGParticle("AntiDelta0", -2114, 1.232, 0));
- particleMap.put(-1114, new PDGParticle("AntiDelta+", -1114, 1.232, 1));
- particleMap.put(3122, new PDGParticle("Lambda", 3122, 18, 1.115683, 0));
- particleMap.put(-3122, new PDGParticle("AntiLambda", -3122, 26, 1.115683, 0));
- particleMap.put(3222, new PDGParticle("Sigma+", 3222, 19, 1.18937, 1));
- particleMap.put(3212, new PDGParticle("Sigma0", 3212, 20, 1.192642, 0));
- particleMap.put(3112, new PDGParticle("Sigma-", 3112, 21, 1.197449, -1));
- particleMap.put(-3222, new PDGParticle("AntiSigma-", -3222, 27, 1.18937, -1));
- particleMap.put(-3212, new PDGParticle("AntiSigma0", -3212, 28, 1.192642, 0));
- particleMap.put(-3112, new PDGParticle("AntiSigma+", -3112, 29, 1.197449, 1));
- particleMap.put(3322, new PDGParticle("Xi0", 3322, 22, 1.31486, 0));
- particleMap.put(3312, new PDGParticle("Xi-", 3312, 23, 1.32171, -1));
- particleMap.put(-3322, new PDGParticle("AntiXi0", -3322, 30, 1.31486, 0));
- particleMap.put(-3312, new PDGParticle("AntiXi+", -3312, 31, 1.32171, 1));
- particleMap.put(3224, new PDGParticle("Sigma*+", 3224, 1.3828, 1));
- particleMap.put(3214, new PDGParticle("Sigma*0", 3214, 1.3846, 0));
- particleMap.put(3114, new PDGParticle("Sigma*-", 3114, 1.3872, -1));
- particleMap.put(3324, new PDGParticle("Xi*0", 3324, 1.5318, 0));
- particleMap.put(3314, new PDGParticle("Xi*-", 3314, 1.5334, -1));
- particleMap.put(-3224, new PDGParticle("AntiSigma*-", -3224, 1.3828, -1));
- particleMap.put(-3214, new PDGParticle("AntiSigma*0", -3214, 1.3846, 0));
- particleMap.put(-3114, new PDGParticle("AntiSigma*+", -3114, 1.3872, 1));
- particleMap.put(-3324, new PDGParticle("AntiXi*0", -3324, 1.5318, 0));
- particleMap.put(-3314, new PDGParticle("AntiXi*+", -3314, 1.5334, -1));
- particleMap.put(3334, new PDGParticle("Omega-", 3334, 24, 1.67245, -1));
- particleMap.put(-3334, new PDGParticle("AntiOmega+", -3334, 32, 1.67245, 1));
-
- particleMap.put(1000010020, new PDGParticle("deuteron", 1000010020, 45, 1.87612, 1));
- particleMap.put(1000010030, new PDGParticle("triton", 1000010030, 46, 2.80943, 1));
- particleMap.put(1000020030, new PDGParticle("He3", 1000020030, 49, 2.80941, 2));
- particleMap.put(1000020040, new PDGParticle("alpha", 1000020040, 47, 3.7284, 2));
-
- //522 deuteron 1000010020 1 100 Baryon 3 1.87612 0.00000e+00 -100 -1 -100 -1 -1 0
- //523 triton 1000010030 1 100 Baryon 3 2.80943 0.00000e+00 -100 -1 -100 -1 -1 0
- //524 He3 1000020030 1 100 Baryon 6 2.80941 0.00000e+00 -100 -1 -100 -1 -1 0
- //525 alpha 1000020040 1 100 Baryon 6 3.7284 0.00000e+00 -100 -1 -100 -1 -1 0
- //526 He6 1000020060 1 100 Baryon 6 5.60656 0.00000e+00 -100 -1 -100 -1 -1 0
- //527 Li6 1000030060 1 100 Baryon 9 5.60305 0.00000e+00 -100 -1 -100 -1 -1 0
- //528 Li7 1000030070 1 100 Baryon 9 6.53537 0.00000e+00 -100 -1 -100 -1 -1 0
-
- return particleMap;
- }
-
- static public PDGParticle getParticleByName(String name) {
- for (Map.Entry entry : particleDatabase.entrySet()) {
- Integer key = entry.getKey();
- PDGParticle value = (PDGParticle) entry.getValue();
- if (value.name().compareTo(name) == 0)
- return value;
- }
- return null;
- }
-
- public static void show() {
- for (Map.Entry items : particleDatabase.entrySet()) {
- System.out.println(items.getValue().toString());
- }
- }
-
- public static double getParticleMass(int pid) {
- double mass =0.0;
- if (particleDatabase.containsKey(pid) == true) {
- mass = particleDatabase.get(pid).mass();
- }
- else {
- System.out.println("PDGDatabase::Error -> there is no particle with pid " + pid);
- }
- return mass;
- }
-}
diff --git a/common-tools/clas-physics/src/main/java/org/jlab/clas/pdg/PDGParticle.java b/common-tools/clas-physics/src/main/java/org/jlab/clas/pdg/PDGParticle.java
deleted file mode 100644
index 48d6fd81de..0000000000
--- a/common-tools/clas-physics/src/main/java/org/jlab/clas/pdg/PDGParticle.java
+++ /dev/null
@@ -1,86 +0,0 @@
-package org.jlab.clas.pdg;
-
-/**
- *
- * @author gavalian
- */
-public class PDGParticle {
-
- String particleName = "unknown";
- Integer particleId = 0; /// PDG code and Geant4
- Integer particleIdGeant = 0; /// Geant3
- Double particleMass = 0.0; /// Units of Gev/c^2
- Integer particleCharge = -1; /// units of e
- Double particleWidth = 0.0; /// Units of Gev/c^2
-
- public PDGParticle(String partname, int partid, double partmass)
- {
- particleName = partname;
- particleId = partid;
- particleMass = partmass;
- }
-
- public PDGParticle(String partname, int partid, double partmass, int charge)
- {
- particleName = partname;
- particleId = partid;
- particleMass = partmass;
- particleCharge = charge;
- particleWidth = 0.0;
- }
-
- public PDGParticle(String partname, int partid, int geantid, double partmass, int charge)
- {
- particleName = partname;
- particleId = partid;
- particleIdGeant = geantid;
- particleMass = partmass;
- particleCharge = charge;
- particleWidth = 0.0;
- }
-
- public PDGParticle(String partname, int partid, double partmass, int charge, double width)
- {
- particleName = partname;
- particleId = partid;
- particleMass = partmass;
- particleCharge = charge;
- particleWidth = width;
- }
-
- public int charge()
- { return particleCharge;}
-
- public String name()
- {
- return particleName;
- }
-
- public int gid(){
- return particleIdGeant;
- }
-
- public int pid()
- {
- return particleId;
- }
-
- public double mass()
- {
- return particleMass;
- }
-
- public double width()
- {
- return particleWidth;
- }
-
- @Override
- public String toString(){
- StringBuilder str = new StringBuilder();
- str.append(String.format("[%12s] pid/gid %6d [%5d] %3d mass %8.5f width %8.5f",
- this.particleName,this.particleId,
- this.particleIdGeant, this.charge(), this.particleMass, this.particleWidth));
- return str.toString();
- }
-}
diff --git a/common-tools/clas-physics/src/main/java/org/jlab/clas/pdg/PhysicsConstants.java b/common-tools/clas-physics/src/main/java/org/jlab/clas/pdg/PhysicsConstants.java
deleted file mode 100644
index b6776188cf..0000000000
--- a/common-tools/clas-physics/src/main/java/org/jlab/clas/pdg/PhysicsConstants.java
+++ /dev/null
@@ -1,74 +0,0 @@
-package org.jlab.clas.pdg;
-
-/**
- *
- * @author gavalian
- */
-public class PhysicsConstants {
-
- public static double speedOfLight(){
- return 29.9792458;
- }
-
- public static double massProton(){
- return 0.938272046;
- }
-
- public static double massNeutron(){
- return 0.939565379;
- }
-
- public static double massElectron(){
- return 0.000511;
- }
-
- public static double massMuon() {
- return 0.1056583755;
- }
-
- public static double massPionCharged(){
- return 0.13957018;
- }
-
- public static double massPionNeutral(){
- return 0.1349766;
- }
-
- public static double massKaonCharged(){
- return 0.49367716;
- }
-
- public static double massKaonNeutral(){
- return 0.49761424;
- }
-
- public static double massDeuteron(){
- return 1.87612;
- }
- public static double massTriton(){
- return 2.80943;
- }
- public static double massHe3(){
- return 2.80941;
- }
- public static double massAlpha(){
- return 3.7284;
- }
-
-
- public static double getRandomGauss(double mean, double width){
- double u = 0;
- double v = 0;
- double r = 2.0;
-
- while(r<=0.0||r>1.0){
- u = Math.random()*2.0 - 1.0;
- v = Math.random()*2.0 - 1.0;
- r = u*u + v*v;
- }
-
- double c = Math.sqrt(-2*Math.log(r)/r);
- //System.out.println("u = " + u + " r = " + r + " c = " + c);
- return mean + u*c*width;
- }
-}
diff --git a/common-tools/clas-physics/src/main/java/org/jlab/clas/physics/EventFilter.java b/common-tools/clas-physics/src/main/java/org/jlab/clas/physics/EventFilter.java
deleted file mode 100644
index 5eba0fe358..0000000000
--- a/common-tools/clas-physics/src/main/java/org/jlab/clas/physics/EventFilter.java
+++ /dev/null
@@ -1,343 +0,0 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-package org.jlab.clas.physics;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Set;
-import org.jlab.clas.pdg.PDGDatabase;
-import org.jlab.clas.pdg.PDGParticle;
-
-/**
- *
- * @author gavalian
- */
-public class EventFilter {
-
- HashMap pParticleIDS;
- //ArrayList pOperationCuts;
-
- int nNegativeParticlesWithPid;
- int nPositiveParticlesWithPid;
- int nNeutralParticlesWithPid;
-
- int nNegativeParticlesCount;
- int nPositiveParticlesCount;
- int nNeutralParticlesCount;
-
- int nNegativeParticlesAny;
- int nPositiveParticlesAny;
- int nNeutralParticlesAny;
-
- int nPositiveParticles;
- int nNegativeParticles;
- int nNeutralParticles;
-
-
- long numberOfChecks = 0;
- long numberOfChecksPassed = 0;
- private String filterString = "";
-
- public EventFilter(String filter){
- pParticleIDS = new HashMap();
- //pOperationCuts = new ArrayList();
- this.setFilter(filter);
- }
-
- public EventFilter()
- {
- pParticleIDS = new HashMap();
- //pOperationCuts = new ArrayList();
- }
-
-
- public void addCut(String name, String particle, double min, double max)
- {
- //pOperationCuts.add(new ParticleOperation(name,particle,min,max));
- }
-
- public boolean checkFinalState(PhysicsEvent event)
- {
- boolean filter = true;
-
- int pc = event.countByCharge(+1);
- int pm = event.countByCharge(-1);
- int pn = event.countByCharge( 0);
-
- if(pcthis.getMaximumByCharge(+1))
- return false;
- if(pmthis.getMaximumByCharge(-1))
- return false;
- if(pnthis.getMaximumByCharge( 0))
- return false;
-
- Set pKeys = this.getIdKeys();
- Iterator it = pKeys.iterator();
- while(it.hasNext())
- {
- Integer key = (Integer) it.next();
- int idcount = this.getIdCount(key);
- if(event.countByPid(key)this.getMaximumByCharge(+1))
- return false;
- if(pmthis.getMaximumByCharge(-1))
- return false;
- if(pnthis.getMaximumByCharge( 0))
- return false;
-
- Set pKeys = this.getIdKeys();
- Iterator it = pKeys.iterator();
- while(it.hasNext())
- {
- Integer key = (Integer) it.next();
- int idcount = this.getIdCount(key);
- if(plist.countByPid(key)0){
- nPositiveParticlesWithPid += 1;
- } else {
- nNegativeParticlesWithPid += 1;
- }
- //increaseCharge(charge,1);
- }
- }
-
- public void parseChargedSign(String charge)
- {
- int clen = charge.length();
- char ctrail = charge.charAt(clen-1);
- int count = 0;
-
- if(clen==1)
- {
- count =1;
- } else {
- char pctrail = charge.charAt(clen-2);
- if(pctrail=='X'){
- setInclusive(ctrail);
- return;
- }
- count = Integer.parseInt(charge.substring(0, clen-1));
- }
-
- increaseChargeString(ctrail,count);
- }
-
- public int getIdCount(Integer pidKey)
- {
- return pParticleIDS.get(pidKey);
- }
-
- public Set getIdKeys()
- {
- return pParticleIDS.keySet();
- }
-
- public void setInclusive(char charge)
- {
- switch (charge)
- {
- case '+': nPositiveParticlesAny = -1;
- break;
- case '-': nNegativeParticlesAny = -1;
- break;
- case 'n': nNeutralParticlesAny = -1;
- break;
- default: break;
- }
- }
-
- public void increaseChargeString(char charge, int weight)
- {
- switch (charge)
- {
- case '+': nPositiveParticlesCount += weight;//increaseCharge(1,weight);
- break;
- case '-': nNegativeParticlesCount += weight;//increaseCharge(-1,weight);
- break;
- case 'n': nNeutralParticlesCount += weight;//increaseCharge(0,weight);
- break;
- default: break;
- }
- }
-
- public void increaseCharge(int charge, int weight)
- {
- switch (charge){
- case 1: if(nPositiveParticles>=0) nPositiveParticles+=weight;
- break;
- case -1: if(nNegativeParticles>=0) nNegativeParticles+=weight;
- break;
- case 0: if(nNeutralParticles>=0) nNeutralParticles+=weight;
- break;
- default: break;
- }
- }
-
- public final void setFilter(String opt)
- {
- this.filterString = opt;
- clear();
- String[] tokens = opt.split(":");
- for(int loop = 0; loop < tokens.length; loop++)
- {
- int tokenLen = tokens[loop].length();
- if(tokenLen>0)
- {
- char trailingChar = tokens[loop].charAt(tokenLen-1);
- if(trailingChar=='+'||trailingChar=='-'||trailingChar=='n')
- {
- parseChargedSign(tokens[loop]);
- } else {
- addPid(tokens[loop]);
- }
- }
- }
- this.numberOfChecks = 0;
- this.numberOfChecksPassed = 0;
- }
-
- public int getMinimumByCharge(int charge)
- {
- if(charge==0)
- {
- return (nNeutralParticlesWithPid + nNeutralParticlesCount);
- } else if(charge > 0) {
- return (nPositiveParticlesWithPid + nPositiveParticlesCount);
- }
-
- return (nNegativeParticlesWithPid + nNegativeParticlesCount);
- }
-
- public int getMaximumByCharge(int charge)
- {
- if(charge==0)
- {
- if(nNeutralParticlesAny<0){
- return 100;
- } else {
- return getMinimumByCharge(0);
- }
- }
-
- if(charge>0){
- if(nPositiveParticlesAny<0)
- {
- return 100;
- } else {
- return getMinimumByCharge(1);
- }
- }
-
- if(nNegativeParticlesAny<0)
- {
- return 100;
- } else {
- return getMinimumByCharge(-1);
- }
- }
-
- public int getCountByCharge(int charge)
- {
- if(charge==0)
- {
- return nNeutralParticles;
- } else if(charge>0) return nPositiveParticles;
- return nNegativeParticles;
- }
-
- @Override
- public String toString()
- {
- StringBuilder str = new StringBuilder();
- str.append(String.format("FILTER:---> POSITIVE : %6d %6d, NEGATIVE : %6d %6d , "
- + "NEUTRAL : %6d %6d",
- getMinimumByCharge( 1),getMaximumByCharge( 1),
- getMinimumByCharge(-1),getMaximumByCharge(-1),
- getMinimumByCharge( 0),getMaximumByCharge( 0)));
- //nPositiveParticles, nNegativeParticles, nNeutralParticles));
- return str.toString();
- }
-
-}
diff --git a/common-tools/clas-physics/src/main/java/org/jlab/clas/physics/LorentzVector.java b/common-tools/clas-physics/src/main/java/org/jlab/clas/physics/LorentzVector.java
deleted file mode 100644
index 2b20b5bd1f..0000000000
--- a/common-tools/clas-physics/src/main/java/org/jlab/clas/physics/LorentzVector.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-package org.jlab.clas.physics;
-
-/**
- *
- * @author gavalian
- */
-public class LorentzVector {
-
- Vector3 vector;
- double energy;
-
- /*
- * Default constructor creates the 0 - length lorenz vector
- */
- public LorentzVector() {
- vector = new Vector3();
- energy = 0.0;
- }
-
- public LorentzVector(LorentzVector v) {
- this.vector = new Vector3();
- this.vector.copy(v.vector);
- this.energy = v.energy;
- }
-
- public LorentzVector(double px, double py, double pz, double en) {
- vector = new Vector3();
- vector.setXYZ(px, py, pz);
- energy = en;
- }
-
- public void setPxPyPzE(double px, double py, double pz, double e) {
- vector.setXYZ(px, py, pz);
- energy = e;
- }
-
- public void setPxPyPzM(double px, double py, double pz, double m) {
- vector.setXYZ(px, py, pz);
- energy = Math.sqrt(m * m + vector.mag2());
- }
-
- public void setVectM(Vector3 vect, double m) {
- vector = vect;
- energy = Math.sqrt(m * m + vector.mag2());
- }
-
- public void rotateX(double angle) {
- vector.rotateX(angle);
- }
-
- public void rotateY(double angle) {
- vector.rotateY(angle);
- }
-
- public void rotateZ(double angle) {
- vector.rotateZ(angle);
- }
-
- public double px() {
- return vector.x();
- }
-
- public double py() {
- return vector.y();
- }
-
- public double pz() {
- return vector.z();
- }
-
- public double p() {
- return vector.mag();
- }
-
- public double theta() {
- return vector.theta();
- }
-
- public double phi() {
- return vector.phi();
- }
-
- public double mass2() {
- return (energy * energy - vector.mag2());
- }
-
- public double mass() {
- double m2 = this.mass2();
- if (m2 < 0)
- return -Math.sqrt(-m2);
- return Math.sqrt(m2);
- }
-
- public double e() {
- return energy;
- };
-
- void setE(double e) {
- energy = e;
- }
-
- public Vector3 boostVector() {
- if (energy == 0)
- return new Vector3(0., 0., 0.);
- return new Vector3(px() / energy, py() / energy, pz() / energy);
- }
-
- /*
- * Boosts the vector to the x y z components of a given vector.
- */
- public void boost(double bx, double by, double bz) {
- double b2 = bx * bx + by * by + bz * bz;
- double gamma = 1.0 / Math.sqrt(1.0 - b2);
- // System.out.println("GAMMA = " + gamma + " b2 = " + b2);
- double bp = bx * px() + by * py() + bz * pz();
- double gamma2 = b2 > 0 ? (gamma - 1.0) / b2 : 0.0;
-
- vector.setXYZ(px() + gamma2 * bp * bx + gamma * bx * e(), py() + gamma2 * bp * by + gamma * by * e(),
- pz() + gamma2 * bp * bz + gamma * bz * e());
- energy = gamma * (e() + bp);
- }
-
- public void copy(LorentzVector vect) {
- energy = vect.e();
- vector.setXYZ(vect.px(), vect.py(), vect.pz());
- }
-
- public void boost(Vector3 vect) {
- boost(vect.x(), vect.y(), vect.z());
- }
-
- public Vector3 vect() {
- return vector;
- }
-
- public void add(LorentzVector vLor) {
- vector.add(vLor.vect());
- energy = this.e() + vLor.e();
- }
-
- public void sub(LorentzVector vLor) {
- vector.sub(vLor.vect());
- energy = this.e() - vLor.e();
- }
-
- public void invert() {
- this.vector.setXYZ(-this.vector.x(), -this.vector.y(), -this.vector.z());
- this.energy = -this.energy;
- }
-
- public void print() {
- System.out.format("L Vect : %12.6f %12.6f %12.6f %12.6f %12.6f\n", this.px(), this.py(), this.pz(), this.p(), this.mass());
- }
-}
diff --git a/common-tools/clas-physics/src/main/java/org/jlab/clas/physics/Particle.java b/common-tools/clas-physics/src/main/java/org/jlab/clas/physics/Particle.java
deleted file mode 100644
index 29b95fcc20..0000000000
--- a/common-tools/clas-physics/src/main/java/org/jlab/clas/physics/Particle.java
+++ /dev/null
@@ -1,414 +0,0 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-package org.jlab.clas.physics;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.jlab.clas.pdg.PDGDatabase;
-import org.jlab.clas.pdg.PDGParticle;
-
-/**
- *
- * @author gavalian
- */
-
-public class Particle {
-
- LorentzVector partVector;
- Vector3 partVertex;
- int particleID;
- int particleGeantID;
- byte particleCharge;
- HashMap particleProperties;
-
- public Particle() {
- this.initParticleWithMass(0.0, 0., 0., 0., 0., 0., 0.);
- }
-
- public Particle(Particle p) {
- this.initParticle(p.pid(), p.px(), p.py(), p.pz(), p.vertex().x(), p.vertex().y(), p.vertex().z());
- }
-
- public Particle(int pid, double px, double py, double pz, double vx, double vy, double vz) {
- this.initParticle(pid, px, py, pz, vx, vy, vz);
- }
-
- public Particle(int pid, double px, double py, double pz) {
- this.initParticle(pid, px, py, pz, 0.0, 0.0, 0.0);
- }
-
- public Particle(int pid, double mass, byte charge, double px, double py, double pz, double vx, double vy, double vz) {
- this.initParticleWithMass(mass, px, py, pz, vx, vy, vz);
- particleID = pid;
- particleCharge = (byte) charge;
- }
-
- public static Particle createWithMassCharge(double mass, int charge ,double px, double py, double pz, double vx, double vy, double vz){
- Particle p = new Particle();
- p.initParticleWithMass(mass, px, py, pz, vx, vy, vz);
- p.particleCharge = (byte) charge;
- return p;
- }
-
- public static Particle createWithPid(int pid ,double px, double py, double pz, double vx, double vy, double vz){
- Particle p = new Particle(pid,px,py,pz,vx,vy,vz);
- return p;
- }
-
- public final void initParticleWithMass(double mass, double px, double py, double pz, double vx, double vy, double vz) {
- particleCharge = 0;
- partVector = new LorentzVector();
- partVertex = new Vector3(vx, vy, vz);
- partVector.setPxPyPzM(px, py, pz, mass);
- particleProperties = new HashMap();
- }
-
- public final void initParticle(int pid, double px, double py, double pz, double vx, double vy, double vz) {
- PDGParticle particle = PDGDatabase.getParticleById(pid);
- if (particle == null) {
- System.out.println("Particle: warning. particle with pid=" + pid + " does not exist.");
- initParticleWithMass(0., px, py, pz, vx, vy, vz);
- particleID = 0;
- particleGeantID = 0;
- } else {
- initParticleWithMass(particle.mass(), px, py, pz, vx, vy, vz);
- particleID = pid;
- particleGeantID = 0;// particle.gid();
- particleCharge = (byte) particle.charge();
- }
- }
-
- /**
- * Change the particle momenta from it's original value to new value
- *
- * @param mom
- * new particle momenta
- */
- public void setP(double mom) {
- double mag = this.vector().p();
- double factor = mom / mag;
- this.vector().setPxPyPzM(this.vector().vect().x() * factor, this.vector().vect().y() * factor, this.vector().vect().z() * factor,
- this.mass());
- }
-
- public void setTheta(double theta) {
- this.vector().vect().setMagThetaPhi(this.vector().p(), theta, this.vector().phi());
- }
-
- public void changePid(int pid) {
- PDGParticle part = PDGDatabase.getParticleById(pid);
- if (part == null) {
- System.err.println("[Particle::changePid] error ---> unknown particle id " + pid);
- return;
- }
- partVector.setPxPyPzM(this.partVector.px(), this.partVector.py(), this.partVector.pz(), part.mass());
-
- particleID = pid;
- }
-
- public void setParticleWithMass(double mass, byte charge, double px, double py, double pz, double vx, double vy, double vz) {
- partVector.setPxPyPzM(px, py, pz, mass);
- particleID = 0;
- particleGeantID = 0;
- particleCharge = charge;
- }
-
- public void setVector(int pid, double px, double py, double pz, double vx, double vy, double vz) {
- PDGParticle particle = PDGDatabase.getParticleById(pid);
- if (particle == null) {
- System.out.println("Particle: warning. particle with pid=" + pid + " does not exist.");
- particleID = 0;
- } else {
- partVector.setPxPyPzM(px, py, pz, particle.mass());
- partVertex.setXYZ(vx, vy, vz);
- particleID = pid;
- particleGeantID = particle.gid();
- particleCharge = (byte) particle.charge();
- }
- }
-
- public double px() {
- return this.vector().px();
- }
-
- public double py() {
- return this.vector().py();
- }
-
- public double pz() {
- return this.vector().pz();
- }
-
- public double p() {
- return this.vector().p();
- }
-
- public double theta() {
- return this.vector().theta();
- }
-
- public double phi() {
- return this.vector().phi();
- }
-
- public double e() {
- return this.vector().e();
- }
-
- public double vx() {
- return this.partVertex.x();
- }
-
- public double vy() {
- return this.partVertex.y();
- }
-
- public double vz() {
- return this.partVertex.z();
- }
-
- public void clearProperties() {
- particleProperties.clear();
- }
-
- public void setVector(int pid, Vector3 nvect, Vector3 nvert) {
- PDGParticle particle = PDGDatabase.getParticleById(pid);
- if (particle == null) {
- System.out.println("Particle: warning. particle with pid=" + pid + " does not exist.");
- particleID = 0;
- } else {
- partVector.setVectM(nvect, particle.mass());
- partVertex.setXYZ(nvert.x(), nvert.y(), nvert.z());
- particleID = pid;
- particleGeantID = particle.gid();
- particleCharge = (byte) particle.charge();
- }
- }
-
- public double euclideanDistance(Particle part) {
- double xx = (this.vector().px() - part.vector().px());
- double yy = (this.vector().py() - part.vector().py());
- double zz = (this.vector().pz() - part.vector().pz());
- return Math.sqrt(xx * xx + yy * yy + zz * zz);
- }
-
- public double cosTheta(Particle part) {
- if (part.vector().p() == 0 || this.vector().p() == 0)
- return -1;
- return part.vector().vect().dot(partVector.vect()) / (part.vector().vect().mag() * partVector.vect().mag());
- }
-
- void initParticleWithMassSquare(double mass2, double px, double py, double pz, double vx, double vy, double vz) {
- particleCharge = 0;
- partVector = new LorentzVector();
- partVertex = new Vector3(vx, vy, vz);
- partVector.setPxPyPzE(px, py, pz, Math.sqrt(px * px + py * py + pz * pz + mass2));
- particleProperties = new HashMap();
- }
-
- public void initParticleWithPidMassSquare(int pid, int charge, double mass2, double px, double py, double pz, double vx, double vy,
- double vz) {
- particleID = pid;
- particleCharge = (byte) charge;
- partVector = new LorentzVector();
- partVertex = new Vector3(vx, vy, vz);
- partVector.setPxPyPzE(px, py, pz, Math.sqrt(px * px + py * py + pz * pz + mass2));
- particleProperties = new HashMap();
- }
-
- public void setVector(LorentzVector nvec, Vector3 nvert) {
- partVector = nvec;
- partVertex = nvert;
- }
-
- public double mass() {
- return partVector.mass();
- }
-
- public double mass2() {
- return partVector.mass2();
- }
-
- public int charge() {
- return (int) particleCharge;
- }
-
- public int pid() {
- return particleID;
- }
-
- public int gid() {
- return particleGeantID;
- }
-
- public LorentzVector vector() {
- return partVector;
- }
-
- public Vector3 vertex() {
- return partVertex;
- }
-
- public double getProperty(String pname) {
- if (particleProperties.containsKey(pname) == true)
- return particleProperties.get(pname).doubleValue();
-
- return 0.0;
- }
-
- public Particle inFrame(Particle parent) {
- Vector3 boost = parent.vector().boostVector();
- Vector3 boostm = new Vector3(-boost.x(), -boost.y(), -boost.z());
- partVector.boost(boostm);
- return this;
- }
-
- public double get(String pname) {
- if (pname.compareTo("mass") == 0)
- return partVector.mass();
- if (pname.compareTo("mass2") == 0)
- return partVector.mass2();
- if (pname.compareTo("theta") == 0)
- return partVector.theta();
- if (pname.compareTo("phi") == 0)
- return partVector.phi();
- if (pname.compareTo("p") == 0)
- return partVector.p();
- if (pname.compareTo("mom") == 0)
- return partVector.p();
- if (pname.compareTo("e") == 0)
- return partVector.e();
- if (pname.compareTo("px") == 0)
- return partVector.px();
- if (pname.compareTo("py") == 0)
- return partVector.py();
- if (pname.compareTo("pz") == 0)
- return partVector.pz();
- if (pname.compareTo("vx") == 0)
- return partVertex.x();
- if (pname.compareTo("vy") == 0)
- return partVertex.y();
- if (pname.compareTo("vz") == 0)
- return partVertex.z();
- if (pname.compareTo("vertx") == 0)
- return partVertex.x();
- if (pname.compareTo("verty") == 0)
- return partVertex.y();
- if (pname.compareTo("vertz") == 0)
- return partVertex.z();
-
- System.out.println("[Particle::get] ERROR ----> variable " + pname + " is not defined");
- return 0.0;
- }
-
- public boolean hasProperty(String pname) {
- if (particleProperties.containsKey(pname) == true)
- return true;
- return false;
- }
-
- public void setProperty(String pname, double value) {
- // if(particleProperties.containsKey(pname)==true)
- particleProperties.put(pname, value);
- }
-
- public String propertyString() {
- StringBuilder str = new StringBuilder();
- Iterator it = particleProperties.entrySet().iterator();
- while (it.hasNext()) {
- Map.Entry pairs = (Map.Entry) it.next();
- str.append(String.format("%12s : %f", pairs.getKey(), pairs.getValue()));
- }
- return str.toString();
- }
-
- public String toLundString() {
- StringBuilder str = new StringBuilder();
- str.append(String.format("%3.0f. %4d %6d %2d %2d %9.4f %9.4f %9.4f ", (float) particleCharge, (int) 1, particleID, (int) 0, (int) 0,
- partVector.px(), partVector.py(), partVector.pz()));
-
- str.append(String.format("%9.4f %9.4f %11.4f %9.4f %9.4f", partVector.e(), partVector.mass(), partVertex.x(), partVertex.y(),
- partVertex.z()));
- /*
- * str.append(String.format("%6d %3d %9.5f %9.5f %9.5f %9.5f %9.5f %9.5f %9.5f %9.5f %9.5f %9.5f", particleID,particleCharge,partVector.mass(),
- * partVector.px(),partVector.py(),partVector.pz(), partVector.p(), Math.toDegrees(partVector.theta()), Math.toDegrees(partVector.phi()),
- * partVertex.x(),partVertex.y(),partVertex.z() ));
- */
- return str.toString();
- }
-
- @Override
- public String toString() {
- StringBuilder str = new StringBuilder();
- str.append(String.format("%6d %3d %9.5f %9.5f %9.5f %9.5f %9.5f %9.5f %9.5f", particleID, particleCharge, partVector.mass(),
- partVector.p(), Math.toDegrees(partVector.theta()), Math.toDegrees(partVector.phi()), partVertex.x(), partVertex.y(),
- partVertex.z()));
- return str.toString();
- }
-
- public void copyParticle(Particle part) {
- this.partVector.setPxPyPzM(part.vector().px(), part.vector().py(), part.vector().pz(), part.vector().mass());
- this.partVertex.setXYZ(part.vertex().x(), part.vertex().y(), part.vertex().z());
- particleID = part.pid();
- particleGeantID = part.gid();
- particleCharge = (byte) part.charge();
- }
-
- public void copy(Particle part) {
- this.copyParticle(part);
- }
-
- public void combine(Particle cpart, int sign) {
- particleID = 0;
- if (sign >= 0) {
- partVector.add(cpart.vector());
- } else {
- partVector.sub(cpart.vector());
- }
-
- particleCharge += cpart.charge();
-
- // if(this.mass()==0.0&&this.vector().p()==0.0)
- // {
- // System.err.println(" pid = " + cpart.pid());
- this.partVertex.setXYZ(cpart.vertex().x(), cpart.vertex().y(), cpart.vertex().z());
- // } else {
- /*
- * Line3D pl = new Line3D(); Line3D pn = new Line3D();
- *
- * pl.setOrigin(partVertex.x(), partVertex.y(), partVertex.z() );
- *
- * pl.setEnd(partVertex.x()+partVector.vect().x(), partVertex.y()+partVector.vect().y(), partVertex.z()+partVector.vect().z());
- *
- * pn.setOrigin( cpart.vertex().x(), cpart.vertex().y(), cpart.vertex().z());
- *
- * pn.setEnd( cpart.vertex().x() + cpart.vector().px(), cpart.vertex().y() + cpart.vector().py(), cpart.vertex().z() + cpart.vector().pz() ); Line3D doca =
- * pl.distance(pn); Point3D docam = doca.middle(); this.partVertex.setXYZ(docam.x(), docam.y(), docam.z());
- *
- * /* partVertex.setXYZ(cpart.vertex().x(), cpart.vertex().y(),cpart.vertex().z());
- */
- }
-
- public Vector3 particleDoca(Particle cpart) {
- /*
- * Line3D pl = new Line3D(); Line3D pn = new Line3D();
- *
- * pl.setOrigin(partVertex.x(), partVertex.y(), partVertex.z() );
- *
- * pl.setEnd(partVertex.x()+partVector.vect().x(), partVertex.y()+partVector.vect().y(), partVertex.z()+partVector.vect().z());
- *
- * pn.setOrigin( cpart.vertex().x(), cpart.vertex().y(), cpart.vertex().z());
- *
- * pn.setEnd( cpart.vertex().x() + cpart.vector().px(), cpart.vertex().y() + cpart.vector().py(), cpart.vertex().z() + cpart.vector().pz() );
- *
- * Line3D doca = pl.distance(pn); Point3D docam = doca.middle(); //this.partVertex.setXYZ(docam.x(), docam.y(), docam.z()); return new
- * BasicVector(docam.x(),docam.y(),docam.z());
- */
- return new Vector3();
- }
-
-}
diff --git a/common-tools/clas-physics/src/main/java/org/jlab/clas/physics/ParticleFinder.java b/common-tools/clas-physics/src/main/java/org/jlab/clas/physics/ParticleFinder.java
deleted file mode 100644
index 2e2992e821..0000000000
--- a/common-tools/clas-physics/src/main/java/org/jlab/clas/physics/ParticleFinder.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package org.jlab.clas.physics;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.jlab.clas.pdg.PDGDatabase;
-
-/**
- *
- * @author gavalian
- */
-public class ParticleFinder {
- private final List particleOperations = new ArrayList();
-
- public ParticleFinder(){
-
- }
-
- public void generate(PhysicsEvent event){
- particleOperations.clear();
- int nphotons = event.countByPid(22);
- if(nphotons<2) return;
- for(int i = 0; i < nphotons; i++){
- for(int k = 0; k < nphotons;k++){
- if(i!=k){
- particleOperations.add(String.format("[22,%d]+[22,%d]", i,k));
- }
- }
- }
- }
-
- public Particle getPion(PhysicsEvent event){
- this.generate(event);
-
- double mass = PDGDatabase.getParticleById(111).mass();
- double distance = 1.0;
- Particle pion = null;
- for(String selection : particleOperations){
- Particle candidate = event.getParticle(selection);
- if(Math.abs(candidate.vector().mass()-mass) < distance){
- distance = Math.abs(candidate.vector().mass()-mass);
- pion = candidate;
- }
- }
- return pion;
- }
-}
diff --git a/common-tools/clas-physics/src/main/java/org/jlab/clas/physics/ParticleGenerator.java b/common-tools/clas-physics/src/main/java/org/jlab/clas/physics/ParticleGenerator.java
deleted file mode 100644
index 7238af9259..0000000000
--- a/common-tools/clas-physics/src/main/java/org/jlab/clas/physics/ParticleGenerator.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-
-package org.jlab.clas.physics;
-
-/**
- *
- * @author gavalian
- */
-public class ParticleGenerator {
- private int particleID = 11;
- private double pCosThetaMin = -1.0;
- private double pCosThetaMax = 1.0;
- private double pPhiMin = -180.0;
- private double pPhiMax = -180.0;
- private double pMomentumMin = 1.0;
- private double pMomentumMax = 5.0;
- private final Vector3 vertexConstrains = new Vector3(0.0,0.0,0.0);
-
- public ParticleGenerator(int pid){
- particleID = pid;
- }
-
- public ParticleGenerator(int pid, double pmin, double pmax, double thmin, double thmax,
- double phimin, double phimax){
- particleID = pid;
- this.setRange(pmin, pmax, thmin, thmax, phimin, phimax);
- }
-
- public final void setRange(double pmin, double pmax, double thmin, double thmax,
- double phimin, double phimax){
- this.setMomRange(pmin, pmax);
- this.setThetaRange(thmin, thmax);
- this.setPhiRange(phimin, phimax);
- }
-
- public ParticleGenerator setMomRange(double pmin, double pmax){
- pMomentumMin = pmin;
- pMomentumMax = pmax;
- return this;
- }
-
- public ParticleGenerator setPhiRange(double pmin, double pmax){
- pPhiMin = pmin;
- pPhiMax = pmax;
- return this;
- }
-
- public ParticleGenerator setThetaRange(double tmin, double tmax){
- pCosThetaMin = Math.cos(Math.toRadians(tmin));
- pCosThetaMax = Math.cos(Math.toRadians(tmax));
- return this;
- }
-
- public Particle getParticle(){
- double p = pMomentumMin + Math.random()*(pMomentumMax-pMomentumMin);
- double theta = Math.acos(pCosThetaMin + Math.random()*(pCosThetaMax-pCosThetaMin));
- double phi = Math.toRadians(pPhiMin + Math.random()*(pPhiMax-pPhiMin));
- //Vector3 pvector = new Vector3(p*Math.sin(theta)*Math.cos(phi),
- //p*Math.sin(theta)*Math.sin(phi),p*Math.cos(theta));
- Particle part = new Particle(particleID,
- p*Math.sin(theta)*Math.cos(phi),
- p*Math.sin(theta)*Math.sin(phi),
- p*Math.cos(theta),0.0,0.0,0.0);
- return part;
- }
-
-}
diff --git a/common-tools/clas-physics/src/main/java/org/jlab/clas/physics/ParticleList.java b/common-tools/clas-physics/src/main/java/org/jlab/clas/physics/ParticleList.java
deleted file mode 100644
index 944eff28b9..0000000000
--- a/common-tools/clas-physics/src/main/java/org/jlab/clas/physics/ParticleList.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package org.jlab.clas.physics;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- *
- * @author gavalian
- */
-public class ParticleList {
-
- private List particles = new ArrayList();
-
- public ParticleList(){
-
- }
-
-
- public void add(Particle p){
- this.particles.add(p);
- }
-
- public void clear(){ particles.clear();}
-
- public int count(){ return particles.size();}
- /**
- * returns number of particles of given charge
- * @param charge charge of the particle
- * @return count
- */
- public int countByCharge(int charge){
- int count = 0;
- for(Particle p : particles){
- if(p.charge()==charge) count++;
- }
- return count;
- }
- /**
- * returns number of particles with given particle id (lund id)
- * @param pid particle id
- * @return count
- */
- public int countByPid(int pid){
- int count = 0;
- for(Particle p : particles){
- if(p.pid()==pid) count++;
- }
- return count;
- }
- /**
- * returns particle with id = pid and skips 'skip' particles
- * @param pid
- * @param skip
- * @return
- */
- public Particle getByPid(int pid, int skip){
- int skipped = 0;
- for(int i = 0; i < particles.size();i++){
- if(particles.get(i).pid()==pid){
- if(skipped==skip){
- return particles.get(i);
- } else {
- skipped++;
- }
- }
- }
- return null;
- }
- /**
- * returns particles by charge skipping skip particles.
- * @param charge
- * @param skip
- * @return
- */
- public Particle getByCharge(int charge, int skip){
- int skipped = 0;
- for(int i = 0; i < particles.size();i++){
- if(particles.get(i).charge()==charge){
- if(skipped==skip){
- return particles.get(i);
- } else {
- skipped++;
- }
- }
- }
- return null;
- }
-
- public String toLundString(){
- StringBuilder str = new StringBuilder();
- for(int loop = 0; loop < particles.size(); loop++){
- str.append(String.format("%5d", loop+1));
- str.append(particles.get(loop).toLundString());
- str.append("\n");
- }
- /*
- str.append(String.format("%10d %9.5f %9.5f\n",eventParticles.size(),eventBeam.vector().e(),
- eventTarget.vector().mass()));
- for(int loop = 0; loop < eventParticles.size(); loop++){
- str.append(eventParticles.get(loop).toString());
- str.append("\n");
- }*/
- return str.toString();
- }
-}
diff --git a/common-tools/clas-physics/src/main/java/org/jlab/clas/physics/ParticleNotFoundException.java b/common-tools/clas-physics/src/main/java/org/jlab/clas/physics/ParticleNotFoundException.java
deleted file mode 100644
index 80faaf4e5f..0000000000
--- a/common-tools/clas-physics/src/main/java/org/jlab/clas/physics/ParticleNotFoundException.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package org.jlab.clas.physics;
-
-/**
- *
- * @author gavalian
- */
-public class ParticleNotFoundException extends Exception {
- String message = "";
-
- public ParticleNotFoundException(String msg){
- super(msg);
- this.message = msg;
- }
-
- public ParticleNotFoundException(Throwable cause){
- super(cause);
- }
-
- @Override
- public String toString(){
- return message;
- }
-
- @Override
- public String getMessage(){
- return message;
- }
-}
diff --git a/common-tools/clas-physics/src/main/java/org/jlab/clas/physics/PhysicsEvent.java b/common-tools/clas-physics/src/main/java/org/jlab/clas/physics/PhysicsEvent.java
deleted file mode 100644
index 23553ba2dd..0000000000
--- a/common-tools/clas-physics/src/main/java/org/jlab/clas/physics/PhysicsEvent.java
+++ /dev/null
@@ -1,405 +0,0 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-package org.jlab.clas.physics;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-
-import org.jlab.clas.pdg.PDGDatabase;
-import org.jlab.clas.pdg.PDGParticle;
-import org.jlab.physics.base.EventSelector;
-
-/**
- *
- * @author gavalian
- */
-public class PhysicsEvent {
-
- Particle eventBeam;
- Particle eventTarget;
- private EventSelector eventSelector = new EventSelector();
- List eventParticles;
- List generatedParticles;
- HashMap eventProperties;
-
- private ParticleList mcEvent = new ParticleList();
- private double matchThresholdResolution = 0.02;
- private double matchThresholdAngle = 0.998;
-
- public PhysicsEvent() {
- eventBeam = new Particle(11, 0., 0., 5.017, 0., 0., 0.);
- eventTarget = new Particle(2212, 0., 0., 0., 0., 0., 0.);
- eventParticles = new ArrayList();
- generatedParticles = new ArrayList();
- eventProperties = new HashMap();
- }
-
- public PhysicsEvent(double be) {
- eventBeam = new Particle(11, 0., 0., be, 0., 0., 0.);
- eventTarget = new Particle(2212, 0., 0., 0., 0., 0., 0.);
- eventParticles = new ArrayList();
- generatedParticles = new ArrayList();
- eventProperties = new HashMap();
- }
-
- public void addProperty(String name, double value) {
- eventProperties.put(name, value);
- }
-
- public boolean hasProperty(String name) {
- return eventProperties.containsKey(name);
- }
-
- /**
- * returns generated event
- *
- * @return
- */
- public ParticleList mc() {
- return this.mcEvent;
- }
-
- /**
- * returns particle from reconstructed event that matches particle selected from generated event.
- *
- * @param pid
- * pid of the particle in generated event
- * @param skip
- * order of particle in generated event
- * @return particle from reconstructed event
- */
- public Particle getParticleMatchByPid(int pid, int skip) {
- Particle p = this.mcEvent.getByPid(pid, skip);
- Particle result = new Particle();
- double bestCos = 0.5;
- double bestRes = 0.5;
- // System.out.println(" LOOKING FOR MATCH WITH = " + p.toLundString());
- for (int i = 0; i < this.eventParticles.size(); i++) {
- if (p.charge() == this.eventParticles.get(i).charge()) {
- double cosTheta = p.cosTheta(eventParticles.get(i));
- double resolution = Math.abs((p.p() - eventParticles.get(i).p()) / p.p());
- // System.out.println(i + " " + " cos = " + cosTheta + " res = " + resolution);
- if (cosTheta > bestCos && resolution < bestRes) {
- if (cosTheta >= this.matchThresholdAngle && resolution < this.matchThresholdResolution) {
- bestCos = cosTheta;
- bestRes = resolution;
- // System.out.println(" THIS IS A GOOD PARTICLE = " + eventParticles.get(i).toLundString());
- result.copy(eventParticles.get(i));
- }
- }
- }
- }
- return result;
- }
-
- public double getProperty(String name) {
- return eventProperties.get(name);
- }
-
- public void clear() {
- eventParticles.clear();
- eventProperties.clear();
- generatedParticles.clear();
- }
-
- public int count() {
- return eventParticles.size();
- }
-
- public int countGenerated() {
- return generatedParticles.size();
- }
-
- public int countByCharge(int charge) {
- int icount = 0;
- // System.out.println("countainer size = " + eventParticles.size());
- for (int loop = 0; loop < eventParticles.size(); loop++) {
- // System.out.println("Particle pid = " + eventParticles.get(loop).pid()
- // + " charge = " + eventParticles.get(loop).charge());
- if (eventParticles.get(loop).charge() == charge)
- icount++;
- }
- // System.out.println("particles with charge " + charge + " = " + icount);
- return icount;
- }
-
- /**
- * returns number of particles with given PID (Lund id), if generated flag==true the count in generated particles is returned.
- *
- * @param pid
- * @param generated
- * @return
- */
- public int countByPid(int pid, boolean generated) {
- if (generated == false)
- return countByPid(pid);
- int icount = 0;
- for (int loop = 0; loop < generatedParticles.size(); loop++)
- if (generatedParticles.get(loop).pid() == pid)
- icount++;
- return icount;
- }
-
- public int countByPid(int pid) {
- int icount = 0;
- for (int loop = 0; loop < eventParticles.size(); loop++)
- if (eventParticles.get(loop).pid() == pid)
- icount++;
- return icount;
- }
-
- public void addGeneratedParticle(Particle part) {
- generatedParticles.add(part);
- }
-
- public void addGeneratedParticle(int pid, double px, double py, double pz, double vx, double vy, double vz) {
- generatedParticles.add(new Particle(pid, px, py, pz, vx, vy, vz));
- }
-
- public void addParticle(Particle part) {
- eventParticles.add(part);
- }
-
- public void addParticle(int pid, double px, double py, double pz, double vx, double vy, double vz) {
- eventParticles.add(new Particle(pid, px, py, pz, vx, vy, vz));
- }
-
- public void setBeam(String particle, double mom_z) {
- PDGParticle partInfo = PDGDatabase.getParticleByName(particle);
- if (partInfo != null) {
- this.eventBeam.setVector(partInfo.pid(), 0.0, 0.0, mom_z, 0.0, 0.0, -100.0);
- }
- }
-
- public void setBeam(double mom_z) {
- this.eventBeam = new Particle(11, 0.0, 0.0, mom_z, 0.0, 0.0, -100.0);
- }
-
- public void setBeamParticle(Particle p) {
- eventBeam.copyParticle(p);
- }
-
- public void setTargetParticle(Particle p) {
- eventTarget.copyParticle(p);
- }
-
- public Particle beamParticle() {
- return eventBeam;
- }
-
- public Particle targetParticle() {
- return eventTarget;
- }
-
- public int getParticleIndex(int pid, int skip) {
- int skiped = 0;
- for (int loop = 0; loop < eventParticles.size(); loop++) {
- // System.err.println("searching ----> " + CLASParticles.get(loop).getPid()
- // + " " + skip + " " + skiped);
- if (eventParticles.get(loop).pid() == pid) {
- if (skip == skiped)
- return loop;
- else
- skiped++;
- }
- }
- return -1;
- }
-
- public void removeParticleByPid(int pid, int skip) {
- int index = getParticleIndex(pid, skip);
- if (index < 0 || index >= this.count()) {
- System.out.println("----> error. paritcle does not exist pid=" + pid + " skip=" + skip);
- } else {
- this.removeParticle(index);
- }
- }
-
- public void removeParticle(int index) {
- eventParticles.remove(index);
- }
-
- public Particle getParticleByCharge(int charge, int skip) {
- int skiped = 0;
- for (int loop = 0; loop < eventParticles.size(); loop++) {
- // System.err.println("searching ----> " + CLASParticles.get(loop).getPid()
- // + " " + skip + " " + skiped);
- if (eventParticles.get(loop).charge() == charge) {
- if (skip == skiped)
- return eventParticles.get(loop);
- else
- skiped++;
- }
- }
- return null;
- }
-
- public Particle getParticleByCharge(int charge, int skip, int pid) {
- int skiped = 0;
- for (int loop = 0; loop < eventParticles.size(); loop++) {
- // System.err.println("searching ----> " + CLASParticles.get(loop).getPid()
- // + " " + skip + " " + skiped);
- if (eventParticles.get(loop).charge() == charge) {
- if (skip == skiped) {
- Particle ref = eventParticles.get(loop);
- Particle part = new Particle(pid, ref.vector().px(), ref.vector().py(), ref.vector().pz(), ref.vertex().x(),
- ref.vertex().y(), ref.vertex().z());
- return part;
- } else
- skiped++;
- }
- }
- return null;
- }
-
- public Particle getParticleByPid(int pid, int skip) {
- if (pid == 5000)
- return this.beamParticle();
- if (pid == 5001)
- return this.targetParticle();
-
- int index = this.getParticleIndex(pid, skip);
- if (index < 0 || index >= this.count()) {
- return new Particle(pid, 0., 0., 0., 0., 0., 0.);
- }
- return eventParticles.get(index);
- }
-
- public Particle getGeneratedParticle(int index) {
- if (index < 0 || index >= generatedParticles.size())
- return null;
- return generatedParticles.get(index);
- }
-
- public Particle getParticle(int index) {
- if (index < 0 || index >= eventParticles.size())
- return null;
- return eventParticles.get(index);
- }
-
- public Particle getParticle(String selector) {
- EventSelector evt_selector = new EventSelector(selector);
- return evt_selector.get(this);
- /*
- * eventSelector.parse(selector); return eventSelector.get(this);
- */
- }
-
- /* public Particle getParticleByPid(int pid, int skip) {
- if (pid == 5000)
- return this.beamParticle();
- if (pid == 5001)
- return this.targetParticle();
-
- int index = this.getParticleIndex(pid, skip);
- if (index < 0 || index >= this.count()) {
- return new Particle(pid, 0., 0., 0., 0., 0., 0.);
- }
- return eventParticles.get(index);
- }*/
-
- public String toLundStringGenerated() {
- StringBuilder str = new StringBuilder();
- str.append(String.format("%12d %2d. %2d. %2d %2d %5.3f %7.3f %7.3f %7.3f %7.3f\n", generatedParticles.size(), (int) 1, (int) 1,
- (int) 1, (int) 1, (float) 0.0, (float) 0.0, eventBeam.vector().e(), (float) 0.0, (float) 0.0));
- for (int loop = 0; loop < generatedParticles.size(); loop++) {
- str.append(String.format("%5d", loop + 1));
- str.append(generatedParticles.get(loop).toLundString());
- str.append("\n");
- }
- return str.toString();
- }
-
- public String toLundString() {
- StringBuilder str = new StringBuilder();
- str.append(String.format("%12d %2d. %2d. %2d %2d %5.3f %7.3f %7.3f %7.3f %7.3f\n", eventParticles.size(), (int) 1, (int) 1, (int) 1,
- (int) 1, (float) 0.0, (float) 0.0, eventBeam.vector().e(), (float) 0.0, (float) 0.0));
- for (int loop = 0; loop < eventParticles.size(); loop++) {
- str.append(String.format("%5d", loop + 1));
- str.append(eventParticles.get(loop).toLundString());
- str.append("\n");
- }
- /*
- * str.append(String.format("%10d %9.5f %9.5f\n",eventParticles.size(),eventBeam.vector().e(), eventTarget.vector().mass())); for(int loop = 0; loop <
- * eventParticles.size(); loop++){ str.append(eventParticles.get(loop).toString()); str.append("\n"); }
- */
- return str.toString();
- }
-
- @Override
- public String toString() {
- StringBuilder str = new StringBuilder();
- str.append(String.format("%12d %2d. %2d. %2d %2d %5.3f %7.3f %7.3f %7.3f %7.3f\n", eventParticles.size(), (int) 1, (int) 1, (int) 1,
- (int) 1, (float) 0.0, (float) 0.0, eventBeam.vector().e(), (float) 0.0, (float) 0.0));
- for (int loop = 0; loop < eventParticles.size(); loop++) {
- str.append(String.format("%5d", loop + 1));
- str.append(eventParticles.get(loop).toString());
- str.append("\n");
- }
- return str.toString();
- }
-
- public Particle closestParticle(Particle child) {
- Particle part = new Particle();
- double minCos = -1.0;
- int index = -2;
- int icounter = 0;
- for (Particle p : eventParticles) {
- double cth = p.cosTheta(child);
- if (cth > minCos) {
- minCos = cth;
- index = icounter;
- }
- icounter++;
- }
- if (index >= 0)
- part.copyParticle(eventParticles.get(index));
- return part;
- }
-
- public Vector3 primaryVertex() {
- Particle proton = this.getParticleByPid(2212, 0);
- if (proton.vector().p() > 0) {
- return this.beamParticle().particleDoca(proton);
- }
- return new Vector3();
- }
-
- Vector3 reactionVertexThreeParticles(int index[]) {
- if (index.length == 2) {
-
- }
- return new Vector3();
- }
-
- Vector3 reactionVertexTwoParticles(int index[]) {
- if (index.length == 2) {
-
- }
- return new Vector3();
- }
-
- public List getParticleListByPid(int... pids_order) {
- ArrayList plist = new ArrayList();
- for (int loop = 0; loop < pids_order.length; loop += 2) {
- Particle part = this.getParticleByPid(pids_order[loop], pids_order[loop + 1]);
- if (part != null) {
- plist.add(part);
- }
- }
- return plist;
- }
-
- public List getParticlesByPid(int pid){
- List plist = new ArrayList();
- for(Particle part: eventParticles){
- if(part.pid()==pid){
- plist.add(part);
- }
- }
- return plist;
- }
-}
diff --git a/common-tools/clas-physics/src/main/java/org/jlab/clas/physics/PhysicsKinematics.java b/common-tools/clas-physics/src/main/java/org/jlab/clas/physics/PhysicsKinematics.java
deleted file mode 100644
index 1e69d5ff64..0000000000
--- a/common-tools/clas-physics/src/main/java/org/jlab/clas/physics/PhysicsKinematics.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package org.jlab.clas.physics;
-
-import org.jlab.clas.reactions.DecayKinematics;
-
-/**
- *
- * @author gavalian
- */
-public class PhysicsKinematics {
-
- public static Particle getParticleUnBoosted(Particle frame, Particle part){
- Vector3 boost = frame.vector().boostVector();
- boost.negative();
- LorentzVector vecL = new LorentzVector();
- vecL.copy(part.vector());
- vecL.boost(boost);
- Vector3 partBoosted = new Vector3();
- partBoosted.copy(vecL.vect());
- Vector3 partInFrame = DecayKinematics.vectorToFrame(frame.vector().vect(), partBoosted);
- Particle result = new Particle();
- result.setParticleWithMass(part.mass(), (byte) part.charge(),
- partInFrame.x(),partInFrame.y(),partInFrame.z(),
- part.vertex().x(),part.vertex().y(),part.vertex().z());
- return result;
- }
-
- public static Particle getParticleUnBoosted(Particle frame, Particle part, Boolean isBoosted){
- Vector3 boost = frame.vector().boostVector();
- boost.negative();
- LorentzVector vecL = new LorentzVector();
- vecL.copy(part.vector());
- if(isBoosted==true){
- vecL.boost(boost);
- }
- Vector3 partBoosted = new Vector3();
- partBoosted.copy(vecL.vect());
- Vector3 partInFrame = DecayKinematics.vectorToFrame(frame.vector().vect(), partBoosted);
- Particle result = new Particle();
- result.setParticleWithMass(part.mass(), (byte) part.charge(),
- partInFrame.x(),partInFrame.y(),partInFrame.z(),
- part.vertex().x(),part.vertex().y(),part.vertex().z());
- return result;
- }
-
-}
diff --git a/common-tools/clas-physics/src/main/java/org/jlab/clas/physics/Vector3.java b/common-tools/clas-physics/src/main/java/org/jlab/clas/physics/Vector3.java
deleted file mode 100644
index 35cc04c4e8..0000000000
--- a/common-tools/clas-physics/src/main/java/org/jlab/clas/physics/Vector3.java
+++ /dev/null
@@ -1,216 +0,0 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-package org.jlab.clas.physics;
-
-/**
- *
- * @author gavalian
- */
-public class Vector3 {
- double fX;
- double fY;
- double fZ;
-
- public Vector3(Vector3 v){
- this.fX = v.fX;
- this.fY = v.fY;
- this.fZ = v.fZ;
- }
-
- public Vector3()
- {
- fX = 0.0;
- fY = 0.0;
- fZ = 0.0;
- }
- public Vector3(double x, double y, double z){
- fX = x;
- fY = y;
- fZ = z;
- }
-
- public double x() { return fX;}
- public double y() { return fY;}
- public double z() { return fZ;}
-
- public void setXYZ(double x, double y, double z)
- {
- fX = x;
- fY = y;
- fZ = z;
- }
-
- public void rotateX(double angle)
- {
- double s = Math.sin(angle);
- double c = Math.cos(angle);
- double yy = fY;
- fY = c*yy - s*fZ;
- fZ = s*yy + c*fZ;
- }
-
- public void rotateY(double angle)
- {
- double s = Math.sin(angle);
- double c = Math.cos(angle);
- double zz = fZ;
- fZ = c*zz - s*fX;
- fX = s*zz + c*fX;
- }
-
- public void rotateZ(double angle)
- {
- //rotate vector around Z
- double s = Math.sin(angle);
- double c = Math.cos(angle);
- double xx = fX;
- fX = c*xx - s*fY;
- fY = s*xx + c*fY;
- }
-
- public void setMagThetaPhi(double mag, double theta , double phi)
- {
- double amag = Math.abs(mag);
- fX = amag * Math.sin(theta) * Math.cos(phi);
- fY = amag * Math.sin(theta) * Math.sin(phi);
- fZ = amag * Math.cos(theta);
- }
-
- public void setMag(double mag) {
- if (this.mag()!=0) {
- final double scale = Math.abs(mag) / this.mag();
- fX *= scale;
- fY *= scale;
- fZ *= scale;
- }
- }
-
- public double mag2()
- {
- return (fX*fX+fY*fY+fZ*fZ);
- }
-
- public double mag()
- {
- return Math.sqrt(this.mag2());
- }
-
- public double rho()
- {
- return Math.sqrt(fX*fX + fY*fY);
- }
-
- public double theta()
- {
- return Math.acos(fZ/this.mag());
- }
-
- public double phi()
- {
- return Math.atan2(fY, fX);
- }
-
- public void add(Vector3 vector)
- {
- fX = fX + vector.x();
- fY = fY + vector.y();
- fZ = fZ + vector.z();
- }
-
- public void negative()
- {
- fX = -fX;
- fY = -fY;
- fZ = -fZ;
- }
-
- public void sub(Vector3 vector)
- {
- fX = fX - vector.x();
- fY = fY - vector.y();
- fZ = fZ - vector.z();
- }
-
- public double compare(Vector3 vect)
- {
- double quality = 0.0;
- quality += Math.abs(fX-vect.x())/Math.abs(fX);
- quality += Math.abs(fY-vect.y())/Math.abs(fY);
- quality += Math.abs(fZ-vect.z())/Math.abs(fZ);
- return quality;
- }
-
- public double dot(Vector3 vect)
- {
- return fX*vect.x()+fY*vect.y()+fZ*vect.z();
- }
-
- public Vector3 cross(Vector3 vect)
- {
- Vector3 vprod = new Vector3();
- vprod.setXYZ(fY*vect.z()-fZ*vect.y(),
- fZ*vect.x()-fX*vect.z(), fX*vect.y()-fY*vect.x());
- return vprod;
- }
-
- public double theta(Vector3 vect)
- {
- double res = 0;
- if(this.mag()!=0 && vect.mag()!=0)
- {
- res = Math.toDegrees( Math.acos(this.dot(vect)/(this.mag()*vect.mag() ) ) ) ;
- }
- return res;
- }
-
- public void copy(Vector3 vect)
- {
- fX = vect.x();
- fY = vect.y();
- fZ = vect.z();
- }
-
- public void unit()
- {
-
- if(this.mag()!=0)
- {
- double factor = 1.0/this.mag();
- fX = fX*factor;
- fY = fY*factor;
- fZ = fZ*factor;
- }
- }
-
- public double compareWeighted(Vector3 vect)
- {
- double quality = 0.0;
- double magFactor = mag();
- if(magFactor==0) magFactor = 0.000001;
- quality += Math.abs(fX/magFactor) * Math.abs(fX-vect.x())/Math.abs(fX);
- quality += Math.abs(fY/magFactor) * Math.abs(fY-vect.y())/Math.abs(fY);
- quality += Math.abs(fZ/magFactor) * Math.abs(fZ-vect.z())/Math.abs(fZ);
- return quality;
- }
-
- public String getXYZString()
- {
- StringBuilder str = new StringBuilder();
- str.append(String.format("%e %e %e",fX,fY,fZ));
- return str.toString();
- }
-
- public String getMagThetaPhiString()
- {
- StringBuilder str = new StringBuilder();
- str.append(String.format("%e %e %e",this.mag(),this.theta(),this.phi()));
- return str.toString();
- }
-
- @Override
- public String toString(){
- return this.getXYZString();
- }
-}
diff --git a/common-tools/clas-physics/src/main/java/org/jlab/clas/reactions/DecayKinematics.java b/common-tools/clas-physics/src/main/java/org/jlab/clas/reactions/DecayKinematics.java
deleted file mode 100644
index eba541f9b4..0000000000
--- a/common-tools/clas-physics/src/main/java/org/jlab/clas/reactions/DecayKinematics.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-package org.jlab.clas.reactions;
-
-import org.jlab.clas.physics.Vector3;
-import org.jlab.clas.physics.LorentzVector;
-/**
- *
- * @author gavalian
- */
-public class DecayKinematics {
-
- public static TransMatrix trMatrix = DecayKinematics.initMatrix();
-
- public DecayKinematics()
- {
-
- }
-
- public static TransMatrix initMatrix()
- {
- return new TransMatrix();
- }
-
- public static Vector3 vectorToLab(Vector3 frame, Vector3 vec)
- {
- DecayKinematics.trMatrix.compose(frame);
- DecayKinematics.trMatrix.inverse();
- return DecayKinematics.trMatrix.mult(vec);
- }
-
- public static Vector3 vectorToFrame(Vector3 frame, Vector3 vec)
- {
- DecayKinematics.trMatrix.compose(frame);
- return DecayKinematics.trMatrix.mult(vec);
- }
-
- public static double TwoBodyDecayMomentum(double M, double m1, double m2)
- {
- double mult1 = M*M - (m1+m2)*(m1+m2);
- double mult2 = M*M - (m1-m2)*(m1-m2);
- double mult = mult1*mult2;
- if(mult<0)
- {
- System.err.println("Decay:: error. particle with Mass="+M
- + " can not decay to particles with masses ( " + m1
- + " , " + m2 + " )");
- return -1.0;
- }
- return Math.sqrt(mult)/(2.0*M);
- }
-
- public static LorentzVector[] getDecayParticles(LorentzVector parent,
- double m1, double m2, double theta_rf, double phi_rf)
- {
- LorentzVector[] pd = new LorentzVector[2];
- for(int loop=0;loop<2;loop++) pd[loop] = new LorentzVector();
- double momentum = DecayKinematics.TwoBodyDecayMomentum(parent.mass(), m1, m2);
- Vector3 vz = new Vector3(0.,0.,0.);
- Vector3 v1 = new Vector3();
- Vector3 v2 = new Vector3();
-
- v1.setMagThetaPhi(momentum, theta_rf, phi_rf);
- vz.sub(v1);
- v2.setMagThetaPhi(momentum, Math.PI-theta_rf, 2.0*Math.PI-phi_rf);
- pd[0].setVectM(v1, m1);
- pd[1].setVectM(vz, m2);
- return pd;
- }
-
- public static LorentzVector[] getDecayParticlesLab(LorentzVector parent,
- double m1, double m2, double theta_rf, double phi_rf)
- {
- LorentzVector[] vectD = DecayKinematics.getDecayParticles(parent, m1, m2, theta_rf, phi_rf);
- Vector3 vboost = parent.boostVector();
- vectD[0].boost(vboost);
- vectD[1].boost(vboost);
- return vectD;
- }
-
-}
diff --git a/common-tools/clas-physics/src/main/java/org/jlab/clas/reactions/IDecay.java b/common-tools/clas-physics/src/main/java/org/jlab/clas/reactions/IDecay.java
deleted file mode 100644
index 5f567fe7d8..0000000000
--- a/common-tools/clas-physics/src/main/java/org/jlab/clas/reactions/IDecay.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-package org.jlab.clas.reactions;
-
-import org.jlab.clas.physics.PhysicsEvent;
-
-/**
- *
- * @author gagikgavalian
- */
-
-public interface IDecay {
- void init();
- void setDecayParticle(int id);
- void setDecayParticle(String name);
- void setDecayProducts(int pid1, int pid2);
- void setDecayProducts(String name1, String name2);
- void setDecayProducts(int pid1, int pid2, int pid3);
- void setDecayProducts(String name1, String name2, String name3);
- void decayParticles(PhysicsEvent event);
-}
diff --git a/common-tools/clas-physics/src/main/java/org/jlab/clas/reactions/TransMatrix.java b/common-tools/clas-physics/src/main/java/org/jlab/clas/reactions/TransMatrix.java
deleted file mode 100644
index f55bb6997c..0000000000
--- a/common-tools/clas-physics/src/main/java/org/jlab/clas/reactions/TransMatrix.java
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-package org.jlab.clas.reactions;
-
-import org.jlab.clas.physics.Vector3;
-
-/**
- *
- * @author gagikgavalian
- */
-public class TransMatrix {
- double[][] tMatrix;
- double[] partialMatrix;
-
- Vector3[] LabV;
- Vector3[] PrimeV;
-
- Vector3 Lab1;
- Vector3 Lab2;
- Vector3 Lab3;
- Vector3 Prime1;
- Vector3 Prime2;
- Vector3 Prime3;
-
- public TransMatrix()
- {
- tMatrix = new double[3][3];
- partialMatrix = new double[4];
-
- LabV = new Vector3[3];
- PrimeV = new Vector3[3];
-
- for(int loop = 0; loop < 3; loop++)
- {
- LabV[loop] = new Vector3();
- PrimeV[loop] = new Vector3();
- }
-
- LabV[0].setXYZ(1.0, 0.0, 0.0);
- LabV[1].setXYZ(0.0, 1.0, 0.0);
- LabV[2].setXYZ(0.0, 0.0, 1.0);
-
- PrimeV[0].setXYZ(1.0, 0.0, 0.0);
- PrimeV[1].setXYZ(0.0, 1.0, 0.0);
- PrimeV[2].setXYZ(0.0, 0.0, 1.0);
-
- Lab1 = new Vector3(1.0, 0.0, 0.0);
- Lab2 = new Vector3(0.0, 1.0, 0.0);
- Lab3 = new Vector3(0.0, 0.0, 1.0);
- Prime1 = new Vector3(1.0, 0.0, 0.0);
- Prime2 = new Vector3(0.0, 1.0, 0.0);
- Prime3 = new Vector3(0.0, 0.0, 1.0);
- }
-
- public double get(int row, int col)
- {
- return tMatrix[row][col];
- }
-
- public void set(int row, int col, double val)
- {
- tMatrix[row][col] = val;
- }
-
- double partialDet(int exrow, int excol)
- {
- int index = 0;
- for(int ir = 0; ir < 3; ir++)
- for(int ic = 0; ic < 3; ic++)
- {
- if(ir!=exrow&&ic!=excol)
- {
- partialMatrix[index] = get(ir,ic);
- index++;
- }
- }
- return (partialMatrix[3]*partialMatrix[0]-partialMatrix[1]*partialMatrix[2]);
- }
-
- public double det()
- {
- double determ = 0.0;
- double factor = +1.0;
- for(int ir=0;ir<3;ir++)
- {
- factor = +1.0;
- if(ir==1) factor = -1.0;
- determ += get(ir,0)*factor*partialDet(ir,0);
- }
- return determ;
- }
-
- double epsilon(int i, int j)
- {
- double e = 0.0;
- if(i==0||i==2){
- if(j==1){
- e = -1.;
- } else {
- e = +1.;
- }
- }
-
- if(i==1){
- if(j==1){
- e = +1.;
- } else {
- e = -1.;
- }
- }
- return e;
- }
- public void unit()
- {
- for(int ir = 0; ir < 3; ir++)
- for(int ic = 0; ic < 3; ic++)
- set(ir,ic,0.0);
- set(0,0,1.0);
- set(1,1,1.0);
- set(2,2,1.0);
- }
- public void setRow(int row, double v1, double v2, double v3)
- {
- set(row,0,v1);
- set(row,1,v2);
- set(row,2,v3);
- }
-
- public void compose(Vector3 vec)
- {
- PrimeV[1] = LabV[2].cross(vec);
- if(PrimeV[1].mag()==0)
- {
- //System.out.println("set prime vector to lab direction");
- PrimeV[1].setXYZ(0.0, 1.0, 0.0);
- }
- //System.out.println(" Mag = " + PrimeV[1].mag());
- PrimeV[1].unit();
- //System.out.println(" Mag unit = " + PrimeV[1].mag());
- PrimeV[2].setXYZ(vec.x(), vec.y(), vec.z());
- PrimeV[2].unit();
- PrimeV[0] = PrimeV[1].cross(PrimeV[2]);
-
- //System.out.println("-------> prime vector");
- /*for(int j = 0; j < 3; j++)
- System.out.println(PrimeV[j].x() + " " + PrimeV[j].y() + " " + PrimeV[j].z() + " " + PrimeV[j].mag());
- System.out.println("-------> lab vector");
- for(int j = 0; j < 3; j++)
- System.out.println(LabV[j].x() + " " + LabV[j].y() + " " + LabV[j].z());
- */
- for(int ir = 0; ir < 3; ir++)
- for(int ic=0;ic<3;ic++)
- this.set(ir, ic, PrimeV[ir].dot(LabV[ic]));
- }
-
- public Vector3 mult(Vector3 v)
- {
- Vector3 trvec = new Vector3();
- trvec.setXYZ(get(0,0)*v.x()+get(0,1)*v.y()+get(0,2)*v.z(),
- get(1,0)*v.x()+get(1,1)*v.y()+get(1,2)*v.z(),
- get(2,0)*v.x()+get(2,1)*v.y()+get(2,2)*v.z()
- );
- return trvec;
- }
-
- public void inverse()
- {
- double[][] matRes = new double[3][3];
- double determ = this.det();
- if(determ==0.0)
- {
- System.err.println("----> error in transmatrix deteminant is 0.0 and it can not be inversed.");
- return;
- }
-
- double rvalue;
-
- for(int ir = 0; ir < 3; ir++)
- for(int ic = 0; ic < 3; ic++)
- {
- // Check this later if the reversed index is correct for epsilon.
- rvalue = this.epsilon(ic, ir)*partialDet(ir,ic)/determ;
- //rvalue = partialDet(ir,ic)/determ;
- matRes[ir][ic] = rvalue;
- }
-
- for(int ir = 0; ir < 3; ir++)
- for(int ic = 0; ic < 3; ic++)
- {
- this.set(ir,ic,matRes[ic][ir]);
- //this.set(ir,ic,matRes[ir][ic]);
- }
- }
-
- public void print()
- {
- System.out.println("\n");
- for(int ir = 0; ir < 3; ir++)
- System.out.println(String.format("%8.5f,%8.5f,%8.5f",
- get(ir,0),get(ir,1),get(ir,2)));
-
- }
-}
diff --git a/common-tools/clas-physics/src/main/java/org/jlab/clas/reactions/TwoBodyDecay.java b/common-tools/clas-physics/src/main/java/org/jlab/clas/reactions/TwoBodyDecay.java
deleted file mode 100644
index d4d5216558..0000000000
--- a/common-tools/clas-physics/src/main/java/org/jlab/clas/reactions/TwoBodyDecay.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-package org.jlab.clas.reactions;
-
-import org.jlab.clas.pdg.PDGDatabase;
-import org.jlab.clas.pdg.PDGParticle;
-import org.jlab.clas.physics.LorentzVector;
-import org.jlab.clas.physics.Particle;
-import org.jlab.clas.physics.PhysicsEvent;
-import org.jlab.clas.physics.Vector3;
-
-
-/**
- *
- * @author gavalian
- */
-public class TwoBodyDecay implements IDecay {
-
- int decayParticleID1;
- int decayParticleID2;
- int parentParticleID;
- LorentzVector decayProd1;
- LorentzVector decayProd2;
-
- public TwoBodyDecay()
- {
- this.setDecayParticle(111);
- this.setDecayProducts(22,22);
- }
-
- public TwoBodyDecay(int parentID, int childid1, int childid2)
- {
- decayProd1 = new LorentzVector();
- decayProd2 = new LorentzVector();
- this.setDecayParticle(parentID);
- this.setDecayProducts(childid1,childid2);
- }
-
- public TwoBodyDecay(String parent, String child1, String child2)
- {
- this.setDecayParticle(parent);
- this.setDecayProducts(child1, child2);
- }
-
- public void init() {
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
- }
-
- public void setDecayParticle(int id) {
- this.parentParticleID = id;
- }
-
- public void setDecayParticle(String name) {
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
- }
-
- public void setDecayProducts(int pid1, int pid2) {
- this.decayParticleID1 = pid1;
- this.decayParticleID2 = pid2;
- }
-
- public void setDecayProducts(String name1, String name2) {
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
- }
-
- public void setDecayProducts(int pid1, int pid2, int pid3) {
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
- }
-
- public void setDecayProducts(String name1, String name2, String name3) {
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
- }
-
- private double getCosThetaRandom(){
- return Math.random()*2.0-1.0;
- }
-
- private double getPhiRandom(){
- return Math.random()*2.0*Math.PI-Math.PI;
- }
-
- public void decayParticles(PhysicsEvent event) {
- double cosTheta = this.getCosThetaRandom();
- double phi = this.getPhiRandom();
-
- PDGParticle p1 = PDGDatabase.getParticleById(decayParticleID1);
- PDGParticle p2 = PDGDatabase.getParticleById(decayParticleID2);
-
- Particle mother = event.getParticleByPid(parentParticleID, 0);
- LorentzVector vector = new LorentzVector();
- vector.copy(mother.vector());
-
- LorentzVector[] vec = DecayKinematics.getDecayParticles(vector,
- p1.mass(), p2.mass(), Math.acos(cosTheta), phi);
- Vector3 vectBoost = vector.boostVector();
- vec[0].boost(vectBoost);
- vec[1].boost(vectBoost);
- decayProd1.copy(vec[0]);
- decayProd2.copy(vec[1]);
-
- int index = event.getParticleIndex(parentParticleID, 0);
- event.removeParticle(index);
-
- event.addParticle(new Particle(decayParticleID1,
- vec[0].px(), vec[0].py(), vec[0].pz(),
- mother.vertex().x(),mother.vertex().y(),mother.vertex().z()
- ));
-
- event.addParticle(new Particle(decayParticleID2,
- vec[1].px(), vec[1].py(), vec[1].pz(),
- mother.vertex().x(),mother.vertex().y(),mother.vertex().z()
- ));
- }
-
-}
diff --git a/common-tools/clas-physics/src/main/java/org/jlab/physics/analysis/EventOperator.java b/common-tools/clas-physics/src/main/java/org/jlab/physics/analysis/EventOperator.java
deleted file mode 100644
index 8412e7f2c7..0000000000
--- a/common-tools/clas-physics/src/main/java/org/jlab/physics/analysis/EventOperator.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package org.jlab.physics.analysis;
-
-import java.util.ArrayList;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import org.jlab.clas.physics.EventFilter;
-import org.jlab.clas.physics.PhysicsEvent;
-
-/**
- *
- * @author gavalian
- */
-public class EventOperator {
-
- private String operatorName = "EV";
- private final Map operatorObservables = new LinkedHashMap();
- private final EventFilter eventFilter = new EventFilter();
-
- public EventOperator(){
-
- }
-
- public EventFilter getFilter(){return eventFilter;}
-
- public String getName(){ return operatorName; }
- public EventOperator setName(String name){operatorName = name;return this;}
- public EventOperator setFilter(String filter){eventFilter.setFilter(filter);return this;}
-
- public EventOperator setObservables(String... obsnames){
- operatorObservables.clear();
- for(String n : obsnames){
- operatorObservables.put(n, (Double) 0.0);
- }
- return this;
- }
-
- public void reset(){
- Set keys = this.operatorObservables.keySet();
- for(String key : keys) this.operatorObservables.put(key, (Double) 0.0);
- }
-
- public void operate(PhysicsEvent event){
-
- }
-
- public Map observableMap(){
- return this.operatorObservables;
- }
-
- public List observableList(){
- Set oset = operatorObservables.keySet();
- List names = new ArrayList();
- for(String on : oset){
- names.add(on);
- }
- return names;
- }
-
- @Override
- public String toString(){
- StringBuilder str = new StringBuilder();
- List names = observableList();
- str.append(String.format(" %12s :", getName()));
- for(String n : names){
- str.append(String.format("\t %s : ", n));
- str.append(this.operatorObservables.get(n));
- str.append("\n");
- }
- return str.toString();
- }
-}
diff --git a/common-tools/clas-physics/src/main/java/org/jlab/physics/analysis/GenericEventOperator.java b/common-tools/clas-physics/src/main/java/org/jlab/physics/analysis/GenericEventOperator.java
deleted file mode 100644
index bffc0f4b7a..0000000000
--- a/common-tools/clas-physics/src/main/java/org/jlab/physics/analysis/GenericEventOperator.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package org.jlab.physics.analysis;
-
-import java.util.List;
-import org.jlab.clas.physics.Particle;
-import org.jlab.clas.physics.PhysicsEvent;
-
-/**
- *
- * @author gavalian
- */
-public class GenericEventOperator extends EventOperator {
-
- private String operator = "";
-
- public GenericEventOperator(String name, String op, String... vars){
- setName(name);
- operator = op;
- setObservables(vars);
- }
-
- @Override
- public void operate(PhysicsEvent event){
- reset();
- if(getFilter().isValid(event)==false) return;
- Particle part = event.getParticle(operator);
- List obs = observableList();
- for(String o : obs){
- double value = part.getProperty(o);
- observableMap().put(o, value);
- }
- }
-}
diff --git a/common-tools/clas-physics/src/main/java/org/jlab/physics/analysis/PhysicsAnalysis.java b/common-tools/clas-physics/src/main/java/org/jlab/physics/analysis/PhysicsAnalysis.java
deleted file mode 100644
index b29d97d3e8..0000000000
--- a/common-tools/clas-physics/src/main/java/org/jlab/physics/analysis/PhysicsAnalysis.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package org.jlab.physics.analysis;
-
-import java.util.ArrayList;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import org.jlab.clas.physics.Particle;
-import org.jlab.clas.physics.PhysicsEvent;
-
-/**
- *
- * @author gavalian
- */
-public class PhysicsAnalysis {
-
- private Map descriptors = new LinkedHashMap();
- private Map observableMap = new LinkedHashMap();
- private String projectName = "defaultProject";
-
- public PhysicsAnalysis(){
-
- }
-
- public void addObservable(String descriptor, String observale){
- if(descriptors.containsKey(descriptor)==true){
- descriptors.get(descriptor).addObservable(observale);
- }
- }
-
- public void addDescriptor(ParticleDescriptor desc){
- this.descriptors.put(desc.getName(), desc);
- }
-
- public void addDescriptor(String name, String operator){
- this.addDescriptor(new ParticleDescriptor(name,operator));
- }
-
- public void processEvent(PhysicsEvent event){
- this.observableMap.clear();
- for(Map.Entry entry : this.descriptors.entrySet()){
- Particle particle = event.getParticle(entry.getValue().getOperator());
- for(String property : entry.getValue().observableList()){
- float pvalue = (float) particle.get(property);
- this.observableMap.put(entry.getKey()+":"+property, pvalue);
- }
- }
- }
-
- public Map getObservables(){
- return this.observableMap;
- }
-
- public String toTupleString(){
- StringBuilder str = new StringBuilder();
- for(Map.Entry entry : this.observableMap.entrySet()){
- str.append(String.format(" %f ", entry.getValue()));
- }
- return str.toString();
- }
-
- @Override
- public String toString(){
- StringBuilder str = new StringBuilder();
- for(Map.Entry entry : this.descriptors.entrySet()){
- str.append(entry.getValue().toString());
- str.append("\n");
- }
- return str.toString();
- }
-
- public static class ParticleDescriptor {
-
- String descriptorName = "";
- String descriptorOperator = "";
- List observables = new ArrayList();
-
- public ParticleDescriptor(String name, String operator){
- descriptorName = name;
- descriptorOperator = operator;
- }
-
- public String getName(){
- return descriptorName;
- }
-
- public String getOperator(){
- return this.descriptorOperator;
- }
-
- public void addObservable(String ob){
- this.observables.add(ob);
- }
-
- public List observableList(){
- return this.observables;
- }
-
- @Override
- public String toString(){
- StringBuilder str = new StringBuilder();
- str.append(String.format("%12s : %24s ", getName(),getOperator()));
- for(String obs : observables){
- str.append(String.format(" : %s ", obs));
- }
- return str.toString();
- }
- }
-
-}
diff --git a/common-tools/clas-physics/src/main/java/org/jlab/physics/analysis/PhysicsDataObject.java b/common-tools/clas-physics/src/main/java/org/jlab/physics/analysis/PhysicsDataObject.java
deleted file mode 100644
index 4286cf61d3..0000000000
--- a/common-tools/clas-physics/src/main/java/org/jlab/physics/analysis/PhysicsDataObject.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package org.jlab.physics.analysis;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- *
- * @author gavalian
- */
-public class PhysicsDataObject {
-
- List descriptors = new ArrayList();
-
- public PhysicsDataObject(){
-
- }
-
- public void addDescriptor(DataObjectDescriptor desc){
- this.descriptors.add(desc);
- }
-
- public void addDescriptor(String observable, String... cutList){
- DataObjectDescriptor desc = new DataObjectDescriptor(observable);
- for(String cut : cutList){
- desc.getDataCuts().add(cut);
- }
- addDescriptor(desc);
- }
-
- public class DataObjectDescriptor {
-
- String dataObservable = "";
- List dataCuts = new ArrayList();
-
- public DataObjectDescriptor(String obs){
- this.dataObservable = obs;
- }
-
- public String getDataObservable(){
- return this.dataObservable;
- }
-
- public List getDataCuts(){
- return dataCuts;
- }
-
- }
-}
diff --git a/common-tools/clas-physics/src/main/java/org/jlab/physics/base/DimensionSpace.java b/common-tools/clas-physics/src/main/java/org/jlab/physics/base/DimensionSpace.java
deleted file mode 100644
index 42b70b11ac..0000000000
--- a/common-tools/clas-physics/src/main/java/org/jlab/physics/base/DimensionSpace.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package org.jlab.physics.base;
-
-import java.awt.FlowLayout;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JSlider;
-
-/**
- *
- * @author gavalian
- */
-public class DimensionSpace {
-
-
- String dimName = "unknown";
- double dimValue = 0.5;
- double dimMinimum = 0.0;
- double dimMaximum = 1.0;
- double constrainUpper = 1.0;
- double constrainLower = 0.0;
- int numberOfBins = 1;
-
- JPanel dimPanel = null;
-
- public DimensionSpace(){
-
- }
-
- public DimensionSpace(String name, double min, double max){
- this.set(name, min, max);
- }
-
- public final void set(String name, double min, double max){
- this.dimName = name;
- this.dimMinimum = min;
- this.dimMaximum = max;
- this.dimValue = min + 0.5*(max-min);
- }
-
- public void reset(){
- this.constrainUpper = 1.0;
- this.constrainLower = 0.0;
- }
-
- public void setContsrains(double lower, double upper){
- this.constrainUpper = upper;
- this.constrainLower = lower;
- }
-
- public double getRandom(){
- double rndm = Math.random();
- double low = this.dimMinimum + (this.dimMaximum - this.dimMinimum)*this.constrainLower;
- double max = this.dimMinimum + (this.dimMaximum - this.dimMinimum)*this.constrainUpper;
- return low + rndm*(max-low);
- }
-
- public void setRandom(){
- this.dimValue = this.getRandom();
- }
-
- public int getBin(){
- double delta = (this.dimMaximum-this.dimMinimum)/this.numberOfBins;
- double w = (this.dimValue-this.dimMinimum)/delta;
- int bin = (int) w;
- return bin;
- }
-
- public int getNBins(){
- return this.numberOfBins;
- }
-
- public void setNBins(int bins){
- this.numberOfBins = bins;
- }
-
- public String getName(){ return this.dimName;}
-
- public void setValue(double value){ this.dimValue = value;}
-
- public void setValueNormalized(double value){
- if(value<0.0||value>1.0){
- System.out.println("error: normalized value has to be 0.0-1.0");
- } else {
- this.dimValue = this.dimMinimum + value*(this.dimMaximum-this.dimMinimum);
- }
- }
-
- public double getValue() { return this.dimValue;}
- public double getMin() { return this.dimMinimum;}
- public double getMax() { return this.dimMaximum;}
-
- public void createPanel(){
- this.dimPanel = new JPanel();
- this.dimPanel.setLayout(new FlowLayout());
- JLabel nameLabel = new JLabel(this.dimName);
- JSlider jsUpper = new JSlider(JSlider.HORIZONTAL,
- 0, 100, 0);
- JSlider jsLower = new JSlider(JSlider.HORIZONTAL,
- 0, 100, 100);
-
- this.dimPanel.add(nameLabel);
- this.dimPanel.add(jsUpper);
- this.dimPanel.add(jsLower);
- }
-
- public JPanel getPanel(){ return this.dimPanel;}
-
- @Override
- public String toString(){
- StringBuilder str = new StringBuilder();
- str.append(String.format("* %-24s * %12.6f * %12.6f * %12.6f * ",
- this.dimName,this.dimMinimum,this.dimMaximum,this.dimValue));
- return str.toString();
- }
-}
diff --git a/common-tools/clas-physics/src/main/java/org/jlab/physics/base/EventOperation.java b/common-tools/clas-physics/src/main/java/org/jlab/physics/base/EventOperation.java
deleted file mode 100644
index 2e981748cd..0000000000
--- a/common-tools/clas-physics/src/main/java/org/jlab/physics/base/EventOperation.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package org.jlab.physics.base;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.jlab.clas.physics.Particle;
-import org.jlab.clas.physics.PhysicsEvent;
-
-/**
- *
- * @author gavalian
- */
-public abstract class EventOperation {
-
- public List operators = new ArrayList();
- public List particles = new ArrayList();
- public List properties = new ArrayList();
-
- public EventOperation(){
-
- }
-
- public void init(String... oper){
- this.operators.clear();
- for(String item : oper){
- operators.add(item);
- }
- }
-
- abstract void processEvent(PhysicsEvent event);
-
- public void initParticles(PhysicsEvent event){
-
- }
-
- public double getProperty(){
- return 0.0;
- }
-
-}
diff --git a/common-tools/clas-physics/src/main/java/org/jlab/physics/base/EventSelector.java b/common-tools/clas-physics/src/main/java/org/jlab/physics/base/EventSelector.java
deleted file mode 100644
index 8c5cefa34c..0000000000
--- a/common-tools/clas-physics/src/main/java/org/jlab/physics/base/EventSelector.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-
-package org.jlab.physics.base;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.jlab.clas.physics.Particle;
-import org.jlab.clas.physics.ParticleNotFoundException;
-import org.jlab.clas.physics.PhysicsEvent;
-
-/**
- *
- * @author gavalian
- */
-public class EventSelector {
- private final ArrayList pSelectors = new ArrayList();
- private String selectorFormat = "";
- private final String openBracket = "[";
- private final String closeBracket = "]";
-
- public EventSelector(){
-
- }
-
- public EventSelector(String format){
- this.parse(format);
- }
-
- public final void parse(String format){
- pSelectors.clear();
- ParticleStringParser parser = new ParticleStringParser();
- List operators = parser.parse(format);
- selectorFormat = format.replaceAll("\\s+", "");
-
- for(String item : operators){
- ParticleSelector selector = new ParticleSelector(item);
- pSelectors.add(selector);
- }
- /*
- selectorFormat = format.replaceAll("\\s+", "");
- int position = selectorFormat.indexOf(this.closeBracket, 0);
- int lastposition = 0;
- while(position>0&&position plist = this.getParticleList(event);
- if(plist.isEmpty()) return null;
-
- Particle part = new Particle();
- part.copy(plist.get(0));
- for(int loop =1 ; loop < plist.size(); loop++){
- part.combine(plist.get(loop), 1);
- }
- return part;
- } catch (ParticleNotFoundException e){
- return new Particle();
- }
- }
-
- public List getParticleList(PhysicsEvent event) throws ParticleNotFoundException{
- ArrayList plist = new ArrayList();
- for(ParticleSelector sel : pSelectors){
- Particle part = new Particle();
- boolean status = sel.getParticle(event,part);
- if(status==false){
- throw new ParticleNotFoundException("[EventSelector::ERROR] event does no contain "
- + "particle for selector \n" + sel.toString());
- /*System.err.println("[EventSelector::ERROR] event does no contain "
- + "particle for selector \n" + sel.toString());*/
- } else {
- plist.add(part);
- }
- }
- return plist;
- }
-
- @Override
- public String toString(){
- StringBuilder str = new StringBuilder();
- str.append(String.format("EVENT SELECTOR : (%s)\n", this.selectorFormat));
- for(ParticleSelector psel : pSelectors){
- str.append(psel.toString());
- str.append("\n");
- }
- return str.toString();
- }
-
- public static void main(String[] args){
- EventSelector selector = new EventSelector("[b]+[t]+(211)-{2212,0}-[2212,1]");
- System.out.println(selector);
- }
-}
diff --git a/common-tools/clas-physics/src/main/java/org/jlab/physics/base/IEventFilter.java b/common-tools/clas-physics/src/main/java/org/jlab/physics/base/IEventFilter.java
deleted file mode 100644
index 639a23a8da..0000000000
--- a/common-tools/clas-physics/src/main/java/org/jlab/physics/base/IEventFilter.java
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-
-package org.jlab.physics.base;
-
-import org.jlab.clas.physics.PhysicsEvent;
-
-/**
- *
- * @author gavalian
- */
-public interface IEventFilter {
- void init(String format);
- Boolean isValid(PhysicsEvent event);
-}
diff --git a/common-tools/clas-physics/src/main/java/org/jlab/physics/base/IPhysicsCut.java b/common-tools/clas-physics/src/main/java/org/jlab/physics/base/IPhysicsCut.java
deleted file mode 100644
index ad1f634f27..0000000000
--- a/common-tools/clas-physics/src/main/java/org/jlab/physics/base/IPhysicsCut.java
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-
-package org.jlab.physics.base;
-
-import org.jlab.clas.physics.PhysicsEvent;
-
-/**
- *
- * @author gavalian
- */
-public interface IPhysicsCut {
- void init(String format);
- Boolean isValid(PhysicsEvent event);
-}
diff --git a/common-tools/clas-physics/src/main/java/org/jlab/physics/base/ParameterSpace.java b/common-tools/clas-physics/src/main/java/org/jlab/physics/base/ParameterSpace.java
deleted file mode 100644
index 5382a2e693..0000000000
--- a/common-tools/clas-physics/src/main/java/org/jlab/physics/base/ParameterSpace.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package org.jlab.physics.base;
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-/**
- *
- * @author gavalian
- */
-public class ParameterSpace {
- Map parameters = new LinkedHashMap();
- public ParameterSpace(){
-
- }
-
- public ParameterSpace addParameter(String name, double min, double max){
- parameters.put(name, new DimensionSpace(name,min,max));
- return this;
- }
-
- public ParameterSpace setValue(String name, double value){
- parameters.get(name).setValue(value);
- return this;
- }
-
- public double getValue(String name){
- return this.parameters.get(name).getValue();
- }
-}
diff --git a/common-tools/clas-physics/src/main/java/org/jlab/physics/base/ParticleSelector.java b/common-tools/clas-physics/src/main/java/org/jlab/physics/base/ParticleSelector.java
deleted file mode 100644
index 3db11302f7..0000000000
--- a/common-tools/clas-physics/src/main/java/org/jlab/physics/base/ParticleSelector.java
+++ /dev/null
@@ -1,337 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-
-package org.jlab.physics.base;
-
-import org.jlab.clas.pdg.PDGDatabase;
-import org.jlab.clas.pdg.PDGParticle;
-import org.jlab.clas.physics.Particle;
-import org.jlab.clas.physics.PhysicsEvent;
-
-/**
- *
- * @author gavalian
- */
-public class ParticleSelector {
-
- public static int TYPE_GENERATED = 1;
- public static int TYPE_RECONSTRUCED = 2;
- public static int TYPE_MATCHED = 3;
- public static int TYPE_DETECTOR_PARTICLE = 4;
-
- private Integer particleID = 11;
- private Integer particleSkip = 0;
- private Integer particleSign = 1;
- private String particleType = "11";
- private Integer particleSelectionType = ParticleSelector.TYPE_RECONSTRUCED;
- private Boolean overridePid = false;
- private Integer overrideParticleID = 11;
- private String selectorFormat = "[11,0]";
-
- private char bracketsOpen = '(';
- private char bracketsClose = ')';
-
- private final char[] bracketTypes = new char[]{'(',')','[',']','{','}'};
-
- public ParticleSelector(String format, int type){
-
- if(type>0&&type<4){
- bracketsOpen = bracketTypes[ (type-1)*2];
- bracketsClose = bracketTypes[ (type-1)*2 + 1];
- this.particleSelectionType = type;
- this.parse(format);
- }
- }
-
-
- public ParticleSelector(String format){
-
- int type = 1;
- if(format.charAt(format.length()-1)==')') type = 1;
- if(format.charAt(format.length()-1)==']') type = 2;
- if(format.charAt(format.length()-1)=='}') type = 3;
-
- if(type>0&&type<4){
- bracketsOpen = bracketTypes[ (type-1)*2];
- bracketsClose = bracketTypes[ (type-1)*2 + 1];
- this.particleSelectionType = type;
- this.parse(format);
- }
- }
-
- public ParticleSelector(){
-
- }
-
- public ParticleSelector(int pid, int skip, int sign){
- particleID = pid;
- particleSkip = skip;
- particleSign = sign;
- }
-
- private boolean parseParticleID(String text){
- //System.err.println("[DEBUG] ---> parsing particle ID = " + text);
- if(text.length()==1&&(text.compareTo("+")==0
- ||text.compareTo("-")==0||text.compareTo("n")==0)){
- particleID = 0;
- particleType = text;
- return true;
- }
-
- if(text.compareTo("b")==0){
- particleID = 5000;
- particleType = "beam";
- return true;
- }
-
- if(text.compareTo("t")==0){
- particleID = 5001;
- particleType = "target";
- return true;
- }
-
- //System.err.println("TEXT = " + text + " Check = " + text.matches("[0-9]+"));
-
- if (text.matches("-?[0-9]+") == true && text.length() > 0){
- particleID = Integer.parseInt(text);
- particleType = text;
- return true;
- } else {
- PDGParticle particle = PDGDatabase.getParticleByName(text);
- if(particle!=null){
- particleID = particle.pid();
- particleType = text;
- return true;
- } else {
- return false;
- }
- //System.err.println("Parsing as number : " + text);
- }
- }
-
- private void reset(){
- this.overridePid = false;
- this.overrideParticleID = 11;
- this.particleID = 11;
- this.particleType = "e-";
- this.particleSkip = 0;
- this.particleSign = 1;
- }
-
- public final void parse(String options){
- this.reset();
- selectorFormat = options.replaceAll("\\s+", "");
- String trimmed;
- if(selectorFormat.charAt(1)==this.bracketsOpen&&
- selectorFormat.charAt(selectorFormat.length()-1)==this.bracketsClose){
-
- if(selectorFormat.charAt(0)=='-'){
- this.particleSign = -1;
- } else {this.particleSign = 1;}
- trimmed = selectorFormat.substring(2, selectorFormat.length()-1);
- } else if(selectorFormat.charAt(0)==this.bracketsOpen&&
- selectorFormat.charAt(selectorFormat.length()-1)==this.bracketsClose){
- trimmed = selectorFormat.substring(1, selectorFormat.length()-1);
- this.particleSign = 1;
- } else {
- System.err.println("[ParticleSelector] ---> Syntax error. in string ("
- +this.selectorFormat + ").");
- return;
- }
-
- //trimmed = selectorFormat.substring(2, selectorFormat.length()-1);
- //System.err.println("[DEBUG]--> trimmed string = (" + trimmed + ")");
- String[] tokens = trimmed.split(",");
- if(tokens.length>0){
- this.parseParticleID(tokens[0]);
- this.overrideParticleID = this.particleID;
- }
-
- if(tokens.length>1){
- particleSkip = Integer.parseInt(tokens[1]);
- } else {
- particleSkip = 0;
- }
-
- if(tokens.length>2){
- overrideParticleID = Integer.parseInt(tokens[2]);
- this.overridePid = true;
- }
-
- }
-
- public int pid(){return particleID;}
- public int skip(){return particleSkip;}
-
- public boolean getParticle(PhysicsEvent event, Particle p){
-
- p.setParticleWithMass(0.0,(byte) 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
- try {
-
- if(particleID==5000){
- p.copyParticle(event.beamParticle());
- return true;
- }
- if(particleID==5001){
- p.copyParticle(event.targetParticle());
- return true;
- }
-
- } catch (Exception ex){
- System.out.println("ERROR: getting particle beam or target has failed");
- }
-
-
- if(this.particleSelectionType==ParticleSelector.TYPE_RECONSTRUCED&&event.countByPid(particleID)>>>>> COPY IS DONE ON " + fromEvent.toString());
- if(this.particleSign<0) p.vector().invert();
- return true;
- }
- p.initParticle(this.overrideParticleID,
- fromEvent.px(),
- fromEvent.py(),
- fromEvent.pz(),
- fromEvent.vertex().x(),
- fromEvent.vertex().y(),
- fromEvent.vertex().z()
- );
- if(this.particleSign<0) p.vector().invert();
- return true;
- } catch (Exception e){
-
- }
- return false;
- }
-
- public Particle getParticle(PhysicsEvent event){
- try {
- if(particleID==5000) return event.beamParticle();
- if(particleID==5001) return event.targetParticle();
-
- if(particleType.compareTo("-")==0){
- Particle fromEvent = event.getParticleByCharge(-1,particleSkip);
- Particle npart = new Particle(this.overrideParticleID,
- fromEvent.px(),
- fromEvent.py(),
- fromEvent.pz(),
- fromEvent.vertex().x(),
- fromEvent.vertex().y(),
- fromEvent.vertex().z()
- );
- if(this.particleSign<0) npart.vector().invert();
- return npart;
-
- }
-
- if(particleType.compareTo("+")==0){
- Particle fromEvent = event.getParticleByCharge(1,particleSkip);
- Particle npart = new Particle(this.overrideParticleID,
- fromEvent.px(),
- fromEvent.py(),
- fromEvent.pz(),
- fromEvent.vertex().x(),
- fromEvent.vertex().y(),
- fromEvent.vertex().z()
- );
- if(this.particleSign<0) npart.vector().invert();
- return npart;
- }
-
- if(particleType.compareTo("n")==0){
- Particle fromEvent = event.getParticleByCharge(0,particleSkip);
- Particle npart = new Particle(this.overrideParticleID,
- fromEvent.px(),
- fromEvent.py(),
- fromEvent.pz(),
- fromEvent.vertex().x(),
- fromEvent.vertex().y(),
- fromEvent.vertex().z()
- );
- if(this.particleSign<0) npart.vector().invert();
- return npart;
-
- }
-
- if(event.countByPid(particleID) idx = new ArrayList();
- for(int i = 0; i < index.length; i++){
- if(index[i]>=0) idx.add(index[i]);
- }
-
- int idxSize = idx.size();
-
- switch (idxSize){
- case 0: return -1;
- case 1: return idx.get(0);
- case 2: return Math.min(idx.get(0), idx.get(1));
- case 3: return Math.min(idx.get(2),Math.min(idx.get(0), idx.get(1)));
- default: return -1;
- }
- }
-
- private int getPositionOpen(String str, int start_index){
- int[] bracket_index = new int[3];
- bracket_index[0] = str.indexOf(ParticleStringParser.CURLY_BRACKET_OPEN, start_index);
- bracket_index[1] = str.indexOf(ParticleStringParser.SQUARE_BRACKET_OPEN, start_index);
- bracket_index[2] = str.indexOf(ParticleStringParser.ROUND_BRACKET_OPEN, start_index);
- return this.minIndex(bracket_index);
- }
-
- private int getPositionClose(String str, int start_index){
- int[] bracket_index = new int[3];
- bracket_index[0] = str.indexOf(ParticleStringParser.CURLY_BRACKET_CLOSE, start_index);
- bracket_index[1] = str.indexOf(ParticleStringParser.SQUARE_BRACKET_CLOSE, start_index);
- bracket_index[2] = str.indexOf(ParticleStringParser.ROUND_BRACKET_CLOSE, start_index);
- return this.minIndex(bracket_index);
- }
-
- private int getBracketType(String str, int pstart, int pend){
- char bstart = str.charAt(pstart);
- char bend = str.charAt(pend);
- if(bstart=='{'&&bend=='}'){
- return ParticleStringParser.BRACKET_TYPE_CURLY;
- }
- if(bstart=='['&&bend==']'){
- return ParticleStringParser.BRACKET_TYPE_SQUARE;
- }
- if(bstart=='('&&bend==')'){
- return ParticleStringParser.BRACKET_TYPE_ROUND;
- }
- return ParticleStringParser.BRACKET_TYPE_UNKNOWN;
- }
-
- public List parse(String strOperation){
-
- int start_position = 0;
- String operation = strOperation.replaceAll("\\s+", "");
- List operands = new ArrayList();
-
- while(start_position>=0&&start_position : " + item);
- }
- }
-}
diff --git a/common-tools/clas-physics/src/main/java/org/jlab/physics/base/PhaseSpace.java b/common-tools/clas-physics/src/main/java/org/jlab/physics/base/PhaseSpace.java
deleted file mode 100644
index e0ea96e3ad..0000000000
--- a/common-tools/clas-physics/src/main/java/org/jlab/physics/base/PhaseSpace.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package org.jlab.physics.base;
-
-import java.awt.FlowLayout;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.Set;
-import javax.swing.JFrame;
-import javax.swing.JPanel;
-
-/**
- *
- * @author gavalian
- */
-public class PhaseSpace {
-
- Map params = new LinkedHashMap();
- JPanel spacePanel = null;
-
- public PhaseSpace(){
-
- }
-
- public Set getKeys(){
- return params.keySet();
- }
-
- public void add(DimensionSpace space){
- this.params.put(space.getName(), space);
- }
-
- public void add(String name, double min, double max){
- this.add(new DimensionSpace(name,min,max));
- }
-
- public void add(String name, double value, double min, double max){
- DimensionSpace dim = new DimensionSpace(name,min,max);
- dim.setValue(value);
- this.add(dim);
- }
-
- public DimensionSpace getDimension(String name){
- return this.params.get(name);
- }
-
- public JPanel createPanel(){
- this.spacePanel = new JPanel();
- this.spacePanel.setLayout(new FlowLayout());
- for(Map.Entry item : this.params.entrySet()){
- item.getValue().createPanel();
- JPanel panel = item.getValue().getPanel();
- this.spacePanel.add(panel);
- }
- return this.spacePanel;
- }
-
- @Override
- public String toString(){
- StringBuilder str = new StringBuilder();
- for(int c = 0; c < 73; c++) str.append("*");
- str.append("\n");
- str.append(String.format("* %-24s * %12s * %12s * %12s * ",
- "Name", "Min","Max","Value"));
- str.append("\n");
- for(int c = 0; c < 73; c++) str.append("*");
- str.append("\n");
- for(Map.Entry item : this.params.entrySet()){
- str.append(item.getValue().toString());
- str.append("\n");
- }
- for(int c = 0; c < 73; c++) str.append("*");
- str.append("\n");
- return str.toString();
- }
-
- public void show(){
- System.out.println(this.toString());
- }
-
- public void setRandom(){
- for(Map.Entry entry : this.params.entrySet()){
- entry.getValue().setRandom();
- }
- }
-
- public PhaseSpace copy(){
- PhaseSpace space = new PhaseSpace();
- for(Map.Entry entry : this.params.entrySet()){
- space.add(entry.getKey(), entry.getValue().getMin(), entry.getValue().getMax());
- }
- return space;
- }
-
- public static void main(String[] args){
- PhaseSpace space = new PhaseSpace();
- space.add("x" , 0.0, 1.0);
- space.add("pt" , 0.5, 1.5);
-
- System.out.println(space);
-
- JFrame frame = new JFrame();
- frame.add(space.createPanel());
- frame.pack();
- frame.setVisible(true);
- }
-}
diff --git a/common-tools/clas-physics/src/main/java/org/jlab/physics/io/LundReader.java b/common-tools/clas-physics/src/main/java/org/jlab/physics/io/LundReader.java
deleted file mode 100644
index 94aa31437e..0000000000
--- a/common-tools/clas-physics/src/main/java/org/jlab/physics/io/LundReader.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-
-package org.jlab.physics.io;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.jlab.clas.physics.Particle;
-import org.jlab.clas.physics.PhysicsEvent;
-
-/**
- *
- * @author gavalian
- */
-public class LundReader {
- private final ArrayList inputFiles = new ArrayList();
- private BufferedReader reader = null;
- private PhysicsEvent physEvent = new PhysicsEvent();
-
- public LundReader() {
-
- }
-
- public LundReader(String file) {
- this.addFile(file);
- this.open();
- }
-
- public void addFile(String file) {
- inputFiles.add(file);
- }
-
- public void open() {
- this.openFile(0);
- }
-
- private Boolean openFile(int counter) {
- try {
- File file = new File(inputFiles.get(counter));
- reader = new BufferedReader(new FileReader(file));
- } catch (FileNotFoundException ex) {
- Logger.getLogger(LundReader.class.getName()).log(Level.SEVERE, null, ex);
- }
- return true;
- }
-
- public PhysicsEvent getEvent() {
- return physEvent;
- }
-
- public Boolean next() {
- try {
- physEvent.clear();
- String header = reader.readLine();
- if (header == null)
- return false;
- String[] tokens = header.trim().split("\\s+");
- // System.err.println("TOKENS size = " + tokens.length);
- // for(int loop = 0; loop < tokens.length; loop++){
- // System.err.println(" token " + loop + " = " + tokens[loop]);
- // }
- if (tokens.length != 10)
- return false;
- Integer nrows = Integer.parseInt(tokens[0]);
- if (nrows < 1)
- return false;
- physEvent.addProperty("nPart", nrows);
- physEvent.addProperty("nTarNucl", Double.parseDouble(tokens[1]));
- physEvent.addProperty("nTarProt", Double.parseDouble(tokens[2]));
- physEvent.addProperty("tarPol", Double.parseDouble(tokens[3]));
- physEvent.addProperty("beamPol", Double.parseDouble(tokens[4]));
- physEvent.addProperty("x", Double.parseDouble(tokens[5]));
- physEvent.addProperty("y", Double.parseDouble(tokens[6]));
- physEvent.addProperty("W", Double.parseDouble(tokens[7]));
- physEvent.addProperty("Q2", Double.parseDouble(tokens[8]));
- physEvent.addProperty("nu", Double.parseDouble(tokens[9]));
-
- for (int loop = 0; loop < nrows; loop++) {
- String particleLine = reader.readLine();
- if (particleLine != null) {
- String[] params = particleLine.trim().split("\\s+");
- // System.err.println("PARAMS LENGTH = " + params.length);
- if (params.length == 14) {
-
- int pid = Integer.parseInt(params[3]);
- // System.err.println("PID = " + pid);
- int status = Integer.parseInt(params[2]);
- double px = Double.parseDouble(params[6]);
- double py = Double.parseDouble(params[7]);
- double pz = Double.parseDouble(params[8]);
- double vx = Double.parseDouble(params[11]);
- double vy = Double.parseDouble(params[12]);
- double vz = Double.parseDouble(params[13]);
- if (status == 1) {
- physEvent.addParticle(new Particle(pid, px, py, pz, vx, vy, vz));
- }
- }
- }
- }
- return true;
- } catch (IOException ex) {
- Logger.getLogger(LundReader.class.getName()).log(Level.SEVERE, null, ex);
- }
- return false;
- }
-}
diff --git a/common-tools/clas-physics/src/main/java/org/jlab/physics/oper/PhysicsCutDescriptor.java b/common-tools/clas-physics/src/main/java/org/jlab/physics/oper/PhysicsCutDescriptor.java
deleted file mode 100644
index f9169c6030..0000000000
--- a/common-tools/clas-physics/src/main/java/org/jlab/physics/oper/PhysicsCutDescriptor.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package org.jlab.physics.oper;
-
-import java.util.Map;
-
-/**
- *
- * @author gavalian
- */
-public class PhysicsCutDescriptor {
-
- private String operator = "";
- private String variable = "";
- private double variableMin = 0.0;
- private double variableMax = 100.0;
- private String cutName = "default";
-
- public PhysicsCutDescriptor(String name, String variable, double min, double max){
- this.cutName = name;
- this.setVariable(variable);
- this.setMinMax(min, max);
- }
-
- public final void setName(String name){ this.cutName = name; }
- public String getName() { return this.cutName;}
-
- public final void setVariable(String var){
- this.variable = var;
- }
-
- public final void setMinMax(double min, double max){
- this.variableMin = min;
- this.variableMax = max;
- }
-
- public double getMin(){ return this.variableMin; }
- public double getMax(){ return this.variableMax;}
-
- public boolean isValid(Map map){
- if(map.containsKey(this.variable)==false) return false;
- double value = map.get(this.variable).getValue();
- return (value>=this.variableMin&&value<=this.variableMax);
- }
-
- @Override
- public String toString(){
- StringBuilder str = new StringBuilder();
- str.append(String.format("* %-12s * %-12s * (%12.5f, %12.5f) *\n",
- this.cutName,this.variable,
- this.variableMin,this.variableMax));
- return str.toString();
- }
-}
diff --git a/common-tools/clas-physics/src/main/java/org/jlab/physics/oper/PhysicsEventOperator.java b/common-tools/clas-physics/src/main/java/org/jlab/physics/oper/PhysicsEventOperator.java
deleted file mode 100644
index 9efcc3dcd5..0000000000
--- a/common-tools/clas-physics/src/main/java/org/jlab/physics/oper/PhysicsEventOperator.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package org.jlab.physics.oper;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.jlab.clas.physics.Particle;
-import org.jlab.clas.physics.PhysicsEvent;
-
-/**
- *
- * @author gavalian
- */
-public class PhysicsEventOperator {
-
- private String operatorName = "unknown";
- private Double varMinimum = 0.0;
- private Double varMaximum = 0.0;
- private String particleSelector = "[b]";
- private String particleVariable = "mom";
- private Double currentValue = 0.0;
- private ArrayList operatorCuts = new ArrayList();
-
- public PhysicsEventOperator(String name, String variable, String particle,
- double min, double max){
- this.set(name, variable, particle);
- this.setLimits(min, max);
- }
-
- public final void set(String name, String variable, String particle){
- this.operatorName = name;
- this.particleVariable = variable;
- this.particleSelector = particle;
- }
-
- public final void setLimits(double min, double max){
- this.varMinimum = min;
- this.varMaximum = max;
- }
-
- public void apply(PhysicsEvent event){
- Particle part = event.getParticle(this.particleSelector);
- this.currentValue = part.get(this.particleVariable);
- }
-
- public boolean isValid(){
- return (this.currentValue>=this.varMinimum&&this.currentValue getCuts(){return this.operatorCuts;}
- public double getValue(){ return this.currentValue;};
-
- @Override
- public String toString(){
- return this.stringValue();
- }
-}
diff --git a/common-tools/clas-physics/src/main/java/org/jlab/physics/oper/PhysicsEventProcessor.java b/common-tools/clas-physics/src/main/java/org/jlab/physics/oper/PhysicsEventProcessor.java
deleted file mode 100644
index f524f2eee7..0000000000
--- a/common-tools/clas-physics/src/main/java/org/jlab/physics/oper/PhysicsEventProcessor.java
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package org.jlab.physics.oper;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.TreeMap;
-import org.jlab.clas.physics.EventFilter;
-import org.jlab.clas.physics.Particle;
-import org.jlab.clas.physics.PhysicsEvent;
-
-/**
- *
- * @author gavalian
- */
-public class PhysicsEventProcessor {
-
- private final TreeMap operators = new TreeMap();
- private final TreeMap particleDescriptors =
- new TreeMap();
- private final TreeMap cutDescriptors =
- new TreeMap();
-
- private final TreeMap histDescriptors =
- new TreeMap();
-
- private Particle beamParticle = new Particle(11,0.0,0.0,11.0,0.0,0.0,0.0);
- private EventFilter eventFilter = new EventFilter();
-
-
- public PhysicsEventProcessor(double energy, String filter){
- beamParticle.setVector(11, 0.0,0.0,energy,0.0,0.0,0.0);
- eventFilter.setFilter(filter);
- }
-
-
- public void addParticle(String name,String particle, String variable){
- this.particleDescriptors.put(name, new PhysicsParticleDescriptor(name,particle,variable));
- }
-
- public void addCut(String cutname, String variable, double min, double max){
- this.cutDescriptors.put(cutname, new PhysicsCutDescriptor(cutname,variable,min,max));
- }
-
- public void parseLine(String line){
- String[] tokens = line.split("\\s+");
-
- if(tokens.length>0){
-
- if(tokens[0].compareTo("PARTICLE")==0){
- this.addParticle(tokens[1], tokens[2], tokens[3]);
- }
-
- if(tokens[0].compareTo("CUT")==0){
- this.addCut(tokens[1], tokens[2],
- Double.parseDouble(tokens[3]),
- Double.parseDouble(tokens[4])
- );
- }
-
- if(tokens[0].compareTo("HIST")==0){
- this.addHistogram(tokens[1], Integer.parseInt(tokens[2]),
- Double.parseDouble(tokens[3]),
- Double.parseDouble(tokens[4]),
- tokens[5],tokens[6]
- );
- }
- }
- }
-
- public void addHistogram(String name, int nbins, double min, double max,
- String var, String cuts){
- String[] tokens = cuts.split("&");
-
- if(this.particleDescriptors.containsKey(var)==false){
- System.out.println("[PHYS-PROC] ---> warning : adding histogram ["
- + name + "] unsuccessful. no variable [" + var + "] is defined");
- return;
- }
-
- PhysicsHistogramDescriptor desc = new PhysicsHistogramDescriptor(
- name,nbins,min,max,var,"");
- //System.out.println("ADDING CUTS SIZE TOKENS = " + tokens.length);
- desc.getCuts().clear();
- for(String item : tokens){
- if(this.cutDescriptors.containsKey(item)==true){
- desc.addCut(item);
- //System.out.println(" adding cut ["+item+"]");
- } else {
- System.out.println("[PHYS-PROC] ---> warning : adding "
- + " cut ["+ item+"] to histogram ["+name+"] failed. not cut with that name found");
- }
- }
- this.histDescriptors.put(name, desc);
- }
-
- public void addOperator(PhysicsEventOperator oper){
- this.operators.put(oper.getName(), oper);
- }
-
- public boolean isEventValid(PhysicsEvent event){
- return eventFilter.isValid(event);
- }
-
- public void apply(PhysicsEvent event){
- //for(Map.Entry entry : this.operators.entrySet()){
- // entry.getValue().apply(event);
- //}
- event.setBeamParticle(beamParticle);
- for(Map.Entry desc : this.particleDescriptors.entrySet()){
- desc.getValue().applyEvent(event);
- }
-
- }
-
- public PhysicsEventOperator getOperator(String name){
- return this.operators.get(name);
- }
-
- public boolean processCuts(List cutList){
- for(int loop = 0; loop < cutList.size(); loop++){
- if(this.cutDescriptors.get(cutList.get(loop)).isValid(particleDescriptors)==false)
- return false;
- }
- return true;
- }
-
- public List getOperatorList(){
- ArrayList opList = new ArrayList ();
- for(Map.Entry entry : this.operators.entrySet()){
- opList.add(entry.getKey());
- }
- return opList;
- }
-
- public double[] getOperatorValues(){
- double[] values = new double[this.operators.size()];
- int counter = 0;
- for(Map.Entry entry : this.operators.entrySet()){
- values[counter] = entry.getValue().getValue();
- counter++;
- }
- return values;
- }
-
- public boolean isValid(String oper){
- if(this.operators.containsKey(oper)==false) return false;
- PhysicsEventOperator evOper = this.operators.get(oper);
- for(String cut : evOper.getCuts()){
- if(this.operators.containsKey(cut)==true){
- if(this.operators.get(cut).isValid()==false) return false;
- } else {
- System.out.println("[PhysicsEventProcessor] ERROR : processing operator ["
- + oper + "]. Could not find cut named [" + cut + "]" );
- }
- }
- return true;
- }
- public void showData(){
- StringBuilder str = new StringBuilder();
- //for(Map.Entry entry : this.operators.entrySet()){
- // str.append(entry.getValue().stringValue());
- // str.append("\n");
- //}
- for(Map.Entry desc : this.particleDescriptors.entrySet()){
- str.append(String.format("* %-14s * %-12s * %32s * %12.5f *\n",
- desc.getValue().getName(),
- desc.getValue().getVariable(),
- desc.getValue().getParticle(),desc.getValue().getValue()));
- }
- System.out.println(str.toString());
- }
- @Override
- public String toString(){
- StringBuilder str = new StringBuilder();
- //for(Map.Entry entry : this.operators.entrySet()){
- // str.append(entry.getValue().stringValue());
- // str.append("\n");
- //}
- for(Map.Entry desc : this.particleDescriptors.entrySet()){
- str.append("[VAR ] --> ");
- str.append(desc.getValue().toString());
- }
-
- for(Map.Entry desc : this.cutDescriptors.entrySet()){
- str.append("[CUT ] --> ");
- str.append(desc.getValue().toString());
- }
-
- for(Map.Entry desc : this.histDescriptors.entrySet()){
- str.append("[HIST] --> ");
- str.append(desc.getValue().toString());
- }
-
- return str.toString();
- }
-}
diff --git a/common-tools/clas-physics/src/main/java/org/jlab/physics/oper/PhysicsHistogramDescriptor.java b/common-tools/clas-physics/src/main/java/org/jlab/physics/oper/PhysicsHistogramDescriptor.java
deleted file mode 100644
index 9ea8c0e55b..0000000000
--- a/common-tools/clas-physics/src/main/java/org/jlab/physics/oper/PhysicsHistogramDescriptor.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package org.jlab.physics.oper;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- *
- * @author gavalian
- */
-public class PhysicsHistogramDescriptor {
- private String histName = "";
- private int numberOfBins = 100;
- private double histMin = 0.0;
- private double histMax = 1.0;
- private String variable = "a";
- private List cutList = new ArrayList();
-
- public PhysicsHistogramDescriptor(String name, int bins, double min, double max
- ,String var, String cuts){
- this.histName = name;
- this.numberOfBins = bins;
- this.histMin = min;
- this.histMax = max;
- this.variable = var;
- this.setCuts(cuts);
- }
-
- public final void setCuts(String cuts){
- this.cutList.clear();
- String[] tokens = cuts.split(":");
- for(String item : tokens){
- this.cutList.add(item);
- }
- }
-
- public void addCut(String cut){
- this.cutList.add(cut);
- }
-
- public List getCuts() { return this.cutList;}
- public String getName(){ return this.histName;}
- public String getVariable(){ return this.variable;}
- public double getMin(){ return this.histMin;}
- public double getMax(){ return this.histMax;}
-
- @Override
- public String toString(){
- StringBuilder str = new StringBuilder();
- str.append(String.format("* %-12s * %-12s * (%5d, %12.5f, %12.5f) * NCUTS = %d",
- this.histName,this.variable,this.numberOfBins,
- this.histMin,this.histMax,this.cutList.size()));
- for(String item : this.cutList){
- str.append(item);
- str.append("&");
- }
- str.append(" *\n");
- return str.toString();
- }
-}
diff --git a/common-tools/clas-physics/src/main/java/org/jlab/physics/oper/PhysicsParticleDescriptor.java b/common-tools/clas-physics/src/main/java/org/jlab/physics/oper/PhysicsParticleDescriptor.java
deleted file mode 100644
index 635f878045..0000000000
--- a/common-tools/clas-physics/src/main/java/org/jlab/physics/oper/PhysicsParticleDescriptor.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package org.jlab.physics.oper;
-
-import org.jlab.clas.physics.Particle;
-import org.jlab.clas.physics.PhysicsEvent;
-
-/**
- *
- * @author gavalian
- */
-public class PhysicsParticleDescriptor {
- private String particleString = "[b]";
- private String particleVariable = "mass";
- private double descriptorValue = 0.0;
- private String descName = "unknown";
-
- public PhysicsParticleDescriptor(String name,String particle, String variable){
- this.descName = name;
- this.setParticle(particle);
- this.setVariable(variable);
- }
-
- public final void setName(String name) { this.descName = name; }
- public String getName() { return this.descName;}
-
- public final void setParticle(String part){
- this.particleString = part;
- }
-
- public final void setVariable(String var){
- this.particleVariable = var;
- }
-
- public void applyEvent(PhysicsEvent event){
- Particle part = event.getParticle(this.particleString);
- if(part!=null){
- this.descriptorValue = part.get(this.particleVariable);
- }
- }
-
- public String getParticle(){ return this.particleString; }
- public String getVariable(){ return this.particleVariable; }
- public double getValue() { return this.descriptorValue; }
-
- @Override
- public String toString(){
- StringBuilder str = new StringBuilder();
- str.append(String.format("* %-12s * %-12s * %-45s *\n",
- this.descName, this.particleVariable,this.particleString));
- return str.toString();
- }
-}
diff --git a/common-tools/clas-physics/src/main/java/org/jlab/physics/process/DVCSProcess.java b/common-tools/clas-physics/src/main/java/org/jlab/physics/process/DVCSProcess.java
deleted file mode 100644
index 177a8417c8..0000000000
--- a/common-tools/clas-physics/src/main/java/org/jlab/physics/process/DVCSProcess.java
+++ /dev/null
@@ -1,266 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package org.jlab.physics.process;
-
-import java.util.ArrayList;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import org.jlab.clas.pdg.PDGDatabase;
-import org.jlab.clas.physics.LorentzVector;
-import org.jlab.clas.physics.Particle;
-import org.jlab.clas.physics.PhysicsEvent;
-import org.jlab.clas.physics.Vector3;
-import org.jlab.physics.base.PhaseSpace;
-
-/**
- *
- * @author gavalian
- */
-public class DVCSProcess implements IPhysicsProcess {
-
- private static final double MP = 0.93827;
-
- public PhysicsEvent getEvent(PhaseSpace kinematics) {
- PhysicsEvent event = new PhysicsEvent();
- event.setBeam(kinematics.getDimension("E").getValue());
-
- Particle electron = KinematicsFactory.getElectron(
- kinematics.getDimension("E").getValue(),
- kinematics.getDimension("Q2").getValue(),
- kinematics.getDimension("xb").getValue());
-
- double E = kinematics.getDimension("E").getValue();
- double q2 = kinematics.getDimension("Q2").getValue();
- double xb = kinematics.getDimension("xb").getValue();
- double t = kinematics.getDimension("t").getValue();
- double phi = kinematics.getDimension("phi").getValue();
-
- double min_t = this.t_min(q2, xb);
- double max_t = this.t_max(q2, xb);
- double xmin = q2/(2.0*MP*E);
- /*System.out.println(" t = " + t + " t-min = "
- + this.t_min(q2, xb) + " t-max = " + this.t_max(q2, xb) +
- " xmin = " + xmin);
- */
- if(tmax_t){
- return event;
- }
-
- event.addParticle(electron);
-
- List protonGamma = this.getDvcsPhoton(E, q2, xb, t, 0.0, phi);
- //System.out.println(" PROTON " + protonGamma.get(0));
- //System.out.println(" PHOTON " + protonGamma.get(1));
- if(protonGamma.size()<2){
- event.clear();
- return event;
- }
-
- Particle proton = new Particle(2212,
- protonGamma.get(0).x(),
- protonGamma.get(0).y(),
- protonGamma.get(0).z()
- );
-
- Particle photon = new Particle(22,
- protonGamma.get(1).x(),
- protonGamma.get(1).y(),
- protonGamma.get(1).z()
- );
-
- event.addParticle(proton);
- event.addParticle(photon);
- /*
- Vector3 norm = new Vector3(0.0,1.0,0.0);
-
- Particle q2p = event.getParticle("[b]-[11]");
- LorentzVector cm = new LorentzVector(q2p.vector());
- LorentzVector pr = new LorentzVector(0.0,0.0,0.0,0.938);
- cm.add(pr);
- System.out.println("*****************************");
- System.out.println(q2p.toLundString());
- cm.print();
- */
- return event;
- }
-
- public PhaseSpace getPhaseSpace() {
- PhaseSpace space = new PhaseSpace();
- space.add("E" , 6.0, 4.0, 11.0);
- space.add("Q2" , 2.4, 1.5, 5.0);
- space.add("xb" , 0.35, 0.0, 1.0);
- space.add("t" , 0.25, 0.0, 11.0);
- space.add("phi" , 0.0, -Math.PI,Math.PI);
- return space;
- }
-
- public Map getKinematics() {
- Map kinematics = new LinkedHashMap();
- /*kinematics.put("E" , 6.0);
- kinematics.put("Q2", 2.5);
- kinematics.put("xb", 0.35);
- kinematics.put("t" , 0.2);
- kinematics.put("phi", 0.0);*/
- return kinematics;
- }
-
- public double getProperty(String key, PhysicsEvent event){
-
- if(key.compareTo("Q2")==0){
- Particle q2p = event.getParticle("[b]-[11]");
- return -q2p.vector().mass2();
- }
-
- if(key.compareTo("W2")==0){
- Particle w2p = event.getParticle("[b]+[t]-[11]");
- return w2p.vector().mass2();
- }
-
- if(key.compareTo("t")==0){
- Particle delta = event.getParticle("[t]-[2212]");
- return -delta.vector().mass2();
- }
-
- if(key.compareTo("xb")==0){
- Particle q2p = event.getParticle("[b]-[11]");
- Particle ep = event.getParticle("[11]");
- Particle beam = event.getParticle("[b]");
- double nu = beam.vector().e()-ep.vector().e();
- double q2 = -q2p.vector().mass2();
- return q2/(2.0*MP*nu);
- }
-
- if(key.compareTo("phi")==0){
- Particle beam = event.getParticle("[b]");
- Particle electron = event.getParticle("[11]");
- Vector3 normE = beam.vector().vect().cross(electron.vector().vect());
- normE.unit();
- Particle proton = event.getParticle("[2212]");
- Particle gamma = event.getParticle("[22]");
- Vector3 normH = proton.vector().vect().cross(gamma.vector().vect());
- //return delta.vector().mass2();
- }
-
- return 0.0;
- }
-
- public double t_min(double q2, double xb){
- double eps = KinematicsFactory.getEpsilon(q2, xb);
- double nomin = 2.0*(1.0-xb)*(1.0-Math.sqrt(1+eps*eps)) + eps*eps;
- double denom = 4.0*xb*(1.0-xb) + eps*eps;
- return q2*(nomin/denom);
- }
-
- public double t_max(double q2, double xb){
- double eps = KinematicsFactory.getEpsilon(q2, xb);
- double nomin = 2.0*(1.0-xb)*(1.0+Math.sqrt(1+eps*eps)) + eps*eps;
- double denom = 4.0*xb*(1.0-xb) + eps*eps;
- return q2*(nomin/denom);
- }
-
- public Particle getProton(PhysicsEvent event, double q2, double xb,double t){
- Particle q2p = event.getParticle("[b]-[11]");
- LorentzVector cm = new LorentzVector(q2p.vector());
- LorentzVector pr = new LorentzVector(0.0,0.0,0.0,0.938);
- cm.add(pr);
- double min_t = this.t_min(q2, xb);
- double max_t = this.t_max(q2, xb);
- double scale = (max_t - min_t)/Math.PI;
- return new Particle(2212,0.0,0.0,0.0,0.0,0.0,0.0);
- //return 1.0;
- }
-
- public List getDvcsPhoton(double E, double q2, double xb, double t, double phield, double phigd){
-
- double nu = q2/(2.0*MP*xb);
- double qmod = Math.sqrt(nu*nu + q2);
- double esc = E - nu;
- double costel = 1.0 - q2/(2.0*E*esc);
- double sintel = Math.sqrt(1.0 - costel*costel);
-
- if(esc<0.0) return new ArrayList();
-
- double Ep = MP + t/(2.0*MP);
- double Egam = nu - t/(2.0*MP);
-
- double cosphe = Math.cos(phield);
- double sinphe = Math.sin(phield);
- Vector3 vecQ = new Vector3(0.0,0.0,E);
- Vector3 vecEP = new Vector3(esc*sintel*cosphe,esc*sintel*sinphe,esc*costel);
- vecQ.sub(vecEP);
- /*System.out.println(" Q2 VECTOR = " + "ESC = " + nu + " " + vecQ);
- System.out.println(" EP / EGAM = " + Ep + " " + Egam + " VEC " + vecQ);
- System.out.println("******* " + nu + " " + Egam + " " + q2);*/
- /*double a1 = 2.0*Egam*(MP + nu) + q2;
- double a2 = - 2.0*MP*nu ;
- double a3 = 2.0*Egam*qmod;
- */
- //System.out.println("a1/a2/a3 = " + a1 + " " + a2 + " " + a3);
- /*System.out.println(" NU = " + nu);*/
-
- double costVq = vecQ.z()/qmod;
- double sintVq = Math.sqrt(1.0 - costVq*costVq);
- double costgg = (2.0*Egam*(MP + nu) + q2 - 2.0*MP*nu )/(2.0*Egam*qmod);
- if(costgg>1.0) return new ArrayList();
- //double costgg = (2.0*Egam*(nu) + q2 - 2.0*MP*nu )/(2.0*Egam*qmod);
- double sintgg = Math.sqrt(1.0 - costgg*costgg);
- double Vgx = Egam*sintgg*Math.cos(phigd);
- double Vgy = Egam*sintgg*Math.sin(phigd);
- double Vgz = Egam*costgg;
-
- Vector3 vecG = new Vector3(
- Vgx * costVq * cosphe - Vgz*sintVq*cosphe - Vgy*sinphe,
- Vgx * costVq * sinphe - Vgz*sintVq*sinphe + Vgy*cosphe,
- Vgx * sintVq + Vgz*costVq
- );
- /*System.out.println(" cos VQ " + costVq + " costgg = " + costgg
- + " qmod = " + qmod + " Nu = " + nu);*/
- //System.out.println(" PHOTON VECT = " + vecG);
- List protonGamma = new ArrayList();
- vecQ.sub(vecG);
-
- protonGamma.add(vecQ);
- protonGamma.add(vecG);
-
- return protonGamma;
- }
-
- public static void main(String[] args){
- //PDGDatabase.show();
- DVCSProcess dvcs = new DVCSProcess();
- PhaseSpace kinematics = dvcs.getPhaseSpace();
-
- //kinematics.show();
-
- kinematics.getDimension("phi").setValue(Math.toRadians(30.0));
- PhysicsEvent event = dvcs.getEvent(kinematics);
-
- /*
- Particle q2 = event.getParticle("[b]-[11]");
- Particle e = event.getParticle("[11]");
- double q2m = 4*6.0*e.vector().e()*Math.sin(e.theta()/2.0)*Math.sin(e.theta()/2.0);
- System.out.println(q2.mass()*q2.mass() + " q2 mass = " + q2m);
- */
-
- //System.out.println(event.toLundString());
-
- Particle mt = event.getParticle("[t]-[2212]");
- Particle mtg = event.getParticle("[b]-[11]-[22]");
- System.out.println(" -t = " + mt.vector().mass2());
- System.out.println(" -tg = " + mtg.vector().mass2());
-
- /*
- for(double xb = 0.1 ; xb < 0.6; xb += 0.05){
- kinematics.getDimension("xb").setValue(xb);
- event = dvcs.getEvent(kinematics);
- }*/
- }
-
- public double getWeight(PhaseSpace kinematics) {
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
- }
-}
diff --git a/common-tools/clas-physics/src/main/java/org/jlab/physics/process/IPhysicsProcess.java b/common-tools/clas-physics/src/main/java/org/jlab/physics/process/IPhysicsProcess.java
deleted file mode 100644
index 7ff7459601..0000000000
--- a/common-tools/clas-physics/src/main/java/org/jlab/physics/process/IPhysicsProcess.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package org.jlab.physics.process;
-
-import java.util.Map;
-import org.jlab.clas.physics.PhysicsEvent;
-import org.jlab.physics.base.PhaseSpace;
-
-/**
- *
- * @author gavalian
- */
-public interface IPhysicsProcess {
-
- PhysicsEvent getEvent(PhaseSpace kinematics);
- PhaseSpace getPhaseSpace();
- double getWeight(PhaseSpace kinematics);
-}
diff --git a/common-tools/clas-physics/src/main/java/org/jlab/physics/process/KinematicsFactory.java b/common-tools/clas-physics/src/main/java/org/jlab/physics/process/KinematicsFactory.java
deleted file mode 100644
index 10e9759156..0000000000
--- a/common-tools/clas-physics/src/main/java/org/jlab/physics/process/KinematicsFactory.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package org.jlab.physics.process;
-
-import org.jlab.clas.pdg.PDGDatabase;
-import org.jlab.clas.physics.Particle;
-import org.jlab.clas.physics.Vector3;
-
-/**
- *
- * @author gavalian
- */
-public class KinematicsFactory {
-
- public static double MP = 0.93827;
- /**
- * returns mu for given kinematics variables
- * @param q2 transferred momentum
- * @param xb Bjorken x
- * @return
- */
- public static double getMu(double q2, double xb){
- //double pmass = PDGDatabase.getParticleMass(2212);
- return q2/(2.0*0.93827*xb);
- }
- /**
- * returns E' for given energy and kinematics variables.
- * @param E initial electron energy
- * @param q2 transferred momentum to proton
- * @param xb Bjorken x
- * @return
- */
- public static double getEprime(double E, double q2, double xb){
- return E - KinematicsFactory.getMu(q2, xb);
- }
- /**
- * returns scattered electron angle for given kinematics
- * @param E initial electron energy
- * @param q2 transfered 4 momentum
- * @param xb Bjorken x
- * @return
- */
- public static double getTheta(double E, double q2, double xb){
- double eprime = KinematicsFactory.getEprime(E, q2, xb);
- double left_side = q2/(4.0*E*eprime);
- double value = Math.sqrt(left_side);
- return 2.0*Math.asin(value);
- }
-
- public static double getEpsilon(double q2, double xb){
- return 2.0*xb*0.93827/q2;
- }
-
- public static double getQ2(double E, double x, double y){
- return 2.0*MP*E*y*x;
- }
-
- /**
- * returns an electron for given beam energy, q2 and xb
- * @param E
- * @param q2
- * @param xb
- * @return
- */
- public static Particle getElectron(double E, double q2, double xb){
- double eprime = KinematicsFactory.getEprime( E, q2, xb);
- double theta = KinematicsFactory.getTheta( E, q2, xb);
- //System.out.println("E-prime = " + eprime + " theta = " + Math.toDegrees(theta));
- Vector3 vec = new Vector3();
- vec.setMagThetaPhi(eprime, theta, 0.0);
- return new Particle(11,vec.x(),vec.y(),vec.z(),0.0,0.0,0.0);
- }
- /**
- * returns magnetic moment of the proton
- * @param del2
- * @return
- */
- public static double getGM_p(double del2){
- double denom = (1.0-del2/(0.84*0.84));
- double dipol = 1.0/(denom*denom);
- return (1.0+1.79)*dipol;
- }
- /**
- * returns magnetic moment for neutron
- * @param del2
- * @return
- */
- public static double getGM_n(double del2){
- double denom = (1.0-del2/(0.84*0.84));
- double dipol = 1.0/(denom*denom);
- return -1.91*dipol;
- }
- /**
- * returns electric moment of neutron, it's
- * always 0, unless something has changed since
- * writing of this code.
- * @param del2
- * @return
- */
- public static double getGE_n(double del2){
- return 0;
- }
- /**
- * returns electric moment of the proton
- * @param del2
- * @return
- */
- public static double getGE_p(double del2){
- double denom = (1.0-del2/(0.84*0.84));
- double dipol = 1.0/(denom*denom);
- return dipol;
- }
- /**
- * Returns F1 function for U quark
- * @param del2
- * @return
- */
- public static double getF1_u(double del2){
- double delim = del2/(4.0*MP*MP);
- double f1pn_1 = (KinematicsFactory.getGE_p(del2) -
- delim*KinematicsFactory.getGM_p(del2))/(1.0-delim);
- double f1pn_2 = (KinematicsFactory.getGE_n(del2) -
- delim*KinematicsFactory.getGM_n(del2))/(1.0-delim);
- return 2.0*f1pn_1 + f1pn_2;
- }
- /**
- * returns F1 function for d quark
- * @param del2
- * @return
- */
- public static double getF1_d(double del2){
- double delim = del2/(4.0*MP*MP);
- double f1pn_1 = (KinematicsFactory.getGE_p(del2) -
- delim*KinematicsFactory.getGM_p(del2))/(1.0-delim);
- double f1pn_2 = (KinematicsFactory.getGE_n(del2) -
- delim*KinematicsFactory.getGM_n(del2))/(1.0-delim);
- return 2.0*f1pn_2 + f1pn_1;
- }
-}
diff --git a/common-tools/clas-physics/src/test/java/org/jlab/clas/physics/LorentzVectorTest.java b/common-tools/clas-physics/src/test/java/org/jlab/clas/physics/LorentzVectorTest.java
deleted file mode 100644
index 6f1a5b5f33..0000000000
--- a/common-tools/clas-physics/src/test/java/org/jlab/clas/physics/LorentzVectorTest.java
+++ /dev/null
@@ -1,106 +0,0 @@
-package org.jlab.clas.physics;
-
-import org.junit.Test;
-import static org.junit.Assert.*;
-
-/**
- *
- * @author naharrison
- */
-public class LorentzVectorTest {
-
- @Test
- public void testLorentzVector() {
- LorentzVector v = new LorentzVector(0.0, 0.0, 6.0, Math.sqrt(6.0*6.0 + 0.938*0.938));
- assertEquals(v.mass(), 0.938, 1e-6);
- assertEquals(v.theta(), 0.0, 1e-6);
- assertEquals(v.p(), 6.0, 1e-6);
- assertEquals(v.e(), Math.sqrt(6.0*6.0 + 0.938*0.938), 1e-6);
-
- v.setPxPyPzM(6.0, 0.0, 0.0, 0.000511);
- assertEquals(v.mass(), 0.000511, 1e-6);
- assertEquals(v.theta(), Math.PI/2.0, 1e-6);
- assertEquals(v.phi(), 0.0, 1e-6);
- assertEquals(v.p(), 6.0, 1e-6);
- assertEquals(v.e(), Math.sqrt(6.0*6.0 + 0.000511*0.000511), 1e-6);
-
- v.print();
- }
-
-
- @Test
- public void testConstructors() {
- LorentzVector v = new LorentzVector();
- v.setPxPyPzE(6.0, 0.0, 0.0, Math.sqrt(6.0*6.0 + 0.938*0.938));
- assertEquals(v.mass(), 0.938, 1e-6);
- assertEquals(v.p(), 6.0, 1e-6);
-
- LorentzVector vcopy = new LorentzVector(v);
- assertEquals(vcopy.mass(), 0.938, 1e-6);
- assertEquals(vcopy.p(), 6.0, 1e-6);
- }
-
-
- @Test
- public void testAddSubInvert() {
- LorentzVector v1 = new LorentzVector(0.0, 1.0, 0.0, Math.sqrt(1.0 + 0.938*0.938));
- LorentzVector v2 = new LorentzVector(1.0, 0.0, 0.0, Math.sqrt(1.0 + 0.938*0.938));
- v1.add(v2);
- v1.sub(v2);
- v1.add(v2);
- v1.invert();
-
- assertEquals(v1.px(), -1.0, 1e-6);
- assertEquals(v1.py(), -1.0, 1e-6);
- assertEquals(v1.pz(), 0.0, 1e-6);
- assertEquals(v2.vect().x(), 1.0, 1e-6);
- assertEquals(v2.vect().y(), 0.0, 1e-6);
- assertEquals(v2.vect().z(), 0.0, 1e-6);
- }
-
-
- @Test
- public void testRotations() {
- LorentzVector v = new LorentzVector(0.0, 6.0, 0.0, Math.sqrt(6.0*6.0 + 0.938*0.938));
-
- v.rotateY(0.1234);
- assertEquals(v.px(), 0.0, 1e-6);
- assertEquals(v.py(), 6.0, 1e-6);
- assertEquals(v.pz(), 0.0, 1e-6);
-
- v.rotateZ(Math.toRadians(90.0));
- assertEquals(v.px(), -6.0, 1e-6);
- assertEquals(v.py(), 0.0, 1e-6);
- assertEquals(v.pz(), 0.0, 1e-6);
- }
-
-
- @Test
- public void testBoostX() {
- double betaX = 0.5;
- LorentzVector v = new LorentzVector(1.0, 1.0, 1.0, Math.sqrt(3.0 + 0.938*0.938));
- double e = v.e();
- v.boost(betaX, 0.0, 0.0);
- double gamma = 1.0/Math.sqrt(1.0 - betaX*betaX);
- assertEquals(v.px(), 1.0 + (gamma-1.0) + gamma*betaX*e, 1e-6);
- assertEquals(v.py(), 1.0, 1e-6);
- assertEquals(v.pz(), 1.0, 1e-6);
- assertEquals(v.e(), gamma*(e + betaX), 1e-6);
- }
-
-
- @Test
- public void testBoostY() {
- double betaY = 0.5;
- Vector3 vboost = new Vector3(0.0, betaY, 0.0);
- LorentzVector v = new LorentzVector(1.0, 1.0, 1.0, Math.sqrt(3.0 + 0.938*0.938));
- double e = v.e();
- v.boost(vboost);
- double gamma = 1.0/Math.sqrt(1.0 - betaY*betaY);
- assertEquals(v.px(), 1.0, 1e-6);
- assertEquals(v.py(), 1.0 + (gamma-1.0) + gamma*betaY*e, 1e-6);
- assertEquals(v.pz(), 1.0, 1e-6);
- assertEquals(v.e(), gamma*(e + betaY), 1e-6);
- }
-
-}
diff --git a/common-tools/clas-physics/src/test/java/org/jlab/clas/physics/ParticleTest.java b/common-tools/clas-physics/src/test/java/org/jlab/clas/physics/ParticleTest.java
deleted file mode 100644
index ccd78d5639..0000000000
--- a/common-tools/clas-physics/src/test/java/org/jlab/clas/physics/ParticleTest.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package org.jlab.clas.physics;
-
-import org.junit.Test;
-import static org.junit.Assert.*;
-
-/**
- *
- * @author naharrison
- */
-public class ParticleTest {
-
- @Test
- public void testParticle() {
- Particle p = new Particle(11, 0.0, 0.0, 11.0, 0.0, 0.0, 0.0);
- assertEquals(p.mass(), 0.0005, 1e-4);
- assertEquals(p.mass2(), 0.0005*0.0005, 1e-4);
- assertEquals(p.charge(), -1);
- assertEquals(p.px(), 0.0, 1e-6);
- assertEquals(p.py(), 0.0, 1e-6);
- assertEquals(p.pz(), 11.0, 1e-6);
- assertEquals(p.p(), 11.0, 1e-6);
- assertEquals(p.theta(), 0.0, 1e-6);
- assertEquals(p.vertex().x(), 0.0, 1e-6);
- assertEquals(p.vertex().y(), 0.0, 1e-6);
- assertEquals(p.vertex().z(), 0.0, 1e-6);
- assertEquals(p.vx(), 0.0, 1e-6);
- assertEquals(p.vy(), 0.0, 1e-6);
- assertEquals(p.vz(), 0.0, 1e-6);
-
- Particle p2 = new Particle(p);
- assertEquals(p2.mass(), 0.0005, 1e-4);
- assertEquals(p2.mass2(), 0.0005*0.0005, 1e-4);
- assertEquals(p2.charge(), -1);
- assertEquals(p2.px(), 0.0, 1e-6);
- assertEquals(p2.py(), 0.0, 1e-6);
- assertEquals(p2.pz(), 11.0, 1e-6);
- assertEquals(p2.p(), 11.0, 1e-6);
- assertEquals(p2.theta(), 0.0, 1e-6);
- assertEquals(p2.vertex().x(), 0.0, 1e-6);
- assertEquals(p2.vertex().y(), 0.0, 1e-6);
- assertEquals(p2.vertex().z(), 0.0, 1e-6);
- assertEquals(p2.vx(), 0.0, 1e-6);
- assertEquals(p2.vy(), 0.0, 1e-6);
- assertEquals(p2.vz(), 0.0, 1e-6);
- }
-
-
- @Test
- public void testEuclideanDistance() {
- Particle p1 = new Particle();
- p1.setVector(11, 3.0, 0.0, 0.0, 0.0, 0.0, 0.0);
- Particle p2 = new Particle(22, 0.0, 4.0, 0.0);
- assertEquals(p1.euclideanDistance(p2), 5.0, 1e-6);
- }
-
-}
-
diff --git a/common-tools/clas-physics/src/test/java/org/jlab/clas/physics/Vector3Test.java b/common-tools/clas-physics/src/test/java/org/jlab/clas/physics/Vector3Test.java
deleted file mode 100644
index 6a75c819da..0000000000
--- a/common-tools/clas-physics/src/test/java/org/jlab/clas/physics/Vector3Test.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package org.jlab.clas.physics;
-
-import org.junit.Test;
-import static org.junit.Assert.*;
-
-/**
- *
- * @author naharrison
- */
-public class Vector3Test {
-
- @Test
- public void testDotAndCross() {
- Vector3 v1 = new Vector3();
- Vector3 v2 = new Vector3(v1);
- v1.setMagThetaPhi(1.0, Math.toRadians(90.0), 0.0);
- v2.setXYZ(0.0, 2.0, 0.0);
- v2.unit();
- assertEquals(v1.dot(v2), 0.0, 1e-6);
-
- Vector3 v3 = v1.cross(v2);
- Vector3 vz = new Vector3(0.0, 0.0, 1.0);
- assertEquals(v3.x(), vz.x(), 1e-6);
- assertEquals(v3.y(), vz.y(), 1e-6);
- assertEquals(v3.z(), vz.z(), 1e-6);
-
- Vector3 v4 = v2.cross(v1);
- vz.negative();
- assertEquals(v4.x(), vz.x(), 1e-6);
- assertEquals(v4.y(), vz.y(), 1e-6);
- assertEquals(v4.z(), vz.z(), 1e-6);
- }
-
-
- @Test
- public void testCompare() {
- Vector3 v1 = new Vector3(1, 2, 3);
- Vector3 v2 = new Vector3(1, 2, 3);
- assertEquals(v1.compare(v2), 0.0, 1e-6);
- assertEquals(v1.compareWeighted(v2), 0.0, 1e-6);
- }
-
-
- @Test
- public void testStrings() {
- Vector3 v1 = new Vector3(1, 2, 3);
- System.out.println(v1.getXYZString());
- System.out.println(v1.getMagThetaPhiString());
- System.out.println(v1.toString());
- }
-
-}
diff --git a/common-tools/pom.xml b/common-tools/pom.xml
index f66e67930c..8a49c5df28 100644
--- a/common-tools/pom.xml
+++ b/common-tools/pom.xml
@@ -15,7 +15,6 @@
clas-utils
- clas-physics
clas-io
clas-logging
clas-geometry
diff --git a/pom.xml b/pom.xml
index 5454d99e13..0f28f8e11f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -19,6 +19,10 @@
+
+ gitlab-maven
+ https://code.jlab.org/api/v4/projects/864/packages/maven/
+
clas12maven
https://clasweb.jlab.org/.clas12maven