CMS 3D CMS Logo

HectorProducer Class Reference

#include <SimTransport/HectorProducer/interface/HectorProducer.h>

Inheritance diagram for HectorProducer:

edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

virtual void beginJob (const edm::EventSetup &c)
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 23 of file HectorProducer.cc.

References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), edm::ParameterSet::getParameter(), hector, m_FP420Transport, m_InTag, m_verbosity, and m_ZDCTransport.

00023                                                                 : eventsAnalysed(0) {
00024   
00025   
00026   //  produces<edm::HepMCProduct>();
00027   
00028   // TransportHector
00029   
00030   m_InTag          = parameters.getParameter<std::string>("HepMCProductLabel") ;
00031   m_verbosity      = parameters.getParameter<bool>("Verbosity");
00032   m_FP420Transport = parameters.getParameter<bool>("FP420Transport");
00033   m_ZDCTransport   = parameters.getParameter<bool>("ZDCTransport");
00034   
00035   produces<edm::HepMCProduct>();
00036   //  hector = new Hector( parameters );
00037   hector = new Hector(parameters, 
00038                       m_verbosity,
00039                       m_FP420Transport,
00040                       m_ZDCTransport);
00041   
00042   edm::LogInfo ("Hector") << "HectorProducer parameters: \n" 
00043                           << "   Verbosity: " << m_verbosity << "\n"
00044                           << "   m_InTag:    " <<  m_InTag<< "\n"
00045                           << "   m_FP420Transport:    " << m_FP420Transport << "\n"
00046                           << "   m_ZDCTransport:    " << m_ZDCTransport << "\n";
00047 
00048   if(m_verbosity) {
00049     cout << "===================================================================" << endl;  
00050     cout << "=== Start create new HectorProducer                           =====" << endl;
00051     cout << "=== m_InTag: " << m_InTag << endl;
00052     cout << "=== You are going to transport:                               =====" << endl;
00053     cout << "=== FP420: " << m_FP420Transport << endl;
00054     cout << "=== ZDC: " << m_ZDCTransport << endl;
00055     cout << "===================================================================" << endl;
00056   }  
00057 }

HectorProducer::~HectorProducer (  )  [virtual]

default destructor

Definition at line 59 of file HectorProducer.cc.

References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), eventsAnalysed, and m_verbosity.

00059                                {
00060   
00061   //if ( hector ) delete hector;
00062   
00063   if(m_verbosity) {
00064     cout << "===================================================================" << endl;  
00065     cout << "=== Start delete HectorProducer                               =====" << endl;
00066     cout << "=== Number of events analysed: " << eventsAnalysed << endl;
00067   }
00068   //  delete hector;
00069 
00070    if(m_verbosity) {
00071     cout << "=== DONE                              =====" << endl;
00072     cout << "===================================================================" << endl;  
00073   }
00074  
00075 }


Member Function Documentation

void HectorProducer::beginJob ( const edm::EventSetup c  )  [virtual]

Reimplemented from edm::EDProducer.

Definition at line 77 of file HectorProducer.cc.

00078 {
00079   //  cout << "HectorProducer::beginJob" << std::endl;
00080   //  cout << "" << std::endl;
00081 }

void HectorProducer::endJob ( void   )  [virtual]

Reimplemented from edm::EDProducer.

Definition at line 83 of file HectorProducer.cc.

00084 {
00085   //    std::cout << " HectorProducer terminating " << std::endl;
00086 }

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

this method will do the user analysis

Implements edm::EDProducer.

Definition at line 89 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, m_FP420Transport, m_InTag, m_ZDCTransport, edm::Event::put(), and std.

00089                                                                        {
00090   //  cout << "HectorProducer::produce" << std::endl;
00091   using namespace edm;
00092   using namespace std;
00093   //   using namespace HepMC;
00094   //   using namespace CLHEP;
00095   
00096   eventsAnalysed++;
00097   
00098   //   vector< Handle<HepMCProduct> > AllHepMCEvt ;   
00099   //   iEvent.getManyByType( AllHepMCEvt ) ;
00100   Handle<HepMCProduct>  HepMCEvt;   
00101   iEvent.getByLabel( m_InTag, HepMCEvt ) ;
00102   
00103   //   for ( unsigned int i=0; i<HepMCEvt.size(); ++i )
00104   //   {
00105   if ( !HepMCEvt.isValid() )
00106     {
00107       // in principal, should never happen, as it's taken care of bt Framework
00108       throw cms::Exception("InvalidReference")
00109         << "Invalid reference to HepMCProduct\n";
00110     }
00111   
00112   if ( HepMCEvt.provenance()->moduleLabel() == "HectorTrasported" )
00113     {
00114       throw cms::Exception("LogicError")
00115         << "HectorTrasported HepMCProduce already exists\n";
00116     }
00117   
00118   //   }
00119   
00120   evt_ = new HepMC::GenEvent( *HepMCEvt->GetEvent() );
00121   hector->clearApertureFlags();
00122   if(m_FP420Transport) {
00123     hector->clear();
00124     hector->add( evt_ ,es);
00125     hector->filterFP420();
00126   }
00127   if(m_ZDCTransport) {
00128     hector->clear();
00129     hector->add( evt_ ,es);
00130     hector->filterZDC();
00131     
00132     hector->clear();
00133     hector->add( evt_ ,es);
00134     hector->filterD1();
00135   }
00136   evt_ = hector->addPartToHepMC( evt_ );
00137   
00138   // OK, create a product and put in into edm::Event
00139   //
00140   auto_ptr<HepMCProduct> NewProduct(new HepMCProduct()) ;
00141   NewProduct->addHepMCData( evt_ ) ;
00142   
00143   //   iEvent.put( NewProduct, "HectorTrasported" ) ;
00144   iEvent.put( NewProduct ) ;
00145 }


Member Data Documentation

int HectorProducer::eventsAnalysed [private]

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().

Hector* HectorProducer::hector [private]

Definition at line 31 of file HectorProducer.h.

Referenced by HectorProducer(), and produce().

bool HectorProducer::m_FP420Transport [private]

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().

bool HectorProducer::m_verbosity [private]

Definition at line 34 of file HectorProducer.h.

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

bool HectorProducer::m_ZDCTransport [private]

Definition at line 36 of file HectorProducer.h.

Referenced by HectorProducer(), and produce().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:24:09 2009 for CMSSW by  doxygen 1.5.4