22 return TMath::Prob(
c1.conversionVertex().chi2(),
c1.conversionVertex().ndof()) >
27 bool atLeastOneInCommon =
false;
28 for (
auto const& tk1 :
c1.tracks()) {
29 for (
auto const& tk2 : c2.
tracks()) {
31 atLeastOneInCommon =
true;
36 return atLeastOneInCommon;
39 bool lt_(std::pair<double, short>
a, std::pair<double, short>
b) {
return a.first <
b.first; }
71 convAlgo_ = StringToEnumValue<reco::Conversion::ConversionAlgorithm>(
algo);
73 std::vector<std::string> qual = ps.
getParameter<std::vector<std::string>>(
"convQuality");
75 convQuality_ = StringToEnumValue<reco::Conversion::ConversionQuality>(qual);
79 produces<pat::CompositeCandidateCollection>(
"conversions");
97 for (reco::ConversionCollection::const_iterator
conv = pConv->begin();
conv != pConv->end(); ++
conv) {
108 if (!
conv->quality(
q)) {
117 outCollection->push_back(*
conv);
122 for (reco::ConversionCollection::const_iterator
conv = outCollection->begin();
conv != outCollection->end(); ++
conv) {
131 bool flagTkVtxCompatibility =
true;
133 flagTkVtxCompatibility =
false;
138 bool flagCompatibleInnerHits =
false;
139 if (
conv->tracks().size() == 2) {
143 flagCompatibleInnerHits =
true;
148 bool flagHighpurity =
true;
150 flagHighpurity =
false;
155 bool pizero_rejected =
false;
156 bool large_pizero_window =
CheckPi0(*
conv, pfphotons, pizero_rejected);
162 if (flag1 && flag2 && flag3 && flag4) {
164 *
conv, flagTkVtxCompatibility, flagCompatibleInnerHits, flagHighpurity, pizero_rejected, large_pizero_window);
166 pat_conv->addUserInt(
"flags",
flags);
167 patoutCollection->push_back(*pat_conv);
170 event.put(
std::move(patoutCollection),
"conversions");
174 bool flagTkVtxCompatibility,
175 bool flagCompatibleInnerHits,
177 bool pizero_rejected,
178 bool large_pizero_window) {
180 if (flagTkVtxCompatibility)
182 if (flagCompatibleInnerHits)
188 if (large_pizero_window)
193 std::vector<std::string> s_quals;
194 s_quals.push_back(
"generalTracksOnly");
195 s_quals.push_back(
"arbitratedEcalSeeded");
196 s_quals.push_back(
"arbitratedMerged");
197 s_quals.push_back(
"arbitratedMergedEcalGeneral");
198 s_quals.push_back(
"highPurity");
199 s_quals.push_back(
"highEfficiency");
200 s_quals.push_back(
"ecalMatched1Track");
201 s_quals.push_back(
"ecalMatched2Track");
202 std::vector<int> i_quals = StringToEnumValue<reco::Conversion::ConversionQuality>(s_quals);
203 for (std::vector<int>::const_iterator qq = i_quals.begin(); qq != i_quals.end(); ++qq) {
208 flags += (q_mask * 32 * 8);
221 while (iter1 < (((
int)
c.size()) - 1)) {
222 int iter2 = iter1 + 1;
223 while (iter2 < (
int)
c.size())
225 c.erase(
c.begin() + iter2);
236 std::vector<std::pair<double, short>>
idx[2];
238 for (
auto const& tk :
conv.tracks()) {
241 for (
auto const&
vtx : priVtxs) {
244 double dz_ = tk->dz(
vtx.position());
245 double dzError_ = tk->dzError();
246 dzError_ =
sqrt(dzError_ * dzError_ +
vtx.covariance(2, 2));
249 idx[ik].push_back(std::pair<double, short>(fabs(dz_),
count));
271 uint32_t oldSubStr = 0;
273 uint32_t hitA = hitPatA.
getHitPattern(reco::HitPattern::HitCategory::TRACK_HITS,
i);
299 int closest_pv_index = 0;
301 for (
auto const&
vtx : priVtxs) {
302 if (
conv.zOfPrimaryVertexFromTracks(
vtx.position()) <
303 conv.zOfPrimaryVertexFromTracks(priVtxs[closest_pv_index].position()))
304 closest_pv_index =
i;
308 for (
auto const& tk :
conv.tracks())
309 if (-tk->dxy(priVtxs[closest_pv_index].position()) * tk->charge() / tk->dxyError() < 0)
313 for (
auto const& tk :
conv.tracks())
318 for (
auto const& tk :
conv.tracks())
347 pfphotons.push_back(*
cand);
354 bool& pizero_rejected) {
358 bool check_small =
false;
359 bool check_large =
false;
366 float inv = (
conv.refittedPair4Momentum() +
photon->p4()).M();
367 if (inv > large1 && inv < large2) {
369 if (inv > small1 && inv < small2) {
375 pizero_rejected = check_small;
Analysis-level particle class.
static uint32_t getLayer(uint16_t pattern)
bool foundCompatibleInnerHits(const reco::HitPattern &hitPatA, const reco::HitPattern &hitPatB)
T getParameter(std::string const &) const
std::vector< int > convQuality_
#define DEFINE_FWK_MODULE(type)
reco::Candidate::LorentzVector convertVector(const math::XYZTLorentzVectorF &)
int numberOfAllHits(HitCategory category) const
void endStream() override
std::string convSelectionCuts_
T const * product() const
std::vector< double > pi0LargeWindow_
double _minDistanceOfApproachMinCut
bool HighpuritySubset(const reco::Conversion &, const reco::VertexCollection &)
std::vector< Vertex > VertexCollection
collection of Vertex objects
bool ConversionLessByChi2(const reco::Conversion &c1, const reco::Conversion &c2)
std::vector< Conversion > ConversionCollection
collectin of Conversion objects
std::unique_ptr< StringCutObjectSelector< reco::Conversion > > convSelection_
void setVertex(const Point &vertex) override
set vertex
std::vector< double > pi0SmallWindow_
static bool validHitFilter(uint16_t pattern)
U second(std::pair< T, U > const &p)
bool operator==(const reco::Conversion &c1, const reco::Conversion &c2)
bool ConversionEqualByTrack(const reco::Conversion &c1, const reco::Conversion &c2)
bool checkTkVtxCompatibility(const reco::Conversion &, const reco::VertexCollection &)
void produce(edm::Event &event, const edm::EventSetup &esetup) override
uint16_t getTrackerMonoStereo(HitCategory category, uint16_t substr, uint16_t layer) const
int PackFlags(const reco::Conversion &, bool, bool, bool, bool, bool)
edm::EDGetTokenT< reco::VertexCollection > thePVsToken_
float ChiSquaredProbability(double chiSquared, double nrDOF)
uint16_t getHitPattern(HitCategory category, int position) const
static uint32_t getSubStructure(uint16_t pattern)
const reco::PFCandidateCollection selectPFPhotons(const reco::PFCandidateCollection &)
OniaPhotonConversionProducer(const edm::ParameterSet &ps)
bool lt_(std::pair< double, short > a, std::pair< double, short > b)
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
static bool trackerHitFilter(uint16_t pattern)
edm::EDGetTokenT< reco::ConversionCollection > convCollectionToken_
std::vector< CompositeCandidate > CompositeCandidateCollection
edm::EDGetTokenT< reco::PFCandidateCollection > pfCandidateCollectionToken_
bool wantCompatibleInnerHits_
math::XYZTLorentzVector LorentzVector
Lorentz vector.
double chi2() const
chi-squares
const reco::Vertex & conversionVertex() const
returns the reco conversion vertex
bool CheckPi0(const reco::Conversion &, const reco::PFCandidateCollection &, bool &)
pat::CompositeCandidate * makePhotonCandidate(const reco::Conversion &)
bool wantTkVtxCompatibility_
void removeDuplicates(reco::ConversionCollection &)
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< float > > XYZTLorentzVectorF
Lorentz vector with cylindrical internal representation using pseudorapidity.
std::vector< edm::RefToBase< reco::Track > > const & tracks() const
vector of track to base references
double _vertexChi2ProbCut
void setP4(const LorentzVector &p4) final
set 4-momentum
void addUserData(const std::string &label, const T &data, bool transientOnly=false, bool overwrite=false)
double _minDistanceOfApproachMaxCut