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