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 Member Functions | Private Attributes
AnalyzerWithCentrality Class Reference
Inheritance diagram for AnalyzerWithCentrality:
edm::EDAnalyzer

Public Member Functions

 AnalyzerWithCentrality (const edm::ParameterSet &)
 
 ~AnalyzerWithCentrality ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Private Member Functions

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

Private Attributes

CentralityProvidercentrality_
 
edm::Service< TFileServicefs
 
TH1D * h1
 
TNtuple * nt
 

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
CurrentProcessingContext const * currentContext () const
 

Detailed Description

Definition at line 27 of file AnalyzerWithCentrality.cc.

Constructor & Destructor Documentation

AnalyzerWithCentrality::AnalyzerWithCentrality ( const edm::ParameterSet iConfig)
explicit

Definition at line 57 of file AnalyzerWithCentrality.cc.

References fs, h1, TFileDirectory::make(), and nt.

57  :
58 centrality_(0)
59 {
60  //now do what ever initialization is needed
61  h1 = fs->make<TH1D>("h1","histogram",100,0,100);
62  nt = fs->make<TNtuple>("hi","hi","hf:hft:hftp:hftm:eb:ee:eep:eem:npix:et:zdc:zdcp:zdcm:bin:trig");
63 }
CentralityProvider * centrality_
T * make() const
make new ROOT object
edm::Service< TFileService > fs
AnalyzerWithCentrality::~AnalyzerWithCentrality ( )

Definition at line 65 of file AnalyzerWithCentrality.cc.

66 {
67 
68  // do anything here that needs to be done at desctruction time
69  // (e.g. close files, deallocate resources etc.)
70 
71 }

Member Function Documentation

void AnalyzerWithCentrality::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

Implements edm::EDAnalyzer.

Definition at line 80 of file AnalyzerWithCentrality.cc.

References newFWLiteAna::bin, CentralityProvider::bMean(), CentralityBins::bMeanOfBin(), CentralityProvider::bSigma(), CentralityBins::bSigmaOfBin(), centrality_, CentralityProvider::centralityValue(), gather_cfg::cout, reco::Centrality::EtEBSum(), reco::Centrality::EtEESum(), reco::Centrality::EtEESumMinus(), reco::Centrality::EtEESumPlus(), reco::Centrality::EtHFhitSum(), reco::Centrality::EtHFtowerSum(), reco::Centrality::EtHFtowerSumMinus(), reco::Centrality::EtHFtowerSumPlus(), reco::Centrality::EtMidRapiditySum(), CentralityProvider::getBin(), CentralityProvider::getNbins(), h1, reco::Centrality::multiplicityPixel(), pileupCalc::nbins, CentralityProvider::NcollMean(), CentralityBins::NcollMeanOfBin(), CentralityProvider::NcollSigma(), CentralityBins::NcollSigmaOfBin(), CentralityProvider::newEvent(), CentralityProvider::NhardMean(), CentralityProvider::NhardSigma(), CentralityProvider::NpartMean(), CentralityBins::NpartMeanOfBin(), CentralityProvider::NpartSigma(), CentralityBins::NpartSigmaOfBin(), nt, CentralityProvider::print(), CentralityProvider::raw(), reco::Centrality::zdcSum(), reco::Centrality::zdcSumMinus(), and reco::Centrality::zdcSumPlus().

