CMS 3D CMS Logo

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

#include <EcalRecHitProducer.h>

Inheritance diagram for EcalRecHitProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 EcalRecHitProducer (const edm::ParameterSet &ps)
 
virtual void produce (edm::Event &evt, const edm::EventSetup &es)
 
 ~EcalRecHitProducer ()
 
- 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 Attributes

EcalCleaningAlgocleaningAlgo_
 
edm::EDGetTokenT< std::set
< EBDetId > > 
ebDetIdToBeRecoveredToken_
 
edm::EDGetTokenT< std::set
< EcalTrigTowerDetId > > 
ebFEToBeRecoveredToken_
 
std::string ebRechitCollection_
 
edm::EDGetTokenT
< EBUncalibratedRecHitCollection
ebUncalibRecHitToken_
 
edm::EDGetTokenT< std::set
< EEDetId > > 
eeDetIdToBeRecoveredToken_
 
edm::EDGetTokenT< std::set
< EcalScDetId > > 
eeFEToBeRecoveredToken_
 
std::string eeRechitCollection_
 
edm::EDGetTokenT
< EEUncalibratedRecHitCollection
eeUncalibRecHitToken_
 
bool killDeadChannels_
 
bool recoverEBFE_
 
bool recoverEBIsolatedChannels_
 
bool recoverEBVFE_
 
bool recoverEEFE_
 
bool recoverEEIsolatedChannels_
 
bool recoverEEVFE_
 
EcalRecHitWorkerBaseClassworker_
 
EcalRecHitWorkerBaseClassworkerRecover_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- 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

produce ECAL rechits from uncalibrated rechits

Author
Shahram Rahatlou, University of Rome & INFN, March 2006

Definition at line 26 of file EcalRecHitProducer.h.

Constructor & Destructor Documentation

EcalRecHitProducer::EcalRecHitProducer ( const edm::ParameterSet ps)
explicit

Definition at line 28 of file EcalRecHitProducer.cc.

References trackerHits::c, cleaningAlgo_, edm::EDConsumerBase::consumesCollector(), ebDetIdToBeRecoveredToken_, ebFEToBeRecoveredToken_, ebRechitCollection_, ebUncalibRecHitToken_, eeDetIdToBeRecoveredToken_, eeFEToBeRecoveredToken_, eeRechitCollection_, eeUncalibRecHitToken_, reco::get(), edm::ParameterSet::getParameter(), killDeadChannels_, recoverEBFE_, recoverEBIsolatedChannels_, recoverEBVFE_, recoverEEFE_, recoverEEIsolatedChannels_, recoverEEVFE_, AlCaHLTBitMon_QueryRunRegistry::string, worker_, and workerRecover_.

