CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Attributes
LA_Filler_Fitter Class Reference

#include <LA_Filler_Fitter.h>

Classes

struct  EnsembleSummary
 
struct  Result
 

Public Types

enum  Method {
  WIDTH = 1 << 0, FIRST_METHOD = 1 << 0, PROB1 = 1 << 1, AVGV2 = 1 << 2,
  AVGV3 = 1 << 3, RMSV2 = 1 << 4, RMSV3 = 1 << 5, LAST_METHOD = 1 << 5
}
 

Public Member Functions

poly< std::string > allAndOne (const unsigned width) const
 
void fill (TTree *, Book &) const
 
void fill_one_cluster (Book &, const poly< std::string > &, const unsigned, const float, const float, const float, const float) const
 
poly< std::string > granularity (const SiStripDetId, const float, const Long64_t, const float, const unsigned) const
 
 LA_Filler_Fitter (int methods, bool layer, bool module, float localybin, unsigned stripbin, unsigned max, const TrackerTopology *tTopo)
 
 LA_Filler_Fitter (int methods, int M, int N, double low, double up, unsigned max, const TrackerTopology *tTopo)
 
std::string layerLabel (const SiStripDetId) const
 
void summarize_ensembles (Book &) const
 
poly< std::string > varWidth (const unsigned width) const
 

Static Public Member Functions

static std::map< std::string, std::vector< Result > > ensemble_results (const Book &, const Method)
 
static std::map< std::string, std::vector< EnsembleSummary > > ensemble_summary (const Book &)
 
static unsigned find_rebin (const TH1 *const)
 
static void fit (Book &book)
 
static void fit_width_profile (Book &)
 
static unsigned layer_index (bool TIB, bool stereo, unsigned layer)
 
static std::map< std::string, Resultlayer_results (const Book &, const Method)
 
static void make_and_fit_symmchi2 (Book &)
 
static std::string method (Method m, bool fit=true)
 
static std::map< uint32_t, Resultmodule_results (const Book &, const Method)
 
static std::string moduleLabel (const SiStripDetId)
 
static std::pair< std::pair< float, float >, std::pair< float, float > > offset_slope (const std::vector< EnsembleSummary > &)
 
static float pull (const std::vector< EnsembleSummary > &)
 
static Result result (Method, const std::string name, const Book &)
 
static TH1 * rms_profile (const std::string, const TProfile *const)
 
static std::string subdetLabel (const SiStripDetId)
 
static TH1 * subset_probability (const std::string name, const TH1 *const, const TH1 *const)
 

Private Attributes

const bool byLayer_
 
const bool byModule_
 
const int ensembleBins_
 
const double ensembleLow_
 
const int ensembleSize_
 
const double ensembleUp_
 
const float localYbin_
 
const Long64_t maxEvents_
 
const int methods_
 
const unsigned stripsPerBin_
 
const TrackerTopologytTopo_
 

Detailed Description

Definition at line 14 of file LA_Filler_Fitter.h.

Member Enumeration Documentation

◆ Method

Enumerator
WIDTH 
FIRST_METHOD 
PROB1 
AVGV2 
AVGV3 
RMSV2 
RMSV3 
LAST_METHOD 

Definition at line 50 of file LA_Filler_Fitter.h.

50  {
51  WIDTH = 1 << 0,
52  FIRST_METHOD = 1 << 0,
53  PROB1 = 1 << 1,
54  AVGV2 = 1 << 2,
55  AVGV3 = 1 << 3,
56  RMSV2 = 1 << 4,
57  RMSV3 = 1 << 5,
58  LAST_METHOD = 1 << 5
59  };

Constructor & Destructor Documentation

◆ LA_Filler_Fitter() [1/2]

LA_Filler_Fitter::LA_Filler_Fitter ( int  methods,
int  M,
int  N,
double  low,
double  up,
unsigned  max,
const TrackerTopology tTopo 
)
inline

Definition at line 17 of file LA_Filler_Fitter.h.

18  : ensembleSize_(M),
21  ensembleUp_(up),
22  byLayer_(true),
23  byModule_(false),
24  localYbin_(0),
25  stripsPerBin_(0),
26  maxEvents_(max),
27  methods_(methods),
28  tTopo_(tTopo) {}

◆ LA_Filler_Fitter() [2/2]

LA_Filler_Fitter::LA_Filler_Fitter ( int  methods,
bool  layer,
bool  module,
float  localybin,
unsigned  stripbin,
unsigned  max,
const TrackerTopology tTopo 
)
inline

Definition at line 31 of file LA_Filler_Fitter.h.

38  : ensembleSize_(0),
39  ensembleBins_(0),
40  ensembleLow_(0),
41  ensembleUp_(0),
42  byLayer_(layer),
44  localYbin_(localybin),
45  stripsPerBin_(stripbin),
46  maxEvents_(max),
47  methods_(methods),
48  tTopo_(tTopo) {}

Member Function Documentation

◆ allAndOne()

poly< std::string > LA_Filler_Fitter::allAndOne ( const unsigned  width) const

Definition at line 77 of file LA_Filler.cc.

77  {
78  poly<std::string> a1("_all");
79  if (width == 1)
80  a1 *= "_w1";
81  return a1;
82 }

References ApeEstimator_cff::width.

Referenced by fill_one_cluster().

◆ ensemble_results()

std::map< std::string, std::vector< LA_Filler_Fitter::Result > > LA_Filler_Fitter::ensemble_results ( const Book book,
const Method  m 
)
static

Definition at line 79 of file LA_Results.cc.

80  {
81  std::map<std::string, std::vector<Result> > results;
82  for (Book::const_iterator it = book.begin(".*_sample.*" + method(m)); it != book.end(); ++it) {
83  const std::string name = std::regex_replace(it->first, std::regex("sample\\d*_"), "");
84  results[name].push_back(result(m, it->first, book));
85  }
86  return results;
87 }

