#include <RecoCaloTools/EcalChannelKiller/src/EcalChannelKiller.cc>
Public Member Functions | |
EcalChannelKiller (const edm::ParameterSet &) | |
~EcalChannelKiller () | |
Private Member Functions | |
virtual void | beginJob () |
virtual void | endJob () |
virtual void | produce (edm::Event &, const edm::EventSetup &) |
Private Attributes | |
std::vector< EBDetId > | ChannelsDeadID |
std::string | DeadChannelFileName_ |
std::string | hitCollection_ |
std::string | hitProducer_ |
std::string | reducedHitCollection_ |
Description: <one line="" class="" summary>="">
Implementation: <Notes on="" implementation>="">
Definition at line 30 of file EcalChannelKiller.h.
EcalChannelKiller::EcalChannelKiller | ( | const edm::ParameterSet & | ps | ) | [explicit] |
Definition at line 48 of file EcalChannelKiller.cc.
References edm::ParameterSet::getParameter().
{ hitProducer_ = ps.getParameter<std::string>("hitProducer"); hitCollection_ = ps.getParameter<std::string>("hitCollection"); reducedHitCollection_ = ps.getParameter<std::string>("reducedHitCollection"); DeadChannelFileName_ = ps.getParameter<std::string>("DeadChannelsFile"); produces< EcalRecHitCollection >(reducedHitCollection_); }
EcalChannelKiller::~EcalChannelKiller | ( | ) |
Definition at line 62 of file EcalChannelKiller.cc.
{ // do anything here that needs to be done at desctruction time // (e.g. close files, deallocate resources etc.) }
void EcalChannelKiller::beginJob | ( | void | ) | [private, virtual] |
Reimplemented from edm::EDProducer.
Definition at line 133 of file EcalChannelKiller.cc.
{ //Open the DeadChannel file, read it. 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 EcalChannelKiller::endJob | ( | void | ) | [private, virtual] |
void EcalChannelKiller::produce | ( | edm::Event & | iEvent, |
const edm::EventSetup & | iSetup | ||
) | [private, virtual] |
Implements edm::EDProducer.
Definition at line 77 of file EcalChannelKiller.cc.
References edm::Event::getByLabel(), and edm::Event::put().
{ using namespace edm; // get the hit collection from the event: edm::Handle<EcalRecHitCollection> rhcHandle; iEvent.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(); int nRed = 0; // create an auto_ptr to a EcalRecHitCollection, copy the RecHits into it and put in the Event: std::auto_ptr< EcalRecHitCollection > redCollection(new EcalRecHitCollection); for(EcalRecHitCollection::const_iterator it = hit_collection->begin(); it != hit_collection->end(); ++it) { double NewEnergy =it->energy(); bool ItIsDead=false; //Dead Cells are read from text files std::vector<EBDetId>::const_iterator DeadCell; for(DeadCell=ChannelsDeadID.begin();DeadCell<ChannelsDeadID.end();DeadCell++){ if(it->detid()==*DeadCell){ ItIsDead=true; NewEnergy =0.; nRed++; } }//End looping on vector of Dead Cells // Make a new RecHit // // TODO what will be the it->time() for D.C. ? // Could we use it for "correction" identification? // if(!ItIsDead){ EcalRecHit NewHit(it->id(),NewEnergy,it->time()); redCollection->push_back( NewHit ); } } // std::cout << "total # hits: " << nTot << " #hits with E = " << 0 << " GeV : " << nRed << std::endl; iEvent.put(redCollection, reducedHitCollection_); }
std::vector<EBDetId> EcalChannelKiller::ChannelsDeadID [private] |
Definition at line 45 of file EcalChannelKiller.h.
std::string EcalChannelKiller::DeadChannelFileName_ [private] |
Definition at line 44 of file EcalChannelKiller.h.
std::string EcalChannelKiller::hitCollection_ [private] |
Definition at line 42 of file EcalChannelKiller.h.
std::string EcalChannelKiller::hitProducer_ [private] |
Definition at line 41 of file EcalChannelKiller.h.
std::string EcalChannelKiller::reducedHitCollection_ [private] |
Definition at line 43 of file EcalChannelKiller.h.