#include <EventFilter/EcalRawToRecHitProducer/src/EcalRawToRecHitProducer.cc>
Public Types | |
typedef edm::LazyGetter < EcalRecHit > | EcalRecHitLazyGetter |
typedef edm::RefGetter < EcalRecHit > | EcalRecHitRefGetter |
Public Member Functions | |
EcalRawToRecHitProducer (const edm::ParameterSet &) | |
~EcalRawToRecHitProducer () | |
Private Member Functions | |
virtual void | produce (edm::Event &, const edm::EventSetup &) |
Private Attributes | |
std::string | EBrechitCollection_ |
std::string | EErechitCollection_ |
edm::InputTag | lsourceTag_ |
std::string | rechitCollection_ |
edm::InputTag | sourceTag_ |
bool | splitOutput_ |
Description: <one line="" class="" summary>="">
Implementation: <Notes on="" implementation>="">
Definition at line 53 of file EcalRawToRecHitProducer.h.
Definition at line 56 of file EcalRawToRecHitProducer.h.
Definition at line 57 of file EcalRawToRecHitProducer.h.
EcalRawToRecHitProducer::EcalRawToRecHitProducer | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 3 of file EcalRawToRecHitProducer.cc.
References EBrechitCollection_, EErechitCollection_, edm::ParameterSet::getParameter(), LogDebug, lsourceTag_, rechitCollection_, sourceTag_, and splitOutput_.
{ lsourceTag_=iConfig.getParameter<edm::InputTag>("lazyGetterTag"); sourceTag_=iConfig.getParameter<edm::InputTag>("sourceTag"); splitOutput_=iConfig.getParameter<bool>("splitOutput"); if (splitOutput_){ EBrechitCollection_=iConfig.getParameter<std::string>("EBrechitCollection"); EErechitCollection_=iConfig.getParameter<std::string>("EErechitCollection"); produces<EBRecHitCollection>(EBrechitCollection_); produces<EERecHitCollection>(EErechitCollection_); LogDebug("EcalRawToRecHit|Producer")<<"ready to create rechits from lazy getter: "<<lsourceTag_ <<"\n using region ref from: "<<sourceTag_ <<"\n splitting in two collections" <<"\n EB instance: "<<EBrechitCollection_ <<"\n EE instance: "<<EErechitCollection_; } else{ rechitCollection_=iConfig.getParameter<std::string>("rechitCollection"); produces<EcalRecHitCollection>(rechitCollection_); LogDebug("EcalRawToRecHit|Producer")<<"ready to create rechits from lazy getter: "<<lsourceTag_ <<"\n using region ref from: "<<sourceTag_ <<"\n not splitting the output collection."; } }
EcalRawToRecHitProducer::~EcalRawToRecHitProducer | ( | ) |
Definition at line 30 of file EcalRawToRecHitProducer.cc.
{ }
void EcalRawToRecHitProducer::produce | ( | edm::Event & | iEvent, |
const edm::EventSetup & | iSetup | ||
) | [private, virtual] |
Implements edm::EDProducer.
Definition at line 41 of file EcalRawToRecHitProducer.cc.
References cond::rpcobgas::detid, EBrechitCollection_, EErechitCollection_, edm::Event::getByLabel(), MyWatcher::lap(), LogDebug, lsourceTag_, edm::Event::put(), rechitCollection_, sourceTag_, splitOutput_, and DetId::subdetId().
{ using namespace edm; MyWatcher watcher("Producer"); LogDebug("EcalRawToRecHit|Producer")<<watcher.lap(); //retrieve a lazygetter edm::Handle<EcalRecHitLazyGetter> lgetter; iEvent.getByLabel(lsourceTag_, lgetter); LogDebug("EcalRawToRecHit|Producer")<<"lazy getter retreived from: "<<lsourceTag_<<(lgetter.failedToGet()?" not valid ":"valid") <<watcher.lap(); //retrieve a refgetter edm::Handle<EcalRecHitRefGetter> rgetter; iEvent.getByLabel(sourceTag_ ,rgetter); LogDebug("EcalRawToRecHit|Producer")<<"ref getter retreived from: "<<sourceTag_<<(rgetter.failedToGet()?" not valid ":"valid") <<watcher.lap(); if (splitOutput_){ //prepare the output collection std::auto_ptr<EBRecHitCollection> EBrechits( new EBRecHitCollection ); std::auto_ptr<EERecHitCollection> EErechits( new EERecHitCollection ); //loop the refgetter unsigned int iR=0; EcalRecHitRefGetter::const_iterator iRegion=rgetter->begin(); EcalRecHitRefGetter::const_iterator iRegionEnd=rgetter->end(); for (;iRegion!=iRegionEnd;++iRegion){ LogDebug("EcalRawToRecHit|Producer")<<"looping over refgetter region: "<<iR<<watcher.lap(); std::vector<EcalRecHit>::const_iterator iRecHit=lgetter->begin_record()+iRegion->start(); std::vector<EcalRecHit>::const_iterator iRecHitEnd =lgetter->begin_record()+iRegion->finish(); for (;iRecHit!=iRecHitEnd;iRecHit++){ DetId detid =iRecHit->id(); //split barrel and endcap int EcalNum=detid.subdetId(); //1 stands for Barrel, 2 for endcaps LogDebug("EcalRawToRecHit|Producer")<<"subdetId is: "<<EcalNum; if (EcalNum==1) EBrechits->push_back(*iRecHit); else if (EcalNum==2) EErechits->push_back(*iRecHit); else { edm::LogError("IncorrectRecHit")<<" a subdetid is not recognized. recHit on :"<< iRecHit->id().rawId() <<" is lost."; }//subdetid }//loop over things in region LogDebug("EcalRawToRecHit|Producer")<<"looping over refgetter region: "<<iR++<<" done" <<watcher.lap(); }//loop over regions LogDebug("EcalRawToRecHit|Producer")<<EBrechits->size()<<" EB recHits to be put with instance: "<<EBrechitCollection_ <<"\n"<<EErechits->size()<<" EE recHits to be put with instance: "<<EErechitCollection_ << watcher.lap(); iEvent.put(EBrechits, EBrechitCollection_); iEvent.put(EErechits, EErechitCollection_); LogDebug("EcalRawToRecHit|Producer")<<"collections uploaded." << watcher.lap(); } else{ //prepare the output collection std::auto_ptr< EcalRecHitCollection > rechits( new EcalRecHitCollection); //loop the refgetter unsigned int iR=0; EcalRecHitRefGetter::const_iterator iRegion=rgetter->begin(); EcalRecHitRefGetter::const_iterator iRegionEnd=rgetter->end(); for (;iRegion!=iRegionEnd;++iRegion){ LogDebug("EcalRawToRecHit|Producer")<<"looping over refgetter region: "<<iR<<watcher.lap(); std::vector<EcalRecHit>::const_iterator iRecHit=lgetter->begin_record()+iRegion->start(); std::vector<EcalRecHit>::const_iterator iRecHitEnd=lgetter->begin_record()+iRegion->finish(); for (;iRecHit!=iRecHitEnd;iRecHit++){ LogDebug("EcalRawToRecHit|Producer")<<"dereferencing rechit ref."; DetId detid =iRecHit->id(); int EcalNum=detid.subdetId(); //1 stands for Barrel, 2 for endcaps LogDebug("EcalRawToRecHit|Producer")<<"subdetId is: "<<EcalNum; rechits->push_back(*iRecHit); }//loop over things in region LogDebug("EcalRawToRecHit|Producer")<<"looping over refgetter region: "<<iR++<<" done"<<watcher.lap(); }//loop over regions LogDebug("EcalRawToRecHit|Producer")<<rechits->size()<<" rechits to be put."<< watcher.lap(); iEvent.put(rechits,rechitCollection_); LogDebug("EcalRawToRecHit|Producer")<<"collections uploaded." << watcher.lap(); } }
std::string EcalRawToRecHitProducer::EBrechitCollection_ [private] |
Definition at line 70 of file EcalRawToRecHitProducer.h.
Referenced by EcalRawToRecHitProducer(), and produce().
std::string EcalRawToRecHitProducer::EErechitCollection_ [private] |
Definition at line 71 of file EcalRawToRecHitProducer.h.
Referenced by EcalRawToRecHitProducer(), and produce().
Definition at line 66 of file EcalRawToRecHitProducer.h.
Referenced by EcalRawToRecHitProducer(), and produce().
std::string EcalRawToRecHitProducer::rechitCollection_ [private] |
Definition at line 72 of file EcalRawToRecHitProducer.h.
Referenced by EcalRawToRecHitProducer(), and produce().
Definition at line 67 of file EcalRawToRecHitProducer.h.
Referenced by EcalRawToRecHitProducer(), and produce().
bool EcalRawToRecHitProducer::splitOutput_ [private] |
Definition at line 69 of file EcalRawToRecHitProducer.h.
Referenced by EcalRawToRecHitProducer(), and produce().