CMS 3D CMS Logo

BeamProfileHLLHC2DBWriter.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: BeamProfileHLLHC2DBWriter
4 // Class: BeamProfileHLLHC2DBWriter
5 //
13 //
14 // Original Author: Francesco Brivio (INFN Milano-Bicocca)
15 // Created: November 2, 2023
16 //
17 
18 // system include files
19 #include <memory>
20 
21 // user include files
30 
31 #include "CLHEP/Units/GlobalSystemOfUnits.h"
32 #include "CLHEP/Units/GlobalPhysicalConstants.h"
33 
34 //
35 // class declaration
36 //
38 public:
40  ~BeamProfileHLLHC2DBWriter() override = default;
41 
42  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
43 
44 private:
45  void analyze(edm::StreamID, const edm::Event&, const edm::EventSetup&) const override;
46  void endJob() override;
47 
48  // ----------member data ---------------------------
51 };
52 
53 // ------------ constructor ------------
55  : recordName_(iConfig.getParameter<std::string>("recordName")) {
56  beamSpot_.setMeanX(iConfig.getParameter<double>("MeanX"));
57  beamSpot_.setMeanY(iConfig.getParameter<double>("MeanY"));
58  beamSpot_.setMeanZ(iConfig.getParameter<double>("MeanZ"));
59  beamSpot_.setEProton(iConfig.getParameter<double>("EProton"));
60  beamSpot_.setCrabFrequency(iConfig.getParameter<double>("CrabFrequency"));
61  beamSpot_.setRF800(iConfig.getParameter<double>("RF800"));
62  beamSpot_.setCrossingAngle(iConfig.getParameter<double>("CrossingAngle"));
63  beamSpot_.setCrabbingAngleCrossing(iConfig.getParameter<double>("CrabbingAngleCrossing"));
64  beamSpot_.setCrabbingAngleSeparation(iConfig.getParameter<double>("CrabbingAngleSeparation"));
65  beamSpot_.setBetaCrossingPlane(iConfig.getParameter<double>("BetaCrossingPlane"));
66  beamSpot_.setBetaSeparationPlane(iConfig.getParameter<double>("BetaSeparationPlane"));
67  beamSpot_.setHorizontalEmittance(iConfig.getParameter<double>("HorizontalEmittance"));
68  beamSpot_.setVerticalEmittance(iConfig.getParameter<double>("VerticalEmittance"));
69  beamSpot_.setBunchLength(iConfig.getParameter<double>("BunchLength"));
70  beamSpot_.setTimeOffset(iConfig.getParameter<double>("TimeOffset"));
71 }
72 
73 // ------------ method called for each event ------------
75 
76 // ------------ method called once each job just after ending the event loop ------------
79  poolDbService->createOneIOV<SimBeamSpotHLLHCObjects>(beamSpot_, poolDbService->beginOfTime(), recordName_);
80 }
81 
82 // ------------ method fills 'descriptions' with the allowed parameters for the module ------------
85  desc.add<std::string>("recordName", "SimBeamSpotHLLHCObjectsRcd")
86  ->setComment("name of the record to use for the PoolDBOutputService");
87  desc.add<double>("MeanX", 0.0)->setComment("in cm");
88  desc.add<double>("MeanY", 0.0)->setComment("in cm");
89  desc.add<double>("MeanZ", 0.0)->setComment("in cm");
90  desc.add<double>("EProton", 0.0)->setComment("in GeV");
91  desc.add<double>("CrabFrequency", 0.0)->setComment("in MHz");
92  desc.add<double>("RF800", 0.0)->setComment("800 MHz RF?");
93  desc.add<double>("CrossingAngle", 0.0)->setComment("in urad");
94  desc.add<double>("CrabbingAngleCrossing", 0.0)->setComment("in urad");
95  desc.add<double>("CrabbingAngleSeparation", 0.0)->setComment("in urad");
96  desc.add<double>("BetaCrossingPlane", 0.0)->setComment("in m");
97  desc.add<double>("BetaSeparationPlane", 0.0)->setComment("in m");
98  desc.add<double>("HorizontalEmittance", 0.0)->setComment("in mm");
99  desc.add<double>("VerticalEmittance", 0.0)->setComment("in mm");
100  desc.add<double>("BunchLength", 0.0)->setComment("in m");
101  desc.add<double>("TimeOffset", 0.0)->setComment("in ns");
102  descriptions.addWithDefaultLabel(desc);
103 }
104 
105 //define this as a plug-in
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
void setMeanX(double val)
set meanX, meanY, meanZ
~BeamProfileHLLHC2DBWriter() override=default
void setEProton(double val)
set EProton, fCrabFrequency, RF800
void setHorizontalEmittance(double val)
void analyze(edm::StreamID, const edm::Event &, const edm::EventSetup &) const override
void createOneIOV(const T &payload, cond::Time_t firstSinceTime, const std::string &recordName)
void setBetaSeparationPlane(double val)
int iEvent
Definition: GenABIO.cc:224
void setCrabbingAngleCrossing(double val)
void setVerticalEmittance(double val)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void setBunchLength(double val)
set BunchLength and TimeOffset
void setCrossingAngle(double val)
set Crossing and Crabbing angles
SimBeamSpotHLLHCObjects beamSpot_
BeamProfileHLLHC2DBWriter(const edm::ParameterSet &)
void setCrabbingAngleSeparation(double val)
void setBetaCrossingPlane(double val)
set BetaStar and Emittance