diff --git a/common-tools/clas-analysis/src/main/java/org/jlab/analysis/roads/DictionaryGenerator.java b/common-tools/clas-analysis/src/main/java/org/jlab/analysis/roads/DictionaryGenerator.java index 1b4153c39..4f3c15853 100644 --- a/common-tools/clas-analysis/src/main/java/org/jlab/analysis/roads/DictionaryGenerator.java +++ b/common-tools/clas-analysis/src/main/java/org/jlab/analysis/roads/DictionaryGenerator.java @@ -226,8 +226,8 @@ private void init(String variation, double torusScale, double solenoidScale, lon this.variation = variation; ConstantProvider providerDC = GeometryFactory.getConstants(DetectorType.DC, run, variation); dcDetector = new DCGeant4Factory(providerDC, true, true); - ConstantProvider providerTG = GeometryFactory.getConstants(DetectorType.TARGET, run, variation); - solShift = providerTG.getDouble("/geometry/target/position",0); + ConstantProvider providerMAGNETS = GeometryFactory.getConstants(DetectorType.MAGNETS, run, variation); + solShift = providerMAGNETS.getDouble("/geometry/shifts/solenoid/z",0); ConstantProvider providerFTOF = GeometryFactory.getConstants(DetectorType.FTOF, run, variation); ftofDetector = new FTOFGeant4Factory(providerFTOF); ecalDetector = GeometryFactory.getDetector(DetectorType.ECAL, run, variation); diff --git a/common-tools/clas-detector/src/main/java/org/jlab/detector/base/DetectorType.java b/common-tools/clas-detector/src/main/java/org/jlab/detector/base/DetectorType.java index 67ae4d472..9aed37f7e 100644 --- a/common-tools/clas-detector/src/main/java/org/jlab/detector/base/DetectorType.java +++ b/common-tools/clas-detector/src/main/java/org/jlab/detector/base/DetectorType.java @@ -30,6 +30,7 @@ public enum DetectorType { RASTER (22, "RASTER"), URWELL (23, "URWELL"), TARGET (100, "TARGET"), + MAGNETS (101, "MAGNETS"), ECIN (110, "ECIN"), ECOUT (111, "ECOUT"), ECTOT (112, "ECTOT"), diff --git a/common-tools/clas-detector/src/main/java/org/jlab/detector/base/GeometryFactory.java b/common-tools/clas-detector/src/main/java/org/jlab/detector/base/GeometryFactory.java index 04dd0cee1..6a14e9c45 100644 --- a/common-tools/clas-detector/src/main/java/org/jlab/detector/base/GeometryFactory.java +++ b/common-tools/clas-detector/src/main/java/org/jlab/detector/base/GeometryFactory.java @@ -88,7 +88,7 @@ public static ConstantProvider getConstants(DetectorType type, int run, String v if(type==DetectorType.CTOF){ provider.loadTable("/geometry/ctof/ctof"); provider.loadTable("/geometry/ctof/cad"); - provider.loadTable("/geometry/target"); + provider.loadTable("/geometry/shifts/solenoid"); } if(type==DetectorType.FTCAL){ @@ -103,14 +103,17 @@ public static ConstantProvider getConstants(DetectorType type, int run, String v provider.loadTable("/geometry/cvt/svt/material/box"); provider.loadTable("/geometry/cvt/svt/material/tube"); provider.loadTable("/geometry/cvt/svt/alignment"); - provider.loadTable("/geometry/target"); } if(type==DetectorType.TARGET){ - provider.loadTable("/geometry/target"); + provider.loadTable("/geometry/shifts/target"); provider.loadTable("/geometry/materials/target"); } + if(type==DetectorType.MAGNETS){ + provider.loadTable("/geometry/shifts/solenoid"); + } + if(type==DetectorType.FMT){ provider.loadTable("/geometry/fmt/fmt_global"); provider.loadTable("/geometry/fmt/fmt_layer_noshim"); diff --git a/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/CTOFGeant4Factory.java b/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/CTOFGeant4Factory.java index 77f4770b7..aef46d3d0 100644 --- a/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/CTOFGeant4Factory.java +++ b/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/CTOFGeant4Factory.java @@ -26,12 +26,12 @@ public final class CTOFGeant4Factory extends Geant4Factory { private final int npaddles = 48; private final String ctofdbpath = "/geometry/ctof/ctof/"; private final String caddbpath = "/geometry/ctof/cad/"; - private final String tgdbpath = "/geometry/target/"; + private final String tgdbpath = "/geometry/shifts/solenoid/"; private double globalOffset = 0; public CTOFGeant4Factory(ConstantProvider cp) { - this.globalOffset = cp.getDouble(tgdbpath+"position", 0); + this.globalOffset = cp.getDouble(tgdbpath+"z", 0); double cadRadius = cp.getDouble(caddbpath+"radius", 0); double cadThick = cp.getDouble(caddbpath+"thickness", 0); double cadAngle = cp.getDouble(caddbpath+"angle", 0); diff --git a/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/SVT/SVTConstants.java b/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/SVT/SVTConstants.java index c048c033d..a96bd20df 100644 --- a/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/SVT/SVTConstants.java +++ b/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/SVT/SVTConstants.java @@ -147,8 +147,6 @@ public static DatabaseConstantProvider connect( DatabaseConstantProvider cp ) cp.loadTable( ccdbPath +"material/peeksupport"); cp.loadTable( ccdbPath +"layeralignment"); cp.loadTable( ccdbPath +"position"); - //shift by target -// cp.loadTable("/geometry/target"); //if( loadAlignmentTables ) cp.loadTable( ccdbPath +"alignment/sector"); // possible future tables //if( loadAlignmentTables ) cp.loadTable( ccdbPath +"alignment/layer"); @@ -389,7 +387,7 @@ else if( value == "tube" ) // offset by boxNum to reset row for CCDB table // | | radius | radius // | | | // o==============v===========================v===================================-> z (beamline) -// System.out.println("SVT READ Z SHIFT VALUE "+cp.getDouble("/geometry/target/position", 0)); + // LAYERRADIUS and ZSTARTACTIVE are used primarily by the Reconstruction and getStrip() for( int region = 0; region < NREGIONS; region++ ) { diff --git a/common-tools/swim-tools/src/main/java/org/jlab/clas/swimtools/MagFieldsEngine.java b/common-tools/swim-tools/src/main/java/org/jlab/clas/swimtools/MagFieldsEngine.java index 4a37be09c..ceab50389 100644 --- a/common-tools/swim-tools/src/main/java/org/jlab/clas/swimtools/MagFieldsEngine.java +++ b/common-tools/swim-tools/src/main/java/org/jlab/clas/swimtools/MagFieldsEngine.java @@ -154,7 +154,7 @@ public boolean initializeMagneticFields() { } private void loadTables() { - String[] ccdbTables = new String[] { "/geometry/target" }; + String[] ccdbTables = new String[] { "/geometry/shifts/solenoid" }; requireConstants(Arrays.asList(ccdbTables)); this.getConstantsManager().setVariation("default"); @@ -173,8 +173,8 @@ public boolean processDataEvent(DataEvent event) { if (solShift == null) { // if no shift is set in the yaml file or environment, read from CCDB // will read target position and assume that is representative of the shift of // the whole CD - IndexedTable targetPosition = this.getConstantsManager().getConstants(newRun, "/geometry/target"); - Swimmer.set_zShift((float) targetPosition.getDoubleValue("position", 0, 0, 0)); + IndexedTable targetPosition = this.getConstantsManager().getConstants(newRun, "/geometry/shifts/solenoid"); + Swimmer.set_zShift((float) targetPosition.getDoubleValue("z", 0, 0, 0)); } Swimmer.setMagneticFieldsScales(bank.getFloat("solenoid", 0), bank.getFloat("torus", 0), (double) 0.0, diff --git a/reconstruction/cnd/src/main/java/org/jlab/rec/cnd/constants/CalibrationConstantsLoader.java b/reconstruction/cnd/src/main/java/org/jlab/rec/cnd/constants/CalibrationConstantsLoader.java index 53999c87e..ac01252ef 100644 --- a/reconstruction/cnd/src/main/java/org/jlab/rec/cnd/constants/CalibrationConstantsLoader.java +++ b/reconstruction/cnd/src/main/java/org/jlab/rec/cnd/constants/CalibrationConstantsLoader.java @@ -26,8 +26,9 @@ public class CalibrationConstantsLoader { "/calibration/cnd/Energy", "/calibration/cnd/time_jitter", "/geometry/cnd/cndgeom", - "/geometry/target", "/calibration/cnd/cluster", - "/calibration/cnd/double_hits" + "/geometry/shifts/solenoid", + "/calibration/cnd/cluster", + "/calibration/cnd/double_hits" }; public CalibrationConstantsLoader(int run, ConstantsManager ccdb) { @@ -129,7 +130,7 @@ public final void Load(int run, ConstantsManager ccdb) { INNERRADIUS[0] = 10.*tabJs.get(10).getDoubleValue("InnerRadius", 1, 1, 1); THICKNESS[0] = 10.*tabJs.get(10).getDoubleValue("Thickness", 1, 1, 1); // not right structure for common tools - ZTARGET[0] = tabJs.get(11).getDoubleValue("position", 0, 0, 0); // not right structure for common tools + ZTARGET[0] = tabJs.get(11).getDoubleValue("z", 0, 0, 0); // not right structure for common tools //INNERRADIUS[0] = 290.0; //THICKNESS[0] = 30.0; diff --git a/reconstruction/cvt/src/main/java/org/jlab/rec/cvt/Geometry.java b/reconstruction/cvt/src/main/java/org/jlab/rec/cvt/Geometry.java index 555eec510..dd14ef47c 100644 --- a/reconstruction/cvt/src/main/java/org/jlab/rec/cvt/Geometry.java +++ b/reconstruction/cvt/src/main/java/org/jlab/rec/cvt/Geometry.java @@ -145,8 +145,8 @@ private synchronized void load(String variation, int run, IndexedTable svtLorent private void initTarget(ConstantProvider provider) { // get target position and half-length from old table // half-length used for track candidates vertex cut - this.targetPosition = provider.getDouble("/geometry/target/position",0)*10; - this.targetHalfLength = provider.getDouble("/geometry/target/length",0)*10; + this.targetPosition = provider.getDouble("/geometry/shifts/target/z",0)*10; + this.targetHalfLength = provider.getDouble("/geometry/materials/target/length",0)*10/2; // load target geometry and material, using CCDB table if targetMat yaml // variable is not specified or differs from LH2/LD2 if("LH2".equals(Constants.getInstance().getTargetType()) || diff --git a/reconstruction/cvt/src/main/java/org/jlab/rec/cvt/measurement/Measurements.java b/reconstruction/cvt/src/main/java/org/jlab/rec/cvt/measurement/Measurements.java index a7d5974d8..dcefd1f33 100644 --- a/reconstruction/cvt/src/main/java/org/jlab/rec/cvt/measurement/Measurements.java +++ b/reconstruction/cvt/src/main/java/org/jlab/rec/cvt/measurement/Measurements.java @@ -100,7 +100,8 @@ private Surface getTarget(double xbeam, double ybeam, boolean beamSpot) { Point3D p = new Point3D(xbeam, ybeam, 0); Line3D l = new Line3D(p, u); Surface target = new Surface(l.origin(), l.end(), Constants.DEFAULTSWIMACC); - if(Geometry.getInstance().getTargetCellSurface().lineVolume!=null) { + if(Geometry.getInstance().getTargetCellSurface()!=null && + Geometry.getInstance().getTargetCellSurface().lineVolume!=null) { target.lineVolume = Geometry.getInstance().getTargetCellSurface().lineVolume; } for(Material m : Geometry.getInstance().getTargetMaterials()) diff --git a/reconstruction/dc/src/main/java/org/jlab/rec/dc/Constants.java b/reconstruction/dc/src/main/java/org/jlab/rec/dc/Constants.java index 15e7498e9..d29dfc291 100644 --- a/reconstruction/dc/src/main/java/org/jlab/rec/dc/Constants.java +++ b/reconstruction/dc/src/main/java/org/jlab/rec/dc/Constants.java @@ -517,8 +517,8 @@ private synchronized void LoadGeometry(String geoVariation, double[][] shifts) { } // Load target ConstantProvider providerTG = GeometryFactory.getConstants(DetectorType.TARGET, 11, geoVariation); - double targetPosition = providerTG.getDouble("/geometry/target/position",0); - double targetLength = providerTG.getDouble("/geometry/target/length",0); + double targetPosition = providerTG.getDouble("/geometry/shifts/target/z",0); + double targetLength = providerTG.getDouble("/geometry/materials/target/length",0); // Load other geometries ConstantProvider providerFTOF = GeometryFactory.getConstants(DetectorType.FTOF, 11, geoVariation); ftofDetector = new FTOFGeant4Factory(providerFTOF); diff --git a/reconstruction/eb/src/main/java/org/jlab/rec/eb/EBCCDBConstants.java b/reconstruction/eb/src/main/java/org/jlab/rec/eb/EBCCDBConstants.java index d3ad93f76..e762757b0 100644 --- a/reconstruction/eb/src/main/java/org/jlab/rec/eb/EBCCDBConstants.java +++ b/reconstruction/eb/src/main/java/org/jlab/rec/eb/EBCCDBConstants.java @@ -42,7 +42,7 @@ public class EBCCDBConstants { "/runcontrol/fcup", "/runcontrol/hwp", "/runcontrol/helicity", - "/geometry/target", + "/geometry/shifts/solenoid", "/calibration/ftof/tres", //"/calibration/ctof/tres" }; @@ -275,7 +275,7 @@ public final void load(int run,ConstantsManager manager) { loadDouble(EBCCDBEnum.NEUTRON_maxBeta,"neutron_beta","neutron_beta",0,0,0); - loadDouble(EBCCDBEnum.TARGET_POSITION,"/geometry/target","position",0,0,0); + loadDouble(EBCCDBEnum.SOLENOID_POSITION,"/geometry/shifts/solenoid","z",0,0,0); loadDouble(EBCCDBEnum.FCUP_slope,"/runcontrol/fcup","slope",0,0,0); loadDouble(EBCCDBEnum.FCUP_offset,"/runcontrol/fcup","offset",0,0,0); diff --git a/reconstruction/eb/src/main/java/org/jlab/rec/eb/EBCCDBEnum.java b/reconstruction/eb/src/main/java/org/jlab/rec/eb/EBCCDBEnum.java index 5e058eff6..7062bb7b7 100644 --- a/reconstruction/eb/src/main/java/org/jlab/rec/eb/EBCCDBEnum.java +++ b/reconstruction/eb/src/main/java/org/jlab/rec/eb/EBCCDBEnum.java @@ -14,7 +14,7 @@ public enum EBCCDBEnum { FTOF_MATCHING_1B, FTOF_MATCHING_2, CTOF_Matching, - TARGET_POSITION, + SOLENOID_POSITION, RF_BUCKET_LENGTH, RF_OFFSET, RF_CYCLES, diff --git a/reconstruction/eb/src/main/java/org/jlab/rec/eb/EBRadioFrequency.java b/reconstruction/eb/src/main/java/org/jlab/rec/eb/EBRadioFrequency.java index e3ad51c6f..14fed64fb 100644 --- a/reconstruction/eb/src/main/java/org/jlab/rec/eb/EBRadioFrequency.java +++ b/reconstruction/eb/src/main/java/org/jlab/rec/eb/EBRadioFrequency.java @@ -40,12 +40,15 @@ public double getStartTime(DetectorParticle trigger,final DetectorType type,fin final double rfPeriod = this.ccdb.getDouble(EBCCDBEnum.RF_BUCKET_LENGTH); - // The RF calibration is relative to target center: - final double zTarget = this.ccdb.getDouble(EBCCDBEnum.TARGET_POSITION); + // The RF calibration is relative to the solenoid center: + // FIXME the reference point doesn't have to be the solenoid center or + // target center but could be z=0. It only needs to be consistent with + // the one used in RF calibrations + final double zSolenoid = this.ccdb.getDouble(EBCCDBEnum.SOLENOID_POSITION); // The trigger particles' vertex info: final double tVertex = trigger.getVertexTime(type,layer,trigger.getPid()); - final double dzTargetVertex = zTarget - trigger.vertex().z(); + final double dzTargetVertex = zSolenoid - trigger.vertex().z(); // The RF time at the trigger particle's vertex: // (Note, this is shifted forward by a large integer number of RF periods, diff --git a/reconstruction/ft/src/main/java/org/jlab/rec/ft/FTEBEngine.java b/reconstruction/ft/src/main/java/org/jlab/rec/ft/FTEBEngine.java index 57bc2bca0..f9acd60a4 100644 --- a/reconstruction/ft/src/main/java/org/jlab/rec/ft/FTEBEngine.java +++ b/reconstruction/ft/src/main/java/org/jlab/rec/ft/FTEBEngine.java @@ -50,7 +50,7 @@ public boolean init() { "/calibration/ft/ftcal/cluster", "/calibration/ft/ftcal/thetacorr", "/calibration/ft/ftcal/phicorr", - "/geometry/target" + "/geometry/shifts/solenoid" }; requireConstants(Arrays.asList(tables)); this.getConstantsManager().setVariation("default"); diff --git a/reconstruction/ft/src/main/java/org/jlab/rec/ft/FTEventBuilder.java b/reconstruction/ft/src/main/java/org/jlab/rec/ft/FTEventBuilder.java index e9db393b3..d65390d21 100644 --- a/reconstruction/ft/src/main/java/org/jlab/rec/ft/FTEventBuilder.java +++ b/reconstruction/ft/src/main/java/org/jlab/rec/ft/FTEventBuilder.java @@ -113,13 +113,13 @@ public void correctDirection(List particles, ConstantsManager manage } public List initFTparticles(List responses, ConstantsManager manager, int run) { - IndexedTable target = manager.getConstants(run, "/geometry/target"); + IndexedTable solenoid = manager.getConstants(run, "/geometry/shifts/solenoid"); List particles = new ArrayList<>(); for (int i = 0; i < responses.size(); i++) { if (responses.get(i).getType()==DetectorType.FTCAL) { // start assuming the cluster to be associated to a photon - FTParticle track = new FTParticle(i, 0, this.solenoidField, responses.get(i), 0, 0, target.getDoubleValue("position", 0,0,0)); + FTParticle track = new FTParticle(i, 0, this.solenoidField, responses.get(i), 0, 0, solenoid.getDoubleValue("z", 0,0,0)); particles.add(track); responses.get(i).setAssociation(particles.size()-1); }