CMS 3D CMS Logo

Public Member Functions | Private Attributes

HectorProducer Class Reference

#include <HectorProducer.h>

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

List of all members.

Public Member Functions

virtual void beginJob ()
virtual void endJob ()
 HectorProducer (edm::ParameterSet const &p)
 default constructor
void produce (edm::Event &iEvent, const edm::EventSetup &es)
 this method will do the user analysis
virtual ~HectorProducer ()
 default destructor

Private Attributes

int eventsAnalysed
 just to count events that have been analysed
HepMC::GenEvent * evt_
Hectorhector
bool m_FP420Transport
std::string m_InTag
bool m_verbosity
bool m_ZDCTransport

Detailed Description

Definition at line 20 of file HectorProducer.h.


Constructor & Destructor Documentation

HectorProducer::HectorProducer ( edm::ParameterSet const &  p)

default constructor

Definition at line 24 of file HectorProducer.cc.

References edm::ParameterSet::getParameter(), hector, m_FP420Transport, m_InTag, m_verbosity, and m_ZDCTransport.

                                                                : eventsAnalysed(0) {
  
  
  // TransportHector
  
  m_InTag          = parameters.getParameter<std::string>("HepMCProductLabel") ;
  m_verbosity      = parameters.getParameter<bool>("Verbosity");
  m_FP420Transport = parameters.getParameter<bool>("FP420Transport");
  m_ZDCTransport   = parameters.getParameter<bool>("ZDCTransport");
  
  produces<edm::HepMCProduct>();
  produces<edm::LHCTransportLinkContainer>();

  hector = new Hector(parameters, 
                      m_verbosity,
                      m_FP420Transport,
                      m_ZDCTransport);
  
}
HectorProducer::~HectorProducer ( ) [virtual]

default destructor

Definition at line 44 of file HectorProducer.cc.

References eventsAnalysed, LogDebug, and m_verbosity.

                               {
  
  if(m_verbosity) {
    LogDebug("HectorSetup") << "Delete HectorProducer"  
                            << "Number of events analysed: " << eventsAnalysed;
  }

}

Member Function Documentation

virtual void HectorProducer::beginJob ( void  ) [inline, virtual]

Reimplemented from edm::EDProducer.

Definition at line 25 of file HectorProducer.h.

{}
virtual void HectorProducer::endJob ( void  ) [inline, virtual]

Reimplemented from edm::EDProducer.

Definition at line 26 of file HectorProducer.h.

{}
void HectorProducer::produce ( edm::Event iEvent,
const edm::EventSetup es 
) [virtual]

this method will do the user analysis

Implements edm::EDProducer.

Definition at line 53 of file HectorProducer.cc.

References Hector::add(), Hector::addPartToHepMC(), Hector::clear(), Hector::clearApertureFlags(), eventsAnalysed, evt_, Exception, Hector::filterD1(), Hector::filterFP420(), Hector::filterZDC(), edm::Event::getByLabel(), Hector::getCorrespondenceMap(), hector, i, LogDebug, m_FP420Transport, m_InTag, m_verbosity, m_ZDCTransport, and edm::Event::put().

                                                                       {

  using namespace edm;
  using namespace std;
  
  eventsAnalysed++;
  
  Handle<HepMCProduct>  HepMCEvt;   
  iEvent.getByLabel( m_InTag, HepMCEvt ) ;
  
  if ( !HepMCEvt.isValid() )
    {
      throw cms::Exception("InvalidReference")
        << "Invalid reference to HepMCProduct\n";
    }
  
  if ( HepMCEvt.provenance()->moduleLabel() == "LHCTransport" )
    {
      throw cms::Exception("LogicError")
        << "HectorTrasported HepMCProduce already exists\n";
    }

  evt_ = new HepMC::GenEvent( *HepMCEvt->GetEvent() );
  hector->clearApertureFlags();
  if(m_FP420Transport) {
    hector->clear();
    hector->add( evt_ ,es);
    hector->filterFP420();
  }
  if(m_ZDCTransport) {
    hector->clear();
    hector->add( evt_ ,es);
    hector->filterZDC();
    
    hector->clear();
    hector->add( evt_ ,es);
    hector->filterD1();
  }
  evt_ = hector->addPartToHepMC( evt_ );
  if (m_verbosity) {
    evt_->print();
  }
  
  auto_ptr<HepMCProduct> NewProduct(new HepMCProduct()) ;
  NewProduct->addHepMCData( evt_ ) ;
  
  iEvent.put( NewProduct ) ;

  auto_ptr<LHCTransportLinkContainer> NewCorrespondenceMap(new edm::LHCTransportLinkContainer() );
  edm::LHCTransportLinkContainer thisLink(hector->getCorrespondenceMap());
  (*NewCorrespondenceMap).swap(thisLink);

  if ( m_verbosity ) {
    for ( unsigned int i = 0; i < (*NewCorrespondenceMap).size(); i++) 
      LogDebug("HectorEventProcessing") << "Hector correspondence table: " << (*NewCorrespondenceMap)[i];
  }

  iEvent.put( NewCorrespondenceMap );

}

Member Data Documentation

just to count events that have been analysed

Definition at line 29 of file HectorProducer.h.

Referenced by produce(), and ~HectorProducer().

HepMC::GenEvent* HectorProducer::evt_ [private]

Definition at line 30 of file HectorProducer.h.

Referenced by produce().

Definition at line 31 of file HectorProducer.h.

Referenced by HectorProducer(), and produce().

Definition at line 35 of file HectorProducer.h.

Referenced by HectorProducer(), and produce().

std::string HectorProducer::m_InTag [private]

Definition at line 33 of file HectorProducer.h.

Referenced by HectorProducer(), and produce().

Definition at line 34 of file HectorProducer.h.

Referenced by HectorProducer(), produce(), and ~HectorProducer().

Definition at line 36 of file HectorProducer.h.

Referenced by HectorProducer(), and produce().