CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
< PPSAlignmentConfiguration
produce (const PPSAlignmentConfigurationRcd &)
 
- Public Member Functions inherited from edm::ESProducer
 ESProducer ()
 
 ESProducer (const 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
 
ESProducer const & operator= (const 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::ComponentDescription
descriptionForFinder () const
 
 EventSetupRecordIntervalFinder ()
 
 EventSetupRecordIntervalFinder (const EventSetupRecordIntervalFinder &)=delete
 
std::set
< eventsetup::EventSetupRecordKey
findingForRecords () const
 
const ValidityIntervalfindIntervalFor (const eventsetup::EventSetupRecordKey &, const IOVSyncValue &)
 
bool nonconcurrentAndIOVNeedsUpdate (const eventsetup::EventSetupRecordKey &key, const IOVSyncValue &syncValue) const
 
const
EventSetupRecordIntervalFinder
operator= (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::PointErrors
buildVectorFromDirectory (TDirectory *dir, const PPSAlignmentConfiguration::RPConfig &rpd)
 
TDirectory * findDirectoryWithName (TDirectory *dir, std::string searchName)
 
int fitProfile (TProfile *p, double x_mean, double x_rms, double &sl, double &sl_unc)
 
void setIntervalFor (const edm::eventsetup::EventSetupRecordKey &key, const edm::IOVSyncValue &iosv, edm::ValidityInterval &oValidity) override
 

Private Attributes

std::map< unsigned int,
PPSAlignmentConfiguration::SelectionRange
alignment_x_meth_o_ranges
 
std::map< unsigned int,
PPSAlignmentConfiguration::SelectionRange
alignment_x_relative_ranges
 
std::map< unsigned int,
PPSAlignmentConfiguration::SelectionRange
alignment_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::SelectionRange
matchingShiftRanges
 
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
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 TArg >
ESConsumesCollectorT< TRecord > setWhatProduced (T *iThis, TReturn(T::*iMethod)(const TRecord &), const TArg &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 35 of file PPSAlignmentConfigurationESSource.cc.

Constructor & Destructor Documentation

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

Definition at line 92 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.

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

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

Definition at line 651 of file PPSAlignmentConfigurationESSource.cc.

References ztail::d, debug, fitProfile(), isotrackApplyRegressor::k, mergeVDriftHistosByStation::name, GetRecoTauVFromDQM_MC_cff::next, class-composition::o, MetAnalyzer::pv(), AlCaHLTBitMon_QueryRunRegistry::string, PPSAlignmentConfiguration::RPConfig::y_cen_add_, and PPSAlignmentConfiguration::RPConfig::y_width_mult_.

Referenced by PPSAlignmentConfigurationESSource().

652  {
653  std::vector<PPSAlignmentConfiguration::PointErrors> pv;
654 
655  TIter next(dir->GetListOfKeys());
656  TObject* o;
657  while ((o = next())) {
658  TKey* k = (TKey*)o;
659 
660  std::string name = k->GetName();
661  size_t d = name.find('-');
662  const double x_min = std::stod(name.substr(0, d));
663  const double x_max = std::stod(name.substr(d + 1));
664 
665  TDirectory* d_slice = (TDirectory*)k->ReadObj();
666 
667  TH1D* h_y = (TH1D*)d_slice->Get("h_y");
668  TProfile* p_y_diffFN_vs_y = (TProfile*)d_slice->Get("p_y_diffFN_vs_y");
669 
670  double y_cen = h_y->GetMean();
671  double y_width = h_y->GetRMS();
672 
673  y_cen += rpd.y_cen_add_;
674  y_width *= rpd.y_width_mult_;
675 
676  double sl = 0., sl_unc = 0.;
677  int fr = fitProfile(p_y_diffFN_vs_y, y_cen, y_width, sl, sl_unc);
678  if (fr != 0)
679  continue;
680 
681  if (debug)
682  p_y_diffFN_vs_y->Write(name.c_str());
683 
684  pv.push_back({(x_max + x_min) / 2., sl, (x_max - x_min) / 2., sl_unc});
685  }
686 
687  return pv;
688 }
tuple d
Definition: ztail.py:151
int fitProfile(TProfile *p, double x_mean, double x_rms, double &sl, double &sl_unc)
void PPSAlignmentConfigurationESSource::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 326 of file PPSAlignmentConfigurationESSource.cc.

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

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

Definition at line 623 of file PPSAlignmentConfigurationESSource.cc.

References DeadROC_duringRun::dir, isotrackApplyRegressor::k, mergeVDriftHistosByStation::name, GetRecoTauVFromDQM_MC_cff::next, class-composition::o, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by PPSAlignmentConfigurationESSource().

623  {
624  TIter next(dir->GetListOfKeys());
625  std::queue<TDirectory*> dirQueue;
626  TObject* o;
627  while ((o = next())) {
628  TKey* k = (TKey*)o;
629 
630  std::string name = k->GetName();
631  if (name == searchName)
632  return dir;
633 
634  if (((TSystemFile*)k)->IsDirectory())
635  dirQueue.push((TDirectory*)k->ReadObj());
636  }
637 
638  while (!dirQueue.empty()) {
639  TDirectory* resultDir = findDirectoryWithName(dirQueue.front(), searchName);
640  dirQueue.pop();
641  if (resultDir != nullptr)
642  return resultDir;
643  }
644 
645  return nullptr;
646 }
TDirectory * findDirectoryWithName(TDirectory *dir, std::string searchName)
int PPSAlignmentConfigurationESSource::fitProfile ( TProfile *  p,
double  x_mean,
double  x_rms,
double &  sl,
double &  sl_unc 
)
private

Definition at line 592 of file PPSAlignmentConfigurationESSource.cc.

References fitProfileMinBinEntries, and fitProfileMinNReasonable.

Referenced by buildVectorFromDirectory().

592  {
593  unsigned int n_reasonable = 0;
594  for (int bi = 1; bi <= p->GetNbinsX(); bi++) {
595  if (p->GetBinEntries(bi) < fitProfileMinBinEntries) {
596  p->SetBinContent(bi, 0.);
597  p->SetBinError(bi, 0.);
598  } else {
599  n_reasonable++;
600  }
601  }
602 
603  if (n_reasonable < fitProfileMinNReasonable)
604  return 1;
605 
606  double x_min = x_mean - x_rms, x_max = x_mean + x_rms;
607 
608  TF1* ff_pol1 = new TF1("ff_pol1", "[0] + [1]*x");
609 
610  ff_pol1->SetParameter(0., 0.);
611  p->Fit(ff_pol1, "Q", "", x_min, x_max);
612 
613  sl = ff_pol1->GetParameter(1);
614  sl_unc = ff_pol1->GetParError(1);
615 
616  return 0;
617 }
std::unique_ptr< PPSAlignmentConfiguration > PPSAlignmentConfigurationESSource::produce ( const PPSAlignmentConfigurationRcd )

Definition at line 278 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.

279  {
280  auto p = std::make_unique<PPSAlignmentConfiguration>();
281 
282  p->setSectorConfig45(sectorConfig45);
283  p->setSectorConfig56(sectorConfig56);
284 
285  p->setX_ali_sh_step(x_ali_sh_step);
286 
287  p->setY_mode_sys_unc(y_mode_sys_unc);
288  p->setChiSqThreshold(chiSqThreshold);
289  p->setY_mode_unc_max_valid(y_mode_unc_max_valid);
290  p->setY_mode_max_valid(y_mode_max_valid);
291 
292  p->setMinRPTracksSize(minRPTracksSize);
293  p->setMaxRPTracksSize(maxRPTracksSize);
294  p->setN_si(n_si);
295 
296  p->setMatchingReferencePoints(matchingReferencePoints);
297  p->setMatchingShiftRanges(matchingShiftRanges);
298 
299  p->setAlignment_x_meth_o_ranges(alignment_x_meth_o_ranges);
300  p->setFitProfileMinBinEntries(fitProfileMinBinEntries);
301  p->setFitProfileMinNReasonable(fitProfileMinNReasonable);
302  p->setMethOGraphMinN(methOGraphMinN);
303  p->setMethOUncFitRange(methOUncFitRange);
304 
305  p->setAlignment_x_relative_ranges(alignment_x_relative_ranges);
306  p->setNearFarMinEntries(nearFarMinEntries);
307 
308  p->setAlignment_y_ranges(alignment_y_ranges);
309  p->setModeGraphMinN(modeGraphMinN);
310  p->setMultSelProjYMinEntries(multSelProjYMinEntries);
311 
312  p->setBinning(binning);
313 
314  p->setExtraParams(extraParams);
315 
316  edm::LogInfo("PPS") << "\n"
317  << "[ESSource] " << (label.empty() ? "empty label" : "label = " + label) << ":\n\n"
318  << (*p);
319 
320  return p;
321 }
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
void PPSAlignmentConfigurationESSource::setIntervalFor ( const edm::eventsetup::EventSetupRecordKey key,
const edm::IOVSyncValue iosv,
edm::ValidityInterval oValidity 
)
overrideprivatevirtual

Implements edm::EventSetupRecordIntervalFinder.

Definition at line 692 of file PPSAlignmentConfigurationESSource.cc.

References edm::IOVSyncValue::beginOfTime(), edm::IOVSyncValue::endOfTime(), edm::EventID::event(), edm::IOVSyncValue::eventID(), infinity, edm::eventsetup::EventSetupRecordKey::name(), and edm::EventID::run().

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

Member Data Documentation

std::map<unsigned int, PPSAlignmentConfiguration::SelectionRange> PPSAlignmentConfigurationESSource::alignment_x_meth_o_ranges
private
std::map<unsigned int, PPSAlignmentConfiguration::SelectionRange> PPSAlignmentConfigurationESSource::alignment_x_relative_ranges
private
std::map<unsigned int, PPSAlignmentConfiguration::SelectionRange> PPSAlignmentConfigurationESSource::alignment_y_ranges
private
PPSAlignmentConfiguration::Binning PPSAlignmentConfigurationESSource::binning
private
double PPSAlignmentConfigurationESSource::chiSqThreshold
private
bool PPSAlignmentConfigurationESSource::debug
private
std::vector<double> PPSAlignmentConfigurationESSource::extraParams
private
unsigned int PPSAlignmentConfigurationESSource::fitProfileMinBinEntries
private
unsigned int PPSAlignmentConfigurationESSource::fitProfileMinNReasonable
private
std::string PPSAlignmentConfigurationESSource::label
private
std::map<unsigned int, std::vector<PPSAlignmentConfiguration::PointErrors> > PPSAlignmentConfigurationESSource::matchingReferencePoints
private
std::map<unsigned int, PPSAlignmentConfiguration::SelectionRange> PPSAlignmentConfigurationESSource::matchingShiftRanges
private
unsigned int PPSAlignmentConfigurationESSource::maxRPTracksSize
private
unsigned int PPSAlignmentConfigurationESSource::methOGraphMinN
private
double PPSAlignmentConfigurationESSource::methOUncFitRange
private
unsigned int PPSAlignmentConfigurationESSource::minRPTracksSize
private
unsigned int PPSAlignmentConfigurationESSource::modeGraphMinN
private
unsigned int PPSAlignmentConfigurationESSource::multSelProjYMinEntries
private
double PPSAlignmentConfigurationESSource::n_si
private
unsigned int PPSAlignmentConfigurationESSource::nearFarMinEntries
private
PPSAlignmentConfiguration::SectorConfig PPSAlignmentConfigurationESSource::sectorConfig45
private
PPSAlignmentConfiguration::SectorConfig PPSAlignmentConfigurationESSource::sectorConfig56
private
double PPSAlignmentConfigurationESSource::x_ali_sh_step
private
double PPSAlignmentConfigurationESSource::y_mode_max_valid
private
double PPSAlignmentConfigurationESSource::y_mode_sys_unc
private
double PPSAlignmentConfigurationESSource::y_mode_unc_max_valid
private