CMS 3D CMS Logo

Classes | Functions
PFAnalysisNtuplizer.cc File Reference
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/one/EDAnalyzer.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/MakerMacros.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "DataFormats/CaloRecHit/interface/CaloClusterFwd.h"
#include "DataFormats/EgammaCandidates/interface/GsfElectron.h"
#include "DataFormats/GsfTrackReco/interface/GsfTrack.h"
#include "DataFormats/HcalRecHit/interface/HFRecHit.h"
#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h"
#include "Geometry/HcalCommonData/interface/HcalHitRelabeller.h"
#include "DataFormats/HcalDetId/interface/HcalDetId.h"
#include "DataFormats/EcalDetId/interface/EcalSubdetector.h"
#include "DataFormats/ParticleFlowReco/interface/PFCluster.h"
#include "DataFormats/VertexReco/interface/Vertex.h"
#include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h"
#include "DataFormats/ParticleFlowReco/interface/PFBlockElementSuperCluster.h"
#include "DataFormats/ParticleFlowReco/interface/PFBlockElementGsfTrack.h"
#include "DataFormats/ParticleFlowReco/interface/PFBlockElementTrack.h"
#include "DataFormats/ParticleFlowReco/interface/PFBlockElementBrem.h"
#include "DataFormats/ParticleFlowReco/interface/PFBlockElementCluster.h"
#include "Geometry/HcalTowerAlgo/interface/HcalGeometry.h"
#include "SimDataFormats/CaloAnalysis/interface/CaloParticle.h"
#include "SimDataFormats/CaloAnalysis/interface/SimCluster.h"
#include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h"
#include "SimDataFormats/TrackingAnalysis/interface/TrackingParticle.h"
#include "SimDataFormats/Associations/interface/TrackAssociation.h"
#include "DataFormats/ParticleFlowReco/interface/PFBlock.h"
#include "DataFormats/EgammaReco/interface/SuperCluster.h"
#include "DataFormats/EgammaReco/interface/ElectronSeed.h"
#include "DataFormats/Math/interface/deltaPhi.h"
#include "DataFormats/TrackReco/interface/Track.h"
#include "DataFormats/DetId/interface/DetId.h"
#include "DataFormats/GeometrySurface/interface/PlaneBuilder.h"
#include "Geometry/CaloGeometry/interface/CaloCellGeometry.h"
#include "Geometry/CaloGeometry/interface/CaloGeometry.h"
#include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h"
#include "Geometry/Records/interface/CaloGeometryRecord.h"
#include "CommonTools/BaseParticlePropagator/interface/BaseParticlePropagator.h"
#include "Math/Transform3D.h"
#include "MagneticField/Engine/interface/MagneticField.h"
#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
#include "MagneticField/VolumeGeometry/interface/MagVolumeOutsideValidity.h"
#include "RecoParticleFlow/PFProducer/interface/MLPFModel.h"
#include "CommonTools/UtilAlgos/interface/TFileService.h"
#include "FWCore/ServiceRegistry/interface/Service.h"
#include "TH1F.h"
#include "TVector2.h"
#include "TTree.h"
#include <map>
#include <set>
#include <string>
#include <vector>

Go to the source code of this file.

Classes

class  ElementWithIndex
 
class  PFAnalysis
 

Functions

double detid_compare (const map< uint64_t, double > &rechits, const map< uint64_t, double > &simhits)
 
vector< int > find_element_ref (const vector< ElementWithIndex > &vec, const edm::RefToBase< reco::Track > &r)
 
int get_index_triu_vector (int i, int j, int n)
 
pair< int, int > get_triu_vector_index (int k, int n)
 
static const edm::ParameterSetDescriptionFillerPluginFactory::PMaker< edm::ParameterSetDescriptionFiller< PFAnalysis > > s_filler_0__LINE__ ("PFAnalysis")
 
static const edm::MakerPluginFactory ::PMaker< edm::WorkerMaker< PFAnalysis > > s_maker__LINE__ ("PFAnalysis")
 

Function Documentation

◆ detid_compare()

