CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch13/src/DataFormats/HeavyIonEvent/src/Centrality.cc

Go to the documentation of this file.
00001 //
00002 // $Id: Centrality.cc,v 1.14 2010/10/16 17:09:34 yilmaz Exp $
00003 //
00004 
00005 #include "DataFormats/HeavyIonEvent/interface/Centrality.h"
00006 #include "FWCore/ParameterSet/interface/Registry.h"
00007 
00008 #include <iostream>
00009 using namespace std;
00010 using namespace reco;
00011 
00012 Centrality::Centrality(double d, std::string label)
00013   : 
00014 value_(d),
00015 label_(label),
00016 etHFhitSumPlus_(0),
00017 etHFtowerSumPlus_(0),
00018 etHFtruncatedPlus_(0),
00019 etHFhitSumMinus_(0),
00020 etHFtowerSumMinus_(0),
00021 etHFtruncatedMinus_(0),
00022 etEESumPlus_(0),
00023 etEEtruncatedPlus_(0),
00024 etEESumMinus_(0),
00025 etEEtruncatedMinus_(0),
00026 etEBSum_(0),
00027 etEBtruncated_(0),
00028 pixelMultiplicity_(0),
00029 trackMultiplicity_(0),
00030 zdcSumPlus_(0),
00031 zdcSumMinus_(0),
00032 etMidRapiditySum_(0),
00033 ntracksPtCut_(0),
00034 ntracksEtaCut_(0),
00035 ntracksEtaPtCut_(0),
00036 nPixelTracks_(0)
00037 {
00038 }
00039 
00040 
00041 Centrality::~Centrality()
00042 {
00043 }
00044 
00045 #include "CondFormats/HIObjects/interface/CentralityTable.h"
00046 #include "CondFormats/DataRecord/interface/HeavyIonRcd.h"
00047 #include "FWCore/Framework/interface/ESHandle.h"
00048 
00049 const CentralityBins* getCentralityBinsFromDB(const edm::EventSetup& iSetup){
00050 
00051   string centralityLabel = "";
00052   string centralityMC = "";
00053   
00054   const edm::ParameterSet &thepset = edm::getProcessParameterSet();
00055   if(thepset.exists("HeavyIonGlobalParameters")){
00056     edm::ParameterSet hiPset = thepset.getParameter<edm::ParameterSet>("HeavyIonGlobalParameters");
00057     centralityLabel = hiPset.getParameter<string>("centralityVariable");
00058     if(hiPset.exists("nonDefaultGlauberModel")){
00059       centralityMC = hiPset.getParameter<string>("nonDefaultGlauberModel");
00060       centralityLabel += centralityMC;
00061     }
00062   }
00063   
00064   edm::ESHandle<CentralityTable> inputDB_;
00065   iSetup.get<HeavyIonRcd>().get(centralityLabel,inputDB_);
00066   int nbinsMax = inputDB_->m_table.size();
00067   //cout<<"nbinsMax "<<nbinsMax<<endl;
00068    CentralityBins* CB = new CentralityBins("ctemp","",nbinsMax);
00069    for(int j=0; j<nbinsMax; j++){
00070 
00071       const CentralityTable::CBin* thisBin;
00072       thisBin = &(inputDB_->m_table[j]);
00073       CB->table_[j].bin_edge = thisBin->bin_edge;
00074       CB->table_[j].n_part_mean = thisBin->n_part.mean;
00075       CB->table_[j].n_part_var  = thisBin->n_part.var;
00076       CB->table_[j].n_coll_mean = thisBin->n_coll.mean;
00077       CB->table_[j].n_coll_var  = thisBin->n_coll.var;
00078       CB->table_[j].n_hard_mean = thisBin->n_hard.mean;
00079       CB->table_[j].n_hard_var  = thisBin->n_hard.var;
00080       CB->table_[j].b_mean = thisBin->b.mean;
00081       CB->table_[j].b_var = thisBin->b.var;
00082 
00083    }
00084 
00085    return CB;
00086 }
00087 
00088 
00089