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

Public Member Functions

 EcalDeadChannelRecoveryProducers (const edm::ParameterSet &)
 
 ~EcalDeadChannelRecoveryProducers ()
 
- 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 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
 
- 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

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

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

Definition at line 28 of file EcalDeadChannelRecoveryProducers.h.

Constructor & Destructor Documentation

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

Definition at line 58 of file EcalDeadChannelRecoveryProducers.cc.

References edm::ParameterSet::getParameter(), and AlCaHLTBitMon_QueryRunRegistry::string.

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

Definition at line 74 of file EcalDeadChannelRecoveryProducers.cc.

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

Member Function Documentation

void EcalDeadChannelRecoveryProducers::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 144 of file EcalDeadChannelRecoveryProducers.cc.

References gather_cfg::cout.

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

Reimplemented from edm::EDProducer.

Definition at line 167 of file EcalDeadChannelRecoveryProducers.cc.

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

Implements edm::EDProducer.

Definition at line 89 of file EcalDeadChannelRecoveryProducers.cc.

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

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

bool EcalDeadChannelRecoveryProducers::CorrectDeadCells_
private

Definition at line 46 of file EcalDeadChannelRecoveryProducers.h.

std::string EcalDeadChannelRecoveryProducers::CorrectionMethod_
private

Definition at line 47 of file EcalDeadChannelRecoveryProducers.h.

std::string EcalDeadChannelRecoveryProducers::DeadChannelFileName_
private

Definition at line 44 of file EcalDeadChannelRecoveryProducers.h.

std::string EcalDeadChannelRecoveryProducers::hitCollection_
private

Definition at line 42 of file EcalDeadChannelRecoveryProducers.h.

std::string EcalDeadChannelRecoveryProducers::hitProducer_
private

Definition at line 41 of file EcalDeadChannelRecoveryProducers.h.

std::string EcalDeadChannelRecoveryProducers::reducedHitCollection_
private

Definition at line 43 of file EcalDeadChannelRecoveryProducers.h.

double EcalDeadChannelRecoveryProducers::Sum8GeVThreshold_
private

Definition at line 40 of file EcalDeadChannelRecoveryProducers.h.