19 #include <boost/foreach.hpp>
30 bool atLeastOneInCommon=
false;
34 atLeastOneInCommon=
true;
39 return atLeastOneInCommon;
42 bool lt_(std::pair<double,short>
a, std::pair<double,short>
b) {
43 return a.first < b.first; }
77 convAlgo_ = StringToEnumValue<reco::Conversion::ConversionAlgorithm>(
algo);
79 std::vector<std::string> qual = ps.
getParameter<std::vector<std::string> >(
"convQuality");
80 if( qual[0] !=
"" )
convQuality_ =StringToEnumValue<reco::Conversion::ConversionQuality>(qual);
84 produces<pat::CompositeCandidateCollection>(
"conversions");
104 std::vector<int> flagCollection;
119 for(reco::ConversionCollection::const_iterator
conv = pConv->begin();
conv != pConv->end(); ++
conv){
122 if (! ( *convSelection_)(*conv)){
134 if (!
conv->quality(q)) {
153 bool flagTkVtxCompatibility =
true;
155 flagTkVtxCompatibility =
false;
161 bool flagCompatibleInnerHits =
false;
162 if (
conv->tracks().size()==2) {
171 bool flagHighpurity =
true;
173 flagHighpurity =
false;
179 bool pizero_rejected =
false;
180 bool large_pizero_window =
CheckPi0(*
conv, pfphotons, pizero_rejected);
186 if (flag1 && flag2 && flag3 && flag4){
187 int flags =
PackFlags(*
conv,flagTkVtxCompatibility,flagCompatibleInnerHits,flagHighpurity,pizero_rejected,large_pizero_window);
188 flagCollection.push_back(flags);
189 outCollection->push_back(*
conv);
196 for (reco::ConversionCollection::const_iterator
conv = outCollection->begin();
conv != outCollection->end(); ++
conv){
199 pat_conv->
addUserInt(
"flags",flagCollection.at(i));
200 patoutCollection->push_back(*pat_conv);
203 event.put(patoutCollection,
"conversions");
205 delete convSelection_;
209 bool flagCompatibleInnerHits,
bool flagHighpurity,
210 bool pizero_rejected,
bool large_pizero_window ) {
212 if ( flagTkVtxCompatibility ) flags += 1;
213 if ( flagCompatibleInnerHits ) flags += 2;
214 if ( flagHighpurity ) flags += 4;
215 if ( pizero_rejected ) flags += 8;
216 if ( large_pizero_window ) flags += 16;
218 flags += (conv.
algo()*32);
220 std::vector<std::string> s_quals;
221 s_quals.push_back(
"generalTracksOnly");
222 s_quals.push_back(
"arbitratedEcalSeeded");
223 s_quals.push_back(
"arbitratedMerged");
224 s_quals.push_back(
"arbitratedMergedEcalGeneral");
225 s_quals.push_back(
"highPurity");
226 s_quals.push_back(
"highEfficiency");
227 s_quals.push_back(
"ecalMatched1Track");
228 s_quals.push_back(
"ecalMatched2Track");
229 std::vector<int> i_quals = StringToEnumValue<reco::Conversion::ConversionQuality>(s_quals);
230 for (std::vector<int>::const_iterator qq = i_quals.begin(); qq!=i_quals.end(); ++qq) {
232 if (conv.
quality(q)) q_mask = *qq;
234 flags += (q_mask*32*8);
247 while(iter1 < (( (
int) c.size() ) - 1) ){
250 c.erase( c.begin() + iter2 );
251 f.erase( f.begin() + iter2 );
262 std::vector< std::pair< double, short> >
idx[2];
276 idx[ik].push_back(std::pair<double,short>(fabs(dz_),count));
278 if(idx[ik].
size()==0) {
return false;}
280 std::stable_sort(idx[ik].
begin(),idx[ik].
end(),
lt_);
288 uint32_t oldSubStr=0;
289 for (
int i=0;
i<hitPatA.
numberOfHits(reco::HitPattern::HitCategory::TRACK_HITS) && count<2;
i++) {
290 uint32_t hitA = hitPatA.
getHitPattern(reco::HitPattern::HitCategory::TRACK_HITS,
i);
313 int closest_pv_index = 0;
350 for (reco::PFCandidateCollection::const_iterator cand = pfcandidates.begin(); cand != pfcandidates.end(); ++cand){
357 bool &pizero_rejected ) {
361 bool check_small =
false;
362 bool check_large =
false;
368 for (reco::PFCandidateCollection::const_iterator photon = photons.begin(); photon!=photons.end(); ++photon) {
370 if (inv > large1 && inv < large2) {
372 if (inv > small1 && inv < small2) {
378 pizero_rejected = check_small;
388 std::cout <<
"############################" << std::endl;
389 std::cout <<
"Conversion Candidate producer report" << std::endl;
390 std::cout <<
"############################" << std::endl;
400 std::cout <<
"############################" << std::endl;
403 std::cout <<
"############################" << std::endl;
const reco::Vertex & conversionVertex() const
returns the reco conversion vertex
Analysis-level particle class.
T getParameter(std::string const &) const
static uint32_t getLayer(uint16_t pattern)
bool foundCompatibleInnerHits(const reco::HitPattern &hitPatA, const reco::HitPattern &hitPatB)
ConversionAlgorithm algo() const
void removeDuplicates(reco::ConversionCollection &, std::vector< int > &)
double normalizedChi2() const
chi-squared divided by n.d.o.f. (or chi-squared * 1e6 if n.d.o.f. is zero)
static HepMC::IO_HEPEVT conv
std::vector< int > convQuality_
double dxyError() const
error on dxy
bool quality(ConversionQuality q) const
#define DEFINE_FWK_MODULE(type)
reco::Candidate::LorentzVector convertVector(const math::XYZTLorentzVectorF &)
std::string convSelectionCuts_
std::vector< double > pi0LargeWindow_
uint16_t getTrackerMonoStereo(HitCategory category, uint16_t substr, uint16_t layer) const
double zOfPrimaryVertexFromTracks(const math::XYZPoint &myBeamSpot=math::XYZPoint()) const
double distOfMinimumApproach() const
double _minDistanceOfApproachMinCut
bool HighpuritySubset(const reco::Conversion &, const reco::VertexCollection &)
std::vector< Variable::Flags > flags
std::vector< Vertex > VertexCollection
collection of Vertex objects
bool ConversionLessByChi2(const reco::Conversion &c1, const reco::Conversion &c2)
double covariance(int i, int j) const
(i, j)-th element of error matrix, i, j = 0, ... 2
const Point & position() const
position
std::vector< Conversion > ConversionCollection
collectin of Conversion objects
std::vector< double > pi0SmallWindow_
static bool validHitFilter(uint16_t pattern)
U second(std::pair< T, U > const &p)
virtual void produce(edm::Event &event, const edm::EventSetup &esetup)
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 &)
double ndof() const
number of degrees of freedom of the fit
int PackFlags(const reco::Conversion &, bool, bool, bool, bool, bool)
double chi2() const
chi-squares
edm::EDGetTokenT< reco::VertexCollection > thePVsToken_
float ChiSquaredProbability(double chiSquared, double nrDOF)
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
virtual void setVertex(const Point &vertex)
set vertex
void addUserInt(const std::string &label, int32_t data, const bool overwrite=false)
Set user-defined int.
static uint32_t getSubStructure(uint16_t pattern)
const reco::PFCandidateCollection selectPFPhotons(const reco::PFCandidateCollection &)
OniaPhotonConversionProducer(const edm::ParameterSet &ps)
double dz() const
dz parameter (= dsz/cos(lambda)). This is the track z0 w.r.t (0,0,0) only if the refPoint is close to...
double dzError() const
error on dz
math::XYZTLorentzVectorF refittedPair4Momentum() const
Conversion track pair 4-momentum from the tracks refitted with vertex constraint. ...
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
T const * product() const
edm::EDGetTokenT< reco::PFCandidateCollection > pfCandidateCollectionToken_
tuple idx
DEBUGGING if hasattr(process,"trackMonIterativeTracking2012"): print "trackMonIterativeTracking2012 D...
bool wantCompatibleInnerHits_
virtual void setP4(const LorentzVector &p4) final
set 4-momentum
math::XYZTLorentzVector LorentzVector
Lorentz vector.
bool CheckPi0(const reco::Conversion &, const reco::PFCandidateCollection &, bool &)
pat::CompositeCandidate * makePhotonCandidate(const reco::Conversion &)
bool wantTkVtxCompatibility_
int charge() const
track electric charge
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< float > > XYZTLorentzVectorF
Lorentz vector with cylindrical internal representation using pseudorapidity.
uint16_t getHitPattern(HitCategory category, int position) const
double dxy() const
dxy parameter. (This is the transverse impact parameter w.r.t. to (0,0,0) ONLY if refPoint is close t...
double _vertexChi2ProbCut
tuple size
Write out results.
void addUserData(const std::string &label, const T &data, bool transientOnly=false, bool overwrite=false)
double _minDistanceOfApproachMaxCut
std::vector< edm::RefToBase< reco::Track > > const & tracks() const
vector of track to base references
int numberOfHits(HitCategory category) const