CMS 3D CMS Logo

Public Types | Public Member Functions | Private Attributes

CentralityProvider Class Reference

#include <CentralityProvider.h>

Inheritance diagram for CentralityProvider:
CentralityBins TNamed

List of all members.

Public Types

enum  VariableType {
  HFtowers, HFhits, PixelHits, PixelTracks,
  Tracks, EB, EE, Missing
}

Public Member Functions

float bMean () const
float bSigma () const
 CentralityProvider (const edm::EventSetup &iSetup)
double centralityValue () const
int getBin () const
int getNbins () const
float lowEdge () const
float NcollMean () const
float NcollSigma () const
void newEvent (const edm::Event &ev, const edm::EventSetup &iSetup)
void newRun (const edm::EventSetup &iSetup)
float NhardMean () const
float NhardSigma () const
float NpartMean () const
float NpartSigma () const
void print ()
const reco::Centralityraw () const
const CentralityBinstable () const
 ~CentralityProvider ()

Private Attributes

std::string centralityLabel_
std::string centralityMC_
std::string centralityVariable_
edm::Handle< reco::Centralitychandle_
unsigned int prevRun_
edm::InputTag tag_
VariableType varType_

Detailed Description

Definition at line 12 of file CentralityProvider.h.


Member Enumeration Documentation

Enumerator:
HFtowers 
HFhits 
PixelHits 
PixelTracks 
Tracks 
EB 
EE 
Missing 

Definition at line 18 of file CentralityProvider.h.


Constructor & Destructor Documentation

CentralityProvider::CentralityProvider ( const edm::EventSetup iSetup)

Definition at line 3 of file CentralityProvider.cc.

References centralityLabel_, centralityMC_, centralityVariable_, EB, EE, Exception, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), edm::getProcessParameterSet(), HFhits, HFtowers, Missing, newRun(), PixelHits, PixelTracks, tag_, Tracks, and varType_.

                                                                  :
   prevRun_(0),
   varType_(Missing)
{
   const edm::ParameterSet &thepset = edm::getProcessParameterSet();
   if(thepset.exists("HeavyIonGlobalParameters")){
      edm::ParameterSet hiPset = thepset.getParameter<edm::ParameterSet>("HeavyIonGlobalParameters");
      tag_ = hiPset.getParameter<edm::InputTag>("centralitySrc");
      centralityVariable_ = hiPset.getParameter<std::string>("centralityVariable");
      if(centralityVariable_.compare("HFtowers") == 0) varType_ = HFtowers;
      if(centralityVariable_.compare("HFhits") == 0) varType_ = HFhits;
      if(centralityVariable_.compare("PixelHits") == 0) varType_ = PixelHits;
      if(centralityVariable_.compare("PixelTracks") == 0) varType_ = PixelTracks;
      if(centralityVariable_.compare("Tracks") == 0) varType_ = Tracks;
      if(centralityVariable_.compare("EB") == 0) varType_ = EB;
      if(centralityVariable_.compare("EE") == 0) varType_ = EE;
      if(varType_ == Missing){
         std::string errorMessage="Requested Centrality variable does not exist : "+centralityVariable_+"\n" +
            "Supported variables are: \n" + "HFtowers HFhits PixelHits PixelTracks Tracks EB EE" + "\n";
         throw cms::Exception("Configuration",errorMessage);
      }
      if(hiPset.exists("nonDefaultGlauberModel")){
         centralityMC_ = hiPset.getParameter<std::string>("nonDefaultGlauberModel");
      }
      centralityLabel_ = centralityVariable_+centralityMC_;
      SetName(centralityLabel_.data());
   }else{
   }
   newRun(iSetup);
}
CentralityProvider::~CentralityProvider ( ) [inline]

Definition at line 16 of file CentralityProvider.h.

{;}

Member Function Documentation

float CentralityProvider::bMean ( ) const [inline]

Definition at line 30 of file CentralityProvider.h.

References CentralityBins::bMeanOfBin(), and getBin().

{ return bMeanOfBin(getBin());}
float CentralityProvider::bSigma ( ) const [inline]

