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)
 
- 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:
2009/12/14 22:23:53
Revision:
1.2

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 57 of file EcalDeadChannelRecoveryProducers.cc.

References edm::ParameterSet::getParameter().

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

Definition at line 73 of file EcalDeadChannelRecoveryProducers.cc.

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

Member Function Documentation

void EcalDeadChannelRecoveryProducers::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 143 of file EcalDeadChannelRecoveryProducers.cc.

References gather_cfg::cout.

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

Reimplemented from edm::EDProducer.

Definition at line 166 of file EcalDeadChannelRecoveryProducers.cc.

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

Implements edm::EDProducer.

Definition at line 88 of file EcalDeadChannelRecoveryProducers.cc.

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

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

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.