CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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,
Measurement1D
fitResiduals (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

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

Definition at line 123 of file PVValidationHelpers.h.

Enumeration Type Documentation

Enumerator
phase0 
phase1 
phase2 
END_OF_PHASES 

Definition at line 78 of file PVValidationHelpers.h.

Enumerator
MEAN 
WIDTH 
MEDIAN 
MAD 
UNKWN 

Definition at line 45 of file PVValidationHelpers.h.

Enumerator
phi 
eta 
pT 
pTCentral 
ladder 
modZ 
END_OF_PLOTS 

Definition at line 68 of file PVValidationHelpers.h.

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

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

Definition at line 12 of file PVValidationHelpers.cc.

References gpuVertexFinder::hist.

Referenced by LHCInfoPopConSourceHandler::addEmptyPayload(), CosmicHitPairGenerator::CosmicHitPairGenerator(), CosmicHitTripletGenerator::CosmicHitTripletGenerator(), edmStreamStallGrapher::createPDFImage(), 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(), python.rootplot.core::plot_hists_mpl(), L1GctLut< NAddressBits, NDataBits >::printLine(), core.PileUpAnalyzer.PileUpAnalyzer::process(), objects.VertexAnalyzer.VertexAnalyzer::process(), TIBLayer::searchNeighbors(), TECLayer::searchNeighbors(), CompositeTECWedge::searchNeighbors(), PixelForwardLayer::searchNeighbors(), PixelForwardLayerPhase1::searchNeighbors(), Phase2EndcapSingleRing::searchNeighbors(), TIDRing::searchNeighbors(), TOBRod::searchNeighbors(), Phase2EndcapRing::searchNeighbors(), TBPLayer::searchNeighbors(), PixelBlade::searchNeighbors(), Phase1PixelBlade::searchNeighbors(), Phase2OTBarrelRod::searchNeighbors(), TIBRing::searchNeighbors(), CompositeTECPetal::searchNeighbors(), MatrixReader.MatrixReader::showRaw(), conddb_migrate::tags_in_gts(), LHCInfoImpl::transferPayloads(), evf::FastMonEncoding::update(), and evf::FastMonEncoding::updatePreinit().

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
void PVValHelper::fill ( std::map< std::string, TH1 * > &  h,
const std::string &  s,
double  x 
)

Definition at line 20 of file PVValidationHelpers.cc.

References alignCSCRings::s.

Referenced by HFRaddamTask::_process(), TPTask::_process(), SiStripGainsPCLHarvester::algoComputeMPVandGain(), SiStripThreshold::allThresholds(), GenericBenchmarkAnalyzer::analyze(), EcalDumpRaw::analyze(), DTDataIntegrityTask::analyze(), AnalyzerMinbias::analyze(), TrackCountingTagPlotter::analyzeTag(), TrackProbabilityTagPlotter::analyzeTag(), L1TGlobalSummary::beginRun(), SimpleCosmicBONSeeder::checkNoisyModules(), funct::Master< F >::clear(), edm::IndexSet::clear(), edm::FileBlock::close(), l1tpf::corrector::corrector(), CSCTFUnpacker::CSCTFUnpacker(), EcalDumpRaw::decode(), PhysicsTools::VarProcessor::deriv(), DTEfficiencyTest::dqmEndLuminosityBlock(), MetTreeProducer::fill(), CandCommonVertexFitterBase::fill(), CandKinematicVertexFitter::fill(), egHLT::MonElemContainer< T >::fill(), FlavourHistograms2D< T, G >::fill(), l1tpf_calo::GridData< PreCluster >::fill(), NanoAODDQM::SelGroupConfig::fillSel(), TrackingNtuple::fillStripRphiStereoHits(), PrimaryVertexValidation::fillTrackHistos(), TrackingNtuple::fillTrackingVertices(), Phase2EndcapLayerDoubleDisk::groupedCompatibleDetsV(), tkDetUtil::groupedCompatibleDetsV(), GroupedCkfTrajectoryBuilder::groupedIntermediaryClean(), HITrackClusterRemover::HITrackClusterRemover(), HLTTrackClusterRemoverNew::HLTTrackClusterRemoverNew(), l1tpf::corrector::init_(), StripCPEfromTrackAngle::localParameters(), BoostedJetONNXJetTagsProducer::make_inputs(), HLTTauDQMPath::offlineMatching(), reco::PFCandidate::PFCandidate(), l1tpf_calo::Phase1GridBase::Phase1GridBase(), cscdqm::EventProcessor::processCSC(), EgammaHLTCaloTowerProducer::produce(), SeedClusterRemoverPhase2::produce(), SeedClusterRemover::produce(), BPHWriteSpecificDecay::produce(), HITrackClusterRemover::produce(), TTStubBuilder< T >::produce(), SeedClusterRemover::readPSet(), HLTTrackClusterRemoverNew::readPSet(), HITrackClusterRemover::readPSet(), PhiMemoryImage::reset(), funct::Master< F >::reset(), hltrigreport::Accumulate::reset(), HGCal3DClustering::reset(), L1DataEmulDigi::reset(), StMeasurementDetSet::resetOnDemandStrips(), HcalSiPM::resetSiPM(), edm::soa::Table< edm::soa::col::Pt, edm::soa::col::Eta, edm::soa::col::Phi, edm::soa::col::Vz >::resetStartingAt(), magfieldparam::rz_poly::rz_poly(), SeedClusterRemover::SeedClusterRemover(), CandCommonVertexFitterBase::set(), CandKinematicVertexFitter::set(), StMeasurementConditionSet::set128StripStatus(), PxMeasurementDetSet::setActiveThisEvent(), Phase2OTMeasurementDetSet::setActiveThisEvent(), magfieldparam::rz_poly::SetAllON(), CaloSamples::setBlank(), StMeasurementDetSet::setEmpty(), PxMeasurementDetSet::setEmpty(), Phase2OTMeasurementDetSet::setEmpty(), PFAlgo::setHcalDepthInfo(), edm::StreamerOutputModuleCommon::setHltMask(), heppy::IsolationComputer::setPackedCandidates(), tmtt::StubFEWindows::setZero(), StripSubClusterShapeFilterBase::StripSubClusterShapeFilterBase(), SimG4HcalValidation::update(), edmNew::DetSetVector< T >::update(), MeasurementTrackerEventProducer::updatePixels(), DAClusterizerInZ::vertices(), DAClusterizerInZ_vect::vertices(), and DAClusterizerInZT_vect::vertices().

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
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 alignCSCRings::s.

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
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().

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
std::pair< Measurement1D, Measurement1D > PVValHelper::fitResiduals ( TH1 *  hist)

Definition at line 225 of file PVValidationHelpers.cc.

References cms::cuda::func, 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 }
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t Func __host__ __device__ V int Func func
tuple result
Definition: mps_fire.py:311
__shared__ Hist hist
std::vector< float > PVValHelper::generateBins ( int  n,
float  start,
float  range 
)