References Book::begin(), Book::end(), visualization-live-secondInstance_cfg::m, method(), Skims_PA_cff::name, result(), bookConverter::results, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by summarize_ensembles().

◆ ensemble_summary()

std::map< std::string, std::vector< LA_Filler_Fitter::EnsembleSummary > > LA_Filler_Fitter::ensemble_summary ( const Book book)
static

Definition at line 115 of file LA_Results.cc.

116  {
117  std::map<std::string, std::vector<EnsembleSummary> > summary;
118  for (Book::const_iterator it = book.begin(".*_ensembleReco"); it != book.end(); ++it) {
119  const std::string base = boost::erase_all_copy(it->first, "_ensembleReco");
120 
121  const TH1* const reco = it->second;
122  const TH1* const measure = book[base + "_measure"];
123  const TH1* const merr = book[base + "_merr"];
124  const TH1* const pull = book[base + "_pull"];
125 
126  EnsembleSummary s;
127  s.samples = reco->GetEntries();
128  s.truth = reco->GetMean();
129  s.meanMeasured = std::make_pair<float, float>(measure->GetFunction("gaus")->GetParameter(1),
130  measure->GetFunction("gaus")->GetParError(1));
131  s.sigmaMeasured = std::make_pair<float, float>(measure->GetFunction("gaus")->GetParameter(2),
132  measure->GetFunction("gaus")->GetParError(2));
133  s.meanUncertainty = std::make_pair<float, float>(merr->GetFunction("gaus")->GetParameter(1),
134  merr->GetFunction("gaus")->GetParError(1));
135  s.pull = std::make_pair<float, float>(pull->GetFunction("gaus")->GetParameter(2),
136  pull->GetFunction("gaus")->GetParError(2));
137 
138  const std::string name = std::regex_replace(base, std::regex("ensembleBin\\d*_"), "");
139  summary[name].push_back(s);
140  }
141  return summary;
142 }

References newFWLiteAna::base, Book::begin(), Book::end(), Skims_PA_cff::name, pull(), alignCSCRings::s, AlCaHLTBitMon_QueryRunRegistry::string, and edmLumisInFiles::summary.

Referenced by sistrip::EnsembleCalibrationLA::write_ensembles_text().

◆ fill()

void LA_Filler_Fitter::fill ( TTree *  tree,
Book book 
) const

Definition at line 7 of file LA_Filler.cc.

7  {
8  TTREE_FOREACH_ENTRY(tree) {
9  TFE_MAX(maxEvents_);
10  TFE_PRINTSTATUS;
11  std::vector<unsigned> PLEAF(tsostrackmulti, tree);
12  std::vector<unsigned> PLEAF(clusterdetid, tree);
13  std::vector<unsigned> PLEAF(clusterwidth, tree);
14  std::vector<float> PLEAF(clustervariance, tree);
15  std::vector<float> PLEAF(tsosdriftx, tree);
16  std::vector<float> PLEAF(tsosdriftz, tree);
17  std::vector<float> PLEAF(tsoslocaltheta, tree);
18  std::vector<float> PLEAF(tsoslocalphi, tree);
19  std::vector<float> PLEAF(tsosglobalZofunitlocalY, tree);
20 
21  const unsigned N(clusterdetid.size());
22  std::vector<float> BdotY(N, 0);
23  if (!ensembleBins_) {
24  std::vector<float> PLEAF(tsosBdotY, tree);
25  swap(BdotY, tsosBdotY);
26  }
27  std::vector<float> localy(N, 0);
28  if (localYbin_) {
29  std::vector<float> PLEAF(tsoslocaly, tree);
30  swap(localy, tsoslocaly);
31  }
32  std::vector<unsigned> seedstrip(N, 0);
33  if (stripsPerBin_) {
34  std::vector<unsigned> PLEAF(clusterseedstrip, tree);
35  swap(seedstrip, clusterseedstrip);
36  }
37 
38  for (unsigned i = 0; i < N; i++) {
39  const SiStripDetId detid(clusterdetid[i]);
40  if (tsostrackmulti[i] != 1 ||
41  (detid.subDetector() != SiStripDetId::TIB && detid.subDetector() != SiStripDetId::TOB))
42  continue;
43 
44  const int sign = tsosglobalZofunitlocalY[i] < 0 ? -1 : 1;
45  const float tthetaL = sign * tsosdriftx[i] / tsosdriftz[i];
46  const float tthetaT = sign * tan(tsoslocaltheta[i]) * cos(tsoslocalphi[i]);
47 
48  fill_one_cluster(book,
49  granularity(detid, tthetaL, TFE_index, localy[i], seedstrip[i] % 128),
50  clusterwidth[i],
51  clustervariance[i],
52  tthetaL,
53  tthetaT,
54  fabs(BdotY[i]));
55  }
56  }
57 }

References funct::cos(), ensembleBins_, fill_one_cluster(), granularity(), mps_fire::i, localYbin_, maxEvents_, N, Validation_hcalonly_cfi::sign, stripsPerBin_, SiStripDetId::subDetector(), edm::swap(), funct::tan(), SiStripDetId::TIB, and SiStripDetId::TOB.

Referenced by sistrip::EnsembleCalibrationLA::endJob(), and sistrip::MeasureLA::MeasureLA().

◆ fill_one_cluster()

void LA_Filler_Fitter::fill_one_cluster ( Book book,
const poly< std::string > &  gran,
const unsigned  width,
const float  variance,
const float  tthetaL,
const float  tthetaT,
const float  BdotY 
) const

Definition at line 59 of file LA_Filler.cc.

65  {
66  book.fill(tthetaL, gran + "_reconstruction", 360, -1.0, 1.0);
67  book.fill(tthetaT - tthetaL, gran + allAndOne(width), 360, -1.0, 1.0);
68  book.fill(tthetaT - tthetaL, variance, gran + varWidth(width), 360, -1.0, 1.0);
69  if (methods_ & WIDTH)
70  book.fill(tthetaT, width, gran + method(WIDTH), 81, -0.6, 0.6);
71  if (!ensembleBins_) {
72  book.fill(BdotY, gran + "_field", 101, 1, 5);
73  book.fill(width, gran + "_width", 10, 0, 10);
74  }
75 }

