CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
CTPPSCompositeESSource Class Reference
Inheritance diagram for CTPPSCompositeESSource:
edm::ESProducer edm::EventSetupRecordIntervalFinder edm::ESProductResolverFactoryProducer edm::eventsetup::ESProductResolverProvider

Classes

struct  BinData
 
struct  ProfileData
 

Public Member Functions

 CTPPSCompositeESSource (const edm::ParameterSet &)
 
std::unique_ptr< PPSDirectSimulationDataproduceDirectSimuData (const PPSDirectSimulationDataRcd &)
 
std::unique_ptr< LHCInfoproduceLhcInfo (const LHCInfoRcd &)
 
std::shared_ptr< CTPPSRPAlignmentCorrectionsDataproduceMisalignedAlignments (const RPMisalignedAlignmentRecord &)
 
std::shared_ptr< CTPPSGeometryproduceMisalignedTG (const VeryForwardMisalignedGeometryRecord &)
 
std::unique_ptr< LHCOpticalFunctionsSetCollectionproduceOptics (const CTPPSOpticsRcd &)
 
std::shared_ptr< CTPPSRPAlignmentCorrectionsDataproduceRealAlignments (const RPRealAlignmentRecord &)
 
std::shared_ptr< CTPPSGeometryproduceRealTG (const VeryForwardRealGeometryRecord &)
 
- Public Member Functions inherited from edm::ESProducer
 ESProducer ()
 
 ESProducer (const ESProducer &)=delete
 
 ESProducer (ESProducer &&)=delete
 
ESResolverIndex 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< ESResolverIndex > > updateFromMayConsumes (unsigned int iIndex, const Record &iRecord) const
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &) final
 
 ~ESProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::ESProductResolverFactoryProducer
 ESProductResolverFactoryProducer ()
 
 ESProductResolverFactoryProducer (const ESProductResolverFactoryProducer &)=delete
 
const ESProductResolverFactoryProduceroperator= (const ESProductResolverFactoryProducer &)=delete
 
 ~ESProductResolverFactoryProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::eventsetup::ESProductResolverProvider
void createKeyedResolvers (EventSetupRecordKey const &key, unsigned int nConcurrentIOVs)
 
const ComponentDescriptiondescription () const
 
 ESProductResolverProvider ()
 
 ESProductResolverProvider (const ESProductResolverProvider &)=delete
 
void fillRecordsNotAllowingConcurrentIOVs (std::set< EventSetupRecordKey > &recordsNotAllowingConcurrentIOVs) const
 
virtual void initConcurrentIOVs (EventSetupRecordKey const &key, unsigned int nConcurrentIOVs)
 
bool isUsingRecord (const EventSetupRecordKey &key) const
 
KeyedResolverskeyedResolvers (const EventSetupRecordKey &iRecordKey, unsigned int iovIndex=0)
 
const ESProductResolverProvideroperator= (const ESProductResolverProvider &)=delete
 
void setAppendToDataLabel (const edm::ParameterSet &)
 
void setDescription (const ComponentDescription &iDescription)
 
std::set< EventSetupRecordKeyusingRecords () const
 
virtual ~ESProductResolverProvider () 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 &)
 
- Static Public Member Functions inherited from edm::eventsetup::ESProductResolverProvider
static void prevalidate (ConfigurationDescriptions &)
 

Private Member Functions

void buildAlignment (const edm::ParameterSet &profile, ProfileData &pData)
 
void buildDirectSimuData (const edm::ParameterSet &profile, ProfileData &pData)
 
void buildGeometry (const DDCompactView &cpv)
 
void buildLHCInfo (const edm::ParameterSet &profile, ProfileData &pData)
 
void buildOptics (const edm::ParameterSet &profile, ProfileData &pData)
 
void setIntervalFor (const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &) override
 

Private Attributes

std::string compactViewTag_
 
const ProfileDatacurrentProfile_
 
unsigned int generateEveryNEvents_
 
bool geometryBuilt_
 
const bool isRun2_
 
std::string lhcInfoLabel_
 
std::unique_ptr< CLHEP::HepRandomEngine > m_engine_
 
std::string opticsLabel_
 
edm::EventID previously_set_eventID_
 
std::vector< BinData< ProfileData > > profile_bins_
 
edm::ESGetToken< DDCompactView, IdealGeometryRecordtokenCompactViewMisaligned_
 
edm::ESGetToken< DDCompactView, IdealGeometryRecordtokenCompactViewReal_
 
unsigned int verbosity_
 

Additional Inherited Members

- Protected Types inherited from edm::ESProductResolverFactoryProducer
using EventSetupRecordKey = eventsetup::EventSetupRecordKey
 
