CMS 3D CMS Logo

Public Member Functions | Private Attributes

PreshowerAnalyzer Class Reference

#include <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 ()
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

Implementation: \

Author:
: Shahram Rahatlou, May 2006

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

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_, rootFile_, and AlCaHLTBitMon_QueryRunRegistry::string.

{
 
  EminDE_ = ps.getParameter<double>("EminDE");
  EmaxDE_ = ps.getParameter<double>("EmaxDE");
  nBinDE_ = ps.getParameter<int>("nBinDE");

  EminSC_ = ps.getParameter<double>("EminSC");
  EmaxSC_ = ps.getParameter<double>("EmaxSC");
  nBinSC_ = ps.getParameter<int>("nBinSC");

  preshClusterCollectionX_ = ps.getParameter<std::string>("preshClusterCollectionX");
  preshClusterCollectionY_ = ps.getParameter<std::string>("preshClusterCollectionY");
  preshClusterProducer_   = ps.getParameter<std::string>("preshClusterProducer");

  islandEndcapSuperClusterCollection1_ = ps.getParameter<std::string>("islandEndcapSuperClusterCollection1");
  islandEndcapSuperClusterProducer1_   = ps.getParameter<std::string>("islandEndcapSuperClusterProducer1");

  islandEndcapSuperClusterCollection2_ = ps.getParameter<std::string>("islandEndcapSuperClusterCollection2");
  islandEndcapSuperClusterProducer2_   = ps.getParameter<std::string>("islandEndcapSuperClusterProducer2");

  outputFile_   = ps.getParameter<std::string>("outputFile");
  rootFile_ = TFile::Open(outputFile_.c_str(),"RECREATE"); // open output file to store histograms

  // calibration parameters:
  calib_planeX_ = ps.getParameter<double>("preshCalibPlaneX");
  calib_planeY_ = ps.getParameter<double>("preshCalibPlaneY");
  gamma_        = ps.getParameter<double>("preshCalibGamma");
  mip_          = ps.getParameter<double>("preshCalibMIP");

  nEvt_ = 0; 
}
PreshowerAnalyzer::~PreshowerAnalyzer ( )

Definition at line 65 of file PreshowerAnalyzer.cc.

References rootFile_.

