CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

edm::ExhumeProducer Class Reference

#include <ExhumeProducer.h>

Inheritance diagram for edm::ExhumeProducer:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

void endRun (Run &r)
 ExhumeProducer (const ParameterSet &)
 Constructor.
virtual ~ExhumeProducer ()
 Destructor.

Private Member Functions

void clear ()
virtual void produce (edm::Event &e, const EventSetup &es)
 Interface to the PYGIVE pythia routine, with add'l protections.

Private Attributes

double comEnergy_
unsigned int eventNumber_
HepMC::GenEvent * evt
Exhume::EventexhumeEvent_
Exhume::CrossSectionexhumeProcess_
double extCrossSect_
double extFilterEff_
CLHEP::HepRandomEngine * fRandomEngine
CLHEP::RandFlat * fRandomGenerator
unsigned int maxEventsToPrint_
 Events to print if verbosity.
bool pythiaHepMCVerbosity_
 HepMC verbosity flag.
unsigned int pythiaPylistVerbosity_
 Pythia PYLIST Verbosity flag.
int sigID_

Detailed Description

Definition at line 28 of file ExhumeProducer.h.


Constructor & Destructor Documentation

ExhumeProducer::ExhumeProducer ( const ParameterSet pset)

Constructor.

Definition at line 73 of file ExhumeProducer.cc.

References edm::errors::Configuration, Exception, exhumeEvent_, exhumeProcess_, fRandomEngine, fRandomGenerator, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), maxEventsToPrint_, pythiaHepMCVerbosity_, pythiaPylistVerbosity_, randomEngine, Exhume::Event::SetMassRange(), Exhume::Event::SetParameterSpace(), and sigID_.

                                                         :
  EDProducer(),
  evt(0), 
  pythiaPylistVerbosity_ (pset.getUntrackedParameter<int>("pythiaPylistVerbosity",0)),
  pythiaHepMCVerbosity_ (pset.getUntrackedParameter<bool>("pythiaHepMCVerbosity",false)),
  maxEventsToPrint_ (pset.getUntrackedParameter<int>("maxEventsToPrint",1)),
  comEnergy_(pset.getParameter<double>("comEnergy")),
  extCrossSect_(pset.getUntrackedParameter<double>("crossSection", -1.)),
  extFilterEff_(pset.getUntrackedParameter<double>("filterEfficiency", -1.)),
  eventNumber_(0)
{
  std::ostringstream header_str;

  header_str << "ExhumeProducer: initializing Exhume/Pythia.\n";
  
  // PYLIST Verbosity Level
  // Valid PYLIST arguments are: 1, 2, 3, 5, 7, 11, 12, 13
  pythiaPylistVerbosity_ = pset.getUntrackedParameter<int>("pythiaPylistVerbosity",0);
  header_str << "Pythia PYLIST verbosity level = " << pythiaPylistVerbosity_ << "\n";
  
  // HepMC event verbosity Level
  pythiaHepMCVerbosity_ = pset.getUntrackedParameter<bool>("pythiaHepMCVerbosity",false);
  header_str << "Pythia HepMC verbosity = " << pythiaHepMCVerbosity_ << "\n"; 

  //Max number of events printed on verbosity level 
  maxEventsToPrint_ = pset.getUntrackedParameter<int>("maxEventsToPrint",0);
  header_str << "Number of events to be printed = " << maxEventsToPrint_ << "\n";

  //Exhume Initialization
  ParameterSet process_pset = pset.getParameter<ParameterSet>("ExhumeProcess") ;
  string processType = process_pset.getParameter<string>("ProcessType");
  if(processType == "Higgs"){
        exhumeProcess_ = new Exhume::Higgs(pset);
        int higgsDecay = process_pset.getParameter<int>("HiggsDecay");
        ((Exhume::Higgs*)exhumeProcess_)->SetHiggsDecay(higgsDecay);
        sigID_ = 100 + higgsDecay;
  } else if(processType == "QQ"){       
        exhumeProcess_ = new Exhume::QQ(pset);
        int quarkType = process_pset.getParameter<int>("QuarkType");
        double thetaMin = process_pset.getParameter<double>("ThetaMin");
        ((Exhume::QQ*)exhumeProcess_)->SetQuarkType(quarkType);
        ((Exhume::QQ*)exhumeProcess_)->SetThetaMin(thetaMin);
        sigID_ = 200 + quarkType;
  } else if(processType == "GG"){
        exhumeProcess_ = new Exhume::GG(pset);
        double thetaMin = process_pset.getParameter<double>("ThetaMin");
        ((Exhume::GG*)exhumeProcess_)->SetThetaMin(thetaMin);
        sigID_ = 300;
  } else{
        sigID_ = -1;
        throw edm::Exception(edm::errors::Configuration,"ExhumeError") <<" No valid Exhume Process";
  }

  edm::Service<RandomNumberGenerator> rng;
  //uint32_t seed = rng->mySeed();
  fRandomEngine = &(rng->getEngine());
  randomEngine = fRandomEngine;
  fRandomGenerator = new CLHEP::RandFlat(fRandomEngine) ;
  //exhumeEvent_ = new Exhume::Event(*exhumeProcess_,seed);
  exhumeEvent_ = new Exhume::Event(*exhumeProcess_,randomEngine);

  double massRangeLow = process_pset.getParameter<double>("MassRangeLow");
  double massRangeHigh = process_pset.getParameter<double>("MassRangeHigh");
  exhumeEvent_->SetMassRange(massRangeLow,massRangeHigh);
  exhumeEvent_->SetParameterSpace();

  header_str << "\n"; // Stetically add for the output
  //********                                      
  
  produces<HepMCProduct>();
  produces<GenEventInfoProduct>();
  produces<GenRunInfoProduct, edm::InRun>();

  header_str << "ExhumeProducer: starting event generation ...\n";

  edm::LogInfo("") << header_str.str();
}
ExhumeProducer::~ExhumeProducer ( ) [virtual]