- Protected Types inherited from edm::eventsetup::ESProductResolverProvider
using KeyedResolversVector = std::vector< std::pair< DataKey, std::shared_ptr< ESProductResolver > >>
 
- 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::ESProductResolverFactoryProducer
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::ESProductResolverFactoryBase > iFactory, const std::string &iLabel=std::string())
 
KeyedResolversVector registerResolvers (const EventSetupRecordKey &, unsigned int iovIndex) override
 
- Protected Member Functions inherited from edm::eventsetup::ESProductResolverProvider
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 50 of file CTPPSCompositeESSource.cc.

Constructor & Destructor Documentation

◆ CTPPSCompositeESSource()

CTPPSCompositeESSource::CTPPSCompositeESSource ( const edm::ParameterSet conf)

Definition at line 138 of file CTPPSCompositeESSource.cc.

References newFWLiteAna::bin, buildAlignment(), buildDirectSimuData(), buildLHCInfo(), buildOptics(), looper::cfg, compactViewTag_, edm::ParameterSet::getParameter(), lhcInfoLabel_, opticsLabel_, produceDirectSimuData(), produceLhcInfo(), produceMisalignedTG(), produceOptics(), produceRealTG(), profile_bins_, edm::ESProducer::setWhatProduced(), tokenCompactViewMisaligned_, and tokenCompactViewReal_.

139  : compactViewTag_(conf.getParameter<std::string>("compactViewTag")),
140  lhcInfoLabel_(conf.getParameter<std::string>("lhcInfoLabel")),
141  opticsLabel_(conf.getParameter<std::string>("opticsLabel")),
142  generateEveryNEvents_(conf.getUntrackedParameter<unsigned int>("generateEveryNEvents")),
143  verbosity_(conf.getUntrackedParameter<unsigned int>("verbosity")),
144  isRun2_(conf.getParameter<bool>("isRun2")),
145  m_engine_(new CLHEP::HepJamesRandom(conf.getParameter<unsigned int>("seed"))),
146  geometryBuilt_(false) {
147  double l_int_sum = 0;
148 
149  for (const auto &cfg : conf.getParameter<std::vector<edm::ParameterSet>>("periods")) {
150  double l_int = cfg.getParameter<double>("L_int");
151 
152  profile_bins_.emplace_back(BinData<ProfileData>{l_int_sum, l_int_sum + l_int, ProfileData()});
153 
154  l_int_sum += l_int;
155 
156  auto &pData = profile_bins_.back().data;
157 
158  buildLHCInfo(cfg, pData);
159  buildOptics(cfg, pData);
160  buildAlignment(cfg, pData);
161  buildDirectSimuData(cfg, pData);
162  }
163 
164  // normalise L_int sums to probabilities
165  for (auto &bin : profile_bins_) {
166  bin.min /= l_int_sum;
167  bin.max /= l_int_sum;
168  }
169 
170  // framework registrations
174 
180 
181  findingRecord<LHCInfoRcd>();
182  findingRecord<CTPPSOpticsRcd>();
183  findingRecord<PPSDirectSimulationDataRcd>();
184  findingRecord<RPRealAlignmentRecord>();
185  findingRecord<RPMisalignedAlignmentRecord>();
186  findingRecord<VeryForwardRealGeometryRecord>();
187  findingRecord<VeryForwardMisalignedGeometryRecord>();
188 }
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:166
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
void buildAlignment(const edm::ParameterSet &profile, ProfileData &pData)
void buildLHCInfo(const edm::ParameterSet &profile, ProfileData &pData)
std::shared_ptr< CTPPSGeometry > produceMisalignedTG(const VeryForwardMisalignedGeometryRecord &)
void buildDirectSimuData(const edm::ParameterSet &profile, ProfileData &pData)
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:81
std::unique_ptr< CLHEP::HepRandomEngine > m_engine_
void buildOptics(const edm::ParameterSet &profile, ProfileData &pData)
T getUntrackedParameter(std::string const &, T const &) const
std::unique_ptr< PPSDirectSimulationData > produceDirectSimuData(const PPSDirectSimulationDataRcd &)
edm::ESGetToken< DDCompactView, IdealGeometryRecord > tokenCompactViewReal_
std::vector< BinData< ProfileData > > profile_bins_
std::unique_ptr< LHCInfo > produceLhcInfo(const LHCInfoRcd &)
std::unique_ptr< LHCOpticalFunctionsSetCollection > produceOptics(const CTPPSOpticsRcd &)
std::shared_ptr< CTPPSGeometry > produceRealTG(const VeryForwardRealGeometryRecord &)
edm::ESGetToken< DDCompactView, IdealGeometryRecord > tokenCompactViewMisaligned_

