8 using namespace muonisolation;
13 float BaseEtaBin = 0.087;
15 for (
int it=1; it <= 20; it++) theBounds[it] = it*BaseEtaBin;
33 for (
int num = 1;
num <= NumberOfTowers;
num++) {
34 if ( fabs(eta) > theBounds[
num-1]) {
36 if (eta < 0) number = -
num;
39 if (fabs(eta) >= theBounds[NumberOfTowers-1]) number = 0;
46 for (
unsigned int i=1;
i <=EtaBounds::NumberOfTowers;
i++) result.push_back(etabounds(
i));
59 int itow1 =
abs(etabounds.towerFromEta(l1.
eta));
60 int itow2 =
abs(etabounds.towerFromEta(l2.
eta));
61 if (itow1 < itow2)
return true;
62 if (itow1 == itow2 && l1.
cone< l2.
cone)
return true;
71 if ( (INFILE=fopen(infile.c_str(),
"r")) ==
NULL) {
72 cout <<
"Cannot open input file " << infile <<endl;
75 ThresholdLocation location;
78 while (fgets(buffer,80,INFILE)) {
79 sscanf(buffer,
"%4s",tag);
80 if (strcmp(tag,
"ver:") == 0){
81 cout <<
" NominalEfficiencyThresholds: "<< infile <<
" comment: "<<buffer<<endl;
84 if (strcmp(tag,
"loc:") == 0) {
85 sscanf(buffer,
"%*s %f %*s %d", &location.eta, &location.cone);
88 if (strcmp(tag,
"thr:") == 0) {
89 eb.eff_previous = eb.eff;
90 sscanf(buffer,
"%*s %f %f", &eb.eff, &thr_val);
91 add(location,ThresholdConstituent(eb,thr_val));
95 cout <<
"... done"<<endl;
103 MapType::iterator ploc = thresholds.find(location);
104 if ( ploc == thresholds.end() ) {
106 mt.insert(threshold);
107 thresholds[location] = mt;
111 (*ploc).second.insert(threshold);
118 MapType::iterator ploc;
119 for (ploc = thresholds.begin(); ploc != thresholds.end(); ploc++) {
120 cout <<
"eta: "<< (*ploc).first.eta
121 <<
" icone: "<< (*ploc).first.cone<<endl;
122 ThresholdConstituents::iterator it;
123 for (it = (*ploc).second.begin(); it != (*ploc).second.end(); it++) {
124 cout <<
" eff: " << (*it).first.eff
125 <<
" eff_previous: "<< (*it).first.eff_previous
126 <<
" cut value: " << (*it).second <<endl;
134 MapType::const_iterator ploc = thresholds.find(location);
135 if ( ploc == thresholds.end() ) {
136 cout <<
"NominalEfficiencyThresholds: Problem:can't find location in the map :( "
137 << location.
eta <<
" " << location.
cone <<
" " << eff_thr
144 ThresholdConstituents::const_iterator it = (*ploc).second.find(eb);
145 if (it == (*ploc).second.end()) {
146 cout <<
"NominalEfficiencyThresholds: Problem:can't find threshold in the map :("<<endl;
std::map< EfficiencyBin, float, EfficiencyBin > ThresholdConstituents
void add(const std::vector< const T * > &source, std::vector< const T * > &dest)
bool operator()(const EfficiencyBin &e1, const EfficiencyBin &e2) const
bool operator()(const ThresholdLocation &l1, const ThresholdLocation &l2) const
std::vector< double > bins() const
int towerFromEta(double eta) const
Abs< T >::type abs(const T &t)
std::pair< EfficiencyBin, float > ThresholdConstituent
float thresholdValueForEfficiency(ThresholdLocation location, float eff_thr) const
NominalEfficiencyThresholds()
void add(ThresholdLocation location, ThresholdConstituent threshold)