References allAndOne(), ensembleBins_, Book::fill(), method(), methods_, varWidth(), ApeEstimator_cff::width, and WIDTH.

Referenced by fill().

◆ find_rebin()

unsigned LA_Filler_Fitter::find_rebin ( const TH1 * const  hist)
static

Definition at line 104 of file LA_Fitter.cc.

104  {
105  const double mean = hist->GetMean();
106  const double rms = hist->GetRMS();
107  const int begin = std::min(1, hist->GetXaxis()->FindFixBin(mean - rms));
108  const int end = std::max(hist->GetNbinsX(), hist->GetXaxis()->FindFixBin(mean + rms)) + 1;
109  unsigned current_hole(0), max_hole(0);
110  for (int i = begin; i < end; i++) {
111  if (!hist->GetBinError(i))
112  current_hole++;
113  else if (current_hole) {
114  max_hole = std::max(current_hole, max_hole);
115  current_hole = 0;
116  }
117  }
118  return max_hole + 1;
119 }

References mps_fire::end, gpuVertexFinder::hist, mps_fire::i, SiStripPI::max, SiStripPI::mean, min(), and SiStripPI::rms.

Referenced by make_and_fit_symmchi2().

◆ fit()

static void LA_Filler_Fitter::fit ( Book book)
inlinestatic

◆ fit_width_profile()

void LA_Filler_Fitter::fit_width_profile ( Book book)
static

Definition at line 8 of file LA_Fitter.cc.

8  {
9  for (Book::iterator it = book.begin(".*" + method(WIDTH)); it != book.end(); ++it) {
10  it->second->SetTitle("Mean Cluster Width;tan#theta_{t}");
11  TH1* const p = it->second;
12  if (p->GetEntries() < 400) {
13  delete p;
14  book[it->first] = nullptr;
15  continue;
16  }
17  p->SetTitle(";tan#theta_{t};");
18  const float min = p->GetMinimum();
19  const float max = p->GetMaximum();
20  float xofmin = p->GetBinCenter(p->GetMinimumBin());
21  if (xofmin > 0.0 || xofmin < -0.15)
22  xofmin = -0.05;
23  const float xofmax = p->GetBinCenter(p->GetMaximumBin());
24 
25  TF1* const fit = new TF1("LA_profile_fit", "[2]*(TMath::Abs(x-[0]))+[1]", -1, 1);
26  fit->SetParLimits(0, -0.15, 0.01);
27  fit->SetParLimits(1, 0.6 * min, 1.25 * min);
28  fit->SetParLimits(2, 0.1, 10);
29  fit->SetParameters(xofmin, min, (max - min) / fabs(xofmax - xofmin));
30 
31  int badfit = p->Fit(fit, "IEQ", "", -.5, .3);
32  if (badfit)
33  badfit = p->Fit(fit, "IEQ", "", -.46, .26);
34  if (badfit) {
35  book.erase(it);
36  }
37  }
38 }

References Book::begin(), Book::end(), Book::erase(), SiStripPI::max, method(), min(), AlCaHLTBitMon_ParallelJobs::p, and WIDTH.

Referenced by fit().

◆ granularity()

poly< std::string > LA_Filler_Fitter::granularity ( const SiStripDetId  detid,
const float  tthetaL,
const Long64_t  TFE_index,
const float  localy,
const unsigned  apvstrip 
) const

Definition at line 94 of file LA_Filler.cc.

98  {
99  poly<std::string> gran;
100  gran += subdetLabel(detid);
101  if (byLayer_)
102  gran *= layerLabel(detid);
103  if (byModule_)
104  gran *= moduleLabel(detid);
105  if (localYbin_)
106  gran += (localy < 0 ? "_yM" : "_yP") + std::to_string(abs((int)(localy / localYbin_ + (localy < 0 ? -1 : 0))));
107  if (stripsPerBin_)
108  gran += "_strip" +
109  std::to_string(
110  (unsigned)((0.5 + ((apvstrip / 64) ? (127 - apvstrip) : apvstrip) / stripsPerBin_) * stripsPerBin_));
111  if (ensembleBins_) {
112  gran +=
113  "_ensembleBin" + std::to_string((int)(ensembleBins_ * (tthetaL - ensembleLow_) / (ensembleUp_ - ensembleLow_)));
114  gran += "";
115  if (ensembleSize_)
116  gran *= "_sample" + std::to_string(TFE_index % ensembleSize_);
117  }
118  return gran;
119 }

References funct::abs(), byLayer_, byModule_, ensembleBins_, ensembleLow_, ensembleSize_, ensembleUp_, layerLabel(), localYbin_, moduleLabel(), stripsPerBin_, and subdetLabel().

Referenced by fill().

◆ layer_index()

static unsigned LA_Filler_Fitter::layer_index ( bool  TIB,
bool  stereo,
unsigned  layer 
)
inlinestatic

Definition at line 105 of file LA_Filler_Fitter.h.

105  {
106  return layer + (TIB ? 0 : 6) + (stereo ? 1 : 0) + ((layer > 2) ? 1 : (layer == 1) ? -1 : 0);
107  }

References phase1PixelTopology::layer, and SectorBuilder_Tib_cff::TIB.

Referenced by sistrip::MeasureLA::calibration_key(), and sistrip::EnsembleCalibrationLA::write_ensembles_text().

◆ layer_results()

std::map< std::string, LA_Filler_Fitter::Result > LA_Filler_Fitter::layer_results ( const Book book,
const Method  m 
)
static

Definition at line 70 of file LA_Results.cc.

70  {
71  std::map<std::string, Result> results;
72  for (Book::const_iterator it = book.begin(".*layer\\d.*" + method(m)); it != book.end(); ++it) {
73  const std::string name = boost::erase_all_copy(it->first, method(m));
74  results[name] = result(m, it->first, book);
75  }
76  return results;
77 }

