CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
PreshowerAnalyzer Class Reference

#include <PreshowerAnalyzer.h>

Inheritance diagram for PreshowerAnalyzer:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
virtual void beginJob ()
 
virtual void endJob ()
 
 PreshowerAnalyzer (const edm::ParameterSet &)
 
 ~PreshowerAnalyzer ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

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.

32 {
33 
34  EminDE_ = ps.getParameter<double>("EminDE");
35  EmaxDE_ = ps.getParameter<double>("EmaxDE");
36  nBinDE_ = ps.getParameter<int>("nBinDE");
37 
38  EminSC_ = ps.getParameter<double>("EminSC");
39  EmaxSC_ = ps.getParameter<double>("EmaxSC");
40  nBinSC_ = ps.getParameter<int>("nBinSC");
41 
42  preshClusterCollectionX_ = ps.getParameter<std::string>("preshClusterCollectionX");
43  preshClusterCollectionY_ = ps.getParameter<std::string>("preshClusterCollectionY");
44  preshClusterProducer_ = ps.getParameter<std::string>("preshClusterProducer");
45 
46  islandEndcapSuperClusterCollection1_ = ps.getParameter<std::string>("islandEndcapSuperClusterCollection1");
47  islandEndcapSuperClusterProducer1_ = ps.getParameter<std::string>("islandEndcapSuperClusterProducer1");
48 
49  islandEndcapSuperClusterCollection2_ = ps.getParameter<std::string>("islandEndcapSuperClusterCollection2");
50  islandEndcapSuperClusterProducer2_ = ps.getParameter<std::string>("islandEndcapSuperClusterProducer2");
51 
52  outputFile_ = ps.getParameter<std::string>("outputFile");
53  rootFile_ = TFile::Open(outputFile_.c_str(),"RECREATE"); // open output file to store histograms
54 
55  // calibration parameters:
56  calib_planeX_ = ps.getParameter<double>("preshCalibPlaneX");
57  calib_planeY_ = ps.getParameter<double>("preshCalibPlaneY");
58  gamma_ = ps.getParameter<double>("preshCalibGamma");
59  mip_ = ps.getParameter<double>("preshCalibMIP");
60 
61  nEvt_ = 0;
62 }
std::string preshClusterProducer_
T getParameter(std::string const &) const
std::string islandEndcapSuperClusterProducer2_
std::string preshClusterCollectionX_
std::string preshClusterCollectionY_
std::string islandEndcapSuperClusterCollection2_
std::string outputFile_
std::string islandEndcapSuperClusterCollection1_
std::string islandEndcapSuperClusterProducer1_
PreshowerAnalyzer::~PreshowerAnalyzer ( )

Definition at line 65 of file PreshowerAnalyzer.cc.

References rootFile_.

67 {
68  delete rootFile_;
69 }

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, reco::e1, reco::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_.

