CMS 3D CMS Logo

PreshowerAnalyzer Class Reference

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

#include <RecoEcal/EgammaClusterProducers/interface/PreshowerAnalyzer.h>

Inheritance diagram for PreshowerAnalyzer:

edm::EDAnalyzer

List of all members.

Public Member Functions

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

Private Attributes

double calib_planeX_
double calib_planeY_
float EmaxDE_
float EmaxSC_
float EminDE_
float EminSC_
double gamma_
TH1F * h1_esDeltaE
TH1F * h1_esE_x
TH1F * h1_esE_y
TH1F * h1_esEta_x
TH1F * h1_esEta_y
TH1F * h1_esNhits_x
TH1F * h1_esNhits_y
TH1F * h1_esPhi_x
TH1F * h1_esPhi_y
TH1F * h1_islandEESCEnergy1
TH1F * h1_islandEESCEnergy2
TH1F * h1_nclu_x
TH1F * h1_nclu_y
std::string islandEndcapSuperClusterCollection1_
std::string islandEndcapSuperClusterCollection2_
std::string islandEndcapSuperClusterProducer1_
std::string islandEndcapSuperClusterProducer2_
double mip_
int nBinDE_
int nBinSC_
int nEvt_
std::string outputFile_
std::string preshClusterCollectionX_
std::string preshClusterCollectionY_
std::string preshClusterProducer_
TFile * rootFile_


Detailed Description

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

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

Implementation: \

Author:
: Shahram Rahatlou, May 2006
Implementation: <Notes on="" implementation>="">

Definition at line 35 of file PreshowerAnalyzer.h.


Constructor & Destructor Documentation

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

Definition at line 30 of file PreshowerAnalyzer.cc.

References calib_planeX_, calib_planeY_, EmaxDE_, EmaxSC_, EminDE_, EminSC_, gamma_, edm::ParameterSet::getParameter(), islandEndcapSuperClusterCollection1_, islandEndcapSuperClusterCollection2_, islandEndcapSuperClusterProducer1_, islandEndcapSuperClusterProducer2_, mip_, nBinDE_, nBinSC_, nEvt_, outputFile_, preshClusterCollectionX_, preshClusterCollectionY_, preshClusterProducer_, and rootFile_.

00032 {
00033  
00034   EminDE_ = ps.getParameter<double>("EminDE");
00035   EmaxDE_ = ps.getParameter<double>("EmaxDE");
00036   nBinDE_ = ps.getParameter<int>("nBinDE");
00037 
00038   EminSC_ = ps.getParameter<double>("EminSC");
00039   EmaxSC_ = ps.getParameter<double>("EmaxSC");
00040   nBinSC_ = ps.getParameter<int>("nBinSC");
00041 
00042   preshClusterCollectionX_ = ps.getParameter<std::string>("preshClusterCollectionX");
00043   preshClusterCollectionY_ = ps.getParameter<std::string>("preshClusterCollectionY");
00044   preshClusterProducer_   = ps.getParameter<std::string>("preshClusterProducer");
00045 
00046   islandEndcapSuperClusterCollection1_ = ps.getParameter<std::string>("islandEndcapSuperClusterCollection1");
00047   islandEndcapSuperClusterProducer1_   = ps.getParameter<std::string>("islandEndcapSuperClusterProducer1");
00048 
00049   islandEndcapSuperClusterCollection2_ = ps.getParameter<std::string>("islandEndcapSuperClusterCollection2");
00050   islandEndcapSuperClusterProducer2_   = ps.getParameter<std::string>("islandEndcapSuperClusterProducer2");
00051 
00052   outputFile_   = ps.getParameter<std::string>("outputFile");
00053   rootFile_ = TFile::Open(outputFile_.c_str(),"RECREATE"); // open output file to store histograms
00054 
00055   // calibration parameters:
00056   calib_planeX_ = ps.getParameter<double>("preshCalibPlaneX");
00057   calib_planeY_ = ps.getParameter<double>("preshCalibPlaneY");
00058   gamma_        = ps.getParameter<double>("preshCalibGamma");
00059   mip_          = ps.getParameter<double>("preshCalibMIP");
00060 
00061   nEvt_ = 0; 
00062 }