References Book::begin(), Book::end(), visualization-live-secondInstance_cfg::m, method(), Skims_PA_cff::name, result(), bookConverter::results, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by sistrip::MeasureLA::process_reports().

◆ layerLabel()

std::string LA_Filler_Fitter::layerLabel ( const SiStripDetId  detid) const

Definition at line 127 of file LA_Filler.cc.

127  {
128  const bool isTIB = detid.subdetId() == StripSubdetector::TIB;
129  unsigned layer = isTIB ? tTopo_->tibLayer(detid) : tTopo_->tobLayer(detid);
130  bool stereo = isTIB ? tTopo_->tibStereo(detid) : tTopo_->tobStereo(detid);
131 
132  return subdetLabel(detid) + "_layer" + std::to_string(layer) + (stereo ? "s" : "a");
133 }

References phase1PixelTopology::layer, DetId::subdetId(), subdetLabel(), StripSubdetector::TIB, TrackerTopology::tibLayer(), TrackerTopology::tibStereo(), TrackerTopology::tobLayer(), TrackerTopology::tobStereo(), and tTopo_.

Referenced by granularity(), and sistrip::MeasureLA::summarize_module_muH_byLayer().

◆ make_and_fit_symmchi2()

void LA_Filler_Fitter::make_and_fit_symmchi2 ( Book book)
static

Definition at line 40 of file LA_Fitter.cc.

40  {
41  for (Book::iterator it = book.begin(".*_all"); it != book.end(); ++it) {
42  const std::string base = boost::erase_all_copy(it->first, "_all");
43 
44  std::vector<Book::iterator> rebin_hists;
45  const Book::iterator& all = it;
46  rebin_hists.push_back(all);
47  Book::iterator w1 = book.find(base + "_w1");
48  rebin_hists.push_back(w1);
49  Book::iterator var_w2 = book.find(base + method(AVGV2, false));
50  rebin_hists.push_back(var_w2);
51  Book::iterator var_w3 = book.find(base + method(AVGV3, false));
52  rebin_hists.push_back(var_w3);
53 
54  const unsigned rebin = std::max(var_w2 == book.end() ? 0 : find_rebin(var_w2->second),
55  var_w3 == book.end() ? 0 : find_rebin(var_w3->second));
56  for (const auto& it : rebin_hists)
57  if (it != book.end())
58  it->second->Rebin(rebin > 1 ? rebin < 7 ? rebin : 6 : 1);
59 
60  TH1* const prob_w1 =
61  w1 == book.end() ? nullptr : subset_probability(base + method(PROB1, false), w1->second, all->second);
62  TH1* const rmsv_w2 =
63  var_w2 == book.end() ? nullptr : rms_profile(base + method(RMSV2, false), (TProfile* const)var_w2->second);
64  TH1* const rmsv_w3 =
65  var_w3 == book.end() ? nullptr : rms_profile(base + method(RMSV3, false), (TProfile* const)var_w3->second);
66 
67  std::vector<TH1*> fit_hists;
68  if (prob_w1) {
69  book.book(base + method(PROB1, false), prob_w1);
70  fit_hists.push_back(prob_w1);
71  prob_w1->SetTitle("Width==1 Probability;tan#theta_{t}-(dx/dz)_{reco}");
72  }
73  if (var_w2 != book.end()) {
74  book.book(base + method(RMSV2, false), rmsv_w2);
75  fit_hists.push_back(var_w2->second);
76  var_w2->second->SetTitle("Width==2 Mean Variance;tan#theta_{t}-(dx/dz)_{reco}");
77  fit_hists.push_back(rmsv_w2);
78  rmsv_w2->SetTitle("Width==2 RMS Variance;tan#theta_{t}-(dx/dz)_{reco}");
79  }
80  if (var_w3 != book.end()) {
81  book.book(base + method(RMSV3, false), rmsv_w3);
82  fit_hists.push_back(var_w3->second);
83  var_w3->second->SetTitle("Width==3 Mean Variance;tan#theta_{t}-(dx/dz)_{reco}");
84  fit_hists.push_back(rmsv_w3);
85  rmsv_w3->SetTitle("Width==3 RMS Variance;tan#theta_{t}-(dx/dz)_{reco}");
86  }
87 
88  if (fit_hists.empty())
89  continue;
90  const unsigned bins = fit_hists[0]->GetNbinsX();
91  const unsigned guess = fit_hists[0]->FindBin(0);
92  const std::pair<unsigned, unsigned> range(guess - bins / 30, guess + bins / 30);
93 
94  for (auto const& hist : fit_hists) {
96  if (chi2) {
97  book.book(chi2->GetName(), chi2);
98  chi2->SetTitle("Symmetry #chi^{2};tan#theta_{t}-(dx/dz)_{reco}");
99  }
100  }
101  }
102 }

References python.cmstools::all(), AVGV2, AVGV3, newFWLiteAna::base, Book::begin(), trigObjTnPSource_cfi::bins, Book::book(), hltPixelTracks_cff::chi2, Book::end(), Book::find(), find_rebin(), mps_check::guess, gpuVertexFinder::hist, SiStripPI::max, method(), PROB1, FastTimerService_cff::range, rms_profile(), RMSV2, RMSV3, AlCaHLTBitMon_QueryRunRegistry::string, subset_probability(), and SymmetryFit::symmetryChi2().

Referenced by fit().

◆ method()

static std::string LA_Filler_Fitter::method ( Method  m,
bool  fit = true 
)
inlinestatic

Definition at line 61 of file LA_Filler_Fitter.h.

