CMS 3D CMS Logo

Classes | Typedefs | Enumerations | Functions | Variables
PVValHelper Namespace Reference

Classes

struct  histodetails
 

Typedefs

typedef std::tuple< std::string, std::string, std::string > plotLabels
 

Enumerations

enum  detectorPhase { phase0 = 0, phase1 = 1, phase2 = 2, END_OF_PHASES = 3 }
 
enum  estimator {
  MEAN = 1, WIDTH = 2, MEDIAN = 3, MAD = 4,
  UNKWN = -1
}
 
enum  plotVariable {
  phi = 1, eta = 2, pT = 3, pTCentral = 4,
  ladder = 5, modZ = 6, END_OF_PLOTS = 7
}
 
enum  residualType {
  dxy = 1, dx = 2, dy = 3, dz = 4,
  IP2D = 5, resz = 6, IP3D = 7, d3D = 8,
  norm_dxy = 9, norm_dx = 10, norm_dy = 11, norm_dz = 12,
  norm_IP2D = 13, norm_resz = 14, norm_IP3D = 15, norm_d3D = 16,
  END_OF_TYPES = 17
}
 

Functions

void add (std::map< std::string, TH1 *> &h, TH1 *hist)
 
void fill (std::map< std::string, TH1 *> &h, const std::string &s, double x)
 
void fill (std::map< std::string, TH1 *> &h, const std::string &s, double x, double y)
 
void fillByIndex (std::vector< TH1F *> &h, unsigned int index, double x, std::string tag="")
 
std::pair< Measurement1D, Measurement1DfitResiduals (TH1 *hist)
 
std::vector< float > generateBins (int n, float start, float range)
 
Measurement1D getMAD (TH1F *histo)
 
Measurement1D getMedian (TH1F *histo)
 
plotLabels getTypeString (residualType type)
 
plotLabels getVarString (plotVariable var)
 
template<typename T , size_t N>
std::array< T, N+1 > makeLogBins (const T &min, const T &max)
 
void shrinkHistVectorToFit (std::vector< TH1F *> &h, unsigned int desired_size)
 

Variables

constexpr double max_eta_phase0 = 2.5
 
constexpr double max_eta_phase1 = 2.7
 
constexpr double max_eta_phase2 = 4.0
 

Typedef Documentation

◆ plotLabels

typedef std::tuple<std::string, std::string, std::string> PVValHelper::plotLabels

Definition at line 123 of file PVValidationHelpers.h.

Enumeration Type Documentation

◆ detectorPhase

Enumerator
phase0 
phase1 
phase2 
END_OF_PHASES 

Definition at line 78 of file PVValidationHelpers.h.

◆ estimator

Enumerator
MEAN 
WIDTH 
MEDIAN 
MAD 
UNKWN 

Definition at line 45 of file PVValidationHelpers.h.

◆ plotVariable

Enumerator
phi 
eta 
pT 
pTCentral 
ladder 
modZ 
END_OF_PLOTS 

Definition at line 68 of file PVValidationHelpers.h.

◆ residualType

Enumerator
dxy 
dx 
dy 
dz 
IP2D 
resz 
IP3D 
d3D 
norm_dxy 
norm_dx 
norm_dy 
norm_dz 
norm_IP2D 
norm_resz 
norm_IP3D 
norm_d3D 
END_OF_TYPES 

Definition at line 47 of file PVValidationHelpers.h.

Function Documentation

◆ add()

void PVValHelper::add ( std::map< std::string, TH1 *> &  h,
TH1 *  hist 
)

Definition at line 12 of file PVValidationHelpers.cc.

References h, and gpuVertexFinder::hist.

