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

359  {
360  // load alignment data
361  auto ctppsRPAlignmentCorrectionsDataXMLPSet =
362  cfg.getParameter<edm::ParameterSet>("ctppsRPAlignmentCorrectionsDataXML");
363  ctppsRPAlignmentCorrectionsDataXMLPSet.addUntrackedParameter("verbosity", verbosity_);
364 
365  CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon ctppsRPAlignmentCorrectionsDataESSourceXMLCommon(
366  ctppsRPAlignmentCorrectionsDataXMLPSet);
367 
368  // store the first entry from the alignment sequence (more cannot be done)
369  pData.acReal = std::make_shared<CTPPSRPAlignmentCorrectionsData>(
370  ctppsRPAlignmentCorrectionsDataESSourceXMLCommon.acsReal.empty()
372  : ctppsRPAlignmentCorrectionsDataESSourceXMLCommon.acsReal[0].second);
373 
374  pData.acMisaligned = std::make_shared<CTPPSRPAlignmentCorrectionsData>(
375  ctppsRPAlignmentCorrectionsDataESSourceXMLCommon.acsMisaligned.empty()
377  : ctppsRPAlignmentCorrectionsDataESSourceXMLCommon.acsMisaligned[0].second);
378 }
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(), PostProcessor_cff::profile, 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 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307

◆ 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 382 of file CTPPSCompositeESSource.cc.

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

Referenced by CTPPSCompositeESSource().

382  {
383  const auto &ctppsLHCInfo = profile.getParameter<edm::ParameterSet>("ctppsLHCInfo");
384 
385  pData.beamEnergy = ctppsLHCInfo.getParameter<double>("beamEnergy");
386  pData.betaStar = ctppsLHCInfo.getParameter<double>("betaStar");
387  pData.xangle = ctppsLHCInfo.getParameter<double>("xangle");
388 
389  // continue only if distributed xangle/beta* shall be used
390  if (pData.xangle > 0)
391  return;
392 
393  edm::FileInPath fip(ctppsLHCInfo.getParameter<std::string>("xangleBetaStarHistogramFile").c_str());
394  std::unique_ptr<TFile> f_in(TFile::Open(fip.fullPath().c_str()));
395  if (!f_in)
396  throw cms::Exception("PPS") << "Cannot open input file '"
397  << ctppsLHCInfo.getParameter<std::string>("xangleBetaStarHistogramFile") << "'.";
398 
399  TH2D *h_xangle_beta_star =
400  (TH2D *)f_in->Get(ctppsLHCInfo.getParameter<std::string>("xangleBetaStarHistogramObject").c_str());
401  if (!h_xangle_beta_star)
402  throw cms::Exception("PPS") << "Cannot load input object '"
403  << ctppsLHCInfo.getParameter<std::string>("xangleBetaStarHistogramObject") << "'.";
404 
405  // extract non-empty bins, calculate weights
406  double sum = 0.;
407  for (int bi = 1; bi <= h_xangle_beta_star->GetNcells(); ++bi)
408  sum += h_xangle_beta_star->GetBinContent(bi);
409 
410  double cw = 0.;
411  for (int x = 1; x <= h_xangle_beta_star->GetNbinsX(); ++x)
412  for (int y = 1; y <= h_xangle_beta_star->GetNbinsY(); ++y) {
413  const double w = h_xangle_beta_star->GetBinContent(h_xangle_beta_star->GetBin(x, y)) / sum;
414  if (w > 0.) {
415  pData.xangleBetaStarBins.push_back(
416  {cw,
417  cw + w,
418  std::pair<double, double>(h_xangle_beta_star->GetXaxis()->GetBinCenter(x),
419  h_xangle_beta_star->GetYaxis()->GetBinCenter(y))});
420  cw += w;
421  }
422  }
423 }
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, TrackerOfflineValidation_Dqm_cff::dirName, mps_splice::entry, fcn(), tkal_create_file_lists::FileInfo, MillePedeFileConverter_cfg::fileName, contentValuesFiles::fullPath, CTPPSCompositeESSource::ProfileData::lhcOptical, eostools::move(), PostProcessor_cff::profile, muonDTDigis_cfi::pset, AlCaHLTBitMon_QueryRunRegistry::string, profile_base_cff::xangle, and z.

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  const double &xangle = pset.getParameter<double>("xangle");
326  const std::string &fileName = pset.getParameter<edm::FileInPath>("fileName").fullPath();
327  fileInfo.push_back({xangle, fileName});
328  }
329 
330  struct RPInfo {
331  std::string m_dirName;
332  double m_scoringPlaneZ;
333  };
334 
335  std::unordered_map<unsigned int, RPInfo> rpInfo;
336 
337  for (const auto &pset : ctppsOpticalFunctions.getParameter<std::vector<edm::ParameterSet>>("scoringPlanes")) {
338  const unsigned int rpId = pset.getParameter<unsigned int>("rpId");
339  const std::string dirName = pset.getParameter<std::string>("dirName");
340  const double z = pset.getParameter<double>("z");
341  const RPInfo entry = {dirName, z};
342  rpInfo.emplace(rpId, entry);
343  }
344 
345  for (const auto &fi : fileInfo) {
346  std::unordered_map<unsigned int, LHCOpticalFunctionsSet> xa_data;
347 
348  for (const auto &rpi : rpInfo) {
349  LHCOpticalFunctionsSet fcn(fi.m_fileName, rpi.second.m_dirName, rpi.second.m_scoringPlaneZ);
350  xa_data.emplace(rpi.first, std::move(fcn));
351  }
352 
353  pData.lhcOptical.emplace(fi.m_xangle, xa_data);
354  }
355 }
Set of optical functions corresponding to one scoring plane along LHC.
void fcn(int &, double *, double &, double *, int)
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 488 of file CTPPSCompositeESSource.cc.

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

