CMS 3D CMS Logo

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

Public Member Functions

 CTPPSModifiedOpticalFunctionsESSource (const edm::ParameterSet &)
 
std::shared_ptr< LHCInterpolatedOpticalFunctionsSetCollectionproduce (const CTPPSInterpolatedOpticsRcd &)
 
 ~CTPPSModifiedOpticalFunctionsESSource () override
 
- 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)
 

Static Public Member Functions

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

Private Attributes

const double factor_
 
const edm::ESGetToken< LHCInterpolatedOpticalFunctionsSetCollection, CTPPSInterpolatedOpticsRcdinputOpticsToken_
 
const unsigned int rpDecId_45_F_
 
const unsigned int rpDecId_45_N_
 
const unsigned int rpDecId_56_F_
 
const unsigned int rpDecId_56_N_
 
const std::string scenario_
 

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 char *iLabel)
 
template<typename T >
auto setWhatProduced (T *iThis, const es::Label &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)
 

Detailed Description

Definition at line 16 of file CTPPSModifiedOpticalFunctionsESSource.cc.

Constructor & Destructor Documentation

◆ CTPPSModifiedOpticalFunctionsESSource()

CTPPSModifiedOpticalFunctionsESSource::CTPPSModifiedOpticalFunctionsESSource ( const edm::ParameterSet iConfig)

Definition at line 38 of file CTPPSModifiedOpticalFunctionsESSource.cc.

39  : inputOpticsToken_(setWhatProduced(this, iConfig.getParameter<std::string>("outputOpticsLabel"))
40  .consumes(edm::ESInputTag("", iConfig.getParameter<std::string>("inputOpticsLabel")))),
41  scenario_(iConfig.getParameter<std::string>("scenario")),
42  factor_(iConfig.getParameter<double>("factor")),
43  rpDecId_45_N_(iConfig.getParameter<unsigned int>("rpId_45_N")),
44  rpDecId_45_F_(iConfig.getParameter<unsigned int>("rpId_45_F")),
45  rpDecId_56_N_(iConfig.getParameter<unsigned int>("rpId_56_N")),
46  rpDecId_56_F_(iConfig.getParameter<unsigned int>("rpId_56_F")) {}

◆ ~CTPPSModifiedOpticalFunctionsESSource()

CTPPSModifiedOpticalFunctionsESSource::~CTPPSModifiedOpticalFunctionsESSource ( )
inlineoverride

Definition at line 19 of file CTPPSModifiedOpticalFunctionsESSource.cc.

19 {}

Member Function Documentation

◆ fillDescriptions()

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

Definition at line 50 of file CTPPSModifiedOpticalFunctionsESSource.cc.

50  {
52 
53  desc.add<std::string>("inputOpticsLabel", "")->setComment("label of the input optics records");
54  desc.add<std::string>("outputOpticsLabel", "modified")->setComment("label of the output optics records");
55 
56  desc.add<std::string>("scenario", "none")->setComment("name of modification scenario");
57 
58  desc.add<double>("factor", 0.)->setComment("size of modification (number of sigmas)");
59 
60  desc.add<unsigned int>("rpId_45_N", 0)->setComment("decimal RP id for 45 near");
61  desc.add<unsigned int>("rpId_45_F", 0)->setComment("decimal RP id for 45 far");
62  desc.add<unsigned int>("rpId_56_N", 0)->setComment("decimal RP id for 56 near");
63  desc.add<unsigned int>("rpId_56_F", 0)->setComment("decimal RP id for 56 far");
64 
65  descriptions.add("ctppsModifiedOpticalFunctionsESSource", desc);
66 }

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

◆ produce()

std::shared_ptr< LHCInterpolatedOpticalFunctionsSetCollection > CTPPSModifiedOpticalFunctionsESSource::produce ( const CTPPSInterpolatedOpticsRcd iRecord)

Definition at line 70 of file CTPPSModifiedOpticalFunctionsESSource.cc.

