CMS 3D CMS Logo

Functions

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/DataFormats/HeavyIonEvent/src/Centrality.cc File Reference

#include "DataFormats/HeavyIonEvent/interface/Centrality.h"
#include "FWCore/ParameterSet/interface/Registry.h"
#include <iostream>
#include "CondFormats/HIObjects/interface/CentralityTable.h"
#include "CondFormats/DataRecord/interface/HeavyIonRcd.h"
#include "FWCore/Framework/interface/ESHandle.h"

Go to the source code of this file.

Functions

const CentralityBinsgetCentralityBinsFromDB (const edm::EventSetup &iSetup)

Function Documentation

const CentralityBins* getCentralityBinsFromDB ( const edm::EventSetup iSetup)

Definition at line 49 of file Centrality.cc.

References CentralityTable::CBin::b, CentralityTable::CBin::bin_edge, edm::ParameterSet::exists(), edm::EventSetup::get(), edm::ParameterSet::getParameter(), edm::getProcessParameterSet(), j, CentralityTable::CBin::n_coll, CentralityTable::CBin::n_hard, CentralityTable::CBin::n_part, and CentralityBins::table_.

                                                                          {

  string centralityLabel = "";
  string centralityMC = "";
  
  const edm::ParameterSet &thepset = edm::getProcessParameterSet();
  if(thepset.exists("HeavyIonGlobalParameters")){
    edm::ParameterSet hiPset = thepset.getParameter<edm::ParameterSet>("HeavyIonGlobalParameters");
    centralityLabel = hiPset.getParameter<string>("centralityVariable");
    if(hiPset.exists("nonDefaultGlauberModel")){
      centralityMC = hiPset.getParameter<string>("nonDefaultGlauberModel");
      centralityLabel += centralityMC;
    }
  }
  
  edm::ESHandle<CentralityTable> inputDB_;
  iSetup.get<HeavyIonRcd>().get(centralityLabel,inputDB_);
  int nbinsMax = inputDB_->m_table.size();
  //cout<<"nbinsMax "<<nbinsMax<<endl;
   CentralityBins* CB = new CentralityBins("ctemp","",nbinsMax);
   for(int j=0; j<nbinsMax; j++){

      const CentralityTable::CBin* thisBin;
      thisBin = &(inputDB_->m_table[j]);
      CB->table_[j].bin_edge = thisBin->bin_edge;
      CB->table_[j].n_part_mean = thisBin->n_part.mean;
      CB->table_[j].n_part_var  = thisBin->n_part.var;
      CB->table_[j].n_coll_mean = thisBin->n_coll.mean;
      CB->table_[j].n_coll_var  = thisBin->n_coll.var;
      CB->table_[j].n_hard_mean = thisBin->n_hard.mean;
      CB->table_[j].n_hard_var  = thisBin->n_hard.var;
      CB->table_[j].b_mean = thisBin->b.mean;
      CB->table_[j].b_var = thisBin->b.var;

   }

   return CB;
}