81 {
82  using namespace edm;
83  if(!centrality_) centrality_ = new CentralityProvider(iSetup);
84  centrality_->newEvent(iEvent,iSetup);
85 
86  double hf = centrality_->raw()->EtHFhitSum();
87  double hft = centrality_->raw()->EtHFtowerSum();
88  double hftp = centrality_->raw()->EtHFtowerSumPlus();
89  double hftm = centrality_->raw()->EtHFtowerSumMinus();
90  double eb = centrality_->raw()->EtEBSum();
91  double ee = centrality_->raw()->EtEESum();
92  double eep = centrality_->raw()->EtEESumPlus();
93  double eem = centrality_->raw()->EtEESumMinus();
94  double zdc = centrality_->raw()->zdcSum();
95  double zdcm = centrality_->raw()->zdcSumMinus();
96  double zdcp = centrality_->raw()->zdcSumPlus();
97  double npix = centrality_->raw()->multiplicityPixel();
98  double et = centrality_->raw()->EtMidRapiditySum();
99 
100  cout<<"Centrality variables in the event:"<<endl;
101  cout<<"Total energy in HF hits : "<<hf<<endl;
102  cout<<"Asymmetry of HF towers : "<<fabs(hftp-hftm)/(hftp+hftm)<<endl;
103  cout<<"Total energy in EE basic clusters : "<<eep+eem<<endl;
104  cout<<"Total energy in EB basic clusters : "<<eb<<endl;
105 
106  centrality_->print();
107 
108  cout<<"Centrality of the event : "<<centrality_->centralityValue()<<endl;
109 
110  int bin = centrality_->getBin();
111  cout<<"a"<<endl;
112  nt->Fill(hf,hft,hftp,hftm,eb,ee,eep,eem,npix,et,zdc,zdcp,zdcm,bin,1);
113  cout<<"b"<<endl;
114 
115  h1->Fill(bin);
116  cout<<"c"<<endl;
117 
118  int nbins = centrality_->getNbins();
119  cout<<"d"<<endl;
120  int binsize = 100./nbins;
121  cout<<"e"<<endl;
122  char* binName = Form("%d to % d",bin*binsize,(bin+1)*binsize);
123  cout<<"The event falls into centrality bin : "<<binName<<" id : "<<bin<<endl;
124 
125  double npartMean = centrality_->NpartMean();
126  double npartSigma = centrality_->NpartSigma();
127  cout<<"Npart Mean : "<<npartMean<<" Variance : "<<npartSigma<<endl;
128 
129  // or, alternatively,
130  npartMean = centrality_->NpartMeanOfBin(bin);
131  npartSigma = centrality_->NpartSigmaOfBin(bin);
132 
133  double ncollMean = centrality_->NcollMean();
134  double ncollSigma = centrality_->NcollSigma();
135  cout<<"Ncoll Mean : "<<ncollMean<<" Variance : "<<ncollSigma<<endl;
136 
137  // or, alternatively,
138  ncollMean = centrality_->NcollMeanOfBin(bin);
139  ncollSigma = centrality_->NcollSigmaOfBin(bin);
140 
141 
142  double nhardMean = centrality_->NhardMean();
143  double nhardSigma = centrality_->NhardSigma();
144  cout<<"Nhard Mean : "<<nhardMean<<" Variance : "<<nhardSigma<<endl;
145 
146  double bMean = centrality_->bMean();
147  double bSigma = centrality_->bSigma();
148  cout<<"b Mean : "<<bMean<<" Variance : "<<bSigma<<endl;
149 
150  bMean = centrality_->bMeanOfBin(bin);
151  bSigma = centrality_->bSigmaOfBin(bin);
152 
153 
154 }
double zdcSum() const
Definition: Centrality.h:43
double EtEESum() const
Definition: Centrality.h:26
float bMean() const
float NpartSigmaOfBin(int bin) const
double EtHFtowerSumMinus() const
Definition: Centrality.h:22
double EtEESumMinus() const
Definition: Centrality.h:28
float NcollSigma() const
float NhardMean() const
const reco::Centrality * raw() const
float NpartMean() const
double zdcSumMinus() const
Definition: Centrality.h:45
float NcollMeanOfBin(int bin) const
void newEvent(const edm::Event &ev, const edm::EventSetup &iSetup)
float NpartSigma() const
double EtHFtowerSumPlus() const
Definition: Centrality.h:21
float bSigmaOfBin(int bin) const
double EtEESumPlus() const
Definition: Centrality.h:27
float NhardSigma() const
double multiplicityPixel() const
Definition: Centrality.h:36
double EtHFtowerSum() const
Definition: Centrality.h:20
float NpartMeanOfBin(int bin) const
double EtEBSum() const
Definition: Centrality.h:32
double EtMidRapiditySum() const
Definition: Centrality.h:46
double EtHFhitSum() const
Definition: Centrality.h:17
float bSigma() const
CentralityProvider * centrality_
float bMeanOfBin(int bin) const
float NcollMean() const
tuple cout
Definition: gather_cfg.py:121
double centralityValue() const
float NcollSigmaOfBin(int bin) const
double zdcSumPlus() const
Definition: Centrality.h:44
void AnalyzerWithCentrality::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 159 of file AnalyzerWithCentrality.cc.

160 {
161 }
void AnalyzerWithCentrality::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 165 of file AnalyzerWithCentrality.cc.

165  {
166 }

Member Data Documentation

CentralityProvider* AnalyzerWithCentrality::centrality_
private

Definition at line 40 of file AnalyzerWithCentrality.cc.

Referenced by analyze().

edm::Service<TFileService> AnalyzerWithCentrality::fs
private

Definition at line 41 of file AnalyzerWithCentrality.cc.

Referenced by AnalyzerWithCentrality().

TH1D* AnalyzerWithCentrality::h1
private
TNtuple* AnalyzerWithCentrality::nt
private

Definition at line 43 of file AnalyzerWithCentrality.cc.

Referenced by analyze(), and AnalyzerWithCentrality().