29 {
30 
31  ebRechitCollection_ = ps.getParameter<std::string>("EBrechitCollection");
32  eeRechitCollection_ = ps.getParameter<std::string>("EErechitCollection");
33 
34  recoverEBIsolatedChannels_ = ps.getParameter<bool>("recoverEBIsolatedChannels");
35  recoverEEIsolatedChannels_ = ps.getParameter<bool>("recoverEEIsolatedChannels");
36  recoverEBVFE_ = ps.getParameter<bool>("recoverEBVFE");
37  recoverEEVFE_ = ps.getParameter<bool>("recoverEEVFE");
38  recoverEBFE_ = ps.getParameter<bool>("recoverEBFE");
39  recoverEEFE_ = ps.getParameter<bool>("recoverEEFE");
40  killDeadChannels_ = ps.getParameter<bool>("killDeadChannels");
41 
42 
43  produces< EBRecHitCollection >(ebRechitCollection_);
44  produces< EERecHitCollection >(eeRechitCollection_);
45 
46 
48  consumes<EBUncalibratedRecHitCollection>( ps.getParameter<edm::InputTag>("EBuncalibRecHitCollection"));
49 
51  consumes<EEUncalibratedRecHitCollection>( ps.getParameter<edm::InputTag>("EEuncalibRecHitCollection"));
52 
54  consumes<std::set<EBDetId>>(ps.getParameter<edm::InputTag>("ebDetIdToBeRecovered"));
55 
57  consumes<std::set<EEDetId>>(ps.getParameter<edm::InputTag>("eeDetIdToBeRecovered"));
58 
59  ebFEToBeRecoveredToken_ = consumes<std::set<EcalTrigTowerDetId>>(ps.getParameter<edm::InputTag>("ebFEToBeRecovered"));
60 
61  eeFEToBeRecoveredToken_= consumes<std::set<EcalScDetId>>( ps.getParameter<edm::InputTag>("eeFEToBeRecovered")) ;
62 
63  std::string componentType = ps.getParameter<std::string>("algo");
65  worker_ = EcalRecHitWorkerFactory::get()->create(componentType, ps, c);
66 
67  // to recover problematic channels
68  componentType = ps.getParameter<std::string>("algoRecover");
69  workerRecover_ = EcalRecHitWorkerFactory::get()->create(componentType, ps, c);
70 
71  edm::ParameterSet cleaningPs =
72  ps.getParameter<edm::ParameterSet>("cleaningConfig");
73  cleaningAlgo_ = new EcalCleaningAlgo(cleaningPs);
74 }
std::string eeRechitCollection_
T getParameter(std::string const &) const
EcalRecHitWorkerBaseClass * worker_
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
EcalCleaningAlgo * cleaningAlgo_
edm::EDGetTokenT< EEUncalibratedRecHitCollection > eeUncalibRecHitToken_
edm::EDGetTokenT< std::set< EcalScDetId > > eeFEToBeRecoveredToken_
edm::EDGetTokenT< EBUncalibratedRecHitCollection > ebUncalibRecHitToken_
EcalRecHitWorkerBaseClass * workerRecover_
edm::EDGetTokenT< std::set< EBDetId > > ebDetIdToBeRecoveredToken_
std::string ebRechitCollection_
edm::EDGetTokenT< std::set< EEDetId > > eeDetIdToBeRecoveredToken_
T get(const Candidate &c)
Definition: component.h:55
edm::EDGetTokenT< std::set< EcalTrigTowerDetId > > ebFEToBeRecoveredToken_
EcalRecHitProducer::~EcalRecHitProducer ( )

Definition at line 76 of file EcalRecHitProducer.cc.

References cleaningAlgo_, worker_, and workerRecover_.

77 {
78  delete worker_;
79  delete workerRecover_;
80  delete cleaningAlgo_;
81 }
EcalRecHitWorkerBaseClass * worker_
EcalCleaningAlgo * cleaningAlgo_
EcalRecHitWorkerBaseClass * workerRecover_

Member Function Documentation

void EcalRecHitProducer::produce ( edm::Event evt,
const edm::EventSetup es 
)
virtual

Implements edm::EDProducer.

Definition at line 84 of file EcalRecHitProducer.cc.

References cleaningAlgo_, EcalRecHitWorkerBaseClass::EB_FE, EcalRecHitWorkerBaseClass::EB_single, EcalRecHitWorkerBaseClass::EB_VFE, ebDetIdToBeRecoveredToken_, ebFEToBeRecoveredToken_, ebRechitCollection_, ebUncalibRecHitToken_, EcalRecHitWorkerBaseClass::EE_FE, EcalRecHitWorkerBaseClass::EE_single, EcalRecHitWorkerBaseClass::EE_VFE, eeDetIdToBeRecoveredToken_, eeFEToBeRecoveredToken_, eeRechitCollection_, eeUncalibRecHitToken_, EBDetId::ETAPHIMODE, edm::EventSetup::get(), edm::Event::getByToken(), EcalChannelStatusCode::getStatusCode(), killDeadChannels_, LogDebug, edm::Handle< T >::product(), edm::Event::put(), recoverEBFE_, recoverEBIsolatedChannels_, recoverEBVFE_, recoverEEFE_, recoverEEIsolatedChannels_, recoverEEVFE_, EcalRecHitWorkerBaseClass::run(), EcalRecHitWorkerBaseClass::set(), EcalCleaningAlgo::setFlags(), EEDetId::validDetId(), worker_, and workerRecover_.

