CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
PPSAlignmentConfigurationESSource Class Reference
Inheritance diagram for PPSAlignmentConfigurationESSource:
edm::ESProducer edm::EventSetupRecordIntervalFinder edm::ESProxyFactoryProducer edm::eventsetup::DataProxyProvider

Public Member Functions

 PPSAlignmentConfigurationESSource (const edm::ParameterSet &iConfig)
 
std::unique_ptr< PPSAlignmentConfigurationproduce (const PPSAlignmentConfigurationRcd &)
 
- Public Member Functions inherited from edm::ESProducer
 ESProducer ()
 
 ESProducer (const ESProducer &)=delete
 
 ESProducer (ESProducer &&)=delete
 
ESProxyIndex const * getTokenIndices (unsigned int iIndex) const
 
ESRecordIndex const * getTokenRecordIndices (unsigned int iIndex) const
 
bool hasMayConsumes () const noexcept
 
size_t numberOfTokenIndices (unsigned int iIndex) const
 
ESProduceroperator= (const ESProducer &)=delete
 
ESProduceroperator= (ESProducer &&)=delete
 
SerialTaskQueueChainqueue ()
 
template<typename Record >
std::optional< std::vector< ESProxyIndex > > updateFromMayConsumes (unsigned int iIndex, const Record &iRecord) const
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &) final
 
 ~ESProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::ESProxyFactoryProducer
 ESProxyFactoryProducer ()
 
 ESProxyFactoryProducer (const ESProxyFactoryProducer &)=delete
 
const ESProxyFactoryProduceroperator= (const ESProxyFactoryProducer &)=delete
 
 ~ESProxyFactoryProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::eventsetup::DataProxyProvider
void createKeyedProxies (EventSetupRecordKey const &key, unsigned int nConcurrentIOVs)
 
 DataProxyProvider ()
 
 DataProxyProvider (const DataProxyProvider &)=delete
 
const ComponentDescriptiondescription () const
 
void fillRecordsNotAllowingConcurrentIOVs (std::set< EventSetupRecordKey > &recordsNotAllowingConcurrentIOVs) const
 
virtual void initConcurrentIOVs (EventSetupRecordKey const &key, unsigned int nConcurrentIOVs)
 
bool isUsingRecord (const EventSetupRecordKey &key) const
 
KeyedProxieskeyedProxies (const EventSetupRecordKey &iRecordKey, unsigned int iovIndex=0)
 
const DataProxyProvideroperator= (const DataProxyProvider &)=delete
 
void setAppendToDataLabel (const edm::ParameterSet &)
 
void setDescription (const ComponentDescription &iDescription)
 
std::set< EventSetupRecordKeyusingRecords () const
 
virtual ~DataProxyProvider () noexcept(false)
 
- Public Member Functions inherited from edm::EventSetupRecordIntervalFinder
bool concurrentFinder () const
 
const eventsetup::ComponentDescriptiondescriptionForFinder () const
 
 EventSetupRecordIntervalFinder ()
 
 EventSetupRecordIntervalFinder (const EventSetupRecordIntervalFinder &)=delete
 
std::set< eventsetup::EventSetupRecordKeyfindingForRecords () const
 
const ValidityIntervalfindIntervalFor (const eventsetup::EventSetupRecordKey &, const IOVSyncValue &)
 
bool nonconcurrentAndIOVNeedsUpdate (const eventsetup::EventSetupRecordKey &key, const IOVSyncValue &syncValue) const
 
const EventSetupRecordIntervalFinderoperator= (const EventSetupRecordIntervalFinder &)=delete
 
void resetInterval (const eventsetup::EventSetupRecordKey &)
 
void setDescriptionForFinder (const eventsetup::ComponentDescription &iDescription)
 
virtual ~EventSetupRecordIntervalFinder () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::eventsetup::DataProxyProvider
static void prevalidate (ConfigurationDescriptions &)
 

Private Member Functions

std::vector< PPSAlignmentConfiguration::PointErrorsbuildVectorFromDirectory (TDirectory *dir, const PPSAlignmentConfiguration::RPConfig &rpd)
 
TDirectory * findDirectoryWithName (TDirectory *dir, std::string searchName)
 
void setIntervalFor (const edm::eventsetup::EventSetupRecordKey &key, const edm::IOVSyncValue &iosv, edm::ValidityInterval &oValidity) override
 

Private Attributes

std::map< unsigned int, PPSAlignmentConfiguration::SelectionRangealignment_x_meth_o_ranges
 
std::map< unsigned int, PPSAlignmentConfiguration::SelectionRangealignment_x_relative_ranges
 
std::map< unsigned int, PPSAlignmentConfiguration::SelectionRangealignment_y_ranges
 
PPSAlignmentConfiguration::Binning binning
 
double chiSqThreshold
 
bool debug
 
std::vector< double > extraParams
 
unsigned int fitProfileMinBinEntries
 
unsigned int fitProfileMinNReasonable
 
std::string label
 
std::map< unsigned int, std::vector< PPSAlignmentConfiguration::PointErrors > > matchingReferencePoints
 
std::map< unsigned int, PPSAlignmentConfiguration::SelectionRangematchingShiftRanges
 
unsigned int maxRPTracksSize
 
unsigned int methOGraphMinN
 
double methOUncFitRange
 
unsigned int minRPTracksSize
 
unsigned int modeGraphMinN
 
unsigned int multSelProjYMinEntries
 
double n_si
 
unsigned int nearFarMinEntries
 
PPSAlignmentConfiguration::SectorConfig sectorConfig45
 
PPSAlignmentConfiguration::SectorConfig sectorConfig56
 
double x_ali_sh_step
 
double y_mode_max_valid
 
double y_mode_sys_unc
 
double y_mode_unc_max_valid
 

Additional Inherited Members