61  {
62  switch (m) {
63  case WIDTH:
64  return "_width_prof";
65  case PROB1:
66  return fit ? SymmetryFit::name(method(m, false)) : "_prob_w1";
67  case AVGV2:
68  return fit ? SymmetryFit::name(method(m, false)) : "_avg_var_w2";
69  case AVGV3:
70  return fit ? SymmetryFit::name(method(m, false)) : "_avg_var_w3";
71  case RMSV2:
72  return fit ? SymmetryFit::name(method(m, false)) : "_rms_var_w2";
73  case RMSV3:
74  return fit ? SymmetryFit::name(method(m, false)) : "_rms_var_w3";
75  default:
76  return "_UNKNOWN";
77  }
78  }

References AVGV2, AVGV3, visualization-live-secondInstance_cfg::m, SymmetryFit::name(), PROB1, RMSV2, RMSV3, and WIDTH.

Referenced by ensemble_results(), fill_one_cluster(), fit_width_profile(), layer_results(), make_and_fit_symmchi2(), module_results(), result(), sistrip::MeasureLA::summarize_module_muH_byLayer(), varWidth(), sistrip::MeasureLA::write_report_plots(), and sistrip::MeasureLA::write_report_text_ms().

◆ module_results()

std::map< uint32_t, LA_Filler_Fitter::Result > LA_Filler_Fitter::module_results ( const Book book,
const Method  m 
)
static

Definition at line 60 of file LA_Results.cc.

60  {
61  std::map<uint32_t, Result> results;
62  for (Book::const_iterator it = book.begin(".*_module\\d*" + method(m)); it != book.end(); ++it) {
63  const uint32_t detid = boost::lexical_cast<uint32_t>(
64  std::regex_replace(it->first, std::regex(".*_module(\\d*)_.*"), std::string("\\1")));
65  results[detid] = result(m, it->first, book);
66  }
67  return results;
68 }

References Book::begin(), Book::end(), visualization-live-secondInstance_cfg::m, method(), result(), bookConverter::results, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by sistrip::MeasureLA::process_reports(), and sistrip::MeasureLA::summarize_module_muH_byLayer().

◆ moduleLabel()

std::string LA_Filler_Fitter::moduleLabel ( const SiStripDetId  detid)
static

Definition at line 124 of file LA_Filler.cc.

124  {
125  return subdetLabel(detid) + "_module" + std::to_string(detid());
126 }

References subdetLabel().

Referenced by granularity().

◆ offset_slope()

std::pair< std::pair< float, float >, std::pair< float, float > > LA_Filler_Fitter::offset_slope ( const std::vector< EnsembleSummary > &  ensembles)
static

Definition at line 144 of file LA_Results.cc.

145  {
146  try {
147  std::vector<float> x, y, xerr, yerr;
148  for (auto const& ensemble : ensembles) {
149  x.push_back(ensemble.truth);
150  xerr.push_back(0);
151  y.push_back(ensemble.meanMeasured.first);
152  yerr.push_back(ensemble.meanMeasured.second);
153  }
154  TGraphErrors graph(x.size(), &(x[0]), &(y[0]), &(xerr[0]), &(yerr[0]));
155  //Need our own copy for thread safety
156  TF1 pol1("mypol1", "pol1");
157  graph.Fit(&pol1);
158  const TF1* const fit = graph.GetFunction("pol1");
159 
160  return std::make_pair(std::make_pair(fit->GetParameter(0), fit->GetParError(0)),
161  std::make_pair(fit->GetParameter(1), fit->GetParError(1)));
162  } catch (edm::Exception const& e) {
163  std::cerr << "Fitting Line Failed " << std::endl << e << std::endl;
164  return std::make_pair(std::make_pair(0, 0), std::make_pair(0, 0));
165  }
166 }

References EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0::cerr, MillePedeFileConverter_cfg::e, x, and y.

Referenced by sistrip::EnsembleCalibrationLA::write_ensembles_text().

◆ pull()

float LA_Filler_Fitter::pull ( const std::vector< EnsembleSummary > &  ensembles)
static

Definition at line 168 of file LA_Results.cc.

168  {
169  float p(0), w(0);
170  for (auto const& ensemble : ensembles) {
171  const float unc2 = pow(ensemble.pull.second, 2);
172  p += ensemble.pull.first / unc2;
173  w += 1 / unc2;
174  }
175  return p / w;
176 }

References AlCaHLTBitMon_ParallelJobs::p, funct::pow(), and w.

Referenced by ensemble_summary(), and sistrip::EnsembleCalibrationLA::write_ensembles_text().

◆ result()

LA_Filler_Fitter::Result LA_Filler_Fitter::result ( Method  m,
const std::string  name,
const Book book 
)
static

Definition at line 12 of file LA_Results.cc.

12  {
13  Result p;
14  const std::string base = boost::erase_all_copy(name, method(m));
15 
16  const TH1* const h = book[name];
17  const TH1* const reco = book[base + "_reconstruction"];
18  const TH1* const field = book[base + "_field"];
19 
20  if (reco)
21  p.reco = std::make_pair<float, float>(reco->GetMean(), reco->GetMeanError());
22  if (field)
23  p.field = field->GetMean();
24  if (h) {
25  switch (m) {
26  case WIDTH: {
27  const TF1* const f = h->GetFunction("LA_profile_fit");
28  if (!f)
29  break;
30  p.measured = std::make_pair<float, float>(f->GetParameter(0), f->GetParError(0));
31  p.chi2 = f->GetChisquare();
32  p.ndof = f->GetNDF();
33  p.entries = (unsigned)(h->GetEntries());
34  break;
35  }
36  case PROB1:
37  case AVGV2:
38  case AVGV3:
39  case RMSV2:
40  case RMSV3: /*case MULTI:*/ {
41  const TF1* const f = h->GetFunction("SymmetryFit");
42  if (!f)
43  break;
44  p.measured = std::make_pair<float, float>(p.reco.first + f->GetParameter(0), f->GetParameter(1));
45  p.chi2 = f->GetParameter(2);
46  p.ndof = (unsigned)(f->GetParameter(3));
47  p.entries = (m & PROB1) ? (unsigned)book[base + "_w1"]->GetEntries()
48  : (m & (AVGV2 | RMSV2)) ? (unsigned)book[base + method(AVGV2, false)]->GetEntries()
49  : (m & (AVGV3 | RMSV3)) ? (unsigned)book[base + method(AVGV3, false)]->GetEntries()
50  : 0;
51  break;
52  }
53  default:
54  break;
55  }
56  }
57  return p;
58 }

