test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CentralityProvider.cc
Go to the documentation of this file.
2 
4  prevRun_(0),
5  varType_(Missing)
6 {
8  if(thepset.exists("HeavyIonGlobalParameters")){
9  edm::ParameterSet hiPset = thepset.getParameter<edm::ParameterSet>("HeavyIonGlobalParameters");
10  tag_ = hiPset.getParameter<edm::InputTag>("centralitySrc");
11  centralityVariable_ = hiPset.getParameter<std::string>("centralityVariable");
12  if(centralityVariable_.compare("HFtowers") == 0) varType_ = HFtowers;
13  if(centralityVariable_.compare("HFhits") == 0) varType_ = HFhits;
14  if(centralityVariable_.compare("PixelHits") == 0) varType_ = PixelHits;
15  if(centralityVariable_.compare("PixelTracks") == 0) varType_ = PixelTracks;
16  if(centralityVariable_.compare("Tracks") == 0) varType_ = Tracks;
17  if(centralityVariable_.compare("EB") == 0) varType_ = EB;
18  if(centralityVariable_.compare("EE") == 0) varType_ = EE;
19  if(varType_ == Missing){
20  std::string errorMessage="Requested Centrality variable does not exist : "+centralityVariable_+"\n" +
21  "Supported variables are: \n" + "HFtowers HFhits PixelHits PixelTracks Tracks EB EE" + "\n";
22  throw cms::Exception("Configuration",errorMessage);
23  }
24  if(hiPset.exists("nonDefaultGlauberModel")){
25  centralityMC_ = hiPset.getParameter<std::string>("nonDefaultGlauberModel");
26  }
27  centralityLabel_ = centralityVariable_+centralityMC_;
28  SetName(centralityLabel_.data());
29  }else{
30  }
31  newRun(iSetup);
32 }
33 
36  if(ev.id().run() == prevRun_) return;
37  prevRun_ = ev.id().run();
38  newRun(iSetup);
39 }
40 
43  iSetup.get<HeavyIonRcd>().get(centralityLabel_,inputDB_);
44  int nbinsMax = inputDB_->m_table.size();
45  table_.clear();
46  table_.reserve(nbinsMax);
47  for(int j=0; j<nbinsMax; j++){
48  const CentralityTable::CBin* thisBin;
49  thisBin = &(inputDB_->m_table[j]);
50  CBin newBin;
51  newBin.bin_edge = thisBin->bin_edge;
52  newBin.n_part_mean = thisBin->n_part.mean;
53  newBin.n_part_var = thisBin->n_part.var;
54  newBin.n_coll_mean = thisBin->n_coll.mean;
55  newBin.n_coll_var = thisBin->n_coll.var;
56  newBin.n_hard_mean = thisBin->n_hard.mean;
57  newBin.n_hard_var = thisBin->n_hard.var;
58  newBin.b_mean = thisBin->b.mean;
59  newBin.b_var = thisBin->b.var;
60 
61  newBin.eccRP_mean = thisBin->eccRP.mean;
62  newBin.eccRP_var = thisBin->eccRP.var;
63  newBin.ecc2_mean = thisBin->ecc2.mean;
64  newBin.ecc2_var = thisBin->ecc2.var;
65  newBin.ecc3_mean = thisBin->ecc3.mean;
66  newBin.ecc3_var = thisBin->ecc3.var;
67  newBin.s_mean = thisBin->S.mean;
68  newBin.s_var = thisBin->S.var;
69 
70  table_.push_back(newBin);
71  }
72 }
73 
75  std::cout<<"Number of bins : "<<table_.size()<<std::endl;
76  for(unsigned int j = 0; j < table_.size(); ++j){
77  std::cout<<"Bin : "<<j<<std::endl;
78  std::cout<<"Bin Low Edge : "<<table_[j].bin_edge <<std::endl;
79  std::cout<<"Npart Mean : "<<table_[j].n_part_mean <<std::endl;
80  std::cout<<"Npart RMS : "<<table_[j].n_part_var <<std::endl;
81  std::cout<<"Ncoll Mean : "<<table_[j].n_coll_mean <<std::endl;
82  std::cout<<"Ncoll RMS : "<<table_[j].n_coll_var <<std::endl;
83  std::cout<<"Nhard Mean : "<<table_[j].n_hard_mean <<std::endl;
84  std::cout<<"Nhard RMS : "<<table_[j].n_hard_var <<std::endl;
85  std::cout<<"b Mean : "<<table_[j].b_mean <<std::endl;
86  std::cout<<"b RMS : "<<table_[j].b_var <<std::endl;
87  }
88 }
89 
91  double var = -99;
92  if(varType_ == HFhits) var = chandle_->EtHFhitSum();
93  if(varType_ == HFtowers) var = chandle_->EtHFtowerSum();
94  if(varType_ == PixelHits) var = chandle_->multiplicityPixel();
95  if(varType_ == PixelTracks) var = chandle_->NpixelTracks();
96  if(varType_ == Tracks) var = chandle_->Ntracks();
97  if(varType_ == EB) var = chandle_->EtEBSum();
98  if(varType_ == EE) var = chandle_->EtEESum();
99 
100  return var;
101 }
102 
103 
104 
105 
106 
RunNumber_t run() const
Definition: EventID.h:42
T getParameter(std::string const &) const
float ecc2_var
float s_mean
float eccRP_var
float bin_edge
bool exists(std::string const &parameterName) const
checks if a parameter exists
bool ev
float n_part_mean
CentralityProvider(const edm::EventSetup &iSetup)
float n_hard_var
float b_var
float n_hard_mean
void newEvent(const edm::Event &ev, const edm::EventSetup &iSetup)
float ecc2_mean
int j
Definition: DBlmapReader.cc:9
edm::Handle< reco::Centrality > chandle_
std::string centralityLabel_
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390
float eccRP_mean
float ecc3_var
float n_coll_mean
ParameterSet const & getProcessParameterSet()
Definition: Registry.cc:82
void newRun(const edm::EventSetup &iSetup)
const T & get() const
Definition: EventSetup.h:55
edm::EventID id() const
Definition: EventBase.h:56
float n_part_var
float b_mean
std::string centralityVariable_
tuple cout
Definition: gather_cfg.py:121
float s_var
std::vector< CBin > table_
double centralityValue() const
float ecc3_mean
float n_coll_var