File indexing completed on 2024-04-06 12:13:41
0001 #ifndef PythiaFilterIsolatedTrack_h
0002 #define PythiaFilterIsolatedTrack_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018 #include <atomic>
0019 #include <memory>
0020
0021
0022 #include "TH1F.h"
0023
0024
0025 #include "FWCore/Framework/interface/Frameworkfwd.h"
0026 #include "FWCore/Framework/interface/stream/EDFilter.h"
0027
0028 #include "FWCore/Framework/interface/Event.h"
0029 #include "FWCore/Framework/interface/MakerMacros.h"
0030
0031 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0032
0033 #include "FWCore/ServiceRegistry/interface/Service.h"
0034 #include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h"
0035
0036 #include "SimGeneral/HepPDTRecord/interface/ParticleDataTable.h"
0037
0038 namespace PythiaFilterIsoTracks {
0039 struct Counters {
0040 Counters() : nAll_(0), nGood_(0) {}
0041 mutable std::atomic<unsigned int> nAll_, nGood_;
0042 };
0043 }
0044
0045 class PythiaFilterIsolatedTrack : public edm::stream::EDFilter<edm::GlobalCache<PythiaFilterIsoTracks::Counters> > {
0046 public:
0047 explicit PythiaFilterIsolatedTrack(const edm::ParameterSet&, const PythiaFilterIsoTracks::Counters* count);
0048 ~PythiaFilterIsolatedTrack() override;
0049
0050 static std::unique_ptr<PythiaFilterIsoTracks::Counters> initializeGlobalCache(edm::ParameterSet const&) {
0051 return std::make_unique<PythiaFilterIsoTracks::Counters>();
0052 }
0053
0054 bool filter(edm::Event&, edm::EventSetup const&) override;
0055 void endStream() override;
0056 static void globalEndJob(const PythiaFilterIsoTracks::Counters* counters);
0057
0058
0059 std::pair<double, double> GetEtaPhiAtEcal(double etaIP, double phiIP, double pT, int charge, double vtxZ);
0060 double getDistInCM(double eta1, double phi1, double eta2, double phi2);
0061
0062 private:
0063
0064 const edm::EDGetTokenT<edm::HepMCProduct> token_;
0065 const double maxSeedEta_;
0066 const double minSeedEta_;
0067 const double minSeedMom_;
0068 const double minIsolTrackMom_;
0069 const double isolCone_;
0070 const bool onlyHadrons_;
0071
0072 unsigned int nAll_, nGood_;
0073 double ecDist_;
0074 double ecRad_;
0075
0076 edm::ESGetToken<HepPDT::ParticleDataTable, PDTRecord> pdt_;
0077 };
0078 #endif