Destructor.

Definition at line 152 of file ExhumeProducer.cc.

References clear().

                               {
  std::ostringstream footer_str;
  footer_str << "ExhumeProducer: event generation done.\n";

  edm::LogInfo("") << footer_str.str();

  clear();
}

Member Function Documentation

void ExhumeProducer::clear ( void  ) [private]

Definition at line 161 of file ExhumeProducer.cc.

References exhumeEvent_, and exhumeProcess_.

Referenced by ~ExhumeProducer().

                           {
  delete exhumeEvent_;
  delete exhumeProcess_;
}
void ExhumeProducer::endRun ( Run r)

Definition at line 166 of file ExhumeProducer.cc.

References Exhume::Event::CrossSectionCalculation(), interpolateCardsSimple::eff, exhumeEvent_, exhumeProcess_, extCrossSect_, extFilterEff_, Exhume::Event::GetEfficiency(), Exhume::CrossSection::GetName(), mergeVDriftHistosByStation::name, and edm::Run::put().

                                     {
  std::ostringstream footer_str;

  double cs = exhumeEvent_->CrossSectionCalculation();
  double eff = exhumeEvent_->GetEfficiency();
  string name = exhumeProcess_->GetName();

  footer_str << "\n" <<"   You have just been ExHuMEd." << "\n" << "\n";
  footer_str << "   The cross section for process " << name
            << " is " << cs << " fb" << "\n" << "\n";
  footer_str << "   The efficiency of event generation was " << eff << "%" << "\n" << "\n";

  edm::LogInfo("") << footer_str.str();

  auto_ptr<GenRunInfoProduct> genRunInfoProd (new GenRunInfoProduct());
  genRunInfoProd->setInternalXSec(cs);
  genRunInfoProd->setFilterEfficiency(extFilterEff_);
  genRunInfoProd->setExternalXSecLO(extCrossSect_);
  genRunInfoProd->setExternalXSecNLO(-1.);   

  run.put(genRunInfoProd);
}
void ExhumeProducer::produce ( edm::Event e,
const EventSetup es 
) [private, virtual]