85 {
86  using namespace edm;
87 
90 
91  const EBUncalibratedRecHitCollection* ebUncalibRecHits = 0;
92  const EEUncalibratedRecHitCollection* eeUncalibRecHits = 0;
93 
94  // get the barrel uncalib rechit collection
95 
96  evt.getByToken( ebUncalibRecHitToken_, pEBUncalibRecHits);
97  ebUncalibRecHits = pEBUncalibRecHits.product();
98  LogDebug("EcalRecHitDebug") << "total # EB uncalibrated rechits: " << ebUncalibRecHits->size();
99 
100 
101 
102  evt.getByToken( eeUncalibRecHitToken_, pEEUncalibRecHits);
103  eeUncalibRecHits = pEEUncalibRecHits.product(); // get a ptr to the product
104  LogDebug("EcalRecHitDebug") << "total # EE uncalibrated rechits: " << eeUncalibRecHits->size();
105 
106  // collection of rechits to put in the event
107  std::auto_ptr< EBRecHitCollection > ebRecHits( new EBRecHitCollection );
108  std::auto_ptr< EERecHitCollection > eeRecHits( new EERecHitCollection );
109 
110  worker_->set(es);
111 
115  || killDeadChannels_ ) {
116  workerRecover_->set(es);
117  }
118 
119  if (ebUncalibRecHits)
120  {
121  // loop over uncalibrated rechits to make calibrated ones
122  for(EBUncalibratedRecHitCollection::const_iterator it = ebUncalibRecHits->begin(); it != ebUncalibRecHits->end(); ++it) {
123  worker_->run(evt, *it, *ebRecHits);
124  }
125  }
126 
127  if (eeUncalibRecHits)
128  {
129  // loop over uncalibrated rechits to make calibrated ones
130  for(EEUncalibratedRecHitCollection::const_iterator it = eeUncalibRecHits->begin(); it != eeUncalibRecHits->end(); ++it) {
131  worker_->run(evt, *it, *eeRecHits);
132  }
133  }
134 
135  // sort collections before attempting recovery, to avoid insertion of double recHits
136  ebRecHits->sort();
137  eeRecHits->sort();
138 
140  {
142  const std::set<EBDetId> * detIds = 0;
143  evt.getByToken( ebDetIdToBeRecoveredToken_, pEBDetId);
144  detIds = pEBDetId.product();
145 
146 
147  if ( detIds ) {
149  es.get<EcalChannelStatusRcd>().get(chStatus);
150  for( std::set<EBDetId>::const_iterator it = detIds->begin(); it != detIds->end(); ++it ) {
151  // get channel status map to treat dead VFE separately
152  EcalChannelStatusMap::const_iterator chit = chStatus->find( *it );
153  EcalChannelStatusCode chStatusCode = 1;
154  if ( chit != chStatus->end() ) {
155  chStatusCode = *chit;
156  } else {
157  edm::LogError("EcalRecHitProducerError") << "No channel status found for xtal "
158  << (*it).rawId()
159  << "! something wrong with EcalChannelStatus in your DB? ";
160  }
162  if ( (chStatusCode.getStatusCode() & 0x001F) == 12 ) { // dead VFE (from DB info)
163  // uses the EcalUncalibratedRecHit to pass the DetId info
165  if ( recoverEBVFE_ || killDeadChannels_ ) workerRecover_->run( evt, urh, *ebRecHits );
166  } else {
167  // uses the EcalUncalibratedRecHit to pass the DetId info
169  if ( recoverEBIsolatedChannels_ || killDeadChannels_ ) workerRecover_->run( evt, urh, *ebRecHits );
170  }
171 
172  }
173  }
174  }
175 
177  {
179  const std::set<EEDetId> * detIds = 0;
180 
181  evt.getByToken( eeDetIdToBeRecoveredToken_, pEEDetId);
182  detIds = pEEDetId.product();
183 
184  if ( detIds ) {
186  es.get<EcalChannelStatusRcd>().get(chStatus);
187  for( std::set<EEDetId>::const_iterator it = detIds->begin(); it != detIds->end(); ++it ) {
188  // get channel status map to treat dead VFE separately
189  EcalChannelStatusMap::const_iterator chit = chStatus->find( *it );
190  EcalChannelStatusCode chStatusCode = 1;
191  if ( chit != chStatus->end() ) {
192  chStatusCode = *chit;
193  } else {
194  edm::LogError("EcalRecHitProducerError") << "No channel status found for xtal "
195  << (*it).rawId()
196  << "! something wrong with EcalChannelStatus in your DB? ";
197  }
199  if ( (chStatusCode.getStatusCode() & 0x001F) == 12 ) { // dead VFE (from DB info)
200  // uses the EcalUncalibratedRecHit to pass the DetId info
202  if ( recoverEEVFE_ || killDeadChannels_ ) workerRecover_->run( evt, urh, *eeRecHits );
203  } else {
204  // uses the EcalUncalibratedRecHit to pass the DetId info
206  if ( recoverEEIsolatedChannels_ || killDeadChannels_ ) workerRecover_->run( evt, urh, *eeRecHits );
207  }
208  }
209  }
210  }
211 
213  {
215  const std::set<EcalTrigTowerDetId> * ttIds = 0;
216 
217  evt.getByToken( ebFEToBeRecoveredToken_, pEBFEId);
218  ttIds = pEBFEId.product();
219 
220  if ( ttIds ) {
221  for( std::set<EcalTrigTowerDetId>::const_iterator it = ttIds->begin(); it != ttIds->end(); ++it ) {
222  // uses the EcalUncalibratedRecHit to pass the DetId info
223  int ieta = (((*it).ietaAbs()-1)*5+1)*(*it).zside(); // from EcalTrigTowerConstituentsMap
224  int iphi = ((*it).iphi()-1)*5+11; // from EcalTrigTowerConstituentsMap
225  if( iphi <= 0 ) iphi += 360; // from EcalTrigTowerConstituentsMap
227  workerRecover_->run( evt, urh, *ebRecHits );
228  }
229  }
230  }
231 
233  {
235  const std::set<EcalScDetId> * scIds = 0;
236 
237  evt.getByToken( eeFEToBeRecoveredToken_, pEEFEId);
238  scIds = pEEFEId.product();
239 
240 
241  if ( scIds ) {
242  for( std::set<EcalScDetId>::const_iterator it = scIds->begin(); it != scIds->end(); ++it ) {
243  // uses the EcalUncalibratedRecHit to pass the DetId info
244  if (EEDetId::validDetId( ((*it).ix()-1)*5+1, ((*it).iy()-1)*5+1, (*it).zside() )) {
245  EcalUncalibratedRecHit urh( EEDetId( ((*it).ix()-1)*5+1, ((*it).iy()-1)*5+1, (*it).zside() ), 0, 0, 0, 0, EcalRecHitWorkerBaseClass::EE_FE );
246  workerRecover_->run( evt, urh, *eeRecHits );
247  }
248  }
249  }
250  }
251 
252  // without re-sorting, find (used below in cleaning) will lead
253  // to undefined results
254  ebRecHits->sort();
255  eeRecHits->sort();
256 
257  // apply spike cleaning
258  if (cleaningAlgo_){
259  cleaningAlgo_->setFlags(*ebRecHits);
260  cleaningAlgo_->setFlags(*eeRecHits);
261  }
262 
263 
264  // put the collection of recunstructed hits in the event
265  LogInfo("EcalRecHitInfo") << "total # EB calibrated rechits: " << ebRecHits->size();
266  LogInfo("EcalRecHitInfo") << "total # EE calibrated rechits: " << eeRecHits->size();
267 
268  evt.put( ebRecHits, ebRechitCollection_ );
269  evt.put( eeRecHits, eeRechitCollection_ );
270 }
#define LogDebug(id)
std::string eeRechitCollection_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
std::vector< EcalUncalibratedRecHit >::const_iterator const_iterator
EcalRecHitWorkerBaseClass * worker_
uint16_t getStatusCode() const
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
EcalCleaningAlgo * cleaningAlgo_
edm::EDGetTokenT< EEUncalibratedRecHitCollection > eeUncalibRecHitToken_
edm::EDGetTokenT< std::set< EcalScDetId > > eeFEToBeRecoveredToken_
static const int ETAPHIMODE
Definition: EBDetId.h:166
edm::EDGetTokenT< EBUncalibratedRecHitCollection > ebUncalibRecHitToken_
EcalRecHitWorkerBaseClass * workerRecover_
virtual bool run(const edm::Event &evt, const EcalUncalibratedRecHit &uncalibRH, EcalRecHitCollection &result)=0
edm::EDGetTokenT< std::set< EBDetId > > ebDetIdToBeRecoveredToken_
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
Definition: EEDetId.h:248
std::string ebRechitCollection_
const T & get() const
Definition: EventSetup.h:55
std::vector< Item >::const_iterator const_iterator
T const * product() const
Definition: Handle.h:81
virtual void set(const edm::EventSetup &es)=0
void setFlags(EcalRecHitCollection &rhs)
edm::EDGetTokenT< std::set< EEDetId > > eeDetIdToBeRecoveredToken_
edm::EDGetTokenT< std::set< EcalTrigTowerDetId > > ebFEToBeRecoveredToken_