Definition at line 161 of file PVValidationHelpers.cc.

References a, SplitLinear::begin, dataset::end, MergeJob_cfg::interval, 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 }
tuple interval
Definition: MergeJob_cfg.py:20
const uint16_t range(const Frame &aFrame)
double a
Definition: hdecay.h:119
string end
Definition: dataset.py:937
Measurement1D PVValHelper::getMAD ( TH1F *  histo)

Definition at line 196 of file PVValidationHelpers.cc.

References funct::abs(), getMedian(), dqmiolumiharvest::j, median(), hlt_dqm_clientPB-live_cfg::nbins, mps_fire::result, AlCaHLTBitMon_QueryRunRegistry::string, Measurement1D::value(), and HLT_FULL_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)
tuple result
Definition: mps_fire.py:311
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double value() const
Definition: Measurement1D.h:25
std::string HistoName
T median(std::vector< T > values)
Definition: median.h:16
Measurement1D PVValHelper::getMedian ( TH1F *  histo)

Definition at line 180 of file PVValidationHelpers.cc.

References 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 }
tuple result
Definition: mps_fire.py:311
T median(std::vector< T > values)
Definition: median.h:16
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
PVValHelper::plotLabels PVValHelper::getVarString ( PVValHelper::plotVariable  var)

Definition at line 130 of file PVValidationHelpers.cc.

References eta, ladder, modZ, phi, pT, and pTCentral.

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
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, VarParsing::mult, N, funct::pow(), and runTheMatrix::ret.

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  }
tuple 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
void PVValHelper::shrinkHistVectorToFit ( std::vector< TH1F * > &  h,
unsigned int  desired_size 
)

Definition at line 56 of file PVValidationHelpers.cc.

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

constexpr double PVValHelper::max_eta_phase0 = 2.5

Definition at line 23 of file PVValidationHelpers.h.

Referenced by PrimaryVertexValidation::beginRun().

constexpr double PVValHelper::max_eta_phase1 = 2.7

Definition at line 24 of file PVValidationHelpers.h.

Referenced by PrimaryVertexValidation::beginRun().

constexpr double PVValHelper::max_eta_phase2 = 4.0

Definition at line 25 of file PVValidationHelpers.h.

Referenced by PrimaryVertexValidation::beginRun().