Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-03-26 02:43:51

0001 //
0002 // Class: PFSuperClusterTreeMaker.cc
0003 //
0004 // Info: Processes a track into histograms of delta-phis and such
0005 //
0006 // Author: L. Gray (FNAL)
0007 //
0008 
0009 #include <memory>
0010 #include <map>
0011 
0012 #include "FWCore/Framework/interface/Frameworkfwd.h"
0013 #include "FWCore/Framework/interface/Event.h"
0014 #include "FWCore/Framework/interface/EventSetup.h"
0015 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0016 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0017 
0018 #include "DataFormats/EgammaReco/interface/SuperClusterFwd.h"
0019 #include "DataFormats/EgammaReco/interface/SuperCluster.h"
0020 #include "DataFormats/ParticleFlowReco/interface/PFClusterFwd.h"
0021 #include "DataFormats/ParticleFlowReco/interface/PFCluster.h"
0022 
0023 #include "DataFormats/VertexReco/interface/VertexFwd.h"
0024 #include "DataFormats/VertexReco/interface/Vertex.h"
0025 
0026 #include "FWCore/ServiceRegistry/interface/Service.h"
0027 #include "CommonTools/UtilAlgos/interface/TFileService.h"
0028 #include "TTree.h"
0029 #include "TVector2.h"
0030 
0031 #include "DataFormats/Math/interface/deltaR.h"
0032 
0033 #include "DataFormats/HepMCCandidate/interface/GenParticleFwd.h"
0034 #include "DataFormats/HepMCCandidate/interface/GenParticle.h"
0035 
0036 #include "RecoEcal/EgammaCoreTools/interface/Mustache.h"
0037 #include "CondFormats/EcalObjects/interface/EcalMustacheSCParameters.h"
0038 #include "CondFormats/DataRecord/interface/EcalMustacheSCParametersRcd.h"
0039 #include "CondFormats/EcalObjects/interface/EcalSCDynamicDPhiParameters.h"
0040 #include "CondFormats/DataRecord/interface/EcalSCDynamicDPhiParametersRcd.h"
0041 namespace MK = reco::MustacheKernel;
0042 
0043 #include "RecoParticleFlow/PFClusterTools/interface/PFEnergyCalibration.h"
0044 
0045 #include <algorithm>
0046 #include <memory>
0047 
0048 typedef edm::ParameterSet PSet;
0049 
0050 namespace {
0051   template <typename T>
0052   void array_deleter(T* arr) {
0053     delete[] arr;
0054   }
0055 
0056   struct GetSharedRecHitFraction {
0057     const edm::Ptr<reco::CaloCluster> the_seed;
0058     double x_rechits_tot, x_rechits_match;
0059     GetSharedRecHitFraction(const edm::Ptr<reco::CaloCluster>& s) : the_seed(s) {}
0060     double operator()(const edm::Ptr<reco::CaloCluster>& x) {
0061       // now see if the clusters overlap in rechits
0062       const auto& seedHitsAndFractions = the_seed->hitsAndFractions();
0063       const auto& xHitsAndFractions = x->hitsAndFractions();
0064       x_rechits_tot = xHitsAndFractions.size();
0065       x_rechits_match = 0.0;
0066       for (const std::pair<DetId, float>& seedHit : seedHitsAndFractions) {
0067         for (const std::pair<DetId, float>& xHit : xHitsAndFractions) {
0068           if (seedHit.first == xHit.first) {
0069             x_rechits_match += 1.0;
0070           }
0071         }
0072       }
0073       return x_rechits_match / x_rechits_tot;
0074     }
0075   };
0076 }  // namespace
0077 
0078 class PFSuperClusterTreeMaker : public edm::one::EDAnalyzer<edm::one::SharedResources> {
0079   typedef TTree* treeptr;
0080 
0081 public:
0082   PFSuperClusterTreeMaker(const PSet&);
0083   ~PFSuperClusterTreeMaker() override = default;
0084   void analyze(const edm::Event&, const edm::EventSetup&) override;
0085 
0086 private:
0087   bool _dogen;
0088   edm::InputTag _geninput;
0089   edm::InputTag _vtxsrc;
0090   bool _readEB, _readEE;
0091   edm::InputTag _scInputEB, _scInputEE;
0092   std::shared_ptr<PFEnergyCalibration> _calib;
0093   std::map<reco::SuperClusterRef, reco::GenParticleRef> _genmatched;
0094   void findBestGenMatches(const edm::Event& e, const edm::Handle<reco::SuperClusterCollection>& scs);
0095   void processSuperClusterFillTree(const edm::Event&, const reco::SuperClusterRef&);
0096 
0097   // SC parameters
0098   edm::ESGetToken<EcalMustacheSCParameters, EcalMustacheSCParametersRcd> ecalMustacheSCParametersToken_;
0099   const EcalMustacheSCParameters* mustacheSCParams_;
0100   edm::ESGetToken<EcalSCDynamicDPhiParameters, EcalSCDynamicDPhiParametersRcd> ecalSCDynamicDPhiParametersToken_;
0101   const EcalSCDynamicDPhiParameters* scDynamicDPhiParams_;
0102 
0103   // the tree
0104   void setTreeArraysForSize(const size_t N_ECAL, const size_t N_PS);
0105   treeptr _tree;
0106   Int_t nVtx;
0107   Float_t scRawEnergy, scCalibratedEnergy, scPreshowerEnergy, scEta, scPhi, scR, scPhiWidth, scEtaWidth,
0108       scSeedRawEnergy, scSeedCalibratedEnergy, scSeedEta, scSeedPhi;
0109   Float_t genEnergy, genEta, genPhi, genDRToCentroid, genDRToSeed;
0110   Int_t N_ECALClusters;
0111   std::shared_ptr<Float_t> clusterRawEnergy, clusterCalibEnergy, clusterEta, clusterPhi, clusterDPhiToSeed,
0112       clusterDEtaToSeed, clusterDPhiToCentroid, clusterDEtaToCentroid, clusterDPhiToGen, clusterDEtaToGen,
0113       clusterHitFractionSharedWithSeed;
0114   std::shared_ptr<Int_t> clusterInMustache, clusterInDynDPhi;
0115   Int_t N_PSClusters;
0116   std::shared_ptr<Float_t> psClusterRawEnergy, psClusterEta, psClusterPhi;
0117 };
0118 
0119 void PFSuperClusterTreeMaker::analyze(const edm::Event& e, const edm::EventSetup& es) {
0120   mustacheSCParams_ = &es.getData(ecalMustacheSCParametersToken_);
0121   scDynamicDPhiParams_ = &es.getData(ecalSCDynamicDPhiParametersToken_);
0122 
0123   edm::Handle<reco::VertexCollection> vtcs;
0124   e.getByLabel(_vtxsrc, vtcs);
0125   if (vtcs.isValid())
0126     nVtx = vtcs->size();
0127   else
0128     nVtx = -1;
0129 
0130   edm::Handle<reco::SuperClusterCollection> ebSCs, eeSCs;
0131   if (_readEB)
0132     e.getByLabel(_scInputEB, ebSCs);
0133   if (_readEE)
0134     e.getByLabel(_scInputEE, eeSCs);
0135 
0136   if (ebSCs.isValid()) {
0137     findBestGenMatches(e, ebSCs);
0138     for (size_t i = 0; i < ebSCs->size(); ++i) {
0139       processSuperClusterFillTree(e, reco::SuperClusterRef(ebSCs, i));
0140     }
0141   }
0142 
0143   if (eeSCs.isValid()) {
0144     findBestGenMatches(e, eeSCs);
0145     for (size_t i = 0; i < eeSCs->size(); ++i) {
0146       processSuperClusterFillTree(e, reco::SuperClusterRef(eeSCs, i));
0147     }
0148   }
0149 }
0150 
0151 void PFSuperClusterTreeMaker::findBestGenMatches(const edm::Event& e,
0152                                                  const edm::Handle<reco::SuperClusterCollection>& scs) {
0153   _genmatched.clear();
0154   reco::GenParticleRef genmatch;
0155   // gen information (if needed)
0156   if (_dogen) {
0157     edm::Handle<reco::GenParticleCollection> genp;
0158     std::vector<reco::GenParticleRef> elesandphos;
0159     e.getByLabel(_geninput, genp);
0160     if (genp.isValid()) {
0161       reco::GenParticleRef bestmatch;
0162       for (size_t i = 0; i < genp->size(); ++i) {
0163         const int pdgid = std::abs(genp->at(i).pdgId());
0164         if (pdgid == 22 || pdgid == 11) {
0165           elesandphos.push_back(reco::GenParticleRef(genp, i));
0166         }
0167       }
0168       for (size_t i = 0; i < elesandphos.size(); ++i) {
0169         double dE_min = -1;
0170         reco::SuperClusterRef bestmatch;
0171         for (size_t k = 0; k < scs->size(); ++k) {
0172           if (reco::deltaR(scs->at(k), *elesandphos[i]) < 0.3) {
0173             double dE = std::abs(scs->at(k).energy() - elesandphos[i]->energy());
0174             if (dE_min == -1 || dE < dE_min) {
0175               dE_min = dE;
0176               bestmatch = reco::SuperClusterRef(scs, k);
0177             }
0178           }
0179         }
0180         _genmatched[bestmatch] = elesandphos[i];
0181       }
0182     } else {
0183       throw cms::Exception("PFSuperClusterTreeMaker")
0184           << "Requested generator level information was not available!" << std::endl;
0185     }
0186   }
0187 }
0188 
0189 void PFSuperClusterTreeMaker::processSuperClusterFillTree(const edm::Event& e, const reco::SuperClusterRef& sc) {
0190   const int N_ECAL = sc->clustersSize();
0191   const int N_PS = sc->preshowerClustersSize();
0192   const double sc_eta = std::abs(sc->position().Eta());
0193   const double sc_cosheta = std::cosh(sc_eta);
0194   const double sc_pt = sc->rawEnergy() / sc_cosheta;
0195   if (!std::distance(sc->clustersBegin(), sc->clustersEnd()))
0196     return;
0197   if ((sc_pt < 3.0 && sc_eta < 2.0) || (sc_pt < 4.0 && sc_eta < 2.5 && sc_eta > 2.0) || (sc_pt < 6.0 && sc_eta > 2.5))
0198     return;
0199   N_ECALClusters = std::max(0, N_ECAL - 1);  // minus 1 because of seed
0200   N_PSClusters = N_PS;
0201   // gen information (if needed)
0202   reco::GenParticleRef genmatch;
0203   if (_dogen) {
0204     std::map<reco::SuperClusterRef, reco::GenParticleRef>::iterator itrmatch;
0205     if ((itrmatch = _genmatched.find(sc)) != _genmatched.end()) {
0206       genmatch = itrmatch->second;
0207       genEnergy = genmatch->energy();
0208       genEta = genmatch->eta();
0209       genPhi = genmatch->phi();
0210       genDRToCentroid = reco::deltaR(*sc, *genmatch);
0211       genDRToSeed = reco::deltaR(*genmatch, **(sc->clustersBegin()));
0212     } else {
0213       genEnergy = -1.0;
0214       genEta = 999.0;
0215       genPhi = 999.0;
0216       genDRToCentroid = 999.0;
0217       genDRToSeed = 999.0;
0218     }
0219   }
0220   // supercluster information
0221   setTreeArraysForSize(N_ECALClusters, N_PSClusters);
0222   scRawEnergy = sc->rawEnergy();
0223   scCalibratedEnergy = sc->energy();
0224   scPreshowerEnergy = sc->preshowerEnergy();
0225   scEta = sc->position().Eta();
0226   scPhi = sc->position().Phi();
0227   scR = sc->position().R();
0228   scPhiWidth = sc->phiWidth();
0229   scEtaWidth = sc->etaWidth();
0230   // sc seed information
0231   bool sc_is_pf = false;
0232   edm::Ptr<reco::CaloCluster> theseed = sc->seed();
0233   reco::CaloCluster_iterator startCluster = sc->clustersBegin();
0234   if (theseed.isNull() || !theseed.isAvailable()) {
0235     edm::Ptr<reco::CaloCluster> theseed = *(startCluster++);
0236   }
0237   edm::Ptr<reco::PFCluster> seedasPF = edm::Ptr<reco::PFCluster>(theseed);
0238   if (seedasPF.isNonnull() && seedasPF.isAvailable())
0239     sc_is_pf = true;
0240   GetSharedRecHitFraction fractionOfSeed(theseed);
0241   scSeedRawEnergy = theseed->energy();
0242   if (sc_is_pf) {
0243     scSeedCalibratedEnergy = _calib->energyEm(*seedasPF, 0.0, 0.0, false);
0244   } else {
0245     scSeedCalibratedEnergy = theseed->energy();
0246   }
0247   scSeedEta = theseed->eta();
0248   scSeedPhi = theseed->phi();
0249   // loop over all clusters that aren't the seed
0250   auto clusend = sc->clustersEnd();
0251   size_t iclus = 0;
0252   edm::Ptr<reco::PFCluster> pclus;
0253   for (auto clus = startCluster; clus != clusend; ++clus) {
0254     if (theseed == *clus)
0255       continue;
0256     clusterRawEnergy.get()[iclus] = (*clus)->energy();
0257     if (sc_is_pf) {
0258       pclus = edm::Ptr<reco::PFCluster>(*clus);
0259       clusterCalibEnergy.get()[iclus] = _calib->energyEm(*pclus, 0.0, 0.0, false);
0260     } else {
0261       clusterCalibEnergy.get()[iclus] = (*clus)->energy();
0262     }
0263     clusterEta.get()[iclus] = (*clus)->eta();
0264     clusterPhi.get()[iclus] = (*clus)->phi();
0265     clusterDPhiToSeed.get()[iclus] = TVector2::Phi_mpi_pi((*clus)->phi() - theseed->phi());
0266     clusterDEtaToSeed.get()[iclus] = (*clus)->eta() - theseed->eta();
0267     clusterDPhiToCentroid.get()[iclus] = TVector2::Phi_mpi_pi((*clus)->phi() - sc->phi());
0268     clusterDEtaToCentroid.get()[iclus] = (*clus)->eta() - sc->eta();
0269     clusterDPhiToCentroid.get()[iclus] = TVector2::Phi_mpi_pi((*clus)->phi() - sc->phi());
0270     clusterDEtaToCentroid.get()[iclus] = (*clus)->eta() - sc->eta();
0271     clusterHitFractionSharedWithSeed.get()[iclus] = fractionOfSeed(*clus);
0272     if (_dogen && genmatch.isNonnull()) {
0273       clusterDPhiToGen.get()[iclus] = TVector2::Phi_mpi_pi((*clus)->phi() - genmatch->phi());
0274       clusterDEtaToGen.get()[iclus] = (*clus)->eta() - genmatch->eta();
0275     }
0276     clusterInMustache.get()[iclus] = (Int_t)MK::inMustache(
0277         mustacheSCParams_, theseed->eta(), theseed->phi(), (*clus)->energy(), (*clus)->eta(), (*clus)->phi());
0278 
0279     clusterInDynDPhi.get()[iclus] = (Int_t)MK::inDynamicDPhiWindow(
0280         scDynamicDPhiParams_, theseed->eta(), theseed->phi(), (*clus)->energy(), (*clus)->eta(), (*clus)->phi());
0281     ++iclus;
0282   }
0283   // loop over all preshower clusters
0284   auto psclusend = sc->preshowerClustersEnd();
0285   size_t ipsclus = 0;
0286   edm::Ptr<reco::CaloCluster> ppsclus;
0287   for (auto psclus = sc->preshowerClustersBegin(); psclus != psclusend; ++psclus) {
0288     ppsclus = edm::Ptr<reco::CaloCluster>(*psclus);
0289     psClusterRawEnergy.get()[ipsclus] = ppsclus->energy();
0290     psClusterEta.get()[ipsclus] = ppsclus->eta();
0291     psClusterPhi.get()[ipsclus] = ppsclus->phi();
0292     ++ipsclus;
0293   }
0294   _tree->Fill();
0295 }
0296 
0297 PFSuperClusterTreeMaker::PFSuperClusterTreeMaker(const PSet& p) {
0298   usesResource("TFileService");
0299   ecalMustacheSCParametersToken_ = esConsumes<EcalMustacheSCParameters, EcalMustacheSCParametersRcd>();
0300   ecalSCDynamicDPhiParametersToken_ = esConsumes<EcalSCDynamicDPhiParameters, EcalSCDynamicDPhiParametersRcd>();
0301 
0302   _calib.reset(new PFEnergyCalibration());
0303   N_ECALClusters = 1;
0304   N_PSClusters = 1;
0305   edm::Service<TFileService> fs;
0306   _tree = fs->make<TTree>("SuperClusterTree", "Dump of all available SC info");
0307   _tree->Branch("N_ECALClusters", &N_ECALClusters, "N_ECALClusters/I");
0308   _tree->Branch("N_PSClusters", &N_PSClusters, "N_PSClusters/I");
0309   _tree->Branch("nVtx", &nVtx, "nVtx/I");
0310   _tree->Branch("scRawEnergy", &scRawEnergy, "scRawEnergy/F");
0311   _tree->Branch("scCalibratedEnergy", &scCalibratedEnergy, "scCalibratedEnergy/F");
0312   _tree->Branch("scPreshowerEnergy", &scPreshowerEnergy, "scPreshowerEnergy/F");
0313   _tree->Branch("scEta", &scEta, "scEta/F");
0314   _tree->Branch("scPhi", &scPhi, "scPhi/F");
0315   _tree->Branch("scR", &scR, "scR/F");
0316   _tree->Branch("scPhiWidth", &scPhiWidth, "scPhiWidth/F");
0317   _tree->Branch("scEtaWidth", &scEtaWidth, "scEtaWidth/F");
0318   _tree->Branch("scSeedRawEnergy", &scSeedRawEnergy, "scSeedRawEnergy/F");
0319   _tree->Branch("scSeedCalibratedEnergy", &scSeedCalibratedEnergy, "scSeedCalibratedEnergy/F");
0320   _tree->Branch("scSeedEta", &scSeedEta, "scSeedEta/F");
0321   _tree->Branch("scSeedPhi", &scSeedPhi, "scSeedPhi/F");
0322   // ecal cluster information
0323   clusterRawEnergy.reset(new Float_t[1], array_deleter<Float_t>);
0324   _tree->Branch("clusterRawEnergy", clusterRawEnergy.get(), "clusterRawEnergy[N_ECALClusters]/F");
0325   clusterCalibEnergy.reset(new Float_t[1], array_deleter<Float_t>);
0326   _tree->Branch("clusterCalibEnergy", clusterCalibEnergy.get(), "clusterCalibEnergy[N_ECALClusters]/F");
0327   clusterEta.reset(new Float_t[1], array_deleter<Float_t>);
0328   _tree->Branch("clusterEta", clusterEta.get(), "clusterEta[N_ECALClusters]/F");
0329   clusterPhi.reset(new Float_t[1], array_deleter<Float_t>);
0330   _tree->Branch("clusterPhi", clusterPhi.get(), "clusterPhi[N_ECALClusters]/F");
0331   clusterDPhiToSeed.reset(new Float_t[1], array_deleter<Float_t>);
0332   _tree->Branch("clusterDPhiToSeed", clusterDPhiToSeed.get(), "clusterDPhiToSeed[N_ECALClusters]/F");
0333   clusterDEtaToSeed.reset(new Float_t[1], array_deleter<Float_t>);
0334   _tree->Branch("clusterDEtaToSeed", clusterDEtaToSeed.get(), "clusterDEtaToSeed[N_ECALClusters]/F");
0335   clusterDPhiToCentroid.reset(new Float_t[1], array_deleter<Float_t>);
0336   _tree->Branch("clusterDPhiToCentroid", clusterDPhiToCentroid.get(), "clusterDPhiToCentroid[N_ECALClusters]/F");
0337   clusterDEtaToCentroid.reset(new Float_t[1], array_deleter<Float_t>);
0338   _tree->Branch("clusterDEtaToCentroid", clusterDEtaToCentroid.get(), "clusterDEtaToCentroid[N_ECALClusters]/F");
0339   clusterHitFractionSharedWithSeed.reset(new Float_t[1], array_deleter<Float_t>);
0340   _tree->Branch("clusterHitFractionSharedWithSeed",
0341                 clusterHitFractionSharedWithSeed.get(),
0342                 "clusterHitFractionSharedWithSeed[N_ECALClusters]/F");
0343   clusterInMustache.reset(new Int_t[1], array_deleter<Int_t>);
0344   _tree->Branch("clusterInMustache", clusterInMustache.get(), "clusterInMustache[N_ECALClusters]/I");
0345   clusterInDynDPhi.reset(new Int_t[1], array_deleter<Int_t>);
0346   _tree->Branch("clusterInDynDPhi", clusterInDynDPhi.get(), "clusterInDynDPhi[N_ECALClusters]/I");
0347   // preshower information
0348   psClusterRawEnergy.reset(new Float_t[1], array_deleter<Float_t>);
0349   _tree->Branch("psClusterRawEnergy", psClusterRawEnergy.get(), "psClusterRawEnergy[N_PSClusters]/F");
0350   psClusterEta.reset(new Float_t[1], array_deleter<Float_t>);
0351   _tree->Branch("psClusterEta", psClusterEta.get(), "psClusterEta[N_PSClusters]/F");
0352   psClusterPhi.reset(new Float_t[1], array_deleter<Float_t>);
0353   _tree->Branch("psClusterPhi", psClusterPhi.get(), "psClusterPhi[N_PSClusters]/F");
0354 
0355   if ((_dogen = p.getUntrackedParameter<bool>("doGen", false))) {
0356     _geninput = p.getParameter<edm::InputTag>("genSrc");
0357     _tree->Branch("genEta", &genEta, "genEta/F");
0358     _tree->Branch("genPhi", &genPhi, "genPhi/F");
0359     _tree->Branch("genEnergy", &genEnergy, "genEnergy/F");
0360     _tree->Branch("genDRToCentroid", &genDRToCentroid, "genDRToCentroid/F");
0361     _tree->Branch("genDRToSeed", &genDRToSeed, "genDRToSeed/F");
0362 
0363     clusterDPhiToGen.reset(new Float_t[1], array_deleter<Float_t>);
0364     _tree->Branch("clusterDPhiToGen", clusterDPhiToGen.get(), "clusterDPhiToGen[N_ECALClusters]/F");
0365     clusterDEtaToGen.reset(new Float_t[1], array_deleter<Float_t>);
0366     _tree->Branch("clusterDEtaToGen", clusterDEtaToGen.get(), "clusterDPhiToGen[N_ECALClusters]/F");
0367   }
0368   _vtxsrc = p.getParameter<edm::InputTag>("primaryVertices");
0369 
0370   _readEB = _readEE = false;
0371   if (p.existsAs<edm::InputTag>("superClusterSrcEB")) {
0372     _readEB = true;
0373     _scInputEB = p.getParameter<edm::InputTag>("superClusterSrcEB");
0374   }
0375   if (p.existsAs<edm::InputTag>("superClusterSrcEE")) {
0376     _readEE = true;
0377     _scInputEE = p.getParameter<edm::InputTag>("superClusterSrcEE");
0378   }
0379 }
0380 
0381 void PFSuperClusterTreeMaker::setTreeArraysForSize(const size_t N_ECAL, const size_t N_PS) {
0382   Float_t* cRE_new = new Float_t[N_ECAL];
0383   clusterRawEnergy.reset(cRE_new, array_deleter<Float_t>);
0384   _tree->GetBranch("clusterRawEnergy")->SetAddress(clusterRawEnergy.get());
0385   Float_t* cCE_new = new Float_t[N_ECAL];
0386   clusterCalibEnergy.reset(cCE_new, array_deleter<Float_t>);
0387   _tree->GetBranch("clusterCalibEnergy")->SetAddress(clusterCalibEnergy.get());
0388   Float_t* cEta_new = new Float_t[N_ECAL];
0389   clusterEta.reset(cEta_new, array_deleter<Float_t>);
0390   _tree->GetBranch("clusterEta")->SetAddress(clusterEta.get());
0391   Float_t* cPhi_new = new Float_t[N_ECAL];
0392   clusterPhi.reset(cPhi_new, array_deleter<Float_t>);
0393   _tree->GetBranch("clusterPhi")->SetAddress(clusterPhi.get());
0394   Float_t* cDPhiSeed_new = new Float_t[N_ECAL];
0395   clusterDPhiToSeed.reset(cDPhiSeed_new, array_deleter<Float_t>);
0396   _tree->GetBranch("clusterDPhiToSeed")->SetAddress(clusterDPhiToSeed.get());
0397   Float_t* cDEtaSeed_new = new Float_t[N_ECAL];
0398   clusterDEtaToSeed.reset(cDEtaSeed_new, array_deleter<Float_t>);
0399   _tree->GetBranch("clusterDEtaToSeed")->SetAddress(clusterDEtaToSeed.get());
0400   Float_t* cDPhiCntr_new = new Float_t[N_ECAL];
0401   clusterDPhiToCentroid.reset(cDPhiCntr_new, array_deleter<Float_t>);
0402   _tree->GetBranch("clusterDPhiToCentroid")->SetAddress(clusterDPhiToCentroid.get());
0403   Float_t* cDEtaCntr_new = new Float_t[N_ECAL];
0404   clusterDEtaToCentroid.reset(cDEtaCntr_new, array_deleter<Float_t>);
0405   _tree->GetBranch("clusterDEtaToCentroid")->SetAddress(clusterDEtaToCentroid.get());
0406   Float_t* cHitFracShared_new = new Float_t[N_ECAL];
0407   clusterHitFractionSharedWithSeed.reset(cHitFracShared_new, array_deleter<Float_t>);
0408   _tree->GetBranch("clusterHitFractionSharedWithSeed")->SetAddress(clusterHitFractionSharedWithSeed.get());
0409 
0410   if (_dogen) {
0411     Float_t* cDPhiGen_new = new Float_t[N_ECAL];
0412     clusterDPhiToGen.reset(cDPhiGen_new, array_deleter<Float_t>);
0413     _tree->GetBranch("clusterDPhiToGen")->SetAddress(clusterDPhiToGen.get());
0414     Float_t* cDEtaGen_new = new Float_t[N_ECAL];
0415     clusterDEtaToGen.reset(cDEtaGen_new, array_deleter<Float_t>);
0416     _tree->GetBranch("clusterDEtaToGen")->SetAddress(clusterDEtaToGen.get());
0417   }
0418   Int_t* cInMust_new = new Int_t[N_ECAL];
0419   clusterInMustache.reset(cInMust_new, array_deleter<Int_t>);
0420   _tree->GetBranch("clusterInMustache")->SetAddress(clusterInMustache.get());
0421   Int_t* cInDynDPhi_new = new Int_t[N_ECAL];
0422   clusterInDynDPhi.reset(cInDynDPhi_new, array_deleter<Int_t>);
0423   _tree->GetBranch("clusterInDynDPhi")->SetAddress(clusterInDynDPhi.get());
0424   Float_t* psRE_new = new Float_t[N_PS];
0425   psClusterRawEnergy.reset(psRE_new, array_deleter<Float_t>);
0426   _tree->GetBranch("psClusterRawEnergy")->SetAddress(psClusterRawEnergy.get());
0427   Float_t* psEta_new = new Float_t[N_PS];
0428   psClusterEta.reset(psEta_new, array_deleter<Float_t>);
0429   _tree->GetBranch("psClusterEta")->SetAddress(psClusterEta.get());
0430   Float_t* psPhi_new = new Float_t[N_PS];
0431   psClusterPhi.reset(psPhi_new, array_deleter<Float_t>);
0432   _tree->GetBranch("psClusterPhi")->SetAddress(psClusterPhi.get());
0433 }
0434 
0435 #include "FWCore/Framework/interface/MakerMacros.h"
0436 DEFINE_FWK_MODULE(PFSuperClusterTreeMaker);