CMS 3D CMS Logo

Public Member Functions | Private Attributes

EcalTBHodoscopeRawInfoDumper Class Reference

#include <EcalTBHodoscopeRawInfoDumper.h>

Inheritance diagram for EcalTBHodoscopeRawInfoDumper:
edm::EDAnalyzer

List of all members.

Public Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
virtual void beginJob ()
 EcalTBHodoscopeRawInfoDumper (const edm::ParameterSet &ps)
virtual void endJob ()
virtual ~EcalTBHodoscopeRawInfoDumper ()

Private Attributes

TH1F * h_firedHits_ [4]
TH1F * h_numberOfFiredHits_ [4]
std::string rawInfoCollection_
std::string rawInfoProducer_
std::string rootfile_

Detailed Description

Definition at line 18 of file EcalTBHodoscopeRawInfoDumper.h.


Constructor & Destructor Documentation

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

Definition at line 13 of file EcalTBHodoscopeRawInfoDumper.cc.

References edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), rawInfoCollection_, rawInfoProducer_, and rootfile_.

{
  rawInfoCollection_ = ps.getParameter<std::string>("rawInfoCollection");
  rawInfoProducer_   = ps.getParameter<std::string>("rawInfoProducer");
  rootfile_          = ps.getUntrackedParameter<std::string>("rootfile","ecalHodoscopeRawInfoPlots.root");
}
EcalTBHodoscopeRawInfoDumper::~EcalTBHodoscopeRawInfoDumper ( ) [virtual]

Definition at line 20 of file EcalTBHodoscopeRawInfoDumper.cc.

                                                            {
}

Member Function Documentation

void EcalTBHodoscopeRawInfoDumper::analyze ( const edm::Event e,
const edm::EventSetup es 
) [virtual]

Implements edm::EDAnalyzer.

Definition at line 62 of file EcalTBHodoscopeRawInfoDumper.cc.

References edm::Event::getByLabel(), h_firedHits_, h_numberOfFiredHits_, i, edm::HandleBase::isValid(), j, LogDebug, edm::Handle< T >::product(), rawInfoCollection_, and rawInfoProducer_.

{
  // Get input
   edm::Handle<EcalTBHodoscopeRawInfo> ecalRawHodoscope;  
   const EcalTBHodoscopeRawInfo* hodoscopeRawInfo = 0;
   //evt.getByLabel( digiProducer_, digiCollection_, pDigis);
   e.getByLabel( rawInfoProducer_, ecalRawHodoscope);
   if (!ecalRawHodoscope.isValid()) {
     edm::LogError("EcalTBHodoscopeRecInfoError") << "Error! can't get the product " << rawInfoCollection_.c_str() ;
   } else {
     hodoscopeRawInfo = ecalRawHodoscope.product();
   }

   if (hodoscopeRawInfo)
     for (int i=0; i<4; i++)
       {
         std::ostringstream str;
         str << " Hits " ;
         std::vector<int> firedHits;
         h_numberOfFiredHits_[i]->Fill((*hodoscopeRawInfo)[i].numberOfFiredHits());
         for (int j=0;j<64;j++)
           if ((*hodoscopeRawInfo)[i][j])
             {
               h_firedHits_[i]->Fill(j);
               firedHits.push_back(j);
               str << j << " " ;
             }
         LogDebug("EcalTBHodoscope") << "Looking plane " << i << " number of hits " << (*hodoscopeRawInfo)[i].numberOfFiredHits() << str.str();
       }
  // Create empty output
} 
void EcalTBHodoscopeRawInfoDumper::beginJob ( void  ) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 25 of file EcalTBHodoscopeRawInfoDumper.cc.

References h_firedHits_, h_numberOfFiredHits_, and i.

                                       {
//========================================================================

  char histoName[100];
  char histoTitle[100];
  
  for (int i=0; i<4; i++)
    {
      sprintf(histoName,"h_numberOfFiredHits_%d",i);
      sprintf(histoTitle,"NumberOfFiredHits Plane %d",i);
      h_numberOfFiredHits_[i]=new TH1F(histoName,histoTitle,10,0.,10.);
    }

  for (int i=0; i<4; i++)
    {
      sprintf(histoName,"h_firedHits_%d",i);
      sprintf(histoTitle,"firedHits Plane %d",i);
      h_firedHits_[i]=new TH1F(histoName,histoTitle,64,-0.5,63.5);
    }  
}
void EcalTBHodoscopeRawInfoDumper::endJob ( void  ) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 48 of file EcalTBHodoscopeRawInfoDumper.cc.

References f, h_firedHits_, h_numberOfFiredHits_, i, and rootfile_.

                                     {
//========================================================================

  TFile f(rootfile_.c_str(),"RECREATE");
  
  for (int i=0; i<4; i++)
    h_numberOfFiredHits_[i]->Write();
  
  for (int i=0; i<4; i++)
    h_firedHits_[i]->Write();

  f.Close();
}

Member Data Documentation

Definition at line 34 of file EcalTBHodoscopeRawInfoDumper.h.

Referenced by analyze(), beginJob(), and endJob().

Definition at line 33 of file EcalTBHodoscopeRawInfoDumper.h.

Referenced by analyze(), beginJob(), and endJob().

Definition at line 31 of file EcalTBHodoscopeRawInfoDumper.h.

Referenced by analyze(), and EcalTBHodoscopeRawInfoDumper().

Definition at line 30 of file EcalTBHodoscopeRawInfoDumper.h.

Referenced by analyze(), and EcalTBHodoscopeRawInfoDumper().

Definition at line 32 of file EcalTBHodoscopeRawInfoDumper.h.

Referenced by EcalTBHodoscopeRawInfoDumper(), and endJob().