Public Member Functions | |
void | Alpha (double m=0) |
angle between crossing plane and horizontal plane | |
void | Beta (double m=0) |
BetaBoostEvtVtxGenerator (const edm::ParameterSet &p) | |
double | BetaFunction (double z, double z0) |
beta function | |
void | betastar (double m=0) |
set beta_star | |
void | emittance (double m=0) |
emittance (no the normalized) | |
CLHEP::HepRandomEngine & | getEngine () |
virtual TMatrixD * | GetInvLorentzBoost () |
virtual HepMC::FourVector * | newVertex () |
return a new event vertex | |
void | Phi (double m=0) |
set half crossing angle | |
virtual void | produce (edm::Event &, const edm::EventSetup &) |
void | sigmaZ (double s=1.0) |
set resolution in Z in cm | |
void | X0 (double m=0) |
set mean in X in cm | |
void | Y0 (double m=0) |
set mean in Y in cm | |
void | Z0 (double m=0) |
set mean in Z in cm | |
virtual | ~BetaBoostEvtVtxGenerator () |
Private Member Functions | |
BetaBoostEvtVtxGenerator (const BetaBoostEvtVtxGenerator &p) | |
BetaBoostEvtVtxGenerator & | operator= (const BetaBoostEvtVtxGenerator &rhs) |
Private Attributes | |
double | alpha_ |
double | beta_ |
TMatrixD * | boost_ |
double | falpha |
double | fbetastar |
double | femittance |
CLHEP::HepRandomEngine * | fEngine |
CLHEP::RandGaussQ * | fRandom |
double | fSigmaZ |
double | fTimeOffset |
HepMC::FourVector * | fVertex |
double | fX0 |
double | fY0 |
double | fZ0 |
double | phi_ |
edm::InputTag | sourceLabel |
bool | verbosity_ |
Definition at line 50 of file BetaBoostEvtVtxGenerator.cc.
BetaBoostEvtVtxGenerator::BetaBoostEvtVtxGenerator | ( | const edm::ParameterSet & | p | ) |
Definition at line 116 of file BetaBoostEvtVtxGenerator.cc.
References alpha_, beta_, Exception, fbetastar, femittance, fEngine, fRandom, fSigmaZ, fTimeOffset, fX0, fY0, fZ0, getEngine(), edm::ParameterSet::getParameter(), edm::Service< T >::isAvailable(), and phi_.
: fVertex(0), boost_(0), fTimeOffset(0), fEngine(0), sourceLabel(p.getParameter<edm::InputTag>("src")), verbosity_(p.getUntrackedParameter<bool>("verbosity",false)) { edm::Service<edm::RandomNumberGenerator> rng; if ( ! rng.isAvailable()) { throw cms::Exception("Configuration") << "The BaseEvtVtxGenerator requires the RandomNumberGeneratorService\n" "which is not present in the configuration file. You must add the service\n" "in the configuration file or remove the modules that require it."; } CLHEP::HepRandomEngine& engine = rng->getEngine(); fEngine = &engine; fRandom = new CLHEP::RandGaussQ(getEngine()); fX0 = p.getParameter<double>("X0")*cm; fY0 = p.getParameter<double>("Y0")*cm; fZ0 = p.getParameter<double>("Z0")*cm; fSigmaZ = p.getParameter<double>("SigmaZ")*cm; alpha_ = p.getParameter<double>("Alpha")*radian; phi_ = p.getParameter<double>("Phi")*radian; fbetastar = p.getParameter<double>("BetaStar")*cm; femittance = p.getParameter<double>("Emittance")*cm; // this is not the normalized emittance fTimeOffset = p.getParameter<double>("TimeOffset")*ns*c_light; // HepMC time units are mm beta_=p.getParameter<double>("Beta"); if (fSigmaZ <= 0) { throw cms::Exception("Configuration") << "Error in BetaBoostEvtVtxGenerator: " << "Illegal resolution in Z (SigmaZ is negative)"; } produces<bool>(); }
BetaBoostEvtVtxGenerator::~BetaBoostEvtVtxGenerator | ( | ) | [virtual] |
BetaBoostEvtVtxGenerator::BetaBoostEvtVtxGenerator | ( | const BetaBoostEvtVtxGenerator & | p | ) | [private] |
Copy constructor
void BetaBoostEvtVtxGenerator::Alpha | ( | double | m = 0 | ) | [inline] |
angle between crossing plane and horizontal plane
Definition at line 75 of file BetaBoostEvtVtxGenerator.cc.
References m.
void BetaBoostEvtVtxGenerator::Beta | ( | double | m = 0 | ) | [inline] |
double BetaBoostEvtVtxGenerator::BetaFunction | ( | double | z, |
double | z0 | ||
) |
beta function
Definition at line 196 of file BetaBoostEvtVtxGenerator.cc.
References fbetastar, femittance, and mathSSE::sqrt().
Referenced by newVertex().
void BetaBoostEvtVtxGenerator::betastar | ( | double | m = 0 | ) | [inline] |
void BetaBoostEvtVtxGenerator::emittance | ( | double | m = 0 | ) | [inline] |
emittance (no the normalized)
Definition at line 81 of file BetaBoostEvtVtxGenerator.cc.
References m.
{ femittance=m; }
CLHEP::HepRandomEngine & BetaBoostEvtVtxGenerator::getEngine | ( | ) |
Definition at line 163 of file BetaBoostEvtVtxGenerator.cc.
References fEngine.
Referenced by BetaBoostEvtVtxGenerator().
{ return *fEngine; }
TMatrixD * BetaBoostEvtVtxGenerator::GetInvLorentzBoost | ( | ) | [virtual] |
Definition at line 215 of file BetaBoostEvtVtxGenerator.cc.
References alpha_, beta_, boost_, funct::cos(), phi_, funct::sin(), mathSSE::sqrt(), funct::tan(), and verbosity_.
Referenced by produce().
{ //alpha_ = 0; //phi_ = 142.e-6; // if (boost_ != 0 ) return boost_; //boost_.ResizeTo(4,4); //boost_ = new TMatrixD(4,4); TMatrixD tmpboost(4,4); TMatrixD tmpboostZ(4,4); TMatrixD tmpboostXYZ(4,4); //if ( (alpha_ == 0) && (phi_==0) ) { boost_->Zero(); return boost_; } // Lorentz boost to frame where the collision is head-on // phi is the half crossing angle in the plane ZS // alpha is the angle to the S axis from the X axis in the XY plane tmpboost(0,0) = 1./cos(phi_); tmpboost(0,1) = - cos(alpha_)*sin(phi_); tmpboost(0,2) = - tan(phi_)*sin(phi_); tmpboost(0,3) = - sin(alpha_)*sin(phi_); tmpboost(1,0) = - cos(alpha_)*tan(phi_); tmpboost(1,1) = 1.; tmpboost(1,2) = cos(alpha_)*tan(phi_); tmpboost(1,3) = 0.; tmpboost(2,0) = 0.; tmpboost(2,1) = - cos(alpha_)*sin(phi_); tmpboost(2,2) = cos(phi_); tmpboost(2,3) = - sin(alpha_)*sin(phi_); tmpboost(3,0) = - sin(alpha_)*tan(phi_); tmpboost(3,1) = 0.; tmpboost(3,2) = sin(alpha_)*tan(phi_); tmpboost(3,3) = 1.; //cout<<"beta "<<beta_; double gama=1.0/sqrt(1-beta_*beta_); tmpboostZ(0,0)=gama; tmpboostZ(0,1)=0.; tmpboostZ(0,2)=-1.0*beta_*gama; tmpboostZ(0,3)=0.; tmpboostZ(1,0)=0.; tmpboostZ(1,1) = 1.; tmpboostZ(1,2)=0.; tmpboostZ(1,3)=0.; tmpboostZ(2,0)=-1.0*beta_*gama; tmpboostZ(2,1) = 0.; tmpboostZ(2,2)=gama; tmpboostZ(2,3) = 0.; tmpboostZ(3,0)=0.; tmpboostZ(3,1)=0.; tmpboostZ(3,2)=0.; tmpboostZ(3,3) = 1.; tmpboostXYZ=tmpboostZ*tmpboost; tmpboostXYZ.Invert(); boost_ = new TMatrixD(tmpboostXYZ); if ( verbosity_ ) { boost_->Print(); } return boost_; }
HepMC::FourVector * BetaBoostEvtVtxGenerator::newVertex | ( | ) | [virtual] |
return a new event vertex
Definition at line 169 of file BetaBoostEvtVtxGenerator.cc.
References BetaFunction(), fRandom, fSigmaZ, fTimeOffset, fVertex, fX0, fY0, fZ0, mathSSE::sqrt(), X, and Gflash::Z.
Referenced by produce().
{ double X,Y,Z; double tmp_sigz = fRandom->fire(0., fSigmaZ); Z = tmp_sigz + fZ0; double tmp_sigx = BetaFunction(Z,fZ0); // need sqrt(2) for beamspot width relative to single beam width tmp_sigx /= sqrt(2.0); X = fRandom->fire(0.,tmp_sigx) + fX0; // + Z*fdxdz ; double tmp_sigy = BetaFunction(Z,fZ0); // need sqrt(2) for beamspot width relative to single beam width tmp_sigy /= sqrt(2.0); Y = fRandom->fire(0.,tmp_sigy) + fY0; // + Z*fdydz; double tmp_sigt = fRandom->fire(0., fSigmaZ); double T = tmp_sigt + fTimeOffset; if ( fVertex == 0 ) fVertex = new HepMC::FourVector(); fVertex->set(X,Y,Z,T); return fVertex; }
BetaBoostEvtVtxGenerator& BetaBoostEvtVtxGenerator::operator= | ( | const BetaBoostEvtVtxGenerator & | rhs | ) | [private] |
Copy assignment operator
void BetaBoostEvtVtxGenerator::Phi | ( | double | m = 0 | ) | [inline] |
void BetaBoostEvtVtxGenerator::produce | ( | edm::Event & | evt, |
const edm::EventSetup & | |||
) | [virtual] |
Implements edm::EDProducer.
Definition at line 279 of file BetaBoostEvtVtxGenerator.cc.
References edm::Event::getByLabel(), GetInvLorentzBoost(), newVertex(), edm::Event::put(), and sourceLabel.
{ Handle<HepMCProduct> HepMCEvt ; evt.getByLabel( sourceLabel, HepMCEvt ) ; // generate new vertex & apply the shift // HepMCEvt->applyVtxGen( newVertex() ) ; //HepMCEvt->LorentzBoost( 0., 142.e-6 ); HepMCEvt->boostToLab( GetInvLorentzBoost(), "vertex" ); HepMCEvt->boostToLab( GetInvLorentzBoost(), "momentum" ); // OK, create a (pseudo)product and put in into edm::Event // auto_ptr<bool> NewProduct(new bool(true)) ; evt.put( NewProduct ) ; return ; }
void BetaBoostEvtVtxGenerator::sigmaZ | ( | double | s = 1.0 | ) |
set resolution in Z in cm
Definition at line 203 of file BetaBoostEvtVtxGenerator.cc.
References Exception, fSigmaZ, and alignCSCRings::s.
{ if (s>=0 ) { fSigmaZ=s; } else { throw cms::Exception("LogicError") << "Error in BetaBoostEvtVtxGenerator::sigmaZ: " << "Illegal resolution in Z (negative)"; } }
void BetaBoostEvtVtxGenerator::X0 | ( | double | m = 0 | ) | [inline] |
void BetaBoostEvtVtxGenerator::Y0 | ( | double | m = 0 | ) | [inline] |
void BetaBoostEvtVtxGenerator::Z0 | ( | double | m = 0 | ) | [inline] |
double BetaBoostEvtVtxGenerator::alpha_ [private] |
Definition at line 93 of file BetaBoostEvtVtxGenerator.cc.
Referenced by BetaBoostEvtVtxGenerator(), and GetInvLorentzBoost().
double BetaBoostEvtVtxGenerator::beta_ [private] |
Definition at line 95 of file BetaBoostEvtVtxGenerator.cc.
Referenced by BetaBoostEvtVtxGenerator(), and GetInvLorentzBoost().
TMatrixD* BetaBoostEvtVtxGenerator::boost_ [private] |
Definition at line 103 of file BetaBoostEvtVtxGenerator.cc.
Referenced by GetInvLorentzBoost(), and ~BetaBoostEvtVtxGenerator().
double BetaBoostEvtVtxGenerator::falpha [private] |
Definition at line 100 of file BetaBoostEvtVtxGenerator.cc.
double BetaBoostEvtVtxGenerator::fbetastar [private] |
Definition at line 99 of file BetaBoostEvtVtxGenerator.cc.
Referenced by BetaBoostEvtVtxGenerator(), and BetaFunction().
double BetaBoostEvtVtxGenerator::femittance [private] |
Definition at line 99 of file BetaBoostEvtVtxGenerator.cc.
Referenced by BetaBoostEvtVtxGenerator(), and BetaFunction().
CLHEP::HepRandomEngine* BetaBoostEvtVtxGenerator::fEngine [private] |
Definition at line 106 of file BetaBoostEvtVtxGenerator.cc.
Referenced by BetaBoostEvtVtxGenerator(), and getEngine().
CLHEP::RandGaussQ* BetaBoostEvtVtxGenerator::fRandom [private] |
Definition at line 109 of file BetaBoostEvtVtxGenerator.cc.
Referenced by BetaBoostEvtVtxGenerator(), newVertex(), and ~BetaBoostEvtVtxGenerator().
double BetaBoostEvtVtxGenerator::fSigmaZ [private] |
Definition at line 97 of file BetaBoostEvtVtxGenerator.cc.
Referenced by BetaBoostEvtVtxGenerator(), newVertex(), and sigmaZ().
double BetaBoostEvtVtxGenerator::fTimeOffset [private] |
Definition at line 104 of file BetaBoostEvtVtxGenerator.cc.
Referenced by BetaBoostEvtVtxGenerator(), and newVertex().
HepMC::FourVector* BetaBoostEvtVtxGenerator::fVertex [private] |
Definition at line 102 of file BetaBoostEvtVtxGenerator.cc.
Referenced by newVertex(), and ~BetaBoostEvtVtxGenerator().
double BetaBoostEvtVtxGenerator::fX0 [private] |
Definition at line 96 of file BetaBoostEvtVtxGenerator.cc.
Referenced by BetaBoostEvtVtxGenerator(), and newVertex().
double BetaBoostEvtVtxGenerator::fY0 [private] |
Definition at line 96 of file BetaBoostEvtVtxGenerator.cc.
Referenced by BetaBoostEvtVtxGenerator(), and newVertex().
double BetaBoostEvtVtxGenerator::fZ0 [private] |
Definition at line 96 of file BetaBoostEvtVtxGenerator.cc.
Referenced by BetaBoostEvtVtxGenerator(), and newVertex().
double BetaBoostEvtVtxGenerator::phi_ [private] |
Definition at line 93 of file BetaBoostEvtVtxGenerator.cc.
Referenced by BetaBoostEvtVtxGenerator(), and GetInvLorentzBoost().
Definition at line 107 of file BetaBoostEvtVtxGenerator.cc.
Referenced by produce().
bool BetaBoostEvtVtxGenerator::verbosity_ [private] |
Definition at line 111 of file BetaBoostEvtVtxGenerator.cc.
Referenced by GetInvLorentzBoost().