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::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 ()
 
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 Attributes

EcalCleaningAlgocleaningAlgo_
 
edm::InputTag ebDetIdToBeRecovered_
 
edm::InputTag ebFEToBeRecovered_
 
std::string ebRechitCollection_
 
edm::InputTag ebUncalibRecHitCollection_
 
edm::InputTag eeDetIdToBeRecovered_
 
edm::InputTag eeFEToBeRecovered_
 
std::string eeRechitCollection_
 
edm::InputTag eeUncalibRecHitCollection_
 
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
 
typedef WorkerT< EDProducerWorkerType
 
- 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::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

produce ECAL rechits from uncalibrated rechits

Id:
EcalRecHitProducer.cc,v 1.17 2011/05/20 13:14:32 argiro Exp
Date:
2011/05/20 13:14:32
Revision:
1.17
Author
Shahram Rahatlou, University of Rome & INFN, March 2006

produce ECAL rechits from uncalibrated rechits

Id:
EcalRecHitProducer.h,v 1.4 2011/01/12 13:59:24 argiro Exp
Date:
2011/01/12 13:59:24
Revision:
1.4
Author
Shahram Rahatlou, University of Rome & INFN, March 2006

Definition at line 25 of file EcalRecHitProducer.h.

Constructor & Destructor Documentation

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

Definition at line 31 of file EcalRecHitProducer.cc.

References cleaningAlgo_, ebDetIdToBeRecovered_, ebFEToBeRecovered_, ebRechitCollection_, ebUncalibRecHitCollection_, eeDetIdToBeRecovered_, eeFEToBeRecovered_, eeRechitCollection_, eeUncalibRecHitCollection_, reco::get(), edm::ParameterSet::getParameter(), killDeadChannels_, recoverEBFE_, recoverEBIsolatedChannels_, recoverEBVFE_, recoverEEFE_, recoverEEIsolatedChannels_, recoverEEVFE_, worker_, and workerRecover_.

32 {
33  ebUncalibRecHitCollection_ = ps.getParameter<edm::InputTag>("EBuncalibRecHitCollection");
34  eeUncalibRecHitCollection_ = ps.getParameter<edm::InputTag>("EEuncalibRecHitCollection");
35  ebRechitCollection_ = ps.getParameter<std::string>("EBrechitCollection");
36  eeRechitCollection_ = ps.getParameter<std::string>("EErechitCollection");
37 
38  recoverEBIsolatedChannels_ = ps.getParameter<bool>("recoverEBIsolatedChannels");
39  recoverEEIsolatedChannels_ = ps.getParameter<bool>("recoverEEIsolatedChannels");
40  recoverEBVFE_ = ps.getParameter<bool>("recoverEBVFE");
41  recoverEEVFE_ = ps.getParameter<bool>("recoverEEVFE");
42  recoverEBFE_ = ps.getParameter<bool>("recoverEBFE");
43  recoverEEFE_ = ps.getParameter<bool>("recoverEEFE");
44  killDeadChannels_ = ps.getParameter<bool>("killDeadChannels");
45 
46  ebDetIdToBeRecovered_ = ps.getParameter<edm::InputTag>("ebDetIdToBeRecovered");
47  eeDetIdToBeRecovered_ = ps.getParameter<edm::InputTag>("eeDetIdToBeRecovered");
48  ebFEToBeRecovered_ = ps.getParameter<edm::InputTag>("ebFEToBeRecovered");
49  eeFEToBeRecovered_ = ps.getParameter<edm::InputTag>("eeFEToBeRecovered");
50 
51  produces< EBRecHitCollection >(ebRechitCollection_);
52  produces< EERecHitCollection >(eeRechitCollection_);
53 
54  std::string componentType = ps.getParameter<std::string>("algo");
55  worker_ = EcalRecHitWorkerFactory::get()->create(componentType, ps);
56 
57  // to recover problematic channels
58  componentType = ps.getParameter<std::string>("algoRecover");
59  workerRecover_ = EcalRecHitWorkerFactory::get()->create(componentType, ps);
60 
61  edm::ParameterSet cleaningPs =
62  ps.getParameter<edm::ParameterSet>("cleaningConfig");
63  cleaningAlgo_ = new EcalCleaningAlgo(cleaningPs);
64 }
std::string eeRechitCollection_
T getParameter(std::string const &) const
edm::InputTag ebFEToBeRecovered_
edm::InputTag ebDetIdToBeRecovered_
edm::InputTag eeFEToBeRecovered_
EcalRecHitWorkerBaseClass * worker_
EcalCleaningAlgo * cleaningAlgo_
EcalRecHitWorkerBaseClass * workerRecover_
edm::InputTag eeDetIdToBeRecovered_
std::string ebRechitCollection_
edm::InputTag ebUncalibRecHitCollection_
T get(const Candidate &c)
Definition: component.h:56
edm::InputTag eeUncalibRecHitCollection_
EcalRecHitProducer::~EcalRecHitProducer ( )