- Protected Types inherited from edm::ESProxyFactoryProducer
using EventSetupRecordKey = eventsetup::EventSetupRecordKey
 
- Protected Types inherited from edm::eventsetup::DataProxyProvider
using KeyedProxiesVector = std::vector< std::pair< DataKey, std::shared_ptr< DataProxy > >>
 
- Protected Member Functions inherited from edm::ESProducer
ESConsumesInfoconsumesInfoPushBackNew ()
 
unsigned int consumesInfoSize () const
 
template<typename CallbackT , typename TList , typename TRecord >
void registerProducts (std::shared_ptr< std::pair< unsigned int, std::shared_ptr< CallbackT >>> iCallback, const TList *, const TRecord *iRecord, const es::Label &iLabel)
 
template<typename CallbackT , typename TRecord >
void registerProducts (std::shared_ptr< std::pair< unsigned int, std::shared_ptr< CallbackT >>>, const eventsetup::produce::Null *, const TRecord *, const es::Label &)
 
template<typename T >
auto setWhatProduced (T *iThis, const es::Label &iLabel={})
 
template<typename T >
auto setWhatProduced (T *iThis, const char *iLabel)
 
template<typename T >
auto setWhatProduced (T *iThis, const std::string &iLabel)
 
template<typename T , typename TDecorator >
auto setWhatProduced (T *iThis, const TDecorator &iDec, const es::Label &iLabel={})
 
template<typename T , typename TReturn , typename TRecord >
auto setWhatProduced (T *iThis, TReturn(T::*iMethod)(const TRecord &), const es::Label &iLabel={})
 
template<typename T , typename TReturn , typename TRecord , typename TDecorator >
auto setWhatProduced (T *iThis, TReturn(T ::*iMethod)(const TRecord &), const TDecorator &iDec, const es::Label &iLabel={})
 
template<typename TFunc >
auto setWhatProduced (TFunc &&func, const es::Label &iLabel={})
 
template<typename TReturn , typename TRecord , typename TFunc , typename TDecorator >
ESConsumesCollectorT< TRecord > setWhatProduced (TFunc &&func, TDecorator &&iDec, const es::Label &iLabel={})
 
void usesResources (std::vector< std::string > const &)
 
- Protected Member Functions inherited from edm::ESProxyFactoryProducer
template<class TFactory >
void registerFactory (std::unique_ptr< TFactory > iFactory, const std::string &iLabel=std::string())
 
virtual void registerFactoryWithKey (const EventSetupRecordKey &iRecord, std::unique_ptr< eventsetup::ProxyFactoryBase > iFactory, const std::string &iLabel=std::string())
 
KeyedProxiesVector registerProxies (const EventSetupRecordKey &, unsigned int iovIndex) override
 
- Protected Member Functions inherited from edm::eventsetup::DataProxyProvider
template<class T >
void usingRecord ()
 
void usingRecordWithKey (const EventSetupRecordKey &key)
 
- Protected Member Functions inherited from edm::EventSetupRecordIntervalFinder
template<class T >
void findingRecord ()
 
void findingRecordWithKey (const eventsetup::EventSetupRecordKey &)
 

Detailed Description

Definition at line 38 of file PPSAlignmentConfigurationESSource.cc.

Constructor & Destructor Documentation

◆ PPSAlignmentConfigurationESSource()

PPSAlignmentConfigurationESSource::PPSAlignmentConfigurationESSource ( const edm::ParameterSet iConfig)

Definition at line 94 of file PPSAlignmentConfigurationESSource.cc.

References alignment_x_meth_o_ranges, alignment_x_relative_ranges, alignment_y_ranges, PPSAlignmentConfiguration::Binning::bin_size_x_, binning, buildVectorFromDirectory(), reco::ceil(), chiSqThreshold, debug, PPSAlignmentConfiguration::Binning::diffFN_n_bins_x_, PPSAlignmentConfiguration::Binning::diffFN_x_max_, PPSAlignmentConfiguration::Binning::diffFN_x_min_, edm::ParameterSet::empty(), extraParams, findDirectoryWithName(), fitProfileMinBinEntries, fitProfileMinNReasonable, edm::ParameterSet::getParameter(), PPSAlignmentConfiguration::RPConfig::id_, label, matchingReferencePoints, matchingShiftRanges, maxRPTracksSize, methOGraphMinN, methOUncFitRange, minRPTracksSize, eostools::mkdir(), modeGraphMinN, multSelProjYMinEntries, PPSAlignmentConfiguration::Binning::n_bins_x_, PPSAlignmentConfiguration::Binning::n_bins_y_, n_si, PPSAlignmentConfiguration::RPConfig::name_, PPSAlignmentConfiguration::SectorConfig::name_, nearFarMinEntries, AlCaHLTBitMon_ParallelJobs::p, PPSAlignmentConfiguration::Binning::pixel_x_offset_, PPSAlignmentConfiguration::RPConfig::position_, PPSAlignmentConfiguration::SectorConfig::rp_F_, PPSAlignmentConfiguration::SectorConfig::rp_N_, sectorConfig45, sectorConfig56, edm::ESProducer::setWhatProduced(), PPSAlignmentConfiguration::Binning::slice_n_bins_x_, PPSAlignmentConfiguration::Binning::slice_n_bins_y_, PPSAlignmentConfiguration::Binning::slice_x_max_, PPSAlignmentConfiguration::Binning::slice_x_min_, PPSAlignmentConfiguration::Binning::slice_y_max_, PPSAlignmentConfiguration::Binning::slice_y_min_, AlCaHLTBitMon_QueryRunRegistry::string, x_ali_sh_step, PPSAlignmentConfiguration::Binning::y_max_, PPSAlignmentConfiguration::Binning::y_min_, y_mode_max_valid, y_mode_sys_unc, and y_mode_unc_max_valid.