Member Function Documentation

◆ buildAlignment()

void CTPPSCompositeESSource::buildAlignment ( const edm::ParameterSet profile,
ProfileData pData 
)
private

Definition at line 355 of file CTPPSCompositeESSource.cc.

References CTPPSCompositeESSource::ProfileData::acMisaligned, CTPPSCompositeESSource::ProfileData::acReal, CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon::acsMisaligned, CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon::acsReal, edm::ParameterSet::addUntrackedParameter(), looper::cfg, and verbosity_.

Referenced by CTPPSCompositeESSource().

355  {
356  // load alignment data
357  auto ctppsRPAlignmentCorrectionsDataXMLPSet =
358  cfg.getParameter<edm::ParameterSet>("ctppsRPAlignmentCorrectionsDataXML");
359  ctppsRPAlignmentCorrectionsDataXMLPSet.addUntrackedParameter("verbosity", verbosity_);
360 
361  CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon ctppsRPAlignmentCorrectionsDataESSourceXMLCommon(
362  ctppsRPAlignmentCorrectionsDataXMLPSet);
363 
364  // store the first entry from the alignment sequence (more cannot be done)
365  pData.acReal = std::make_shared<CTPPSRPAlignmentCorrectionsData>(
366  ctppsRPAlignmentCorrectionsDataESSourceXMLCommon.acsReal.empty()
368  : ctppsRPAlignmentCorrectionsDataESSourceXMLCommon.acsReal[0].second);
369 
370  pData.acMisaligned = std::make_shared<CTPPSRPAlignmentCorrectionsData>(
371  ctppsRPAlignmentCorrectionsDataESSourceXMLCommon.acsMisaligned.empty()
373  : ctppsRPAlignmentCorrectionsDataESSourceXMLCommon.acsMisaligned[0].second);
374 }
U second(std::pair< T, U > const &p)
void addUntrackedParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:193
Container for CTPPS RP alignment corrections. The corrections are stored on two levels - RP and senso...

◆ buildDirectSimuData()

void CTPPSCompositeESSource::buildDirectSimuData ( const edm::ParameterSet profile,
ProfileData pData 
)
private

Definition at line 268 of file CTPPSCompositeESSource.cc.