96  {
97 //========================================================================
98 
99  using namespace edm; // needed for all fwk related classe
100 
101  //std::cout << "\n ....... Event # " << nEvt_+1 << " is analyzing ....... " << std::endl << std::endl;
102 
103  // Get island super clusters
104  Handle<reco::SuperClusterCollection> pIslandEndcapSuperClusters1;
106  const reco::SuperClusterCollection* islandEndcapSuperClusters1 = pIslandEndcapSuperClusters1.product();
107  //std::cout << "\n islandEndcapSuperClusters1->size() = " << islandEndcapSuperClusters1->size() << std::endl;
108 
109  // loop over the super clusters and fill the histogram
110  for(reco::SuperClusterCollection::const_iterator aClus = islandEndcapSuperClusters1->begin();
111  aClus != islandEndcapSuperClusters1->end(); aClus++) {
112  h1_islandEESCEnergy1->Fill( aClus->energy() );
113  }
114 
115  // Get island super clusters
116  Handle<reco::SuperClusterCollection> pIslandEndcapSuperClusters2;
118  const reco::SuperClusterCollection* islandEndcapSuperClusters2 = pIslandEndcapSuperClusters2.product();
119  //std::cout << "\n islandEndcapSuperClusters2->size() = " << islandEndcapSuperClusters2->size() << std::endl;
120 
121  // loop over the super clusters and fill the histogram
122  for(reco::SuperClusterCollection::const_iterator aClus = islandEndcapSuperClusters2->begin();
123  aClus != islandEndcapSuperClusters2->end(); aClus++) {
124  h1_islandEESCEnergy2->Fill( aClus->energy() );
125  }
126 
127 
128  // Get ES clusters in X plane
129  Handle<reco::PreshowerClusterCollection> pPreshowerClustersX;
130  evt.getByLabel(preshClusterProducer_, preshClusterCollectionX_, pPreshowerClustersX);
131  const reco::PreshowerClusterCollection *clustersX = pPreshowerClustersX.product();
132  h1_nclu_x->Fill( clustersX->size() );
133  //std::cout << "\n pPreshowerClustersX->size() = " << clustersX->size() << std::endl;
134 
135  Handle<reco::PreshowerClusterCollection> pPreshowerClustersY;
136  evt.getByLabel(preshClusterProducer_, preshClusterCollectionY_, pPreshowerClustersY);
137  const reco::PreshowerClusterCollection *clustersY = pPreshowerClustersY.product();
138  h1_nclu_y->Fill( clustersY->size() );
139  //std::cout << "\n pPreshowerClustersY->size() = " << clustersY->size() << std::endl;
140 
141 
142  // loop over the ES clusters and fill the histogram
143  float e1 = 0;
144  for(reco::PreshowerClusterCollection::const_iterator esClus = clustersX->begin();
145  esClus !=clustersX->end(); esClus++) {
146  e1 += esClus->energy();
147  h1_esE_x->Fill( esClus->energy() );
148  h1_esEta_x->Fill( esClus->eta() );
149  h1_esPhi_x->Fill( esClus->phi() );
150  h1_esNhits_x->Fill( esClus->nhits() );
151  }
152 
153  float e2 = 0;
154  for(reco::PreshowerClusterCollection::const_iterator esClus = clustersY->begin();
155  esClus !=clustersY->end(); esClus++) {
156  e2 += esClus->energy();
157  h1_esE_y->Fill( esClus->energy() );
158  h1_esEta_y->Fill( esClus->eta() );
159  h1_esPhi_y->Fill( esClus->phi() );
160  h1_esNhits_y->Fill( esClus->nhits() );
161  }
162 
163  float deltaE = 0;
164  if(e1+e2 > 1.0e-10) {
165  // GeV to #MIPs
166  e1 = e1 / mip_;
167  e2 = e2 / mip_;
168  deltaE = gamma_*(calib_planeX_*e1+calib_planeY_*e2);
169  }
170 
171  h1_esDeltaE->Fill(deltaE);
172 
173  nEvt_++;
174 
175 }
std::string preshClusterProducer_
std::string islandEndcapSuperClusterProducer2_
std::string preshClusterCollectionX_
std::string preshClusterCollectionY_
std::string islandEndcapSuperClusterCollection2_
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
std::vector< PreshowerCluster > PreshowerClusterCollection
collection of PreshowerCluster objects
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
Float e1
Definition: deltaR.h:22
std::string islandEndcapSuperClusterCollection1_
Float e2
Definition: deltaR.h:23
std::string islandEndcapSuperClusterProducer1_
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_.

72  {
73 //========================================================================
74 
75  rootFile_->cd();
76 
77  h1_esE_x = new TH1F("esE_x"," ES cluster Energy in X-plane",20, 0, 0.03);
78  h1_esE_y = new TH1F("esE_y"," ES cluster Energy in Y-plane",20, 0, 0.03);
79  h1_esEta_x = new TH1F("esEta_x"," ES cluster Eta in X-plane",12, 1.5, 2.7);
80  h1_esEta_y = new TH1F("esEta_y"," ES cluster Eta in Y-plane",12, 1.5, 2.7);
81  h1_esPhi_x = new TH1F("esPhi_x"," ES cluster Phi in X-plane",20, 0, 6.28);
82  h1_esPhi_y = new TH1F("esPhi_y"," ES cluster Phi in Y-plane",20, 0, 6.28);
83  h1_esNhits_x = new TH1F("esNhits_x"," ES cluster Nhits in X-plane",10, 0, 10);
84  h1_esNhits_y = new TH1F("esNhits_y"," ES cluster Nhits in Y-plane",10, 0, 10);
85  h1_esDeltaE = new TH1F("esDeltaE"," DeltaE", nBinDE_, EminDE_, EmaxDE_);
86  h1_nclu_x = new TH1F("esNclu_x"," number of ES clusters (for one SC) in X-plane",20, 0, 80);
87  h1_nclu_y = new TH1F("esNclu_y"," number of ES clusters (for one SC) in Y-plane",20, 0, 80);
88 
89  h1_islandEESCEnergy1 = new TH1F("islandEESCEnergy1","Energy of super clusters with island algo - endcap1",nBinSC_,EminSC_,EmaxSC_);
90  h1_islandEESCEnergy2 = new TH1F("islandEESCEnergy2","Energy of super clusters with island algo - endcap2",nBinSC_,EminSC_,EmaxSC_);
91 }
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_.

178  {
179 //========================================================================
180 
181  rootFile_->cd();
182 
183  h1_esE_x->Write();
184  h1_esE_y->Write();
185  h1_esEta_x->Write();
186  h1_esEta_y->Write();
187  h1_esPhi_x->Write();
188  h1_esPhi_y->Write();
189  h1_esNhits_x->Write();
190  h1_esNhits_y->Write();
191  h1_esDeltaE->Write();
192  h1_nclu_x->Write();
193  h1_nclu_y->Write();
194 
195  h1_islandEESCEnergy1->Write();
196  h1_islandEESCEnergy2->Write();
197 
198  rootFile_->Close();
199 }

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