CMS 3D CMS Logo

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 //
86 BeamProfile2DB::BeamProfile2DB(const edm::ParameterSet& iConfig) : beamSpot_(read(iConfig)) {}
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->createNewIOV<SimBeamSpotObjects>(
107  &beamSpot_, poolDbService->beginOfTime(), poolDbService->endOfTime(), "SimBeamSpotObjectsRcd");
108 }
109 
110 // ------------ method fills 'descriptions' with the allowed parameters for the module ------------
112  //The following says we do not know what parameters are allowed so do no validation
113  // Please change this to state exactly what you do use, even if it is no parameters
115  desc.add<double>("X0")->setComment("in cm");
116  desc.add<double>("Y0")->setComment("in cm");
117  desc.add<double>("Z0")->setComment("in cm");
118  desc.add<double>("SigmaZ")->setComment("in cm");
119  desc.add<double>("BetaStar")->setComment("in cm");
120  desc.add<double>("Emittance")->setComment("in cm");
121  desc.add<double>("Alpha")->setComment("in radians");
122  desc.add<double>("Phi")->setComment("in radians");
123  desc.add<double>("TimeOffset")->setComment("in ns");
124  descriptions.addDefault(desc);
125 }
126 
127 //define this as a plug-in
runTheMatrix.ret
ret
prodAgent to be discontinued
Definition: runTheMatrix.py:543
edm::StreamID
Definition: StreamID.h:30
cond::service::PoolDBOutputService::beginOfTime
cond::Time_t beginOfTime() const
Definition: PoolDBOutputService.cc:215
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
SimBeamSpotObjects.h
BeamProfile2DB
Definition: BeamProfile2DB.cc:43
SimBeamSpotObjects
Definition: SimBeamSpotObjects.h:14
BeamProfile2DB::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: BeamProfile2DB.cc:111
BeamProfile2DB::analyze
void analyze(edm::StreamID, const edm::Event &, const edm::EventSetup &) const override
Definition: BeamProfile2DB.cc:98
MakerMacros.h
PoolDBOutputService.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
cond::service::PoolDBOutputService::createNewIOV
void createNewIOV(const T *firstPayloadObj, cond::Time_t firstSinceTime, cond::Time_t, const std::string &recordName)
Definition: PoolDBOutputService.h:116
BeamProfile2DB::BeamProfile2DB
BeamProfile2DB(const edm::ParameterSet &)
Definition: BeamProfile2DB.cc:86
Service.h
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
edm::ParameterSet
Definition: ParameterSet.h:47
AlCaHLTBitMon_ParallelJobs.p
def p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
Event.h
BeamProfile2DB::beginJob
void beginJob() override
Definition: BeamProfile2DB.cc:101
edm::Service< cond::service::PoolDBOutputService >
iEvent
int iEvent
Definition: GenABIO.cc:224
BeamProfile2DB::~BeamProfile2DB
~BeamProfile2DB() override
Definition: BeamProfile2DB.cc:88
edm::EventSetup
Definition: EventSetup.h:58
readEcalDQMStatus.read
read
Definition: readEcalDQMStatus.py:38
cond::service::PoolDBOutputService::endOfTime
cond::Time_t endOfTime() const
Definition: PoolDBOutputService.cc:213
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
BeamProfile2DB::beamSpot_
SimBeamSpotObjects beamSpot_
Definition: BeamProfile2DB.cc:56
Frameworkfwd.h
BeamProfile2DB::endJob
void endJob() override
Definition: BeamProfile2DB.cc:104
ParameterSet.h
edm::Event
Definition: Event.h:73
edm::ConfigurationDescriptions::addDefault
void addDefault(ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:99
EDAnalyzer.h
edm::global::EDAnalyzer
Definition: EDAnalyzer.h:32