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::EDConsumerBase edm::ProductRegistryHelper

Public Types

typedef edm::LazyGetter
< EcalRecHit
EcalRecHitLazyGetter
 
typedef edm::RefGetter
< EcalRecHit
EcalRecHitRefGetter
 
- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- 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 ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

virtual void produce (edm::Event &, const edm::EventSetup &)
 

Private Attributes

EcalCleaningAlgocleaningAlgo_
 
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)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

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

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

Definition at line 54 of file EcalRawToRecHitProducer.h.

Member Typedef Documentation

Definition at line 57 of file EcalRawToRecHitProducer.h.

Definition at line 58 of file EcalRawToRecHitProducer.h.

Constructor & Destructor Documentation

EcalRawToRecHitProducer::EcalRawToRecHitProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 4 of file EcalRawToRecHitProducer.cc.

References cleaningAlgo_, EBrechitCollection_, EErechitCollection_, edm::ParameterSet::empty(), edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), LogDebug, lsourceTag_, rechitCollection_, sourceTag_, splitOutput_, and AlCaHLTBitMon_QueryRunRegistry::string.

5 {
6  lsourceTag_=iConfig.getParameter<edm::InputTag>("lazyGetterTag");
7  sourceTag_=iConfig.getParameter<edm::InputTag>("sourceTag");
8 
9  splitOutput_=iConfig.getParameter<bool>("splitOutput");
10  if (splitOutput_){
11  EBrechitCollection_=iConfig.getParameter<std::string>("EBrechitCollection");
12  EErechitCollection_=iConfig.getParameter<std::string>("EErechitCollection");
13  produces<EBRecHitCollection>(EBrechitCollection_);
14  produces<EERecHitCollection>(EErechitCollection_);
15  LogDebug("EcalRawToRecHit|Producer")<<"ready to create rechits from lazy getter: "<<lsourceTag_
16  <<"\n using region ref from: "<<sourceTag_
17  <<"\n splitting in two collections"
18  <<"\n EB instance: "<<EBrechitCollection_
19  <<"\n EE instance: "<<EErechitCollection_;
20  }
21  else{
22  rechitCollection_=iConfig.getParameter<std::string>("rechitCollection");
23  produces<EcalRecHitCollection>(rechitCollection_);
24  LogDebug("EcalRawToRecHit|Producer")<<"ready to create rechits from lazy getter: "<<lsourceTag_
25  <<"\n using region ref from: "<<sourceTag_
26  <<"\n not splitting the output collection.";
27  }
28 
29  cleaningAlgo_=0;
30  if (iConfig.exists("cleaningConfig")){
31  const edm::ParameterSet & cleaning=iConfig.getParameter<edm::ParameterSet>("cleaningConfig");
32  if (!cleaning.empty())
33  cleaningAlgo_ = new EcalCleaningAlgo(cleaning);
34  }
35 }
#define LogDebug(id)
T getParameter(std::string const &) const
bool empty() const
Definition: ParameterSet.h:216
bool exists(std::string const &parameterName) const
checks if a parameter exists
EcalCleaningAlgo * cleaningAlgo_
EcalRawToRecHitProducer::~EcalRawToRecHitProducer ( )

Definition at line 38 of file EcalRawToRecHitProducer.cc.

References cleaningAlgo_.

39 {
40  if (cleaningAlgo_) delete cleaningAlgo_;
41 }
EcalCleaningAlgo * cleaningAlgo_

Member Function Documentation

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

Implements edm::EDProducer.

Definition at line 50 of file EcalRawToRecHitProducer.cc.

References cleaningAlgo_, cond::rpcobgas::detid, EBrechitCollection_, EErechitCollection_, edm::Event::getByLabel(), LogDebug, lsourceTag_, edm::Event::put(), rechitCollection_, HI_PhotonSkim_cff::rechits, EcalCleaningAlgo::setFlags(), sourceTag_, splitOutput_, and DetId::subdetId().

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