Definition at line 31 of file CentralityProvider.h.

References CentralityBins::bSigmaOfBin(), and getBin().

{ return bSigmaOfBin(getBin());}
double CentralityProvider::centralityValue ( ) const

Definition at line 90 of file CentralityProvider.cc.

References chandle_, EB, EE, HFhits, HFtowers, PixelHits, PixelTracks, Tracks, and varType_.

Referenced by getBin().

                                                 {
   double var = -99;
   if(varType_ == HFhits) var = chandle_->EtHFhitSum();
   if(varType_ == HFtowers) var = chandle_->EtHFtowerSum();
   if(varType_ == PixelHits) var = chandle_->multiplicityPixel();
   if(varType_ == PixelTracks) var = chandle_->NpixelTracks();
   if(varType_ == Tracks) var = chandle_->Ntracks();
   if(varType_ == EB) var = chandle_->EtEBSum();
   if(varType_ == EE) var = chandle_->EtEESum();

   return var;
}
int CentralityProvider::getBin ( ) const [inline]
int CentralityProvider::getNbins ( ) const [inline]

Reimplemented from CentralityBins.

Definition at line 20 of file CentralityProvider.h.

References CentralityBins::table_.

{return table_.size();}
float CentralityProvider::lowEdge ( ) const [inline]

Definition at line 23 of file CentralityProvider.h.

References getBin(), and CentralityBins::lowEdgeOfBin().

{ return lowEdgeOfBin(getBin());}
float CentralityProvider::NcollMean ( ) const [inline]

Definition at line 26 of file CentralityProvider.h.

References getBin(), and CentralityBins::NcollMeanOfBin().

{ return NcollMeanOfBin(getBin());}
float CentralityProvider::NcollSigma ( ) const [inline]

Definition at line 27 of file CentralityProvider.h.

References getBin(), and CentralityBins::NcollSigmaOfBin().

{ return NcollSigmaOfBin(getBin());}
void CentralityProvider::newEvent ( const edm::Event ev,
const edm::EventSetup iSetup 
)
void CentralityProvider::newRun ( const edm::EventSetup iSetup)

Definition at line 41 of file CentralityProvider.cc.

References CentralityTable::CBin::b, CBin::b_mean, CBin::b_var, CBin::bin_edge, CentralityTable::CBin::bin_edge, centralityLabel_, CentralityTable::CBin::ecc2, CBin::ecc2_mean, CBin::ecc2_var, CentralityTable::CBin::ecc3, CBin::ecc3_mean, CBin::ecc3_var, CentralityTable::CBin::eccRP, CBin::eccRP_mean, CBin::eccRP_var, edm::EventSetup::get(), j, CentralityTable::CBin::n_coll, CBin::n_coll_mean, CBin::n_coll_var, CentralityTable::CBin::n_hard, CBin::n_hard_mean, CBin::n_hard_var, CentralityTable::CBin::n_part, CBin::n_part_mean, CBin::n_part_var, CentralityTable::CBin::S, CBin::s_mean, CBin::s_var, and CentralityBins::table_.

Referenced by CentralityProvider(), and newEvent().

                                                          {
   edm::ESHandle<CentralityTable> inputDB_;
   iSetup.get<HeavyIonRcd>().get(centralityLabel_,inputDB_);
   int nbinsMax = inputDB_->m_table.size();
   table_.clear();
   table_.reserve(nbinsMax);
   for(int j=0; j<nbinsMax; j++){
      const CentralityTable::CBin* thisBin;
      thisBin = &(inputDB_->m_table[j]);
      CBin newBin;
      newBin.bin_edge = thisBin->bin_edge;
      newBin.n_part_mean = thisBin->n_part.mean;
      newBin.n_part_var  = thisBin->n_part.var;
      newBin.n_coll_mean = thisBin->n_coll.mean;
      newBin.n_coll_var  = thisBin->n_coll.var;
      newBin.n_hard_mean = thisBin->n_hard.mean;
      newBin.n_hard_var  = thisBin->n_hard.var;
      newBin.b_mean = thisBin->b.mean;
      newBin.b_var = thisBin->b.var;

      newBin.eccRP_mean = thisBin->eccRP.mean;
      newBin.eccRP_var = thisBin->eccRP.var;
      newBin.ecc2_mean = thisBin->ecc2.mean;
      newBin.ecc2_var = thisBin->ecc2.var;
      newBin.ecc3_mean = thisBin->ecc3.mean;
      newBin.ecc3_var = thisBin->ecc3.var;
      newBin.s_mean = thisBin->S.mean;
      newBin.s_var = thisBin->S.var;

      table_.push_back(newBin);
   }
}
float CentralityProvider::NhardMean ( ) const [inline]

