10 #include "CLHEP/Random/RandFlat.h"
20 produces<PEcalTBInfo>();
28 beamEta = (fMaxEta+fMinEta)/2.;
29 beamPhi = (fMaxPhi+fMinPhi)/2.;
30 beamTheta = 2.0*atan(
exp(-beamEta));
34 string fullMapName = CrystalMapFile.fullPath();
43 theTestMap->findCrystalAngles(cryIndex, eta, phi);
44 if ( fabs(beamEta - eta) < deltaEta && fabs(beamPhi - phi) < deltaPhi ) {
45 deltaEta = fabs(beamEta - eta);
46 deltaPhi = fabs(beamPhi - phi);
47 crysNumber = cryIndex;
49 else if (fabs(beamEta - eta)<deltaEta && fabs(beamPhi - phi)>deltaPhi ) {
50 if ( fabs(beamPhi - phi) < 0.017 ) {
51 deltaEta = fabs(beamEta - eta);
52 deltaPhi = fabs(beamPhi - phi);
53 crysNumber = cryIndex;
56 else if (fabs(beamEta - eta)>deltaEta && fabs(beamPhi - phi)<deltaPhi ) {
57 if ( fabs(beamEta - eta) < 0.017 ) {
58 deltaEta = fabs(beamEta - eta);
59 deltaPhi = fabs(beamPhi - phi);
60 crysNumber = cryIndex;
65 edm::LogInfo(
"EcalTBInfo") <<
"Initialize TB MC ECAL info producer with parameters: \n"
66 <<
"Crystal map file: " << CrystalMapFile <<
"\n"
67 <<
"Beam average eta = " << beamEta <<
"\n"
68 <<
"Beam average phi = " << beamPhi <<
"\n"
69 <<
"Corresponding to crystal number = " << crysNumber <<
"\n"
70 <<
"Beam X offset = " << beamXoff <<
"\n"
71 <<
"Beam Y offset = " << beamYoff;
75 double xx = -
cos(beamTheta)*
cos(beamPhi);
76 double xy = -
cos(beamTheta)*
sin(beamPhi);
77 double xz =
sin(beamTheta);
79 double yx =
sin(beamPhi);
80 double yy = -
cos(beamPhi);
83 double zx =
sin(beamTheta)*
cos(beamPhi);
84 double zy =
sin(beamTheta)*
sin(beamPhi);
85 double zz =
cos(beamTheta);
87 fromCMStoTB =
new ROOT::Math::Rotation3D(xx, xy, xz, yx, yy, yz, zx, zy, zz);
93 <<
"EcalTBMCInfoProducer requires the RandomNumberGeneratorService\n"
94 "which is not present in the configuration file. You must add the service\n"
95 "in the configuration file or remove the modules that require it.";
112 product->setCrystal(crysNumber);
114 product->setBeamDirection(beamEta, beamPhi);
115 product->setBeamOffset(beamXoff, beamYoff);
120 partXhodo = partYhodo = 0.;
123 event.getByLabel(GenVtxLabel,GenEvt);
125 const HepMC::GenEvent* Evt = GenEvt->GetEvent() ;
126 HepMC::GenEvent::vertex_const_iterator Vtx = Evt->vertices_begin();
129 (*Vtx)->position().y(),
130 (*Vtx)->position().z());
132 LogDebug(
"EcalTBInfo") <<
"Generated vertex position = "
133 << eventCMSVertex.x() <<
" "
134 << eventCMSVertex.y() <<
" "
135 << eventCMSVertex.z();
139 LogDebug(
"EcalTBInfo") <<
"Rotated vertex position = "
140 << eventTBVertex.x() <<
" "
141 << eventTBVertex.y() <<
" "
142 << eventTBVertex.z();
144 partXhodo = eventTBVertex.x();
145 partYhodo = eventTBVertex.y();
147 product->setBeamPosition(partXhodo, partYhodo);
150 double thisPhaseShift = CLHEP::RandFlat::shoot(engine);
152 product->setPhaseShift(thisPhaseShift);
153 LogDebug(
"EcalTBInfo") <<
"Asynchronous Phaseshift = " << thisPhaseShift;
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
static const int NCRYSTAL
Sin< T >::type sin(const T &t)
virtual ~EcalTBMCInfoProducer()
Destructor.
Cos< T >::type cos(const T &t)
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
void produce(edm::Event &event, const edm::EventSetup &eventSetup)
Produce digis out of raw data.
XYZPointD XYZPoint
point in space with cartesian internal representation
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &) const =0
Use this engine in event methods.
Geom::Phi< T > phi() const
StreamID streamID() const
EcalTBMCInfoProducer(const edm::ParameterSet &ps)
Constructor.