CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

edm::BeamHaloSource Class Reference

#include <BeamHaloSource.h>

Inheritance diagram for edm::BeamHaloSource:
edm::GeneratedInputSource edm::ConfigurableInputSource edm::InputSource edm::ProductRegistryHelper

List of all members.

Public Member Functions

 BeamHaloSource (const ParameterSet &, const InputSourceDescription &)
 Constructor.
virtual ~BeamHaloSource ()
 Destructor.

Private Member Functions

bool call_bh_set_parameters (int *ival, float *fval, const std::string cval_string)
bool call_ki_bhg_fill (int &iret, float &weight)
bool call_ki_bhg_init (long &seed)
bool call_ki_bhg_stat (int &iret)
void clear ()
virtual bool produce (Event &e)

Private Attributes

float EG_MAX_
float EG_MIN_
HepMC::GenEvent * evt
std::string G3FNAME_
int GENMOD_
int IW_HAD_
int IW_MUO_
int LHC_B1_
int LHC_B2_

Detailed Description

Definition at line 22 of file BeamHaloSource.h.


Constructor & Destructor Documentation

BeamHaloSource::BeamHaloSource ( const ParameterSet pset,
const InputSourceDescription desc 
)

Constructor.

Definition at line 56 of file BeamHaloSource.cc.

References _BeamHalo_randomEngine, call_bh_set_parameters(), call_ki_bhg_init(), gather_cfg::cout, edm::ParameterSet::getUntrackedParameter(), and edm::ConfigurableInputSource::numberEventsInRun().

                                                                 :
        GeneratedInputSource(pset, desc), evt(0)
{

   int iparam[8];
   float fparam[4];
   std::string cparam;
 // -- from bhgctrl.inc
   iparam[0]  = pset.getUntrackedParameter<int>("GENMOD");
   iparam[1]  = pset.getUntrackedParameter<int>("LHC_B1");
   iparam[2]  = pset.getUntrackedParameter<int>("LHC_B2");
   iparam[3]  = pset.getUntrackedParameter<int>("IW_MUO");
   iparam[4]  = pset.getUntrackedParameter<int>("IW_HAD");
   iparam[5]  = numberEventsInRun();
   iparam[6]  = pset.getUntrackedParameter<int>("OFFSET",0);
   iparam[7]  = pset.getUntrackedParameter<int>("shift_bx");
   
   fparam[0]  = (float)pset.getUntrackedParameter<double>("EG_MIN");
   fparam[1]  = (float)pset.getUntrackedParameter<double>("EG_MAX");

   fparam[2] = (float)pset.getUntrackedParameter<double>("BXNS");
   fparam[3]  = (float)pset.getUntrackedParameter<double>("W0",1.0);

   cparam     = pset.getUntrackedParameter<std::string>("G3FNAME","input.txt");
   call_bh_set_parameters(iparam,fparam,cparam);


// -- Seed for randomnumbers
    Service<RandomNumberGenerator> rng;
    _BeamHalo_randomEngine = &(rng->getEngine());
    long seed = (long)(rng->mySeed());


// -- initialisation
   call_ki_bhg_init(seed);


  produces<HepMCProduct>();
  cout << "BeamHaloSource: starting event generation ... " << endl;

}
BeamHaloSource::~BeamHaloSource ( ) [virtual]

Destructor.

Definition at line 50 of file BeamHaloSource.cc.

                                {
        int iret=0;
        call_ki_bhg_stat(iret);
}

Member Function Documentation

bool BeamHaloSource::call_bh_set_parameters ( int *  ival,
float *  fval,
const std::string  cval_string 
) [private]

Definition at line 147 of file BeamHaloSource.cc.

References BHSETPARAM.

Referenced by BeamHaloSource().

                                                                                               {
  BHSETPARAM(ival,fval,cval_string.c_str(),cval_string.length());
        return true;
}
bool BeamHaloSource::call_ki_bhg_fill ( int &  iret,
float &  weight 
) [private]

Definition at line 157 of file BeamHaloSource.cc.

References KI_BHG_FILL.

Referenced by produce().

                                                              {
        KI_BHG_FILL(iret,weight);
        return true;
}
bool BeamHaloSource::call_ki_bhg_init ( long &  seed) [private]

Definition at line 152 of file BeamHaloSource.cc.

References KI_BHG_INIT.

Referenced by BeamHaloSource().

                                                {
        KI_BHG_INIT(seed);
        return true;
}
bool BeamHaloSource::call_ki_bhg_stat ( int &  iret) [private]

Definition at line 162 of file BeamHaloSource.cc.

References KI_BHG_STAT.

                                               {
        KI_BHG_STAT(iret);
        return true;
}
void BeamHaloSource::clear ( void  ) [private]

Definition at line 100 of file BeamHaloSource.cc.

{
}
bool BeamHaloSource::produce ( Event e) [private, virtual]

Implements edm::ConfigurableInputSource.

Definition at line 104 of file BeamHaloSource.cc.

References call_ki_bhg_fill(), edm::ConfigurableInputSource::event(), evt, configurableAnalysis::GenParticle, AlCaHLTBitMon_ParallelJobs::p, edm::Event::put(), CommonMethods::weight(), create_public_pileup_plots::weights, and wrapper.

                                      {
        // cout << "in produce " << endl;

  //            auto_ptr<HepMCProduct> bare_product(new HepMCProduct());

        // cout << "apres autoptr " << endl;

        int iret=0;
        float weight = 0;
        call_ki_bhg_fill(iret, weight);

        if( iret < 0 ) return false;

        // cout << "apres fortran " << endl;


        // HepMC::GenEvent* evt = conv.getGenEventfromHEPEVT();
        //      HepMC::GenEvent* evt = conv.read_next_event();  seems to be broken (?)
  evt = new HepMC::GenEvent();

  for (int theindex = 1; theindex<=wrapper.number_entries(); theindex++) {
  HepMC::GenVertex* Vtx = new  HepMC::GenVertex(HepMC::FourVector(wrapper.x(theindex),wrapper.y(theindex),wrapper.z(theindex),wrapper.t(theindex)));
  HepMC::FourVector p(wrapper.px(theindex),wrapper.py(theindex),wrapper.pz(theindex),wrapper.e(theindex));
  HepMC::GenParticle* Part = 
    new HepMC::GenParticle(p,wrapper.id(theindex),wrapper.status(theindex));
  Vtx->add_particle_out(Part); 
  evt->add_vertex(Vtx);
  }

  evt->set_event_number(event());

        HepMC::WeightContainer& weights = evt -> weights();
        weights.push_back(weight);
        //      evt->print();
  std::auto_ptr<HepMCProduct> CMProduct(new HepMCProduct());
  if (evt) CMProduct->addHepMCData(evt );
  e.put(CMProduct);
    
    return true;
}

Member Data Documentation

Definition at line 49 of file BeamHaloSource.h.

Definition at line 48 of file BeamHaloSource.h.

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

Definition at line 41 of file BeamHaloSource.h.

Referenced by produce().

std::string edm::BeamHaloSource::G3FNAME_ [private]

Definition at line 50 of file BeamHaloSource.h.

Definition at line 43 of file BeamHaloSource.h.

Definition at line 47 of file BeamHaloSource.h.

Definition at line 46 of file BeamHaloSource.h.

Definition at line 44 of file BeamHaloSource.h.

Definition at line 45 of file BeamHaloSource.h.