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  pPbRunFlip_ = hiPset.getUntrackedParameter<unsigned int>("pPbRunFlip",99999999);
13  if(centralityVariable_.compare("HFtowers") == 0) varType_ = HFtowers;
14  if(centralityVariable_.compare("HFtowersPlus") == 0) varType_ = HFtowersPlus;
15  if(centralityVariable_.compare("HFtowersMinus") == 0) varType_ = HFtowersMinus;
16  if(centralityVariable_.compare("HFtowersTrunc") == 0) varType_ = HFtowersTrunc;
17  if(centralityVariable_.compare("HFtowersPlusTrunc") == 0) varType_ = HFtowersPlusTrunc;
18  if(centralityVariable_.compare("HFtowersMinusTrunc") == 0) varType_ = HFtowersMinusTrunc;
19  if(centralityVariable_.compare("HFhits") == 0) varType_ = HFhits;
20  if(centralityVariable_.compare("PixelHits") == 0) varType_ = PixelHits;
21  if(centralityVariable_.compare("PixelTracks") == 0) varType_ = PixelTracks;
22  if(centralityVariable_.compare("Tracks") == 0) varType_ = Tracks;
23  if(centralityVariable_.compare("EB") == 0) varType_ = EB;
24  if(centralityVariable_.compare("EE") == 0) varType_ = EE;
25  if(varType_ == Missing){
26  std::string errorMessage="Requested Centrality variable does not exist : "+centralityVariable_+"\n" +
27  "Supported variables are: \n" + "HFtowers HFhits PixelHits PixelTracks Tracks EB EE" + "\n";
28  throw cms::Exception("Configuration",errorMessage);
29  }
30  if(hiPset.exists("nonDefaultGlauberModel")){
31  centralityMC_ = hiPset.getParameter<std::string>("nonDefaultGlauberModel");
32  }
33  centralityLabel_ = centralityVariable_+centralityMC_;
34  SetName(centralityLabel_.data());
35  }else{
36  }
37  newRun(iSetup);
38 }
39 
42  if(ev.id().run() == prevRun_) return;
43  if(prevRun_ < pPbRunFlip_ && ev.id().run() >= pPbRunFlip_){
44  std::cout<<"Attention, the sides are flipped from this run on!"<<std::endl;
45  if(centralityVariable_.compare("HFtowersPlus") == 0) varType_ = HFtowersMinus;
46  if(centralityVariable_.compare("HFtowersMinus") == 0) varType_ = HFtowersPlus;
47  if(centralityVariable_.compare("HFtowersPlusTrunc") == 0) varType_ = HFtowersMinusTrunc;
48  if(centralityVariable_.compare("HFtowersMinusTrunc") == 0) varType_ = HFtowersPlusTrunc;
49  }
50  prevRun_ = ev.id().run();
51  newRun(iSetup);
52 }
53 
56  iSetup.get<HeavyIonRcd>().get(centralityLabel_,inputDB_);
57  int nbinsMax = inputDB_->m_table.size();
58  table_.clear();
59  table_.reserve(nbinsMax);
60  for(int j=0; j<nbinsMax; j++){
61  const CentralityTable::CBin* thisBin;
62  thisBin = &(inputDB_->m_table[j]);
63  CBin newBin;
64  newBin.bin_edge = thisBin->bin_edge;
65  newBin.n_part_mean = thisBin->n_part.mean;
66  newBin.n_part_var = thisBin->n_part.var;
67  newBin.n_coll_mean = thisBin->n_coll.mean;
68  newBin.n_coll_var = thisBin->n_coll.var;
69  newBin.n_hard_mean = thisBin->n_hard.mean;
70  newBin.n_hard_var = thisBin->n_hard.var;
71  newBin.b_mean = thisBin->b.mean;
72  newBin.b_var = thisBin->b.var;
73 
74  newBin.eccRP_mean = thisBin->eccRP.mean;
75  newBin.eccRP_var = thisBin->eccRP.var;
76  newBin.ecc2_mean = thisBin->ecc2.mean;
77  newBin.ecc2_var = thisBin->ecc2.var;
78  newBin.ecc3_mean = thisBin->ecc3.mean;
79  newBin.ecc3_var = thisBin->ecc3.var;
80  newBin.s_mean = thisBin->S.mean;
81  newBin.s_var = thisBin->S.var;
82 
83  table_.push_back(newBin);
84  }
85 }
86 
88  std::cout<<"Number of bins : "<<table_.size()<<std::endl;
89  for(unsigned int j = 0; j < table_.size(); ++j){
90  std::cout<<"Bin : "<<j<<std::endl;
91  std::cout<<"Bin Low Edge : "<<table_[j].bin_edge <<std::endl;
92  std::cout<<"Npart Mean : "<<table_[j].n_part_mean <<std::endl;
93  std::cout<<"Npart RMS : "<<table_[j].n_part_var <<std::endl;
94  std::cout<<"Ncoll Mean : "<<table_[j].n_coll_mean <<std::endl;
95  std::cout<<"Ncoll RMS : "<<table_[j].n_coll_var <<std::endl;
96  std::cout<<"Nhard Mean : "<<table_[j].n_hard_mean <<std::endl;
97  std::cout<<"Nhard RMS : "<<table_[j].n_hard_var <<std::endl;
98  std::cout<<"b Mean : "<<table_[j].b_mean <<std::endl;
99  std::cout<<"b RMS : "<<table_[j].b_var <<std::endl;
100  }
101 }
102 
104  double var = -99;
105  if(varType_ == HFhits) var = chandle_->EtHFhitSum();
106  if(varType_ == HFtowers) var = chandle_->EtHFtowerSum();
107  if(varType_ == HFtowersPlus) var = chandle_->EtHFtowerSumPlus();
108  if(varType_ == HFtowersMinus) var = chandle_->EtHFtowerSumMinus();
109  if(varType_ == HFtowersTrunc) var = chandle_->EtHFtruncated();
110  if(varType_ == HFtowersPlusTrunc) var = chandle_->EtHFtruncatedPlus();
111  if(varType_ == HFtowersMinusTrunc) var = chandle_->EtHFtruncatedMinus();
112  if(varType_ == PixelHits) var = chandle_->multiplicityPixel();
113  if(varType_ == PixelTracks) var = chandle_->NpixelTracks();
114  if(varType_ == Tracks) var = chandle_->Ntracks();
115  if(varType_ == EB) var = chandle_->EtEBSum();
116  if(varType_ == EE) var = chandle_->EtEESum();
117 
118  return var;
119 }
120 
121 
122 
123 
124 
RunNumber_t run() const
Definition: EventID.h:42
T getParameter(std::string const &) const
float ecc2_var
T getUntrackedParameter(std::string const &, T const &) const
float s_mean
float eccRP_var
float bin_edge
bool exists(std::string const &parameterName) const
checks if a parameter exists
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_
unsigned int pPbRunFlip_
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
float eccRP_mean
float ecc3_var
float n_coll_mean
ParameterSet const & getProcessParameterSet()
Definition: Registry.cc:34
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