37 namespace MK = reco::MustacheKernel;
49 void operator () (
T* arr) {
delete [] arr; }
52 typedef std::unary_function<const edm::Ptr<reco::PFCluster>&,
53 double> ClusUnaryFunction;
55 struct GetSharedRecHitFraction :
public ClusUnaryFunction {
57 double x_rechits_tot, x_rechits_match;
62 const auto& seedHitsAndFractions =
63 the_seed->hitsAndFractions();
64 const auto& xHitsAndFractions =
65 x->hitsAndFractions();
66 x_rechits_tot = xHitsAndFractions.size();
67 x_rechits_match = 0.0;
68 for(
const std::pair<DetId, float>& seedHit : seedHitsAndFractions ) {
69 for(
const std::pair<DetId, float>& xHit : xHitsAndFractions ) {
70 if( seedHit.first == xHit.first ) {
71 x_rechits_match += 1.0;
75 return x_rechits_match/x_rechits_tot;
93 std::shared_ptr<PFEnergyCalibration>
_calib;
129 <<
"Product ID for the EB SuperCluster collection was invalid!"
137 <<
"Product ID for the EE SuperCluster collection was invalid!"
157 double minDr = 1e6, this_dr;
159 for(
size_t i = 0;
i < genp->size(); ++
i) {
162 if( this_dr < minDr && genp->
at(
i).pdgId() == 22) {
168 genmatch = bestmatch;
170 genEta = bestmatch->eta();
171 genPhi = bestmatch->phi();
183 <<
"Requested generator level information was not available!"
199 GetSharedRecHitFraction fractionOfSeed(theseed);
208 for(
auto clus = sc.
clustersBegin(); clus != clusend; ++clus ) {
210 if( theseed == pclus )
continue;
262 _tree =
_fs->
make<TTree>(
"SuperClusterTree",
"Dump of all available SC info");
268 "scCalibratedEnergy/F");
277 "scSeedCalibratedEnergy/F");
283 "clusterRawEnergy[N_ECALClusters]/F");
286 "clusterCalibEnergy[N_ECALClusters]/F");
287 clusterEta.reset(
new Float_t[1],array_deleter<Float_t>());
289 "clusterEta[N_ECALClusters]/F");
290 clusterPhi.reset(
new Float_t[1],array_deleter<Float_t>());
292 "clusterPhi[N_ECALClusters]/F");
295 "clusterDPhiToSeed[N_ECALClusters]/F");
298 "clusterDEtaToSeed[N_ECALClusters]/F");
301 "clusterDPhiToCentroid[N_ECALClusters]/F");
304 "clusterDEtaToCentroid[N_ECALClusters]/F");
306 array_deleter<Float_t>());
307 _tree->Branch(
"clusterHitFractionSharedWithSeed",
309 "clusterHitFractionSharedWithSeed[N_ECALClusters]/F");
312 "clusterInMustache[N_ECALClusters]/I");
315 "clusterInDynDPhi[N_ECALClusters]/I");
319 "psClusterRawEnergy[N_PSClusters]/F");
320 psClusterEta.reset(
new Float_t[1],array_deleter<Float_t>());
322 "psClusterEta[N_PSClusters]/F");
323 psClusterPhi.reset(
new Float_t[1],array_deleter<Float_t>());
325 "psClusterPhi[N_PSClusters]/F");
338 "clusterDPhiToGen[N_ECALClusters]/F");
341 "clusterDPhiToGen[N_ECALClusters]/F");
351 Float_t* cRE_new =
new Float_t[N_ECAL];
354 Float_t* cCE_new =
new Float_t[N_ECAL];
357 Float_t* cEta_new =
new Float_t[N_ECAL];
358 clusterEta.reset(cEta_new,array_deleter<Float_t>());
360 Float_t* cPhi_new =
new Float_t[N_ECAL];
361 clusterPhi.reset(cPhi_new,array_deleter<Float_t>());
363 Float_t* cDPhiSeed_new =
new Float_t[N_ECAL];
366 Float_t* cDEtaSeed_new =
new Float_t[N_ECAL];
369 Float_t* cDPhiCntr_new =
new Float_t[N_ECAL];
372 Float_t* cDEtaCntr_new =
new Float_t[N_ECAL];
375 Float_t* cHitFracShared_new =
new Float_t[N_ECAL];
377 array_deleter<Float_t>());
381 Float_t* cDPhiGen_new =
new Float_t[N_ECAL];
384 Float_t* cDEtaGen_new =
new Float_t[N_ECAL];
388 Int_t* cInMust_new =
new Int_t[N_ECAL];
391 Int_t* cInDynDPhi_new =
new Int_t[N_ECAL];
394 Float_t* psRE_new =
new Float_t[N_PS];
397 Float_t* psEta_new =
new Float_t[N_PS];
400 Float_t* psPhi_new =
new Float_t[N_PS];
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
const math::XYZPoint & position() const
cluster centroid position
CaloCluster_iterator preshowerClustersBegin() const
fist iterator over PreshowerCluster constituents
std::shared_ptr< Float_t > psClusterRawEnergy
double phiWidth() const
obtain phi and eta width of the Super Cluster
bool inDynamicDPhiWindow(const bool isEE, const float seedPhi, const float ClustE, const float ClusEta, const float clusPhi)
#define DEFINE_FWK_MODULE(type)
std::shared_ptr< Float_t > clusterPhi
edm::Ref< GenParticleCollection > GenParticleRef
persistent reference to a GenParticle
std::shared_ptr< Float_t > clusterCalibEnergy
void setTreeArraysForSize(const size_t N_ECAL, const size_t N_PS)
double Phi_mpi_pi(double x)
std::shared_ptr< PFEnergyCalibration > _calib
std::shared_ptr< Float_t > clusterDEtaToCentroid
Float_t scPreshowerEnergy
std::shared_ptr< Float_t > clusterHitFractionSharedWithSeed
~PFSuperClusterTreeMaker()
double eta() const
pseudorapidity of cluster centroid
Float_t scSeedCalibratedEnergy
edm::Service< TFileService > _fs
bool isNonnull() const
Checks for non-null.
PFSuperClusterTreeMaker(const PSet &)
const T & max(const T &a, const T &b)
auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
double energy() const
cluster energy
std::shared_ptr< Float_t > psClusterPhi
std::shared_ptr< Float_t > clusterDPhiToSeed
tuple genp
produce generated paricles in acceptance #
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
double rawEnergy() const
raw uncorrected energy (sum of energies of component BasicClusters)
std::shared_ptr< Float_t > clusterDPhiToGen
Float_t scCalibratedEnergy
void analyze(const edm::Event &, const edm::EventSetup &)
std::shared_ptr< Float_t > psClusterEta
std::shared_ptr< Int_t > clusterInMustache
std::shared_ptr< Float_t > clusterEta
std::shared_ptr< Float_t > clusterDEtaToSeed
CaloCluster_iterator clustersBegin() const
fist iterator over BasicCluster constituents
T * make() const
make new ROOT object
const CaloClusterPtr & seed() const
seed BasicCluster
double preshowerEnergy() const
energy deposited in preshower
std::shared_ptr< Int_t > clusterInDynDPhi
std::shared_ptr< Float_t > clusterRawEnergy
double phi() const
azimuthal angle of cluster centroid
std::shared_ptr< Float_t > clusterDEtaToGen
std::shared_ptr< Float_t > clusterDPhiToCentroid
bool inMustache(const float maxEta, const float maxPhi, const float ClustE, const float ClusEta, const float ClusPhi)
CaloCluster_iterator preshowerClustersEnd() const
last iterator over PreshowerCluster constituents
CaloCluster_iterator clustersEnd() const
last iterator over BasicCluster constituents
void processSuperClusterFillTree(const edm::Event &, const reco::SuperCluster &)