CMS 3D CMS Logo

BPHDecayToV0Builder.cc
Go to the documentation of this file.
1 /*
2  * See header file for a description of this class.
3  *
4  * \author Paolo Ronchese INFN Padova
5  *
6  */
7 
8 //-----------------------
9 // This Class' Header --
10 //-----------------------
12 
13 //-------------------------------
14 // Collaborating Class Headers --
15 //-------------------------------
19 
21 
22 //---------------
23 // C++ Headers --
24 //---------------
25 #include <cmath>
26 using namespace std;
27 
28 //-------------------
29 // Initializations --
30 //-------------------
31 
32 //----------------
33 // Constructors --
34 //----------------
36  const std::string& d1Name,
37  const std::string& d2Name,
38  const BPHRecoBuilder::BPHGenericCollection* d1Collection,
39  const BPHRecoBuilder::BPHGenericCollection* d2Collection)
41  p1Name(d1Name),
42  p2Name(d2Name),
43  p1Collection(d1Collection),
44  p2Collection(d2Collection),
45  vCollection(nullptr),
46  rCollection(nullptr),
47  sList(""),
48  ptMin(0.0),
49  etaMax(100.0) {}
50 
52  const std::string& d1Name,
53  const std::string& d2Name,
54  const std::vector<reco::VertexCompositeCandidate>* v0Collection,
55  const std::string& searchList)
57  p1Name(d1Name),
58  p2Name(d2Name),
59  p1Collection(nullptr),
60  p2Collection(nullptr),
61  vCollection(v0Collection),
62  rCollection(nullptr),
63  sList(searchList),
64  ptMin(0.0),
65  etaMax(100.0) {}
66 
68  const std::string& d1Name,
69  const std::string& d2Name,
70  const std::vector<reco::VertexCompositePtrCandidate>* vpCollection,
71  const std::string& searchList)
73  p1Name(d1Name),
74  p2Name(d2Name),
75  p1Collection(nullptr),
76  p2Collection(nullptr),
77  vCollection(nullptr),
78  rCollection(vpCollection),
79  sList(searchList),
80  ptMin(0.0),
81  etaMax(100.0) {}
82 
83 //--------------
84 // Destructor --
85 //--------------
87 
88 //--------------
89 // Operations --
90 //--------------
91 vector<BPHPlusMinusConstCandPtr> BPHDecayToV0Builder::build() {
92  if (updated)
93  return cList;
94  cList.clear();
95  v0Clear();
96 
97  if ((p1Collection != nullptr) && (p2Collection != nullptr))
99  else if (vCollection != nullptr)
101  else if (rCollection != nullptr)
103 
104  updated = true;
105  return cList;
106 }
107 
110  updated = false;
111  ptMin = pt;
112  return;
113 }
114 
116  updated = false;
117  etaMax = eta;
118  return;
119 }
120 
122 double BPHDecayToV0Builder::getPtMin() const { return ptMin; }
123 
124 double BPHDecayToV0Builder::getEtaMax() const { return etaMax; }
125 
126 template <class T>
127 void BPHDecayToV0Builder::buildFromV0(const T* v0Collection, v0Type type) {
128  int iv0;
129  int nv0 = v0Collection->size();
130  cList.reserve(nv0);
131 
132  // cycle over V0 collection
133  for (iv0 = 0; iv0 < nv0; ++iv0) {
134  const typename T::value_type& v0 = v0Collection->at(iv0);
135 
136  // every reco::VertexCompositeCandidate must have exactly two daughters
137  if (v0.numberOfDaughters() != 2)
138  continue;
139  const reco::Candidate* dr = v0.daughter(0);
140  const reco::Candidate* dl = v0.daughter(1);
141 
142  // filters
143  if (dr->p4().pt() < ptMin)
144  continue;
145  if (dl->p4().pt() < ptMin)
146  continue;
147  if (fabs(dr->p4().eta()) > etaMax)
148  continue;
149  if (fabs(dl->p4().eta()) > etaMax)
150  continue;
151 
153  BPHPlusMinusCandidate* cptr = cand.get();
154  if (cand->daughters().size() != 2)
155  continue;
156  if (!massSel->accept(*cand))
157  continue;
158  if ((chi2Sel != nullptr) && (!chi2Sel->accept(*cand)))
159  continue;
160 
161  cList.push_back(cand);
162  V0Info* info = new V0Info;
163  info->type = type;
164  info->v0 = &v0;
165  v0Map[cptr] = info;
166  }
167 
168  return;
169 }
170 
172  map<const BPHRecoCandidate*, const V0Info*>::iterator iter = v0Map.begin();
173  map<const BPHRecoCandidate*, const V0Info*>::iterator iend = v0Map.end();
174  while (iter != iend)
175  delete iter++->second;
176  return;
177 }
BPHDecayToV0Builder::VertexCompositePtrCandidate
Definition: BPHDecayToV0Builder.h:43
V0Monitor_cff.v0
v0
Definition: V0Monitor_cff.py:7
BPHDecayToV0Builder::V0Info
Definition: BPHDecayToV0Builder.h:44
BPHDecayToV0Builder::VertexCompositeCandidate
Definition: BPHDecayToV0Builder.h:43
BPHDecayToV0Builder::BPHDecayToV0Builder
BPHDecayToV0Builder(const edm::EventSetup &es, const std::string &d1Name, const std::string &d2Name, const BPHRecoBuilder::BPHGenericCollection *d1Collection, const BPHRecoBuilder::BPHGenericCollection *d2Collection)
Definition: BPHDecayToV0Builder.cc:35
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
BPHDecayToV0Builder::v0Type
v0Type
Definition: BPHDecayToV0Builder.h:43
BPHPlusMinusCandidatePtr
BPHGenericPtr< BPHPlusMinusCandidate >::type BPHPlusMinusCandidatePtr
Definition: BPHPlusMinusCandidatePtr.h:7
BPHDecayToV0Builder::v0Map
std::map< const BPHRecoCandidate *, const V0Info * > v0Map
Definition: BPHDecayToV0Builder.h:103
BPHDecayToV0Builder.h
ptMin
constexpr float ptMin
Definition: PhotonIDValueMapProducer.cc:155
BPHPlusMinusCandidate
Definition: BPHPlusMinusCandidate.h:32
BPHDecayToV0Builder::v0Clear
void v0Clear()
Definition: BPHDecayToV0Builder.cc:171
BPHDecayToV0Builder::getPtMin
double getPtMin() const
get current cuts
Definition: BPHDecayToV0Builder.cc:122
BPHDecayToV0Builder::~BPHDecayToV0Builder
~BPHDecayToV0Builder() override
Definition: BPHDecayToV0Builder.cc:86
info
static const TGPicture * info(bool iBackgroundIsBlack)
Definition: FWCollectionSummaryWidget.cc:153
BPHDecayGenericBuilder::massSel
BPHMassSelect * massSel
Definition: BPHDecayGenericBuilder.h:75
BPHDecayToV0Builder::rCollection
const std::vector< reco::VertexCompositePtrCandidate > * rCollection
Definition: BPHDecayToV0Builder.h:97
BPHDecayToV0Builder::ptMin
double ptMin
Definition: BPHDecayToV0Builder.h:100
BPHDecayToV0Builder::buildFromBPHGenericCollection
virtual void buildFromBPHGenericCollection()=0
build candidates and link to V0
BPHDecayGenericBuilder::updated
bool updated
Definition: BPHDecayGenericBuilder.h:80
BPHDecayToV0Builder::build
std::vector< BPHPlusMinusConstCandPtr > build()
build candidates
Definition: BPHDecayToV0Builder.cc:91
VertexCompositeCandidate.h
PVValHelper::eta
Definition: PVValidationHelpers.h:69
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
BPHDecayToV0Builder::buildCandidate
virtual BPHPlusMinusCandidatePtr buildCandidate(const reco::Candidate *c1, const reco::Candidate *c2, const void *v0, v0Type type)=0
BPHDecayToV0Builder::p1Collection
const BPHRecoBuilder::BPHGenericCollection * p1Collection
Definition: BPHDecayToV0Builder.h:94
BPHDecayGenericBuilder::chi2Sel
BPHChi2Select * chi2Sel
Definition: BPHDecayGenericBuilder.h:76
BPHDecayToV0Builder::buildFromV0
void buildFromV0(const T *v0Collection, v0Type type)
Definition: BPHDecayToV0Builder.cc:127
type
type
Definition: SiPixelVCal_PayloadInspector.cc:37
gainCalibHelper::gainCalibPI::type
type
Definition: SiPixelGainCalibHelper.h:39
cand
Definition: decayParser.h:32
newFWLiteAna.searchList
searchList
Definition: newFWLiteAna.py:119
BPHDecayToV0Builder::p2Collection
const BPHRecoBuilder::BPHGenericCollection * p2Collection
Definition: BPHDecayToV0Builder.h:95
BPHDecayToV0Builder::etaMax
double etaMax
Definition: BPHDecayToV0Builder.h:101
edm::EventSetup
Definition: EventSetup.h:57
reco::JetExtendedAssociation::value_type
Container::value_type value_type
Definition: JetExtendedAssociation.h:30
BPHRecoBuilder.h
BPHDecayToV0Builder::vCollection
const std::vector< reco::VertexCompositeCandidate > * vCollection
Definition: BPHDecayToV0Builder.h:96
reco::Candidate
Definition: Candidate.h:27
BPHRecoBuilder::BPHGenericCollection
Definition: BPHRecoBuilder.h:70
std
Definition: JetResolutionObject.h:76
BPHPlusMinusCandidate.h
T
long double T
Definition: Basic3DVectorLD.h:48
BPHDecayToV0Builder::cList
std::vector< BPHPlusMinusConstCandPtr > cList
Definition: BPHDecayToV0Builder.h:89
flavorHistoryFilter_cfi.dr
dr
Definition: flavorHistoryFilter_cfi.py:37
BPHDecayToV0Builder::setEtaMax
void setEtaMax(double eta)
Definition: BPHDecayToV0Builder.cc:115
BPHDecayGenericBuilder
Definition: BPHDecayGenericBuilder.h:36
ALCARECOTkAlBeamHalo_cff.etaMax
etaMax
Definition: ALCARECOTkAlBeamHalo_cff.py:33
reco::Candidate::p4
virtual const LorentzVector & p4() const =0
four-momentum Lorentz vector
BPHMassSelect::accept
bool accept(const BPHDecayMomentum &cand) const override
select particle
Definition: BPHMassSelect.h:48
Candidate.h
BPHChi2Select::accept
bool accept(const BPHDecayVertex &cand) const override
select vertex
Definition: BPHChi2Select.h:48
BPHDecayToV0Builder::setPtMin
void setPtMin(double pt)
set cuts
Definition: BPHDecayToV0Builder.cc:109
BPHDecayToV0Builder::getEtaMax
double getEtaMax() const
Definition: BPHDecayToV0Builder.cc:124