double detid_compare ( const map< uint64_t, double > &  rechits,
const map< uint64_t, double > &  simhits 
)

Definition at line 109 of file PFAnalysisNtuplizer.cc.

References runTheMatrix::ret, and HLTBitAnalyser_cfi::simhits.

Referenced by PFAnalysis::associateClusterToSimCluster().

109  {
110  double ret = 0.0;
111 
112  for (const auto& rh : rechits) {
113  for (const auto& sh : simhits) {
114  if (rh.first == sh.first) {
115  //rechit energy times simhit fraction
116  ret += rh.second * sh.second;
117  break;
118  }
119  }
120  }
121  return ret;
122 }
ret
prodAgent to be discontinued

◆ find_element_ref()

vector<int> find_element_ref ( const vector< ElementWithIndex > &  vec,
const edm::RefToBase< reco::Track > &  r 
)

Definition at line 79 of file PFAnalysisNtuplizer.cc.

References reco::PFBlockElement::BREM, reco::PFBlockElement::GSF, mps_fire::i, runTheMatrix::ret, and reco::PFBlockElement::TRACK.

Referenced by PFAnalysis::analyze().

79  {
80  vector<int> ret;
81  for (unsigned int i = 0; i < vec.size(); i++) {
82  const auto& elem = vec.at(i);
83  if (elem.orig.type() == reco::PFBlockElement::TRACK) {
84  const auto& ref = elem.orig.trackRef();
85  if (ref.isNonnull() && ref->extra().isNonnull()) {
86  if (ref.key() == r.key()) {
87  ret.push_back(i);
88  }
89  }
90  } else if (elem.orig.type() == reco::PFBlockElement::GSF) {
91  const auto& ref = ((const reco::PFBlockElementGsfTrack*)&elem.orig)->clusterRef();
92  if (ref.isNonnull()) {
93  if (ref.key() == r.key()) {
94  ret.push_back(i);
95  }
96  }
97  } else if (elem.orig.type() == reco::PFBlockElement::BREM) {
98  const auto& ref = ((const reco::PFBlockElementBrem*)&elem.orig)->clusterRef();
99  if (ref.isNonnull()) {
100  if (ref.key() == r.key()) {
101  ret.push_back(i);
102  }
103  }
104  }
105  }
106  return ret;
107 }
ret
prodAgent to be discontinued

◆ get_index_triu_vector()

int get_index_triu_vector ( int  i,
int  j,
int  n 
)

Definition at line 1038 of file PFAnalysisNtuplizer.cc.

References mps_fire::i, dqmiolumiharvest::j, dqmdumpme::k, and dqmiodumpmetadata::n.

1038  {
1039  int k = (n * (n - 1) / 2) - (n - i) * ((n - i) - 1) / 2 + j - i - 1;
1040  return k;
1041 }

◆ get_triu_vector_index()

pair<int, int> get_triu_vector_index ( int  k,
int  n 
)

Definition at line 1043 of file PFAnalysisNtuplizer.cc.

References mps_fire::i, dqmiolumiharvest::j, dqmdumpme::k, dqmiodumpmetadata::n, and mathSSE::sqrt().

Referenced by PFAnalysis::processBlocks().

1043  {
1044  int i = n - 2 - floor(sqrt(-8 * k + 4 * n * (n - 1) - 7) / 2.0 - 0.5);
1045  int j = k + i + 1 - n * (n - 1) / 2 + (n - i) * ((n - i) - 1) / 2;
1046  return make_pair(i, j);
1047 }
T sqrt(T t)
Definition: SSEVec.h:23

◆ s_filler_0__LINE__()

static const edm::ParameterSetDescriptionFillerPluginFactory::PMaker<edm::ParameterSetDescriptionFiller< PFAnalysis > > s_filler_0__LINE__ ( "PFAnalysis"  )
static

◆ s_maker__LINE__()

static const edm::MakerPluginFactory ::PMaker< edm::WorkerMaker< PFAnalysis > > s_maker__LINE__ ( "PFAnalysis"  )
static