Referenced by helpers.CloneTaskVisitor::__appendToTopTask(), Options.Options::__getitem__(), SequenceTypes._ModuleSequenceType::_replaceIfHeldDirectly(), SequenceTypes.Schedule::_replaceIfHeldDirectly(), LHCInfoPopConSourceHandler::addEmptyPayload(), custom_jme_cff::AddJetID(), custom_jme_cff::AddPileUpJetIDVars(), custom_jme_cff::AddQGLTaggerVars(), Config.ProcessModifier::apply(), SequenceTypes._ModuleSequenceType::associate(), objects.VertexAnalyzer.VertexAnalyzer::beginLoop(), core.PileUpAnalyzer.PileUpAnalyzer::beginLoop(), CosmicHitPairGenerator::CosmicHitPairGenerator(), CosmicHitTripletGenerator::CosmicHitTripletGenerator(), o2olib.O2OTool::create(), edmStreamStallGrapher::createPDFImage(), evf::FastMonEncoding::encode(), evf::FastMonEncoding::encodeString(), SequenceVisitors.NodeVisitor::enter(), helpers.CloneSequenceVisitor::enter(), SequenceTypes.NodeNameVisitor::enter(), BPHWriteSpecificDecay::fill(), Phase2ITValidateCluster::fillITHistos(), Phase2OTValidateCluster::fillOTHistos(), evf::FastMonEncoding::fillReserved(), TrackerMap::find_layer(), symbols::get_libraries(), python.rootplot.core::get_plot_inputs(), symbols::get_symbols(), L1TPhase2CorrelatorOffline::getQuantile(), L1GctHfBitCountsLut::getThresholdsGct(), PixelForwardLayer::groupedCompatibleDetsV(), PixelForwardLayerPhase1::groupedCompatibleDetsV(), TIBRing::groupedCompatibleDetsV(), MillePedeVariables::increaseHitsX(), MillePedeVariables::increaseHitsY(), CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon::Merge(), edmTracerLogToSimpleConfig.PathParser::parse(), edmTracerLogToSimpleConfig.ConsumesParser::parse(), python.rootplot.core::plot_hists_mpl(), L1GctLut< 16, 12 >::printLine(), core.JSONAnalyzer.JSONAnalyzer::process(), objects.VertexAnalyzer.VertexAnalyzer::process(), core.PileUpAnalyzer.PileUpAnalyzer::process(), TIBLayer::searchNeighbors(), TECLayer::searchNeighbors(), CompositeTECWedge::searchNeighbors(), PixelForwardLayer::searchNeighbors(), PixelForwardLayerPhase1::searchNeighbors(), Phase2EndcapSingleRing::searchNeighbors(), TIDRing::searchNeighbors(), TOBRod::searchNeighbors(), Phase2EndcapRing::searchNeighbors(), TBPLayer::searchNeighbors(), PixelBlade::searchNeighbors(), Phase2OTBarrelRod::searchNeighbors(), Phase1PixelBlade::searchNeighbors(), TIBRing::searchNeighbors(), CompositeTECPetal::searchNeighbors(), MatrixReader.MatrixReader::showRaw(), conddb_migrate::tags_in_gts(), LHCInfoImpl::transferPayloads(), evf::FastMonEncoding::update(), evf::FastMonEncoding::updatePreinit(), evf::FastMonEncoding::updateReserved(), and querying.connection::write().

14 {
15  h[hist->GetName()] = hist;
16  hist->StatOverflows(kTRUE);
17 }
__shared__ Hist hist
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4

◆ fill() [1/2]

void PVValHelper::fill ( std::map< std::string, TH1 *> &  h,
const std::string &  s,
double  x 
)

Definition at line 20 of file PVValidationHelpers.cc.

References h, alignCSCRings::s, and x.

Referenced by PrimaryVertexValidation::fillTrackHistos().

22 {
23  if (h.count(s) == 0) {
24  edm::LogWarning("PVValidationHelpers") << "Trying to fill non-existing Histogram named " << s << std::endl;
25  return;
26  }
27  h[s]->Fill(x);
28 }
float x
Log< level::Warning, false > LogWarning
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4

◆ fill() [2/2]

void PVValHelper::fill ( std::map< std::string, TH1 *> &  h,
const std::string &  s,
double  x,
double  y 
)

Definition at line 31 of file PVValidationHelpers.cc.

References h, alignCSCRings::s, x, and detailsBasic3DVector::y.

33 {
34  if (h.count(s) == 0) {
35  edm::LogWarning("PVValidationHelpers") << "Trying to fill non-existing Histogram named " << s << std::endl;
36  return;
37  }
38  h[s]->Fill(x, y);
39 }
float x
Log< level::Warning, false > LogWarning
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4

◆ fillByIndex()

void PVValHelper::fillByIndex ( std::vector< TH1F *> &  h,
unsigned int  index,
double  x,
std::string  tag = "" 
)

Definition at line 42 of file PVValidationHelpers.cc.

References cms::cuda::assert(), h, makeGlobalPositionRcd_cfg::tag, and x.

Referenced by PrimaryVertexValidation::analyze(), SplitVertexResolution::analyze(), and DMRChecker::analyze().

