#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 | beginJob (const edm::EventSetup &) |
virtual void | endJob () |
virtual void | produce (edm::Event &, const edm::EventSetup &) |
Private Attributes | |
std::string | EBrechitCollection_ |
std::string | EErechitCollection_ |
edm::InputTag | fedListTag_ |
bool | global_ |
edm::InputTag | lsourceTag_ |
edm::InputTag | sourceTag_ |
bool | splitOutput_ |
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(), global_, LogDebug, lsourceTag_, sourceTag_, and splitOutput_.
00004 { 00005 lsourceTag_=iConfig.getParameter<edm::InputTag>("lazyGetterTag"); 00006 sourceTag_=iConfig.getParameter<edm::InputTag>("sourceTag"); 00007 00008 splitOutput_=iConfig.getParameter<bool>("splitOutput"); 00009 if (splitOutput_){ 00010 EBrechitCollection_=iConfig.getParameter<std::string>("EBrechitCollection"); 00011 EErechitCollection_=iConfig.getParameter<std::string>("EErechitCollection"); 00012 produces<EBRecHitCollection>(EBrechitCollection_); 00013 produces<EERecHitCollection>(EErechitCollection_); 00014 LogDebug("EcalRawToRecHit|Producer")<<"ready to create rechits from lazy getter: "<<sourceTag_ 00015 <<"\n "<<((global_)?" global":"regional")<<" RAW->RecHit" 00016 <<"\n splitting in two collections" 00017 <<"\n EB instance: "<<EBrechitCollection_ 00018 <<"\n EE instance: "<<EErechitCollection_; 00019 } 00020 else{ 00021 produces<EcalRecHitCollection>(); 00022 LogDebug("EcalRawToRecHit|Producer")<<"ready to create rechits from lazy getter: "<<sourceTag_ 00023 <<"\n "<<((global_)?" global":"regional")<<" RAW->RecHit"; 00024 } 00025 }
EcalRawToRecHitProducer::~EcalRawToRecHitProducer | ( | ) |
void EcalRawToRecHitProducer::beginJob | ( | const edm::EventSetup & | ) | [private, virtual] |
void EcalRawToRecHitProducer::produce | ( | edm::Event & | iEvent, | |
const edm::EventSetup & | iSetup | |||
) | [private, virtual] |
Implements edm::EDProducer.
Definition at line 39 of file EcalRawToRecHitProducer.cc.
References EBrechitCollection_, EErechitCollection_, edm::Event::getByLabel(), edm::Handle< T >::id(), MyWatcher::lap(), LogDebug, lsourceTag_, edm::Event::put(), sourceTag_, splitOutput_, and DetId::subdetId().
00040 { 00041 using namespace edm; 00042 00043 MyWatcher watcher("Producer"); 00044 LogDebug("EcalRawToRecHit|Producer")<<watcher.lap(); 00045 00046 //retrieve a lazygetter 00047 edm::Handle<EcalRecHitLazyGetter> lgetter; 00048 iEvent.getByLabel(lsourceTag_, lgetter); 00049 LogDebug("EcalRawToRecHit|Producer")<<"lazy getter retreived." 00050 <<watcher.lap(); 00051 00052 //retrieve a refgetter 00053 edm::Handle<EcalRecHitRefGetter> rgetter; 00054 iEvent.getByLabel(sourceTag_ ,rgetter); 00055 LogDebug("EcalRawToRecHit|Producer")<<"ref getter retreived." 00056 <<watcher.lap(); 00057 00058 00059 if (splitOutput_){ 00060 //prepare the output collection 00061 std::auto_ptr<EBRecHitCollection> EBrechits( new EBRecHitCollection ); 00062 std::auto_ptr<EERecHitCollection> EErechits( new EERecHitCollection ); 00063 //loop the refgetter 00064 uint iR=0; 00065 EcalRecHitRefGetter::const_iterator iRegion=rgetter->begin(); 00066 EcalRecHitRefGetter::const_iterator iRegionEnd=rgetter->end(); 00067 for (;iRegion!=iRegionEnd;++iRegion){ 00068 LogDebug("EcalRawToRecHit|Producer")<<"looping over refgetter region: "<<iR<<watcher.lap(); 00069 std::vector<EcalRecHit>::const_iterator iRecHit=lgetter->begin_record()+iRegion->start(); 00070 std::vector<EcalRecHit>::const_iterator iRecHitEnd =lgetter->begin_record()+iRegion->finish(); 00071 for (;iRecHit!=iRecHitEnd;iRecHit++){ 00072 DetId detid =iRecHit->id(); 00073 //split barrel and endcap 00074 int EcalNum=detid.subdetId(); //1 stands for Barrel, 2 for endcaps 00075 LogDebug("EcalRawToRecHit|Producer")<<"subdetId is: "<<EcalNum; 00076 if (EcalNum==1) EBrechits->push_back(*iRecHit); 00077 else if (EcalNum==2) EErechits->push_back(*iRecHit); 00078 else { 00079 edm::LogError("EcalRawToRecHit|Producer")<<" a subdetid is not recognized. recHit on :"<< iRecHit->id().rawId() 00080 <<" is lost."; 00081 }//subdetid 00082 }//loop over things in region 00083 LogDebug("EcalRawToRecHit|Producer")<<"looping over refgetter region: "<<iR++<<" done" 00084 <<watcher.lap(); 00085 }//loop over regions 00086 00087 LogDebug("EcalRawToRecHit|Producer")<<EBrechits->size()<<" EB recHits to be put with instance: "<<EBrechitCollection_ 00088 <<"\n"<<EErechits->size()<<" EE recHits to be put with instance: "<<EErechitCollection_ 00089 << watcher.lap(); 00090 iEvent.put(EBrechits, EBrechitCollection_); 00091 iEvent.put(EErechits, EErechitCollection_); 00092 LogDebug("EcalRawToRecHit|Producer")<<"collections uploaded." 00093 << watcher.lap(); 00094 } 00095 else{ 00096 //prepare the output collection 00097 std::auto_ptr< EcalRecHitCollection > rechits( new EcalRecHitCollection); 00098 //loop the refgetter 00099 EcalRecHitRefGetter::const_iterator iRegion=rgetter->begin(); 00100 EcalRecHitRefGetter::const_iterator iRegionEnd=rgetter->end(); 00101 for (;iRegion!=iRegionEnd;++iRegion){ 00102 std::vector<EcalRecHit>::const_iterator iRecHit=lgetter->begin_record()+iRegion->start(); 00103 std::vector<EcalRecHit>::const_iterator iRecHitEnd=lgetter->begin_record()+iRegion->finish(); 00104 for (;iRecHit!=iRecHitEnd;iRecHit++){ 00105 rechits->push_back(*iRecHit); 00106 }//loop over things in region 00107 }//loop over regions 00108 LogDebug("EcalRawToRecHit|Producer")<<rechits->size()<<" rechits to be put." 00109 << watcher.lap(); 00110 iEvent.put(rechits); 00111 LogDebug("EcalRawToRecHit|Producer")<<"collections uploaded." 00112 << watcher.lap(); 00113 } 00114 00115 }
std::string EcalRawToRecHitProducer::EBrechitCollection_ [private] |
Definition at line 74 of file EcalRawToRecHitProducer.h.
Referenced by EcalRawToRecHitProducer(), and produce().
std::string EcalRawToRecHitProducer::EErechitCollection_ [private] |
Definition at line 75 of file EcalRawToRecHitProducer.h.
Referenced by EcalRawToRecHitProducer(), and produce().
Definition at line 70 of file EcalRawToRecHitProducer.h.
bool EcalRawToRecHitProducer::global_ [private] |
Definition at line 68 of file EcalRawToRecHitProducer.h.
Referenced by EcalRawToRecHitProducer(), and produce().
Definition at line 69 of file EcalRawToRecHitProducer.h.
Referenced by EcalRawToRecHitProducer(), and produce().
bool EcalRawToRecHitProducer::splitOutput_ [private] |
Definition at line 73 of file EcalRawToRecHitProducer.h.
Referenced by EcalRawToRecHitProducer(), and produce().