-
Notifications
You must be signed in to change notification settings - Fork 12
Add isolations to TrackData object for Kalman tracks #1159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
36f0523
400cdc4
cc4bd1f
1e3a722
4967fff
3dafcbc
c0c352d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,7 +17,6 @@ | |
| import org.hps.recon.tracking.TrackData; | ||
| import org.hps.recon.tracking.TrackIntersectData; | ||
| import org.hps.recon.tracking.TrackResidualsData; | ||
| //import org.hps.recon.tracking.KFKinkData; | ||
|
|
||
| import org.hps.recon.tracking.MaterialSupervisor.ScatteringDetectorVolume; | ||
| import org.hps.recon.tracking.MaterialSupervisor.SiStripPlane; | ||
|
|
@@ -354,22 +353,16 @@ public void process(EventHeader event) { | |
| List<LCRelation> trackResidualsRelations = new ArrayList<LCRelation>(); | ||
| List<TrackIntersectData> trackIntersects = new ArrayList<TrackIntersectData>(); | ||
| List<LCRelation> trackIntersectsRelations = new ArrayList<LCRelation>(); | ||
|
|
||
| ArrayList<KalTrack>[] kPatList = prepareTrackCollections(event, outputFullTracks, trackDataCollection, trackDataRelations, allClstrs, gblStripClusterDataRelations,trackXKinks,trackXKinksRelations,trackZKinks,trackZKinksRelations,trackResiduals, trackResidualsRelations, trackIntersects, trackIntersectsRelations); | ||
|
|
||
| // ArrayList<KalTrack>[] kPatList = prepareTrackCollections(event, outputFullTracks, trackDataCollection, trackDataRelations, allClstrs, gblStripClusterDataRelations, trackResiduals, trackResidualsRelations); | ||
| //mg debug why the track data relations (and others I think) are screwed | ||
| // for (LCRelation tdRel: trackDataRelations){ | ||
| // System.out.println(tdRel.getFrom()+" ---> " +tdRel.getTo()); | ||
| // } | ||
|
|
||
| int flag = 1 << LCIOConstants.TRBIT_HITS; | ||
| event.put(outputFullTrackCollectionName, outputFullTracks, Track.class, flag); | ||
| event.put("KFGBLStripClusterData", allClstrs, GBLStripClusterData.class, flag); | ||
| event.put("KFGBLStripClusterDataRelations", gblStripClusterDataRelations, LCRelation.class, flag); | ||
| event.put("KFTrackData",trackDataCollection, TrackData.class,0); | ||
| event.put("KFTrackDataRelations",trackDataRelations,LCRelation.class,0); | ||
|
|
||
| if (addKinks) { | ||
| event.put("KFXKink", trackXKinks, TrackResidualsData.class,0); | ||
| event.put("KFXKinkRelations", trackXKinksRelations,LCRelation.class,0); | ||
|
|
@@ -419,7 +412,8 @@ private ArrayList<KalTrack>[] prepareTrackCollections(EventHeader event, List<Tr | |
| List<TrackResidualsData> trackXKinks, List<LCRelation> trackXKinksRelations, | ||
| List<TrackResidualsData> trackZKinks, List<LCRelation> trackZKinksRelations, | ||
| List<TrackResidualsData> trackResiduals, List<LCRelation> trackResidualsRelations, | ||
| List<TrackIntersectData> trackIntersects, List<LCRelation> trackIntersectsRelations) { | ||
| List<TrackIntersectData> trackIntersects, List<LCRelation> trackIntersectsRelations | ||
| ) { | ||
|
|
||
| int evtNumb = event.getEventNumber(); | ||
| String stripHitInputCollectionName = "StripClusterer_SiTrackerHitStrip1D"; | ||
|
|
@@ -444,12 +438,6 @@ private ArrayList<KalTrack>[] prepareTrackCollections(EventHeader event, List<Tr | |
| nEvents++; | ||
| logger.log(Level.FINE,"KalmanPatRecDriver.process: run time for pattern recognition at event " + evtNumb + " is " + runTime + " milliseconds"); | ||
|
|
||
| //List<RawTrackerHit> rawhits = event.get(RawTrackerHit.class, "SVTRawTrackerHits"); | ||
| //if (rawhits == null) { | ||
| // logger.log(Level.FINE, String.format("KalmanPatRecDriver.process: the raw hits collection is missing")); | ||
| // return null; | ||
| //} | ||
|
|
||
| int nKalTracks = 0; | ||
| for (int topBottom=0; topBottom<2; ++topBottom) { | ||
| ArrayList<KalTrack> kPat = kPatList[topBottom]; | ||
|
|
@@ -472,11 +460,6 @@ private ArrayList<KalTrack>[] prepareTrackCollections(EventHeader event, List<Tr | |
| Track KalmanTrackHPS = KI.createTrack(kTk, true); | ||
| if (KalmanTrackHPS == null) continue; | ||
|
|
||
| //pT cut | ||
| //double [] hParams_check = kTk.originHelixParms(); | ||
| //double ptInv_check = hParams_check[2]; | ||
| //double pt = Math.abs(1./ptInv_check); | ||
|
|
||
| outputFullTracks.add(KalmanTrackHPS); | ||
|
|
||
| List<GBLStripClusterData> clstrs = KI.createGBLStripClusterData(kTk); | ||
|
|
@@ -500,9 +483,6 @@ private ArrayList<KalTrack>[] prepareTrackCollections(EventHeader event, List<Tr | |
| //if tanLamda<0 set bottom | ||
| if (KalmanTrackHPS.getTrackStates().get(0).getTanLambda() < 0) trackerVolume = 1; | ||
|
|
||
| //TODO: compute isolations | ||
| double qualityArray[] = new double[1]; | ||
| qualityArray[0] = -1; | ||
|
|
||
| //Get the track momentum and convert it into detector frame and float values | ||
| Hep3Vector momentum = new BasicHep3Vector(KalmanTrackHPS.getTrackStates().get(0).getMomentum()); | ||
|
|
@@ -537,13 +517,7 @@ private ArrayList<KalTrack>[] prepareTrackCollections(EventHeader event, List<Tr | |
| //Add the TrackResiduals | ||
| List<Integer> layers = new ArrayList<Integer>(); | ||
| List<Double> residuals = new ArrayList<Double>(); | ||
| List<Float> sigmas = new ArrayList<Float>(); | ||
| List<Integer> layersInt = new ArrayList<Integer>(); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a reason why this chunk of code is moved down a few lines? It is hard to parse what is going on with the different loops and if statements.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The first loop is of hits on track (so, only layers with a HOT are included) and the second one is over all layers. I separated the intersections list instantiations down to just before the loop over all layers because that's where it's filled. |
||
| List<Double> intersect = new ArrayList<Double>(); | ||
| List<Float> sigmasInt = new ArrayList<Float>(); | ||
| int uindex = 0; | ||
| int vindex = 1; | ||
| int windex = 2; | ||
| List<Float> sigmas = new ArrayList<Float>(); | ||
| for (GBLStripClusterData clstr: clstrs) { | ||
| Pair<Double,Double> res_and_sigma = kTk.unbiasedResidualMillipede(clstr.getId()); | ||
| if (res_and_sigma.getSecondElement() > -1.) { | ||
|
|
@@ -556,17 +530,30 @@ private ArrayList<KalTrack>[] prepareTrackCollections(EventHeader event, List<Tr | |
| sigmas.add(res_and_sigma.getSecondElement().floatValue()); | ||
| } | ||
| } | ||
| //Add the Track Intersections | ||
| List<Integer> layersInt = new ArrayList<Integer>(); | ||
| List<Double> intersect = new ArrayList<Double>(); | ||
| List<Float> sigmasInt = new ArrayList<Float>(); | ||
|
|
||
| int uindex = 0; | ||
| int vindex = 1; | ||
| int windex = 2; | ||
|
|
||
| double[] isolationsArray=new double[14]; | ||
| for(int ilay = 0;ilay<14;ilay++){ | ||
| Pair<Double[], Double> inter_and_sigma = kTk.unbiasedIntersect(ilay, true); | ||
| layersInt.add(ilay); | ||
| intersect.add(inter_and_sigma.getFirstElement()[uindex]); | ||
| intersect.add(inter_and_sigma.getFirstElement()[vindex]); | ||
| intersect.add(inter_and_sigma.getFirstElement()[windex]); | ||
| sigmasInt.add(inter_and_sigma.getSecondElement().floatValue()); | ||
| sigmasInt.add(inter_and_sigma.getSecondElement().floatValue()); | ||
| //get isolations | ||
| Pair<Double,Double> isolation=kTk.getIsoAndT0(ilay); | ||
| isolationsArray[ilay]=isolation.getFirstElement(); | ||
| }//Loop on layers | ||
|
|
||
| //Add the Track Data | ||
| TrackData KFtrackData = new TrackData(trackerVolume, (float) kTk.getTime(), qualityArray, momentum_f, (float) origin_bFieldY, (float) target_bFieldY, (float) ecal_bFieldY, (float) svtCenter_bFieldY); | ||
| TrackData KFtrackData = new TrackData(trackerVolume, (float) kTk.getTime(), isolationsArray, momentum_f, (float) origin_bFieldY, (float) target_bFieldY, (float) ecal_bFieldY, (float) svtCenter_bFieldY); | ||
| trackDataCollection.add(KFtrackData); | ||
| trackDataRelations.add(new BaseLCRelation(KFtrackData, KalmanTrackHPS)); | ||
|
|
||
|
|
@@ -577,7 +564,6 @@ private ArrayList<KalTrack>[] prepareTrackCollections(EventHeader event, List<Tr | |
| trackIntersects.add(intersectData); | ||
| trackIntersectsRelations.add(new BaseLCRelation(intersectData, KalmanTrackHPS)); | ||
|
|
||
|
|
||
| //Add the Kinks | ||
| layers = new ArrayList<Integer>(); | ||
| List<Double> Xkinks = new ArrayList<Double>(); | ||
|
|
@@ -598,13 +584,6 @@ private ArrayList<KalTrack>[] prepareTrackCollections(EventHeader event, List<Tr | |
| TrackResidualsData kinkZData = new TrackResidualsData(trackerVolume,layers,Zkinks,sigmas); | ||
| trackZKinks.add(kinkZData); | ||
| trackZKinksRelations.add(new BaseLCRelation(kinkZData, KalmanTrackHPS)); | ||
| /* | ||
| if (KalmanTrackHPS.getTrackerHits().size() != residuals.size()) { | ||
| System.out.println("KalmanPatRecDriver::Residuals consistency check failed."); | ||
| System.out.printf("Track has %d hits while I have %d residuals \n", KalmanTrackHPS.getTrackerHits().size(), residuals.size()); | ||
| } | ||
| */ | ||
|
|
||
| } // end of loop on tracks | ||
| } // end of loop on trackers | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't fully understand this comment. What do you mean by
local-->global v-->z elementand what is+ive vThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The local-->global refers to the rotation matrix R (local i.e. sensor frame to the "global" frame for kalman tracking) and v-->z element is the element in that matrix (the z component of the v direction). +ive == positive.