Definition at line 66 of file EcalRecHitProducer.cc.

References cleaningAlgo_, worker_, and workerRecover_.

67 {
68  delete worker_;
69  delete workerRecover_;
70  delete cleaningAlgo_;
71 }
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 74 of file EcalRecHitProducer.cc.

References cleaningAlgo_, EcalRecHitWorkerBaseClass::EB_FE, EcalRecHitWorkerBaseClass::EB_single, EcalRecHitWorkerBaseClass::EB_VFE, ebDetIdToBeRecovered_, ebFEToBeRecovered_, ebRechitCollection_, ebUncalibRecHitCollection_, EcalRecHitWorkerBaseClass::EE_FE, EcalRecHitWorkerBaseClass::EE_single, EcalRecHitWorkerBaseClass::EE_VFE, eeDetIdToBeRecovered_, eeFEToBeRecovered_, eeRechitCollection_, eeUncalibRecHitCollection_, EBDetId::ETAPHIMODE, edm::EventSetup::get(), edm::Event::getByLabel(), EcalChannelStatusCode::getStatusCode(), edm::InputTag::instance(), edm::HandleBase::isValid(), killDeadChannels_, edm::InputTag::label(), 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_.

75 {
76  using namespace edm;
77 
80 
81  const EBUncalibratedRecHitCollection* ebUncalibRecHits = 0;
82  const EEUncalibratedRecHitCollection* eeUncalibRecHits = 0;
83 
84  // get the barrel uncalib rechit collection
86  evt.getByLabel( ebUncalibRecHitCollection_, pEBUncalibRecHits);
87  if ( pEBUncalibRecHits.isValid() ) {
88  ebUncalibRecHits = pEBUncalibRecHits.product();
89  LogDebug("EcalRecHitDebug") << "total # EB uncalibrated rechits: " << ebUncalibRecHits->size();
90  } else {
91  edm::LogError("EcalRecHitError") << "Error! can't get the product " << ebUncalibRecHitCollection_;
92  }
93  }
94 
96  evt.getByLabel( eeUncalibRecHitCollection_, pEEUncalibRecHits);
97  if ( pEEUncalibRecHits.isValid() ) {
98  eeUncalibRecHits = pEEUncalibRecHits.product(); // get a ptr to the product
99  LogDebug("EcalRecHitDebug") << "total # EE uncalibrated rechits: " << eeUncalibRecHits->size();
100  } else {
101  edm::LogError("EcalRecHitError") << "Error! can't get the product " << eeUncalibRecHitCollection_;
102  }
103  }
104 
105  // collection of rechits to put in the event
106  std::auto_ptr< EBRecHitCollection > ebRecHits( new EBRecHitCollection );
107  std::auto_ptr< EERecHitCollection > eeRecHits( new EERecHitCollection );
108 
109  worker_->set(es);
110 
114  || killDeadChannels_ ) {
115  workerRecover_->set(es);
116  }
117 
118  if (ebUncalibRecHits)
119  {
120  // loop over uncalibrated rechits to make calibrated ones
121  for(EBUncalibratedRecHitCollection::const_iterator it = ebUncalibRecHits->begin(); it != ebUncalibRecHits->end(); ++it) {
122  worker_->run(evt, *it, *ebRecHits);
123  }
124  }
125 
126  if (eeUncalibRecHits)
127  {
128  // loop over uncalibrated rechits to make calibrated ones
129  for(EEUncalibratedRecHitCollection::const_iterator it = eeUncalibRecHits->begin(); it != eeUncalibRecHits->end(); ++it) {
130  worker_->run(evt, *it, *eeRecHits);
131  }
132  }
133 
134  // sort collections before attempting recovery, to avoid insertion of double recHits
135  ebRecHits->sort();
136  eeRecHits->sort();
137 
139  {
141  const std::set<EBDetId> * detIds = 0;
142  if ( ebDetIdToBeRecovered_.label() != "" && ebDetIdToBeRecovered_.instance() != "" ) {
143  evt.getByLabel( ebDetIdToBeRecovered_, pEBDetId);
144  if ( pEBDetId.isValid() ) {
145  detIds = pEBDetId.product();
146  } else {
147  edm::LogError("EcalRecHitError") << "Error! can't get the product " << ebDetIdToBeRecovered_;
148  }
149  }
150  if ( detIds ) {
152  es.get<EcalChannelStatusRcd>().get(chStatus);
153  for( std::set<EBDetId>::const_iterator it = detIds->begin(); it != detIds->end(); ++it ) {
154  // get channel status map to treat dead VFE separately
155  EcalChannelStatusMap::const_iterator chit = chStatus->find( *it );
156  EcalChannelStatusCode chStatusCode = 1;
157  if ( chit != chStatus->end() ) {
158  chStatusCode = *chit;
159  } else {
160  edm::LogError("EcalRecHitProducerError") << "No channel status found for xtal "
161  << (*it).rawId()
162  << "! something wrong with EcalChannelStatus in your DB? ";
163  }
165  if ( (chStatusCode.getStatusCode() & 0x001F) == 12 ) { // dead VFE (from DB info)
166  // uses the EcalUncalibratedRecHit to pass the DetId info
168  if ( recoverEBVFE_ || killDeadChannels_ ) workerRecover_->run( evt, urh, *ebRecHits );
169  } else {
170  // uses the EcalUncalibratedRecHit to pass the DetId info
172  if ( recoverEBIsolatedChannels_ || killDeadChannels_ ) workerRecover_->run( evt, urh, *ebRecHits );
173  }
174 
175  }
176  }
177  }
178 
180  {
182  const std::set<EEDetId> * detIds = 0;
183  if ( eeDetIdToBeRecovered_.label() != "" && eeDetIdToBeRecovered_.instance() != "" ) {
184  evt.getByLabel( eeDetIdToBeRecovered_, pEEDetId);
185  if ( pEEDetId.isValid() ) {
186  detIds = pEEDetId.product();
187  } else {
188  edm::LogError("EcalRecHitError") << "Error! can't get the product " << eeDetIdToBeRecovered_;
189  }
190  }
191  if ( detIds ) {
193  es.get<EcalChannelStatusRcd>().get(chStatus);
194  for( std::set<EEDetId>::const_iterator it = detIds->begin(); it != detIds->end(); ++it ) {
195  // get channel status map to treat dead VFE separately
196  EcalChannelStatusMap::const_iterator chit = chStatus->find( *it );
197  EcalChannelStatusCode chStatusCode = 1;
198  if ( chit != chStatus->end() ) {
199  chStatusCode = *chit;
200  } else {
201  edm::LogError("EcalRecHitProducerError") << "No channel status found for xtal "
202  << (*it).rawId()
203  << "! something wrong with EcalChannelStatus in your DB? ";
204  }
206  if ( (chStatusCode.getStatusCode() & 0x001F) == 12 ) { // dead VFE (from DB info)
207  // uses the EcalUncalibratedRecHit to pass the DetId info
209  if ( recoverEEVFE_ || killDeadChannels_ ) workerRecover_->run( evt, urh, *eeRecHits );
210  } else {
211  // uses the EcalUncalibratedRecHit to pass the DetId info
213  if ( recoverEEIsolatedChannels_ || killDeadChannels_ ) workerRecover_->run( evt, urh, *eeRecHits );
214  }
215  }
216  }
217  }
218 
220  {
222  const std::set<EcalTrigTowerDetId> * ttIds = 0;
223  if ( ebFEToBeRecovered_.label() != "" && ebFEToBeRecovered_.instance() != "" ) {
224  evt.getByLabel( ebFEToBeRecovered_, pEBFEId);
225  if ( pEBFEId.isValid() ) {
226  ttIds = pEBFEId.product();
227  } else {
228  edm::LogError("EcalRecHitError") << "Error! can't get the product " << ebFEToBeRecovered_;
229  }
230  }
231  if ( ttIds ) {
232  for( std::set<EcalTrigTowerDetId>::const_iterator it = ttIds->begin(); it != ttIds->end(); ++it ) {
233  // uses the EcalUncalibratedRecHit to pass the DetId info
234  int ieta = (((*it).ietaAbs()-1)*5+1)*(*it).zside(); // from EcalTrigTowerConstituentsMap
235  int iphi = ((*it).iphi()-1)*5+11; // from EcalTrigTowerConstituentsMap
236  if( iphi <= 0 ) iphi += 360; // from EcalTrigTowerConstituentsMap
238  workerRecover_->run( evt, urh, *ebRecHits );
239  }
240  }
241  }
242 
244  {
246  const std::set<EcalScDetId> * scIds = 0;
247  if ( eeFEToBeRecovered_.label() != "" && eeFEToBeRecovered_.instance() != "" ) {
248  evt.getByLabel( eeFEToBeRecovered_, pEEFEId);
249  if ( pEEFEId.isValid() ) {
250  scIds = pEEFEId.product();
251  } else {
252  edm::LogError("EcalRecHitError") << "Error! can't get the product " << eeFEToBeRecovered_;
253  }
254  }
255  if ( scIds ) {
256  for( std::set<EcalScDetId>::const_iterator it = scIds->begin(); it != scIds->end(); ++it ) {
257  // uses the EcalUncalibratedRecHit to pass the DetId info
258  if (EEDetId::validDetId( ((*it).ix()-1)*5+1, ((*it).iy()-1)*5+1, (*it).zside() )) {
259  EcalUncalibratedRecHit urh( EEDetId( ((*it).ix()-1)*5+1, ((*it).iy()-1)*5+1, (*it).zside() ), 0, 0, 0, 0, EcalRecHitWorkerBaseClass::EE_FE );
260  workerRecover_->run( evt, urh, *eeRecHits );
261  }
262  }
263  }
264  }
265 
266  // without re-sorting, find (used below in cleaning) will lead
267  // to undefined results
268  ebRecHits->sort();
269  eeRecHits->sort();
270 
271  // apply spike cleaning
272  if (cleaningAlgo_){
273  cleaningAlgo_->setFlags(*ebRecHits);
274  cleaningAlgo_->setFlags(*eeRecHits);
275  }
276 
277 
278  // put the collection of recunstructed hits in the event
279  LogInfo("EcalRecHitInfo") << "total # EB calibrated rechits: " << ebRecHits->size();
280  LogInfo("EcalRecHitInfo") << "total # EE calibrated rechits: " << eeRecHits->size();
281 
282  evt.put( ebRecHits, ebRechitCollection_ );
283  evt.put( eeRecHits, eeRechitCollection_ );
284 }
#define LogDebug(id)
std::string eeRechitCollection_
edm::InputTag ebFEToBeRecovered_
std::vector< T >::const_iterator const_iterator
edm::InputTag ebDetIdToBeRecovered_
edm::InputTag eeFEToBeRecovered_
EcalRecHitWorkerBaseClass * worker_
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
Definition: EEDetId.cc:562
uint16_t getStatusCode() const
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
EcalCleaningAlgo * cleaningAlgo_
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
static const int ETAPHIMODE
Definition: EBDetId.h:145
EcalRecHitWorkerBaseClass * workerRecover_
virtual bool run(const edm::Event &evt, const EcalUncalibratedRecHit &uncalibRH, EcalRecHitCollection &result)=0
edm::InputTag eeDetIdToBeRecovered_
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:74
edm::InputTag ebUncalibRecHitCollection_
std::string const & label() const
Definition: InputTag.h:25
virtual void set(const edm::EventSetup &es)=0
void setFlags(EcalRecHitCollection &rhs)
std::string const & instance() const
Definition: InputTag.h:26
edm::InputTag eeUncalibRecHitCollection_

