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
PPSAlignmentConfigESSource Class Reference
Inheritance diagram for PPSAlignmentConfigESSource:
edm::ESProducer edm::EventSetupRecordIntervalFinder edm::ESProxyFactoryProducer edm::eventsetup::DataProxyProvider

Public Member Functions

 PPSAlignmentConfigESSource (const edm::ParameterSet &iConfig)
 
std::unique_ptr
< PPSAlignmentConfig
produce (const PPSAlignmentConfigRcd &)
 
- 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< PointErrorsbuildVectorFromDirectory (TDirectory *dir, const 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,
SelectionRange
alignment_x_meth_o_ranges
 
std::map< unsigned int,
SelectionRange
alignment_x_relative_ranges
 
std::map< unsigned int,
SelectionRange
alignment_y_ranges
 
Binning binning
 
double chiSqThreshold
 
bool debug
 
unsigned int fitProfileMinBinEntries
 
unsigned int fitProfileMinNReasonable
 
std::string label
 
std::map< unsigned int,
std::vector< PointErrors > > 
matchingReferencePoints
 
std::map< unsigned int,
SelectionRange
matchingShiftRanges
 
unsigned int maxRPTracksSize
 
unsigned int methOGraphMinN
 
double methOUncFitRange
 
unsigned int modeGraphMinN
 
unsigned int multSelProjYMinEntries
 
double n_si
 
unsigned int nearFarMinEntries
 
std::string resultsDir
 
SectorConfig sectorConfig45
 
SectorConfig sectorConfig56
 
std::vector< std::string > sequence
 
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 41 of file PPSAlignmentConfigESSource.cc.

Constructor & Destructor Documentation

PPSAlignmentConfigESSource::PPSAlignmentConfigESSource ( const edm::ParameterSet iConfig)

Definition at line 97 of file PPSAlignmentConfigESSource.cc.

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

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

Member Function Documentation

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

Definition at line 640 of file PPSAlignmentConfigESSource.cc.

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

Referenced by PPSAlignmentConfigESSource().

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

Definition at line 316 of file PPSAlignmentConfigESSource.cc.

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

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

Definition at line 612 of file PPSAlignmentConfigESSource.cc.

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

Referenced by PPSAlignmentConfigESSource().

612  {
613  TIter next(dir->GetListOfKeys());
614  std::queue<TDirectory *> dirQueue;
615  TObject *o;
616  while ((o = next())) {
617  TKey *k = (TKey *)o;
618 
619  std::string name = k->GetName();
620  if (name == searchName)
621  return dir;
622 
623  if (((TSystemFile *)k)->IsDirectory())
624  dirQueue.push((TDirectory *)k->ReadObj());
625  }
626 
627  while (!dirQueue.empty()) {
628  TDirectory *resultDir = findDirectoryWithName(dirQueue.front(), searchName);
629  dirQueue.pop();
630  if (resultDir != nullptr)
631  return resultDir;
632  }
633 
634  return nullptr;
635 }
TDirectory * findDirectoryWithName(TDirectory *dir, std::string searchName)
int PPSAlignmentConfigESSource::fitProfile ( TProfile *  p,
double  x_mean,
double  x_rms,
double &  sl,
double &  sl_unc 
)
private

Definition at line 581 of file PPSAlignmentConfigESSource.cc.

References fitProfileMinBinEntries, and fitProfileMinNReasonable.

Referenced by buildVectorFromDirectory().

581  {
582  unsigned int n_reasonable = 0;
583  for (int bi = 1; bi <= p->GetNbinsX(); bi++) {
584  if (p->GetBinEntries(bi) < fitProfileMinBinEntries) {
585  p->SetBinContent(bi, 0.);
586  p->SetBinError(bi, 0.);
587  } else {
588  n_reasonable++;
589  }
590  }
591 
592  if (n_reasonable < fitProfileMinNReasonable)
593  return 1;
594 
595  double xMin = x_mean - x_rms, xMax = x_mean + x_rms;
596 
597  TF1 *ff_pol1 = new TF1("ff_pol1", "[0] + [1]*x");
598 
599  ff_pol1->SetParameter(0., 0.);
600  p->Fit(ff_pol1, "Q", "", xMin, xMax);
601 
602  sl = ff_pol1->GetParameter(1);
603  sl_unc = ff_pol1->GetParError(1);
604 
605  return 0;
606 }
std::unique_ptr< PPSAlignmentConfig > PPSAlignmentConfigESSource::produce ( const PPSAlignmentConfigRcd )

Definition at line 269 of file PPSAlignmentConfigESSource.cc.

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

269  {
270  auto p = std::make_unique<PPSAlignmentConfig>();
271 
272  p->setSequence(sequence);
273  p->setResultsDir(resultsDir);
274 
275  p->setSectorConfig45(sectorConfig45);
276  p->setSectorConfig56(sectorConfig56);
277 
278  p->setX_ali_sh_step(x_ali_sh_step);
279 
280  p->setY_mode_sys_unc(y_mode_sys_unc);
281  p->setChiSqThreshold(chiSqThreshold);
282  p->setY_mode_unc_max_valid(y_mode_unc_max_valid);
283  p->setY_mode_max_valid(y_mode_max_valid);
284 
285  p->setMaxRPTracksSize(maxRPTracksSize);
286  p->setN_si(n_si);
287 
288  p->setMatchingReferencePoints(matchingReferencePoints);
289  p->setMatchingShiftRanges(matchingShiftRanges);
290 
291  p->setAlignment_x_meth_o_ranges(alignment_x_meth_o_ranges);
292  p->setFitProfileMinBinEntries(fitProfileMinBinEntries);
293  p->setFitProfileMinNReasonable(fitProfileMinNReasonable);
294  p->setMethOGraphMinN(methOGraphMinN);
295  p->setMethOUncFitRange(methOUncFitRange);
296 
297  p->setAlignment_x_relative_ranges(alignment_x_relative_ranges);
298  p->setNearFarMinEntries(nearFarMinEntries);
299 
300  p->setAlignment_y_ranges(alignment_y_ranges);
301  p->setModeGraphMinN(modeGraphMinN);
302  p->setMultSelProjYMinEntries(multSelProjYMinEntries);
303 
304  p->setBinning(binning);
305 
306  edm::LogInfo("PPS") << "\n"
307  << "[ESSource] " << (label.empty() ? "empty label" : "label = " + label) << ":\n\n"
308  << (*p);
309 
310  return p;
311 }
std::map< unsigned int, SelectionRange > alignment_x_meth_o_ranges
std::map< unsigned int, SelectionRange > alignment_y_ranges
std::vector< std::string > sequence
std::map< unsigned int, std::vector< PointErrors > > matchingReferencePoints
std::map< unsigned int, SelectionRange > alignment_x_relative_ranges
std::map< unsigned int, SelectionRange > matchingShiftRanges
Log< level::Info, false > LogInfo
void PPSAlignmentConfigESSource::setIntervalFor ( const edm::eventsetup::EventSetupRecordKey key,
const edm::IOVSyncValue iosv,
edm::ValidityInterval oValidity 
)
overrideprivatevirtual

Implements edm::EventSetupRecordIntervalFinder.

Definition at line 680 of file PPSAlignmentConfigESSource.cc.

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

682  {
683  edm::LogInfo("PPS") << ">> PPSAlignmentConfigESSource::setIntervalFor(" << key.name() << ")\n"
684  << " run=" << iosv.eventID().run() << ", event=" << iosv.eventID().event();
685 
687  oValidity = infinity;
688 }
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, SelectionRange> PPSAlignmentConfigESSource::alignment_x_meth_o_ranges
private

Definition at line 77 of file PPSAlignmentConfigESSource.cc.

Referenced by PPSAlignmentConfigESSource(), and produce().

std::map<unsigned int, SelectionRange> PPSAlignmentConfigESSource::alignment_x_relative_ranges
private

Definition at line 83 of file PPSAlignmentConfigESSource.cc.

Referenced by PPSAlignmentConfigESSource(), and produce().

std::map<unsigned int, SelectionRange> PPSAlignmentConfigESSource::alignment_y_ranges
private

Definition at line 86 of file PPSAlignmentConfigESSource.cc.

Referenced by PPSAlignmentConfigESSource(), and produce().

Binning PPSAlignmentConfigESSource::binning
private
double PPSAlignmentConfigESSource::chiSqThreshold
private

Definition at line 67 of file PPSAlignmentConfigESSource.cc.

Referenced by PPSAlignmentConfigESSource(), and produce().

bool PPSAlignmentConfigESSource::debug
private
unsigned int PPSAlignmentConfigESSource::fitProfileMinBinEntries
private

Definition at line 78 of file PPSAlignmentConfigESSource.cc.

Referenced by fitProfile(), PPSAlignmentConfigESSource(), and produce().

unsigned int PPSAlignmentConfigESSource::fitProfileMinNReasonable
private

Definition at line 79 of file PPSAlignmentConfigESSource.cc.

Referenced by fitProfile(), PPSAlignmentConfigESSource(), and produce().

std::string PPSAlignmentConfigESSource::label
private
std::map<unsigned int, std::vector<PointErrors> > PPSAlignmentConfigESSource::matchingReferencePoints
private

Definition at line 74 of file PPSAlignmentConfigESSource.cc.

Referenced by PPSAlignmentConfigESSource(), and produce().

std::map<unsigned int, SelectionRange> PPSAlignmentConfigESSource::matchingShiftRanges
private

Definition at line 75 of file PPSAlignmentConfigESSource.cc.

Referenced by PPSAlignmentConfigESSource(), and produce().

unsigned int PPSAlignmentConfigESSource::maxRPTracksSize
private

Definition at line 71 of file PPSAlignmentConfigESSource.cc.

Referenced by PPSAlignmentConfigESSource(), and produce().

unsigned int PPSAlignmentConfigESSource::methOGraphMinN
private

Definition at line 80 of file PPSAlignmentConfigESSource.cc.

Referenced by PPSAlignmentConfigESSource(), and produce().

double PPSAlignmentConfigESSource::methOUncFitRange
private

Definition at line 81 of file PPSAlignmentConfigESSource.cc.

Referenced by PPSAlignmentConfigESSource(), and produce().

unsigned int PPSAlignmentConfigESSource::modeGraphMinN
private

Definition at line 87 of file PPSAlignmentConfigESSource.cc.

Referenced by PPSAlignmentConfigESSource(), and produce().

unsigned int PPSAlignmentConfigESSource::multSelProjYMinEntries
private

Definition at line 88 of file PPSAlignmentConfigESSource.cc.

Referenced by PPSAlignmentConfigESSource(), and produce().

double PPSAlignmentConfigESSource::n_si
private

Definition at line 72 of file PPSAlignmentConfigESSource.cc.

Referenced by PPSAlignmentConfigESSource(), and produce().

unsigned int PPSAlignmentConfigESSource::nearFarMinEntries
private

Definition at line 84 of file PPSAlignmentConfigESSource.cc.

Referenced by PPSAlignmentConfigESSource(), and produce().

std::string PPSAlignmentConfigESSource::resultsDir
private

Definition at line 60 of file PPSAlignmentConfigESSource.cc.

Referenced by PPSAlignmentConfigESSource(), and produce().

SectorConfig PPSAlignmentConfigESSource::sectorConfig45
private

Definition at line 62 of file PPSAlignmentConfigESSource.cc.

Referenced by PPSAlignmentConfigESSource(), and produce().

SectorConfig PPSAlignmentConfigESSource::sectorConfig56
private

Definition at line 62 of file PPSAlignmentConfigESSource.cc.

Referenced by PPSAlignmentConfigESSource(), and produce().

std::vector<std::string> PPSAlignmentConfigESSource::sequence
private
double PPSAlignmentConfigESSource::x_ali_sh_step
private

Definition at line 64 of file PPSAlignmentConfigESSource.cc.

Referenced by PPSAlignmentConfigESSource(), and produce().

double PPSAlignmentConfigESSource::y_mode_max_valid
private

Definition at line 69 of file PPSAlignmentConfigESSource.cc.

Referenced by PPSAlignmentConfigESSource(), and produce().

double PPSAlignmentConfigESSource::y_mode_sys_unc
private

Definition at line 66 of file PPSAlignmentConfigESSource.cc.

Referenced by PPSAlignmentConfigESSource(), and produce().

double PPSAlignmentConfigESSource::y_mode_unc_max_valid
private

Definition at line 68 of file PPSAlignmentConfigESSource.cc.

Referenced by PPSAlignmentConfigESSource(), and produce().