File indexing completed on 2024-04-06 12:25:31
0001 #ifndef JetMatchingTools_h
0002 #define JetMatchingTools_h
0003
0004 #include <vector>
0005
0006 #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
0007 #include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h"
0008 #include "DataFormats/CaloTowers/interface/CaloTowerCollection.h"
0009 #include "SimDataFormats/CaloHit/interface/PCaloHitContainer.h"
0010 #include "SimDataFormats/Vertex/interface/SimVertexContainer.h"
0011 #include "SimDataFormats/Track/interface/SimTrackContainer.h"
0012 #include "DataFormats/HepMCCandidate/interface/GenParticle.h"
0013 #include "FWCore/Framework/interface/ConsumesCollector.h"
0014
0015 namespace edm {
0016 class Event;
0017 }
0018 namespace reco {
0019 class CaloJet;
0020 class GenJet;
0021 }
0022
0023 class CaloTower;
0024 class CaloRecHit;
0025 class DetId;
0026 class PCaloHit;
0027
0028 class JetMatchingTools {
0029 public:
0030 struct JetConstituent {
0031 DetId id;
0032 double energy;
0033
0034 JetConstituent() {}
0035 ~JetConstituent() {}
0036 JetConstituent(const JetConstituent& j) : id(j.id), energy(j.energy) {}
0037 JetConstituent(const EcalRecHit& ehit) : id(ehit.detid()), energy(ehit.energy()) {}
0038 JetConstituent(const CaloRecHit& ehit) : id(ehit.detid()), energy(ehit.energy()) {}
0039 };
0040
0041 JetMatchingTools(const edm::Event& fEvent, edm::ConsumesCollector&& iC);
0042 ~JetMatchingTools();
0043
0044
0045 std::vector<const CaloTower*> getConstituents(const reco::CaloJet& fJet);
0046
0047 std::vector<JetConstituent> getConstituentHits(const CaloTower& fTower);
0048
0049 std::vector<DetId> getConstituentIds(const CaloTower& fTower);
0050
0051 std::vector<const PCaloHit*> getPCaloHits(DetId fId);
0052
0053 int getTrackId(const PCaloHit& fHit);
0054
0055 const SimTrack* getTrack(unsigned fSimTrackId);
0056
0057 int generatorId(unsigned fSimTrackId);
0058
0059 const reco::GenParticle* getGenParticle(int fGeneratorId);
0060
0061 std::vector<const reco::GenParticle*> getGenParticles(const reco::CaloJet& fJet, bool fVerbose = true);
0062
0063 std::vector<const reco::GenParticle*> getGenParticles(const reco::GenJet& fJet);
0064
0065
0066
0067 std::vector<const PCaloHit*> getPCaloHits(int fGeneratorId);
0068
0069 std::vector<const CaloTower*> getCaloTowers(int fGeneratorId);
0070
0071
0072 double lostEnergyFraction(const reco::CaloJet& fJet);
0073
0074
0075 double overlapEnergyFraction(const std::vector<const reco::GenParticle*>& fObject,
0076 const std::vector<const reco::GenParticle*>& fReference) const;
0077
0078 const EBRecHitCollection* getEBRecHitCollection();
0079 const EERecHitCollection* getEERecHitCollection();
0080 const HBHERecHitCollection* getHBHERecHitCollection();
0081 const HORecHitCollection* getHORecHitCollection();
0082 const HFRecHitCollection* getHFRecHitCollection();
0083 const edm::PCaloHitContainer* getEBSimHitCollection();
0084 const edm::PCaloHitContainer* getEESimHitCollection();
0085 const edm::PCaloHitContainer* getHcalSimHitCollection();
0086 const edm::SimTrackContainer* getSimTrackCollection();
0087 const edm::SimVertexContainer* getSimVertexCollection();
0088 const reco::CandidateCollection* getGenParticlesCollection();
0089
0090 private:
0091 const edm::Event* mEvent;
0092 const EBRecHitCollection* mEBRecHitCollection;
0093 const EERecHitCollection* mEERecHitCollection;
0094 const HBHERecHitCollection* mHBHERecHitCollection;
0095 const HORecHitCollection* mHORecHitCollection;
0096 const HFRecHitCollection* mHFRecHitCollection;
0097 const edm::PCaloHitContainer* mEBSimHitCollection;
0098 const edm::PCaloHitContainer* mEESimHitCollection;
0099 const edm::PCaloHitContainer* mHcalSimHitCollection;
0100 const edm::SimTrackContainer* mSimTrackCollection;
0101 const edm::SimVertexContainer* mSimVertexCollection;
0102 const reco::CandidateCollection* mGenParticleCollection;
0103
0104 edm::EDGetTokenT<EBRecHitCollection> input_ebrechits_token_;
0105 edm::EDGetTokenT<EERecHitCollection> input_eerechits_token_;
0106 edm::EDGetTokenT<HBHERecHitCollection> input_hbherechits_token_;
0107 edm::EDGetTokenT<HORecHitCollection> input_horechits_token_;
0108 edm::EDGetTokenT<HFRecHitCollection> input_hfrechits_token_;
0109 edm::EDGetTokenT<edm::PCaloHitContainer> input_pcalohits_eecal_token_;
0110 edm::EDGetTokenT<edm::PCaloHitContainer> input_pcalohits_ebcal_token_;
0111 edm::EDGetTokenT<edm::PCaloHitContainer> input_pcalohits_hcal_token_;
0112 edm::EDGetTokenT<edm::SimTrackContainer> input_simtrack_token_;
0113 edm::EDGetTokenT<edm::SimVertexContainer> input_simvertex_token_;
0114 edm::EDGetTokenT<reco::CandidateCollection> input_cands_token_;
0115 };
0116
0117 #endif