CMS 3D CMS Logo

CTPPSBeamParametersESSource.cc
Go to the documentation of this file.
1 /****************************************************************************
2  *
3  * CondFormats/PPSObjects/plugins/CTPPSBeamParametersESSource.cc
4  *
5  * Description : - Loads CTPPSBeamParameters from the CTPPSBeamParametersESSource_cfi.py
6  * config file.
7  * - Currently, one single set of beam parameters is provided. Just to be
8  * ready in time for 10_4_0 and allow simple tests.
9  * - To be further developed to provide multiple sets of parameters
10  * - Needed while CTPPSBeamParameters is not available in database
11  *
12  *
13  * Author:
14  * Wagner Carvalho wcarvalh@cern.ch
15  *
16  ****************************************************************************/
17 
21 
28 
31 
32 #include <memory>
33 
34 //----------------------------------------------------------------------------------------------------
35 
36 using namespace std;
37 
43 public:
45  ~CTPPSBeamParametersESSource() override = default;
46 
47  std::unique_ptr<CTPPSBeamParameters> produce(const CTPPSBeamParametersRcd&);
49 
50 private:
52 
54  void setBeamParameters(const edm::ParameterSet&);
56  std::unique_ptr<CTPPSBeamParameters> fillBeamParameters();
57 
58  // Beam parameters
59  double beamMom45_, beamMom56_;
60  double betaStarX45_, betaStarY45_, betaStarX56_, betaStarY56_;
61  double beamDivX45_, beamDivY45_, beamDivX56_, beamDivY56_;
62  double halfXangleX45_, halfXangleY45_;
63  double halfXangleX56_, halfXangleY56_;
64  double vtxOffsetX45_, vtxOffsetY45_, vtxOffsetZ45_, vtxOffsetT45_;
65  double vtxOffsetX56_, vtxOffsetY56_, vtxOffsetZ56_, vtxOffsetT56_;
66  double vtxStddevX_, vtxStddevY_, vtxStddevZ_, vtxStddevT_;
67 
68 protected:
70  void setIntervalFor(const edm::eventsetup::EventSetupRecordKey&,
71  const edm::IOVSyncValue&,
72  edm::ValidityInterval&) override;
73 };
74 
75 //----------------------------------------------------------------------------------------------------
76 
78  : setBeamPars_(iConfig.getParameter<bool>("setBeamPars")),
79  beamMom45_(0.),
80  beamMom56_(0.),
81  betaStarX45_(0.),
82  betaStarY45_(0.),
83  betaStarX56_(0.),
84  betaStarY56_(0.),
85  beamDivX45_(0.),
86  beamDivY45_(0.),
87  beamDivX56_(0.),
88  beamDivY56_(0.),
89  halfXangleX45_(0.),
90  halfXangleY45_(0.),
91  halfXangleX56_(0.),
92  halfXangleY56_(0.),
93  vtxOffsetX45_(0.),
94  vtxOffsetY45_(0.),
95  vtxOffsetZ45_(0.),
96  vtxOffsetT45_(0.),
97  vtxOffsetX56_(0.),
98  vtxOffsetY56_(0.),
99  vtxOffsetZ56_(0.),
100  vtxOffsetT56_(0.),
101  vtxStddevX_(0.),
102  vtxStddevY_(0.),
103  vtxStddevZ_(0.),
104  vtxStddevT_(0.) {
105  if (setBeamPars_)
106  setBeamParameters(iConfig);
107 
108  setWhatProduced(this);
109  findingRecord<CTPPSBeamParametersRcd>();
110 }
111 
112 //----------------------------------------------------------------------------------------------------
113 
114 std::unique_ptr<CTPPSBeamParameters> CTPPSBeamParametersESSource::produce(const CTPPSBeamParametersRcd&) {
115  // If beam parameters are available from the config file, fill their values into CTPPSBeamParameters object
116  auto bp = (setBeamPars_) ? fillBeamParameters() : std::make_unique<CTPPSBeamParameters>();
117 
118  edm::LogInfo("CTPPSBeamParametersESSource::produce") << "\n" << *bp;
119 
120  return bp;
121 }
122 
123 //----------------------------------------------------------------------------------------------------
124 
126  beamMom45_ = iConfig.getParameter<double>("beamMom45");
127  beamMom56_ = iConfig.getParameter<double>("beamMom56");
128  betaStarX45_ = iConfig.getParameter<double>("betaStarX45");
129  betaStarX56_ = iConfig.getParameter<double>("betaStarX56");
130  betaStarY45_ = iConfig.getParameter<double>("betaStarY45");
131  betaStarY56_ = iConfig.getParameter<double>("betaStarY56");
132  beamDivX45_ = iConfig.getParameter<double>("beamDivX45");
133  beamDivX56_ = iConfig.getParameter<double>("beamDivX56");
134  beamDivY45_ = iConfig.getParameter<double>("beamDivY45");
135  beamDivY56_ = iConfig.getParameter<double>("beamDivY56");
136  halfXangleX45_ = iConfig.getParameter<double>("halfXangleX45");
137  halfXangleX56_ = iConfig.getParameter<double>("halfXangleX56");
138  halfXangleY45_ = iConfig.getParameter<double>("halfXangleY45");
139  halfXangleY56_ = iConfig.getParameter<double>("halfXangleY56");
140  vtxOffsetX45_ = iConfig.getParameter<double>("vtxOffsetX45");
141  vtxOffsetY45_ = iConfig.getParameter<double>("vtxOffsetY45");
142  vtxOffsetZ45_ = iConfig.getParameter<double>("vtxOffsetZ45");
143  vtxOffsetT45_ = iConfig.getParameter<double>("vtxOffsetT45");
144  vtxOffsetX56_ = iConfig.getParameter<double>("vtxOffsetX56");
145  vtxOffsetY56_ = iConfig.getParameter<double>("vtxOffsetY56");
146  vtxOffsetZ56_ = iConfig.getParameter<double>("vtxOffsetZ56");
147  vtxOffsetT56_ = iConfig.getParameter<double>("vtxOffsetT56");
148  vtxStddevX_ = iConfig.getParameter<double>("vtxStddevX");
149  vtxStddevY_ = iConfig.getParameter<double>("vtxStddevY");
150  vtxStddevZ_ = iConfig.getParameter<double>("vtxStddevZ");
151  vtxStddevT_ = iConfig.getParameter<double>("vtxStddevT");
152 }
153 
154 //----------------------------------------------------------------------------------------------------
155 
156 std::unique_ptr<CTPPSBeamParameters> CTPPSBeamParametersESSource::fillBeamParameters() {
157  auto p = std::make_unique<CTPPSBeamParameters>();
158 
159  p->setBeamMom45(beamMom45_);
160  p->setBeamMom56(beamMom56_);
161 
162  p->setBetaStarX45(betaStarX45_);
163  p->setBetaStarY45(betaStarY45_);
164  p->setBetaStarX56(betaStarX56_);
165  p->setBetaStarY56(betaStarY56_);
166 
167  p->setBeamDivergenceX45(beamDivX45_);
168  p->setBeamDivergenceY45(beamDivY45_);
169  p->setBeamDivergenceX56(beamDivX56_);
170  p->setBeamDivergenceY56(beamDivY56_);
171 
172  p->setHalfXangleX45(halfXangleX45_);
173  p->setHalfXangleY45(halfXangleY45_);
174  p->setHalfXangleX56(halfXangleX56_);
175  p->setHalfXangleY56(halfXangleY56_);
176 
177  p->setVtxOffsetX45(vtxOffsetX45_);
178  p->setVtxOffsetY45(vtxOffsetY45_);
179  p->setVtxOffsetZ45(vtxOffsetZ45_);
180  p->setVtxOffsetT45(vtxOffsetT45_);
181  p->setVtxOffsetX56(vtxOffsetX56_);
182  p->setVtxOffsetY56(vtxOffsetY56_);
183  p->setVtxOffsetZ56(vtxOffsetZ56_);
184  p->setVtxOffsetT56(vtxOffsetT56_);
185 
186  p->setVtxStddevX(vtxStddevX_);
187  p->setVtxStddevY(vtxStddevY_);
188  p->setVtxStddevZ(vtxStddevZ_);
189  p->setVtxStddevT(vtxStddevT_);
190 
191  return p;
192 }
193 
194 //----------------------------------------------------------------------------------------------------
195 
197  const edm::IOVSyncValue& iosv,
198  edm::ValidityInterval& oValidity) {
199  edm::LogInfo("CTPPSBeamParametersESSource")
200  << ">> CTPPSBeamParametersESSource::setIntervalFor(" << key.name() << ")\n"
201  << " run=" << iosv.eventID().run() << ", event=" << iosv.eventID().event();
202 
204  oValidity = infinity;
205 }
206 
207 //----------------------------------------------------------------------------------------------------
208 
211  desc.add<bool>("setBeamPars", true);
212  // beam momentum (GeV)
213  desc.add<double>("beamMom45", 6500.);
214  desc.add<double>("beamMom56", 6500.);
215  // beta* (cm)
216  desc.add<double>("betaStarX45", 30.);
217  desc.add<double>("betaStarY45", 30.);
218  desc.add<double>("betaStarX56", 30.);
219  desc.add<double>("betaStarY56", 30.);
220  // beam divergence (rad)
221  desc.add<double>("beamDivX45", 0.1);
222  desc.add<double>("beamDivY45", 0.1);
223  desc.add<double>("beamDivX56", 0.1);
224  desc.add<double>("beamDivY56", 0.1);
225  // half crossing angle (rad)
226  desc.add<double>("halfXangleX45", 80.e-6);
227  desc.add<double>("halfXangleY45", 80.e-6);
228  desc.add<double>("halfXangleX56", 80.e-6);
229  desc.add<double>("halfXangleY56", 80.e-6);
230  // vertex offset (cm)
231  desc.add<double>("vtxOffsetX45", 1.e-2);
232  desc.add<double>("vtxOffsetY45", 1.e-2);
233  desc.add<double>("vtxOffsetZ45", 1.e-2);
234  desc.add<double>("vtxOffsetT45", 1.e-2);
235  desc.add<double>("vtxOffsetX56", 1.e-2);
236  desc.add<double>("vtxOffsetY56", 1.e-2);
237  desc.add<double>("vtxOffsetZ56", 1.e-2);
238  desc.add<double>("vtxOffsetT56", 1.e-2);
239  // vertex sigma (cm)
240  desc.add<double>("vtxStddevX", 2.e-2);
241  desc.add<double>("vtxStddevY", 2.e-2);
242  desc.add<double>("vtxStddevZ", 2.e-2);
243  desc.add<double>("vtxStddevT", 2.e-2);
244 
245  descriptions.add("ctppsBeamParametersESSource", desc);
246 }
247 
248 //----------------------------------------------------------------------------------------------------
249 
CTPPSBeamParametersESSource::produce
std::unique_ptr< CTPPSBeamParameters > produce(const CTPPSBeamParametersRcd &)
Definition: CTPPSBeamParametersESSource.cc:114
CTPPSBeamParametersESSource::betaStarX56_
double betaStarX56_
Definition: CTPPSBeamParametersESSource.cc:60
CTPPSBeamParameters.h
CTPPSBeamParametersESSource::CTPPSBeamParametersESSource
CTPPSBeamParametersESSource(const edm::ParameterSet &)
Definition: CTPPSBeamParametersESSource.cc:77
electrons_cff.bool
bool
Definition: electrons_cff.py:366
CTPPSBeamParametersESSource::betaStarY56_
double betaStarY56_
Definition: CTPPSBeamParametersESSource.cc:60
CTPPSBeamParametersESSource::beamDivY56_
double beamDivY56_
Definition: CTPPSBeamParametersESSource.cc:61
CTPPSBeamParametersRcd.h
MessageLogger.h
ESHandle.h
CTPPSBeamParametersESSource::betaStarX45_
double betaStarX45_
Definition: CTPPSBeamParametersESSource.cc:60
CTPPSBeamParametersESSource
Loads CTPPSBeamParameters from a config file.
Definition: CTPPSBeamParametersESSource.cc:42
CTPPSBeamParametersESSource::beamDivX45_
double beamDivX45_
Definition: CTPPSBeamParametersESSource.cc:61
edm::ESProducer::setWhatProduced
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:163
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
edm::ValidityInterval
Definition: ValidityInterval.h:28
ESProducer.h
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
infinity
const double infinity
Definition: CSCChamberFitter.cc:10
edm::EventSetupRecordIntervalFinder
Definition: EventSetupRecordIntervalFinder.h:33
edm::eventsetup::EventSetupRecordKey
Definition: EventSetupRecordKey.h:30
MakerMacros.h
CTPPSBeamParametersESSource::halfXangleX45_
double halfXangleX45_
Definition: CTPPSBeamParametersESSource.cc:62
CTPPSBeamParametersESSource::halfXangleY56_
double halfXangleY56_
Definition: CTPPSBeamParametersESSource.cc:63
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
CTPPSBeamParametersESSource::vtxOffsetZ45_
double vtxOffsetZ45_
Definition: CTPPSBeamParametersESSource.cc:64
fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
CTPPSBeamParametersESSource::vtxStddevX_
double vtxStddevX_
Definition: CTPPSBeamParametersESSource.cc:66
edm::IOVSyncValue
Definition: IOVSyncValue.h:31
edm::EventID::run
RunNumber_t run() const
Definition: EventID.h:38
DEFINE_FWK_EVENTSETUP_SOURCE
#define DEFINE_FWK_EVENTSETUP_SOURCE(type)
Definition: SourceFactory.h:91
EventSetupRecordIntervalFinder.h
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
ESProducts.h
CTPPSBeamParametersESSource::beamDivY45_
double beamDivY45_
Definition: CTPPSBeamParametersESSource.cc:61
SourceFactory.h
CTPPSBeamParametersESSource::vtxStddevZ_
double vtxStddevZ_
Definition: CTPPSBeamParametersESSource.cc:66
edm::IOVSyncValue::eventID
const EventID & eventID() const
Definition: IOVSyncValue.h:40
CTPPSBeamParametersESSource::setIntervalFor
void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &) override
sets infinite validity of this data
Definition: CTPPSBeamParametersESSource.cc:196
edm::ParameterSet
Definition: ParameterSet.h:47
AlCaHLTBitMon_ParallelJobs.p
def p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
CTPPSBeamParametersESSource::beamMom45_
double beamMom45_
Definition: CTPPSBeamParametersESSource.cc:59
edm::IOVSyncValue::endOfTime
static const IOVSyncValue & endOfTime()
Definition: IOVSyncValue.cc:82
edm::EventID::event
EventNumber_t event() const
Definition: EventID.h:40
CTPPSBeamParametersESSource::beamMom56_
double beamMom56_
Definition: CTPPSBeamParametersESSource.cc:59
CTPPSBeamParametersESSource::vtxOffsetY56_
double vtxOffsetY56_
Definition: CTPPSBeamParametersESSource.cc:65
CTPPSBeamParametersESSource::setBeamParameters
void setBeamParameters(const edm::ParameterSet &)
Set BP to their values from config.
Definition: CTPPSBeamParametersESSource.cc:125
CTPPSBeamParametersESSource::vtxStddevT_
double vtxStddevT_
Definition: CTPPSBeamParametersESSource.cc:66
CTPPSBeamParametersESSource::vtxOffsetT45_
double vtxOffsetT45_
Definition: CTPPSBeamParametersESSource.cc:64
CTPPSBeamParametersESSource::betaStarY45_
double betaStarY45_
Definition: CTPPSBeamParametersESSource.cc:60
CTPPSBeamParametersRcd
Definition: CTPPSBeamParametersRcd.h:14
CTPPSBeamParametersESSource::setBeamPars_
bool setBeamPars_
Definition: CTPPSBeamParametersESSource.cc:51
CTPPSBeamParametersESSource::vtxOffsetX45_
double vtxOffsetX45_
Definition: CTPPSBeamParametersESSource.cc:64
ModuleFactory.h
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
CTPPSBeamParametersESSource::beamDivX56_
double beamDivX56_
Definition: CTPPSBeamParametersESSource.cc:61
std
Definition: JetResolutionObject.h:76
CTPPSBeamParametersESSource::vtxOffsetT56_
double vtxOffsetT56_
Definition: CTPPSBeamParametersESSource.cc:65
CTPPSBeamParametersESSource::vtxStddevY_
double vtxStddevY_
Definition: CTPPSBeamParametersESSource.cc:66
CTPPSBeamParametersESSource::vtxOffsetY45_
double vtxOffsetY45_
Definition: CTPPSBeamParametersESSource.cc:64
CTPPSBeamParametersESSource::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &)
Definition: CTPPSBeamParametersESSource.cc:209
edm::IOVSyncValue::beginOfTime
static const IOVSyncValue & beginOfTime()
Definition: IOVSyncValue.cc:88
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::ESProducer
Definition: ESProducer.h:104
CTPPSBeamParametersESSource::vtxOffsetZ56_
double vtxOffsetZ56_
Definition: CTPPSBeamParametersESSource.cc:65
ParameterSet.h
CTPPSBeamParametersESSource::vtxOffsetX56_
double vtxOffsetX56_
Definition: CTPPSBeamParametersESSource.cc:65
crabWrapper.key
key
Definition: crabWrapper.py:19
CTPPSBeamParametersESSource::halfXangleY45_
double halfXangleY45_
Definition: CTPPSBeamParametersESSource.cc:62
CTPPSBeamParametersESSource::fillBeamParameters
std::unique_ptr< CTPPSBeamParameters > fillBeamParameters()
Fill CTPPSBeamParameters object with BP.
Definition: CTPPSBeamParametersESSource.cc:156
CTPPSBeamParametersESSource::halfXangleX56_
double halfXangleX56_
Definition: CTPPSBeamParametersESSource.cc:63