References profile_base_cff::ctppsDirectSimuData, CTPPSCompositeESSource::ProfileData::directSimuData, geometryDiff::file, PPSDirectSimulationData::getEfficienciesPerPlane(), PPSDirectSimulationData::getEfficienciesPerRP(), ConfigBuilder::profile, ctppsOpticalFunctions_non_DB_cff::rpId, PPSDirectSimulationData::setEmpiricalAperture45(), PPSDirectSimulationData::setEmpiricalAperture56(), PPSDirectSimulationData::setTimeResolutionDiamonds45(), PPSDirectSimulationData::setTimeResolutionDiamonds56(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by CTPPSCompositeESSource().

268  {
269  const auto &ctppsDirectSimuData = profile.getParameter<edm::ParameterSet>("ctppsDirectSimuData");
270 
271  pData.directSimuData.setEmpiricalAperture45(ctppsDirectSimuData.getParameter<std::string>("empiricalAperture45"));
272  pData.directSimuData.setEmpiricalAperture56(ctppsDirectSimuData.getParameter<std::string>("empiricalAperture56"));
273 
274  pData.directSimuData.setTimeResolutionDiamonds45(
275  ctppsDirectSimuData.getParameter<std::string>("timeResolutionDiamonds45"));
276  pData.directSimuData.setTimeResolutionDiamonds56(
277  ctppsDirectSimuData.getParameter<std::string>("timeResolutionDiamonds56"));
278 
279  for (const auto &ps : ctppsDirectSimuData.getParameterSetVector("efficienciesPerRP")) {
280  const auto rpId = ps.getParameter<unsigned int>("rpId");
281  const auto &file = ps.getParameter<std::string>("file");
282  const auto &object = ps.getParameter<std::string>("object");
283  pData.directSimuData.getEfficienciesPerRP()[rpId] = {file, object};
284  }
285 
286  for (const auto &ps : ctppsDirectSimuData.getParameterSetVector("efficienciesPerPlane")) {
287  const auto rpId = ps.getParameter<unsigned int>("rpId");
288  const auto &file = ps.getParameter<std::string>("file");
289  const auto &object = ps.getParameter<std::string>("object");
290  pData.directSimuData.getEfficienciesPerPlane()[rpId] = {file, object};
291  }
292 }

◆ buildGeometry()

void CTPPSCompositeESSource::buildGeometry ( const DDCompactView cpv)
private

Definition at line 296 of file CTPPSCompositeESSource.cc.

References CTPPSGeometryESCommon::applyAlignments(), detgeomdescbuilder::buildDetGeomDescFromCompactView(), geometryBuilt_, isRun2_, AlCaHLTBitMon_ParallelJobs::p, profile_bins_, and verbosity_.

Referenced by produceMisalignedTG(), and produceRealTG().

296  {
297  std::unique_ptr<DetGeomDesc> idealGD = detgeomdescbuilder::buildDetGeomDescFromCompactView(cpv, isRun2_);
298 
299  for (auto &pb : profile_bins_) {
300  auto &p = pb.data;
301 
302  p.misalignedGD = CTPPSGeometryESCommon::applyAlignments(*(idealGD), p.acMisaligned.get());
303  p.misalignedTG = std::make_shared<CTPPSGeometry>(p.misalignedGD.get(), verbosity_);
304 
305  p.realGD = CTPPSGeometryESCommon::applyAlignments(*(idealGD), p.acReal.get());
306  p.realTG = std::make_shared<CTPPSGeometry>(p.realGD.get(), verbosity_);
307  }
308 
309  geometryBuilt_ = true;
310 }
std::unique_ptr< DetGeomDesc > applyAlignments(const DetGeomDesc &, const CTPPSRPAlignmentCorrectionsData *)
std::unique_ptr< DetGeomDesc > buildDetGeomDescFromCompactView(const DDCompactView &myCompactView, const bool isRun2)
std::vector< BinData< ProfileData > > profile_bins_

◆ buildLHCInfo()

void CTPPSCompositeESSource::buildLHCInfo ( const edm::ParameterSet profile,
ProfileData pData 
)
private

Definition at line 378 of file CTPPSCompositeESSource.cc.

References CTPPSCompositeESSource::ProfileData::beamEnergy, CTPPSCompositeESSource::ProfileData::betaStar, profile_base_cff::ctppsLHCInfo, Exception, ConfigBuilder::profile, AlCaHLTBitMon_QueryRunRegistry::string, w(), x, CTPPSCompositeESSource::ProfileData::xangle, CTPPSCompositeESSource::ProfileData::xangleBetaStarBins, and y.

Referenced by CTPPSCompositeESSource().

378  {
379  const auto &ctppsLHCInfo = profile.getParameter<edm::ParameterSet>("ctppsLHCInfo");
380 
381  pData.beamEnergy = ctppsLHCInfo.getParameter<double>("beamEnergy");
382  pData.betaStar = ctppsLHCInfo.getParameter<double>("betaStar");
383  pData.xangle = ctppsLHCInfo.getParameter<double>("xangle");
384 
385  // continue only if distributed xangle/beta* shall be used
386  if (pData.xangle > 0)
387  return;
388 
389  edm::FileInPath fip(ctppsLHCInfo.getParameter<std::string>("xangleBetaStarHistogramFile").c_str());
390  std::unique_ptr<TFile> f_in(TFile::Open(fip.fullPath().c_str()));
391  if (!f_in)
392  throw cms::Exception("PPS") << "Cannot open input file '"
393  << ctppsLHCInfo.getParameter<std::string>("xangleBetaStarHistogramFile") << "'.";
394 
395  TH2D *h_xangle_beta_star =
396  (TH2D *)f_in->Get(ctppsLHCInfo.getParameter<std::string>("xangleBetaStarHistogramObject").c_str());
397  if (!h_xangle_beta_star)
398  throw cms::Exception("PPS") << "Cannot load input object '"
399  << ctppsLHCInfo.getParameter<std::string>("xangleBetaStarHistogramObject") << "'.";
400 
401  // extract non-empty bins, calculate weights
402  double sum = 0.;
403  for (int bi = 1; bi <= h_xangle_beta_star->GetNcells(); ++bi)
404  sum += h_xangle_beta_star->GetBinContent(bi);
405 
406  double cw = 0.;
407  for (int x = 1; x <= h_xangle_beta_star->GetNbinsX(); ++x)
408  for (int y = 1; y <= h_xangle_beta_star->GetNbinsY(); ++y) {
409  const double w = h_xangle_beta_star->GetBinContent(h_xangle_beta_star->GetBin(x, y)) / sum;
410  if (w > 0.) {
411  pData.xangleBetaStarBins.emplace_back(cw,
412  cw + w,
413  std::make_pair(h_xangle_beta_star->GetXaxis()->GetBinCenter(x),
414  h_xangle_beta_star->GetYaxis()->GetBinCenter(y)));
415  cw += w;
416  }
417  }
418 }
T w() const

◆ buildOptics()

void CTPPSCompositeESSource::buildOptics ( const edm::ParameterSet profile,
ProfileData pData 
)
private

Definition at line 314 of file CTPPSCompositeESSource.cc.

References profile_base_cff::ctppsOpticalFunctions, fcn(), tkal_create_file_lists::FileInfo, edm::FileInPath::fullPath(), CTPPSCompositeESSource::ProfileData::lhcOptical, eostools::move(), ConfigBuilder::profile, muonDTDigis_cfi::pset, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by CTPPSCompositeESSource().

314  {
315  const auto &ctppsOpticalFunctions = profile.getParameter<edm::ParameterSet>("ctppsOpticalFunctions");
316 
317  struct FileInfo {
318  double m_xangle;
319  std::string m_fileName;
320  };
321 
322  std::vector<FileInfo> fileInfo;
323 
324  for (const auto &pset : ctppsOpticalFunctions.getParameter<std::vector<edm::ParameterSet>>("opticalFunctions")) {
325  fileInfo.emplace_back(pset.getParameter<double>("xangle"),
326  pset.getParameter<edm::FileInPath>("fileName").fullPath());
327  }
328 
329  struct RPInfo {
330  std::string m_dirName;
331  double m_scoringPlaneZ;
332  };
333 
334  std::unordered_map<unsigned int, RPInfo> rpInfo;
335 
336  for (const auto &pset : ctppsOpticalFunctions.getParameter<std::vector<edm::ParameterSet>>("scoringPlanes")) {
337  rpInfo.emplace(pset.getParameter<unsigned int>("rpId"),
338  RPInfo{pset.getParameter<std::string>("dirName"), pset.getParameter<double>("z")});
339  }
340 
341  for (const auto &fi : fileInfo) {
342  std::unordered_map<unsigned int, LHCOpticalFunctionsSet> xa_data;
343 
344  for (const auto &rpi : rpInfo) {
345  LHCOpticalFunctionsSet fcn(fi.m_fileName, rpi.second.m_dirName, rpi.second.m_scoringPlaneZ);
346  xa_data.emplace(rpi.first, std::move(fcn));
347  }
348 
349  pData.lhcOptical.emplace(fi.m_xangle, xa_data);
350  }
351 }
Set of optical functions corresponding to one scoring plane along LHC.
void fcn(int &, double *, double &, double *, int)
const std::string & fullPath() const
Definition: FileInPath.cc:144
def move(src, dest)
Definition: eostools.py:511

◆ fillDescriptions()

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

Definition at line 192 of file CTPPSCompositeESSource.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), submitPVResolutionJobs::desc, haddnano::of, edm::ParameterDescriptionNode::setComment(), and AlCaHLTBitMon_QueryRunRegistry::string.