44 {
45  assert(!h.empty());
46  if (index < h.size()) {
47  h[index]->Fill(x);
48  } else {
49  edm::LogWarning("PVValidationHelpers") << "Trying to fill non-existing Histogram with index " << index
50  << " for array with size: " << h.size() << " tag: " << tag << std::endl;
51  return;
52  }
53 }
assert(be >=bs)
float x
Log< level::Warning, false > LogWarning
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4

◆ fitResiduals()

std::pair< Measurement1D, Measurement1D > PVValHelper::fitResiduals ( TH1 *  hist)

Definition at line 225 of file PVValidationHelpers.cc.

References EcalMonitorTask_cff::func, gpuVertexFinder::hist, SiStripPI::mean, and mps_fire::result.

Referenced by PrimaryVertexValidation::fillMap(), PrimaryVertexValidation::fillTrendPlot(), and PrimaryVertexValidation::fillTrendPlotByIndex().

227 {
228  //float fitResult(9999);
229  if (hist->GetEntries() < 1) {
230  return std::make_pair(Measurement1D(0., 0.), Measurement1D(0., 0.));
231  };
232 
233  float mean = hist->GetMean();
234  float sigma = hist->GetRMS();
235 
236  TF1 func("tmp", "gaus", mean - 1.5 * sigma, mean + 1.5 * sigma);
237  if (0 == hist->Fit(&func, "QNR")) { // N: do not blow up file by storing fit!
238  mean = func.GetParameter(1);
239  sigma = func.GetParameter(2);
240  // second fit: three sigma of first fit around mean of first fit
241  func.SetRange(mean - 2 * sigma, mean + 2 * sigma);
242  // I: integral gives more correct results if binning is too wide
243  // L: Likelihood can treat empty bins correctly (if hist not weighted...)
244  if (0 == hist->Fit(&func, "Q0LR")) {
245  if (hist->GetFunction(func.GetName())) { // Take care that it is later on drawn:
246  hist->GetFunction(func.GetName())->ResetBit(TF1::kNotDraw);
247  }
248  }
249  }
250 
251  float res_mean = func.GetParameter(1);
252  float res_width = func.GetParameter(2);
253 
254  float res_mean_err = func.GetParError(1);
255  float res_width_err = func.GetParError(2);
256 
257  Measurement1D resultM(res_mean, res_mean_err);
258  Measurement1D resultW(res_width, res_width_err);
259 
260  std::pair<Measurement1D, Measurement1D> result;
261 
262  result = std::make_pair(resultM, resultW);
263  return result;
264 }
__shared__ Hist hist

◆ generateBins()

std::vector< float > PVValHelper::generateBins ( int  n,
float  start,
float  range 
)

Definition at line 161 of file PVValidationHelpers.cc.

References a, mps_fire::end, writeEcalDQMStatus::interval, dqmiodumpmetadata::n, FastTimerService_cff::range, and findQualityFiles::v.

Referenced by PrimaryVertexValidation::PrimaryVertexValidation(), and SplitVertexResolution::SplitVertexResolution().

163 {
164  std::vector<float> v(n);
165  float interval = range / (n - 1);
166  std::iota(v.begin(), v.end(), 1.);
167 
168  /*
169  std::cout<<" interval:"<<interval<<std::endl;
170  for(float &a : v) { std::cout<< a << " "; }
171  std::cout<< "\n";
172  */
173 
174  std::for_each(begin(v), end(v), [&](float& a) { a = start + ((a - 1) * interval); });
175 
176  return v;
177 }
Definition: start.py:1
double a
Definition: hdecay.h:119

◆ getMAD()

Measurement1D PVValHelper::getMAD ( TH1F *  histo)

Definition at line 196 of file PVValidationHelpers.cc.

References funct::abs(), getMedian(), timingPdfMaker::histo, dqmiolumiharvest::j, median(), LaserClient_cfi::nbins, mps_fire::result, AlCaHLTBitMon_QueryRunRegistry::string, Measurement1D::value(), and HLT_2022v12_cff::weights.

Referenced by PrimaryVertexValidation::fillMap(), PrimaryVertexValidation::fillTrendPlot(), PrimaryVertexValidation::fillTrendPlotByIndex(), and SplitVertexResolution::fillTrendPlotByIndex().

