CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC2_patch1/src/RecoBTag/ImpactParameterLearning/plugins/TrackClassMatch.h

Go to the documentation of this file.
00001 #ifndef TrackClassMatch_H
00002 #define TrackClassMatch_H
00003 
00004 #include "DataFormats/TrackReco/interface/Track.h"
00005 #include "DataFormats/VertexReco/interface/Vertex.h"
00006 #include "DataFormats/JetReco/interface/Jet.h"
00007 #include "CondFormats/BTauObjects/interface/TrackProbabilityCategoryData.h"
00008 #include "CondFormats/BTauObjects/interface/TrackProbabilityCalibration.h"
00009 
00012 class TrackClassMatch 
00013 {
00014  public:
00015 
00016  TrackClassMatch() {}
00017 
00018  class Input
00019  {
00020  public:
00021   Input(const reco::Track & t,const reco::Jet &j, const reco::Vertex & v) :
00022                        track(t), jet(j), vertex(v) {}
00023 
00024   const reco::Track & track;
00025   const reco::Jet & jet;
00026   const reco::Vertex & vertex;
00027  };
00028 
00029  typedef Input first_argument_type;
00030  typedef TrackProbabilityCalibration::Entry second_argument_type;
00031  typedef bool result_type;
00032 
00033  bool operator()(const first_argument_type & input , const second_argument_type & category ) const
00034 {
00035  const reco::Track & track = input.track;
00036 // const reco::Jet & jet = input.jet;
00037 // const reco::Vertex & pv = input.vertex;
00038  const TrackProbabilityCategoryData & d = category.category;
00039   //Track Data
00040   double p=track.p();
00041   double eta=track.eta();
00042   double nhit=track.numberOfValidHits();
00043   double npix=track.hitPattern().numberOfValidPixelHits();
00044   bool   firstPixel=track.hitPattern().hasValidHitInFirstPixelBarrel();
00045   double chi=track.normalizedChi2();
00046   //Chi^2 cut  if used
00047   bool chicut=(chi >= d.chiMin        &&       chi < d.chiMax );
00048   if(d.chiMin<=0.01 && d.chiMax<=0.01) chicut=true;
00049 
00050   //First Pixel Hit cut 1=there should be an hit in first layer, -1=there should not be an hit, 0 = I do not care
00051   bool  fisrtPixelCut = ( (firstPixel && d.withFirstPixel == 1) || (!firstPixel && d.withFirstPixel == -1) || d.withFirstPixel == 0 );
00052 
00053   //the AND of everything
00054   bool result=(       p >  d.pMin       &&         p <  d.pMax       &&
00055            fabs(eta) >  d.etaMin     &&  fabs(eta) <  d.etaMax     &&
00056                nhit >= d.nHitsMin      &&      nhit <= d.nHitsMax      &&
00057                npix >= d.nPixelHitsMin &&      npix <= d.nPixelHitsMax &&
00058                 chicut && fisrtPixelCut );
00059   return result;
00060  }
00061 
00062 
00063 
00064 };
00065 
00066 
00067 #endif
00068 
00069 
00070 
00071 
00072 
00073 
00074 
00075