192  {
194  desc.add<std::string>("compactViewTag", "")->setComment("label of the geometry compact view");
195  desc.add<std::string>("lhcInfoLabel", "")->setComment("label of the LHCInfo record");
196  desc.add<std::string>("opticsLabel", "")->setComment("label of the optics record");
197  desc.add<unsigned int>("seed", 1)->setComment("random seed");
198  desc.add<bool>("isRun2", false)->setComment("use diamond's run 2 geometry definition?");
199  desc.addUntracked<unsigned int>("generateEveryNEvents", 1)->setComment("how often to switch conditions");
200  desc.addUntracked<unsigned int>("verbosity", 0);
201 
202  edm::ParameterSetDescription desc_profile;
203  std::vector<edm::ParameterSet> vp;
204  desc_profile.add<double>("L_int", 0.)->setComment("integrated luminosity");
205 
206  // lhcInfo
207  edm::ParameterSetDescription desc_profile_ctppsLHCInfo;
208  desc_profile_ctppsLHCInfo.add<double>("xangle", -1)
209  ->setComment("constant xangle, if negative, the xangle/beta* distribution will be used");
210  desc_profile_ctppsLHCInfo.add<double>("betaStar", 0.)->setComment("constant beta*");
211  desc_profile_ctppsLHCInfo.add<double>("beamEnergy", 0.)->setComment("beam energy");
212  desc_profile_ctppsLHCInfo.add<std::string>("xangleBetaStarHistogramFile", "")
213  ->setComment("ROOT file with xangle/beta* distribution");
214  desc_profile_ctppsLHCInfo.add<std::string>("xangleBetaStarHistogramObject", "")
215  ->setComment("xangle distribution object in the ROOT file");
216  desc_profile.add<edm::ParameterSetDescription>("ctppsLHCInfo", desc_profile_ctppsLHCInfo);
217 
218  // optics
219  edm::ParameterSetDescription desc_profile_ctppsOpticalFunctions;
221  of_desc.add<double>("xangle")->setComment("half crossing angle value in urad");
222  of_desc.add<edm::FileInPath>("fileName")->setComment("ROOT file with optical functions");
223  std::vector<edm::ParameterSet> of;
224  desc_profile_ctppsOpticalFunctions.addVPSet("opticalFunctions", of_desc, of)
225  ->setComment("list of optical functions at different crossing angles");
226 
228  sp_desc.add<unsigned int>("rpId")->setComment("associated detector DetId");
229  sp_desc.add<std::string>("dirName")->setComment("associated path to the optical functions file");
230  sp_desc.add<double>("z")->setComment("longitudinal position at scoring plane/detector");
231  std::vector<edm::ParameterSet> sp;
232  desc_profile_ctppsOpticalFunctions.addVPSet("scoringPlanes", sp_desc, sp)
233  ->setComment("list of sensitive planes/detectors stations");
234  desc_profile.add<edm::ParameterSetDescription>("ctppsOpticalFunctions", desc_profile_ctppsOpticalFunctions);
235 
236  // alignment
237  edm::ParameterSetDescription desc_profile_ctppsRPAlignmentCorrectionsDataXML;
238  desc_profile_ctppsRPAlignmentCorrectionsDataXML.add<std::vector<std::string>>("MeasuredFiles");
239  desc_profile_ctppsRPAlignmentCorrectionsDataXML.add<std::vector<std::string>>("RealFiles");
240  desc_profile_ctppsRPAlignmentCorrectionsDataXML.add<std::vector<std::string>>("MisalignedFiles");
241  desc_profile.add<edm::ParameterSetDescription>("ctppsRPAlignmentCorrectionsDataXML",
242  desc_profile_ctppsRPAlignmentCorrectionsDataXML);
243 
244  // direct simu config
245  edm::ParameterSetDescription desc_profile_ctppsDirectSimuData;
246  desc_profile_ctppsDirectSimuData.add<std::string>("empiricalAperture45");
247  desc_profile_ctppsDirectSimuData.add<std::string>("empiricalAperture56");
248 
249  desc_profile_ctppsDirectSimuData.add<std::string>("timeResolutionDiamonds45");
250  desc_profile_ctppsDirectSimuData.add<std::string>("timeResolutionDiamonds56");
251 
253  eps_desc.add<unsigned int>("rpId")->setComment("RP id");
254  eps_desc.add<std::string>("file")->setComment("file name");
255  eps_desc.add<std::string>("object")->setComment("path to the efficiency histogram");
256  desc_profile_ctppsDirectSimuData.addVPSet("efficienciesPerRP", eps_desc, std::vector<edm::ParameterSet>());
257  desc_profile_ctppsDirectSimuData.addVPSet("efficienciesPerPlane", eps_desc, std::vector<edm::ParameterSet>());
258 
259  desc_profile.add<edm::ParameterSetDescription>("ctppsDirectSimuData", desc_profile_ctppsDirectSimuData);
260 
261  desc.addVPSet("periods", desc_profile, vp)->setComment("profiles");
262 
263  descriptions.add("ctppsCompositeESSource", desc);
264 }
void setComment(std::string const &value)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ produceDirectSimuData()

