Public Member Functions | |
void | Alpha (double m=0) |
angle between crossing plane and horizontal plane | |
void | Beta (double m=0) |
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 * | getRecVertex (edm::Event &) |
virtual HepMC::FourVector * | getVertex (edm::Event &) |
MixBoostEvtVtxGenerator (const edm::ParameterSet &p) | |
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 | ~MixBoostEvtVtxGenerator () |
Private Member Functions | |
MixBoostEvtVtxGenerator (const MixBoostEvtVtxGenerator &p) | |
MixBoostEvtVtxGenerator & | operator= (const MixBoostEvtVtxGenerator &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 |
edm::InputTag | hiLabel |
double | phi_ |
edm::InputTag | signalLabel |
edm::InputTag | sourceLabel |
bool | useRecVertex |
std::vector< double > | vtxOffset |
Definition at line 52 of file MixBoostEvtVtxGenerator.cc.
MixBoostEvtVtxGenerator::MixBoostEvtVtxGenerator | ( | const edm::ParameterSet & | p | ) |
Definition at line 122 of file MixBoostEvtVtxGenerator.cc.
References Exception, edm::ParameterSet::exists(), fEngine, edm::ParameterSet::getParameter(), edm::Service< T >::isAvailable(), and vtxOffset.
: fVertex(0), boost_(0), fTimeOffset(0), fEngine(0), signalLabel(pset.getParameter<edm::InputTag>("signalLabel")), hiLabel(pset.getParameter<edm::InputTag>("heavyIonLabel")), useRecVertex(pset.exists("useRecVertex")?pset.getParameter<bool>("useRecVertex"):false) { vtxOffset.resize(3); if(pset.exists("vtxOffset")) vtxOffset=pset.getParameter< std::vector<double> >("vtxOffset"); 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; produces<bool>("matchedVertex"); }
MixBoostEvtVtxGenerator::~MixBoostEvtVtxGenerator | ( | ) | [virtual] |
MixBoostEvtVtxGenerator::MixBoostEvtVtxGenerator | ( | const MixBoostEvtVtxGenerator & | p | ) | [private] |
Copy constructor
void MixBoostEvtVtxGenerator::Alpha | ( | double | m = 0 | ) | [inline] |
angle between crossing plane and horizontal plane
Definition at line 78 of file MixBoostEvtVtxGenerator.cc.
References m.
void MixBoostEvtVtxGenerator::Beta | ( | double | m = 0 | ) | [inline] |
double MixBoostEvtVtxGenerator::BetaFunction | ( | double | z, |
double | z0 | ||
) |
beta function
Definition at line 188 of file MixBoostEvtVtxGenerator.cc.
References fbetastar, femittance, and mathSSE::sqrt().
Referenced by newVertex().
void MixBoostEvtVtxGenerator::betastar | ( | double | m = 0 | ) | [inline] |
void MixBoostEvtVtxGenerator::emittance | ( | double | m = 0 | ) | [inline] |
emittance (no the normalized)
Definition at line 84 of file MixBoostEvtVtxGenerator.cc.
References m.
{ femittance=m; }
CLHEP::HepRandomEngine & MixBoostEvtVtxGenerator::getEngine | ( | ) |
TMatrixD * MixBoostEvtVtxGenerator::GetInvLorentzBoost | ( | ) | [virtual] |
Definition at line 207 of file MixBoostEvtVtxGenerator.cc.
References alpha_, beta_, boost_, funct::cos(), phi_, funct::sin(), mathSSE::sqrt(), and funct::tan().
{ //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=tmpboost*tmpboostZ; tmpboost.Invert(); boost_ = new TMatrixD(tmpboostXYZ); boost_->Print(); return boost_; }
HepMC::FourVector * MixBoostEvtVtxGenerator::getRecVertex | ( | edm::Event & | evt | ) | [virtual] |
Definition at line 304 of file MixBoostEvtVtxGenerator.cc.
References fVertex, edm::Event::getByLabel(), hiLabel, LaserDQM_cfg::input, and vtxOffset.
Referenced by produce().
{ Handle<reco::VertexCollection> input; evt.getByLabel(hiLabel,input); double aX,aY,aZ; aX = input->begin()->position().x() + vtxOffset[0]; aY = input->begin()->position().y() + vtxOffset[1]; aZ = input->begin()->position().z() + vtxOffset[2]; if(!fVertex) fVertex = new HepMC::FourVector(); fVertex->set(10.0*aX,10.0*aY,10.0*aZ,0.0); // HepMC positions in mm (RECO in cm) return fVertex; }
HepMC::FourVector * MixBoostEvtVtxGenerator::getVertex | ( | edm::Event & | evt | ) | [virtual] |
Definition at line 271 of file MixBoostEvtVtxGenerator.cc.
References gather_cfg::cout, fVertex, edm::Event::getByLabel(), hiLabel, and LaserDQM_cfg::input.
Referenced by produce().
{ Handle<HepMCProduct> input; evt.getByLabel(hiLabel,input); const HepMC::GenEvent* inev = input->GetEvent(); HepMC::GenVertex* genvtx = inev->signal_process_vertex(); if(!genvtx){ cout<<"No Signal Process Vertex!"<<endl; HepMC::GenEvent::particle_const_iterator pt=inev->particles_begin(); HepMC::GenEvent::particle_const_iterator ptend=inev->particles_end(); while(!genvtx || ( genvtx->particles_in_size() == 1 && pt != ptend ) ){ if(!genvtx) cout<<"No Gen Vertex!"<<endl; if(pt == ptend) cout<<"End reached!"<<endl; genvtx = (*pt)->production_vertex(); ++pt; } } double aX,aY,aZ,aT; aX = genvtx->position().x(); aY = genvtx->position().y(); aZ = genvtx->position().z(); aT = genvtx->position().t(); if(!fVertex) fVertex = new HepMC::FourVector(); fVertex->set(aX,aY,aZ,aT); return fVertex; }
HepMC::FourVector * MixBoostEvtVtxGenerator::newVertex | ( | ) | [virtual] |
return a new event vertex
Definition at line 161 of file MixBoostEvtVtxGenerator.cc.
References BetaFunction(), fRandom, fSigmaZ, fTimeOffset, fVertex, fX0, fY0, fZ0, mathSSE::sqrt(), X, and Gflash::Z.
{ 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; }
MixBoostEvtVtxGenerator& MixBoostEvtVtxGenerator::operator= | ( | const MixBoostEvtVtxGenerator & | rhs | ) | [private] |
Copy assignment operator
void MixBoostEvtVtxGenerator::Phi | ( | double | m = 0 | ) | [inline] |
void MixBoostEvtVtxGenerator::produce | ( | edm::Event & | evt, |
const edm::EventSetup & | |||
) | [virtual] |
Implements edm::EDProducer.
Definition at line 323 of file MixBoostEvtVtxGenerator.cc.
References edm::Event::getByLabel(), getRecVertex(), getVertex(), edm::Event::put(), signalLabel, and useRecVertex.
{ Handle<HepMCProduct> HepMCEvt ; evt.getByLabel( signalLabel, HepMCEvt ) ; // generate new vertex & apply the shift // HepMCEvt->applyVtxGen( useRecVertex ? getRecVertex(evt) : getVertex(evt) ) ; // 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 ,"matchedVertex") ; return ; }
void MixBoostEvtVtxGenerator::sigmaZ | ( | double | s = 1.0 | ) |
set resolution in Z in cm
Definition at line 195 of file MixBoostEvtVtxGenerator.cc.
References Exception, fSigmaZ, and alignCSCRings::s.
{ if (s>=0 ) { fSigmaZ=s; } else { throw cms::Exception("LogicError") << "Error in MixBoostEvtVtxGenerator::sigmaZ: " << "Illegal resolution in Z (negative)"; } }
void MixBoostEvtVtxGenerator::X0 | ( | double | m = 0 | ) | [inline] |
void MixBoostEvtVtxGenerator::Y0 | ( | double | m = 0 | ) | [inline] |
void MixBoostEvtVtxGenerator::Z0 | ( | double | m = 0 | ) | [inline] |
double MixBoostEvtVtxGenerator::alpha_ [private] |
Definition at line 96 of file MixBoostEvtVtxGenerator.cc.
Referenced by GetInvLorentzBoost().
double MixBoostEvtVtxGenerator::beta_ [private] |
Definition at line 98 of file MixBoostEvtVtxGenerator.cc.
Referenced by GetInvLorentzBoost().
TMatrixD* MixBoostEvtVtxGenerator::boost_ [private] |
Definition at line 106 of file MixBoostEvtVtxGenerator.cc.
Referenced by GetInvLorentzBoost(), and ~MixBoostEvtVtxGenerator().
double MixBoostEvtVtxGenerator::falpha [private] |
Definition at line 103 of file MixBoostEvtVtxGenerator.cc.
double MixBoostEvtVtxGenerator::fbetastar [private] |
Definition at line 102 of file MixBoostEvtVtxGenerator.cc.
Referenced by BetaFunction().
double MixBoostEvtVtxGenerator::femittance [private] |
Definition at line 102 of file MixBoostEvtVtxGenerator.cc.
Referenced by BetaFunction().
CLHEP::HepRandomEngine* MixBoostEvtVtxGenerator::fEngine [private] |
Definition at line 109 of file MixBoostEvtVtxGenerator.cc.
Referenced by getEngine(), and MixBoostEvtVtxGenerator().
CLHEP::RandGaussQ* MixBoostEvtVtxGenerator::fRandom [private] |
Definition at line 112 of file MixBoostEvtVtxGenerator.cc.
Referenced by newVertex(), and ~MixBoostEvtVtxGenerator().
double MixBoostEvtVtxGenerator::fSigmaZ [private] |
Definition at line 100 of file MixBoostEvtVtxGenerator.cc.
Referenced by newVertex(), and sigmaZ().
double MixBoostEvtVtxGenerator::fTimeOffset [private] |
Definition at line 107 of file MixBoostEvtVtxGenerator.cc.
Referenced by newVertex().
HepMC::FourVector* MixBoostEvtVtxGenerator::fVertex [private] |
Definition at line 105 of file MixBoostEvtVtxGenerator.cc.
Referenced by getRecVertex(), getVertex(), newVertex(), and ~MixBoostEvtVtxGenerator().
double MixBoostEvtVtxGenerator::fX0 [private] |
Definition at line 99 of file MixBoostEvtVtxGenerator.cc.
Referenced by newVertex().
double MixBoostEvtVtxGenerator::fY0 [private] |
Definition at line 99 of file MixBoostEvtVtxGenerator.cc.
Referenced by newVertex().
double MixBoostEvtVtxGenerator::fZ0 [private] |
Definition at line 99 of file MixBoostEvtVtxGenerator.cc.
Referenced by newVertex().
Definition at line 115 of file MixBoostEvtVtxGenerator.cc.
Referenced by getRecVertex(), and getVertex().
double MixBoostEvtVtxGenerator::phi_ [private] |
Definition at line 96 of file MixBoostEvtVtxGenerator.cc.
Referenced by GetInvLorentzBoost().
Definition at line 114 of file MixBoostEvtVtxGenerator.cc.
Referenced by produce().
Definition at line 110 of file MixBoostEvtVtxGenerator.cc.
bool MixBoostEvtVtxGenerator::useRecVertex [private] |
Definition at line 116 of file MixBoostEvtVtxGenerator.cc.
Referenced by produce().
std::vector<double> MixBoostEvtVtxGenerator::vtxOffset [private] |
Definition at line 117 of file MixBoostEvtVtxGenerator.cc.
Referenced by getRecVertex(), and MixBoostEvtVtxGenerator().