71  {
72  // get input
74 
75  // prepare output
76  std::shared_ptr<LHCInterpolatedOpticalFunctionsSetCollection> output =
77  std::make_shared<LHCInterpolatedOpticalFunctionsSetCollection>(input);
78 
79  // premare arm/RP id map
80  struct ArmInfo {
81  unsigned int rpId_N = 0, rpId_F = 0;
82  };
83 
84  std::map<unsigned int, ArmInfo> armInfo;
85 
86  for (const auto &fsp : *output) {
87  CTPPSDetId rpId(fsp.first);
88  unsigned int rpDecId = 100 * rpId.arm() + 10 * rpId.station() + rpId.rp();
89 
90  if (rpDecId == rpDecId_45_N_)
91  armInfo[0].rpId_N = fsp.first;
92  if (rpDecId == rpDecId_45_F_)
93  armInfo[0].rpId_F = fsp.first;
94  if (rpDecId == rpDecId_56_N_)
95  armInfo[1].rpId_N = fsp.first;
96  if (rpDecId == rpDecId_56_F_)
97  armInfo[1].rpId_F = fsp.first;
98  }
99 
100  // loop over arms
101  bool applied = false;
102 
103  for (const auto &ap : armInfo) {
104  const auto &arm = ap.first;
105 
106  //printf("* arm %u\n", arm);
107 
108  auto &of_N = output->find(ap.second.rpId_N)->second;
109  auto &of_F = output->find(ap.second.rpId_F)->second;
110 
111  const double z_N = of_N.getScoringPlaneZ();
112  const double z_F = of_F.getScoringPlaneZ();
113  const double de_z = (arm == 0) ? z_N - z_F : z_F - z_N;
114 
115  //printf(" z_N = %.3f m, z_F = %.3f m\n", z_N*1E-2, z_F*1E-2);
116 
117  if (of_N.m_xi_values.size() != of_N.m_xi_values.size())
118  throw cms::Exception("CTPPSModifiedOpticalFunctionsESSource")
119  << "Different xi sampling of optical functions in near and far RP.";
120 
121  // loop over sampling points (in xi)
122  for (unsigned int i = 0; i < of_N.m_xi_values.size(); ++i) {
123  const double xi = of_N.m_xi_values[i];
124 
125  double x_d_N = of_N.m_fcn_values[LHCOpticalFunctionsSet::exd][i];
126  double x_d_F = of_F.m_fcn_values[LHCOpticalFunctionsSet::exd][i];
127 
128  double L_x_N = of_N.m_fcn_values[LHCOpticalFunctionsSet::eLx][i];
129  double L_x_F = of_F.m_fcn_values[LHCOpticalFunctionsSet::eLx][i];
130  double Lp_x = of_N.m_fcn_values[LHCOpticalFunctionsSet::eLpx][i];
131 
132  //printf(" xi = %.3f, Lp_x = %.3f, %.3f\n", xi, Lp_x, (L_x_F - L_x_N) / de_z);
133 
134  // apply modification scenario
135  if (scenario_ == "none")
136  applied = true;
137 
138  if (scenario_ == "Lx") {
139  const double a = 3180., b = 40.; // cm
140  const double de_L_x = factor_ * (a * xi + b);
141  L_x_N += de_L_x;
142  L_x_F += de_L_x;
143  applied = true;
144  }
145 
146  if (scenario_ == "Lpx") {
147  const double a = 0.42, b = 0.015; // dimensionless
148  const double de_Lp_x = factor_ * (a * xi + b) * Lp_x;
149  Lp_x += de_Lp_x;
150  L_x_N -= de_Lp_x * de_z / 2.;
151  L_x_F += de_Lp_x * de_z / 2.;
152  applied = true;
153  }
154 
155  if (scenario_ == "xd") {
156  const double d = 0.08; // dimensionless
157  x_d_N += x_d_N * d * factor_;
158  x_d_F += x_d_F * d * factor_;
159  applied = true;
160  }
161 
162  // TODO: for test only
163  if (scenario_ == "Lx-scale") {
164  L_x_N *= factor_;
165  L_x_F *= factor_;
166  applied = true;
167  }
168 
169  // store updated values
170  of_N.m_fcn_values[LHCOpticalFunctionsSet::exd][i] = x_d_N;
171  of_F.m_fcn_values[LHCOpticalFunctionsSet::exd][i] = x_d_F;
172 
173  of_N.m_fcn_values[LHCOpticalFunctionsSet::eLx][i] = L_x_N;
174  of_F.m_fcn_values[LHCOpticalFunctionsSet::eLx][i] = L_x_F;
175 
176  of_N.m_fcn_values[LHCOpticalFunctionsSet::eLpx][i] = Lp_x;
177  of_F.m_fcn_values[LHCOpticalFunctionsSet::eLpx][i] = Lp_x;
178  }
179 
180  // re-initialise splines
181  of_N.initializeSplines();
182  of_F.initializeSplines();
183  }
184 
185  // modification applied?
186  if (!applied)
187  edm::LogError("CTPPSModifiedOpticalFunctionsESSource") << "Could not apply scenario `" + scenario_ + "'.";
188 
189  // save modified output
190  return output;
191 }

References a, protons_cff::arm, b, ztail::d, LHCOpticalFunctionsSet::eLpx, LHCOpticalFunctionsSet::eLx, LHCOpticalFunctionsSet::exd, factor_, edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::get(), mps_fire::i, input, inputOpticsToken_, convertSQLitetoXML_cfg::output, rpDecId_45_F_, rpDecId_45_N_, rpDecId_56_F_, rpDecId_56_N_, profile_2016_postTS2_cff::rpId, scenario_, and protons_cff::xi.

