Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2025-04-04 01:26:40

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/AbstractServices/interface/RandomNumberGenerator.h"
0030 #include "FWCore/Concurrency/interface/SharedResourceNames.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 class TauSpinnerCMS : public edm::one::EDProducer<edm::one::SharedResources> {
0047 public:
0048   explicit TauSpinnerCMS(const edm::ParameterSet &);
0049   ~TauSpinnerCMS() override {}  // no need to delete ROOT stuff
0050 
0051   void produce(edm::Event &, const edm::EventSetup &) final;
0052   void beginJob() final;
0053   void endJob() final;
0054   static double flat();
0055   void setRandomEngine(CLHEP::HepRandomEngine *v) { fRandomEngine = v; }
0056   virtual void initialize();
0057 
0058 private:
0059   bool isReco_;
0060   bool isTauolaConfigured_;
0061   bool isLHPDFConfigured_;
0062   std::string LHAPDFname_;
0063   double CMSEnergy_;
0064   edm::InputTag gensrc_;
0065   int MotherPDGID_, Ipol_, nonSM2_, nonSMN_;
0066   static bool isTauSpinnerConfigure;
0067 
0068   // Additional funtionms for Reco (not provided by Tauola/TauSpinner authors)
0069   int readParticlesfromReco(edm::Event &e,
0070                             TauSpinner::SimpleParticle &X,
0071                             TauSpinner::SimpleParticle &tau,
0072                             TauSpinner::SimpleParticle &tau2,
0073                             std::vector<TauSpinner::SimpleParticle> &tau_daughters,
0074                             std::vector<TauSpinner::SimpleParticle> &tau2_daughters);
0075   void GetLastSelf(const reco::GenParticle *Particle);
0076   void GetRecoDaughters(const reco::GenParticle *Particle,
0077                         std::vector<TauSpinner::SimpleParticle> &daughters,
0078                         int parentpdgid);
0079   bool isFirst(const reco::GenParticle *Particle);
0080   double roundOff_;
0081 
0082   static CLHEP::HepRandomEngine *fRandomEngine;
0083   edm::EDGetTokenT<edm::HepMCProduct> hepmcCollectionToken_;
0084   edm::EDGetTokenT<reco::GenParticleCollection> GenParticleCollectionToken_;
0085   static bool fInitialized;
0086 };
0087 #endif