Member Data Documentation

EcalCleaningAlgo* EcalRecHitProducer::cleaningAlgo_
private

Definition at line 55 of file EcalRecHitProducer.h.

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

edm::InputTag EcalRecHitProducer::ebDetIdToBeRecovered_
private

Definition at line 47 of file EcalRecHitProducer.h.

Referenced by EcalRecHitProducer(), and produce().

edm::InputTag EcalRecHitProducer::ebFEToBeRecovered_
private

Definition at line 49 of file EcalRecHitProducer.h.

Referenced by EcalRecHitProducer(), and produce().

std::string EcalRecHitProducer::ebRechitCollection_
private

Definition at line 36 of file EcalRecHitProducer.h.

Referenced by EcalRecHitProducer(), and produce().

edm::InputTag EcalRecHitProducer::ebUncalibRecHitCollection_
private

Definition at line 34 of file EcalRecHitProducer.h.

Referenced by EcalRecHitProducer(), and produce().

edm::InputTag EcalRecHitProducer::eeDetIdToBeRecovered_
private

Definition at line 48 of file EcalRecHitProducer.h.

Referenced by EcalRecHitProducer(), and produce().

edm::InputTag EcalRecHitProducer::eeFEToBeRecovered_
private

Definition at line 50 of file EcalRecHitProducer.h.

