CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_14/src/RecoHI/HiCentralityAlgos/src/CentralityTableHandler.cc

Go to the documentation of this file.
00001 #include "RecoHI/HiCentralityAlgos/interface/CentralityTableHandler.h"
00002 #include "DataFormats/HeavyIonEvent/interface/Centrality.h"
00003 #include "CondCore/PopCon/interface/PopConAnalyzer.h"
00004 #include "FWCore/Framework/interface/MakerMacros.h"
00005 
00006 #include <TFile.h>
00007 #include <iostream>
00008 using namespace std;
00009 using namespace popcon;
00010 
00011 void CentralityTableHandler::getNewObjects(){
00012   //  cond::TagInfo const & tagInfo_ = tagInfo();
00013   //  cond::LogDBEntry const & logDBEntry_ = logDBEntry();     
00014   Ref payload = lastPayload();
00015   cond::Time_t snc = 1;
00016   TFile* inputTFile_ = new TFile(inputTFileName_.data(),"read");
00017   runnum_ = 1;
00018   CentralityBins* CB = (CentralityBins*) inputTFile_->Get(Form("%s/run%d",centralityTag_.data(),runnum_));
00019   cout<<centralityTag_.data()<<endl;
00020   CentralityTable* CT = new CentralityTable();
00021   CT->m_table.reserve(CB->getNbins());
00022 
00023   for(int j=0; j<CB->getNbins(); j++){
00024     CentralityTable::CBin* thisBin = new CentralityTable::CBin();
00025     thisBin->bin_edge = CB->lowEdgeOfBin(j);
00026     thisBin->n_part.mean = CB->NpartMeanOfBin(j);
00027     thisBin->n_part.var  = CB->NpartSigmaOfBin(j);
00028     thisBin->n_coll.mean = CB->NcollMeanOfBin(j);
00029     thisBin->n_coll.var  = CB->NcollSigmaOfBin(j);
00030     thisBin->n_hard.mean = CB->NhardMeanOfBin(j);
00031     thisBin->n_hard.var  = CB->NhardSigmaOfBin(j);
00032     thisBin->b.mean = CB->bMeanOfBin(j);
00033     thisBin->b.var = CB->bSigmaOfBin(j);
00034 
00035     CT->m_table.push_back(*thisBin);
00036   }
00037 
00038   m_to_transfer.push_back(std::make_pair(CT,snc));
00039 
00040 }
00041 
00042 typedef  popcon::PopConAnalyzer<CentralityTableHandler> CentralityPopConProducer;
00043 DEFINE_FWK_MODULE(CentralityPopConProducer);
00044 
00045 
00046 
00047