test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CombinedSVSoftLeptonComputer.h
Go to the documentation of this file.
1 #ifndef RecoBTag_SecondaryVertex_CombinedSVSoftLeptonComputer_h
2 #define RecoBTag_SecondaryVertex_CombinedSVSoftLeptonComputer_h
3 
5 
7 
8 //(z)
12 
13 
15  public:
16  explicit CombinedSVSoftLeptonComputer(const edm::ParameterSet &params);
17 
18  template <class IPTI,class SVTI>
20  operator () (const IPTI &ipInfo, const SVTI &svInfo,
21  const reco::CandSoftLeptonTagInfo &muonInfo,
22  const reco::CandSoftLeptonTagInfo &elecInfo ) const;
23 };
24 
25 template <class IPTI,class SVTI>
27  const reco::CandSoftLeptonTagInfo &muonInfo,
28  const reco::CandSoftLeptonTagInfo &elecInfo) const
29 {
30  using namespace reco;
31 
32  // call the inherited operator()
34 
35  //Jets with vtxCategory 99 cause problems
36  unsigned int vtxType = ( vars.checkTag(reco::btau::vertexCategory) ? (unsigned int)(vars.get(reco::btau::vertexCategory)) : 99 );
37  if (vtxType == 99)
38  return vars;
39 
40 
41  // the following is specific to soft leptons
42  int leptonCategory = 0; // 0 = no lepton, 1 = muon, 2 = electron
43 
44  for (unsigned int i = 0; i < muonInfo.leptons(); ++i) // loop over all muons, not optimal -> find the best or use ranking from best to worst
45  {
46  leptonCategory = 1; // muon category
47  const SoftLeptonProperties & propertiesMuon = muonInfo.properties(i);
48  vars.insert(btau::leptonPtRel,propertiesMuon.ptRel , true);
49  vars.insert(btau::leptonSip3d,propertiesMuon.sip3d , true);
50  vars.insert(btau::leptonDeltaR,propertiesMuon.deltaR , true);
51  vars.insert(btau::leptonRatioRel,propertiesMuon.ratioRel , true);
52  vars.insert(btau::leptonEtaRel,propertiesMuon.etaRel , true);
53  vars.insert(btau::leptonRatio,propertiesMuon.ratio , true);
54  }
55 
56  if(leptonCategory != 1) // no soft muon found, try soft electron
57  {
58  for (unsigned int i = 0; i < elecInfo.leptons(); ++i) // loop over all electrons, not optimal -> find the best or use ranking from best to worst
59  {
60  leptonCategory = 2; // electron category
61  const SoftLeptonProperties & propertiesElec = elecInfo.properties(i);
62  vars.insert(btau::leptonPtRel,propertiesElec.ptRel , true);
63  vars.insert(btau::leptonSip3d,propertiesElec.sip3d , true);
64  vars.insert(btau::leptonDeltaR,propertiesElec.deltaR , true);
65  vars.insert(btau::leptonRatioRel,propertiesElec.ratioRel , true);
66  vars.insert(btau::leptonEtaRel,propertiesElec.etaRel , true);
67  vars.insert(btau::leptonRatio,propertiesElec.ratio , true);
68  }
69  }
70 
71 
72  // set the default value for vertexLeptonCategory to 2 (= NoVertexNoSoftLepton)
73  int vertexLepCat = 2;
74 
75 
76  if(leptonCategory == 0) // no soft lepton
77  {
78  if (vtxType == (unsigned int)(btag::Vertices::RecoVertex))
79  vertexLepCat = 0;
80  else if (vtxType == (unsigned int)(btag::Vertices::PseudoVertex))
81  vertexLepCat = 1;
82  else
83  vertexLepCat = 2;
84  }
85  else if(leptonCategory == 1) // soft muon
86  {
87  if (vtxType == (unsigned int)(btag::Vertices::RecoVertex))
88  vertexLepCat = 3;
89  else if(vtxType == (unsigned int)(btag::Vertices::PseudoVertex))
90  vertexLepCat = 4;
91  else
92  vertexLepCat = 5;
93  }
94  else if(leptonCategory == 2) // soft electron
95  {
96  if (vtxType == (unsigned int)(btag::Vertices::RecoVertex))
97  vertexLepCat = 6;
98  else if (vtxType == (unsigned int)(btag::Vertices::PseudoVertex))
99  vertexLepCat = 7;
100  else
101  vertexLepCat = 8;
102  }
103  vars.insert(btau::vertexLeptonCategory, vertexLepCat , true);
104 
105  vars.finalize();
106  return vars;
107 }
108 
109 #endif // RecoBTag_SecondaryVertex_CombinedSVSoftLeptonComputer_h
int i
Definition: DBlmapReader.cc:9
virtual reco::TaggingVariableList operator()(const reco::TrackIPTagInfo &ipInfo, const reco::SecondaryVertexTagInfo &svInfo) const
const SoftLeptonProperties & properties(size_t i) const
CombinedSVSoftLeptonComputer(const edm::ParameterSet &params)
reco::TaggingVariableList operator()(const IPTI &ipInfo, const SVTI &svInfo, const reco::CandSoftLeptonTagInfo &muonInfo, const reco::CandSoftLeptonTagInfo &elecInfo) const