#include <BeamProfileVtxGenerator.h>
Public Member Functions | |
void | beamPos (double m=0) |
set mean in Z in cm | |
BeamProfileVtxGenerator (const edm::ParameterSet &p) | |
void | eta (double m=0) |
set eta | |
virtual TMatrixD * | GetInvLorentzBoost () |
void | meanX (double m=0) |
set mean in X in cm | |
void | meanY (double m=0) |
set mean in Y in cm | |
virtual HepMC::FourVector * | newVertex () |
return a new event vertex | |
void | phi (double m=0) |
set phi in radian | |
void | psi (double m=999) |
set psi in radian | |
void | setType (bool m=true) |
set type | |
void | sigmaX (double s=1.0) |
set resolution in X in cm | |
void | sigmaY (double s=1.0) |
set resolution in Y in cm | |
virtual | ~BeamProfileVtxGenerator () |
Private Member Functions | |
BeamProfileVtxGenerator (const BeamProfileVtxGenerator &p) | |
BeamProfileVtxGenerator & | operator= (const BeamProfileVtxGenerator &rhs) |
Private Attributes | |
std::vector< double > | fdistn |
double | fEta |
bool | ffile |
double | fMeanX |
double | fMeanY |
double | fMeanZ |
double | fPhi |
double | fPsi |
CLHEP::HepRandom * | fRandom |
double | fSigmaX |
double | fSigmaY |
double | fTheta |
double | fTimeOffset |
bool | fType |
int | nBinx |
int | nBiny |
Definition at line 21 of file BeamProfileVtxGenerator.h.
BeamProfileVtxGenerator::BeamProfileVtxGenerator | ( | const edm::ParameterSet & | p | ) |
Definition at line 20 of file BeamProfileVtxGenerator.cc.
References beamPos(), eta(), fdistn, fEta, ffile, dbtoweb::file, fMeanX, fMeanY, fMeanZ, fPhi, fPsi, fSigmaX, fSigmaY, fTheta, fTimeOffset, fType, edm::ParameterSet::getParameter(), i, recoMuon::in, prof2calltree::last, meanX(), meanY(), nBinx, nBiny, phi(), psi(), setType(), sigmaX(), and sigmaY().
: BaseEvtVtxGenerator(p), fRandom(0) { meanX(p.getParameter<double>("BeamMeanX")*cm); meanY(p.getParameter<double>("BeamMeanY")*cm); beamPos(p.getParameter<double>("BeamPosition")*cm); sigmaX(p.getParameter<double>("BeamSigmaX")*cm); sigmaY(p.getParameter<double>("BeamSigmaY")*cm); double fMinEta = p.getParameter<double>("MinEta"); double fMaxEta = p.getParameter<double>("MaxEta"); double fMinPhi = p.getParameter<double>("MinPhi"); double fMaxPhi = p.getParameter<double>("MaxPhi"); eta(0.5*(fMinEta+fMaxEta)); phi(0.5*(fMinPhi+fMaxPhi)); psi(p.getParameter<double>("Psi")); nBinx = p.getParameter<int>("BinX"); nBiny = p.getParameter<int>("BinY"); ffile = p.getParameter<bool>("UseFile"); fTimeOffset = p.getParameter<double>("TimeOffset")*ns*c_light; if (ffile) { std::string file = p.getParameter<std::string>("File"); ifstream is(file.c_str(), std::ios::in); if (is) { double elem,sum=0; while (!is.eof()) { is >> elem; fdistn.push_back(elem); sum += elem; } if (((int)(fdistn.size())) >= nBinx*nBiny) { double last = 0; for (unsigned int i=0; i<fdistn.size(); i++) { fdistn[i] /= sum; fdistn[i] += last; last = fdistn[i]; } setType(false); } else { ffile = false; } } else { ffile = false; } } if (!ffile) { setType(p.getParameter<bool>("GaussianProfile")); } edm::LogInfo("VertexGenerator") << "BeamProfileVtxGenerator: with " << "beam along eta = " << fEta << " (Theta = " << fTheta/deg << ") phi = " << fPhi/deg << ") psi = " << fPsi/deg << " centred at (" << fMeanX << ", " << fMeanY << ", " << fMeanZ << ") " << "and spread (" << fSigmaX << ", " << fSigmaY << ") of type Gaussian = " << fType << " use file " << ffile; if (ffile) edm::LogInfo("VertexGenerator") << "With " << nBinx << " bins " << " along X and " << nBiny << " bins along Y"; }
BeamProfileVtxGenerator::~BeamProfileVtxGenerator | ( | ) | [virtual] |
BeamProfileVtxGenerator::BeamProfileVtxGenerator | ( | const BeamProfileVtxGenerator & | p | ) | [private] |
Copy constructor
void BeamProfileVtxGenerator::beamPos | ( | double | m = 0 | ) | [inline] |
set mean in Z in cm
Definition at line 46 of file BeamProfileVtxGenerator.h.
Referenced by BeamProfileVtxGenerator().
void BeamProfileVtxGenerator::eta | ( | double | m = 0 | ) |
set eta
Definition at line 197 of file BeamProfileVtxGenerator.cc.
References funct::exp(), fEta, fTheta, and asciidump::s.
Referenced by BeamProfileVtxGenerator().
virtual TMatrixD* BeamProfileVtxGenerator::GetInvLorentzBoost | ( | ) | [inline, virtual] |
Implements BaseEvtVtxGenerator.
Definition at line 31 of file BeamProfileVtxGenerator.h.
{
return 0;
}
void BeamProfileVtxGenerator::meanX | ( | double | m = 0 | ) | [inline] |
set mean in X in cm
Definition at line 42 of file BeamProfileVtxGenerator.h.
Referenced by BeamProfileVtxGenerator().
void BeamProfileVtxGenerator::meanY | ( | double | m = 0 | ) | [inline] |
set mean in Y in cm
Definition at line 44 of file BeamProfileVtxGenerator.h.
Referenced by BeamProfileVtxGenerator().
HepMC::FourVector * BeamProfileVtxGenerator::newVertex | ( | ) | [virtual] |
return a new event vertex
Implements BaseEvtVtxGenerator.
Definition at line 91 of file BeamProfileVtxGenerator.cc.
References funct::cos(), fdistn, ffile, fMeanX, fMeanY, fMeanZ, fPhi, fPsi, fRandom, fSigmaX, fSigmaY, fTheta, fTimeOffset, fType, BaseEvtVtxGenerator::fVertex, i, LogDebug, M_PI, nBinx, nBiny, and funct::sin().
{ double aX, aY; if (ffile) { double r1 = (dynamic_cast<CLHEP::RandFlat*>(fRandom))->fire(); int ixy = 0, ix, iy; for (unsigned int i=0; i<fdistn.size(); i++) { if (r1 > fdistn[i]) ixy = i+1; } if (ixy >= nBinx*nBiny) { ix = nBinx-1; iy = nBiny-1; } else { ix = ixy%nBinx; iy = (ixy-ix)/nBinx; } aX = 0.5*(2*ix-nBinx+2*(dynamic_cast<CLHEP::RandFlat*>(fRandom))->fire())*fSigmaX + fMeanX ; aY = 0.5*(2*iy-nBiny+2*(dynamic_cast<CLHEP::RandFlat*>(fRandom))->fire())*fSigmaY + fMeanY ; } else { if (fType) { aX = fSigmaX*(dynamic_cast<CLHEP::RandGaussQ*>(fRandom))->fire() +fMeanX; aY = fSigmaY*(dynamic_cast<CLHEP::RandGaussQ*>(fRandom))->fire() +fMeanY; } else { aX = (dynamic_cast<CLHEP::RandFlat*>(fRandom))->fire(-0.5*fSigmaX,0.5*fSigmaX) + fMeanX ; aY = (dynamic_cast<CLHEP::RandFlat*>(fRandom))->fire(-0.5*fSigmaY,0.5*fSigmaY) + fMeanY; } } double xp, yp, zp ; if( 2.*M_PI < fabs(fPsi) ) { xp = -aX*cos(fTheta)*cos(fPhi) +aY*sin(fPhi) +fMeanZ*sin(fTheta)*cos(fPhi); yp = -aX*cos(fTheta)*sin(fPhi) -aY*cos(fPhi) +fMeanZ*sin(fTheta)*sin(fPhi); zp = aX*sin(fTheta) +fMeanZ*cos(fTheta); } else // for endcap testbeam, use 3rd angle psi { const HepGeom::Vector3D<double> av ( aX, aY, fMeanZ ) ; /* static const double kRadToDeg ( 180./M_PI ) ; std::cout<<"theta = "<<std::setw(7) << std::setiosflags( std::ios::fixed ) << std::setprecision(5) <<fTheta*kRadToDeg<<", phi="<<std::setw(7) << std::setiosflags( std::ios::fixed ) << std::setprecision(5) << fPhi*kRadToDeg <<", PSI="<<std::setw(7) << std::setiosflags( std::ios::fixed ) << std::setprecision(5) <<fPsi*kRadToDeg<<std::endl ; */ const HepGeom::RotateZ3D R1 ( fPhi - M_PI ) ; const HepGeom::Point3D<double> xUnit ( 0,1,0 ) ; const HepGeom::Point3D<double> zUnit ( 0,0,1 ) ; const HepGeom::Transform3D RXRZ ( HepGeom::Rotate3D( -fTheta, R1*xUnit )*R1 ) ; const HepGeom::Transform3D TRF ( HepGeom::Rotate3D(fPsi,RXRZ*zUnit)*RXRZ ) ; /* std::cout<<"\n\n$$$$$$$$$$$Transform=" <<" thetaZ = "<<std::setw(7) << std::setiosflags( std::ios::fixed ) << std::setprecision(5) <<TRF.getRotation().thetaZ()*kRadToDeg <<", phiZ = "<<std::setw(7) << std::setiosflags( std::ios::fixed ) << std::setprecision(5) <<TRF.getRotation().phiZ()*kRadToDeg <<", thetaY = "<<std::setw(7) << std::setiosflags( std::ios::fixed ) << std::setprecision(5) <<TRF.getRotation().thetaY()*kRadToDeg <<", phiY = "<<std::setw(7) << std::setiosflags( std::ios::fixed ) << std::setprecision(5) <<TRF.getRotation().phiY()*kRadToDeg <<", thetaX = "<<std::setw(7) << std::setiosflags( std::ios::fixed ) << std::setprecision(5) <<TRF.getRotation().thetaX()*kRadToDeg <<", phiX = "<<std::setw(7) << std::setiosflags( std::ios::fixed ) << std::setprecision(5) <<TRF.getRotation().phiX()*kRadToDeg <<std::setw(7) << std::setiosflags( std::ios::fixed ) << std::setprecision(5) <<TRF.getTranslation()<<std::endl ; */ const HepGeom::Vector3D<double> pv ( TRF*av ) ; xp = pv.x() ; yp = pv.y() ; zp = pv.z() ; } //if (fVertex == 0) fVertex = new CLHEP::Hep3Vector; //fVertex->set(xp, yp, zp); if (fVertex == 0 ) fVertex = new HepMC::FourVector() ; fVertex->set(xp, yp, zp, fTimeOffset ); LogDebug("VertexGenerator") << "BeamProfileVtxGenerator: Vertex created " << "at (" << xp << ", " << yp << ", " << zp << ", " << fTimeOffset << ")"; return fVertex; }
BeamProfileVtxGenerator& BeamProfileVtxGenerator::operator= | ( | const BeamProfileVtxGenerator & | rhs | ) | [private] |
Copy assignment operator
void BeamProfileVtxGenerator::phi | ( | double | m = 0 | ) | [inline] |
set phi in radian
Definition at line 51 of file BeamProfileVtxGenerator.h.
Referenced by BeamProfileVtxGenerator().
void BeamProfileVtxGenerator::psi | ( | double | m = 999 | ) | [inline] |
set psi in radian
Definition at line 53 of file BeamProfileVtxGenerator.h.
Referenced by BeamProfileVtxGenerator().
void BeamProfileVtxGenerator::setType | ( | bool | m = true | ) |
set type
Definition at line 202 of file BeamProfileVtxGenerator.cc.
References fRandom, fType, BaseEvtVtxGenerator::getEngine(), and asciidump::s.
Referenced by BeamProfileVtxGenerator().
void BeamProfileVtxGenerator::sigmaX | ( | double | s = 1.0 | ) |
set resolution in X in cm
Definition at line 173 of file BeamProfileVtxGenerator.cc.
References fSigmaX, and asciidump::s.
Referenced by BeamProfileVtxGenerator().
void BeamProfileVtxGenerator::sigmaY | ( | double | s = 1.0 | ) |
set resolution in Y in cm
Definition at line 185 of file BeamProfileVtxGenerator.cc.
References fSigmaY, and asciidump::s.
Referenced by BeamProfileVtxGenerator().
std::vector<double> BeamProfileVtxGenerator::fdistn [private] |
Definition at line 71 of file BeamProfileVtxGenerator.h.
Referenced by BeamProfileVtxGenerator(), and newVertex().
double BeamProfileVtxGenerator::fEta [private] |
Definition at line 65 of file BeamProfileVtxGenerator.h.
Referenced by BeamProfileVtxGenerator(), and eta().
bool BeamProfileVtxGenerator::ffile [private] |
Definition at line 69 of file BeamProfileVtxGenerator.h.
Referenced by BeamProfileVtxGenerator(), and newVertex().
double BeamProfileVtxGenerator::fMeanX [private] |
Definition at line 64 of file BeamProfileVtxGenerator.h.
Referenced by BeamProfileVtxGenerator(), meanX(), and newVertex().
double BeamProfileVtxGenerator::fMeanY [private] |
Definition at line 64 of file BeamProfileVtxGenerator.h.
Referenced by BeamProfileVtxGenerator(), meanY(), and newVertex().
double BeamProfileVtxGenerator::fMeanZ [private] |
Definition at line 64 of file BeamProfileVtxGenerator.h.
Referenced by beamPos(), BeamProfileVtxGenerator(), and newVertex().
double BeamProfileVtxGenerator::fPhi [private] |
Definition at line 65 of file BeamProfileVtxGenerator.h.
Referenced by BeamProfileVtxGenerator(), newVertex(), and phi().
double BeamProfileVtxGenerator::fPsi [private] |
Definition at line 67 of file BeamProfileVtxGenerator.h.
Referenced by BeamProfileVtxGenerator(), newVertex(), and psi().
CLHEP::HepRandom* BeamProfileVtxGenerator::fRandom [private] |
Definition at line 72 of file BeamProfileVtxGenerator.h.
Referenced by newVertex(), setType(), and ~BeamProfileVtxGenerator().
double BeamProfileVtxGenerator::fSigmaX [private] |
Definition at line 63 of file BeamProfileVtxGenerator.h.
Referenced by BeamProfileVtxGenerator(), newVertex(), and sigmaX().
double BeamProfileVtxGenerator::fSigmaY [private] |
Definition at line 63 of file BeamProfileVtxGenerator.h.
Referenced by BeamProfileVtxGenerator(), newVertex(), and sigmaY().
double BeamProfileVtxGenerator::fTheta [private] |
Definition at line 65 of file BeamProfileVtxGenerator.h.
Referenced by BeamProfileVtxGenerator(), eta(), and newVertex().
double BeamProfileVtxGenerator::fTimeOffset [private] |
Reimplemented from BaseEvtVtxGenerator.
Definition at line 73 of file BeamProfileVtxGenerator.h.
Referenced by BeamProfileVtxGenerator(), and newVertex().
bool BeamProfileVtxGenerator::fType [private] |
Definition at line 69 of file BeamProfileVtxGenerator.h.
Referenced by BeamProfileVtxGenerator(), newVertex(), and setType().
int BeamProfileVtxGenerator::nBinx [private] |
Definition at line 70 of file BeamProfileVtxGenerator.h.
Referenced by BeamProfileVtxGenerator(), and newVertex().
int BeamProfileVtxGenerator::nBiny [private] |
Definition at line 70 of file BeamProfileVtxGenerator.h.
Referenced by BeamProfileVtxGenerator(), and newVertex().