CMS 3D CMS Logo

PythiaFilterIsolatedTrack.h
Go to the documentation of this file.
1 #ifndef PythiaFilterIsolatedTrack_h
2 #define PythiaFilterIsolatedTrack_h
3 
17 // system include files
18 #include <atomic>
19 #include <memory>
20 
21 // Root objects
22 #include "TH1F.h"
23 
24 // user include files
27 
30 
32 
35 
37  struct Counters {
38  Counters() : nAll_(0), nGood_(0) {}
39  mutable std::atomic<unsigned int> nAll_, nGood_;
40  };
41 }
42 
43 class PythiaFilterIsolatedTrack : public edm::stream::EDFilter<edm::GlobalCache<PythiaFilterIsoTracks::Counters> > {
44 
45 public:
47  ~PythiaFilterIsolatedTrack() override;
48 
49  static std::unique_ptr<PythiaFilterIsoTracks::Counters> initializeGlobalCache(edm::ParameterSet const& ) {
50  return std::unique_ptr<PythiaFilterIsoTracks::Counters>(new PythiaFilterIsoTracks::Counters());
51  }
52 
53  bool filter(edm::Event&, edm::EventSetup const&) override;
54  void endStream() override;
55  static void globalEndJob(const PythiaFilterIsoTracks::Counters* counters);
56 
57  // helper functions
58  std::pair<double,double> GetEtaPhiAtEcal(double etaIP, double phiIP, double pT, int charge, double vtxZ);
59  double getDistInCM(double eta1, double phi1, double eta2, double phi2);
60 
61 private:
62 
63  // parameters
64  edm::EDGetTokenT<edm::HepMCProduct> token_; // token to get the generated particles
65  double MaxSeedEta_; // maximum eta of the isolated track seed
66  double MinSeedMom_; // minimum momentum of the isolated track seed
67  double MinIsolTrackMom_; // minimum prohibited momentum of a nearby track
68  double IsolCone_; // cone size (in mm) around the seed to consider a track "nearby"
69  bool onlyHadrons_; // select only isolated hadrons
70 
71  unsigned int nAll_, nGood_;
72  double ecDist_; //distance to ECAL andcap from IP (cm)
73  double ecRad_; //radius of ECAL barrel (cm)
74 };
75 #endif
static std::unique_ptr< PythiaFilterIsoTracks::Counters > initializeGlobalCache(edm::ParameterSet const &)
edm::EDGetTokenT< edm::HepMCProduct > token_
std::atomic< unsigned int > nGood_