Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:13:41

0001 #ifndef PythiaFilterIsolatedTrack_h
0002 #define PythiaFilterIsolatedTrack_h
0003 
0004 /** \class PythiaFilterIsolatedTrack
0005  *
0006  *  PythiaFilterGammaJet filter implements generator-level preselections 
0007  *  for ChargedHadron+jet like events to be used in jet energy calibration.
0008  *  Ported from fortran code written by V.Konoplianikov.
0009  * 
0010  * \author O.Kodolova, SINP
0011  *
0012  * Cleaned up code
0013  * \author J.P. Chou, Brown University
0014  *
0015  ************************************************************/
0016 
0017 // system include files
0018 #include <atomic>
0019 #include <memory>
0020 
0021 // Root objects
0022 #include "TH1F.h"
0023 
0024 // user include files
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 }  // namespace PythiaFilterIsoTracks
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   // helper functions
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   // parameters
0064   const edm::EDGetTokenT<edm::HepMCProduct> token_;  // token to get the generated particles
0065   const double maxSeedEta_;                          // maximum eta of the isolated track seed
0066   const double minSeedEta_;                          // minimum eta of the isolated track seed
0067   const double minSeedMom_;                          // minimum momentum of the isolated track seed
0068   const double minIsolTrackMom_;                     // minimum prohibited momentum of a nearby track
0069   const double isolCone_;                            // cone size (in mm) around the seed to consider a track "nearby"
0070   const bool onlyHadrons_;                           // select only isolated hadrons
0071 
0072   unsigned int nAll_, nGood_;
0073   double ecDist_;  //distance to ECAL andcap from IP (cm)
0074   double ecRad_;   //radius of ECAL barrel (cm)
0075 
0076   edm::ESGetToken<HepPDT::ParticleDataTable, PDTRecord> pdt_;
0077 };
0078 #endif