@@ -255,7 +255,8 @@ protected void addEventVariables() {
255255 "evTx/I" ,"evTy/I" ,"rfT1/D" ,"rfT2/D" ,
256256 "nEcalHits/I" , "nSVTHits/I" , "nEcalCl/I" , "nEcalClele/I" ,"nEcalClpos/I" ,"nEcalClpho/I" ,"nEcalClEleSide/I" ,"nEcalClPosSide/I" ,
257257 "nSVTHitsL1/I" ,"nSVTHitsL2/I" ,"nSVTHitsL3/I" ,"nSVTHitsL4/I" ,"nSVTHitsL5/I" ,"nSVTHitsL6/I" ,
258- "nSVTHitsL1b/I" ,"nSVTHitsL2b/I" ,"nSVTHitsL3b/I" ,"nSVTHitsL4b/I" ,"nSVTHitsL5b/I" ,"nSVTHitsL6b/I" };
258+ "nSVTHitsL1b/I" ,"nSVTHitsL2b/I" ,"nSVTHitsL3b/I" ,"nSVTHitsL4b/I" ,"nSVTHitsL5b/I" ,"nSVTHitsL6b/I" ,
259+ "topL1HitX/D" ,"topL1HitY/D" ,"botL1HitX/D" ,"botL1HitY/D" };
259260 tupleVariables .addAll (Arrays .asList (newVars ));
260261 }
261262
@@ -300,6 +301,7 @@ protected void addParticleVariables(String prefix) {
300301 "RawMaxAmplL2/D" , "RawT0L2/D" , "RawChisqL2/D" ,"RawTDiffL2/D" ,
301302 "RawMaxAmplL3/D" , "RawT0L3/D" , "RawChisqL3/D" ,"RawTDiffL3/D" ,
302303 "NTrackHits/I" , "HitsSharedP/D" ,"MaxHitsShared/I" ,
304+ "MinNegativeIsoL2/D" ,"MinPositiveIsoL2/D" ,"IsoStereoL2/D" ,"IsoAxialL2/D" ,
303305 "SharedTrkChisq/D" ,"SharedTrkEcalX/D" ,"SharedTrkEcalY/D" ,
304306 "MatchChisq/D" , "ClT/D" , "ClE/D" , "ClSeedE/D" , "ClX/D" , "ClY/D" , "ClZ/D" , "ClHits/I" , "Clix/I" ,"Cliy/I" };
305307
@@ -488,6 +490,52 @@ else if (sensor.getLayerNumber()==12){
488490 tupleMap .put ("nSVTHitsL5b/I" , (double ) nL5bhits );
489491 tupleMap .put ("nSVTHitsL6b/I" , (double ) nL6bhits );
490492
493+
494+
495+ double topL1HitX = 9999 ;
496+ double topL1HitY = 9999 ;
497+ double botL1HitX = 9999 ;
498+ double botL1HitY = -9999 ;
499+
500+ String stereoHitCollectionName = "RotatedHelicalTrackHits" ;
501+
502+ // Get the collection of 3D hits from the event. This collection
503+ // contains all 3D hits in the event and not just those associated
504+ // with a track.
505+ List <TrackerHit > hits = event .get (TrackerHit .class , stereoHitCollectionName );
506+
507+ // Loop over the collection of 3D hits in the event and map them to
508+ // their corresponding layer.
509+ for (TrackerHit hit : hits ) {
510+ // Retrieve the sensor associated with one of the hits. This will
511+ // be used to retrieve the layer number
512+ HpsSiSensor sensor = (HpsSiSensor ) ((RawTrackerHit ) hit .getRawHits ().get (0 )).getDetectorElement ();
513+
514+ // Retrieve the layer number by using the sensor
515+ int layer = (sensor .getLayerNumber () + 1 )/2 ;
516+
517+ // If hit isn't in layer one, skip it.
518+ // You can also create another list which contains just layer 1 hits ...
519+ if (layer != 1 ) continue ;
520+
521+ if (sensor .isTopLayer () && topL1HitY >hit .getPosition ()[2 ]){
522+ topL1HitY = hit .getPosition ()[2 ];
523+ topL1HitX = hit .getPosition ()[1 ];
524+
525+ }
526+ if (sensor .isBottomLayer () && botL1HitY <hit .getPosition ()[2 ]){
527+ botL1HitY = hit .getPosition ()[2 ];
528+ botL1HitX = hit .getPosition ()[1 ];
529+
530+ }
531+
532+ // To check if hit is in top or bottom, use the sensor
533+ //sensor.isTopLayer()
534+ }
535+ tupleMap .put ("topL1HitX/D" , topL1HitX );
536+ tupleMap .put ("topL1HitY/D" , topL1HitY );
537+ tupleMap .put ("botL1HitX/D" , botL1HitX );
538+ tupleMap .put ("botL1HitY/D" , botL1HitY );
491539 /*
492540 // Get the hit amplitude
493541 double amplitude = FittedRawTrackerHit.getAmp(fittedRawTrackerHitMap.get(rHit));
@@ -632,8 +680,11 @@ protected TrackState fillParticleVariables(EventHeader event, ReconstructedParti
632680
633681 Double [] iso = TrackUtils .getIsolations (track , TrackUtils .getHitToStripsTable (event ), TrackUtils .getHitToRotatedTable (event ));
634682 double minPositiveIso = 9999 ;
683+ double minPositiveIsoL2 = 9999 ;
635684 double minNegativeIso = 9999 ;
685+ double minNegativeIsoL2 = 9999 ;
636686 double isoStereo = -9999 , isoAxial = -9999 ;
687+ double isoStereoL2 = -9999 , isoAxialL2 = -9999 ;
637688 for (int i = 0 ; i < 6 ; i ++) {
638689 if (iso [2 * i ] != null ) {
639690 if (pRot .y () < 0 ) {
@@ -656,10 +707,37 @@ protected TrackState fillParticleVariables(EventHeader event, ReconstructedParti
656707 }
657708 }
658709 }
659- break ;
710+ // break;
711+ }
712+ if (iso [2 * i + 2 ]!=null ){
713+ if (pRot .y () < 0 ) {
714+ isoStereoL2 = iso [2 * i +2 ];
715+ isoAxialL2 = iso [2 * i +3 ];
716+ } else {
717+ isoStereoL2 = iso [2 * i +3 ];
718+ isoAxialL2 = iso [2 * i +2 ];
719+ }
720+ for (int j = 2 * i + 2 ; j < 2 * i + 4 ; j ++) {
721+ if (iso [j ] < 100 ) {
722+ if (iso [j ] > 0 ) {
723+ if (minPositiveIsoL2 > 100 || iso [j ] < minPositiveIsoL2 ) {
724+ minPositiveIsoL2 = iso [j ];
725+ }
726+ } else {
727+ if (minNegativeIsoL2 > 100 || iso [j ] > minNegativeIsoL2 ) {
728+ minNegativeIsoL2 = iso [j ];
729+ }
730+ }
731+ }
732+ }
660733 }
734+ break ;
661735 }
662-
736+
737+ ////////////////////
738+
739+
740+ ///////////////////////////
663741 double trkT = TrackUtils .getTrackTime (track , TrackUtils .getHitToStripsTable (event ), TrackUtils .getHitToRotatedTable (event ));
664742 double trkTsd = TrackUtils .getTrackTimeSD (track , TrackUtils .getHitToStripsTable (event ), TrackUtils .getHitToRotatedTable (event ));
665743
@@ -808,7 +886,7 @@ protected TrackState fillParticleVariables(EventHeader event, ReconstructedParti
808886 tupleMap .put (prefix + "MaxHitsShared/I" , (double ) maxShared );
809887 tupleMap .put (prefix + "SharedTrkChisq/D" , trackShared .getChi2 ());
810888 tupleMap .put (prefix + "SharedTrkEcalX/D" , atEcalShared .x ());
811- tupleMap .put (prefix + "SharedTrkEcalY/D" , atEcalShared .y ());
889+ tupleMap .put (prefix + "SharedTrkEcalY/D" , atEcalShared .y ());
812890
813891 tupleMap .put (prefix + "LambdaKink1/D" , kinks != null ? GBLKinkData .getLambdaKink (kinks , 1 ) : 0 );
814892 tupleMap .put (prefix + "LambdaKink2/D" , kinks != null ? GBLKinkData .getLambdaKink (kinks , 2 ) : 0 );
@@ -818,15 +896,20 @@ protected TrackState fillParticleVariables(EventHeader event, ReconstructedParti
818896 tupleMap .put (prefix + "PhiKink3/D" , kinks != null ? GBLKinkData .getPhiKink (kinks , 3 ) : 0 );
819897 tupleMap .put (prefix + "IsoStereo/D" , isoStereo );
820898 tupleMap .put (prefix + "IsoAxial/D" , isoAxial );
899+ tupleMap .put (prefix + "IsoStereoL2/D" , isoStereoL2 );
900+ tupleMap .put (prefix + "IsoAxialL2/D" , isoAxialL2 );
821901 tupleMap .put (prefix + "MinPositiveIso/D" , minPositiveIso );
822902 tupleMap .put (prefix + "MinNegativeIso/D" , minNegativeIso );
903+ tupleMap .put (prefix + "MinPositiveIsoL2/D" , minPositiveIsoL2 );
904+ tupleMap .put (prefix + "MinNegativeIsoL2/D" , minNegativeIsoL2 );
823905 tupleMap .put (prefix + "TrkExtrpXL0/D" , extrapTrackPosL0 .x ());
824906 tupleMap .put (prefix + "TrkExtrpYL0/D" , extrapTrackPosL0 .y ());
825907 tupleMap .put (prefix + "TrkExtrpXL1/D" , extrapTrackPosL1 .x ());
826908 tupleMap .put (prefix + "TrkExtrpYL1/D" , extrapTrackPosL1 .y ());
827909 tupleMap .put (prefix + "TrkExtrpXL2/D" , extrapTrackPosL2 .x ());
828910 tupleMap .put (prefix + "TrkExtrpYL2/D" , extrapTrackPosL2 .y ());
829911 tupleMap .put (prefix + "MatchChisq/D" , particle .getGoodnessOfPID ());
912+
830913
831914 returnTrackState = tweakedTrackState ;
832915 }
0 commit comments