Definition at line 28 of file CentralityProvider.h.

References getBin(), and CentralityBins::NhardMeanOfBin().

{ return NhardMeanOfBin(getBin());}
float CentralityProvider::NhardSigma ( ) const [inline]

Definition at line 29 of file CentralityProvider.h.

References getBin(), and CentralityBins::NhardSigmaOfBin().

{ return NhardSigmaOfBin(getBin());}
float CentralityProvider::NpartMean ( ) const [inline]

Definition at line 24 of file CentralityProvider.h.

References getBin(), and CentralityBins::NpartMeanOfBin().

{ return NpartMeanOfBin(getBin());}
float CentralityProvider::NpartSigma ( ) const [inline]

Definition at line 25 of file CentralityProvider.h.

References getBin(), and CentralityBins::NpartSigmaOfBin().

{ return NpartSigmaOfBin(getBin());}
void CentralityProvider::print ( void  )

Definition at line 74 of file CentralityProvider.cc.

References gather_cfg::cout, j, and CentralityBins::table_.

Referenced by CentralityTableProducer::analyze().

                              {
   std::cout<<"Number of bins : "<<table_.size()<<std::endl;
   for(unsigned int j = 0; j < table_.size(); ++j){
      std::cout<<"Bin : "<<j<<std::endl;
      std::cout<<"Bin Low Edge : "<<table_[j].bin_edge <<std::endl;
      std::cout<<"Npart Mean : "<<table_[j].n_part_mean <<std::endl;
      std::cout<<"Npart RMS  : "<<table_[j].n_part_var <<std::endl;
      std::cout<<"Ncoll Mean : "<<table_[j].n_coll_mean <<std::endl;
      std::cout<<"Ncoll RMS  : "<<table_[j].n_coll_var <<std::endl;
      std::cout<<"Nhard Mean : "<<table_[j].n_hard_mean <<std::endl;
      std::cout<<"Nhard RMS  : "<<table_[j].n_hard_var <<std::endl;
      std::cout<<"b Mean     : "<<table_[j].b_mean <<std::endl;
      std::cout<<"b RMS      : "<<table_[j].b_var <<std::endl;
   }
}
const reco::Centrality* CentralityProvider::raw ( ) const [inline]

Definition at line 36 of file CentralityProvider.h.

References chandle_, and edm::Handle< T >::product().

{return chandle_.product();}
const CentralityBins* CentralityProvider::table ( ) const [inline]

Definition at line 35 of file CentralityProvider.h.

{return this;}

Member Data Documentation

std::string CentralityProvider::centralityLabel_ [private]

Definition at line 41 of file CentralityProvider.h.

Referenced by CentralityProvider(), and newRun().

std::string CentralityProvider::centralityMC_ [private]

Definition at line 42 of file CentralityProvider.h.

Referenced by CentralityProvider().

Definition at line 40 of file CentralityProvider.h.

Referenced by CentralityProvider().

Definition at line 44 of file CentralityProvider.h.

Referenced by centralityValue(), newEvent(), and raw().

unsigned int CentralityProvider::prevRun_ [private]

Definition at line 43 of file CentralityProvider.h.

Referenced by newEvent().

Definition at line 39 of file CentralityProvider.h.

Referenced by CentralityProvider(), and newEvent().

Definition at line 45 of file CentralityProvider.h.

Referenced by CentralityProvider(), and centralityValue().