51 {
52  using namespace edm;
53 
54 // MyWatcher watcher("Producer");
55 // LogDebug("EcalRawToRecHit|Producer")<<watcher.lap();
56 
57  //retrieve a lazygetter
59  iEvent.getByLabel(lsourceTag_, lgetter);
60  LogDebug("EcalRawToRecHit|Producer")<<"lazy getter retreived from: "<<lsourceTag_<<(lgetter.failedToGet()?" not valid ":"valid") ;
61 // <<watcher.lap();
62 
63  //retrieve a refgetter
65  iEvent.getByLabel(sourceTag_ ,rgetter);
66  LogDebug("EcalRawToRecHit|Producer")<<"ref getter retreived from: "<<sourceTag_<<(rgetter.failedToGet()?" not valid ":"valid");
67 // <<watcher.lap();
68 
69 
70  if (splitOutput_){
71  //prepare the output collection
72  std::auto_ptr<EBRecHitCollection> EBrechits( new EBRecHitCollection );
73  std::auto_ptr<EERecHitCollection> EErechits( new EERecHitCollection );
74  //loop the refgetter
75  unsigned int iR=0;
76  EcalRecHitRefGetter::const_iterator iRegion=rgetter->begin();
77  EcalRecHitRefGetter::const_iterator iRegionEnd=rgetter->end();
78  for (;iRegion!=iRegionEnd;++iRegion){
79  LogDebug("EcalRawToRecHit|Producer")<<"looping over refgetter region: "<<iR;
80 //<<watcher.lap();
81  lgetter->setEvent(iEvent);
82  std::vector<EcalRecHit>::const_iterator iRecHit=lgetter->begin_record()+iRegion->start();
83  std::vector<EcalRecHit>::const_iterator iRecHitEnd =lgetter->begin_record()+iRegion->finish();
84  for (;iRecHit!=iRecHitEnd;iRecHit++){
85  DetId detid =iRecHit->id();
86  //split barrel and endcap
87  int EcalNum=detid.subdetId(); //1 stands for Barrel, 2 for endcaps
88  LogDebug("EcalRawToRecHit|Producer")<<"subdetId is: "<<EcalNum;
89  if (EcalNum==1) EBrechits->push_back(*iRecHit);
90  else if (EcalNum==2) EErechits->push_back(*iRecHit);
91  else {
92  edm::LogError("IncorrectRecHit")<<" a subdetid is not recognized. recHit on :"<< iRecHit->id().rawId()
93  <<" is lost.";
94  }//subdetid
95  }//loop over things in region
96  LogDebug("EcalRawToRecHit|Producer")<<"looping over refgetter region: "<<iR++<<" done";
97 // <<watcher.lap();
98  }//loop over regions
99 
100  LogDebug("EcalRawToRecHit|Producer")<<EBrechits->size()<<" EB recHits to be put with instance: "<<EBrechitCollection_
101  <<"\n"<<EErechits->size()<<" EE recHits to be put with instance: "<<EErechitCollection_ ;
102 // << watcher.lap();
103 
104  // cleaning of anomalous signals, aka spikes
105  // only doable once we have a "global" collection of hits
106  if (cleaningAlgo_){
107  EBrechits->sort();
108  EErechits->sort();
109  cleaningAlgo_->setFlags(*EBrechits);
110  cleaningAlgo_->setFlags(*EErechits);
111  }
112 
113  iEvent.put(EBrechits, EBrechitCollection_);
114  iEvent.put(EErechits, EErechitCollection_);
115  LogDebug("EcalRawToRecHit|Producer")<<"collections uploaded.";
116 // << watcher.lap();
117  }
118  else{
119  //prepare the output collection
120  std::auto_ptr< EcalRecHitCollection > rechits( new EcalRecHitCollection);
121  //loop the refgetter
122  unsigned int iR=0;
123  EcalRecHitRefGetter::const_iterator iRegion=rgetter->begin();
124  EcalRecHitRefGetter::const_iterator iRegionEnd=rgetter->end();
125  for (;iRegion!=iRegionEnd;++iRegion){
126  LogDebug("EcalRawToRecHit|Producer")<<"looping over refgetter region: "<<iR ;
127 //<<watcher.lap();
128  lgetter->setEvent(iEvent);
129  std::vector<EcalRecHit>::const_iterator iRecHit=lgetter->begin_record()+iRegion->start();
130  std::vector<EcalRecHit>::const_iterator iRecHitEnd=lgetter->begin_record()+iRegion->finish();
131  for (;iRecHit!=iRecHitEnd;iRecHit++){
132  LogDebug("EcalRawToRecHit|Producer")<<"dereferencing rechit ref.";
133  DetId detid =iRecHit->id();
134  int EcalNum=detid.subdetId(); //1 stands for Barrel, 2 for endcaps
135  LogDebug("EcalRawToRecHit|Producer")<<"subdetId is: "<<EcalNum;
136  rechits->push_back(*iRecHit);
137  }//loop over things in region
138  LogDebug("EcalRawToRecHit|Producer")<<"looping over refgetter region: "<<iR++<<" done" ;
139 //<<watcher.lap();
140  }//loop over regions
141 
142  if (cleaningAlgo_){
143  rechits->sort();
145  }
146  LogDebug("EcalRawToRecHit|Producer")<<rechits->size()<<" rechits to be put." ;
147 //<< watcher.lap();
148  iEvent.put(rechits,rechitCollection_);
149  LogDebug("EcalRawToRecHit|Producer")<<"collections uploaded." ;
150 // << watcher.lap();
151  }
152 
153 }
#define LogDebug(id)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
EcalCleaningAlgo * cleaningAlgo_
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390
Definition: DetId.h:18
boost::indirect_iterator< typename collection_type::const_iterator > const_iterator
Definition: RefGetter.h:25
void setFlags(EcalRecHitCollection &rhs)

Member Data Documentation

EcalCleaningAlgo* EcalRawToRecHitProducer::cleaningAlgo_
private
std::string EcalRawToRecHitProducer::EBrechitCollection_
private

Definition at line 71 of file EcalRawToRecHitProducer.h.

Referenced by EcalRawToRecHitProducer(), and produce().

std::string EcalRawToRecHitProducer::EErechitCollection_
private

Definition at line 72 of file EcalRawToRecHitProducer.h.

Referenced by EcalRawToRecHitProducer(), and produce().

edm::InputTag EcalRawToRecHitProducer::lsourceTag_
private

Definition at line 67 of file EcalRawToRecHitProducer.h.

Referenced by EcalRawToRecHitProducer(), and produce().

std::string EcalRawToRecHitProducer::rechitCollection_
private

Definition at line 73 of file EcalRawToRecHitProducer.h.

Referenced by EcalRawToRecHitProducer(), and produce().

edm::InputTag EcalRawToRecHitProducer::sourceTag_
private

Definition at line 68 of file EcalRawToRecHitProducer.h.

Referenced by EcalRawToRecHitProducer(), and produce().

bool EcalRawToRecHitProducer::splitOutput_
private

Definition at line 70 of file EcalRawToRecHitProducer.h.

Referenced by EcalRawToRecHitProducer(), and produce().