CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
EcalRawToRecHitProducer Class Reference

#include <EventFilter/EcalRawToRecHitProducer/src/EcalRawToRecHitProducer.cc>

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

Public Types

typedef edm::LazyGetter
< EcalRecHit
EcalRecHitLazyGetter
 
typedef edm::RefGetter
< EcalRecHit
EcalRecHitRefGetter
 
- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 

Public Member Functions

 EcalRawToRecHitProducer (const edm::ParameterSet &)
 
 ~EcalRawToRecHitProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

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_
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

Description: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>="">

Definition at line 53 of file EcalRawToRecHitProducer.h.

Member Typedef Documentation

Definition at line 56 of file EcalRawToRecHitProducer.h.

Definition at line 57 of file EcalRawToRecHitProducer.h.

Constructor & Destructor Documentation

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_.

4 {
5  lsourceTag_=iConfig.getParameter<edm::InputTag>("lazyGetterTag");
6  sourceTag_=iConfig.getParameter<edm::InputTag>("sourceTag");
7 
8  splitOutput_=iConfig.getParameter<bool>("splitOutput");
9  if (splitOutput_){
10  EBrechitCollection_=iConfig.getParameter<std::string>("EBrechitCollection");
11  EErechitCollection_=iConfig.getParameter<std::string>("EErechitCollection");
12  produces<EBRecHitCollection>(EBrechitCollection_);
13  produces<EERecHitCollection>(EErechitCollection_);
14  LogDebug("EcalRawToRecHit|Producer")<<"ready to create rechits from lazy getter: "<<lsourceTag_
15  <<"\n using region ref from: "<<sourceTag_
16  <<"\n splitting in two collections"
17  <<"\n EB instance: "<<EBrechitCollection_
18  <<"\n EE instance: "<<EErechitCollection_;
19  }
20  else{
21  rechitCollection_=iConfig.getParameter<std::string>("rechitCollection");
22  produces<EcalRecHitCollection>(rechitCollection_);
23  LogDebug("EcalRawToRecHit|Producer")<<"ready to create rechits from lazy getter: "<<lsourceTag_
24  <<"\n using region ref from: "<<sourceTag_
25  <<"\n not splitting the output collection.";
26  }
27 }
#define LogDebug(id)
T getParameter(std::string const &) const
EcalRawToRecHitProducer::~EcalRawToRecHitProducer ( )

Definition at line 30 of file EcalRawToRecHitProducer.cc.

31 {
32 }

Member Function Documentation

void EcalRawToRecHitProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

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

Referenced by python.JSONExport.JsonExport::export(), and python.HTMLExport.HTMLExport::export().