Referenced by EcalRecHitProducer(), and produce().

std::string EcalRecHitProducer::eeRechitCollection_
private

Definition at line 37 of file EcalRecHitProducer.h.

Referenced by EcalRecHitProducer(), and produce().

edm::InputTag EcalRecHitProducer::eeUncalibRecHitCollection_
private

Definition at line 35 of file EcalRecHitProducer.h.

Referenced by EcalRecHitProducer(), and produce().

bool EcalRecHitProducer::killDeadChannels_
private

Definition at line 45 of file EcalRecHitProducer.h.

Referenced by EcalRecHitProducer(), and produce().

bool EcalRecHitProducer::recoverEBFE_
private

Definition at line 43 of file EcalRecHitProducer.h.

Referenced by EcalRecHitProducer(), and produce().

bool EcalRecHitProducer::recoverEBIsolatedChannels_
private

Definition at line 39 of file EcalRecHitProducer.h.

Referenced by EcalRecHitProducer(), and produce().

bool EcalRecHitProducer::recoverEBVFE_
private

Definition at line 41 of file EcalRecHitProducer.h.

Referenced by EcalRecHitProducer(), and produce().

bool EcalRecHitProducer::recoverEEFE_
private

Definition at line 44 of file EcalRecHitProducer.h.

Referenced by EcalRecHitProducer(), and produce().

bool EcalRecHitProducer::recoverEEIsolatedChannels_
private

Definition at line 40 of file EcalRecHitProducer.h.

Referenced by EcalRecHitProducer(), and produce().

bool EcalRecHitProducer::recoverEEVFE_
private

Definition at line 42 of file EcalRecHitProducer.h.

Referenced by EcalRecHitProducer(), and produce().

EcalRecHitWorkerBaseClass* EcalRecHitProducer::worker_
private

Definition at line 52 of file EcalRecHitProducer.h.

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

EcalRecHitWorkerBaseClass* EcalRecHitProducer::workerRecover_
private

Definition at line 53 of file EcalRecHitProducer.h.

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