CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
BeamProfile2DB.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: BeamProfile2DB
4 // Class: BeamProfile2DB
5 //
13 //
14 // Original Author: Jean-Roch Vlimant,40 3-A28,+41227671209,
15 // Created: Fri Jan 6 14:49:42 CET 2012
16 //
17 //
18 
19 // system include files
20 #include <memory>
21 
22 // user include files
26 
29 
31 
35 
36 #include "CLHEP/Units/GlobalSystemOfUnits.h"
37 #include "CLHEP/Units/GlobalPhysicalConstants.h"
38 
39 //
40 // class declaration
41 //
42 
44 public:
45  explicit BeamProfile2DB(const edm::ParameterSet&);
46  ~BeamProfile2DB() override;
47 
48  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
49 
50 private:
51  void beginJob() override;
52  void analyze(edm::StreamID, const edm::Event&, const edm::EventSetup&) const override;
53  void endJob() override;
54 
55  // ----------member data ---------------------------
57 };
58 
59 namespace {
62  ret.fX0 = p.getParameter<double>("X0") * cm;
63  ret.fY0 = p.getParameter<double>("Y0") * cm;
64  ret.fZ0 = p.getParameter<double>("Z0") * cm;
65  ret.fSigmaZ = p.getParameter<double>("SigmaZ") * cm;
66  ret.fAlpha = p.getParameter<double>("Alpha") * radian;
67  ret.fPhi = p.getParameter<double>("Phi") * radian;
68  ret.fbetastar = p.getParameter<double>("BetaStar") * cm;
69  ret.femittance = p.getParameter<double>("Emittance") * cm; // this is not the normalized emittance
70  ret.fTimeOffset = p.getParameter<double>("TimeOffset") * ns * c_light; // HepMC time units are mm
71  return ret;
72  }
73 
74 } // namespace
75 //
76 // constants, enums and typedefs
77 //
78 
79 //
80 // static data member definitions
81 //
82 
83 //
84 // constructors and destructor
85 //
87 
89  // do anything here that needs to be done at desctruction time
90  // (e.g. close files, deallocate resources etc.)
91 }
92 
93 //
94 // member functions
95 //
96 
97 // ------------ method called for each event ------------
99 
100 // ------------ method called once each job just before starting event loop ------------
102 
103 // ------------ method called once each job just after ending the event loop ------------
106  poolDbService->createOneIOV<SimBeamSpotObjects>(beamSpot_, poolDbService->beginOfTime(), "SimBeamSpotObjectsRcd");
107 }
108 
109 // ------------ method fills 'descriptions' with the allowed parameters for the module ------------
111  //The following says we do not know what parameters are allowed so do no validation
112  // Please change this to state exactly what you do use, even if it is no parameters
114  desc.add<double>("X0")->setComment("in cm");
115  desc.add<double>("Y0")->setComment("in cm");
116  desc.add<double>("Z0")->setComment("in cm");
117  desc.add<double>("SigmaZ")->setComment("in cm");
118  desc.add<double>("BetaStar")->setComment("in cm");
119  desc.add<double>("Emittance")->setComment("in cm");
120  desc.add<double>("Alpha")->setComment("in radians");
121  desc.add<double>("Phi")->setComment("in radians");
122  desc.add<double>("TimeOffset")->setComment("in ns");
123  descriptions.addDefault(desc);
124 }
125 
126 //define this as a plug-in
tuple ret
prodAgent to be discontinued
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
~BeamProfile2DB() override
void beginJob() override
void createOneIOV(const T &payload, cond::Time_t firstSinceTime, const std::string &recordName)
SimBeamSpotObjects beamSpot_
int iEvent
Definition: GenABIO.cc:224
void addDefault(ParameterSetDescription const &psetDescription)
void endJob() override
void analyze(edm::StreamID, const edm::Event &, const edm::EventSetup &) const override
ParameterDescriptionBase * add(U const &iLabel, T const &value)
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
BeamProfile2DB(const edm::ParameterSet &)