std::unique_ptr< PPSDirectSimulationData > CTPPSCompositeESSource::produceDirectSimuData ( const PPSDirectSimulationDataRcd )

Definition at line 483 of file CTPPSCompositeESSource.cc.

References currentProfile_, and CTPPSCompositeESSource::ProfileData::directSimuData.

Referenced by CTPPSCompositeESSource().

484  {
485  return std::make_unique<PPSDirectSimulationData>(currentProfile_->directSimuData);
486 }
const ProfileData * currentProfile_

◆ produceLhcInfo()

std::unique_ptr< LHCInfo > CTPPSCompositeESSource::produceLhcInfo ( const LHCInfoRcd )

Definition at line 496 of file CTPPSCompositeESSource.cc.

References CTPPSCompositeESSource::ProfileData::beamEnergy, CTPPSCompositeESSource::ProfileData::betaStar, simBeamSpotPI::betaStar, currentProfile_, ztail::d, m_engine_, ctppsOpticalFunctions_non_DB_cff::xangle, CTPPSCompositeESSource::ProfileData::xangle, and CTPPSCompositeESSource::ProfileData::xangleBetaStarBins.

Referenced by CTPPSCompositeESSource().

496  {
497  double xangle = currentProfile_->xangle;
499 
500  if (currentProfile_->xangle < 0) {
501  const double u = CLHEP::RandFlat::shoot(m_engine_.get(), 0., 1.);
502  for (const auto &d : currentProfile_->xangleBetaStarBins) {
503  if (d.min <= u && u <= d.max) {
504  xangle = d.data.first;
505  betaStar = d.data.second;
506  break;
507  }
508  }
509  }
510 
511  auto lhcInfo = std::make_unique<LHCInfo>();
512  lhcInfo->setEnergy(currentProfile_->beamEnergy);
513  lhcInfo->setCrossingAngle(xangle);
514  lhcInfo->setBetaStar(betaStar);
515 
516  edm::LogInfo("PPS") << "new LHCInfo: xangle=" << xangle << ", betaStar=" << betaStar;
517 
518  return lhcInfo;
519 }
const ProfileData * currentProfile_
std::unique_ptr< CLHEP::HepRandomEngine > m_engine_
d
Definition: ztail.py:151
Log< level::Info, false > LogInfo
std::vector< BinData< std::pair< double, double > > > xangleBetaStarBins