{
  delete rootFile_;
}

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_, alignCSCRings::e, 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_.

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

  using namespace edm; // needed for all fwk related classe

  //std::cout << "\n .......  Event # " << nEvt_+1 << " is analyzing ....... " << std::endl << std::endl;

  // Get island super clusters
  Handle<reco::SuperClusterCollection> pIslandEndcapSuperClusters1;
  evt.getByLabel(islandEndcapSuperClusterProducer1_, islandEndcapSuperClusterCollection1_, pIslandEndcapSuperClusters1);
  const reco::SuperClusterCollection* islandEndcapSuperClusters1 = pIslandEndcapSuperClusters1.product();
  //std::cout << "\n islandEndcapSuperClusters1->size() = " << islandEndcapSuperClusters1->size() << std::endl;

  // loop over the super clusters and fill the histogram
  for(reco::SuperClusterCollection::const_iterator aClus = islandEndcapSuperClusters1->begin();
                                                    aClus != islandEndcapSuperClusters1->end(); aClus++) {
    h1_islandEESCEnergy1->Fill( aClus->energy() );
  }

  // Get island super clusters
  Handle<reco::SuperClusterCollection> pIslandEndcapSuperClusters2;
  evt.getByLabel(islandEndcapSuperClusterProducer2_, islandEndcapSuperClusterCollection2_, pIslandEndcapSuperClusters2);
  const reco::SuperClusterCollection* islandEndcapSuperClusters2 = pIslandEndcapSuperClusters2.product();
  //std::cout << "\n islandEndcapSuperClusters2->size() = " << islandEndcapSuperClusters2->size() << std::endl;

  // loop over the super clusters and fill the histogram
  for(reco::SuperClusterCollection::const_iterator aClus = islandEndcapSuperClusters2->begin();
                                                    aClus != islandEndcapSuperClusters2->end(); aClus++) {
    h1_islandEESCEnergy2->Fill( aClus->energy() );
  }


  // Get ES clusters in X plane
  Handle<reco::PreshowerClusterCollection> pPreshowerClustersX;
  evt.getByLabel(preshClusterProducer_, preshClusterCollectionX_, pPreshowerClustersX);
  const reco::PreshowerClusterCollection *clustersX = pPreshowerClustersX.product();
  h1_nclu_x->Fill( clustersX->size() );
  //std::cout << "\n pPreshowerClustersX->size() = " << clustersX->size() << std::endl;

  Handle<reco::PreshowerClusterCollection> pPreshowerClustersY;
  evt.getByLabel(preshClusterProducer_, preshClusterCollectionY_, pPreshowerClustersY);
  const reco::PreshowerClusterCollection *clustersY = pPreshowerClustersY.product();
  h1_nclu_y->Fill( clustersY->size() );
  //std::cout << "\n pPreshowerClustersY->size() = " << clustersY->size() << std::endl;


  // loop over the ES clusters and fill the histogram
  float e1 = 0;
  for(reco::PreshowerClusterCollection::const_iterator esClus = clustersX->begin();
                                                       esClus !=clustersX->end(); esClus++) {
      e1 += esClus->energy();
      h1_esE_x->Fill( esClus->energy() );  
      h1_esEta_x->Fill( esClus->eta() );
      h1_esPhi_x->Fill( esClus->phi() );
      h1_esNhits_x->Fill( esClus->nhits() );     
  }

  float e2 = 0;
  for(reco::PreshowerClusterCollection::const_iterator esClus = clustersY->begin();
                                                       esClus !=clustersY->end(); esClus++) {
      e2 += esClus->energy();
      h1_esE_y->Fill( esClus->energy() );  
      h1_esEta_y->Fill( esClus->eta() );
      h1_esPhi_y->Fill( esClus->phi() );
      h1_esNhits_y->Fill( esClus->nhits() );     
  }
  
  float deltaE = 0;       
  if(e1+e2 > 1.0e-10) {
      // GeV to #MIPs
      e1 = e1 / mip_;
      e2 = e2 / mip_;
      deltaE = gamma_*(calib_planeX_*e1+calib_planeY_*e2);       
   }

  h1_esDeltaE->Fill(deltaE);

   nEvt_++;

}
void PreshowerAnalyzer::beginJob ( void  ) [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_.

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

  rootFile_->cd();

  h1_esE_x = new TH1F("esE_x"," ES cluster Energy in  X-plane",20, 0, 0.03);
  h1_esE_y = new TH1F("esE_y"," ES cluster Energy in  Y-plane",20, 0, 0.03);
  h1_esEta_x = new TH1F("esEta_x"," ES cluster Eta in X-plane",12, 1.5, 2.7);
  h1_esEta_y = new TH1F("esEta_y"," ES cluster Eta in Y-plane",12, 1.5, 2.7);
  h1_esPhi_x = new TH1F("esPhi_x"," ES cluster Phi in X-plane",20, 0, 6.28);
  h1_esPhi_y = new TH1F("esPhi_y"," ES cluster Phi in Y-plane",20, 0, 6.28);
  h1_esNhits_x = new TH1F("esNhits_x"," ES cluster Nhits in  X-plane",10, 0, 10);
  h1_esNhits_y = new TH1F("esNhits_y"," ES cluster Nhits in  Y-plane",10, 0, 10);
  h1_esDeltaE = new TH1F("esDeltaE"," DeltaE", nBinDE_, EminDE_, EmaxDE_); 
  h1_nclu_x = new TH1F("esNclu_x"," number of ES clusters (for one SC) in X-plane",20, 0, 80);
  h1_nclu_y = new TH1F("esNclu_y"," number of ES clusters (for one SC) in Y-plane",20, 0, 80);

  h1_islandEESCEnergy1 = new TH1F("islandEESCEnergy1","Energy of super clusters with island algo - endcap1",nBinSC_,EminSC_,EmaxSC_);
  h1_islandEESCEnergy2 = new TH1F("islandEESCEnergy2","Energy of super clusters with island algo - endcap2",nBinSC_,EminSC_,EmaxSC_);
}
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_.

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

   rootFile_->cd();

   h1_esE_x->Write();     
   h1_esE_y->Write();
   h1_esEta_x->Write();
   h1_esEta_y->Write();
   h1_esPhi_x->Write();
   h1_esPhi_y->Write();
   h1_esNhits_x->Write();
   h1_esNhits_y->Write();          
   h1_esDeltaE->Write();
   h1_nclu_x->Write();
   h1_nclu_y->Write();

   h1_islandEESCEnergy1->Write();
   h1_islandEESCEnergy2->Write();

   rootFile_->Close();
}

Member Data Documentation

Definition at line 60 of file PreshowerAnalyzer.h.

Referenced by analyze(), and PreshowerAnalyzer().

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().

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().

Definition at line 74 of file PreshowerAnalyzer.h.

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

Definition at line 75 of file PreshowerAnalyzer.h.

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

Definition at line 78 of file PreshowerAnalyzer.h.

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

Definition at line 79 of file PreshowerAnalyzer.h.

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

Definition at line 76 of file PreshowerAnalyzer.h.

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

Definition at line 77 of file PreshowerAnalyzer.h.

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

Definition at line 83 of file PreshowerAnalyzer.h.

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

Definition at line 84 of file PreshowerAnalyzer.h.

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

Definition at line 81 of file PreshowerAnalyzer.h.

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

Definition at line 82 of file PreshowerAnalyzer.h.

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

Definition at line 66 of file PreshowerAnalyzer.h.

Referenced by analyze(), and PreshowerAnalyzer().

Definition at line 69 of file PreshowerAnalyzer.h.

Referenced by analyze(), and PreshowerAnalyzer().

Definition at line 67 of file PreshowerAnalyzer.h.

Referenced by analyze(), and PreshowerAnalyzer().

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().

Definition at line 51 of file PreshowerAnalyzer.h.

Referenced by beginJob(), and PreshowerAnalyzer().

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().

Definition at line 56 of file PreshowerAnalyzer.h.

Referenced by analyze(), and PreshowerAnalyzer().

Definition at line 57 of file PreshowerAnalyzer.h.

Referenced by analyze(), and PreshowerAnalyzer().

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().