#include <RecoLocalCalo/EcalDeadChannelRecoveryProducers/src/EcalDeadChannelRecoveryProducers.cc>
Public Member Functions | |
EcalDeadChannelRecoveryProducers (const edm::ParameterSet &) | |
~EcalDeadChannelRecoveryProducers () | |
Private Member Functions | |
virtual void | beginJob () |
virtual void | endJob () |
virtual void | produce (edm::Event &, const edm::EventSetup &) |
Private Attributes | |
std::vector< EBDetId > | ChannelsDeadID |
bool | CorrectDeadCells_ |
std::string | CorrectionMethod_ |
std::string | DeadChannelFileName_ |
std::string | hitCollection_ |
std::string | hitProducer_ |
std::string | reducedHitCollection_ |
double | Sum8GeVThreshold_ |
Description: <one line="" class="" summary>="">
Implementation: <Notes on="" implementation>="">
Definition at line 30 of file EcalDeadChannelRecoveryProducers.h.
EcalDeadChannelRecoveryProducers::EcalDeadChannelRecoveryProducers | ( | const edm::ParameterSet & | ps | ) | [explicit] |
Definition at line 57 of file EcalDeadChannelRecoveryProducers.cc.
References edm::ParameterSet::getParameter().
{ //now do what ever other initialization is needed CorrectDeadCells_ = ps.getParameter<bool>("CorrectDeadCells"); CorrectionMethod_ = ps.getParameter<std::string>("CorrectionMethod"); hitProducer_ = ps.getParameter<std::string>("hitProducer"); hitCollection_ = ps.getParameter<std::string>("hitCollection"); reducedHitCollection_ = ps.getParameter<std::string>("reducedHitCollection"); DeadChannelFileName_ = ps.getParameter<std::string>("DeadChannelsFile"); Sum8GeVThreshold_= ps.getParameter<double>("Sum8GeVThreshold"); produces< EcalRecHitCollection >(reducedHitCollection_); }
EcalDeadChannelRecoveryProducers::~EcalDeadChannelRecoveryProducers | ( | ) |
Definition at line 73 of file EcalDeadChannelRecoveryProducers.cc.
{ // do anything here that needs to be done at desctruction time // (e.g. close files, deallocate resources etc.) }
void EcalDeadChannelRecoveryProducers::beginJob | ( | void | ) | [private, virtual] |
Reimplemented from edm::EDProducer.
Definition at line 143 of file EcalDeadChannelRecoveryProducers.cc.
References gather_cfg::cout.
{ FILE* DeadCha; printf("Dead Channels FILE: %s\n",DeadChannelFileName_.c_str()); DeadCha = fopen(DeadChannelFileName_.c_str(),"r"); int fileStatus=0; int ieta=-10000; int iphi=-10000; while(fileStatus != EOF) { fileStatus = fscanf(DeadCha,"%d %d\n",&ieta,&iphi); // std::cout<<" ieta "<<ieta<<" iphi "<<iphi<<std::endl; if(ieta==-10000||iphi==-10000){std::cout << "Problem reading Dead Channels file "<<std::endl;break;} EBDetId cell(ieta,iphi); ChannelsDeadID.push_back(cell); } //end while fclose(DeadCha); // std::cout<<" Read "<<ChannelsDeadID.size()<<" dead channels "<<std::endl; }
void EcalDeadChannelRecoveryProducers::endJob | ( | void | ) | [private, virtual] |
Reimplemented from edm::EDProducer.
Definition at line 166 of file EcalDeadChannelRecoveryProducers.cc.
{ }
void EcalDeadChannelRecoveryProducers::produce | ( | edm::Event & | evt, |
const edm::EventSetup & | iSetup | ||
) | [private, virtual] |
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().
{ using namespace edm; edm::ESHandle<CaloTopology> theCaloTopology; iSetup.get<CaloTopologyRecord>().get(theCaloTopology); // get the hit collection from the event: edm::Handle<EcalRecHitCollection> rhcHandle; evt.getByLabel(hitProducer_, hitCollection_, rhcHandle); if (!(rhcHandle.isValid())) { std::cout << "could not get a handle on the EcalRecHitCollection!" << std::endl; return; } const EcalRecHitCollection* hit_collection = rhcHandle.product(); // create an auto_ptr to a EcalRecHitCollection, copy the RecHits into it and put it in the Event: std::auto_ptr< EcalRecHitCollection > redCollection(new EcalRecHitCollection); EcalDeadChannelRecoveryAlgos *DeadChannelCorrector = new EcalDeadChannelRecoveryAlgos(theCaloTopology.product()); //Dead Cells are read from a text file std::vector<EBDetId>::const_iterator DeadCell; // //This should work only if we REMOVE the DC RecHit from the reduced RecHit collection // for(EcalRecHitCollection::const_iterator it = hit_collection->begin(); it != hit_collection->end(); ++it) { std::vector<EBDetId>::const_iterator CheckDead = ChannelsDeadID.begin(); bool OverADeadRecHit=false; while(CheckDead<ChannelsDeadID.end()){ if(it->detid()==*CheckDead){OverADeadRecHit=true;break;} CheckDead++; } if(!OverADeadRecHit)redCollection->push_back( *it ); } for(DeadCell=ChannelsDeadID.begin();DeadCell<ChannelsDeadID.end();DeadCell++){ EcalRecHit NewRecHit = DeadChannelCorrector->Correct(*DeadCell,hit_collection,CorrectionMethod_,Sum8GeVThreshold_); redCollection->push_back( NewRecHit ); } delete DeadChannelCorrector ; evt.put(redCollection, reducedHitCollection_); }
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.