◆ produceMisalignedAlignments()

std::shared_ptr< CTPPSRPAlignmentCorrectionsData > CTPPSCompositeESSource::produceMisalignedAlignments ( const RPMisalignedAlignmentRecord )

Definition at line 457 of file CTPPSCompositeESSource.cc.

References CTPPSCompositeESSource::ProfileData::acMisaligned, and currentProfile_.

458  {
460 }
std::shared_ptr< CTPPSRPAlignmentCorrectionsData > acMisaligned
const ProfileData * currentProfile_

◆ produceMisalignedTG()

std::shared_ptr< CTPPSGeometry > CTPPSCompositeESSource::produceMisalignedTG ( const VeryForwardMisalignedGeometryRecord iRecord)

Definition at line 473 of file CTPPSCompositeESSource.cc.

References buildGeometry(), currentProfile_, geometryBuilt_, edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::get(), edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::getRecord(), CTPPSCompositeESSource::ProfileData::misalignedTG, and tokenCompactViewMisaligned_.

Referenced by CTPPSCompositeESSource().

474  {
475  if (!geometryBuilt_)
477 
479 }
void buildGeometry(const DDCompactView &cpv)
const ProfileData * currentProfile_
std::shared_ptr< CTPPSGeometry > misalignedTG
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
edm::ESGetToken< DDCompactView, IdealGeometryRecord > tokenCompactViewMisaligned_

◆ produceOptics()

std::unique_ptr< LHCOpticalFunctionsSetCollection > CTPPSCompositeESSource::produceOptics ( const CTPPSOpticsRcd )

Definition at line 490 of file CTPPSCompositeESSource.cc.

References currentProfile_, and CTPPSCompositeESSource::ProfileData::lhcOptical.

Referenced by CTPPSCompositeESSource().

490  {
491  return std::make_unique<LHCOpticalFunctionsSetCollection>(currentProfile_->lhcOptical);
492 }
LHCOpticalFunctionsSetCollection lhcOptical
const ProfileData * currentProfile_

◆ produceRealAlignments()

std::shared_ptr< CTPPSRPAlignmentCorrectionsData > CTPPSCompositeESSource::produceRealAlignments ( const RPRealAlignmentRecord )

Definition at line 450 of file CTPPSCompositeESSource.cc.

References CTPPSCompositeESSource::ProfileData::acReal, and currentProfile_.

451  {
452  return currentProfile_->acReal;
453 }
const ProfileData * currentProfile_
std::shared_ptr< CTPPSRPAlignmentCorrectionsData > acReal

◆ produceRealTG()

std::shared_ptr< CTPPSGeometry > CTPPSCompositeESSource::produceRealTG ( const VeryForwardRealGeometryRecord iRecord)

Definition at line 464 of file CTPPSCompositeESSource.cc.

References buildGeometry(), currentProfile_, geometryBuilt_, edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::get(), edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::getRecord(), CTPPSCompositeESSource::ProfileData::realTG, and tokenCompactViewReal_.

Referenced by CTPPSCompositeESSource().

464  {
465  if (!geometryBuilt_)
467 
468  return currentProfile_->realTG;
469 }
void buildGeometry(const DDCompactView &cpv)
const ProfileData * currentProfile_
edm::ESGetToken< DDCompactView, IdealGeometryRecord > tokenCompactViewReal_
std::shared_ptr< CTPPSGeometry > realTG
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const

◆ setIntervalFor()

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

Implements edm::EventSetupRecordIntervalFinder.