Interface to the PYGIVE pythia routine, with add'l protections.

Implements edm::EDProducer.

Definition at line 189 of file ExhumeProducer.cc.

References call_pylist(), conv, edm::EventID::event(), eventNumber_, exhumeEvent_, exhumeProcess_, Exhume::Event::Generate(), TtGenEvtProducer_cfi::genEvt, Exhume::CrossSection::GetName(), Exhume::CrossSection::Hadronise(), edm::EventBase::id(), maxEventsToPrint_, pypars, pythiaHepMCVerbosity_, pythiaPylistVerbosity_, and sigID_.

                                                                   {

  auto_ptr<HepMCProduct> bare_product(new HepMCProduct());  
  edm::LogInfo("") << "ExhumeProducer: Generating event ...\n";

  exhumeEvent_->Generate();
  exhumeProcess_->Hadronise();

  HepMC::GenEvent* genEvt = conv.read_next_event();
  genEvt->set_signal_process_id(sigID_);        
  genEvt->set_event_scale(pypars.pari[16]);
// JMM change
//  genEvt->set_event_number(numberEventsInRun() - remainingEvents() - 1);
  ++eventNumber_;
  genEvt->set_event_number(eventNumber_);
    
  //******** Verbosity ********
    
//  if(event() <= maxEventsToPrint_ &&
  if(event.id().event() <= maxEventsToPrint_ &&
     (pythiaPylistVerbosity_ || pythiaHepMCVerbosity_)) {

    // Prints PYLIST info
    if(pythiaPylistVerbosity_) {
       call_pylist(pythiaPylistVerbosity_);
    }
      
    // Prints HepMC event
    if(pythiaHepMCVerbosity_) {
       edm::LogInfo("") << "Event process = " << exhumeProcess_->GetName() << "\n" 
                        << "----------------------" << "\n";
       genEvt->print();
    }
  }
    
  if(genEvt)  bare_product->addHepMCData(genEvt);
  event.put(bare_product);
 
  std::auto_ptr<GenEventInfoProduct> genEventInfo(new GenEventInfoProduct(genEvt));
  event.put(genEventInfo);
}

Member Data Documentation

Definition at line 60 of file ExhumeProducer.h.

unsigned int edm::ExhumeProducer::eventNumber_ [private]

Definition at line 75 of file ExhumeProducer.h.

Referenced by produce().

HepMC::GenEvent* edm::ExhumeProducer::evt [private]

Definition at line 51 of file ExhumeProducer.h.

Definition at line 69 of file ExhumeProducer.h.

Referenced by clear(), endRun(), ExhumeProducer(), and produce().

Definition at line 70 of file ExhumeProducer.h.

Referenced by clear(), endRun(), ExhumeProducer(), and produce().

Definition at line 63 of file ExhumeProducer.h.

Referenced by endRun().

Definition at line 64 of file ExhumeProducer.h.

Referenced by endRun().

CLHEP::HepRandomEngine* edm::ExhumeProducer::fRandomEngine [private]

Definition at line 66 of file ExhumeProducer.h.

Referenced by ExhumeProducer().

CLHEP::RandFlat* edm::ExhumeProducer::fRandomGenerator [private]

Definition at line 67 of file ExhumeProducer.h.

Referenced by ExhumeProducer().

Events to print if verbosity.

Definition at line 58 of file ExhumeProducer.h.

Referenced by ExhumeProducer(), and produce().

HepMC verbosity flag.

Definition at line 56 of file ExhumeProducer.h.

Referenced by ExhumeProducer(), and produce().

Pythia PYLIST Verbosity flag.

Definition at line 54 of file ExhumeProducer.h.

Referenced by ExhumeProducer(), and produce().

Definition at line 72 of file ExhumeProducer.h.

Referenced by ExhumeProducer(), and produce().