#include <ReconstructerFP420.h>
Public Member Functions | |
virtual void | beginJob () |
virtual void | produce (edm::Event &e, const edm::EventSetup &c) |
ReconstructerFP420 (const edm::ParameterSet &conf) | |
virtual | ~ReconstructerFP420 () |
Private Types | |
typedef std::vector< std::string > | vstring |
Private Attributes | |
edm::ParameterSet | conf_ |
std::string | m_genReadoutName |
FP420RecoMain * | sFP420RecoMain_ |
vstring | trackerContainers |
int | verbosity |
int | VtxFlag |
Definition at line 27 of file ReconstructerFP420.h.
typedef std::vector<std::string> cms::ReconstructerFP420::vstring [private] |
Definition at line 42 of file ReconstructerFP420.h.
cms::ReconstructerFP420::ReconstructerFP420 | ( | const edm::ParameterSet & | conf | ) | [explicit] |
Definition at line 30 of file ReconstructerFP420.cc.
References conf_, gather_cfg::cout, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), m_genReadoutName, sFP420RecoMain_, trackerContainers, verbosity, and VtxFlag.
:conf_(conf) { edm::LogInfo ("ReconstructerFP420 ") <<"Enter the FP420 Reco constructer"; verbosity = conf_.getUntrackedParameter<int>("VerbosityLevel"); if (verbosity > 0) { std::cout << "Constructor of ReconstructerFP420" << std::endl; } std::string alias ( conf.getParameter<std::string>("@module_label") ); produces<RecoCollectionFP420>().setBranchAlias( alias ); trackerContainers.clear(); trackerContainers = conf.getParameter<std::vector<std::string> >("ROUList"); VtxFlag = conf.getParameter<int>("VtxFlagGenRec"); m_genReadoutName = conf.getParameter<string>("genReadoutName"); // Initialization: sFP420RecoMain_ = new FP420RecoMain(conf_); }
cms::ReconstructerFP420::~ReconstructerFP420 | ( | ) | [virtual] |
Definition at line 57 of file ReconstructerFP420.cc.
References gather_cfg::cout, sFP420RecoMain_, and verbosity.
{ if (verbosity > 0) { std::cout << "ReconstructerFP420:delete FP420RecoMain" << std::endl; } delete sFP420RecoMain_; }
void cms::ReconstructerFP420::beginJob | ( | void | ) | [virtual] |
Reimplemented from edm::EDProducer.
Definition at line 65 of file ReconstructerFP420.cc.
References gather_cfg::cout, and verbosity.
void cms::ReconstructerFP420::produce | ( | edm::Event & | e, |
const edm::EventSetup & | c | ||
) | [virtual] |
Implements edm::EDProducer.
Definition at line 72 of file ReconstructerFP420.cc.
References gather_cfg::cout, edm::Event::getByLabel(), collect_tpl::input, estimatePileup::inputRange, edm::Event::put(), FP420RecoMain::run(), sFP420RecoMain_, trackerContainers, verbosity, and VtxFlag.
{ // beginJob; // be lazy and include the appropriate namespaces using namespace edm; using namespace std; // Get input // Vtx info: // define GEN Vtx of Signal double vtxGenX = 0.; double vtxGenY = 0.; double vtxGenZ = 0.; /* if(VtxFlag == 1) { Handle<HepMCProduct> EvtHandle; try{ iEvent.getByLabel(m_genReadoutName,EvtHandle); }catch(const Exception&){ if(verbosity>0){ std::cout << "no HepMCProduct found"<< std::endl; } } const HepMC::GenEvent* evt = EvtHandle->GetEvent() ; HepMC::GenParticle* proton1 = 0; HepMC::GenParticle* proton2 = 0; double partmomcut=4000.; double pz1max = 0.; double pz2min = 0.; for ( HepMC::GenEvent::particle_const_iterator p = evt->particles_begin(); p != evt->particles_end(); ++p ) { double pz = (*p)->momentum().pz(); // if (((*p)->pdg_id() == ipdgproton)&&((*p)->status() == 1)&&(pz > partmomcut)){ if( pz > partmomcut){ if(pz > pz1max){ proton1 = *p;pz1max=pz; } } // else if(( (*p)->pdg_id() == ipdgproton)&&((*p)->status() == 1)&&(pz < -1.*partmomcut)) { else if(pz < -1.*partmomcut) { if(pz < pz2min){ proton2 = *p;pz2min=pz; } } }// for if(proton1 && !proton2){ vtxGenX = (proton1)->production_vertex()->position().x(); vtxGenY = (proton1)->production_vertex()->position().y(); vtxGenZ = (proton1)->production_vertex()->position().z(); } else if(proton2 && !proton1){ vtxGenX = (proton2)->production_vertex()->position().x(); vtxGenY = (proton2)->production_vertex()->position().y(); vtxGenZ = (proton2)->production_vertex()->position().z(); } else if(proton1 && proton2){ if(abs((proton1)->momentum().pz()) >= abs((proton2)->momentum().pz()) ) { vtxGenX = (proton1)->production_vertex()->position().x(); vtxGenY = (proton1)->production_vertex()->position().y(); vtxGenZ = (proton1)->production_vertex()->position().z(); } else { vtxGenX = (proton2)->production_vertex()->position().x(); vtxGenY = (proton2)->production_vertex()->position().y(); vtxGenZ = (proton2)->production_vertex()->position().z(); } } }// if(VtxFlag == 1 */ double VtxX = 0.; double VtxY = 0.; double VtxZ = 0.; if(VtxFlag == 1) { VtxX = vtxGenX;// mm VtxY = vtxGenY;// mm VtxZ = vtxGenZ;// mm } // track collection: //A // edm::Handle<ClusterCollectionFP420> icf_simhit; /* Handle<ClusterCollectionFP420> cf_simhit; std::vector<const ClusterCollectionFP420 *> cf_simhitvec; for(uint32_t i = 0; i< trackerContainers.size();i++){ iEvent.getByLabel( trackerContainers[i], cf_simhit); cf_simhitvec.push_back(cf_simhit.product()); } std::auto_ptr<ClusterCollectionFP420 > input(new DigiCollectionFP420(cf_simhitvec)); */ //B Handle<TrackCollectionFP420> input; iEvent.getByLabel( trackerContainers[0] , input); // Step C: create empty output collection std::auto_ptr<RecoCollectionFP420> toutput(new RecoCollectionFP420); // put zero to container info from the beginning (important! because not any detID is updated with coming of new event !!!!!! // clean info of container from previous event std::vector<RecoFP420> collector; collector.clear(); RecoCollectionFP420::Range inputRange; inputRange.first = collector.begin(); inputRange.second = collector.end(); unsigned int detID = 0; toutput->putclear(inputRange,detID); unsigned int StID = 1; toutput->putclear(inputRange,StID); StID = 2; toutput->putclear(inputRange,StID); // !!!!!! // if we want to keep Reco container/Collection for one event ---> uncomment the line below and vice versa toutput->clear(); //container_.clear() --> start from the beginning of the container // RUN now: !!!!!! // startFP420RecoMain_.run(input, toutput); sFP420RecoMain_->run(input, toutput, VtxX, VtxY, VtxZ); // std::cout <<"======= ReconstructerFP420: end of produce " << endl; // Step D: write output to file if (verbosity > 0) { std::cout << "ReconstructerFP420: iEvent.put(toutput)" << std::endl; } iEvent.put(toutput); if (verbosity > 0) { std::cout << "ReconstructerFP420: iEvent.put(toutput) DONE" << std::endl; } }//produce
Definition at line 43 of file ReconstructerFP420.h.
Referenced by ReconstructerFP420().
std::string cms::ReconstructerFP420::m_genReadoutName [private] |
Definition at line 49 of file ReconstructerFP420.h.
Referenced by ReconstructerFP420().
Definition at line 46 of file ReconstructerFP420.h.
Referenced by produce(), ReconstructerFP420(), and ~ReconstructerFP420().
Definition at line 44 of file ReconstructerFP420.h.
Referenced by produce(), and ReconstructerFP420().
int cms::ReconstructerFP420::verbosity [private] |
Definition at line 47 of file ReconstructerFP420.h.
Referenced by beginJob(), produce(), ReconstructerFP420(), and ~ReconstructerFP420().
int cms::ReconstructerFP420::VtxFlag [private] |
Definition at line 48 of file ReconstructerFP420.h.
Referenced by produce(), and ReconstructerFP420().