198 {
199  int nbins = histo->GetNbinsX();
200  double median = getMedian(histo).value();
201  double x_lastBin = histo->GetBinLowEdge(nbins + 1);
202  const char* HistoName = histo->GetName();
203  std::string Finalname = "resMed_";
204  Finalname.append(HistoName);
205  TH1F* newHisto = new TH1F(Finalname.c_str(), Finalname.c_str(), nbins, 0., x_lastBin);
206  double* residuals = new double[nbins];
207  const float* weights = histo->GetArray();
208 
209  for (int j = 0; j < nbins; j++) {
210  residuals[j] = std::abs(median - histo->GetBinCenter(j + 1));
211  newHisto->Fill(residuals[j], weights[j]);
212  }
213 
214  double theMAD = (PVValHelper::getMedian(newHisto).value()) * 1.4826;
215 
216  delete[] residuals;
217  residuals = nullptr;
218  newHisto->Delete("");
219 
220  Measurement1D result(theMAD, theMAD / histo->GetEntries());
221  return result;
222 }
Measurement1D getMedian(TH1F *histo)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::string HistoName
double value() const
Definition: Measurement1D.h:25
T median(std::vector< T > values)
Definition: median.h:16

◆ getMedian()

Measurement1D PVValHelper::getMedian ( TH1F *  histo)

Definition at line 180 of file PVValidationHelpers.cc.

References timingPdfMaker::histo, median(), submitPVResolutionJobs::q, and mps_fire::result.

Referenced by PrimaryVertexValidation::fillMap(), PrimaryVertexValidation::fillTrendPlot(), PrimaryVertexValidation::fillTrendPlotByIndex(), SplitVertexResolution::fillTrendPlotByIndex(), and getMAD().

182 {
183  double median = 0.;
184  double q = 0.5; // 0.5 quantile for "median"
185  // protect against empty histograms
186  if (histo->Integral() != 0) {
187  histo->GetQuantiles(1, &median, &q);
188  }
189 
190  Measurement1D result(median, median / TMath::Sqrt(histo->GetEntries()));
191 
192  return result;
193 }
T median(std::vector< T > values)
Definition: median.h:16

◆ getTypeString()

PVValHelper::plotLabels PVValHelper::getTypeString ( PVValHelper::residualType  type)

Definition at line 63 of file PVValidationHelpers.cc.

References d3D, dx, dxy, dy, dz, IP2D, IP3D, norm_d3D, norm_dx, norm_dxy, norm_dy, norm_dz, norm_IP2D, norm_IP3D, norm_resz, resz, and reco::returnType().

Referenced by PrimaryVertexValidation::bookResidualsHistogram(), and PrimaryVertexValidation::PrimaryVertexValidation().

65 {
67  switch (type) {
68  // absoulte
69 
70  case PVValHelper::dxy:
71  returnType = std::make_tuple("dxy", "d_{xy}", "[#mum]");
72  break;
73  case PVValHelper::dx:
74  returnType = std::make_tuple("dx", "d_{x}", "[#mum]");
75  break;
76  case PVValHelper::dy:
77  returnType = std::make_tuple("dy", "d_{y}", "[#mum]");
78  break;
79  case PVValHelper::dz:
80  returnType = std::make_tuple("dz", "d_{z}", "[#mum]");
81  break;
82  case PVValHelper::IP2D:
83  returnType = std::make_tuple("IP2D", "IP_{2D}", "[#mum]");
84  break;
85  case PVValHelper::resz:
86  returnType = std::make_tuple("resz", "z_{trk}-z_{vtx}", "[#mum]");
87  break;
88  case PVValHelper::IP3D:
89  returnType = std::make_tuple("IP3D", "IP_{3D}", "[#mum]");
90  break;
91  case PVValHelper::d3D:
92  returnType = std::make_tuple("d3D", "d_{3D}", "[#mum]");
93  break;
94 
95  // normalized
96 
98  returnType = std::make_tuple("norm_dxy", "d_{xy}/#sigma_{d_{xy}}", "");
99  break;
101  returnType = std::make_tuple("norm_dx", "d_{x}/#sigma_{d_{x}}", "");
102  break;
104  returnType = std::make_tuple("norm_dy", "d_{y}/#sigma_{d_{y}}", "");
105  break;
107  returnType = std::make_tuple("norm_dz", "d_{z}/#sigma_{d_{z}}", "");
108  break;
110  returnType = std::make_tuple("norm_IP2D", "IP_{2D}/#sigma_{IP_{2D}}", "");
111  break;
113  returnType = std::make_tuple("norm_resz", "z_{trk}-z_{vtx}/#sigma_{res_{z}}", "");
114  break;
116  returnType = std::make_tuple("norm_IP3D", "IP_{3D}/#sigma_{IP_{3D}}", "");
117  break;
119  returnType = std::make_tuple("norm_d3D", "d_{3D}/#sigma_{d_{3D}}", "");
120  break;
121 
122  default:
123  edm::LogWarning("PVValidationHelpers") << " getTypeString() unknown residual type: " << type << std::endl;
124  }
125 
126  return returnType;
127 }
edm::TypeWithDict returnType(const edm::FunctionWithDict &)
Definition: returnType.cc:16
std::tuple< std::string, std::string, std::string > plotLabels
Log< level::Warning, false > LogWarning