References AVGV2, AVGV3, newFWLiteAna::base, f, visualization-live-secondInstance_cfg::m, method(), Skims_PA_cff::name, AlCaHLTBitMon_ParallelJobs::p, PROB1, RMSV2, RMSV3, AlCaHLTBitMon_QueryRunRegistry::string, and WIDTH.

Referenced by ensemble_results(), layer_results(), and module_results().

◆ rms_profile()

TH1 * LA_Filler_Fitter::rms_profile ( const std::string  name,
const TProfile * const  prof 
)
static

Definition at line 121 of file LA_Fitter.cc.

121  {
122  const int bins = prof->GetNbinsX();
123  TH1* const rms =
124  new TH1F(name.c_str(), "", bins, prof->GetBinLowEdge(1), prof->GetBinLowEdge(bins) + prof->GetBinWidth(bins));
125  for (int i = 1; i <= bins; i++) {
126  const double Me = prof->GetBinError(i);
127  const double neff = prof->GetBinEntries(
128  i); //Should be prof->GetBinEffectiveEntries(i);, not availible this version ROOT. This is only ok for unweighted fills
129  rms->SetBinContent(i, Me * sqrt(neff));
130  rms->SetBinError(i, Me / sqrt(2));
131  }
132  return rms;
133 }

References trigObjTnPSource_cfi::bins, mps_fire::i, Skims_PA_cff::name, SiStripPI::rms, and mathSSE::sqrt().

Referenced by make_and_fit_symmchi2().

◆ subdetLabel()

std::string LA_Filler_Fitter::subdetLabel ( const SiStripDetId  detid)
static

Definition at line 121 of file LA_Filler.cc.

121  {
122  return detid.subDetector() == SiStripDetId::TOB ? "TOB" : "TIB";
123 }

References SiStripDetId::subDetector(), and SiStripDetId::TOB.

Referenced by granularity(), layerLabel(), and moduleLabel().

◆ subset_probability()

TH1 * LA_Filler_Fitter::subset_probability ( const std::string  name,
const TH1 * const  subset,
const TH1 * const  total 
)
static

Definition at line 135 of file LA_Fitter.cc.

135  {
136  const int bins = subset->GetNbinsX();
137  TH1* const prob = new TH1F(
138  name.c_str(), "", bins, subset->GetBinLowEdge(1), subset->GetBinLowEdge(bins) + subset->GetBinWidth(bins));
139  for (int i = 1; i <= bins; i++) {
140  const double s = subset->GetBinContent(i);
141  const double T = total->GetBinContent(i);
142  const double B = T - s;
143 
144  const double p = T ? s / T : 0;
145  const double perr = T ? ((s && B) ? sqrt(s * s * B + B * B * s) / (T * T) : 1 / T) : 0;
146 
147  prob->SetBinContent(i, p);
148  prob->SetBinError(i, perr);
149  }
150  return prob;
151 }

References TtFullHadDaughter::B, trigObjTnPSource_cfi::bins, mps_fire::i, Skims_PA_cff::name, AlCaHLTBitMon_ParallelJobs::p, TtFullHadEvtBuilder_cfi::prob, alignCSCRings::s, mathSSE::sqrt(), and dqmMemoryStats::total.

Referenced by make_and_fit_symmchi2().

◆ summarize_ensembles()

void LA_Filler_Fitter::summarize_ensembles ( Book book) const

Definition at line 89 of file LA_Results.cc.

89  {
90  typedef std::map<std::string, std::vector<Result> > results_t;
91  results_t results;
92  for (int m = FIRST_METHOD; m <= LAST_METHOD; m <<= 1)
93  if (methods_ & m) {
94  results_t g = ensemble_results(book, (Method)(m));
95  results.insert(g.begin(), g.end());
96  }
97 
98  for (auto const& group : results) {
99  const std::string name = group.first;
100  for (auto const& p : group.second) {
101  const float pad = (ensembleUp_ - ensembleLow_) / 10;
102  book.fill(p.reco.first, name + "_ensembleReco", 12 * ensembleBins_, ensembleLow_ - pad, ensembleUp_ + pad);
103  book.fill(p.measured.first, name + "_measure", 12 * ensembleBins_, ensembleLow_ - pad, ensembleUp_ + pad);
104  book.fill(p.measured.second, name + "_merr", 500, 0, 0.01);
105  book.fill((p.measured.first - p.reco.first) / p.measured.second, name + "_pull", 500, -10, 10);
106  }
107  //Need our own copy for thread safety
108  TF1 gaus("mygaus", "gaus");
109  book[name + "_measure"]->Fit(&gaus, "LLQ");
110  book[name + "_merr"]->Fit(&gaus, "LLQ");
111  book[name + "_pull"]->Fit(&gaus, "LLQ");
112  }
113 }

References ensemble_results(), ensembleBins_, ensembleLow_, ensembleUp_, Book::fill(), FIRST_METHOD, g, watchdog::group, LAST_METHOD, visualization-live-secondInstance_cfg::m, methods_, Skims_PA_cff::name, AlCaHLTBitMon_ParallelJobs::p, bookConverter::results, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by sistrip::EnsembleCalibrationLA::endJob().

◆ varWidth()

poly< std::string > LA_Filler_Fitter::varWidth ( const unsigned  width) const

Definition at line 84 of file LA_Filler.cc.

84  {
86  vw++;
87  if (width == 2 && methods_ & (AVGV2 | RMSV2))
88  vw *= method(AVGV2, false);
89  if (width == 3 && methods_ & (AVGV3 | RMSV3))
90  vw *= method(AVGV3, false);
91  return vw;
92 }

