CMS 3D CMS Logo

EcalDeadChannelRecoveryProducers Class Reference

Date
2007/05/03 12:41:31
Revision
1.1
More...

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

Inheritance diagram for EcalDeadChannelRecoveryProducers:

edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

 EcalDeadChannelRecoveryProducers (const edm::ParameterSet &)
 ~EcalDeadChannelRecoveryProducers ()

Private Member Functions

virtual void beginJob (const edm::EventSetup &)
virtual void endJob ()
virtual void produce (edm::Event &, const edm::EventSetup &)

Private Attributes

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


Detailed Description

Date
2007/05/03 12:41:31
Revision
1.1

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

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

Definition at line 31 of file EcalDeadChannelRecoveryProducers.h.


Constructor & Destructor Documentation

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

Definition at line 57 of file EcalDeadChannelRecoveryProducers.cc.

References CorrectDeadCells_, CorrectionMethod_, DeadChannelFileName_, edm::ParameterSet::getParameter(), hitCollection_, hitProducer_, reducedHitCollection_, and Sum8GeVThreshold_.

00058 {
00059 
00060    //now do what ever other initialization is needed
00061   CorrectDeadCells_     = ps.getParameter<bool>("CorrectDeadCells");
00062   CorrectionMethod_     = ps.getParameter<std::string>("CorrectionMethod");
00063   hitProducer_          = ps.getParameter<std::string>("hitProducer");
00064   hitCollection_        = ps.getParameter<std::string>("hitCollection");
00065   reducedHitCollection_ = ps.getParameter<std::string>("reducedHitCollection");
00066   DeadChannelFileName_ = ps.getParameter<std::string>("DeadChannelsFile");
00067   Sum8GeVThreshold_= ps.getParameter<double>("Sum8GeVThreshold");
00068 
00069    produces< EcalRecHitCollection >(reducedHitCollection_);
00070 }

EcalDeadChannelRecoveryProducers::~EcalDeadChannelRecoveryProducers (  ) 

Definition at line 73 of file EcalDeadChannelRecoveryProducers.cc.

00074 {
00075  
00076    // do anything here that needs to be done at desctruction time
00077    // (e.g. close files, deallocate resources etc.)
00078 
00079 }


Member Function Documentation

void EcalDeadChannelRecoveryProducers::beginJob ( const edm::EventSetup  )  [private, virtual]

Reimplemented from edm::EDProducer.

Definition at line 143 of file EcalDeadChannelRecoveryProducers.cc.

References ChannelsDeadID, GenMuonPlsPt100GeV_cfg::cout, DeadChannelFileName_, and lat::endl().

00144 {
00145     FILE* DeadCha;
00146     printf("Dead Channels FILE: %s\n",DeadChannelFileName_.c_str());
00147     DeadCha = fopen(DeadChannelFileName_.c_str(),"r");
00148 
00149     int fileStatus=0;
00150     int ieta=-10000;
00151     int iphi=-10000;
00152     while(fileStatus != EOF) {
00153     fileStatus = fscanf(DeadCha,"%d %d\n",&ieta,&iphi);
00154     //    cout<<" ieta "<<ieta<<" iphi "<<iphi<<endl;
00155     if(ieta==-10000||iphi==-10000){std::cout << "Problem reading Dead Channels file "<<std::endl;break;}
00156     EBDetId cell(ieta,iphi);
00157     ChannelsDeadID.push_back(cell);
00158     } //end while           
00159     fclose(DeadCha);
00160   std::cout<<" Read "<<ChannelsDeadID.size()<<" dead channels "<<std::endl;
00161   
00162 }

void EcalDeadChannelRecoveryProducers::endJob ( void   )  [private, virtual]

Reimplemented from edm::EDProducer.

Definition at line 166 of file EcalDeadChannelRecoveryProducers.cc.

00166                                          {
00167 }

void EcalDeadChannelRecoveryProducers::produce ( edm::Event evt,
const edm::EventSetup iSetup 
) [private, virtual]

Implements edm::EDProducer.

Definition at line 88 of file EcalDeadChannelRecoveryProducers.cc.

References edm::SortedCollection< T, SORT >::begin(), ChannelsDeadID, EcalDeadChannelRecoveryAlgos::Correct(), CorrectionMethod_, GenMuonPlsPt100GeV_cfg::cout, edm::SortedCollection< T, SORT >::end(), lat::endl(), edm::EventSetup::get(), edm::Event::getByLabel(), hitCollection_, hitProducer_, edm::Handle< T >::isValid(), it, edm::Handle< T >::product(), edm::Event::put(), reducedHitCollection_, and Sum8GeVThreshold_.