◆ getVarString()

PVValHelper::plotLabels PVValHelper::getVarString ( PVValHelper::plotVariable  var)

Definition at line 130 of file PVValidationHelpers.cc.

References eta, ladder, modZ, phi, pT, pTCentral, and trigObjTnPSource_cfi::var.

Referenced by PrimaryVertexValidation::bookResidualsHistogram(), and PrimaryVertexValidation::PrimaryVertexValidation().

132 {
133  PVValHelper::plotLabels returnVar;
134  switch (var) {
135  case PVValHelper::phi:
136  returnVar = std::make_tuple("phi", "#phi", "[rad]");
137  break;
138  case PVValHelper::eta:
139  returnVar = std::make_tuple("eta", "#eta", "");
140  break;
141  case PVValHelper::pT:
142  returnVar = std::make_tuple("pT", "p_{T}", "[GeV]");
143  break;
145  returnVar = std::make_tuple("pTCentral", "p_{T} |#eta|<1.", "[GeV]");
146  break;
147  case PVValHelper::ladder:
148  returnVar = std::make_tuple("ladder", "ladder number", "");
149  break;
150  case PVValHelper::modZ:
151  returnVar = std::make_tuple("modZ", "module number", "");
152  break;
153  default:
154  edm::LogWarning("PVValidationHelpers") << " getVarString() unknown plot variable: " << var << std::endl;
155  }
156 
157  return returnVar;
158 }
std::tuple< std::string, std::string, std::string > plotLabels
Log< level::Warning, false > LogWarning

◆ makeLogBins()

template<typename T , size_t N>
std::array<T, N + 1> PVValHelper::makeLogBins ( const T min,
const T max 
)

Definition at line 30 of file PVValidationHelpers.h.

References mps_fire::i, SiStripPI::max, SiStripPI::min, VarParsing::mult, N, funct::pow(), runTheMatrix::ret, and ApeEstimator_cff::width.

30  {
31  const T minLog10 = std::log10(min);
32  const T maxLog10 = std::log10(max);
33  const T width = (maxLog10 - minLog10) / N;
34  std::array<T, N + 1> ret;
35  ret[0] = std::pow(10, minLog10);
36  const T mult = std::pow(10, width);
37  for (size_t i = 1; i <= N; ++i) {
38  ret[i] = ret[i - 1] * mult;
39  }
40  return ret;
41  }
ret
prodAgent to be discontinued
#define N
Definition: blowfish.cc:9
long double T
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29

◆ shrinkHistVectorToFit()

void PVValHelper::shrinkHistVectorToFit ( std::vector< TH1F *> &  h,
unsigned int  desired_size 
)

Definition at line 56 of file PVValidationHelpers.cc.

References h.

Referenced by PrimaryVertexValidation::beginRun().

58 {
59  h.erase(h.begin() + desired_size, h.end());
60 }
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4

Variable Documentation

◆ max_eta_phase0

constexpr double PVValHelper::max_eta_phase0 = 2.5

Definition at line 23 of file PVValidationHelpers.h.

Referenced by PrimaryVertexValidation::beginRun().

◆ max_eta_phase1

constexpr double PVValHelper::max_eta_phase1 = 2.7

Definition at line 24 of file PVValidationHelpers.h.

Referenced by PrimaryVertexValidation::beginRun().

◆ max_eta_phase2

constexpr double PVValHelper::max_eta_phase2 = 4.0

Definition at line 25 of file PVValidationHelpers.h.

Referenced by PrimaryVertexValidation::beginRun().