References AVGV2, AVGV3, method(), methods_, RMSV2, RMSV3, and ApeEstimator_cff::width.

Referenced by fill_one_cluster().

Member Data Documentation

◆ byLayer_

const bool LA_Filler_Fitter::byLayer_
private

Definition at line 133 of file LA_Filler_Fitter.h.

Referenced by granularity().

◆ byModule_

const bool LA_Filler_Fitter::byModule_
private

Definition at line 133 of file LA_Filler_Fitter.h.

Referenced by granularity().

◆ ensembleBins_

const int LA_Filler_Fitter::ensembleBins_
private

Definition at line 131 of file LA_Filler_Fitter.h.

Referenced by fill(), fill_one_cluster(), granularity(), and summarize_ensembles().

◆ ensembleLow_

const double LA_Filler_Fitter::ensembleLow_
private

Definition at line 132 of file LA_Filler_Fitter.h.

Referenced by granularity(), and summarize_ensembles().

◆ ensembleSize_

const int LA_Filler_Fitter::ensembleSize_
private

Definition at line 131 of file LA_Filler_Fitter.h.

Referenced by granularity().

◆ ensembleUp_

const double LA_Filler_Fitter::ensembleUp_
private

Definition at line 132 of file LA_Filler_Fitter.h.

Referenced by granularity(), and summarize_ensembles().

◆ localYbin_

const float LA_Filler_Fitter::localYbin_
private

Definition at line 134 of file LA_Filler_Fitter.h.

Referenced by fill(), and granularity().

◆ maxEvents_

const Long64_t LA_Filler_Fitter::maxEvents_
private

Definition at line 136 of file LA_Filler_Fitter.h.

Referenced by fill().

◆ methods_

const int LA_Filler_Fitter::methods_
private

Definition at line 137 of file LA_Filler_Fitter.h.

Referenced by fill_one_cluster(), summarize_ensembles(), and varWidth().

◆ stripsPerBin_

const unsigned LA_Filler_Fitter::stripsPerBin_
private

Definition at line 135 of file LA_Filler_Fitter.h.

Referenced by fill(), and granularity().

◆ tTopo_

const TrackerTopology* LA_Filler_Fitter::tTopo_
private

Definition at line 138 of file LA_Filler_Fitter.h.

Referenced by layerLabel().

