25 #include "Math/GenVector/Rotation3D.h" 26 #include <CLHEP/Random/RandFlat.h> 68 : fMinEta(ps.getParameter<double>(
"MinEta")),
69 fMaxEta(ps.getParameter<double>(
"MaxEta")),
70 fMinPhi(ps.getParameter<double>(
"MinPhi")),
71 fMaxPhi(ps.getParameter<double>(
"MaxPhi")),
72 beamEta((fMaxEta + fMinEta) / 2.),
73 beamPhi((fMaxPhi + fMinPhi) / 2.),
74 beamTheta(2.0 * atan(
exp(-beamEta))),
75 beamXoff(ps.getParameter<double>(
"BeamMeanX")),
76 beamYoff(ps.getParameter<double>(
"BeamMeanX")),
78 produces<PEcalTBInfo>();
83 theTestMap = std::make_unique<EcalTBCrystalMap>(fullMapName);
111 edm::LogVerbatim(
"EcalTBInfo") <<
"Initialize TB MC ECAL info producer with parameters: \n" 113 <<
"Beam average eta = " <<
beamEta <<
"\n" 114 <<
"Beam average phi = " <<
beamPhi <<
"\n" 115 <<
"Corresponding to crystal number = " <<
crysNumber <<
"\n" 116 <<
"Beam X offset = " <<
beamXoff <<
"\n" 137 if (!rng.isAvailable()) {
138 throw cms::Exception(
"Configuration") <<
"EcalTBMCInfoProducer requires the RandomNumberGeneratorService\n" 139 "which is not present in the configuration file. You must add the " 141 "in the configuration file or remove the modules that require it.";
147 CLHEP::HepRandomEngine *engine = &rng->
getEngine(
event.streamID());
149 std::unique_ptr<PEcalTBInfo> product(
new PEcalTBInfo());
166 HepMC::GenEvent::vertex_const_iterator Vtx = Evt->vertices_begin();
168 math::XYZPoint eventCMSVertex((*Vtx)->position().x(), (*Vtx)->position().y(), (*Vtx)->position().z());
170 LogDebug(
"EcalTBInfo") <<
"Generated vertex position = " << eventCMSVertex.x() <<
" " << eventCMSVertex.y() <<
" " 171 << eventCMSVertex.z();
175 LogDebug(
"EcalTBInfo") <<
"Rotated vertex position = " << eventTBVertex.x() <<
" " << eventTBVertex.y() <<
" " 176 << eventTBVertex.z();
184 double thisPhaseShift = CLHEP::RandFlat::shoot(engine);
186 product->setPhaseShift(thisPhaseShift);
187 LogDebug(
"EcalTBInfo") <<
"Asynchronous Phaseshift = " << thisPhaseShift;
Log< level::Info, true > LogVerbatim
std::unique_ptr< ROOT::Math::Rotation3D > fromCMStoTB
T getParameter(std::string const &) const
static const int NCRYSTAL
Sin< T >::type sin(const T &t)
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.
static const double deltaEta
void produce(edm::Event &event, const edm::EventSetup &eventSetup) override
Produce digis out of raw data.
Cos< T >::type cos(const T &t)
#define DEFINE_FWK_MODULE(type)
const HepMC::GenEvent * GetEvent() const
std::unique_ptr< EcalTBCrystalMap > theTestMap
XYZPointD XYZPoint
point in space with cartesian internal representation
const edm::EDGetTokenT< edm::HepMCProduct > GenVtxToken
EcalTBMCInfoProducer(const edm::ParameterSet &ps)
Constructor.
~EcalTBMCInfoProducer() override=default
Destructor.