Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-09-08 23:51:48

0001 // -*- C++ -*-
0002 //
0003 // Package: TauSpinnerInterface
0004 // Class: TauSpinnerCMS
0005 //
0006 /**\class TauSpinnerCMS TauSpinnerCMS.cc
0007 
0008  */
0009 //
0010 // Original Author: Ian Nugent
0011 // Created: Fri Feb 15 2013
0012 
0013 #ifndef TauSpinnerCMS_h
0014 #define TauSpinnerCMS_h
0015 
0016 #include <iostream>
0017 
0018 #include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h"
0019 
0020 // essentials !!!
0021 #include "FWCore/Framework/interface/Event.h"
0022 #include "DataFormats/Common/interface/Handle.h"
0023 #include "FWCore/Framework/interface/MakerMacros.h"
0024 
0025 #include "FWCore/ServiceRegistry/interface/Service.h"
0026 #include "CommonTools/UtilAlgos/interface/TFileService.h"
0027 #include "TH1.h"
0028 
0029 #include "FWCore/Concurrency/interface/SharedResourceNames.h"
0030 //#include "FWCore/Framework/interface/one/EDFilter.h"
0031 #include "FWCore/Framework/interface/one/EDProducer.h"
0032 #include "FWCore/Framework/interface/Event.h"
0033 #include "FWCore/Framework/interface/EventSetup.h"
0034 #include "FWCore/Framework/interface/FileBlock.h"
0035 #include "FWCore/Framework/interface/LuminosityBlock.h"
0036 #include "FWCore/Framework/interface/MakerMacros.h"
0037 #include "FWCore/Framework/interface/Run.h"
0038 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0039 #include "FWCore/ServiceRegistry/interface/RandomEngineSentry.h"
0040 #include "FWCore/Utilities/interface/EDMException.h"
0041 
0042 #include "DataFormats/HepMCCandidate/interface/GenParticle.h"
0043 #include "DataFormats/HepMCCandidate/interface/GenParticleFwd.h"
0044 #include "TauSpinner/SimpleParticle.h"
0045 
0046 #include "FWCore/Utilities/interface/RandomNumberGenerator.h"
0047 
0048 class TauSpinnerCMS : public edm::one::EDProducer<edm::one::SharedResources> {
0049 public:
0050   explicit TauSpinnerCMS(const edm::ParameterSet &);
0051   ~TauSpinnerCMS() override {}  // no need to delete ROOT stuff
0052 
0053   void produce(edm::Event &, const edm::EventSetup &) final;
0054   void beginJob() final;
0055   void endJob() final;
0056   static double flat();
0057   void setRandomEngine(CLHEP::HepRandomEngine *v) { fRandomEngine = v; }
0058   virtual void initialize();
0059 
0060 private:
0061   bool isReco_;
0062   bool isTauolaConfigured_;
0063   bool isLHPDFConfigured_;
0064   std::string LHAPDFname_;
0065   double CMSEnergy_;
0066   edm::InputTag gensrc_;
0067   int MotherPDGID_, Ipol_, nonSM2_, nonSMN_;
0068   static bool isTauSpinnerConfigure;
0069 
0070   // Additional funtionms for Reco (not provided by Tauola/TauSpinner authors)
0071   int readParticlesfromReco(edm::Event &e,
0072                             TauSpinner::SimpleParticle &X,
0073                             TauSpinner::SimpleParticle &tau,
0074                             TauSpinner::SimpleParticle &tau2,
0075                             std::vector<TauSpinner::SimpleParticle> &tau_daughters,
0076                             std::vector<TauSpinner::SimpleParticle> &tau2_daughters);
0077   void GetLastSelf(const reco::GenParticle *Particle);
0078   void GetRecoDaughters(const reco::GenParticle *Particle,
0079                         std::vector<TauSpinner::SimpleParticle> &daughters,
0080                         int parentpdgid);
0081   bool isFirst(const reco::GenParticle *Particle);
0082   double roundOff_;
0083 
0084   static CLHEP::HepRandomEngine *fRandomEngine;
0085   edm::EDGetTokenT<edm::HepMCProduct> hepmcCollectionToken_;
0086   edm::EDGetTokenT<reco::GenParticleCollection> GenParticleCollectionToken_;
0087   static bool fInitialized;
0088 };
0089 #endif