29 tok_HF_ = consumes<edm::SortedCollection<HFRecHit,edm::StrictWeakOrdering<HFRecHit> > >(
hfRecHitName_);
30 tok_HO_ = consumes<edm::SortedCollection<HORecHit,edm::StrictWeakOrdering<HORecHit> > >(
hoRecHitName_);
55 <<
" could not find PFJetCollection named " <<
pfJetCollName_ <<
".\n";
73 <<
" could not find HFRecHit named " <<
hfRecHitName_ <<
".\n";
82 <<
" could not find HORecHit named " <<
hoRecHitName_ <<
".\n";
112 <<
" could not find Vertex named " <<
pvCollName_ <<
".\n";
116 for(std::vector<reco::Vertex>::const_iterator it=pv->begin(); it!=pv->end(); ++it){
117 if(!it->isFake() && it->ndof() > 4) ++
pf_NPV_;
131 std::set<JetCorretPair, JetCorretPairComp> pfjetcorretpairset;
132 for(reco::PFJetCollection::const_iterator it=pfjets->begin(); it!=pfjets->end(); ++it) {
143 for(std::set<JetCorretPair, JetCorretPairComp>::const_iterator it=pfjetcorretpairset.begin(); it!=pfjetcorretpairset.end(); ++it) {
146 if(cntr==1) pf_tag=
jet;
147 else if(cntr==2) pf_probe=
jet;
159 if(pf_tag.
jet() && pf_probe.
jet()){
167 if(std::fabs(pf_tag.
jet()->
eta())>std::fabs(pf_probe.
jet()->
eta())) {
174 double dAbsEta=std::fabs(std::fabs(pf_tag.
jet()->
eta())-std::fabs(pf_probe.
jet()->
eta()));
184 if(passSelPF)
return;
188 for(reco::PFJetCollection::const_iterator it=pfjets->begin(); it!=pfjets->end(); ++it) {
190 std::cout <<
"istag=" << (jet==pf_tag.
jet()) <<
"; isprobe=" << (jet==pf_probe.
jet()) <<
"; et=" << jet->et() <<
"; eta=" << jet->eta() << std::endl;
267 std::map<int,std::pair<int,std::set<float>>> tpfjet_rechits;
268 std::map<int,std::pair<int,std::set<float>>> ppfjet_rechits;
269 std::map<float,int> tpfjet_clusters;
270 std::map<float,int> ppfjet_clusters;
284 if(fabs(pf_tag.
jet()->
eta()) < 2.4){
324 for(std::vector<reco::PFCandidatePtr>::const_iterator it=tagconst.begin(); it!=tagconst.end(); ++it){
325 bool hasTrack =
false;
328 switch(candidateType){
433 std::map<int,int> twrietas;
436 int maxElement=(*it)->elementsInBlocks().size();
437 for(
int e=0;
e<maxElement; ++
e){
441 for(
unsigned iEle=0; iEle<elements.
size(); iEle++) {
442 if(elements[iEle].
index() == (*it)->elementsInBlocks()[
e].second){
448 if(tpfjet_clusters.count(cluster_dR) == 0){
455 int cluster_ind = tpfjet_clusters[cluster_dR];
457 std::vector<std::pair<DetId,float>> hitsAndFracs = cluster.
hitsAndFractions();
460 int nHits = hitsAndFracs.size();
461 for(
int iHit=0; iHit<nHits; iHit++){
465 int etaPhiRecHit =
getEtaPhi((*ith).id());
466 if(etaPhiPF == etaPhiRecHit){
468 if(tpfjet_rechits.count((*ith).id()) == 0){
473 if(hitsAndFracs[iHit].
second > 0.05 && (*ith).energy() > 0.0) twrietas[(*ith).id().ieta()]++;
476 tpfjet_rechits[(*ith).id()].second.insert(hitsAndFracs[iHit].second);
486 switch((*ith).id().subdet()){
491 float avgeta = (cv[0].eta() + cv[2].eta())/2.0;
492 float avgphi = (
static_cast<double>(cv[0].phi()) + static_cast<double>(cv[2].
phi()))/2.0;
493 if(cv[0].
phi() < cv[2].phi()) avgphi = (2.0*3.141592653 + static_cast<double>(cv[0].
phi()) +
static_cast<double>(cv[2].phi()))/2.0;
501 float avgeta = (cv[0].eta() + cv[2].eta())/2.0;
502 float avgphi = (
static_cast<double>(cv[0].phi()) + static_cast<double>(cv[2].
phi()))/2.0;
503 if(cv[0].
phi() < cv[2].phi()) avgphi = (2.0*3.141592653 + static_cast<double>(cv[0].
phi()) +
static_cast<double>(cv[2].phi()))/2.0;
514 else if(tpfjet_rechits[(*ith).id()].second.count(hitsAndFracs[iHit].
second) == 0){
515 tpfjet_twr_frac_.at(tpfjet_rechits[(*ith).id()].first) += hitsAndFracs[iHit].second;
519 tpfjet_rechits[(*ith).id()].second.insert(hitsAndFracs[iHit].second);
527 if((*ith).id().depth() == 1)
continue;
531 bool passMatch =
false;
532 if((*it)->eta() < cv[0].eta() && (*it)->eta() > cv[2].eta()){
533 if((*it)->phi() < cv[0].phi() && (*it)->phi() > cv[2].phi()) passMatch =
true;
534 else if(cv[0].
phi() < cv[2].phi()){
535 if((*it)->phi() < cv[0].phi()) passMatch =
true;
536 else if((*it)->phi() > cv[2].phi()) passMatch =
true;
552 float avgeta = (cv[0].eta() + cv[2].eta())/2.0;
553 float avgphi = (
static_cast<double>(cv[0].phi()) + static_cast<double>(cv[2].
phi()))/2.0;
554 if(cv[0].
phi() < cv[2].phi()) avgphi = (2.0*3.141592653 + static_cast<double>(cv[0].
phi()) +
static_cast<double>(cv[2].phi()))/2.0;
557 HFHAD_E += (*ith).energy();
563 if((*ith).id().depth() == 2)
continue;
567 bool passMatch =
false;
568 if((*it)->eta() < cv[0].eta() && (*it)->eta() > cv[2].eta()){
569 if((*it)->phi() < cv[0].phi() && (*it)->phi() > cv[2].phi()) passMatch =
true;
570 else if(cv[0].
phi() < cv[2].phi()){
571 if((*it)->phi() < cv[0].phi()) passMatch =
true;
572 else if((*it)->phi() > cv[2].phi()) passMatch =
true;
588 float avgeta = (cv[0].eta() + cv[2].eta())/2.0;
589 float avgphi = (
static_cast<double>(cv[0].phi()) + static_cast<double>(cv[2].
phi()))/2.0;
590 if(cv[0].
phi() < cv[2].phi()) avgphi = (2.0*3.141592653 + static_cast<double>(cv[0].
phi()) +
static_cast<double>(cv[2].phi()))/2.0;
593 HFEM_E += (*ith).energy();
601 if(tpfjet_clusters.count(cluster_dR) == 0){
608 int cluster_ind = tpfjet_clusters[cluster_dR];
610 std::vector<std::pair<DetId,float>> hitsAndFracs = cluster.
hitsAndFractions();
611 int nHits = hitsAndFracs.size();
612 for(
int iHit=0; iHit<nHits; iHit++){
616 int etaPhiRecHit =
getEtaPhi((*ith).id());
617 if(etaPhiPF == etaPhiRecHit){
619 if(tpfjet_rechits.count((*ith).id()) == 0){
624 if(hitsAndFracs[iHit].
second > 0.05 && (*ith).energy() > 0.0) twrietas[(*ith).id().ieta()]++;
627 tpfjet_rechits[(*ith).id()].second.insert(hitsAndFracs[iHit].second);
639 float avgeta = (cv[0].eta() + cv[2].eta())/2.0;
640 float avgphi = (
static_cast<double>(cv[0].phi()) + static_cast<double>(cv[2].
phi()))/2.0;
641 if(cv[0].
phi() < cv[2].phi()) avgphi = (2.0*3.141592653 + static_cast<double>(cv[0].
phi()) +
static_cast<double>(cv[2].phi()))/2.0;
646 else if(tpfjet_rechits[(*ith).id()].second.count(hitsAndFracs[iHit].
second) == 0){
647 tpfjet_twr_frac_.at(tpfjet_rechits[(*ith).id()].first) += hitsAndFracs[iHit].second;
651 tpfjet_rechits[(*ith).id()].second.insert(hitsAndFracs[iHit].second);
661 switch(candidateType){
674 int tag_had_EcalE = 0;
675 int tag_had_rawHcalE = 0;
695 if(fabs(pf_probe.
jet()->
eta()) < 2.4){
731 for(std::vector<reco::PFCandidatePtr>::const_iterator it=probeconst.begin(); it!=probeconst.end(); ++it){
732 bool hasTrack =
false;
734 switch(candidateType){
841 int maxElement=(*it)->elementsInBlocks().size();
842 for(
int e=0;
e<maxElement; ++
e){
846 for(
unsigned iEle=0; iEle<elements.
size(); iEle++) {
847 if(elements[iEle].
index() == (*it)->elementsInBlocks()[
e].second){
853 if(ppfjet_clusters.count(cluster_dR) == 0){
860 int cluster_ind = ppfjet_clusters[cluster_dR];
861 std::vector<std::pair<DetId,float>> hitsAndFracs = cluster.
hitsAndFractions();
864 int nHits = hitsAndFracs.size();
865 for(
int iHit=0; iHit<nHits; iHit++){
869 int etaPhiRecHit =
getEtaPhi((*ith).id());
870 if(etaPhiPF == etaPhiRecHit){
872 if(ppfjet_rechits.count((*ith).id()) == 0){
879 ppfjet_rechits[(*ith).id()].second.insert(hitsAndFracs[iHit].second);
889 switch((*ith).id().subdet()){
894 float avgeta = (cv[0].eta() + cv[2].eta())/2.0;
895 float avgphi = (
static_cast<double>(cv[0].phi()) + static_cast<double>(cv[2].
phi()))/2.0;
896 if(cv[0].
phi() < cv[2].phi()) avgphi = (2.0*3.141592653 + static_cast<double>(cv[0].
phi()) +
static_cast<double>(cv[2].phi()))/2.0;
904 float avgeta = (cv[0].eta() + cv[2].eta())/2.0;
905 float avgphi = (
static_cast<double>(cv[0].phi()) + static_cast<double>(cv[2].
phi()))/2.0;
906 if(cv[0].
phi() < cv[2].phi()) avgphi = (2.0*3.141592653 + static_cast<double>(cv[0].
phi()) +
static_cast<double>(cv[2].phi()))/2.0;
917 else if(ppfjet_rechits[(*ith).id()].second.count(hitsAndFracs[iHit].
second) == 0){
918 ppfjet_twr_frac_.at(ppfjet_rechits[(*ith).id()].first) += hitsAndFracs[iHit].second;
922 ppfjet_rechits[(*ith).id()].second.insert(hitsAndFracs[iHit].second);
930 if((*ith).id().depth() == 1)
continue;
934 bool passMatch =
false;
935 if((*it)->eta() < cv[0].eta() && (*it)->eta() > cv[2].eta()){
936 if((*it)->phi() < cv[0].phi() && (*it)->phi() > cv[2].phi()) passMatch =
true;
937 else if(cv[0].
phi() < cv[2].phi()){
938 if((*it)->phi() < cv[0].phi()) passMatch =
true;
939 else if((*it)->phi() > cv[2].phi()) passMatch =
true;
955 float avgeta = (cv[0].eta() + cv[2].eta())/2.0;
956 float avgphi = (
static_cast<double>(cv[0].phi()) + static_cast<double>(cv[2].
phi()))/2.0;
957 if(cv[0].
phi() < cv[2].phi()) avgphi = (2.0*3.141592653 + static_cast<double>(cv[0].
phi()) +
static_cast<double>(cv[2].phi()))/2.0;
960 HFHAD_E += (*ith).energy();
966 if((*ith).id().depth() == 2)
continue;
970 bool passMatch =
false;
971 if((*it)->eta() < cv[0].eta() && (*it)->eta() > cv[2].eta()){
972 if((*it)->phi() < cv[0].phi() && (*it)->phi() > cv[2].phi()) passMatch =
true;
973 else if(cv[0].
phi() < cv[2].phi()){
974 if((*it)->phi() < cv[0].phi()) passMatch =
true;
975 else if((*it)->phi() > cv[2].phi()) passMatch =
true;
991 float avgeta = (cv[0].eta() + cv[2].eta())/2.0;
992 float avgphi = (
static_cast<double>(cv[0].phi()) + static_cast<double>(cv[2].
phi()))/2.0;
993 if(cv[0].
phi() < cv[2].phi()) avgphi = (2.0*3.141592653 + static_cast<double>(cv[0].
phi()) +
static_cast<double>(cv[2].phi()))/2.0;
996 HFEM_E += (*ith).energy();
1004 if(ppfjet_clusters.count(cluster_dR) == 0){
1011 int cluster_ind = ppfjet_clusters[cluster_dR];
1013 std::vector<std::pair<DetId,float>> hitsAndFracs = cluster.
hitsAndFractions();
1014 int nHits = hitsAndFracs.size();
1015 for(
int iHit=0; iHit<nHits; iHit++){
1019 int etaPhiRecHit =
getEtaPhi((*ith).id());
1020 if(etaPhiPF == etaPhiRecHit){
1022 if(ppfjet_rechits.count((*ith).id()) == 0){
1029 ppfjet_rechits[(*ith).id()].second.insert(hitsAndFracs[iHit].second);
1041 float avgeta = (cv[0].eta() + cv[2].eta())/2.0;
1042 float avgphi = (
static_cast<double>(cv[0].phi()) + static_cast<double>(cv[2].
phi()))/2.0;
1043 if(cv[0].
phi() < cv[2].phi()) avgphi = (2.0*3.141592653 + static_cast<double>(cv[0].
phi()) +
static_cast<double>(cv[2].phi()))/2.0;
1048 else if(ppfjet_rechits[(*ith).id()].second.count(hitsAndFracs[iHit].
second) == 0){
1049 ppfjet_twr_frac_.at(ppfjet_rechits[(*ith).id()].first) += hitsAndFracs[iHit].second;
1053 ppfjet_rechits[(*ith).id()].second.insert(hitsAndFracs[iHit].second);
1062 switch(candidateType){
1075 int probe_had_EcalE = 0;
1076 int probe_had_rawHcalE = 0;
1101 h_PassSelPF_ =
new TH1D(
"h_PassSelectionPF",
"Selection Pass Failures PFJets",200,-0.5,199.5);
1103 tree_ =
new TTree(
"dijettree",
"tree for dijet balancing");
1270 double deta = j1->
eta()-j2->
eta();
1271 double dphi = std::fabs(j1->
phi()-j2->
phi());
1272 if(dphi>3.1415927) dphi = 2*3.1415927 - dphi;
1273 return std::sqrt(deta*deta + dphi*dphi);
1278 double deta = eta1 - eta2;
1279 double dphi = std::fabs(phi1 - phi2);
1280 if(dphi>3.1415927) dphi = 2*3.1415927 - dphi;
1281 return std::sqrt(deta*deta + dphi*dphi);
1286 return id.rawId() & 0x3FFF;
1291 return id.rawId() & 0x3FFF;
std::vector< int > tpfjet_twr_elmttype_
T getParameter(std::string const &) const
EventNumber_t event() const
std::vector< float > tpfjet_had_emf_
T getUntrackedParameter(std::string const &, T const &) const
std::vector< float > tpfjet_had_E_
std::vector< int > ppfjet_had_candtrackind_
const reco::PFJet * jet(void) const
std::vector< float > tpfjet_candtrack_pz_
std::vector< float > tpfjet_cluster_eta_
std::vector< float > tpfjet_twr_hade_
ParticleType
particle types
std::vector< float > tpfjet_twr_dR_
bool isNonnull() const
Checks for non-null.
std::vector< int > ppfjet_twr_depth_
std::vector< float > tpfjet_cluster_dR_
std::vector< float > ppfjet_twr_frac_
Particle flow cluster, see clustering algorithm in PFClusterAlgo.
virtual double energy() const final
energy
std::vector< float > ppfjet_candtrack_py_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::vector< int > tpfjet_had_candtrackind_
virtual double correction(const LorentzVector &fJet) const =0
get correction using Jet information only
#define DEFINE_FWK_MODULE(type)
std::vector< float > tpfjet_had_py_
float chargedHadronEnergyFraction() const
chargedHadronEnergyFraction
Base class for all types of Jets.
float tpfjet_photon_EcalE_
std::vector< float > ppfjet_had_emf_
std::vector< int > ppfjet_twr_subdet_
float tpfjet_electron_px_
std::vector< int > tpfjet_twr_depth_
float pf_realthirdjet_px_
virtual double phi() const final
momentum azimuthal angle
std::string hfRecHitName_
std::vector< int > ppfjet_twr_clusterind_
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
std::vector< float > tpfjet_candtrack_EcalE_
double px() const
x coordinate of momentum vector
std::vector< int > tpfjet_twr_clusterind_
float pf_realthirdjet_scale_
std::vector< int > ppfjet_twr_candtrackind_
std::vector< float > ppfjet_twr_hade_
edm::EDGetTokenT< reco::VertexCollection > tok_Vertex_
LuminosityBlockNumber_t luminosityBlock() const
int chargedMultiplicity() const
chargedMultiplicity
Jets made from PFObjects.
double eta() const
pseudorapidity of cluster centroid
virtual const CaloCellGeometry * getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
std::string hbheRecHitName_
float ppfjet_electron_py_
U second(std::pair< T, U > const &p)
std::string pfJetCorrName_
virtual void analyze(const edm::Event &, const edm::EventSetup &)
std::vector< float > ppfjet_cluster_eta_
float neutralEmEnergyFraction() const
neutralEmEnergyFraction
std::vector< float > tpfjet_had_px_
edm::EDGetTokenT< edm::SortedCollection< HFRecHit, edm::StrictWeakOrdering< HFRecHit > > > tok_HF_
std::vector< float > ppfjet_candtrack_pz_
std::vector< float > tpfjet_had_EcalE_
edm::EDGetTokenT< reco::PFJetCollection > tok_PFJet_
float ppfjet_electron_pz_
std::vector< float > tpfjet_had_pz_
std::vector< int > tpfjet_twr_ieta_
std::vector< float > tpfjet_cluster_phi_
float ppfjet_unkown_EcalE_
std::vector< float > ppfjet_cluster_dR_
float neutralHadronEnergyFraction() const
neutralHadronEnergyFraction
virtual double py() const final
y coordinate of momentum vector
std::vector< float > ppfjet_had_rawHcalE_
std::vector< float > tpfjet_candtrack_px_
std::vector< float > ppfjet_cluster_phi_
float pf_realthirdjet_py_
int neutralMultiplicity() const
neutralMultiplicity
double pz() const
z coordinate of momentum vector
std::vector< int > tpfjet_twr_candtrackind_
std::vector< float > ppfjet_had_px_
std::vector< int > ppfjet_twr_hadind_
std::vector< float > ppfjet_had_pz_
DiJetAnalyzer(const edm::ParameterSet &)
std::vector< int > tpfjet_twr_iphi_
float ppfjet_hadEcalEfrac_
std::vector< int > ppfjet_twr_ieta_
float chargedEmEnergyFraction() const
chargedEmEnergyFraction
float tpfjet_electron_EcalE_
std::string hoRecHitName_
edm::EDGetTokenT< edm::SortedCollection< HORecHit, edm::StrictWeakOrdering< HORecHit > > > tok_HO_
static const JetCorrector * getJetCorrector(const std::string &fName, const edm::EventSetup &fSetup)
retrieve corrector from the event setup. troughs exception if something is missing ...
float tpfjet_hadEcalEfrac_
std::vector< float > ppfjet_had_E_
std::vector< float > ppfjet_twr_dR_
virtual double p() const final
magnitude of momentum vector
float tpfjet_electron_pz_
std::vector< float > tpfjet_had_rawHcalE_
float ppfjet_electron_px_
std::vector< float > ppfjet_had_py_
float tpfjet_electron_py_
virtual float jetArea() const
get jet area
float tpfjet_unkown_EcalE_
std::string rootHistFilename_
double deltaR(const reco::Jet *j1, const reco::Jet *j2)
std::vector< int > ppfjet_had_id_
virtual std::vector< reco::PFCandidatePtr > getPFConstituents() const
get all constituents
virtual double px() const final
x coordinate of momentum vector
virtual double et() const final
transverse energy
int getEtaPhi(const DetId id)
std::vector< int > ppfjet_had_ntwrs_
std::vector< float > tpfjet_twr_frac_
virtual double eta() const final
momentum pseudorapidity
std::vector< float > tpfjet_candtrack_py_
std::vector< int > tpfjet_had_id_
double phi() const
azimuthal angle of cluster centroid
std::vector< float > ppfjet_had_EcalE_
std::vector< float > ppfjet_candtrack_px_
float ppfjet_electron_EcalE_
std::vector< int > tpfjet_had_ntwrs_
std::vector< int > ppfjet_twr_elmttype_
const CornersVec & getCorners() const
Returns the corner points of this cell's volume.
std::vector< int > tpfjet_twr_subdet_
std::string pfJetCollName_
std::vector< float > ppfjet_candtrack_EcalE_
float ppfjet_photon_EcalE_
std::vector< int > tpfjet_twr_hadind_
double py() const
y coordinate of momentum vector
virtual double pt() const final
transverse momentum
edm::EDGetTokenT< edm::SortedCollection< HBHERecHit, edm::StrictWeakOrdering< HBHERecHit > > > tok_HBHE_
std::vector< int > ppfjet_twr_iphi_