Member Data Documentation

EcalCleaningAlgo* EcalRecHitProducer::cleaningAlgo_
private

Definition at line 50 of file EcalRecHitProducer.h.

Referenced by EcalRecHitProducer(), produce(), and ~EcalRecHitProducer().

edm::EDGetTokenT<std::set<EBDetId> > EcalRecHitProducer::ebDetIdToBeRecoveredToken_
private

Definition at line 54 of file EcalRecHitProducer.h.

Referenced by EcalRecHitProducer(), and produce().

edm::EDGetTokenT<std::set<EcalTrigTowerDetId> > EcalRecHitProducer::ebFEToBeRecoveredToken_
private

Definition at line 56 of file EcalRecHitProducer.h.

Referenced by EcalRecHitProducer(), and produce().

std::string EcalRecHitProducer::ebRechitCollection_
private

Definition at line 35 of file EcalRecHitProducer.h.

Referenced by EcalRecHitProducer(), and produce().

edm::EDGetTokenT<EBUncalibratedRecHitCollection> EcalRecHitProducer::ebUncalibRecHitToken_
private

Definition at line 52 of file EcalRecHitProducer.h.

Referenced by EcalRecHitProducer(), and produce().

edm::EDGetTokenT<std::set<EEDetId> > EcalRecHitProducer::eeDetIdToBeRecoveredToken_
private