PreshowerAnalyzer::~PreshowerAnalyzer (  ) 

Definition at line 65 of file PreshowerAnalyzer.cc.

References rootFile_.

00067 {
00068   delete rootFile_;
00069 }


Member Function Documentation

void PreshowerAnalyzer::analyze ( const edm::Event evt,
const edm::EventSetup es 
) [virtual]

Implements edm::EDAnalyzer.

Definition at line 96 of file PreshowerAnalyzer.cc.

References calib_planeX_, calib_planeY_, e, e1, e2, gamma_, edm::Event::getByLabel(), h1_esDeltaE, h1_esE_x, h1_esE_y, h1_esEta_x, h1_esEta_y, h1_esNhits_x, h1_esNhits_y, h1_esPhi_x, h1_esPhi_y, h1_islandEESCEnergy1, h1_islandEESCEnergy2, h1_nclu_x, h1_nclu_y, islandEndcapSuperClusterCollection1_, islandEndcapSuperClusterCollection2_, islandEndcapSuperClusterProducer1_, islandEndcapSuperClusterProducer2_, mip_, nEvt_, preshClusterCollectionX_, preshClusterCollectionY_, and preshClusterProducer_.

00096                                                                          {
00097 //========================================================================
00098 
00099   using namespace edm; // needed for all fwk related classe
00100 
00101   //std::cout << "\n .......  Event # " << nEvt_+1 << " is analyzing ....... " << std::endl << std::endl;
00102 
00103   // Get island super clusters
00104   Handle<reco::SuperClusterCollection> pIslandEndcapSuperClusters1;
00105   evt.getByLabel(islandEndcapSuperClusterProducer1_, islandEndcapSuperClusterCollection1_, pIslandEndcapSuperClusters1);
00106   const reco::SuperClusterCollection* islandEndcapSuperClusters1 = pIslandEndcapSuperClusters1.product();
00107   //std::cout << "\n islandEndcapSuperClusters1->size() = " << islandEndcapSuperClusters1->size() << std::endl;
00108 
00109   // loop over the super clusters and fill the histogram
00110   for(reco::SuperClusterCollection::const_iterator aClus = islandEndcapSuperClusters1->begin();
00111                                                     aClus != islandEndcapSuperClusters1->end(); aClus++) {
00112     h1_islandEESCEnergy1->Fill( aClus->energy() );
00113   }
00114 
00115   // Get island super clusters
00116   Handle<reco::SuperClusterCollection> pIslandEndcapSuperClusters2;
00117   evt.getByLabel(islandEndcapSuperClusterProducer2_, islandEndcapSuperClusterCollection2_, pIslandEndcapSuperClusters2);
00118   const reco::SuperClusterCollection* islandEndcapSuperClusters2 = pIslandEndcapSuperClusters2.product();
00119   //std::cout << "\n islandEndcapSuperClusters2->size() = " << islandEndcapSuperClusters2->size() << std::endl;
00120 
00121   // loop over the super clusters and fill the histogram
00122   for(reco::SuperClusterCollection::const_iterator aClus = islandEndcapSuperClusters2->begin();
00123                                                     aClus != islandEndcapSuperClusters2->end(); aClus++) {
00124     h1_islandEESCEnergy2->Fill( aClus->energy() );
00125   }
00126 
00127 
00128   // Get ES clusters in X plane
00129   Handle<reco::PreshowerClusterCollection> pPreshowerClustersX;
00130   evt.getByLabel(preshClusterProducer_, preshClusterCollectionX_, pPreshowerClustersX);
00131   const reco::PreshowerClusterCollection *clustersX = pPreshowerClustersX.product();
00132   h1_nclu_x->Fill( clustersX->size() );
00133   //std::cout << "\n pPreshowerClustersX->size() = " << clustersX->size() << std::endl;
00134 
00135   Handle<reco::PreshowerClusterCollection> pPreshowerClustersY;
00136   evt.getByLabel(preshClusterProducer_, preshClusterCollectionY_, pPreshowerClustersY);
00137   const reco::PreshowerClusterCollection *clustersY = pPreshowerClustersY.product();
00138   h1_nclu_y->Fill( clustersY->size() );
00139   //std::cout << "\n pPreshowerClustersY->size() = " << clustersY->size() << std::endl;
00140 
00141 
00142   // loop over the ES clusters and fill the histogram
00143   float e1 = 0;
00144   for(reco::PreshowerClusterCollection::const_iterator esClus = clustersX->begin();
00145                                                        esClus !=clustersX->end(); esClus++) {
00146       e1 += esClus->energy();
00147       h1_esE_x->Fill( esClus->energy() );  
00148       h1_esEta_x->Fill( esClus->eta() );
00149       h1_esPhi_x->Fill( esClus->phi() );
00150       h1_esNhits_x->Fill( esClus->nhits() );     
00151   }
00152 
00153   float e2 = 0;
00154   for(reco::PreshowerClusterCollection::const_iterator esClus = clustersY->begin();
00155                                                        esClus !=clustersY->end(); esClus++) {
00156       e2 += esClus->energy();
00157       h1_esE_y->Fill( esClus->energy() );  
00158       h1_esEta_y->Fill( esClus->eta() );
00159       h1_esPhi_y->Fill( esClus->phi() );
00160       h1_esNhits_y->Fill( esClus->nhits() );     
00161   }
00162   
00163   float deltaE = 0;       
00164   if(e1+e2 > 1.0e-10) {
00165       // GeV to #MIPs
00166       e1 = e1 / mip_;
00167       e2 = e2 / mip_;
00168       deltaE = gamma_*(calib_planeX_*e1+calib_planeY_*e2);       
00169    }
00170 
00171   h1_esDeltaE->Fill(deltaE);
00172 
00173    nEvt_++;
00174 
00175 }