LA_Filler_Fitter::Method
Method
Definition: LA_Filler_Fitter.h:50
LA_Filler_Fitter::ensembleSize_
const int ensembleSize_
Definition: LA_Filler_Fitter.h:131
SectorBuilder_Tib_cff.TIB
TIB
Definition: SectorBuilder_Tib_cff.py:16
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
DDAxes::y
ApeEstimator_cff.width
width
Definition: ApeEstimator_cff.py:24
mps_fire.i
i
Definition: mps_fire.py:428
SiStripPI::mean
Definition: SiStripPayloadInspectorHelper.h:169
LA_Filler_Fitter::find_rebin
static unsigned find_rebin(const TH1 *const)
Definition: LA_Fitter.cc:104
LA_Filler_Fitter::PROB1
Definition: LA_Filler_Fitter.h:53
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
LA_Filler_Fitter::methods_
const int methods_
Definition: LA_Filler_Fitter.h:137
min
T min(T a, T b)
Definition: MathUtil.h:58
LA_Filler_Fitter::byModule_
const bool byModule_
Definition: LA_Filler_Fitter.h:133
tree
Definition: tree.py:1
LA_Filler_Fitter::rms_profile
static TH1 * rms_profile(const std::string, const TProfile *const)
Definition: LA_Fitter.cc:121
edm::swap
void swap(Association< C > &lhs, Association< C > &rhs)
Definition: Association.h:117
LA_Filler_Fitter::allAndOne
poly< std::string > allAndOne(const unsigned width) const
Definition: LA_Filler.cc:77
LA_Filler_Fitter::tTopo_
const TrackerTopology * tTopo_
Definition: LA_Filler_Fitter.h:138
Book::const_iterator
boost::filter_iterator< match_name, book_t::const_iterator > const_iterator
Definition: Book.h:56
Validation_hcalonly_cfi.sign
sign
Definition: Validation_hcalonly_cfi.py:32
bookConverter.results
results
Definition: bookConverter.py:144
Book::book
TH1 * book(string_t name, TH1 *const hist)
Definition: Book.h:42
DDAxes::x
SymmetryFit::name
static std::string name(std::string base)
Definition: SymmetryFit.h:12
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:46
hltPixelTracks_cff.chi2
chi2
Definition: hltPixelTracks_cff.py:25
SiStripPI::rms
Definition: SiStripPayloadInspectorHelper.h:169
python.cmstools.all
def all(container)
workaround iterator generators for ROOT classes
Definition: cmstools.py:25
TrackerTopology::tobStereo
uint32_t tobStereo(const DetId &id) const
Definition: TrackerTopology.h:275
edm::Exception
Definition: EDMException.h:77
LA_Filler_Fitter::AVGV2
Definition: LA_Filler_Fitter.h:54
LA_Filler_Fitter::subdetLabel
static std::string subdetLabel(const SiStripDetId)
Definition: LA_Filler.cc:121
LA_Filler_Fitter::layerLabel
std::string layerLabel(const SiStripDetId) const
Definition: LA_Filler.cc:127
LA_Filler_Fitter::fill_one_cluster
void fill_one_cluster(Book &, const poly< std::string > &, const unsigned, const float, const float, const float, const float) const
Definition: LA_Filler.cc:59
alignCSCRings.s
s
Definition: alignCSCRings.py:92
LA_Filler_Fitter::RMSV3
Definition: LA_Filler_Fitter.h:57
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
SymmetryFit::symmetryChi2
static TH1 * symmetryChi2(std::string, const std::vector< TH1 * > &, const std::pair< unsigned, unsigned >)
Definition: SymmetryFit.cc:6
w
const double w
Definition: UKUtility.cc:23
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:79
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
LA_Filler_Fitter::byLayer_
const bool byLayer_
Definition: LA_Filler_Fitter.h:133
mps_fire.end
end
Definition: mps_fire.py:242
LA_Filler_Fitter::method
static std::string method(Method m, bool fit=true)
Definition: LA_Filler_Fitter.h:61
N
#define N
Definition: blowfish.cc:9
LA_Filler_Fitter::varWidth
poly< std::string > varWidth(const unsigned width) const
Definition: LA_Filler.cc:84
Book::end
iterator end(string_t re=".*")
Definition: Book.h:65
LA_Filler_Fitter::ensembleBins_
const int ensembleBins_
Definition: LA_Filler_Fitter.h:131
StripSubdetector::TIB
static constexpr auto TIB
Definition: StripSubdetector.h:16
LA_Filler_Fitter::WIDTH
Definition: LA_Filler_Fitter.h:51
LA_Filler_Fitter::ensemble_results
static std::map< std::string, std::vector< Result > > ensemble_results(const Book &, const Method)
Definition: LA_Results.cc:79
h
LA_Filler_Fitter::moduleLabel
static std::string moduleLabel(const SiStripDetId)
Definition: LA_Filler.cc:124
Book::find
iterator find(string_t name, string_t re=".*")
Definition: Book.h:73
Book::erase
void erase(string_t name)
Definition: Book.h:84
DetId::subdetId
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum)
Definition: DetId.h:48
phase1PixelTopology::layer
constexpr std::array< uint8_t, layerIndexSize > layer
Definition: phase1PixelTopology.h:99
LA_Filler_Fitter::LAST_METHOD
Definition: LA_Filler_Fitter.h:58
TrackerTopology::tibStereo
uint32_t tibStereo(const DetId &id) const
Definition: TrackerTopology.h:279
LA_Filler_Fitter::ensembleUp_
const double ensembleUp_
Definition: LA_Filler_Fitter.h:132
Book::fill
void fill(double_t X, const char *name, uint_t NbinsX, double_t Xlow, double_t Xup, double_t W=1)
Definition: Book.h:96
LA_Filler_Fitter::make_and_fit_symmchi2
static void make_and_fit_symmchi2(Book &)
Definition: LA_Fitter.cc:40
AlCaHLTBitMon_ParallelJobs.p
def p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
gpuVertexFinder::hist
__shared__ Hist hist
Definition: gpuClusterTracksDBSCAN.h:48
funct::tan
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
LA_Filler_Fitter::stripsPerBin_
const unsigned stripsPerBin_
Definition: LA_Filler_Fitter.h:135
edmLumisInFiles.summary
summary
Definition: edmLumisInFiles.py:39
LA_Filler_Fitter::subset_probability
static TH1 * subset_probability(const std::string name, const TH1 *const, const TH1 *const)
Definition: LA_Fitter.cc:135
SiStripDetId::TOB
static constexpr auto TOB
Definition: SiStripDetId.h:39
LA_Filler_Fitter::pull
static float pull(const std::vector< EnsembleSummary > &)
Definition: LA_Results.cc:168
LA_Filler_Fitter::granularity
poly< std::string > granularity(const SiStripDetId, const float, const Long64_t, const float, const unsigned) const
Definition: LA_Filler.cc:94
LA_Filler_Fitter::AVGV3
Definition: LA_Filler_Fitter.h:55
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
Book::iterator
boost::filter_iterator< match_name, book_t::iterator > iterator
Definition: Book.h:55
callgraph.module
module
Definition: callgraph.py:61
LA_Filler_Fitter::ensembleLow_
const double ensembleLow_
Definition: LA_Filler_Fitter.h:132
Book::begin
iterator begin(string_t re=".*")
Definition: Book.h:57
TtFullHadDaughter::B
static const std::string B
Definition: TtFullHadronicEvent.h:9
TrackerTopology::tobLayer
unsigned int tobLayer(const DetId &id) const
Definition: TrackerTopology.h:147
poly
Definition: poly.h:11
T
long double T
Definition: Basic3DVectorLD.h:48
LA_Filler_Fitter::fit_width_profile
static void fit_width_profile(Book &)
Definition: LA_Fitter.cc:8
LA_Filler_Fitter::maxEvents_
const Long64_t maxEvents_
Definition: LA_Filler_Fitter.h:136
SiStripDetId::subDetector
SubDetector subDetector() const
Definition: SiStripDetId.h:105
LA_Filler_Fitter::result
static Result result(Method, const std::string name, const Book &)
Definition: LA_Results.cc:12
SiStripDetId::TIB
static constexpr auto TIB
Definition: SiStripDetId.h:37
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
LA_Filler_Fitter::RMSV2
Definition: LA_Filler_Fitter.h:56
dqmMemoryStats.total
total
Definition: dqmMemoryStats.py:152
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
trigObjTnPSource_cfi.bins
bins
Definition: trigObjTnPSource_cfi.py:20
mps_check.guess
string guess
Definition: mps_check.py:394
SiStripDetId
Detector identifier class for the strip tracker.
Definition: SiStripDetId.h:18
LA_Filler_Fitter::FIRST_METHOD
Definition: LA_Filler_Fitter.h:52
newFWLiteAna.base
base
Definition: newFWLiteAna.py:92
EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.cerr
cerr
Definition: EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.py:8
TtFullHadEvtBuilder_cfi.prob
prob
Definition: TtFullHadEvtBuilder_cfi.py:33
LaserClient_cfi.low
low
Definition: LaserClient_cfi.py:52
fit
Definition: CombinedChiSquaredLikelihood.h:6
up
Definition: BitonicSort.h:7
LA_Filler_Fitter::localYbin_
const float localYbin_
Definition: LA_Filler_Fitter.h:134
g
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
TrackerTopology::tibLayer
unsigned int tibLayer(const DetId &id) const
Definition: TrackerTopology.h:150
watchdog.group
group
Definition: watchdog.py:82