42 {
43  using namespace edm;
44 
45  MyWatcher watcher("Producer");
46  LogDebug("EcalRawToRecHit|Producer")<<watcher.lap();
47 
48  //retrieve a lazygetter
50  iEvent.getByLabel(lsourceTag_, lgetter);
51  LogDebug("EcalRawToRecHit|Producer")<<"lazy getter retreived from: "<<lsourceTag_<<(lgetter.failedToGet()?" not valid ":"valid")
52  <<watcher.lap();
53 
54  //retrieve a refgetter
56  iEvent.getByLabel(sourceTag_ ,rgetter);
57  LogDebug("EcalRawToRecHit|Producer")<<"ref getter retreived from: "<<sourceTag_<<(rgetter.failedToGet()?" not valid ":"valid")
58  <<watcher.lap();
59 
60 
61  if (splitOutput_){
62  //prepare the output collection
63  std::auto_ptr<EBRecHitCollection> EBrechits( new EBRecHitCollection );
64  std::auto_ptr<EERecHitCollection> EErechits( new EERecHitCollection );
65  //loop the refgetter
66  unsigned int iR=0;
67  EcalRecHitRefGetter::const_iterator iRegion=rgetter->begin();
68  EcalRecHitRefGetter::const_iterator iRegionEnd=rgetter->end();
69  for (;iRegion!=iRegionEnd;++iRegion){
70  LogDebug("EcalRawToRecHit|Producer")<<"looping over refgetter region: "<<iR<<watcher.lap();
71  std::vector<EcalRecHit>::const_iterator iRecHit=lgetter->begin_record()+iRegion->start();
72  std::vector<EcalRecHit>::const_iterator iRecHitEnd =lgetter->begin_record()+iRegion->finish();
73  for (;iRecHit!=iRecHitEnd;iRecHit++){
74  DetId detid =iRecHit->id();
75  //split barrel and endcap
76  int EcalNum=detid.subdetId(); //1 stands for Barrel, 2 for endcaps
77  LogDebug("EcalRawToRecHit|Producer")<<"subdetId is: "<<EcalNum;
78  if (EcalNum==1) EBrechits->push_back(*iRecHit);
79  else if (EcalNum==2) EErechits->push_back(*iRecHit);
80  else {
81  edm::LogError("IncorrectRecHit")<<" a subdetid is not recognized. recHit on :"<< iRecHit->id().rawId()
82  <<" is lost.";
83  }//subdetid
84  }//loop over things in region
85  LogDebug("EcalRawToRecHit|Producer")<<"looping over refgetter region: "<<iR++<<" done"
86  <<watcher.lap();
87  }//loop over regions
88 
89  LogDebug("EcalRawToRecHit|Producer")<<EBrechits->size()<<" EB recHits to be put with instance: "<<EBrechitCollection_
90  <<"\n"<<EErechits->size()<<" EE recHits to be put with instance: "<<EErechitCollection_
91  << watcher.lap();
92  iEvent.put(EBrechits, EBrechitCollection_);
93  iEvent.put(EErechits, EErechitCollection_);
94  LogDebug("EcalRawToRecHit|Producer")<<"collections uploaded."
95  << watcher.lap();
96  }
97  else{
98  //prepare the output collection
99  std::auto_ptr< EcalRecHitCollection > rechits( new EcalRecHitCollection);
100  //loop the refgetter
101  unsigned int iR=0;
102  EcalRecHitRefGetter::const_iterator iRegion=rgetter->begin();
103  EcalRecHitRefGetter::const_iterator iRegionEnd=rgetter->end();
104  for (;iRegion!=iRegionEnd;++iRegion){
105  LogDebug("EcalRawToRecHit|Producer")<<"looping over refgetter region: "<<iR<<watcher.lap();
106  std::vector<EcalRecHit>::const_iterator iRecHit=lgetter->begin_record()+iRegion->start();
107  std::vector<EcalRecHit>::const_iterator iRecHitEnd=lgetter->begin_record()+iRegion->finish();
108  for (;iRecHit!=iRecHitEnd;iRecHit++){
109  LogDebug("EcalRawToRecHit|Producer")<<"dereferencing rechit ref.";
110  DetId detid =iRecHit->id();
111  int EcalNum=detid.subdetId(); //1 stands for Barrel, 2 for endcaps
112  LogDebug("EcalRawToRecHit|Producer")<<"subdetId is: "<<EcalNum;
113  rechits->push_back(*iRecHit);
114  }//loop over things in region
115  LogDebug("EcalRawToRecHit|Producer")<<"looping over refgetter region: "<<iR++<<" done"<<watcher.lap();
116  }//loop over regions
117  LogDebug("EcalRawToRecHit|Producer")<<rechits->size()<<" rechits to be put."<< watcher.lap();
118  iEvent.put(rechits,rechitCollection_);
119  LogDebug("EcalRawToRecHit|Producer")<<"collections uploaded."
120  << watcher.lap();
121  }
122 
123 }
#define LogDebug(id)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:84
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:39
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:359
Definition: DetId.h:20
boost::indirect_iterator< typename collection_type::const_iterator > const_iterator
Definition: RefGetter.h:24

Member Data Documentation

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

edm::InputTag EcalRawToRecHitProducer::lsourceTag_
private

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

edm::InputTag EcalRawToRecHitProducer::sourceTag_
private

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