CMS 3D CMS Logo

Public Member Functions | Private Attributes

gen::ExternalDecayDriver Class Reference

#include <ExternalDecayDriver.h>

List of all members.

Public Member Functions

HepMC::GenEvent * decay (HepMC::GenEvent *)
 ExternalDecayDriver (const edm::ParameterSet &)
void init (const edm::EventSetup &)
const std::vector< int > & operatesOnParticles ()
const std::vector< std::string > & specialSettings ()
void statistics () const
 ~ExternalDecayDriver ()

Private Attributes

EvtGenInterfacefEvtGenInterface
bool fIsInitialized
std::vector< int > fPDGs
PhotosInterfacefPhotosInterface
std::vector< std::string > fSpecialSettings
TauolaInterfacefTauolaInterface

Detailed Description

Definition at line 18 of file ExternalDecayDriver.h.


Constructor & Destructor Documentation

ExternalDecayDriver::ExternalDecayDriver ( const edm::ParameterSet pset)

Definition at line 21 of file ExternalDecayDriver.cc.

References decayRandomEngine, Exception, fEvtGenInterface, fPhotosInterface, fTauolaInterface, edm::ParameterSet::getParameter(), and edm::ParameterSet::getUntrackedParameter().

   : fIsInitialized(false),
     fTauolaInterface(0),
     fEvtGenInterface(0),
     fPhotosInterface(0)
{
    
    std::vector<std::string> extGenNames =
       pset.getParameter< std::vector<std::string> >("parameterSets");

    Service<RandomNumberGenerator> rng;
    if(!rng.isAvailable()) {
       throw cms::Exception("Configuration")
       << "The RandomNumberProducer module requires the RandomNumberGeneratorService\n"
          "which appears to be absent.  Please add that service to your configuration\n"
          "or remove the modules that require it." << std::endl;
    } 
    decayRandomEngine = &rng->getEngine();   
    
    for (unsigned int ip=0; ip<extGenNames.size(); ++ip )
    {
      std::string curSet = extGenNames[ip];
      if ( curSet == "EvtGen" )
      {
         fEvtGenInterface = new gen::EvtGenInterface(pset.getUntrackedParameter< ParameterSet >(curSet));
      }
      else if ( curSet == "Tauola" )
      {
         fTauolaInterface = new gen::TauolaInterface(pset.getUntrackedParameter< ParameterSet >(curSet));
         //
         // in the future, here it should be something like:
         //
         // fTauolaInterface = TauolaInterface::getInstance();
         // fTauolaInterface->setPSet( pset.getUntrackedParameter< ParameterSet >(curSet) );
         // fPhotosInterface = new gen::PhotosInterface();
         // fPhotosInterface->avoidTauLeptonicDecays();
      }
      else if ( curSet == "Photos" )
      {
         if ( !fPhotosInterface ) fPhotosInterface = new gen::PhotosInterface();
      }

    }

}
ExternalDecayDriver::~ExternalDecayDriver ( )

Member Function Documentation

HepMC::GenEvent * ExternalDecayDriver::decay ( HepMC::GenEvent *  evt)

Definition at line 74 of file ExternalDecayDriver.cc.

References gen::PhotosInterface::apply(), gen::EvtGenInterface::decay(), gen::TauolaInterface::decay(), fEvtGenInterface, fIsInitialized, fPhotosInterface, and fTauolaInterface.

{
   
   if ( !fIsInitialized ) return evt;
   
   if ( fEvtGenInterface )
   {  
      evt = fEvtGenInterface->decay( evt ); 
      if ( !evt ) return 0;
   }

   if ( fTauolaInterface ) 
   {
      evt = fTauolaInterface->decay( evt ); 
      if ( !evt ) return 0;
   }
   

   if ( fPhotosInterface )
   {
      evt = fPhotosInterface->apply( evt );
      if ( !evt ) return 0;
   }

         
   return evt;
}
void ExternalDecayDriver::init ( const edm::EventSetup es)

Definition at line 102 of file ExternalDecayDriver.cc.

References fEvtGenInterface, fIsInitialized, fPDGs, fPhotosInterface, fSpecialSettings, fTauolaInterface, i, gen::EvtGenInterface::init(), gen::TauolaInterface::init(), gen::PhotosInterface::init(), gen::TauolaInterface::operatesOnParticles(), and gen::EvtGenInterface::operatesOnParticles().

{

   if ( fIsInitialized ) return;
   
   if ( fTauolaInterface ) 
   {
      fTauolaInterface->init( es );
      for ( std::vector<int>::const_iterator i=fTauolaInterface->operatesOnParticles().begin();
            i!=fTauolaInterface->operatesOnParticles().end(); i++ ) 
               fPDGs.push_back( *i );
   }
   
   if ( fEvtGenInterface ) 
   {
      fEvtGenInterface->init();
      for ( std::vector<int>::const_iterator i=fEvtGenInterface->operatesOnParticles().begin();
            i!=fEvtGenInterface->operatesOnParticles().end(); i++ )
               fPDGs.push_back( *i );
   }
   

   if ( fPhotosInterface )
   {
      fPhotosInterface->init();
/*   will fix shortly, for future tauola++
      if ( fPhotosInterface )
      {
         for ( unsigned int iss=0; iss<fPhotosInterface->specialSettings().size(); iss++ )
         {
            fSpecialSettings.push_back( fPhotosInterface->specialSettings()[iss]; )
         }
      }
*/
   }
   
   // now do special settings

   // This is TEMPORARY THING, until we switch to tauola++ !!!
   
   if ( fPhotosInterface )
   {
      fSpecialSettings.push_back( "QED-brem-off:all" );
   }
   if ( fTauolaInterface )
   {
      // override !
      fSpecialSettings.clear();
      fSpecialSettings.push_back( "QED-brem-off:15" );
   }
   
   fIsInitialized = true;
   
   return;
}
const std::vector<int>& gen::ExternalDecayDriver::operatesOnParticles ( ) [inline]

Definition at line 28 of file ExternalDecayDriver.h.

References fPDGs.

{ return fPDGs; }
const std::vector<std::string>& gen::ExternalDecayDriver::specialSettings ( ) [inline]

Definition at line 29 of file ExternalDecayDriver.h.

References fSpecialSettings.

{ return fSpecialSettings; }
void ExternalDecayDriver::statistics ( ) const

Definition at line 158 of file ExternalDecayDriver.cc.

References fTauolaInterface, and gen::TauolaInterface::statistics().

{
   if ( fTauolaInterface ) fTauolaInterface->statistics();
   // similar for EvtGen and/or Photos, if needs be
   return;
}

Member Data Documentation

Definition at line 39 of file ExternalDecayDriver.h.

Referenced by decay(), ExternalDecayDriver(), init(), and ~ExternalDecayDriver().

Definition at line 37 of file ExternalDecayDriver.h.

Referenced by decay(), and init().

std::vector<int> gen::ExternalDecayDriver::fPDGs [private]

Definition at line 41 of file ExternalDecayDriver.h.

Referenced by init(), and operatesOnParticles().

Definition at line 40 of file ExternalDecayDriver.h.

Referenced by decay(), ExternalDecayDriver(), init(), and ~ExternalDecayDriver().

std::vector<std::string> gen::ExternalDecayDriver::fSpecialSettings [private]

Definition at line 42 of file ExternalDecayDriver.h.

Referenced by init(), and specialSettings().