Definition at line 55 of file EcalRecHitProducer.h.

Referenced by EcalRecHitProducer(), and produce().

edm::EDGetTokenT< std::set<EcalScDetId> > EcalRecHitProducer::eeFEToBeRecoveredToken_
private

Definition at line 57 of file EcalRecHitProducer.h.

Referenced by EcalRecHitProducer(), and produce().

std::string EcalRecHitProducer::eeRechitCollection_
private

Definition at line 36 of file EcalRecHitProducer.h.

Referenced by EcalRecHitProducer(), and produce().

edm::EDGetTokenT<EEUncalibratedRecHitCollection> EcalRecHitProducer::eeUncalibRecHitToken_
private

Definition at line 53 of file EcalRecHitProducer.h.

Referenced by EcalRecHitProducer(), and produce().

bool EcalRecHitProducer::killDeadChannels_
private

Definition at line 44 of file EcalRecHitProducer.h.

Referenced by EcalRecHitProducer(), and produce().

bool EcalRecHitProducer::recoverEBFE_
private

Definition at line 42 of file EcalRecHitProducer.h.

Referenced by EcalRecHitProducer(), and produce().

bool EcalRecHitProducer::recoverEBIsolatedChannels_
private

Definition at line 38 of file EcalRecHitProducer.h.

Referenced by EcalRecHitProducer(), and produce().

bool EcalRecHitProducer::recoverEBVFE_
private

Definition at line 40 of file EcalRecHitProducer.h.

Referenced by EcalRecHitProducer(), and produce().

bool EcalRecHitProducer::recoverEEFE_
private

Definition at line 43 of file EcalRecHitProducer.h.

Referenced by EcalRecHitProducer(), and produce().

bool EcalRecHitProducer::recoverEEIsolatedChannels_
private

Definition at line 39 of file EcalRecHitProducer.h.

Referenced by EcalRecHitProducer(), and produce().

bool EcalRecHitProducer::recoverEEVFE_
private

Definition at line 41 of file EcalRecHitProducer.h.

Referenced by EcalRecHitProducer(), and produce().

EcalRecHitWorkerBaseClass* EcalRecHitProducer::worker_
private

Definition at line 47 of file EcalRecHitProducer.h.

Referenced by EcalRecHitProducer(), produce(), and ~EcalRecHitProducer().

EcalRecHitWorkerBaseClass* EcalRecHitProducer::workerRecover_
private

Definition at line 48 of file EcalRecHitProducer.h.

Referenced by EcalRecHitProducer(), produce(), and ~EcalRecHitProducer().