void PreshowerAnalyzer::beginJob ( edm::EventSetup const &   )  [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 72 of file PreshowerAnalyzer.cc.

References EmaxDE_, EmaxSC_, EminDE_, EminSC_, h1_esDeltaE, h1_esE_x, h1_esE_y, h1_esEta_x, h1_esEta_y, h1_esNhits_x, h1_esNhits_y, h1_esPhi_x, h1_esPhi_y, h1_islandEESCEnergy1, h1_islandEESCEnergy2, h1_nclu_x, h1_nclu_y, nBinDE_, nBinSC_, and rootFile_.

00072                                                      {
00073 //========================================================================
00074 
00075   rootFile_->cd();
00076 
00077   h1_esE_x = new TH1F("esE_x"," ES cluster Energy in  X-plane",20, 0, 0.03);
00078   h1_esE_y = new TH1F("esE_y"," ES cluster Energy in  Y-plane",20, 0, 0.03);
00079   h1_esEta_x = new TH1F("esEta_x"," ES cluster Eta in X-plane",12, 1.5, 2.7);
00080   h1_esEta_y = new TH1F("esEta_y"," ES cluster Eta in Y-plane",12, 1.5, 2.7);
00081   h1_esPhi_x = new TH1F("esPhi_x"," ES cluster Phi in X-plane",20, 0, 6.28);
00082   h1_esPhi_y = new TH1F("esPhi_y"," ES cluster Phi in Y-plane",20, 0, 6.28);
00083   h1_esNhits_x = new TH1F("esNhits_x"," ES cluster Nhits in  X-plane",10, 0, 10);
00084   h1_esNhits_y = new TH1F("esNhits_y"," ES cluster Nhits in  Y-plane",10, 0, 10);
00085   h1_esDeltaE = new TH1F("esDeltaE"," DeltaE", nBinDE_, EminDE_, EmaxDE_); 
00086   h1_nclu_x = new TH1F("esNclu_x"," number of ES clusters (for one SC) in X-plane",20, 0, 80);
00087   h1_nclu_y = new TH1F("esNclu_y"," number of ES clusters (for one SC) in Y-plane",20, 0, 80);
00088 
00089   h1_islandEESCEnergy1 = new TH1F("islandEESCEnergy1","Energy of super clusters with island algo - endcap1",nBinSC_,EminSC_,EmaxSC_);
00090   h1_islandEESCEnergy2 = new TH1F("islandEESCEnergy2","Energy of super clusters with island algo - endcap2",nBinSC_,EminSC_,EmaxSC_);
00091 }

void PreshowerAnalyzer::endJob ( void   )  [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 178 of file PreshowerAnalyzer.cc.

References h1_esDeltaE, h1_esE_x, h1_esE_y, h1_esEta_x, h1_esEta_y, h1_esNhits_x, h1_esNhits_y, h1_esPhi_x, h1_esPhi_y, h1_islandEESCEnergy1, h1_islandEESCEnergy2, h1_nclu_x, h1_nclu_y, and rootFile_.

00178                                {
00179 //========================================================================
00180 
00181    rootFile_->cd();
00182 
00183    h1_esE_x->Write();     
00184    h1_esE_y->Write();
00185    h1_esEta_x->Write();
00186    h1_esEta_y->Write();
00187    h1_esPhi_x->Write();
00188    h1_esPhi_y->Write();
00189    h1_esNhits_x->Write();
00190    h1_esNhits_y->Write();          
00191    h1_esDeltaE->Write();
00192    h1_nclu_x->Write();
00193    h1_nclu_y->Write();
00194 
00195    h1_islandEESCEnergy1->Write();
00196    h1_islandEESCEnergy2->Write();
00197 
00198    rootFile_->Close();
00199 }


Member Data Documentation

double PreshowerAnalyzer::calib_planeX_ [private]

Definition at line 60 of file PreshowerAnalyzer.h.

Referenced by analyze(), and PreshowerAnalyzer().

double PreshowerAnalyzer::calib_planeY_ [private]

Definition at line 61 of file PreshowerAnalyzer.h.

Referenced by analyze(), and PreshowerAnalyzer().

float PreshowerAnalyzer::EmaxDE_ [private]

Definition at line 50 of file PreshowerAnalyzer.h.

Referenced by beginJob(), and PreshowerAnalyzer().

float PreshowerAnalyzer::EmaxSC_ [private]

Definition at line 53 of file PreshowerAnalyzer.h.

Referenced by beginJob(), and PreshowerAnalyzer().

float PreshowerAnalyzer::EminDE_ [private]

Definition at line 49 of file PreshowerAnalyzer.h.

Referenced by beginJob(), and PreshowerAnalyzer().

float PreshowerAnalyzer::EminSC_ [private]

Definition at line 52 of file PreshowerAnalyzer.h.

Referenced by beginJob(), and PreshowerAnalyzer().

double PreshowerAnalyzer::gamma_ [private]

Definition at line 63 of file PreshowerAnalyzer.h.

Referenced by analyze(), and PreshowerAnalyzer().

TH1F* PreshowerAnalyzer::h1_esDeltaE [private]

Definition at line 80 of file PreshowerAnalyzer.h.

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

TH1F* PreshowerAnalyzer::h1_esE_x [private]

Definition at line 72 of file PreshowerAnalyzer.h.

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

TH1F* PreshowerAnalyzer::h1_esE_y [private]

Definition at line 73 of file PreshowerAnalyzer.h.

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

TH1F* PreshowerAnalyzer::h1_esEta_x [private]

Definition at line 74 of file PreshowerAnalyzer.h.

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

TH1F* PreshowerAnalyzer::h1_esEta_y [private]

Definition at line 75 of file PreshowerAnalyzer.h.

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

TH1F* PreshowerAnalyzer::h1_esNhits_x [private]

Definition at line 78 of file PreshowerAnalyzer.h.

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

TH1F* PreshowerAnalyzer::h1_esNhits_y [private]

Definition at line 79 of file PreshowerAnalyzer.h.

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

TH1F* PreshowerAnalyzer::h1_esPhi_x [private]

Definition at line 76 of file PreshowerAnalyzer.h.

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

TH1F* PreshowerAnalyzer::h1_esPhi_y [private]

Definition at line 77 of file PreshowerAnalyzer.h.

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

TH1F* PreshowerAnalyzer::h1_islandEESCEnergy1 [private]

Definition at line 83 of file PreshowerAnalyzer.h.

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

TH1F* PreshowerAnalyzer::h1_islandEESCEnergy2 [private]

Definition at line 84 of file PreshowerAnalyzer.h.

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

TH1F* PreshowerAnalyzer::h1_nclu_x [private]

Definition at line 81 of file PreshowerAnalyzer.h.

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

TH1F* PreshowerAnalyzer::h1_nclu_y [private]

Definition at line 82 of file PreshowerAnalyzer.h.

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

std::string PreshowerAnalyzer::islandEndcapSuperClusterCollection1_ [private]

Definition at line 66 of file PreshowerAnalyzer.h.

Referenced by analyze(), and PreshowerAnalyzer().

std::string PreshowerAnalyzer::islandEndcapSuperClusterCollection2_ [private]

Definition at line 69 of file PreshowerAnalyzer.h.

Referenced by analyze(), and PreshowerAnalyzer().

std::string PreshowerAnalyzer::islandEndcapSuperClusterProducer1_ [private]

Definition at line 67 of file PreshowerAnalyzer.h.

Referenced by analyze(), and PreshowerAnalyzer().

std::string PreshowerAnalyzer::islandEndcapSuperClusterProducer2_ [private]

Definition at line 70 of file PreshowerAnalyzer.h.

Referenced by analyze(), and PreshowerAnalyzer().

double PreshowerAnalyzer::mip_ [private]

Definition at line 62 of file PreshowerAnalyzer.h.

Referenced by analyze(), and PreshowerAnalyzer().

int PreshowerAnalyzer::nBinDE_ [private]

Definition at line 51 of file PreshowerAnalyzer.h.

Referenced by beginJob(), and PreshowerAnalyzer().

int PreshowerAnalyzer::nBinSC_ [private]

Definition at line 54 of file PreshowerAnalyzer.h.

Referenced by beginJob(), and PreshowerAnalyzer().

int PreshowerAnalyzer::nEvt_ [private]

Definition at line 47 of file PreshowerAnalyzer.h.

Referenced by analyze(), and PreshowerAnalyzer().

std::string PreshowerAnalyzer::outputFile_ [private]

Definition at line 86 of file PreshowerAnalyzer.h.

Referenced by PreshowerAnalyzer().

std::string PreshowerAnalyzer::preshClusterCollectionX_ [private]

Definition at line 56 of file PreshowerAnalyzer.h.

Referenced by analyze(), and PreshowerAnalyzer().

std::string PreshowerAnalyzer::preshClusterCollectionY_ [private]

Definition at line 57 of file PreshowerAnalyzer.h.

Referenced by analyze(), and PreshowerAnalyzer().

std::string PreshowerAnalyzer::preshClusterProducer_ [private]

Definition at line 58 of file PreshowerAnalyzer.h.

Referenced by analyze(), and PreshowerAnalyzer().

TFile* PreshowerAnalyzer::rootFile_ [private]

Definition at line 87 of file PreshowerAnalyzer.h.

Referenced by beginJob(), endJob(), PreshowerAnalyzer(), and ~PreshowerAnalyzer().


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