Definition at line 422 of file CTPPSCompositeESSource.cc.

References newFWLiteAna::bin, currentProfile_, edm::EventID::event(), edm::IOVSyncValue::eventID(), generateEveryNEvents_, edm::EventID::luminosityBlock(), m_engine_, previously_set_eventID_, profile_bins_, and edm::EventID::run().

424  {
425  // determine new IOV
426  edm::EventID beginEvent = iosv.eventID();
427  edm::EventID endEvent(beginEvent.run(), beginEvent.luminosityBlock(), beginEvent.event() + generateEveryNEvents_);
428  oValidity = edm::ValidityInterval(edm::IOVSyncValue(beginEvent), edm::IOVSyncValue(endEvent));
429 
430  // stop if new profile has already been generated
431  if (beginEvent.run() == previously_set_eventID_.run() &&
433  return;
434 
435  previously_set_eventID_ = beginEvent;
436 
437  // randomly pick the next profile
438  const double u = CLHEP::RandFlat::shoot(m_engine_.get(), 0., 1.);
439 
440  for (const auto &bin : profile_bins_) {
441  if (bin.min <= u && u <= bin.max) {
442  currentProfile_ = &bin.data;
443  break;
444  }
445  }
446 }
std::pair< Time_t, Time_t > ValidityInterval
Definition: Time.h:17
const ProfileData * currentProfile_
std::unique_ptr< CLHEP::HepRandomEngine > m_engine_
LuminosityBlockNumber_t luminosityBlock() const
Definition: EventID.h:39
RunNumber_t run() const
Definition: EventID.h:38
const EventID & eventID() const
Definition: IOVSyncValue.h:40
std::vector< BinData< ProfileData > > profile_bins_
EventNumber_t event() const
Definition: EventID.h:40

Member Data Documentation

◆ compactViewTag_

std::string CTPPSCompositeESSource::compactViewTag_
private

Definition at line 68 of file CTPPSCompositeESSource.cc.

Referenced by CTPPSCompositeESSource().

◆ currentProfile_

const ProfileData* CTPPSCompositeESSource::currentProfile_
private

◆ generateEveryNEvents_

unsigned int CTPPSCompositeESSource::generateEveryNEvents_
private

Definition at line 71 of file CTPPSCompositeESSource.cc.

Referenced by setIntervalFor().

◆ geometryBuilt_

bool CTPPSCompositeESSource::geometryBuilt_
private

Definition at line 120 of file CTPPSCompositeESSource.cc.

Referenced by buildGeometry(), produceMisalignedTG(), and produceRealTG().

◆ isRun2_

const bool CTPPSCompositeESSource::isRun2_
private

Definition at line 73 of file CTPPSCompositeESSource.cc.

Referenced by buildGeometry().

◆ lhcInfoLabel_

std::string CTPPSCompositeESSource::lhcInfoLabel_
private

Definition at line 69 of file CTPPSCompositeESSource.cc.

Referenced by CTPPSCompositeESSource().

◆ m_engine_

std::unique_ptr<CLHEP::HepRandomEngine> CTPPSCompositeESSource::m_engine_
private

Definition at line 111 of file CTPPSCompositeESSource.cc.

Referenced by produceLhcInfo(), and setIntervalFor().

◆ opticsLabel_

std::string CTPPSCompositeESSource::opticsLabel_
private

Definition at line 70 of file CTPPSCompositeESSource.cc.

Referenced by CTPPSCompositeESSource().

◆ previously_set_eventID_

edm::EventID CTPPSCompositeESSource::previously_set_eventID_
private

Definition at line 128 of file CTPPSCompositeESSource.cc.

Referenced by setIntervalFor().

◆ profile_bins_

std::vector<BinData<ProfileData> > CTPPSCompositeESSource::profile_bins_
private

◆ tokenCompactViewMisaligned_

edm::ESGetToken<DDCompactView, IdealGeometryRecord> CTPPSCompositeESSource::tokenCompactViewMisaligned_
private

Definition at line 76 of file CTPPSCompositeESSource.cc.

Referenced by CTPPSCompositeESSource(), and produceMisalignedTG().

◆ tokenCompactViewReal_

edm::ESGetToken<DDCompactView, IdealGeometryRecord> CTPPSCompositeESSource::tokenCompactViewReal_
private

Definition at line 76 of file CTPPSCompositeESSource.cc.

Referenced by CTPPSCompositeESSource(), and produceRealTG().

◆ verbosity_

unsigned int CTPPSCompositeESSource::verbosity_
private

Definition at line 72 of file CTPPSCompositeESSource.cc.

Referenced by buildAlignment(), and buildGeometry().