797 const float BARL = 1.4442;
799 const float END_HI = 2.5;
805 LogInfo(
"TkConvValidator") <<
"TkConvValidator Analyzing event number: " << e.
id() <<
" Global Counter " <<
nEvt_ <<
"\n";
822 if (!convHandle.isValid()) {
823 edm::LogError(
"ConversionsProducer") <<
"Error! Can't get the collection "<< std::endl;
831 if (!photonHandle.isValid()) {
832 edm::LogError(
"PhotonProducer") <<
"Error! Can't get the Photon collection "<< std::endl;
840 e.
getByLabel(
"offlinePrimaryVertices", vertexHandle);
841 if (!vertexHandle.isValid()) {
842 edm::LogError(
"TrackerOnlyConversionProducer") <<
"Error! Can't get the product primary Vertex Collection "<<
"\n";
847 bool valid_pvtx =
false;
851 if (the_pvtx.isValid() && fabs(the_pvtx.position().z())<=15 && the_pvtx.position().Rho()<=2){
858 if (!bsHandle.isValid()) {
859 edm::LogError(
"TrackerOnlyConversionProducer") <<
"Error! Can't get the product primary Vertex Collection "<<
"\n";
873 std::vector<SimTrack> theSimTracks;
874 std::vector<SimVertex> theSimVertices;
887 e.
getByLabel(
"tpSelecForEfficiency",TPHandleForEff);
888 tpForEfficiency = *(TPHandleForEff.product());
889 e.
getByLabel(
"tpSelecForFakeRate",TPHandleForFakeRate);
890 tpForFakeRate = *(TPHandleForFakeRate.product());
895 theSimTracks.insert(theSimTracks.end(),SimTk->begin(),SimTk->end());
896 theSimVertices.insert(theSimVertices.end(),SimVtx->begin(),SimVtx->end());
906 e.
getByLabel(
"iterativeCone5GenJets",
"",GenJetsHandle);
912 std::map<const reco::Track*,TrackingParticleRef> myAss;
913 std::map<const reco::Track*,TrackingParticleRef>::const_iterator itAss;
915 for ( std::vector<PhotonMCTruth>::const_iterator mcPho=mcPhotons.begin(); mcPho !=mcPhotons.end(); mcPho++) {
918 float mcPhi= (*mcPho).fourMomentum().phi();
920 mcEta_= (*mcPho).fourMomentum().pseudoRapidity();
929 if ( fabs(
mcEta_) > END_HI )
continue;
937 bool goodSimConversion=
false;
938 bool visibleConversion=
false;
939 bool visibleConversionsWithTwoSimTracks=
false;
940 if ( (*mcPho).isAConversion() == 1 ) {
950 if ( ( fabs(
mcEta_) <= BARL && mcConvR_ <85 ) ||
951 ( fabs(
mcEta_) > BARL && fabs(
mcEta_) <=END_HI && fabs( (*mcPho).vertex().z() ) < 210 ) ) visibleConversion=
true;
956 for(
size_t i = 0;
i < tpForEfficiency.size(); ++
i){
958 if ( fabs( tp->vx() - (*mcPho).vertex().x() ) < 0.0001 &&
959 fabs( tp->vy() - (*mcPho).vertex().y() ) < 0.0001 &&
960 fabs( tp->vz() - (*mcPho).vertex().z() ) < 0.0001) {
966 if (
theConvTP_.
size() == 2 ) visibleConversionsWithTwoSimTracks=
true;
967 goodSimConversion=
false;
969 if ( visibleConversion && visibleConversionsWithTwoSimTracks ) goodSimConversion=
true;
970 if ( goodSimConversion ) {
988 if ( ! (visibleConversion && visibleConversionsWithTwoSimTracks ) )
continue;
1004 bool recomatch =
false;
1005 float chi2Prob = 0.;
1008 for (reco::ConversionCollection::const_iterator
conv = convHandle->begin();
conv!=convHandle->end();++
conv) {
1019 std::vector<edm::RefToBase<reco::Track> >
tracks = aConv.
tracks();
1024 if (tracks.size() !=2 || !(vtx.
isValid()))
continue;
1035 double lxy = (themom.x()*dbsx + themom.y()*dbsy)/themom.rho();
1055 bool isAssociated =
false;
1059 std::vector<std::pair<RefToBase<reco::Track>,
double> > trackV1, trackV2;
1061 int tp_1 = 0, tp_2 = 1;
1063 trackV1 = (std::vector<std::pair<RefToBase<reco::Track>,
double> >) q1[
theConvTP_[0]];
1065 trackV1 = (std::vector<std::pair<RefToBase<reco::Track>,
double> >) q1[
theConvTP_[1]];
1069 trackV2 = (std::vector<std::pair<RefToBase<reco::Track>,
double> >) q2[
theConvTP_[1]];
1071 trackV2 = (std::vector<std::pair<RefToBase<reco::Track>,
double> >) q2[
theConvTP_[0]];
1074 if (!(trackV1.size()&&trackV2.size()))
1076 if (tp_1 == tp_2)
continue;
1082 myAss.insert( std::make_pair (tr1.
get(),
theConvTP_[tp_1] ) );
1083 myAss.insert( std::make_pair (tr2.
get(),
theConvTP_[tp_2]) );
1091 isAssociated =
true;
1114 if ( chi2Prob > 0) {
1121 if ( chi2Prob > 0.0005) {
1136 for (reco::ConversionCollection::const_iterator
conv = convHandle->begin();
conv!=convHandle->end();++
conv) {
1146 std::vector<edm::RefToBase<reco::Track> > tracks = aConv.
tracks();
1150 if (tracks.size() !=2 || !(vtx.
isValid()))
continue;
1161 double lxy = (themom.x()*dbsx + themom.y()*dbsy)/themom.rho();
1165 bool phoIsInBarrel=
false;
1166 bool phoIsInEndcap=
false;
1185 if (
sqrt(p1AtVtx.perp2()) >
sqrt(p2AtVtx.perp2()) )
1186 dPhiTracksAtVtx = p1AtVtx.phi() - p2AtVtx.phi();
1188 dPhiTracksAtVtx = p2AtVtx.phi() - p1AtVtx.phi();
1194 if (fabs(refittedMom.eta())< 1.479 ) {
1203 double Mindeltaeta = 999999;
1204 double Mindeltaphi = 999999;
1205 bool matchConvSC=
false;
1206 reco::PhotonCollection::const_iterator iMatchingSC;
1207 for( reco::PhotonCollection::const_iterator iPho = photonCollection.begin(); iPho != photonCollection.end(); iPho++) {
1211 double deltaeta =
abs( aPho.
superCluster()->position().eta() -ConvEta);
1212 if (
abs(deltaeta)<
abs(Mindeltaeta) &&
abs(deltaphi)<
abs(Mindeltaphi)) {
1213 Mindeltaphi=
abs(deltaphi);
1214 Mindeltaeta=
abs(deltaeta);
1215 iMatchingSC = iPho ;
1218 if (
abs(Mindeltaeta)<0.1 &&
abs(Mindeltaphi)<0.1) {
1232 int ilead = 0, itrail = 1;
1233 if (tk2->
pt() > tk1->
pt()) {
1269 if ( matchConvSC ) {
1290 if ( phoIsInBarrel ) {
1315 if ( matchConvSC ) {
1324 if ( phoIsInEndcap ) {
1340 if ( matchConvSC ) {
1356 for (
unsigned int i=0;
i<tracks.size();
i++) {
1359 d0 = - tracks[
i]->dxy(the_pvtx.position());
1361 d0 = tracks[
i]->d0();
1381 bool associated =
false;
1385 for ( std::vector<PhotonMCTruth>::const_iterator mcPho=mcPhotons.begin(); mcPho !=mcPhotons.end(); mcPho++) {
1386 mcConvPt_= (*mcPho).fourMomentum().et();
1387 float mcPhi= (*mcPho).fourMomentum().phi();
1388 simPV_Z = (*mcPho).primaryVertex().z();
1390 mcEta_= (*mcPho).fourMomentum().pseudoRapidity();
1392 mcConvR_= (*mcPho).vertex().perp();
1398 if ( fabs(
mcEta_) > END_HI )
continue;
1404 if ( (*mcPho).isAConversion() != 1 )
continue;
1405 if (!( ( fabs(
mcEta_) <= BARL && mcConvR_ <85 ) ||
1406 ( fabs(
mcEta_) > BARL && fabs(
mcEta_) <=END_HI && fabs( (*mcPho).vertex().z() ) < 210 ) ) )
1411 for(
size_t i = 0;
i < tpForFakeRate.size(); ++
i){
1413 if ( fabs( tp->vx() - (*mcPho).vertex().x() ) < 0.0001 &&
1414 fabs( tp->vy() - (*mcPho).vertex().y() ) < 0.0001 &&
1415 fabs( tp->vz() - (*mcPho).vertex().z() ) < 0.0001) {
1428 std::vector<std::pair<TrackingParticleRef, double> > tp1 = p1[tk1];
1429 std::vector<std::pair<TrackingParticleRef, double> > tp2 = p2[tk2];
1430 if (!(tp1.size()&&tp2.size())){
1434 if (tp1.size()&&tp2.size()) {
1437 if (
abs(tpr1->pdgId())==11&&
abs(tpr2->pdgId())==11&& tpr1->pdgId()*tpr2->pdgId()<0) {
1438 if ( (tpr1->parentVertex()->sourceTracks_end()-tpr1->parentVertex()->sourceTracks_begin()==1) &&
1439 (tpr2->parentVertex()->sourceTracks_end()-tpr2->parentVertex()->sourceTracks_begin()==1)) {
1440 if (tpr1->parentVertex().
key()==tpr2->parentVertex().
key() && ((*tpr1->parentVertex()->sourceTracks_begin())->
pdgId()==22)) {
1441 mcConvR_ =
sqrt(tpr1->parentVertex()->position().Perp2());
1442 mcConvZ_ = tpr1->parentVertex()->position().z();
1443 mcConvX_ = tpr1->parentVertex()->position().x();
1444 mcConvY_ = tpr1->parentVertex()->position().y();
1445 mcConvEta_ = tpr1->parentVertex()->position().eta();
1446 mcConvPhi_ = tpr1->parentVertex()->position().phi();
1447 mcConvPt_ =
sqrt((*tpr1->parentVertex()->sourceTracks_begin())->momentum().Perp2());
1467 for(
size_t i = 0;
i < tpForFakeRate.size(); ++
i){
1475 for ( std::vector<PhotonMCTruth>::const_iterator mcPho=mcPhotons.begin(); mcPho !=mcPhotons.end(); mcPho++) {
1476 mcConvPt_= (*mcPho).fourMomentum().et();
1477 float mcPhi= (*mcPho).fourMomentum().phi();
1478 simPV_Z = (*mcPho).primaryVertex().z();
1480 mcEta_= (*mcPho).fourMomentum().pseudoRapidity();
1482 mcConvR_= (*mcPho).vertex().perp();
1485 mcConvZ_= (*mcPho).vertex().z();
1488 if ( fabs(
mcEta_) > END_HI )
continue;
1494 if ( (*mcPho).isAConversion() != 1 )
continue;
1495 if (!( ( fabs(
mcEta_) <= BARL && mcConvR_ <85 ) ||
1496 ( fabs(
mcEta_) > BARL && fabs(
mcEta_) <=END_HI && fabs( (*mcPho).vertex().z() ) < 210 ) ) )
1501 for(
size_t i = 0;
i < tpForFakeRate.size(); ++
i){
1503 if ( fabs( tp->vx() - (*mcPho).vertex().x() ) < 0.0001 &&
1504 fabs( tp->vy() - (*mcPho).vertex().y() ) < 0.0001 &&
1505 fabs( tp->vz() - (*mcPho).vertex().z() ) < 0.0001) {
1524 std::vector<std::pair<TrackingParticleRef, double> > tp1 = p1incl[tk1];
1525 std::vector<std::pair<TrackingParticleRef, double> > tp2 = p2incl[tk2];
1526 if (!(tp1.size()&&tp2.size())){
1530 if (tp1.size()&&tp2.size()) {
1533 if (
abs(tpr1->pdgId())==11&&
abs(tpr2->pdgId())==11 && tpr1->pdgId()*tpr2->pdgId()<0) {
1534 if ( ((tpr1->parentVertex()->sourceTracks_end()-tpr1->parentVertex()->sourceTracks_begin()>=1) && (*tpr1->parentVertex()->sourceTracks_begin())->
pdgId()==22) &&
1535 ((tpr2->parentVertex()->sourceTracks_end()-tpr2->parentVertex()->sourceTracks_begin()>=1) && (*tpr2->parentVertex()->sourceTracks_begin())->
pdgId()==22) ) {
1566 if ( associated ) match=1;
1595 if ( matchConvSC ) {
1608 if ( phoIsInBarrel ) {
1624 if ( matchConvSC ) {
1636 if ( phoIsInEndcap ) {
1652 if ( matchConvSC ) {
1695 if ( phoIsInBarrel ) {
1702 if ( phoIsInEndcap ) {
1714 for (
unsigned int i=0;
i<tracks.size();
i++) {
1717 itAss= myAss.find( tfrb.get() );
1731 d0 = - tracks[
i]->dxy(the_pvtx.position());
1733 d0 = tracks[
i]->d0();
1741 if ( itAss == myAss.end() )
continue;
1744 float simPt =
sqrt( ((*itAss).second)->momentum().perp2() );
1746 float ptres= recPt - simPt ;
1753 if ( phoIsInBarrel ) {
1757 if ( phoIsInEndcap ) {
MonitorElement * h2_DPhiTracksAtVtxVsR_
MonitorElement * h2_dzPVVsR_
const reco::Vertex & conversionVertex() const
returns the reco conversion vertex
MonitorElement * h_maxDlClosestHitToVtx_[3][3]
MonitorElement * h_convPt_[3][3]
MonitorElement * p_convVtxdYVsY_
T getParameter(std::string const &) const
MonitorElement * h2_DCotTracksVsR_
MonitorElement * h_convVtxdR_
MonitorElement * h2_DCotTracksVsEta_
MonitorElement * h_simConvVtxRvsZ_[4]
MonitorElement * h_convZplot_
MonitorElement * h_convSCdPhi_[3][3]
MonitorElement * h_SimConvTwoMTracksAndVtxPGT0_[5]
MonitorElement * h_SimConvTwoMTracksAndVtxPGT0005_[5]
std::string photonCollection_
MonitorElement * h_DCotTracks_[3][3]
std::vector< TrackingParticle > TrackingParticleCollection
const_iterator end() const
last iterator over the map (read only)
static HepMC::IO_HEPEVT conv
MonitorElement * nHitsVsEta_[3]
MonitorElement * h_lxybs_[3][3]
edm::RefVector< TrackingParticleCollection > theConvTP_
MonitorElement * h_trailNHitsBeforeVtx_[3][3]
bool quality(ConversionQuality q) const
double y() const
y coordinate
math::XYZVector recalculateMomentumAtFittedVertex(const MagneticField &mf, const TrackerGeometry &trackerGeom, const edm::RefToBase< reco::Track > &tk, const reco::Vertex &vtx)
MonitorElement * p_Chi2VsR_[3]
bool isValid() const
Tells whether the vertex is valid.
MonitorElement * h_convVtxYvsX_zoom_[2]
MonitorElement * p_DCotTracksVsR_
MonitorElement * h_tkChi2_[3]
std::vector< GenJet > GenJetCollection
collection of GenJet objects
const std::vector< Measurement1DFloat > & dlClosestHitToVtx() const
Vector of signed decay length with uncertainty from nearest hit on track to the conversion vtx positi...
MonitorElement * h_convVtxdX_
const_iterator find(const key_type &k) const
find element with specified reference key
MonitorElement * h_convPtRes_[3]
MonitorElement * h_convEtaMatchSC_[3][3]
double zOfPrimaryVertexFromTracks(const math::XYZPoint &myBeamSpot=math::XYZPoint()) const
double distOfMinimumApproach() const
MonitorElement * h2_Chi2VsEta_[3]
MonitorElement * h_SimRecConvTwoMTracks_[5]
double pairCotThetaSeparation() const
Delta cot(Theta) where Theta is the angle in the (y,z) plane between the two tracks. Original tracks are used.
MonitorElement * h_vtxChi2Prob_[3][3]
reco::SuperClusterRef superCluster() const
Ref to SuperCluster.
std::vector< Vertex > VertexCollection
collection of Vertex objects
MonitorElement * h_convVtxdX_endcap_
MonitorElement * h_convVtxdR_endcap_
MonitorElement * h_zPVFromTracks_[2]
MonitorElement * h_convVtxdY_barrel_
MonitorElement * h_tkChi2Large_[3]
edm::ParameterSet parameters_
MonitorElement * p_DCotTracksVsEta_
const_iterator end() const
Termination of iteration.
const std::vector< Track > & refittedTracks() const
Returns the container of refitted tracks.
MonitorElement * h_maxDlClosestHitToVtxSig_[3][3]
MonitorElement * h_convVtxdR_barrel_
MonitorElement * h_leadExpectedHitsInner_[3][3]
double pairInvariantMass() const
if nTracks=2 returns the pair invariant mass. Original tracks are used here
const Point & position() const
position
math::XYZVectorF refittedPairMomentum() const
Conversion tracks momentum from the tracks refitted with vertex constraint.
std::vector< Conversion > ConversionCollection
collectin of Conversion objects
const_iterator begin() const
Initialize an iterator over the RefVector.
MonitorElement * h_convSCdEta_[3][3]
MonitorElement * h_sumNHitsBeforeVtx_[3][3]
MonitorElement * h_dzPVFromTracks_[2]
TrackAlgorithm algo() const
MonitorElement * h_nConv_[3][3]
info per conversion
edm::ESHandle< CaloGeometry > theCaloGeom_
std::vector< edm::RefToBase< reco::Track > > tracks() const
vector of track to base references
MonitorElement * h_convVtxdY_
MonitorElement * p_DPhiTracksAtVtxVsEta_
MonitorElement * h_deltaExpectedHitsInner_[3][3]
MonitorElement * h_convVtxdEta_
MonitorElement * h_convVtxYvsX_
TrackAssociatorBase * theTrackAssociator_
MonitorElement * p_convVtxdZVsR_
MonitorElement * p_convVtxdRVsR_
MonitorElement * h_convR_[3][3]
float etaTransformation(float a, float b)
float phiNormalization(float &a)
std::string conversionCollection_
const T & max(const T &a, const T &b)
MonitorElement * h_VisSimConv_[6]
MonitorElement * h2_photonPtRecVsPtSim_
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
MonitorElement * h_EoverPTracks_[3][3]
edm::ESHandle< MagneticField > theMF_
PhotonMCTruthFinder * thePhotonMCTruthFinder_
double pt() const
track transverse momentum
MonitorElement * h_leadNHitsBeforeVtx_[3][3]
MonitorElement * h_distMinAppTracks_[3][3]
MonitorElement * p_DPhiTracksAtVtxVsR_
MonitorElement * h_SimConvEtaPix_[2]
double chi2() const
chi-squares
MonitorElement * h_convVtxdX_barrel_
MonitorElement * p_nHitsVsEta_[3]
MonitorElement * h_simTkPt_
float ChiSquaredProbability(double chiSquared, double nrDOF)
const HitPattern & trackerExpectedHitsInner() const
Access the hit pattern counting (in the Tracker) the number of expected crossed layers before the fir...
MonitorElement * p_convVtxdXVsX_
MonitorElement * h_convVtxdY_endcap_
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< float > > XYZVectorF
spatial vector with cartesian internal representation
MonitorElement * h_convEta_[3][3]
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
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
virtual reco::RecoToSimCollection associateRecoToSim(edm::Handle< edm::View< reco::Track > > &tCH, edm::Handle< TrackingParticleCollection > &tPCH, const edm::Event *event, const edm::EventSetup *setup) const
compare reco to sim the handle of reco::Track and TrackingParticle collections
MonitorElement * h_simConvVtxYvsX_
MonitorElement * h_convEta2_[3][3]
MonitorElement * h_nHitsBeforeVtx_[3]
MonitorElement * p2_convVtxdRVsRZ_
MonitorElement * p_Chi2VsEta_[3]
virtual reco::SimToRecoCollection associateSimToReco(edm::Handle< edm::View< reco::Track > > &tCH, edm::Handle< TrackingParticleCollection > &tPCH, const edm::Event *event, const edm::EventSetup *setup) const
compare reco to sim the handle of reco::Track and TrackingParticle collections
double deltaPhi(double phi1, double phi2)
double x() const
x coordinate
MonitorElement * h_convVtxdZ_
MonitorElement * h_convVtxRvsZ_[3]
uint8_t nSharedHits() const
number of shared hits btw the two track
MonitorElement * h2_DPhiTracksAtVtxVsEta_
MonitorElement * h_convPhi_[3][3]
size_type size() const
map size
void clear()
Clear the vector.
XYZVectorD XYZVector
spatial vector with cartesian internal representation
MonitorElement * h_convVtxdZ_barrel_
key_type key() const
Accessor for product key.
MonitorElement * h2_convVtxRrecVsTrue_
MonitorElement * h_AllSimConv_[5]
Denominator for efficiencies.
MonitorElement * h_convRplot_
MonitorElement * p_nHitsVsR_[3]
std::vector< Photon > PhotonCollection
collectin of Photon objects
double maxPhoEtaForPurity
MonitorElement * p_dzPVVsR_
MonitorElement * h2_Chi2VsR_[3]
std::vector< PhotonMCTruth > find(const std::vector< SimTrack > &simTracks, const std::vector< SimVertex > &simVertices)
std::string conversionCollectionProducer_
MonitorElement * h_convVtxdPhi_
MonitorElement * h_invMass_[3][3]
MonitorElement * h_convZ_[3][3]
MonitorElement * h_dlClosestHitToVtxSig_[3]
bool arbitratedEcalSeeded_
MonitorElement * h2_PtRecVsPtSim_[3]
std::string photonCollectionProducer_
MonitorElement * h_match_
double mcPhi_
global variable for the MC photon
MonitorElement * p_convVtxdZVsZ_
MonitorElement * h2_TkPtPull_[3]
void push_back(const RefToBase< T > &)
const std::vector< uint8_t > & nHitsBeforeVtx() const
Vector of the number of hits before the vertex along each track trajector.
MonitorElement * h_convVtxdZ_endcap_
MonitorElement * h2_convVtxdRVsR_
MonitorElement * h_DPhiTracksAtVtx_[3][3]
void push_back(value_type const &ref)
Add a Ref<C, T> to the RefVector.
size_type size() const
Size of the RefVector.
MonitorElement * nHitsVsR_[3]
MonitorElement * h_simTkEta_
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
MonitorElement * h_TkPtPull_[3]
MonitorElement * p2_convVtxdZVsRZ_
MonitorElement * h_SimConvTwoMTracks_[5]
MonitorElement * p_convVtxdRVsEta_
MonitorElement * h_dlClosestHitToVtx_[3]
MonitorElement * h_TkD0_[3]
MonitorElement * h2_convVtxdRVsEta_
value_type const * get() const
MonitorElement * h_nSharedHits_[3][3]
double dPhiTracksAtVtx() const
MonitorElement * h_maxNHitsBeforeVtx_[3][3]