Skip to content

Commit d8a415c

Browse files
authored
Merge pull request #1092 from JeffersonLab/dataqual2021
fix data quality drivers to work with KF tracks
2 parents 02712f3 + 8641134 commit d8a415c

File tree

11 files changed

+951
-112
lines changed

11 files changed

+951
-112
lines changed

analysis/src/main/java/org/hps/analysis/dataquality/DataQualityMonitor.java

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,21 @@ public double getBeamEnergy() {
4848
protected boolean debug = false;
4949
protected boolean outputPlots = false;
5050
protected String outputPlotDir = "DQMOutputPlots/";
51-
51+
//define all of the collection strings here so the the variable names are all consistent
52+
//makes it easier to do steering for multiple drivers.
53+
protected String finalStateParticlesColName = "FinalStateParticles";
54+
protected String unconstrainedV0CandidatesColName = "UnconstrainedV0Candidates";
55+
protected String beamConV0CandidatesColName = "BeamspotConstrainedV0Candidates";
56+
protected String targetConV0CandidatesColName = "TargetConstrainedV0Candidates";
57+
5258
@Override
5359
protected void detectorChanged(Detector detector) {
5460
BeamEnergyCollection beamEnergyCollection = this.getConditionsManager()
5561
.getCachedConditions(BeamEnergyCollection.class, "beam_energies").getCachedData();
56-
if (beamEnergy == null && beamEnergyCollection != null && beamEnergyCollection.size() != 0)
62+
if (beamEnergy == null && beamEnergyCollection != null && beamEnergyCollection.size() != 0){
5763
beamEnergy = beamEnergyCollection.get(0).getBeamEnergy();
64+
System.out.println(this.getClass().getName()+":: setting beamEnergy = "+beamEnergy);
65+
}
5866
else {
5967
LOGGER.log(Level.WARNING, "warning: beam energy not found. Using a 6.6 GeV as the default energy");
6068
beamEnergy = 6.6;
@@ -63,16 +71,36 @@ protected void detectorChanged(Detector detector) {
6371
is2019Run = DatabaseConditionsManager.isPhys2019Run(this.getConditionsManager().getRun());
6472
}
6573

74+
public void setFinalStateParticlesColName(String fspColName){
75+
finalStateParticlesColName=fspColName;
76+
}
77+
78+
public void setUnconstrainedV0CandidatesColName(String ucV0ColName){
79+
unconstrainedV0CandidatesColName=ucV0ColName;
80+
}
81+
82+
public void setBeamConV0CandidatesColName(String bscV0ColName){
83+
beamConV0CandidatesColName=bscV0ColName;
84+
}
85+
86+
public void setTargetConV0CandidatesColName(String tcV0ColName){
87+
targetConV0CandidatesColName=tcV0ColName;
88+
}
89+
6690
String triggerType = "all";// allowed types are "" (blank) or "all", singles0, singles1, pairs0,pairs1
6791
public boolean isGBL = false;
68-
92+
public boolean isKF = false;
93+
6994
public void setTriggerType(String type) {
7095
this.triggerType = type;
7196
}
7297

7398
public void setIsGBL(boolean isgbl) {
7499
this.isGBL = isgbl;
75100
}
101+
public void setIsKF(boolean iskf) {
102+
this.isKF = iskf;
103+
}
76104

77105
public void setRecoVersion(String recoVersion) {
78106
this.recoVersion = recoVersion;

analysis/src/main/java/org/hps/analysis/dataquality/FinalStateMonitoring.java

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ public class FinalStateMonitoring extends DataQualityMonitor {
4141

4242
private static Logger LOGGER = Logger.getLogger(FinalStateMonitoring.class.getPackage().getName());
4343

44-
String finalStateParticlesColName = "FinalStateParticles";
45-
4644
String[] fpQuantNames = {"nEle_per_Event", "nPos_per_Event", "nPhoton_per_Event", "nUnAssociatedTracks_per_Event",
4745
"avg_delX_at_ECal", "avg_delY_at_ECal", "avg_E_Over_P", "avg_mom_beam_elec", "sig_mom_beam_elec"};
4846
// some counters
@@ -92,22 +90,20 @@ public class FinalStateMonitoring extends DataQualityMonitor {
9290
/* number of unassocaited tracks/event */
9391
IHistogram1D nUnAssTracksHisto;
9492

95-
public void setFinalStateParticlesColName(String fsp) {
96-
this.finalStateParticlesColName = fsp;
97-
}
98-
9993
@Override
10094
protected void detectorChanged(Detector detector) {
10195
super.detectorChanged(detector);
10296
double maxFactor = 1.5;
10397
double feeMomentumCut = 0.75; // this number, multiplied by the beam energy, is the actual cut
104-
beamEnergy = 4.5;
105-
System.out.println("Using beamEnergy = " + beamEnergy);
98+
System.out.println(this.getClass().getName()+":: setting beamEnergy = "+beamEnergy);
10699
LOGGER.info("Setting up the plotter");
107100
aida.tree().cd("/");
108101
String trkType = "SeedTrack/";
109102
if (isGBL)
110103
trkType = "GBLTrack/";
104+
if (isKF)
105+
trkType = "KFTrack/";
106+
111107

112108
/* Final State Particle Quantities */
113109
/* plot electron & positron momentum separately */
@@ -247,12 +243,6 @@ public void process(EventHeader event) {
247243
if (fsCluster == null)
248244
throw new RuntimeException("isPhoton==true but no cluster found: should never happen");
249245
double ene = fsPart.getEnergy();
250-
// TODO: mg-May 14, 2014....I would like to do this!!!!
251-
// double xpos = fsCluster.getPositionAtShowerMax(false)[0];// false-->assume a photon instead of
252-
// electron from calculating shower depth
253-
// double ypos = fsCluster.getPositionAtShowerMax(false)[1];
254-
// but I can't because ReconParticles don't know about HPSEcalClusters, and casting it as one doesn't
255-
// seem to work
256246
Hep3Vector clusterPosition = new BasicHep3Vector(fsCluster.getPosition());
257247
double xpos = clusterPosition.x();
258248
double ypos = clusterPosition.y();
@@ -271,9 +261,9 @@ public void process(EventHeader event) {
271261
double ene = fsPart.getEnergy();
272262
double eOverP = ene / mom.magnitude();
273263
Hep3Vector clusterPosition = new BasicHep3Vector(fsCluster.getPosition());// this gets position at
274-
// shower max assuming it's an
275-
// electron/positron
276-
Hep3Vector trackPosAtEcal = TrackUtils.extrapolateTrack(fsTrack, clusterPosition.z());
264+
//get this from stored track state...don't do extrapolation by hand (commented out below)
265+
Hep3Vector trackPosAtEcal=new BasicHep3Vector(TrackUtils.getTrackStateAtECal(fsTrack).getReferencePoint());
266+
// Hep3Vector trackPosAtEcal = TrackUtils.extrapolateTrack(fsTrack, clusterPosition.z());
277267
double dx = trackPosAtEcal.x() - clusterPosition.x();// remember track vs detector coords
278268
double dy = trackPosAtEcal.y() - clusterPosition.y();// remember track vs detector coords
279269

0 commit comments

Comments
 (0)