Referenced by CTPPSCompositeESSource().

489  {
490  return std::make_unique<PPSDirectSimulationData>(currentProfile_->directSimuData);
491 }
const ProfileData * currentProfile_

◆ produceLhcInfo()

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

Definition at line 501 of file CTPPSCompositeESSource.cc.

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

Referenced by CTPPSCompositeESSource().

501  {
502  double xangle = currentProfile_->xangle;
504 
505  if (currentProfile_->xangle < 0) {
506  const double u = CLHEP::RandFlat::shoot(m_engine_.get(), 0., 1.);
507  for (const auto &d : currentProfile_->xangleBetaStarBins) {
508  if (d.min <= u && u <= d.max) {
509  xangle = d.data.first;
510  betaStar = d.data.second;
511  break;
512  }
513  }
514  }
515 
516  auto lhcInfo = std::make_unique<LHCInfo>();
517  lhcInfo->setEnergy(currentProfile_->beamEnergy);
518  lhcInfo->setCrossingAngle(xangle);
519  lhcInfo->setBetaStar(betaStar);
520 
521  edm::LogInfo("PPS") << "new LHCInfo: xangle=" << xangle << ", betaStar=" << betaStar;
522 
523  return lhcInfo;
524 }
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 462 of file CTPPSCompositeESSource.cc.

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

463  {
465 }
std::shared_ptr< CTPPSRPAlignmentCorrectionsData > acMisaligned
const ProfileData * currentProfile_

◆ produceMisalignedTG()

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

Definition at line 478 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().

479  {
480  if (!geometryBuilt_)
482 
484 }
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 495 of file CTPPSCompositeESSource.cc.

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

Referenced by CTPPSCompositeESSource().

495  {
496  return std::make_unique<LHCOpticalFunctionsSetCollection>(currentProfile_->lhcOptical);
497 }
LHCOpticalFunctionsSetCollection lhcOptical
const ProfileData * currentProfile_

◆ produceRealAlignments()

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

Definition at line 455 of file CTPPSCompositeESSource.cc.

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

456  {
457  return currentProfile_->acReal;
458 }
const ProfileData * currentProfile_
std::shared_ptr< CTPPSRPAlignmentCorrectionsData > acReal

◆ produceRealTG()

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

Definition at line 469 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().

469  {
470  if (!geometryBuilt_)
472 
473  return currentProfile_->realTG;
474 }
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 427 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().

429  {
430  // determine new IOV
431  edm::EventID beginEvent = iosv.eventID();
432  edm::EventID endEvent(beginEvent.run(), beginEvent.luminosityBlock(), beginEvent.event() + generateEveryNEvents_);
433  oValidity = edm::ValidityInterval(edm::IOVSyncValue(beginEvent), edm::IOVSyncValue(endEvent));
434 
435  // stop if new profile has already been generated
436  if (beginEvent.run() == previously_set_eventID_.run() &&
438  return;
439 
440  previously_set_eventID_ = beginEvent;
441 
442  // randomly pick the next profile
443  const double u = CLHEP::RandFlat::shoot(m_engine_.get(), 0., 1.);
444 
445  for (const auto &bin : profile_bins_) {
446  if (bin.min <= u && u <= bin.max) {
447  currentProfile_ = &bin.data;
448  break;
449  }
450  }
451 }
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().