94  {
95  label = iConfig.getParameter<std::string>("label");
96 
97  debug = iConfig.getParameter<bool>("debug");
98  std::unique_ptr<TFile> debugFile;
99  if (debug) {
100  debugFile =
101  std::make_unique<TFile>(("debug_producer_" + (label.empty() ? "test" : label) + ".root").c_str(), "recreate");
102  }
103 
104  sectorConfig45.name_ = "sector 45";
105 
108 
109  sectorConfig56.name_ = "sector 56";
110 
113 
114  for (std::string sectorName : {"sector_45", "sector_56"}) {
115  const auto& sps = iConfig.getParameter<edm::ParameterSet>(sectorName);
117  if (sectorName == "sector_45")
118  sc = &sectorConfig45;
119  else
120  sc = &sectorConfig56;
121 
122  for (std::string rpName : {"rp_N", "rp_F"}) {
123  const auto& rpps = sps.getParameter<edm::ParameterSet>(rpName);
125  if (rpName == "rp_N")
126  rc = &sc->rp_N_;
127  else
128  rc = &sc->rp_F_;
129 
130  rc->name_ = rpps.getParameter<std::string>("name");
131  rc->id_ = rpps.getParameter<int>("id");
132 
133  rc->slope_ = rpps.getParameter<double>("slope");
134  rc->sh_x_ = rpps.getParameter<double>("sh_x");
135 
136  rc->x_min_fit_mode_ = rpps.getParameter<double>("x_min_fit_mode");
137  rc->x_max_fit_mode_ = rpps.getParameter<double>("x_max_fit_mode");
138  rc->y_max_fit_mode_ = rpps.getParameter<double>("y_max_fit_mode");
139  rc->y_cen_add_ = rpps.getParameter<double>("y_cen_add");
140  rc->y_width_mult_ = rpps.getParameter<double>("y_width_mult");
141 
142  rc->x_slice_min_ = rpps.getParameter<double>("x_slice_min");
143  rc->x_slice_w_ = rpps.getParameter<double>("x_slice_w");
144  rc->x_slice_n_ = std::ceil((rpps.getParameter<double>("x_slice_max") - rc->x_slice_min_) / rc->x_slice_w_);
145  }
146 
147  sc->slope_ = sps.getParameter<double>("slope");
148 
149  sc->cut_h_apply_ = sps.getParameter<bool>("cut_h_apply");
150  sc->cut_h_a_ = sps.getParameter<double>("cut_h_a");
151  sc->cut_h_c_ = sps.getParameter<double>("cut_h_c");
152  sc->cut_h_si_ = sps.getParameter<double>("cut_h_si");
153 
154  sc->cut_v_apply_ = sps.getParameter<bool>("cut_v_apply");
155  sc->cut_v_a_ = sps.getParameter<double>("cut_v_a");
156  sc->cut_v_c_ = sps.getParameter<double>("cut_v_c");
157  sc->cut_v_si_ = sps.getParameter<double>("cut_v_si");
158  }
159 
160  std::map<unsigned int, std::string> rpTags = {{sectorConfig45.rp_F_.id_, "rp_L_F"},
161  {sectorConfig45.rp_N_.id_, "rp_L_N"},
162  {sectorConfig56.rp_N_.id_, "rp_R_N"},
163  {sectorConfig56.rp_F_.id_, "rp_R_F"}};
164 
165  std::map<unsigned int, std::string> sectorNames = {{sectorConfig45.rp_F_.id_, sectorConfig45.name_},
169 
170  std::map<unsigned int, const PPSAlignmentConfiguration::RPConfig*> rpConfigs = {
175 
176  x_ali_sh_step = iConfig.getParameter<double>("x_ali_sh_step");
177 
178  y_mode_sys_unc = iConfig.getParameter<double>("y_mode_sys_unc");
179  chiSqThreshold = iConfig.getParameter<double>("chiSqThreshold");
180  y_mode_unc_max_valid = iConfig.getParameter<double>("y_mode_unc_max_valid");
181  y_mode_max_valid = iConfig.getParameter<double>("y_mode_max_valid");
182 
183  minRPTracksSize = iConfig.getParameter<unsigned int>("min_RP_tracks_size");
184  maxRPTracksSize = iConfig.getParameter<unsigned int>("max_RP_tracks_size");
185  n_si = iConfig.getParameter<double>("n_si");
186 
187  const auto& c_axo = iConfig.getParameter<edm::ParameterSet>("x_alignment_meth_o");
188  for (const auto& p : rpTags) {
189  const auto& ps = c_axo.getParameter<edm::ParameterSet>(p.second);
190  alignment_x_meth_o_ranges[p.first] = {ps.getParameter<double>("x_min"), ps.getParameter<double>("x_max")};
191  }
192  fitProfileMinBinEntries = c_axo.getParameter<unsigned int>("fit_profile_min_bin_entries");
193  fitProfileMinNReasonable = c_axo.getParameter<unsigned int>("fit_profile_min_N_reasonable");
194  methOGraphMinN = c_axo.getParameter<unsigned int>("meth_o_graph_min_N");
195  methOUncFitRange = c_axo.getParameter<double>("meth_o_unc_fit_range");
196 
197  const auto& c_m = iConfig.getParameter<edm::ParameterSet>("matching");
198  const auto& referenceDataset = c_m.getParameter<std::string>("reference_dataset");
199 
200  // constructing vectors with reference data
201  if (!referenceDataset.empty()) {
202  auto f_ref = std::make_unique<TFile>(referenceDataset.c_str(), "READ");
203  if (!f_ref->IsOpen()) {
204  edm::LogWarning("PPS") << "[ESSource] could not find reference dataset file: " << referenceDataset;
205  } else {
206  TDirectory* ad_ref = findDirectoryWithName((TDirectory*)f_ref.get(), sectorConfig45.name_);
207  if (ad_ref == nullptr) {
208  edm::LogWarning("PPS") << "[ESSource] could not find reference dataset in " << referenceDataset;
209  } else {
210  edm::LogInfo("PPS") << "[ESSource] loading reference dataset from " << ad_ref->GetPath();
211 
212  for (const auto& p : rpTags) {
213  if (debug)
214  gDirectory = debugFile->mkdir(rpConfigs[p.first]->name_.c_str())->mkdir("fits_ref");
215 
216  auto* d_ref = (TDirectory*)ad_ref->Get(
217  (sectorNames[p.first] + "/near_far/x slices " + rpConfigs[p.first]->position_).c_str());
218  if (d_ref == nullptr) {
219  edm::LogWarning("PPS") << "[ESSource] could not load d_ref";
220  } else {
221  matchingReferencePoints[p.first] = buildVectorFromDirectory(d_ref, *rpConfigs[p.first]);
222  }
223  }
224  }
225  }
226  }
227 
228  for (const auto& p : rpTags) {
229  const auto& ps = c_m.getParameter<edm::ParameterSet>(p.second);
230  matchingShiftRanges[p.first] = {ps.getParameter<double>("sh_min"), ps.getParameter<double>("sh_max")};
231  }
232 
233  const auto& c_axr = iConfig.getParameter<edm::ParameterSet>("x_alignment_relative");
234  for (const auto& p : rpTags) {
235  if (p.second.back() == 'N') { // only near RPs
236  const auto& ps = c_axr.getParameter<edm::ParameterSet>(p.second);
237  alignment_x_relative_ranges[p.first] = {ps.getParameter<double>("x_min"), ps.getParameter<double>("x_max")};
238  }
239  }
240  nearFarMinEntries = c_axr.getParameter<unsigned int>("near_far_min_entries");
241 
242  const auto& c_ay = iConfig.getParameter<edm::ParameterSet>("y_alignment");
243  for (const auto& p : rpTags) {
244  const auto& ps = c_ay.getParameter<edm::ParameterSet>(p.second);
245  alignment_y_ranges[p.first] = {ps.getParameter<double>("x_min"), ps.getParameter<double>("x_max")};
246  }
247  modeGraphMinN = c_ay.getParameter<unsigned int>("mode_graph_min_N");
248  multSelProjYMinEntries = c_ay.getParameter<unsigned int>("mult_sel_proj_y_min_entries");
249 
250  const auto& bps = iConfig.getParameter<edm::ParameterSet>("binning");
251  binning.bin_size_x_ = bps.getParameter<double>("bin_size_x");
252  binning.n_bins_x_ = bps.getParameter<unsigned int>("n_bins_x");
253  binning.pixel_x_offset_ = bps.getParameter<double>("pixel_x_offset");
254  binning.n_bins_y_ = bps.getParameter<unsigned int>("n_bins_y");
255  binning.y_min_ = bps.getParameter<double>("y_min");
256  binning.y_max_ = bps.getParameter<double>("y_max");
257 
258  binning.diffFN_n_bins_x_ = bps.getParameter<unsigned int>("diffFN_n_bins_x");
259  binning.diffFN_x_min_ = bps.getParameter<double>("diffFN_x_min");
260  binning.diffFN_x_max_ = bps.getParameter<double>("diffFN_x_max");
261 
262  binning.slice_n_bins_x_ = bps.getParameter<unsigned int>("slice_n_bins_x");
263  binning.slice_x_min_ = bps.getParameter<double>("slice_x_min");
264  binning.slice_x_max_ = bps.getParameter<double>("slice_x_max");
265  binning.slice_n_bins_y_ = bps.getParameter<unsigned int>("slice_n_bins_y");
266  binning.slice_y_min_ = bps.getParameter<double>("slice_y_min");
267  binning.slice_y_max_ = bps.getParameter<double>("slice_y_max");
268 
269  extraParams = iConfig.getParameter<std::vector<double>>("extra_params");
270 
271  setWhatProduced(this, label);
272  findingRecord<PPSAlignmentConfigurationRcd>();
273 }
constexpr int32_t ceil(float num)
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:165
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
PPSAlignmentConfiguration::SectorConfig sectorConfig56
std::map< unsigned int, PPSAlignmentConfiguration::SelectionRange > alignment_y_ranges
std::map< unsigned int, PPSAlignmentConfiguration::SelectionRange > alignment_x_relative_ranges
PPSAlignmentConfiguration::SectorConfig sectorConfig45
std::map< unsigned int, PPSAlignmentConfiguration::SelectionRange > matchingShiftRanges
std::map< unsigned int, std::vector< PPSAlignmentConfiguration::PointErrors > > matchingReferencePoints
bool empty() const
Definition: ParameterSet.h:201
TDirectory * findDirectoryWithName(TDirectory *dir, std::string searchName)
Log< level::Info, false > LogInfo
def mkdir(path)
Definition: eostools.py:251
PPSAlignmentConfiguration::Binning binning
std::map< unsigned int, PPSAlignmentConfiguration::SelectionRange > alignment_x_meth_o_ranges
std::vector< PPSAlignmentConfiguration::PointErrors > buildVectorFromDirectory(TDirectory *dir, const PPSAlignmentConfiguration::RPConfig &rpd)
Log< level::Warning, false > LogWarning

Member Function Documentation

◆ buildVectorFromDirectory()

std::vector< PPSAlignmentConfiguration::PointErrors > PPSAlignmentConfigurationESSource::buildVectorFromDirectory ( TDirectory *  dir,
const PPSAlignmentConfiguration::RPConfig rpd 
)
private

Definition at line 620 of file PPSAlignmentConfigurationESSource.cc.

References ztail::d, debug, DeadROC_duringRun::dir, alig_utils::fitProfile(), fitProfileMinBinEntries, fitProfileMinNReasonable, dqmdumpme::k, Skims_PA_cff::name, GetRecoTauVFromDQM_MC_cff::next, EcalTangentSkim_cfg::o, MetAnalyzer::pv(), python.rootplot.root2matplotlib::replace(), AlCaHLTBitMon_QueryRunRegistry::string, PPSAlignmentConfiguration::RPConfig::y_cen_add_, and PPSAlignmentConfiguration::RPConfig::y_width_mult_.

Referenced by PPSAlignmentConfigurationESSource().

621  {
622  std::vector<PPSAlignmentConfiguration::PointErrors> pv;
623 
624  TIter next(dir->GetListOfKeys());
625  TObject* o;
626  while ((o = next())) {
627  TKey* k = (TKey*)o;
628 
629  std::string name = k->GetName();
630  size_t d = name.find('-');
631  std::replace(name.begin(), name.end(), '_', '.'); // replace _ with .
632  const double x_min = std::stod(name.substr(0, d));
633  const double x_max = std::stod(name.substr(d + 1));
634 
635  TDirectory* d_slice = (TDirectory*)k->ReadObj();
636 
637  TH1D* h_y = (TH1D*)d_slice->Get("h_y");
638  TProfile* p_y_diffFN_vs_y = (TProfile*)d_slice->Get("p_y_diffFN_vs_y");
639 
640  double y_cen = h_y->GetMean();
641  double y_width = h_y->GetRMS();
642 
643  y_cen += rpd.y_cen_add_;
644  y_width *= rpd.y_width_mult_;
645 
646  double sl = 0., sl_unc = 0.;
647  int fr = alig_utils::fitProfile(
648  p_y_diffFN_vs_y, y_cen, y_width, fitProfileMinBinEntries, fitProfileMinNReasonable, sl, sl_unc);
649  if (fr != 0)
650  continue;
651 
652  if (debug)
653  p_y_diffFN_vs_y->Write(name.c_str());
654 
655  pv.push_back({(x_max + x_min) / 2., sl, (x_max - x_min) / 2., sl_unc});
656  }
657 
658  return pv;
659 }
int fitProfile(TProfile *p, double x_mean, double x_rms, unsigned int minBinEntries, unsigned int minNBinsReasonable, double &sl, double &sl_unc)
Definition: utils.cc:14
def replace(string, replacements)
def pv(vc)
Definition: MetAnalyzer.py:7
d
Definition: ztail.py:151

◆ fillDescriptions()

void PPSAlignmentConfigurationESSource::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 325 of file PPSAlignmentConfigurationESSource.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), binning, submitPVResolutionJobs::desc, TtSemiLepJetCombMVATrainer_cfi::matching, and AlCaHLTBitMon_QueryRunRegistry::string.

325  {
327 
328  desc.add<bool>("debug", false);
329 
330  desc.add<std::string>("label", "");
331 
332  // sector_45
333  {
335 
337  rp_N.add<std::string>("name", "L_1_F");
338  rp_N.add<int>("id", 3);
339 
340  rp_N.add<double>("slope", 0.19);
341  rp_N.add<double>("sh_x", -3.6);
342 
343  rp_N.add<double>("x_min_fit_mode", 2.);
344  rp_N.add<double>("x_max_fit_mode", 7.0);
345  rp_N.add<double>("y_max_fit_mode", 7.0);
346  rp_N.add<double>("y_cen_add", -0.3);
347  rp_N.add<double>("y_width_mult", 1.1);
348 
349  rp_N.add<double>("x_slice_min", 7.);
350  rp_N.add<double>("x_slice_max", 19.);
351  rp_N.add<double>("x_slice_w", 0.2);
352  sector45.add<edm::ParameterSetDescription>("rp_N", rp_N);
353 
355  rp_F.add<std::string>("name", "L_2_F");
356  rp_F.add<int>("id", 23);
357 
358  rp_F.add<double>("slope", 0.19);
359  rp_F.add<double>("sh_x", -42.);
360 
361  rp_F.add<double>("x_min_fit_mode", 2.);
362  rp_F.add<double>("x_max_fit_mode", 7.5);
363  rp_F.add<double>("y_max_fit_mode", 7.5);
364  rp_F.add<double>("y_cen_add", -0.3);
365  rp_F.add<double>("y_width_mult", 1.1);
366 
367  rp_F.add<double>("x_slice_min", 46.);
368  rp_F.add<double>("x_slice_max", 58.);
369  rp_F.add<double>("x_slice_w", 0.2);
370  sector45.add<edm::ParameterSetDescription>("rp_F", rp_F);
371 
372  sector45.add<double>("slope", 0.006);
373  sector45.add<bool>("cut_h_apply", true);
374  sector45.add<double>("cut_h_a", -1.);
375  sector45.add<double>("cut_h_c", -38.55);
376  sector45.add<double>("cut_h_si", 0.2);
377  sector45.add<bool>("cut_v_apply", true);
378  sector45.add<double>("cut_v_a", -1.07);
379  sector45.add<double>("cut_v_c", 1.63);
380  sector45.add<double>("cut_v_si", 0.15);
381 
382  desc.add<edm::ParameterSetDescription>("sector_45", sector45);
383  }
384 
385  // sector_56
386  {
388 
390  rp_N.add<std::string>("name", "R_1_F");
391  rp_N.add<int>("id", 103);
392 
393  rp_N.add<double>("slope", 0.40);
394  rp_N.add<double>("sh_x", -2.8);
395 
396  rp_N.add<double>("x_min_fit_mode", 2.);
397  rp_N.add<double>("x_max_fit_mode", 7.4);
398  rp_N.add<double>("y_max_fit_mode", 7.4);
399  rp_N.add<double>("y_cen_add", -0.8);
400  rp_N.add<double>("y_width_mult", 1.0);
401 
402  rp_N.add<double>("x_slice_min", 6.);
403  rp_N.add<double>("x_slice_max", 17.);
404  rp_N.add<double>("x_slice_w", 0.2);
405  sector56.add<edm::ParameterSetDescription>("rp_N", rp_N);
406 
408  rp_F.add<std::string>("name", "R_2_F");
409  rp_F.add<int>("id", 123);
410 
411  rp_F.add<double>("slope", 0.39);
412  rp_F.add<double>("sh_x", -41.9);
413 
414  rp_F.add<double>("x_min_fit_mode", 2.);
415  rp_F.add<double>("x_max_fit_mode", 8.0);
416  rp_F.add<double>("y_max_fit_mode", 8.0);
417  rp_F.add<double>("y_cen_add", -0.8);
418  rp_F.add<double>("y_width_mult", 1.0);
419 
420  rp_F.add<double>("x_slice_min", 45.);
421  rp_F.add<double>("x_slice_max", 57.);
422  rp_F.add<double>("x_slice_w", 0.2);
423  sector56.add<edm::ParameterSetDescription>("rp_F", rp_F);
424 
425  sector56.add<double>("slope", -0.015);
426  sector56.add<bool>("cut_h_apply", true);
427  sector56.add<double>("cut_h_a", -1.);
428  sector56.add<double>("cut_h_c", -39.26);
429  sector56.add<double>("cut_h_si", 0.2);
430  sector56.add<bool>("cut_v_apply", true);
431  sector56.add<double>("cut_v_a", -1.07);
432  sector56.add<double>("cut_v_c", 1.49);
433  sector56.add<double>("cut_v_si", 0.15);
434 
435  desc.add<edm::ParameterSetDescription>("sector_56", sector56);
436  }
437 
438  desc.add<double>("x_ali_sh_step", 0.01);
439 
440  desc.add<double>("y_mode_sys_unc", 0.03);
441  desc.add<double>("chiSqThreshold", 50.);
442  desc.add<double>("y_mode_unc_max_valid", 5.);
443  desc.add<double>("y_mode_max_valid", 20.);
444 
445  desc.add<unsigned int>("min_RP_tracks_size", 1);
446  desc.add<unsigned int>("max_RP_tracks_size", 1);
447  desc.add<double>("n_si", 4.);
448 
449  // matching
450  {
452  matching.add<std::string>("reference_dataset", "");
453 
455  rpLF.add<double>("sh_min", -43.);
456  rpLF.add<double>("sh_max", -41.);
457  matching.add<edm::ParameterSetDescription>("rp_L_F", rpLF);
458 
460  rpLN.add<double>("sh_min", -4.2);
461  rpLN.add<double>("sh_max", -2.4);
462  matching.add<edm::ParameterSetDescription>("rp_L_N", rpLN);
463 
465  rpRN.add<double>("sh_min", -3.6);
466  rpRN.add<double>("sh_max", -1.8);
467  matching.add<edm::ParameterSetDescription>("rp_R_N", rpRN);
468 
470  rpRF.add<double>("sh_min", -43.2);
471  rpRF.add<double>("sh_max", -41.2);
472  matching.add<edm::ParameterSetDescription>("rp_R_F", rpRF);
473 
474  desc.add<edm::ParameterSetDescription>("matching", matching);
475  }
476 
477  // x alignment meth o
478  {
479  edm::ParameterSetDescription x_alignment_meth_o;
480 
482  rpLF.add<double>("x_min", 47.);
483  rpLF.add<double>("x_max", 56.5);
484  x_alignment_meth_o.add<edm::ParameterSetDescription>("rp_L_F", rpLF);
485 
487  rpLN.add<double>("x_min", 9.);
488  rpLN.add<double>("x_max", 18.5);
489  x_alignment_meth_o.add<edm::ParameterSetDescription>("rp_L_N", rpLN);
490 
492  rpRN.add<double>("x_min", 7.);
493  rpRN.add<double>("x_max", 15.);
494  x_alignment_meth_o.add<edm::ParameterSetDescription>("rp_R_N", rpRN);
495 
497  rpRF.add<double>("x_min", 46.);
498  rpRF.add<double>("x_max", 54.);
499  x_alignment_meth_o.add<edm::ParameterSetDescription>("rp_R_F", rpRF);
500 
501  x_alignment_meth_o.add<unsigned int>("fit_profile_min_bin_entries", 5);
502  x_alignment_meth_o.add<unsigned int>("fit_profile_min_N_reasonable", 10);
503  x_alignment_meth_o.add<unsigned int>("meth_o_graph_min_N", 5);
504  x_alignment_meth_o.add<double>("meth_o_unc_fit_range", 0.5);
505 
506  desc.add<edm::ParameterSetDescription>("x_alignment_meth_o", x_alignment_meth_o);
507  }
508 
509  // x alignment relative
510  {
511  edm::ParameterSetDescription x_alignment_relative;
512 
514  rpLN.add<double>("x_min", 7.5);
515  rpLN.add<double>("x_max", 12.);
516  x_alignment_relative.add<edm::ParameterSetDescription>("rp_L_N", rpLN);
517 
519  rpRN.add<double>("x_min", 6.);
520  rpRN.add<double>("x_max", 10.);
521  x_alignment_relative.add<edm::ParameterSetDescription>("rp_R_N", rpRN);
522 
523  x_alignment_relative.add<unsigned int>("near_far_min_entries", 100);
524 
525  desc.add<edm::ParameterSetDescription>("x_alignment_relative", x_alignment_relative);
526  }
527 
528  // y alignment
529  {
530  edm::ParameterSetDescription y_alignment;
531 
533  rpLF.add<double>("x_min", 44.5);
534  rpLF.add<double>("x_max", 49.);
535  y_alignment.add<edm::ParameterSetDescription>("rp_L_F", rpLF);
536 
538  rpLN.add<double>("x_min", 6.7);
539  rpLN.add<double>("x_max", 11.);
540  y_alignment.add<edm::ParameterSetDescription>("rp_L_N", rpLN);
541 
543  rpRN.add<double>("x_min", 5.9);
544  rpRN.add<double>("x_max", 10.);
545  y_alignment.add<edm::ParameterSetDescription>("rp_R_N", rpRN);
546 
548  rpRF.add<double>("x_min", 44.5);
549  rpRF.add<double>("x_max", 49.);
550  y_alignment.add<edm::ParameterSetDescription>("rp_R_F", rpRF);
551 
552  y_alignment.add<unsigned int>("mode_graph_min_N", 5);
553  y_alignment.add<unsigned int>("mult_sel_proj_y_min_entries", 300);
554 
555  desc.add<edm::ParameterSetDescription>("y_alignment", y_alignment);
556  }
557 
558  // binning
559  {
561 
562  binning.add<double>("bin_size_x", 142.3314E-3);
563  binning.add<unsigned int>("n_bins_x", 210);
564  binning.add<double>("pixel_x_offset", 40.);
565  binning.add<unsigned int>("n_bins_y", 400);
566  binning.add<double>("y_min", -20.);
567  binning.add<double>("y_max", 20.);
568 
569  binning.add<unsigned int>("diffFN_n_bins_x", 100);
570  binning.add<double>("diffFN_x_min", 0.);
571  binning.add<double>("diffFN_x_max", 20.);
572 
573  binning.add<unsigned int>("slice_n_bins_x", 100);
574  binning.add<double>("slice_x_min", -10.);
575  binning.add<double>("slice_x_max", 10.);
576  binning.add<unsigned int>("slice_n_bins_y", 100);
577  binning.add<double>("slice_y_min", -2.);
578  binning.add<double>("slice_y_max", 2.);
579 
580  desc.add<edm::ParameterSetDescription>("binning", binning);
581  }
582 
583  desc.add<std::vector<double>>("extra_params", {});
584 
585  descriptions.add("ppsAlignmentConfigurationESSource", desc);
586 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
PPSAlignmentConfiguration::Binning binning

◆ findDirectoryWithName()

TDirectory * PPSAlignmentConfigurationESSource::findDirectoryWithName ( TDirectory *  dir,
std::string  searchName 
)
private

Definition at line 592 of file PPSAlignmentConfigurationESSource.cc.

References DeadROC_duringRun::dir, dqmdumpme::k, Skims_PA_cff::name, GetRecoTauVFromDQM_MC_cff::next, EcalTangentSkim_cfg::o, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by PPSAlignmentConfigurationESSource().

592  {
593  TIter next(dir->GetListOfKeys());
594  std::queue<TDirectory*> dirQueue;
595  TObject* o;
596  while ((o = next())) {
597  TKey* k = (TKey*)o;
598 
599  std::string name = k->GetName();
600  if (name == searchName)
601  return dir;
602 
603  if (((TSystemFile*)k)->IsDirectory())
604  dirQueue.push((TDirectory*)k->ReadObj());
605  }
606 
607  while (!dirQueue.empty()) {
608  TDirectory* resultDir = findDirectoryWithName(dirQueue.front(), searchName);
609  dirQueue.pop();
610  if (resultDir != nullptr)
611  return resultDir;
612  }
613 
614  return nullptr;
615 }
TDirectory * findDirectoryWithName(TDirectory *dir, std::string searchName)

◆ produce()

std::unique_ptr< PPSAlignmentConfiguration > PPSAlignmentConfigurationESSource::produce ( const PPSAlignmentConfigurationRcd )

Definition at line 277 of file PPSAlignmentConfigurationESSource.cc.

References alignment_x_meth_o_ranges, alignment_x_relative_ranges, alignment_y_ranges, binning, chiSqThreshold, extraParams, fitProfileMinBinEntries, fitProfileMinNReasonable, label, matchingReferencePoints, matchingShiftRanges, maxRPTracksSize, methOGraphMinN, methOUncFitRange, minRPTracksSize, modeGraphMinN, multSelProjYMinEntries, n_si, nearFarMinEntries, AlCaHLTBitMon_ParallelJobs::p, sectorConfig45, sectorConfig56, x_ali_sh_step, y_mode_max_valid, y_mode_sys_unc, and y_mode_unc_max_valid.

278  {
279  auto p = std::make_unique<PPSAlignmentConfiguration>();
280 
281  p->setSectorConfig45(sectorConfig45);
282  p->setSectorConfig56(sectorConfig56);
283 
284  p->setX_ali_sh_step(x_ali_sh_step);
285 
286  p->setY_mode_sys_unc(y_mode_sys_unc);
287  p->setChiSqThreshold(chiSqThreshold);
288  p->setY_mode_unc_max_valid(y_mode_unc_max_valid);
289  p->setY_mode_max_valid(y_mode_max_valid);
290 
291  p->setMinRPTracksSize(minRPTracksSize);
292  p->setMaxRPTracksSize(maxRPTracksSize);
293  p->setN_si(n_si);
294 
295  p->setMatchingReferencePoints(matchingReferencePoints);
296  p->setMatchingShiftRanges(matchingShiftRanges);
297 
298  p->setAlignment_x_meth_o_ranges(alignment_x_meth_o_ranges);
299  p->setFitProfileMinBinEntries(fitProfileMinBinEntries);
300  p->setFitProfileMinNReasonable(fitProfileMinNReasonable);
301  p->setMethOGraphMinN(methOGraphMinN);
302  p->setMethOUncFitRange(methOUncFitRange);
303 
304  p->setAlignment_x_relative_ranges(alignment_x_relative_ranges);
305  p->setNearFarMinEntries(nearFarMinEntries);
306 
307  p->setAlignment_y_ranges(alignment_y_ranges);
308  p->setModeGraphMinN(modeGraphMinN);
309  p->setMultSelProjYMinEntries(multSelProjYMinEntries);
310 
311  p->setBinning(binning);
312 
313  p->setExtraParams(extraParams);
314 
315  edm::LogInfo("PPS") << "\n"
316  << "[ESSource] " << (label.empty() ? "empty label" : "label = " + label) << ":\n\n"
317  << (*p);
318 
319  return p;
320 }
PPSAlignmentConfiguration::SectorConfig sectorConfig56
std::map< unsigned int, PPSAlignmentConfiguration::SelectionRange > alignment_y_ranges
std::map< unsigned int, PPSAlignmentConfiguration::SelectionRange > alignment_x_relative_ranges
PPSAlignmentConfiguration::SectorConfig sectorConfig45
std::map< unsigned int, PPSAlignmentConfiguration::SelectionRange > matchingShiftRanges
std::map< unsigned int, std::vector< PPSAlignmentConfiguration::PointErrors > > matchingReferencePoints
Log< level::Info, false > LogInfo
PPSAlignmentConfiguration::Binning binning
std::map< unsigned int, PPSAlignmentConfiguration::SelectionRange > alignment_x_meth_o_ranges

◆ setIntervalFor()

void PPSAlignmentConfigurationESSource::setIntervalFor ( const edm::eventsetup::EventSetupRecordKey key,
const edm::IOVSyncValue iosv,
edm::ValidityInterval oValidity 
)
overrideprivatevirtual

Implements edm::EventSetupRecordIntervalFinder.

Definition at line 663 of file PPSAlignmentConfigurationESSource.cc.

References edm::IOVSyncValue::beginOfTime(), edm::IOVSyncValue::endOfTime(), edm::EventID::event(), edm::IOVSyncValue::eventID(), infinity, crabWrapper::key, and edm::EventID::run().

665  {
666  edm::LogInfo("PPS") << ">> PPSAlignmentConfigurationESSource::setIntervalFor(" << key.name() << ")\n"
667  << " run=" << iosv.eventID().run() << ", event=" << iosv.eventID().event();
668 
670  oValidity = infinity;
671 }
static const IOVSyncValue & endOfTime()
Definition: IOVSyncValue.cc:82
static const IOVSyncValue & beginOfTime()
Definition: IOVSyncValue.cc:88
const double infinity
Log< level::Info, false > LogInfo
RunNumber_t run() const
Definition: EventID.h:38
const EventID & eventID() const
Definition: IOVSyncValue.h:40
EventNumber_t event() const
Definition: EventID.h:40

Member Data Documentation

◆ alignment_x_meth_o_ranges

std::map<unsigned int, PPSAlignmentConfiguration::SelectionRange> PPSAlignmentConfigurationESSource::alignment_x_meth_o_ranges
private

◆ alignment_x_relative_ranges

std::map<unsigned int, PPSAlignmentConfiguration::SelectionRange> PPSAlignmentConfigurationESSource::alignment_x_relative_ranges
private

◆ alignment_y_ranges

std::map<unsigned int, PPSAlignmentConfiguration::SelectionRange> PPSAlignmentConfigurationESSource::alignment_y_ranges
private

◆ binning

PPSAlignmentConfiguration::Binning PPSAlignmentConfigurationESSource::binning
private

◆ chiSqThreshold

double PPSAlignmentConfigurationESSource::chiSqThreshold
private

◆ debug

bool PPSAlignmentConfigurationESSource::debug
private

◆ extraParams

std::vector<double> PPSAlignmentConfigurationESSource::extraParams
private

◆ fitProfileMinBinEntries

unsigned int PPSAlignmentConfigurationESSource::fitProfileMinBinEntries
private

◆ fitProfileMinNReasonable

unsigned int PPSAlignmentConfigurationESSource::fitProfileMinNReasonable
private

◆ label

std::string PPSAlignmentConfigurationESSource::label
private

◆ matchingReferencePoints

std::map<unsigned int, std::vector<PPSAlignmentConfiguration::PointErrors> > PPSAlignmentConfigurationESSource::matchingReferencePoints
private

◆ matchingShiftRanges

std::map<unsigned int, PPSAlignmentConfiguration::SelectionRange> PPSAlignmentConfigurationESSource::matchingShiftRanges
private

◆ maxRPTracksSize

unsigned int PPSAlignmentConfigurationESSource::maxRPTracksSize
private

◆ methOGraphMinN

unsigned int PPSAlignmentConfigurationESSource::methOGraphMinN
private

◆ methOUncFitRange

double PPSAlignmentConfigurationESSource::methOUncFitRange
private

◆ minRPTracksSize

unsigned int PPSAlignmentConfigurationESSource::minRPTracksSize
private

◆ modeGraphMinN

unsigned int PPSAlignmentConfigurationESSource::modeGraphMinN
private

◆ multSelProjYMinEntries

unsigned int PPSAlignmentConfigurationESSource::multSelProjYMinEntries
private

◆ n_si

double PPSAlignmentConfigurationESSource::n_si
private

◆ nearFarMinEntries

unsigned int PPSAlignmentConfigurationESSource::nearFarMinEntries
private

◆ sectorConfig45

PPSAlignmentConfiguration::SectorConfig PPSAlignmentConfigurationESSource::sectorConfig45
private

◆ sectorConfig56

PPSAlignmentConfiguration::SectorConfig PPSAlignmentConfigurationESSource::sectorConfig56
private

◆ x_ali_sh_step

double PPSAlignmentConfigurationESSource::x_ali_sh_step
private

◆ y_mode_max_valid

double PPSAlignmentConfigurationESSource::y_mode_max_valid
private

◆ y_mode_sys_unc

double PPSAlignmentConfigurationESSource::y_mode_sys_unc
private

◆ y_mode_unc_max_valid

double PPSAlignmentConfigurationESSource::y_mode_unc_max_valid
private