25 #include "Math/GenVector/Rotation3D.h"
26 #include <CLHEP/Random/RandFlat.h>
64 produces<PEcalTBInfo>();
72 beamEta = (fMaxEta + fMinEta) / 2.;
73 beamPhi = (fMaxPhi + fMinPhi) / 2.;
78 std::string fullMapName = CrystalMapFile.fullPath();
88 if (fabs(beamEta - eta) < deltaEta && fabs(
beamPhi - phi) < deltaPhi) {
89 deltaEta = fabs(beamEta - eta);
92 }
else if (fabs(beamEta - eta) < deltaEta && fabs(
beamPhi - phi) > deltaPhi) {
93 if (fabs(
beamPhi - phi) < 0.017) {
94 deltaEta = fabs(beamEta - eta);
98 }
else if (fabs(beamEta - eta) > deltaEta && fabs(
beamPhi - phi) < deltaPhi) {
99 if (fabs(beamEta - eta) < 0.017) {
100 deltaEta = fabs(beamEta - eta);
101 deltaPhi = fabs(
beamPhi - phi);
107 edm::LogVerbatim(
"EcalTBInfo") <<
"Initialize TB MC ECAL info producer with parameters: \n"
108 <<
"Crystal map file: " << CrystalMapFile <<
"\n"
109 <<
"Beam average eta = " << beamEta <<
"\n"
110 <<
"Beam average phi = " <<
beamPhi <<
"\n"
111 <<
"Corresponding to crystal number = " <<
crysNumber <<
"\n"
112 <<
"Beam X offset = " <<
beamXoff <<
"\n"
129 fromCMStoTB =
new ROOT::Math::Rotation3D(xx, xy, xz, yx, yy, yz, zx, zy, zz);
134 throw cms::Exception(
"Configuration") <<
"EcalTBMCInfoProducer requires the RandomNumberGeneratorService\n"
135 "which is not present in the configuration file. You must add the "
137 "in the configuration file or remove the modules that require it.";
147 std::unique_ptr<PEcalTBInfo> product(
new PEcalTBInfo());
165 HepMC::GenEvent::vertex_const_iterator Vtx = Evt->vertices_begin();
167 math::XYZPoint eventCMSVertex((*Vtx)->position().x(), (*Vtx)->position().y(), (*Vtx)->position().z());
169 LogDebug(
"EcalTBInfo") <<
"Generated vertex position = " << eventCMSVertex.x() <<
" " << eventCMSVertex.y() <<
" "
170 << eventCMSVertex.z();
174 LogDebug(
"EcalTBInfo") <<
"Rotated vertex position = " << eventTBVertex.x() <<
" " << eventTBVertex.y() <<
" "
175 << eventTBVertex.z();
183 double thisPhaseShift = CLHEP::RandFlat::shoot(engine);
185 product->setPhaseShift(thisPhaseShift);
186 LogDebug(
"EcalTBInfo") <<
"Asynchronous Phaseshift = " << thisPhaseShift;
Log< level::Info, true > LogVerbatim
edm::EDGetTokenT< edm::HepMCProduct > GenVtxToken
static const int NCRYSTAL
#define DEFINE_FWK_MODULE(type)
Sin< T >::type sin(const T &t)
Exp< T >::type exp(const T &t)
~EcalTBMCInfoProducer() override
Destructor.
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)
EcalTBCrystalMap * theTestMap
Basic2DVector< T > xy() const
XYZPointD XYZPoint
point in space with cartesian internal representation
T getParameter(std::string const &) const
void findCrystalAngles(const int thisCrysIndex, double &thisEta, double &thisPhi)
StreamID streamID() const
ROOT::Math::Rotation3D * fromCMStoTB
EcalTBMCInfoProducer(const edm::ParameterSet &ps)
Constructor.