15 #include "TMVA/MethodBDT.h" 23 double mvaBremConvCutBarrelLowPt,
24 double mvaBremConvCutBarrelHighPt,
25 double mvaBremConvCutEndcapsLowPt,
26 double mvaBremConvCutEndcapsHighPt)
28 mvaBremConvCutBarrelLowPt_(mvaBremConvCutBarrelLowPt),
29 mvaBremConvCutBarrelHighPt_(mvaBremConvCutBarrelHighPt),
30 mvaBremConvCutEndcapsLowPt_(mvaBremConvCutEndcapsLowPt),
31 mvaBremConvCutEndcapsHighPt_(mvaBremConvCutEndcapsHighPt) {}
47 LogDebug(
"ConvBremPFTrackFinder") <<
"runConvBremFinder:: Entering ";
50 float refGsfEta = refGsf->eta();
51 float refGsfPt = refGsf->pt();
52 float refGsfPhi = refGsf->phi();
53 float gsfR =
sqrt(refGsf->innerPosition().x() * refGsf->innerPosition().x() +
54 refGsf->innerPosition().y() * refGsf->innerPosition().y());
56 GlobalVector direction(refGsf->innerMomentum().x(), refGsf->innerMomentum().y(), refGsf->innerMomentum().z());
57 float refGsfPtMode = refGsf->ptMode();
60 vector<PFBrem> primPFBrem = gsfpfrectk.
PFRecBrem();
63 reco::PFRecTrackCollection::const_iterator pft = PfRTkColl.begin();
64 reco::PFRecTrackCollection::const_iterator pftend = PfRTkColl.end();
66 vector<PFRecTrackRef> AllPFRecTracks;
67 AllPFRecTracks.clear();
68 unsigned int ipft = 0;
70 for (; pft != pftend; ++pft, ipft++) {
73 if (pfTrackRef->trackRef() == pft->trackRef())
77 TrackRef trackRef = pfRecTrRef->trackRef();
80 LogDebug(
"ConvBremPFTrackFinder") <<
"runConvBremFinder:: pushing_back High Purity " << pft->trackRef()->pt()
81 <<
" eta,phi " << pft->trackRef()->eta() <<
", " << pft->trackRef()->phi()
82 <<
" Memory Address Ref " << &*trackRef <<
" Memory Address BaseRef " 84 AllPFRecTracks.push_back(pfRecTrRef);
89 for (
unsigned i = 0;
i < PfConvColl.size();
i++) {
92 unsigned int trackSize = (convRef->pfTracks()).
size();
93 if (convRef->pfTracks().size() < 2)
95 for (
unsigned iTk = 0; iTk < trackSize; iTk++) {
101 if (primaryTrackBaseRef == newTrackBaseRef)
105 for (
unsigned iPF = 0; iPF < AllPFRecTracks.size(); iPF++) {
109 <<
"## Track 1 HP pt " << AllPFRecTracks[iPF]->trackRef()->pt() <<
" eta, phi " 110 << AllPFRecTracks[iPF]->trackRef()->eta() <<
", " << AllPFRecTracks[iPF]->trackRef()->phi()
111 <<
" Memory Address Ref " << &(*AllPFRecTracks[iPF]->trackRef()) <<
" Memory Address BaseRef " 112 << &*selTrackBaseRef;
114 <<
"** Track 2 CONV pt " << compPFTkRef->trackRef()->pt() <<
" eta, phi " 115 << compPFTkRef->trackRef()->eta() <<
", " << compPFTkRef->trackRef()->phi() <<
" Memory Address Ref " 116 << &*compPFTkRef->trackRef() <<
" Memory Address BaseRef " << &*newTrackBaseRef;
118 if (AllPFRecTracks[iPF]->trackRef() == compPFTkRef->trackRef()) {
119 LogDebug(
"ConvBremPFTrackFinder") <<
" SAME BREM REF " << endl;
125 <<
"runConvBremFinder:: pushing_back Conversions " << compPFTkRef->trackRef()->pt() <<
" eta,phi " 126 << compPFTkRef->trackRef()->eta() <<
" phi " << compPFTkRef->trackRef()->phi();
127 AllPFRecTracks.push_back(compPFTkRef);
135 for (
unsigned i = 0;
i < PfNuclColl.size();
i++) {
137 unsigned int trackSize = dispacedVertexRef->pfRecTracks().size();
138 for (
unsigned iTk = 0; iTk < trackSize; iTk++) {
144 if (primaryTrackBaseRef == newTrackBaseRef)
148 for (
unsigned iPF = 0; iPF < AllPFRecTracks.size(); iPF++) {
150 if (selTrackBaseRef == newTrackBaseRef)
155 <<
"runConvBremFinder:: pushing_back displaced Vertex pt " << newPFRecTrackRef->trackRef()->pt()
156 <<
" eta,phi " << newPFRecTrackRef->trackRef()->eta() <<
", " << newPFRecTrackRef->trackRef()->phi();
157 AllPFRecTracks.push_back(newPFRecTrackRef);
165 for (
unsigned i = 0;
i < PfV0Coll.size();
i++) {
167 unsigned int trackSize = (v0Ref->pfTracks()).
size();
168 for (
unsigned iTk = 0; iTk < trackSize; iTk++) {
174 if (primaryTrackBaseRef == newTrackBaseRef)
178 for (
unsigned iPF = 0; iPF < AllPFRecTracks.size(); iPF++) {
180 if (selTrackBaseRef == newTrackBaseRef)
185 <<
"runConvBremFinder:: pushing_back V0 " << newPFRecTrackRef->trackRef()->pt() <<
" eta,phi " 186 << newPFRecTrackRef->trackRef()->eta() <<
", " << newPFRecTrackRef->trackRef()->phi();
187 AllPFRecTracks.push_back(newPFRecTrackRef);
195 for (
unsigned iPF = 0; iPF < AllPFRecTracks.size(); iPF++) {
197 double deta =
std::abs(AllPFRecTracks[iPF]->trackRef()->
eta() - refGsfEta);
211 double secEta = trkRef->innerMomentum().eta();
212 double secPhi = trkRef->innerMomentum().phi();
214 double posEta = trkRef->innerPosition().eta();
215 double posPhi = trkRef->innerPosition().phi();
217 for (
unsigned ipbrem = 0; ipbrem < primPFBrem.size(); ipbrem++) {
218 if (primPFBrem[ipbrem].indTrajPoint() == 99)
224 double bremEta = atPrimECAL.
momentum().Eta();
225 double bremPhi = atPrimECAL.
momentum().Phi();
227 double deta =
std::abs(bremEta - secEta);
229 double DR2 = deta * deta + dphi * dphi;
231 double detaPos =
std::abs(bremEta - posEta);
233 double DRPos2 = detaPos * detaPos + dphiPos * dphiPos;
236 if (DR2 < minDRBremKF2) {
238 minDEtaBremKF = deta;
242 if (DRPos2 < minDRBremKFPos2) {
243 minDRBremKFPos2 = DRPos2;
244 minDEtaBremKFPos = detaPos;
245 minDPhiBremKFPos =
std::abs(dphiPos);
250 secR =
sqrt(trkRef->innerPosition().x() * trkRef->innerPosition().x() +
251 trkRef->innerPosition().y() * trkRef->innerPosition().y());
255 if ((minDPhiBremKF < 0.1 || minDPhiBremKFPos < 0.1) && (minDEtaBremKF < 0.02 || minDEtaBremKFPos < 0.02) &&
257 LogDebug(
"ConvBremPFTrackFinder") <<
"runConvBremFinder:: OK Find track and BREM close " 258 <<
" MinDphi " << minDPhiBremKF <<
" MinDeta " << minDEtaBremKF;
264 for (PFClusterCollection::const_iterator clus = theEClus.begin(); clus != theEClus.end(); clus++) {
274 if (dist > 0. && dist < MinDist) {
276 EE_calib =
cache->pfcalib_->energyEm(*clus, 0.0, 0.0,
false);
279 if (MinDist > 0. && MinDist < 100000.) {
282 secPout =
sqrt(trkRef->outerMomentum().x() * trkRef->outerMomentum().x() +
283 trkRef->outerMomentum().y() * trkRef->outerMomentum().y() +
284 trkRef->outerMomentum().z() * trkRef->outerMomentum().z());
286 secPin =
sqrt(trkRef->innerMomentum().x() * trkRef->innerMomentum().x() +
287 trkRef->innerMomentum().y() * trkRef->innerMomentum().y() +
288 trkRef->innerMomentum().z() * trkRef->innerMomentum().z());
302 e(0, 0) = 0.0015 * 0.0015;
303 e(1, 1) = 0.0015 * 0.0015;
318 unsigned int tmpSh = 0;
320 int kfhitcounter = 0;
321 for (
auto const& nhit : refGsf->recHits())
322 if (nhit->isValid()) {
324 for (
auto const& ihit : trkRef->recHits())
325 if (ihit->isValid()) {
338 double mvaValue = -10;
339 double cutvalue = -10;
342 if (refGsfPt < 20 &&
std::abs(refGsfEta) < 1.479) {
343 mvaValue =
cache->gbrBarrelLowPt_->GetClassifier(
vars);
346 if (refGsfPt > 20 &&
std::abs(refGsfEta) < 1.479) {
347 mvaValue =
cache->gbrBarrelHighPt_->GetClassifier(
vars);
350 if (refGsfPt < 20 &&
std::abs(refGsfEta) > 1.479) {
351 mvaValue =
cache->gbrEndcapsLowPt_->GetClassifier(
vars);
354 if (refGsfPt > 20 &&
std::abs(refGsfEta) > 1.479) {
355 mvaValue =
cache->gbrEndcapsHighPt_->GetClassifier(
vars);
359 LogDebug(
"ConvBremPFTrackFinder") <<
"Gsf track Pt, Eta " << refGsfPt <<
" " << refGsfEta;
360 LogDebug(
"ConvBremPFTrackFinder") <<
"Cutvalue " << cutvalue;
366 <<
" The input variables for conv brem tracks identification " 367 <<
" secR " <<
secR <<
" gsfR " << gsfR <<
" N shared hits " <<
nHITS1 <<
" sTIP " <<
sTIP 369 <<
" ***** MVA ***** " << mvaValue;
371 if (mvaValue > cutvalue) {
reconstructed track used as an input to particle flow
Particle flow cluster, see clustering algorithm in PFClusterAlgo.
const math::XYZTLorentzVector & momentum() const
4-momenta quadrivector
T const * product() const
math::Error< dimension >::type Error
covariance error matrix (3x3)
bool isNonnull() const
Checks for non-null.
std::vector< PFConversion > PFConversionCollection
collection of PFConversion objects
void runConvBremFinder(const edm::Handle< reco::PFRecTrackCollection > &thePfRecTrackCol, const edm::Handle< reco::VertexCollection > &primaryVertex, const edm::Handle< reco::PFDisplacedTrackerVertexCollection > &pfNuclears, const edm::Handle< reco::PFConversionCollection > &pfConversions, const edm::Handle< reco::PFV0Collection > &pfV0, const convbremhelpers::HeavyObjectCache *cache, bool useNuclear, bool useConversions, bool useV0, const reco::PFClusterCollection &theEClus, const reco::GsfPFRecTrack &gsfpfrectk)
reco::TransientTrack build(const reco::Track *p) const
bool isValid() const
is this point valid ?
double mvaBremConvCutEndcapsLowPt_
void calculatePositionREP()
computes posrep_ once and for all
const edm::Ref< std::vector< PFRecTrack > > & kfPFRecTrackRef() const
TransientTrackBuilder builder_
const std::vector< reco::PFBrem > & PFRecBrem() const
double mvaBremConvCutBarrelHighPt_
Abs< T >::type abs(const T &t)
std::vector< reco::PFRecTrackRef > pfRecTrRef_vec_
double mvaBremConvCutEndcapsHighPt_
math::XYZPoint Point
point in the space
std::vector< PFV0 > PFV0Collection
collection of PFV0 objects
const reco::PFTrajectoryPoint & extrapolatedPoint(unsigned layerid) const
static const GlobalPoint notFound(0, 0, 0)
ConvBremPFTrackFinder(const TransientTrackBuilder &builder, double mvaBremConvCutBarrelLowPt, double mvaBremConvCutBarrelHighPt, double mvaBremConvCutEndcapsLowPt, double mvaBremConvCutEndcapsHighPt)
const reco::GsfTrackRef & gsfTrackRef() const
std::vector< PFCluster > PFClusterCollection
collection of PFCluster objects
A PFTrack holds several trajectory points, which basically contain the position and momentum of a tra...
primaryVertex
hltOfflineBeamSpot for HLTMON
static double testTrackAndClusterByRecHit(const reco::PFRecTrack &track, const reco::PFCluster &cluster, bool isBrem=false, bool debug=false)
std::vector< PFRecTrack > PFRecTrackCollection
collection of PFRecTrack objects
std::vector< PFDisplacedTrackerVertex > PFDisplacedTrackerVertexCollection
collection of DisplacedTrackerVertexs
double mvaBremConvCutBarrelLowPt_