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 Member Functions | Private Attributes
EcalDeadChannelRecoveryProducers Class Reference

#include <RecoLocalCalo/EcalDeadChannelRecoveryProducers/src/EcalDeadChannelRecoveryProducers.cc>

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

Public Member Functions

 EcalDeadChannelRecoveryProducers (const edm::ParameterSet &)
 
 ~EcalDeadChannelRecoveryProducers ()
 
- 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 beginJob ()
 
virtual void endJob ()
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 

Private Attributes

std::vector< EBDetIdChannelsDeadID
 
bool CorrectDeadCells_
 
std::string CorrectionMethod_
 
std::string DeadChannelFileName_
 
std::string hitCollection_
 
std::string hitProducer_
 
std::string reducedHitCollection_
 
double Sum8GeVThreshold_
 

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

Date:
2010/08/06 20:24:55
Revision:
1.3

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

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

Definition at line 30 of file EcalDeadChannelRecoveryProducers.h.

Constructor & Destructor Documentation

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

Definition at line 59 of file EcalDeadChannelRecoveryProducers.cc.

References edm::ParameterSet::getParameter().

60 {
61 
62  //now do what ever other initialization is needed
63  CorrectDeadCells_ = ps.getParameter<bool>("CorrectDeadCells");
64  CorrectionMethod_ = ps.getParameter<std::string>("CorrectionMethod");
65  hitProducer_ = ps.getParameter<std::string>("hitProducer");
66  hitCollection_ = ps.getParameter<std::string>("hitCollection");
67  reducedHitCollection_ = ps.getParameter<std::string>("reducedHitCollection");
68  DeadChannelFileName_ = ps.getParameter<std::string>("DeadChannelsFile");
69  Sum8GeVThreshold_= ps.getParameter<double>("Sum8GeVThreshold");
70 
71  produces< EcalRecHitCollection >(reducedHitCollection_);
72 }
T getParameter(std::string const &) const
EcalDeadChannelRecoveryProducers::~EcalDeadChannelRecoveryProducers ( )

Definition at line 75 of file EcalDeadChannelRecoveryProducers.cc.

76 {
77 
78  // do anything here that needs to be done at desctruction time
79  // (e.g. close files, deallocate resources etc.)
80 
81 }

Member Function Documentation

void EcalDeadChannelRecoveryProducers::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 145 of file EcalDeadChannelRecoveryProducers.cc.

References gather_cfg::cout.

146 {
147  FILE* DeadCha;
148  printf("Dead Channels FILE: %s\n",DeadChannelFileName_.c_str());
149  DeadCha = fopen(DeadChannelFileName_.c_str(),"r");
150 
151  int fileStatus=0;
152  int ieta=-10000;
153  int iphi=-10000;
154  while(fileStatus != EOF) {
155  fileStatus = fscanf(DeadCha,"%d %d\n",&ieta,&iphi);
156  // std::cout<<" ieta "<<ieta<<" iphi "<<iphi<<std::endl;
157  if(ieta==-10000||iphi==-10000){std::cout << "Problem reading Dead Channels file "<<std::endl;break;}
158  EBDetId cell(ieta,iphi);
159  ChannelsDeadID.push_back(cell);
160  } //end while
161  fclose(DeadCha);
162  // std::cout<<" Read "<<ChannelsDeadID.size()<<" dead channels "<<std::endl;
163 
164 }
tuple cout
Definition: gather_cfg.py:121
void EcalDeadChannelRecoveryProducers::endJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 168 of file EcalDeadChannelRecoveryProducers.cc.

168  {
169 }
void EcalDeadChannelRecoveryProducers::produce ( edm::Event evt,
const edm::EventSetup iSetup 
)
privatevirtual

Implements edm::EDProducer.

Definition at line 90 of file EcalDeadChannelRecoveryProducers.cc.

References gather_cfg::cout, edm::EventSetup::get(), edm::Event::getByLabel(), and edm::Event::put().

91 {
92  using namespace edm;
93 
94  edm::ESHandle<CaloTopology> theCaloTopology;
95  iSetup.get<CaloTopologyRecord>().get(theCaloTopology);
96 
97  // get the hit collection from the event:
99  evt.getByLabel(hitProducer_, hitCollection_, rhcHandle);
100  if (!(rhcHandle.isValid()))
101  {
102  std::cout << "could not get a handle on the EcalRecHitCollection!" << std::endl;
103  return;
104  }
105  const EcalRecHitCollection* hit_collection = rhcHandle.product();
106 
107  // create an auto_ptr to a EcalRecHitCollection, copy the RecHits into it and put it in the Event:
108  std::auto_ptr< EcalRecHitCollection > redCollection(new EcalRecHitCollection);
109 
110  EcalDeadChannelRecoveryAlgos *DeadChannelCorrector = new EcalDeadChannelRecoveryAlgos(theCaloTopology.product());
111 
112  //Dead Cells are read from a text file
113  std::vector<EBDetId>::const_iterator DeadCell;
114 
115  //
116  //This should work only if we REMOVE the DC RecHit from the reduced RecHit collection
117  //
118  for(EcalRecHitCollection::const_iterator it = hit_collection->begin(); it != hit_collection->end(); ++it) {
119  std::vector<EBDetId>::const_iterator CheckDead = ChannelsDeadID.begin();
120  bool OverADeadRecHit=false;
121  while(CheckDead<ChannelsDeadID.end()){
122  if(it->detid()==*CheckDead){OverADeadRecHit=true;break;}
123  CheckDead++;
124  }
125  if(!OverADeadRecHit)redCollection->push_back( *it );
126  }
127  for(DeadCell=ChannelsDeadID.begin();DeadCell<ChannelsDeadID.end();DeadCell++){
128  EcalRecHit NewRecHit = DeadChannelCorrector->Correct(*DeadCell,hit_collection,CorrectionMethod_,Sum8GeVThreshold_);
129  redCollection->push_back( NewRecHit );
130  }
131 
132 
133 
134 
135  delete DeadChannelCorrector ;
136 
137  evt.put(redCollection, reducedHitCollection_);
138 
139 }
std::vector< EcalRecHit >::const_iterator const_iterator
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
const T & get() const
Definition: EventSetup.h:55
tuple cout
Definition: gather_cfg.py:121

Member Data Documentation

std::vector<EBDetId> EcalDeadChannelRecoveryProducers::ChannelsDeadID
private

Definition at line 47 of file EcalDeadChannelRecoveryProducers.h.

bool EcalDeadChannelRecoveryProducers::CorrectDeadCells_
private

Definition at line 48 of file EcalDeadChannelRecoveryProducers.h.

std::string EcalDeadChannelRecoveryProducers::CorrectionMethod_
private

Definition at line 49 of file EcalDeadChannelRecoveryProducers.h.

std::string EcalDeadChannelRecoveryProducers::DeadChannelFileName_
private

Definition at line 46 of file EcalDeadChannelRecoveryProducers.h.

std::string EcalDeadChannelRecoveryProducers::hitCollection_
private

Definition at line 44 of file EcalDeadChannelRecoveryProducers.h.

std::string EcalDeadChannelRecoveryProducers::hitProducer_
private

Definition at line 43 of file EcalDeadChannelRecoveryProducers.h.

std::string EcalDeadChannelRecoveryProducers::reducedHitCollection_
private

Definition at line 45 of file EcalDeadChannelRecoveryProducers.h.

double EcalDeadChannelRecoveryProducers::Sum8GeVThreshold_
private

Definition at line 42 of file EcalDeadChannelRecoveryProducers.h.