CMS 3D CMS Logo

Public Member Functions | Private Attributes

miscalibExample Class Reference

#include <Calibration/EcalCalibAlgos/src/miscalibExample.cc>

Inheritance diagram for miscalibExample:
edm::EDAnalyzer

List of all members.

Public Member Functions

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

Private Attributes

std::string BarrelHitsCollection_
std::string correctedHybridSuperClusterCollection_
std::string correctedHybridSuperClusterProducer_
std::string ecalHitsProducer_
int read_events
std::string rootfile_
TH1F * scEnergy

Detailed Description

Description: Analyzer to fetch collection of objects from event and make simple plots

Implementation: \

Author:
: Lorenzo Agostino, September 2006

Description: Perform single electron calibration (tested on TB data only).

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

Definition at line 37 of file miscalibExample.h.


Constructor & Destructor Documentation

miscalibExample::miscalibExample ( const edm::ParameterSet iConfig) [explicit]

Definition at line 66 of file miscalibExample.cc.

References correctedHybridSuperClusterCollection_, correctedHybridSuperClusterProducer_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), and rootfile_.

{

   rootfile_                  = iConfig.getUntrackedParameter<std::string>("rootfile","ecalSimpleTBanalysis.root");
   correctedHybridSuperClusterProducer_ = iConfig.getParameter<std::string>("correctedHybridSuperClusterProducer");
   correctedHybridSuperClusterCollection_ = iConfig.getParameter<std::string>("correctedHybridSuperClusterCollection");

}
miscalibExample::~miscalibExample ( )

Definition at line 76 of file miscalibExample.cc.

{
 

}

Member Function Documentation

void miscalibExample::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
) [virtual]

Implements edm::EDAnalyzer.

Definition at line 115 of file miscalibExample.cc.

References correctedHybridSuperClusterCollection_, correctedHybridSuperClusterProducer_, correctedHybridSuperClusters_cfi::correctedHybridSuperClusters, edm::Event::getByLabel(), read_events, and scEnergy.

{
//=================================================================================
   using namespace edm;
   using namespace std;

   read_events++;

 // Get hybrid super clusters after energy correction
 
  Handle<reco::SuperClusterCollection> pCorrectedHybridSuperClusters;
  iEvent.getByLabel(correctedHybridSuperClusterProducer_, correctedHybridSuperClusterCollection_, pCorrectedHybridSuperClusters);
  if (!pCorrectedHybridSuperClusters.isValid()) {
    LogError("EgammaSimpleAnalyzer") << "Error! can't get collection with label " << correctedHybridSuperClusterCollection_.c_str() ;
  }
  const reco::SuperClusterCollection* correctedHybridSuperClusters = pCorrectedHybridSuperClusters.product();


  reco::SuperClusterCollection::const_iterator superClusterIt;
  for(superClusterIt=correctedHybridSuperClusters->begin(); superClusterIt!=correctedHybridSuperClusters->end(); superClusterIt++ )
  {

  scEnergy->Fill(superClusterIt->energy());

  }

}
void miscalibExample::beginJob ( void  ) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 84 of file miscalibExample.cc.

References read_events, and scEnergy.

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

  // Book histograms 
  scEnergy = new TH1F("scEnergy","SuperCluster energy", 100, 20., 80.);
  read_events=0;
 
 }
void miscalibExample::endJob ( void  ) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 95 of file miscalibExample.cc.

References gather_cfg::cout, f, read_events, rootfile_, and scEnergy.

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

   std::cout << "************* STATISTICS **************" << std::endl;
   std::cout << "Read Events: " << read_events << std::endl;



  TFile f(rootfile_.c_str(),"RECREATE");

  scEnergy->Write(); 
  f.Close();
 
}

Member Data Documentation

Definition at line 52 of file miscalibExample.h.

Definition at line 51 of file miscalibExample.h.

Referenced by analyze(), and miscalibExample().

Definition at line 50 of file miscalibExample.h.

Referenced by analyze(), and miscalibExample().

std::string miscalibExample::ecalHitsProducer_ [private]

Definition at line 53 of file miscalibExample.h.

Definition at line 54 of file miscalibExample.h.

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

std::string miscalibExample::rootfile_ [private]

Definition at line 49 of file miscalibExample.h.

Referenced by endJob(), and miscalibExample().

TH1F* miscalibExample::scEnergy [private]

Definition at line 56 of file miscalibExample.h.

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