Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:27:31

0001 #include "FWPFTrackRPZProxyBuilder.h"
0002 
0003 //______________________________________________________________________________
0004 void FWPFTrackRPZProxyBuilder::build(const reco::Track &iData,
0005                                      unsigned int iIndex,
0006                                      TEveElement &oItemHolder,
0007                                      const FWViewContext *vc) {
0008   FWPFTrackUtils *utils = new FWPFTrackUtils();
0009   TEveTrack *trk = utils->setupTrack(iData);
0010   TEvePointSet *ps = utils->getCollisionMarkers(trk);
0011   TEvePointSet *rzps = new TEvePointSet();
0012   setupAddElement(trk, &oItemHolder);
0013 
0014   Float_t *trackPoints = trk->GetP();
0015   unsigned int last = (trk->GetN() - 1) * 3;
0016   float y = trackPoints[last + 1];
0017   float z = trackPoints[last + 2];
0018 
0019   // Reposition any points that have been translated in RhoZ
0020   for (signed int i = 0; i < ps->GetN(); ++i) {
0021     // WORKS BUT DOESN'T HANDLE ALL SCENARIOS.....
0022     Float_t a, b, c;
0023     ps->GetPoint(i, a, b, c);
0024 
0025     if (y < 0 && b > 0)
0026       b *= -1;
0027     else if (y > 0 && b < 0)
0028       b *= -1;
0029 
0030     if (z < 0 && c > 0)
0031       c *= -1;
0032     else if (z > 0 && c < 0)
0033       c *= -1;
0034 
0035     rzps->SetNextPoint(a, b, c);
0036   }
0037 
0038   if (rzps->GetN() != 0)
0039     setupAddElement(rzps, &oItemHolder);
0040   else
0041     delete rzps;
0042 
0043   delete ps;
0044   delete utils;
0045 }
0046 
0047 //______________________________________________________________________________
0048 REGISTER_FWPROXYBUILDER(FWPFTrackRPZProxyBuilder,
0049                         reco::Track,
0050                         "PF Tracks",
0051                         FWViewType::kRhoPhiPFBit | FWViewType::kRhoZBit);