Author: [log in to unmask]
Date: Fri Jul 8 16:41:14 2016
New Revision: 4425
Log:
dump event information to tuple
Added:
java/trunk/analysis/src/main/java/org/hps/analysis/tuple/TridentTruthTupleDriver.java
- copied, changed from r4422, java/trunk/analysis/src/main/java/org/hps/analysis/tuple/TridentTupleDriver.java
java/trunk/steering-files/src/main/resources/org/hps/steering/analysis/MakeTuplesSlic.lcsim
- copied, changed from r4422, java/trunk/steering-files/src/main/resources/org/hps/steering/analysis/MakeTuples.lcsim
Modified:
java/trunk/analysis/src/main/java/org/hps/analysis/tuple/TupleDriver.java
Copied: java/trunk/analysis/src/main/java/org/hps/analysis/tuple/TridentTruthTupleDriver.java (from r4422, java/trunk/analysis/src/main/java/org/hps/analysis/tuple/TridentTupleDriver.java)
=============================================================================
--- java/trunk/analysis/src/main/java/org/hps/analysis/tuple/TridentTupleDriver.java (original)
+++ java/trunk/analysis/src/main/java/org/hps/analysis/tuple/TridentTruthTupleDriver.java Fri Jul 8 16:41:14 2016
@@ -1,111 +1,22 @@
package org.hps.analysis.tuple;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import org.hps.recon.particle.ReconParticleDriver;
-import org.hps.recon.tracking.TrackType;
-import org.hps.recon.vertexing.BilliorTrack;
-import org.hps.record.triggerbank.AbstractIntData;
-import org.hps.record.triggerbank.TIData;
import org.lcsim.event.EventHeader;
-import org.lcsim.event.GenericObject;
-import org.lcsim.event.ReconstructedParticle;
-import org.lcsim.event.Track;
-import org.lcsim.event.TrackState;
-public class TridentTupleDriver extends TupleDriver {
-
- private final String unconstrainedV0CandidatesColName = "UnconstrainedV0Candidates";
-
- private final double tupleTrkPCut = 0.9;
- private final double tupleMaxSumCut = 1.3;
- private boolean getMC = false;
+public class TridentTruthTupleDriver extends TupleDriver {
@Override
protected void setupVariables() {
tupleVariables.clear();
- addEventVariables();
- addVertexVariables();
- addParticleVariables("ele");
- addParticleVariables("pos");
- String[] newVars = new String[]{"minPositiveIso/D", "minNegativeIso/D", "minIso/D"};
- tupleVariables.addAll(Arrays.asList(newVars));
- if (getMC) {
- addMCTridentVariables();
- }
- }
-
- public void setGetMC(boolean getMC) {
- this.getMC = getMC;
+ addMCTridentVariables();
}
@Override
public void process(EventHeader event) {
- /* make sure everything is there */
- if (!event.hasCollection(ReconstructedParticle.class, unconstrainedV0CandidatesColName)) {
- return;
- }
- TIData triggerData = null;
- if (event.hasCollection(GenericObject.class, "TriggerBank")) {
- for (GenericObject data : event.get(GenericObject.class, "TriggerBank")) {
- if (AbstractIntData.getTag(data) == TIData.BANK_TAG) {
- triggerData = new TIData(data);
- }
- }
- }
+ fillMCTridentVariables(event);
- //check to see if this event is from the correct trigger (or "all");
- if (triggerData != null && !matchTriggerType(triggerData)) {
- return;
- }
- List<ReconstructedParticle> unConstrainedV0List = event.get(ReconstructedParticle.class, unconstrainedV0CandidatesColName);
-
- for (ReconstructedParticle uncV0 : unConstrainedV0List) {
- if (isGBL != TrackType.isGBL(uncV0.getType())) {
- continue;
- }
- tupleMap.clear();
- fillEventVariables(event, triggerData);
-
- ReconstructedParticle electron = uncV0.getParticles().get(ReconParticleDriver.ELECTRON);
- ReconstructedParticle positron = uncV0.getParticles().get(ReconParticleDriver.POSITRON);
- if (electron.getCharge() != -1 || positron.getCharge() != 1) {
- throw new RuntimeException("incorrect charge on v0 daughters");
- }
-
- Track eleTrack = electron.getTracks().get(0);
- Track posTrack = positron.getTracks().get(0);
-
- TrackState eleTSTweaked = fillParticleVariables(event, electron, "ele");
- TrackState posTSTweaked = fillParticleVariables(event, positron, "pos");
-
- List<BilliorTrack> billiorTracks = new ArrayList<BilliorTrack>();
- billiorTracks.add(new BilliorTrack(eleTSTweaked, eleTrack.getChi2(), eleTrack.getNDF()));
- billiorTracks.add(new BilliorTrack(posTSTweaked, posTrack.getChi2(), posTrack.getNDF()));
-
- double minPositiveIso = Math.min(tupleMap.get("eleMinPositiveIso/D"), tupleMap.get("posMinPositiveIso/D"));
- double minNegativeIso = Math.min(Math.abs(tupleMap.get("eleMinNegativeIso/D")), Math.abs(tupleMap.get("posMinNegativeIso/D")));
- double minIso = Math.min(minPositiveIso, minNegativeIso);
-
- fillVertexVariables(event, billiorTracks, electron, positron);
-
- tupleMap.put("minPositiveIso/D", minPositiveIso);
- tupleMap.put("minNegativeIso/D", minNegativeIso);
- tupleMap.put("minIso/D", minIso);
-
- if (getMC) {
- fillMCTridentVariables(event);
- }
-
- if (tupleWriter != null) {
- boolean trkCut = tupleMap.get("eleP/D") < tupleTrkPCut * ebeam && tupleMap.get("posP/D") < tupleTrkPCut * ebeam;
- boolean sumCut = tupleMap.get("eleP/D") + tupleMap.get("posP/D") < tupleMaxSumCut * ebeam;
- if (!cutTuple || (trkCut && sumCut)) {
- writeTuple();
- }
- }
+ if (tupleWriter != null) {
+ writeTuple();
}
}
}
Modified: java/trunk/analysis/src/main/java/org/hps/analysis/tuple/TupleDriver.java
=============================================================================
--- java/trunk/analysis/src/main/java/org/hps/analysis/tuple/TupleDriver.java (original)
+++ java/trunk/analysis/src/main/java/org/hps/analysis/tuple/TupleDriver.java Fri Jul 8 16:41:14 2016
@@ -149,10 +149,13 @@
beamAxisRotation.setActiveEuler(Math.PI / 2, -0.0305, -Math.PI / 2);
bfield = TrackUtils.getBField(detector).magnitude();
- BeamEnergy.BeamEnergyCollection beamEnergyCollection
- = this.getConditionsManager().getCachedConditions(BeamEnergy.BeamEnergyCollection.class, "beam_energies").getCachedData();
if (Double.isNaN(ebeam)) {
- ebeam = beamEnergyCollection.get(0).getBeamEnergy();
+ try {
+ BeamEnergy.BeamEnergyCollection beamEnergyCollection
+ = this.getConditionsManager().getCachedConditions(BeamEnergy.BeamEnergyCollection.class, "beam_energies").getCachedData();
+ ebeam = beamEnergyCollection.get(0).getBeamEnergy();
+ } catch (Exception e) {
+ }
}
setupVariables();
if (tupleFile != null) {
Copied: java/trunk/steering-files/src/main/resources/org/hps/steering/analysis/MakeTuplesSlic.lcsim (from r4422, java/trunk/steering-files/src/main/resources/org/hps/steering/analysis/MakeTuples.lcsim)
=============================================================================
--- java/trunk/steering-files/src/main/resources/org/hps/steering/analysis/MakeTuples.lcsim (original)
+++ java/trunk/steering-files/src/main/resources/org/hps/steering/analysis/MakeTuplesSlic.lcsim Fri Jul 8 16:41:14 2016
@@ -1,70 +1,20 @@
+<!--
+This steering file dumps truth information to ROOT tuple format. It only uses the MCParticle collection, so it should work on any MC LCIO file (SLIC output, readout sim, recon).
+-->
+
<lcsim xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
xs:noNamespaceSchemaLocation="http://www.lcsim.org/schemas/lcsim/1.0/lcsim.xsd">
<execute>
<driver name="EventMarkerDriver"/>
- <driver name="CleanupDriver"/>
- <driver name="EventFlagFilter"/>
- <driver name="RawTrackerHitSensorSetup"/>
-
- <driver name="TridentTuple"/>
- <driver name="MollerTuple"/>
- <driver name="FEETuple"/>
+ <driver name="TruthTuple"/>
</execute>
<drivers>
<driver name="EventMarkerDriver" type="org.lcsim.job.EventMarkerDriver">
<eventInterval>1000</eventInterval>
</driver>
- <driver name="CleanupDriver" type="org.lcsim.recon.tracking.digitization.sisim.config.ReadoutCleanupDriver"/>
- <driver name="EventFlagFilter" type="org.hps.recon.filtering.EventFlagFilter">
- </driver>
- <driver name="RawTrackerHitSensorSetup" type="org.lcsim.recon.tracking.digitization.sisim.config.RawTrackerHitSensorSetup">
- <readoutCollections>SVTRawTrackerHits</readoutCollections>
- </driver>
- <driver name="TridentTuple" type="org.hps.analysis.tuple.TridentTupleDriver">
- <triggerType>all</triggerType>
- <isGBL>true</isGBL>
- <tupleFile>${outputFile}_tri.txt</tupleFile>
- <cutTuple>true</cutTuple>
- <beamPosZ>-5.0</beamPosZ>
- <topDOmega>-1.04e-6</topDOmega>
- <botDOmega>0.83e-6</botDOmega>
- <topDLambda>-5e-4</topDLambda>
- <botDLambda>13e-4</botDLambda>
- <topDPhi>1.5e-3</topDPhi>
- <botDPhi>-0.3e-3</botDPhi>
- <topDZ0>0.14</topDZ0>
- <botDZ0>-0.16</botDZ0>
- </driver>
- <driver name="MollerTuple" type="org.hps.analysis.tuple.MollerTupleDriver">
- <triggerType>all</triggerType>
- <isGBL>true</isGBL>
- <tupleFile>${outputFile}_moller.txt</tupleFile>
- <cutTuple>true</cutTuple>
- <beamPosZ>-5.0</beamPosZ>
- <topDOmega>-1.04e-6</topDOmega>
- <botDOmega>0.83e-6</botDOmega>
- <topDLambda>-5e-4</topDLambda>
- <botDLambda>13e-4</botDLambda>
- <topDPhi>1.5e-3</topDPhi>
- <botDPhi>-0.3e-3</botDPhi>
- <topDZ0>0.14</topDZ0>
- <botDZ0>-0.16</botDZ0>
- </driver>
- <driver name="FEETuple" type="org.hps.analysis.tuple.FEETupleDriver">
- <triggerType>all</triggerType>
- <isGBL>true</isGBL>
- <tupleFile>${outputFile}_fee.txt</tupleFile>
- <cutTuple>true</cutTuple>
- <beamPosZ>-5.0</beamPosZ>
- <topDOmega>-1.04e-6</topDOmega>
- <botDOmega>0.83e-6</botDOmega>
- <topDLambda>-5e-4</topDLambda>
- <botDLambda>13e-4</botDLambda>
- <topDPhi>1.5e-3</topDPhi>
- <botDPhi>-0.3e-3</botDPhi>
- <topDZ0>0.14</topDZ0>
- <botDZ0>-0.16</botDZ0>
+ <driver name="TruthTuple" type="org.hps.analysis.tuple.TridentTruthTupleDriver">
+ <tupleFile>${outputFile}_truth.txt</tupleFile>
</driver>
</drivers>
</lcsim>
|