00089 {
00090   using namespace edm;
00091   
00092   edm::ESHandle<CaloTopology> theCaloTopology;
00093   iSetup.get<CaloTopologyRecord>().get(theCaloTopology);
00094   
00095   // get the hit collection from the event:
00096   edm::Handle<EcalRecHitCollection> rhcHandle;
00097   evt.getByLabel(hitProducer_, hitCollection_, rhcHandle);
00098   if (!(rhcHandle.isValid())) 
00099     {
00100       std::cout << "could not get a handle on the EcalRecHitCollection!" << std::endl;
00101       return;
00102     }
00103   const EcalRecHitCollection* hit_collection = rhcHandle.product();
00104   
00105   // create an auto_ptr to a EcalRecHitCollection, copy the RecHits into it and put it in the Event:
00106   std::auto_ptr< EcalRecHitCollection > redCollection(new EcalRecHitCollection);
00107   
00108   EcalDeadChannelRecoveryAlgos *DeadChannelCorrector = new EcalDeadChannelRecoveryAlgos(*theCaloTopology);
00109   
00110   //Dead Cells are read from a text file
00111   vector<EBDetId>::const_iterator DeadCell;
00112 
00113   //
00114   //This should work only if we REMOVE the DC RecHit from the reduced RecHit collection 
00115   //
00116   for(EcalRecHitCollection::const_iterator it = hit_collection->begin(); it != hit_collection->end(); ++it) {     
00117     vector<EBDetId>::const_iterator CheckDead = ChannelsDeadID.begin();
00118     bool OverADeadRecHit=false;
00119     while(CheckDead<ChannelsDeadID.end()){
00120       if(it->detid()==*CheckDead){OverADeadRecHit=true;break;}
00121       CheckDead++;
00122     }
00123     if(!OverADeadRecHit)redCollection->push_back( *it );
00124   }
00125   for(DeadCell=ChannelsDeadID.begin();DeadCell<ChannelsDeadID.end();DeadCell++){
00126     EcalRecHit NewRecHit = DeadChannelCorrector->Correct(*DeadCell,hit_collection,CorrectionMethod_,Sum8GeVThreshold_);
00127     redCollection->push_back( NewRecHit );
00128   }
00129 
00130 
00131 
00132   
00133   delete DeadChannelCorrector ;
00134   
00135   evt.put(redCollection, reducedHitCollection_);
00136   
00137 }


Member Data Documentation

vector<EBDetId> EcalDeadChannelRecoveryProducers::ChannelsDeadID [private]

Definition at line 48 of file EcalDeadChannelRecoveryProducers.h.

Referenced by beginJob(), and produce().

bool EcalDeadChannelRecoveryProducers::CorrectDeadCells_ [private]

Definition at line 49 of file EcalDeadChannelRecoveryProducers.h.

Referenced by EcalDeadChannelRecoveryProducers().

string EcalDeadChannelRecoveryProducers::CorrectionMethod_ [private]

Definition at line 50 of file EcalDeadChannelRecoveryProducers.h.

Referenced by EcalDeadChannelRecoveryProducers(), and produce().

string EcalDeadChannelRecoveryProducers::DeadChannelFileName_ [private]

Definition at line 47 of file EcalDeadChannelRecoveryProducers.h.

Referenced by beginJob(), and EcalDeadChannelRecoveryProducers().

string EcalDeadChannelRecoveryProducers::hitCollection_ [private]

Definition at line 45 of file EcalDeadChannelRecoveryProducers.h.

Referenced by EcalDeadChannelRecoveryProducers(), and produce().

string EcalDeadChannelRecoveryProducers::hitProducer_ [private]

Definition at line 44 of file EcalDeadChannelRecoveryProducers.h.

Referenced by EcalDeadChannelRecoveryProducers(), and produce().

string EcalDeadChannelRecoveryProducers::reducedHitCollection_ [private]

Definition at line 46 of file EcalDeadChannelRecoveryProducers.h.

Referenced by EcalDeadChannelRecoveryProducers(), and produce().

double EcalDeadChannelRecoveryProducers::Sum8GeVThreshold_ [private]

Definition at line 43 of file EcalDeadChannelRecoveryProducers.h.

Referenced by EcalDeadChannelRecoveryProducers(), and produce().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:19:29 2009 for CMSSW by  doxygen 1.5.4