test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions
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 48 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::BinValues::mean, CentralityTable::CBin::n_coll, CentralityTable::CBin::n_hard, CentralityTable::CBin::n_part, CentralityBins::table_, and CentralityTable::BinValues::var.

48  {
49 
50  string centralityLabel = "";
51  string centralityMC = "";
52 
54  if(thepset.exists("HeavyIonGlobalParameters")){
55  edm::ParameterSet hiPset = thepset.getParameter<edm::ParameterSet>("HeavyIonGlobalParameters");
56  centralityLabel = hiPset.getParameter<string>("centralityVariable");
57  if(hiPset.exists("nonDefaultGlauberModel")){
58  centralityMC = hiPset.getParameter<string>("nonDefaultGlauberModel");
59  centralityLabel += centralityMC;
60  }
61  }
62 
64  iSetup.get<HeavyIonRcd>().get(centralityLabel,inputDB_);
65  int nbinsMax = inputDB_->m_table.size();
66  //cout<<"nbinsMax "<<nbinsMax<<endl;
67  CentralityBins* CB = new CentralityBins("ctemp","",nbinsMax);
68  for(int j=0; j<nbinsMax; j++){
69 
70  const CentralityTable::CBin* thisBin;
71  thisBin = &(inputDB_->m_table[j]);
72  CB->table_[j].bin_edge = thisBin->bin_edge;
73  CB->table_[j].n_part_mean = thisBin->n_part.mean;
74  CB->table_[j].n_part_var = thisBin->n_part.var;
75  CB->table_[j].n_coll_mean = thisBin->n_coll.mean;
76  CB->table_[j].n_coll_var = thisBin->n_coll.var;
77  CB->table_[j].n_hard_mean = thisBin->n_hard.mean;
78  CB->table_[j].n_hard_var = thisBin->n_hard.var;
79  CB->table_[j].b_mean = thisBin->b.mean;
80  CB->table_[j].b_var = thisBin->b.var;
81 
82  }
83 
84  return CB;
85 }
T getParameter(std::string const &) const
bool exists(std::string const &parameterName) const
checks if a parameter exists
int j
Definition: DBlmapReader.cc:9
ParameterSet const & getProcessParameterSet()
Definition: Registry.cc:82
const T & get() const
Definition: EventSetup.h:55
std::vector< CBin > table_