Member Data Documentation

◆ factor_

const double CTPPSModifiedOpticalFunctionsESSource::factor_
private

Definition at line 30 of file CTPPSModifiedOpticalFunctionsESSource.cc.

Referenced by produce().

◆ inputOpticsToken_

const edm::ESGetToken<LHCInterpolatedOpticalFunctionsSetCollection, CTPPSInterpolatedOpticsRcd> CTPPSModifiedOpticalFunctionsESSource::inputOpticsToken_
private

Definition at line 26 of file CTPPSModifiedOpticalFunctionsESSource.cc.

Referenced by produce().

◆ rpDecId_45_F_

const unsigned int CTPPSModifiedOpticalFunctionsESSource::rpDecId_45_F_
private

Definition at line 32 of file CTPPSModifiedOpticalFunctionsESSource.cc.

Referenced by produce().

◆ rpDecId_45_N_

const unsigned int CTPPSModifiedOpticalFunctionsESSource::rpDecId_45_N_
private

Definition at line 32 of file CTPPSModifiedOpticalFunctionsESSource.cc.

Referenced by produce().

◆ rpDecId_56_F_

const unsigned int CTPPSModifiedOpticalFunctionsESSource::rpDecId_56_F_
private

Definition at line 32 of file CTPPSModifiedOpticalFunctionsESSource.cc.

Referenced by produce().

◆ rpDecId_56_N_

const unsigned int CTPPSModifiedOpticalFunctionsESSource::rpDecId_56_N_
private

Definition at line 32 of file CTPPSModifiedOpticalFunctionsESSource.cc.

Referenced by produce().

◆ scenario_

const std::string CTPPSModifiedOpticalFunctionsESSource::scenario_
private

Definition at line 28 of file CTPPSModifiedOpticalFunctionsESSource.cc.

Referenced by produce().

CTPPSModifiedOpticalFunctionsESSource::scenario_
const std::string scenario_
Definition: CTPPSModifiedOpticalFunctionsESSource.cc:28
mps_fire.i
i
Definition: mps_fire.py:428
edm::ESInputTag
Definition: ESInputTag.h:87
input
static const std::string input
Definition: EdmProvDump.cc:48
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:72
CTPPSModifiedOpticalFunctionsESSource::rpDecId_45_N_
const unsigned int rpDecId_45_N_
Definition: CTPPSModifiedOpticalFunctionsESSource.cc:32
edm::ESProducer::setWhatProduced
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:163
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
LHCInterpolatedOpticalFunctionsSetCollection
Definition: LHCInterpolatedOpticalFunctionsSetCollection.h:10
LHCOpticalFunctionsSet::exd
Definition: LHCOpticalFunctionsSet.h:16
LHCOpticalFunctionsSet::eLpx
Definition: LHCOpticalFunctionsSet.h:16
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
CTPPSModifiedOpticalFunctionsESSource::rpDecId_56_N_
const unsigned int rpDecId_56_N_
Definition: CTPPSModifiedOpticalFunctionsESSource.cc:32
CTPPSModifiedOpticalFunctionsESSource::factor_
const double factor_
Definition: CTPPSModifiedOpticalFunctionsESSource.cc:30
CTPPSModifiedOpticalFunctionsESSource::rpDecId_45_F_
const unsigned int rpDecId_45_F_
Definition: CTPPSModifiedOpticalFunctionsESSource.cc:32
edm::eventsetup::DependentRecordImplementation::get
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
Definition: DependentRecordImplementation.h:109
b
double b
Definition: hdecay.h:118
CTPPSModifiedOpticalFunctionsESSource::inputOpticsToken_
const edm::ESGetToken< LHCInterpolatedOpticalFunctionsSetCollection, CTPPSInterpolatedOpticsRcd > inputOpticsToken_
Definition: CTPPSModifiedOpticalFunctionsESSource.cc:26
CTPPSModifiedOpticalFunctionsESSource::rpDecId_56_F_
const unsigned int rpDecId_56_F_
Definition: CTPPSModifiedOpticalFunctionsESSource.cc:32
a
double a
Definition: hdecay.h:119
CTPPSDetId
Base class for CTPPS detector IDs.
Definition: CTPPSDetId.h:31
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
protons_cff.arm
arm
Definition: protons_cff.py:39
profile_2016_postTS2_cff.rpId
rpId
Definition: profile_2016_postTS2_cff.py:21
protons_cff.xi
xi
Definition: protons_cff.py:31
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
ztail.d
d
Definition: ztail.py:151
cms::Exception
Definition: Exception.h:70
LHCOpticalFunctionsSet::eLx
Definition: LHCOpticalFunctionsSet.h:16