Skip to content

Commit cd31b5c

Browse files
committed
clean up code
1 parent 03946dd commit cd31b5c

2 files changed

Lines changed: 24 additions & 73 deletions

File tree

recon/src/main/java/org/hps/recon/skims/MollerSkimmer.java

Lines changed: 21 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,13 @@
2323
import org.lcsim.event.Vertex;
2424

2525
public class MollerSkimmer extends Skimmer {
26-
//default parameters...ok for 2021 run
27-
private String _V0CandidateCollectionName = "UnconstrainedMollerCandidates_KF";
28-
private String _V0VertexCollectionName = "UnconstrainedMollerVertices_KF";
29-
//private double _clusterTimingCut = 20.0; // only used if _tight is true
30-
private double _posClusterEnergy = 0.2; //GeV
31-
private double _v0Chi2Cut = 100.0;
26+
private String _MollerCandidateCollectionName = "UnconstrainedMollerCandidates_KF";
27+
private String _MollerVertexCollectionName = "UnconstrainedMollerVertices_KF";
28+
private double _vtxChi2Cut = 100.0;
3229
private double _trackChi2Cut = 30.0;
33-
private double _trackDtCut = 20.0; // the 2-track time difference
34-
private double _trackPMax = 4.5; //GeV
35-
private double _elePMax = 9999; //GeV
36-
private double _v0PMax = 4.5; //GeV
30+
private double _trackDtCut = 20.0;
3731
private int _nHitsMin=9;
38-
private boolean _reqClusterMatch=false;
39-
private boolean _debug=true;
32+
private boolean _debug=false;
4033
private int totalMollers=0;
4134
private int totalMollersPassing=0;
4235

@@ -47,25 +40,28 @@ public boolean passSelection(EventHeader event){
4740
System.out.println(this.getClass().getName()+":: in pass selection");
4841
incrementEventProcessed();
4942

50-
if (!event.hasCollection(ReconstructedParticle.class, _V0CandidateCollectionName)) {
43+
if (!event.hasCollection(ReconstructedParticle.class, _MollerCandidateCollectionName)) {
5144
return false;
5245
}
53-
if (!event.hasCollection(Vertex.class, _V0VertexCollectionName)) {
46+
if (!event.hasCollection(Vertex.class, _MollerVertexCollectionName)) {
5447
return false;
5548
}
5649

57-
List<ReconstructedParticle> V0Candidates = event.get(ReconstructedParticle.class, _V0CandidateCollectionName);
58-
List<Vertex> V0Vertexes= event.get(Vertex.class, _V0VertexCollectionName);
50+
List<ReconstructedParticle> V0Candidates = event.get(ReconstructedParticle.class, _MollerCandidateCollectionName);
51+
List<Vertex> V0Vertexes= event.get(Vertex.class, _MollerVertexCollectionName);
52+
5953
if(V0Candidates.size() != V0Vertexes.size())
6054
System.out.println(this.getClass().getName()+":: Number of Vertexes = "+V0Vertexes.size()+
6155
"; number of candidates = "+V0Candidates.size());
62-
int nMollers = 0; // number of good V0
56+
57+
int nMollers = 0;
6358
totalMollers += V0Candidates.size();
6459
for (ReconstructedParticle v0 : V0Candidates) {
60+
6561
ReconstructedParticle eleTop = v0.getParticles().get(ReconParticleDriver.MOLLER_TOP);
6662
ReconstructedParticle eleBot = v0.getParticles().get(ReconParticleDriver.MOLLER_BOT);
6763

68-
if (v0.getStartVertex().getChi2() > _v0Chi2Cut) {
64+
if (v0.getStartVertex().getChi2() > _vtxChi2Cut) {
6965
if(_debug)System.out.println(this.getClass().getName()+":: failed vertex chi2");
7066
continue;
7167
}
@@ -80,26 +76,6 @@ public boolean passSelection(EventHeader event){
8076
continue;
8177
}
8278

83-
float[] elePTD={TrackData.getTrackData(event, eleTop.getTracks().get(0)).getFloatVal(1),
84-
TrackData.getTrackData(event, eleTop.getTracks().get(0)).getFloatVal(2),
85-
TrackData.getTrackData(event, eleTop.getTracks().get(0)).getFloatVal(3)};
86-
float[] posPTD={TrackData.getTrackData(event, eleBot.getTracks().get(0)).getFloatVal(1),
87-
TrackData.getTrackData(event, eleBot.getTracks().get(0)).getFloatVal(2),
88-
TrackData.getTrackData(event, eleBot.getTracks().get(0)).getFloatVal(3)};
89-
double elePMag = (new BasicHep3Vector(elePTD)).magnitude();
90-
double posPMag = (new BasicHep3Vector(posPTD)).magnitude();
91-
if (elePMag > _trackPMax || posPMag > _trackPMax) {
92-
if(_debug)System.out.println(this.getClass().getName()+":: failed track momentum");
93-
continue;
94-
}
95-
if(eleTop.getMomentum().magnitude() > _elePMax){
96-
if(_debug)System.out.println(this.getClass().getName()+":: failed eleTop momentum");
97-
continue;
98-
}
99-
if ((elePMag+posPMag) > _v0PMax) {
100-
if(_debug)System.out.println(this.getClass().getName()+":: failed v0 momentum");
101-
continue;
102-
}
10379
double eleTime = TrackData.getTrackTime(TrackData.getTrackData(event, eleTop.getTracks().get(0)));
10480
double posTime = TrackData.getTrackTime(TrackData.getTrackData(event, eleBot.getTracks().get(0)));
10581
if (Math.abs(eleTime - posTime) > _trackDtCut) {
@@ -130,7 +106,7 @@ public void setParameters(String parsFileName){
130106
String infilePreResDir = "/org/hps/recon/skims/";
131107
String infile=infilePreResDir+parsFileName;
132108
InputStream inParamStream = this.getClass().getResourceAsStream(infile);
133-
System.out.println(this.getClass().getName()+":: reading in per-sensor per-phase calibs from "+infile);
109+
System.out.println(this.getClass().getName()+":: reading in Moller skimming cuts from "+infile);
134110
BufferedReader reader = new BufferedReader(new InputStreamReader(inParamStream));
135111
String line;
136112
String delims = "[ ]+";// this will split strings between one or more spaces
@@ -151,28 +127,16 @@ public void setParameters(String parsFileName){
151127

152128

153129
private void putParam(String parName, String var){
154-
if(parName.equals("V0CandidateCollectionName"))
155-
_V0CandidateCollectionName=var;
156-
// else if(parName.equals("clusterTimingCut"))
157-
// _clusterTimingCut=Double.parseDouble(var);
158-
else if(parName.equals("v0Chi2Cut"))
159-
_v0Chi2Cut=Double.parseDouble(var);
130+
if(parName.equals("MollerCandidateCollectionName"))
131+
_MollerCandidateCollectionName=var;
132+
else if(parName.equals("vtxChi2Cut"))
133+
_vtxChi2Cut=Double.parseDouble(var);
160134
else if(parName.equals("trackChi2Cut"))
161135
_trackChi2Cut=Double.parseDouble(var);
162136
else if(parName.equals("trackDtCut"))
163137
_trackDtCut=Double.parseDouble(var);
164-
else if(parName.equals("trackPMax"))
165-
_trackPMax=Double.parseDouble(var);
166-
else if(parName.equals("elePMax"))
167-
_elePMax=Double.parseDouble(var);
168-
else if(parName.equals("v0PMax"))
169-
_v0PMax=Double.parseDouble(var);
170138
else if(parName.equals("nHitsMin"))
171139
_nHitsMin=Integer.parseInt(var);
172-
else if(parName.equals("reqClusterMatch"))
173-
_reqClusterMatch=Boolean.parseBoolean(var);
174-
else if(parName.equals("posClusterEnergy"))
175-
_posClusterEnergy=Double.parseDouble(var);
176140
else
177141
System.out.println(this.getClass().getName()+":: couldn't find "+parName+"!");
178142
}
@@ -185,24 +149,15 @@ public int getTotalMollers(){
185149
return totalMollers;
186150
}
187151

188-
// public void setClusterTimeCut(double cutVal){
189-
// this._clusterTimingCut=cutVal;
190-
// }
191-
public void setV0Chi2Cut(double cutVal){
192-
this._v0Chi2Cut=cutVal;
152+
public void setVtxChi2Cut(double cutVal){
153+
this._vtxChi2Cut=cutVal;
193154
}
194155
public void setTrackChi2Cut(double cutVal){
195156
this._trackChi2Cut=cutVal;
196157
}
197158
public void setTrackDtCut(double cutVal){
198159
this._trackDtCut=cutVal;
199160
}
200-
public void setTrackPMax(double cutVal){
201-
this._trackPMax=cutVal;
202-
}
203-
public void setV0PMax(double cutVal){
204-
this._v0PMax=cutVal;
205-
}
206161
public void setNHitsMin(int cutVal){
207162
this._nHitsMin=cutVal;
208163
}
Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1-
V0CandidateCollectionName UnconstrainedMollerCandidates_KF
1+
MollerCandidateCollectionName UnconstrainedMollerCandidates_KF
22
trackChi2Cut 30.0
3-
nHitsMin 9
4-
v0Chi2Cut 30.0
3+
nHitsMin 6
4+
vtxChi2Cut 30.0
55
trackDtCut 20.0
6-
trackPMax 5.5
7-
v0PMax 5.5
8-
reqClusterMatch false
9-
posClusterEnergy 0.2

0 commit comments

Comments
 (0)