CMS 3D CMS Logo

CTPPSBeamParametersFromLHCInfoESSource.cc
Go to the documentation of this file.
1 /****************************************************************************
2  * Authors:
3  * Wagner Carvalho wcarvalh@cern.ch
4  * Jan Kašpar
5  ****************************************************************************/
6 
10 
15 
18 
20 
22 
23 //----------------------------------------------------------------------------------------------------
24 
26 public:
28  ~CTPPSBeamParametersFromLHCInfoESSource() override = default;
29 
30  std::unique_ptr<CTPPSBeamParameters> produce(const CTPPSBeamParametersRcd&);
32 
33 private:
37  const bool useNewLHCInfo_;
38 
40 };
41 
42 //----------------------------------------------------------------------------------------------------
43 
45  : useNewLHCInfo_(iConfig.getParameter<bool>("useNewLHCInfo")) {
46  auto cc = setWhatProduced(this);
47  lhcInfoToken_ = cc.consumes(edm::ESInputTag("", iConfig.getParameter<std::string>("lhcInfoLabel")));
48  lhcInfoPerLSToken_ = cc.consumes(edm::ESInputTag("", iConfig.getParameter<std::string>("lhcInfoPerLSLabel")));
49  lhcInfoPerFillToken_ = cc.consumes(edm::ESInputTag("", iConfig.getParameter<std::string>("lhcInfoPerFillLabel")));
50 
51  defaultParameters_.setBeamDivergenceX45(iConfig.getParameter<double>("beamDivX45"));
52  defaultParameters_.setBeamDivergenceY45(iConfig.getParameter<double>("beamDivX56"));
53  defaultParameters_.setBeamDivergenceX56(iConfig.getParameter<double>("beamDivY45"));
54  defaultParameters_.setBeamDivergenceY56(iConfig.getParameter<double>("beamDivY56"));
55 
56  defaultParameters_.setVtxOffsetX45(iConfig.getParameter<double>("vtxOffsetX45"));
57  defaultParameters_.setVtxOffsetY45(iConfig.getParameter<double>("vtxOffsetY45"));
58  defaultParameters_.setVtxOffsetZ45(iConfig.getParameter<double>("vtxOffsetZ45"));
59  defaultParameters_.setVtxOffsetX56(iConfig.getParameter<double>("vtxOffsetX56"));
60  defaultParameters_.setVtxOffsetY56(iConfig.getParameter<double>("vtxOffsetY56"));
61  defaultParameters_.setVtxOffsetZ56(iConfig.getParameter<double>("vtxOffsetZ56"));
62 
63  defaultParameters_.setVtxStddevX(iConfig.getParameter<double>("vtxStddevX"));
64  defaultParameters_.setVtxStddevY(iConfig.getParameter<double>("vtxStddevY"));
65  defaultParameters_.setVtxStddevZ(iConfig.getParameter<double>("vtxStddevZ"));
66 }
67 
68 //----------------------------------------------------------------------------------------------------
69 
70 std::unique_ptr<CTPPSBeamParameters> CTPPSBeamParametersFromLHCInfoESSource::produce(
71  const CTPPSBeamParametersRcd& iRecord) {
72  auto lhcInfoCombined =
76 
77  auto bp = std::make_unique<CTPPSBeamParameters>(defaultParameters_);
78 
79  const auto beamMom = lhcInfoCombined.energy;
80  const auto betaStar = lhcInfoCombined.betaStarX * 1E2; // conversion m --> cm
81  const auto xangle = lhcInfoCombined.crossingAngle() * 1E-6; // conversion mu rad --> rad
82 
83  bp->setBeamMom45(beamMom);
84  bp->setBeamMom56(beamMom);
85 
86  bp->setBetaStarX45(betaStar);
87  bp->setBetaStarX56(betaStar);
88  bp->setBetaStarY45(betaStar);
89  bp->setBetaStarY56(betaStar);
90 
91  bp->setHalfXangleX45(xangle);
92  bp->setHalfXangleX56(xangle);
93  bp->setHalfXangleY45(xangle);
94  bp->setHalfXangleY56(xangle);
95 
96  return bp;
97 }
98 
99 //----------------------------------------------------------------------------------------------------
100 
103 
104  desc.add<std::string>("lhcInfoLabel", "");
105  desc.add<std::string>("lhcInfoPerLSLabel", "");
106  desc.add<std::string>("lhcInfoPerFillLabel", "");
107  desc.add<bool>("useNewLHCInfo", false);
108 
109  // beam divergence (rad)
110  desc.add<double>("beamDivX45", 0.1);
111  desc.add<double>("beamDivY45", 0.1);
112  desc.add<double>("beamDivX56", 0.1);
113  desc.add<double>("beamDivY56", 0.1);
114 
115  // vertex offset (cm)
116  desc.add<double>("vtxOffsetX45", 1.e-2);
117  desc.add<double>("vtxOffsetY45", 1.e-2);
118  desc.add<double>("vtxOffsetZ45", 1.e-2);
119  desc.add<double>("vtxOffsetX56", 1.e-2);
120  desc.add<double>("vtxOffsetY56", 1.e-2);
121  desc.add<double>("vtxOffsetZ56", 1.e-2);
122 
123  // vertex sigma (cm)
124  desc.add<double>("vtxStddevX", 2.e-2);
125  desc.add<double>("vtxStddevY", 2.e-2);
126  desc.add<double>("vtxStddevZ", 2.e-2);
127 
128  descriptions.add("ctppsBeamParametersFromLHCInfoESSourceDefault", desc);
129 }
130 
131 //----------------------------------------------------------------------------------------------------
132 
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:166
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
edm::ESGetToken< LHCInfoPerFill, LHCInfoPerFillRcd > lhcInfoPerFillToken_
edm::ESGetToken< LHCInfoPerLS, LHCInfoPerLSRcd > lhcInfoPerLSToken_
static void fillDescriptions(edm::ConfigurationDescriptions &)
void setBeamDivergenceY45(double div)
uint32_t cc[maxCellsPerHit]
Definition: gpuFishbone.h:49
std::unique_ptr< CTPPSBeamParameters > produce(const CTPPSBeamParametersRcd &)
void setVtxStddevX(double stddev)
void setVtxStddevZ(double stddev)
void setVtxOffsetY56(double offset)
void setBeamDivergenceX56(double div)
void setBeamDivergenceX45(double div)
void setVtxOffsetZ56(double offset)
void setVtxStddevY(double stddev)
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:61
void setVtxOffsetX45(double offset)
void setBeamDivergenceY56(double div)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void setVtxOffsetY45(double offset)
~CTPPSBeamParametersFromLHCInfoESSource() override=default
void setVtxOffsetZ45(double offset)
void setVtxOffsetX56(double offset)
static LHCInfoCombined createLHCInfoCombined(const edm::eventsetup::DependentRecordImplementation< RecordT, ListT > &iRecord, const edm::ESGetToken< LHCInfoPerLS, LHCInfoPerLSRcd > &tokenInfoPerLS, const edm::ESGetToken< LHCInfoPerFill, LHCInfoPerFillRcd > &tokenInfoPerFill, const edm::ESGetToken< LHCInfo, LHCInfoRcd > &tokenInfo, bool useNewLHCInfo)