35 #include "CLHEP/Units/GlobalSystemOfUnits.h" 36 #include "CLHEP/Units/GlobalPhysicalConstants.h" 38 #include "HepMC/SimpleVector.h" 45 using namespace CLHEP;
57 virtual TMatrixD* GetInvLorentzBoost();
58 virtual HepMC::FourVector* getVertex(
edm::Event&);
59 virtual HepMC::FourVector* getRecVertex(
edm::Event&);
65 void X0(
double m=0) { fX0=
m; }
67 void Y0(
double m=0) { fY0=
m; }
69 void Z0(
double m=0) { fZ0=
m; }
72 void Phi(
double m=0) { phi_=
m; }
83 double BetaFunction(
double z,
double z0);
113 fVertex(0), boost_(0), fTimeOffset(0),
117 useRecVertex(pset.exists(
"useRecVertex")?pset.getParameter<bool>(
"useRecVertex"):
false)
130 produces<edm::HepMCProduct>();
155 <<
"Error in MixBoostEvtVtxGenerator::sigmaZ: " 156 <<
"Illegal resolution in Z (negative)";
168 TMatrixD tmpboost(4,4);
169 TMatrixD tmpboostZ(4,4);
170 TMatrixD tmpboostXYZ(4,4);
198 tmpboostZ(0,2)=-1.0*beta_*gama;
204 tmpboostZ(2,0)=-1.0*beta_*gama;
213 tmpboostXYZ=tmpboostZ*tmpboost;
214 tmpboostXYZ.Invert();
218 boost_ =
new TMatrixD(tmpboostXYZ);
226 const HepMC::GenEvent* inev = 0;
233 if(!(bkg.isVtxGenApplied())){
234 throw cms::Exception(
"MatchVtx")<<
"Input background does not have smeared vertex!"<<endl;
236 inev = bkg.GetEvent();
239 HepMC::GenVertex* genvtx = inev->signal_process_vertex();
241 cout<<
"No Signal Process Vertex!"<<endl;
242 HepMC::GenEvent::particle_const_iterator
pt=inev->particles_begin();
243 HepMC::GenEvent::particle_const_iterator ptend=inev->particles_end();
244 while(!genvtx || ( genvtx->particles_in_size() == 1 && pt != ptend ) ){
245 if(!genvtx)
cout<<
"No Gen Vertex!"<<endl;
246 if(pt == ptend)
cout<<
"End reached!"<<endl;
247 genvtx = (*pt)->production_vertex();
253 aX = genvtx->position().x();
254 aY = genvtx->position().y();
255 aZ = genvtx->position().z();
256 aT = genvtx->position().t();
274 aX = input->begin()->position().x() +
vtxOffset[0];
275 aY = input->begin()->position().y() +
vtxOffset[1];
276 aZ = input->begin()->position().z() +
vtxOffset[2];
279 fVertex->set(10.0*aX,10.0*aY,10.0*aZ,0.0);
292 HepMC::GenEvent* genevt =
new HepMC::GenEvent(*HepUnsmearedMCEvt->
GetEvent());
T getParameter(std::string const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
virtual ~MixBoostEvtVtxGenerator()
HepMC::FourVector * fVertex
void Z0(double m=0)
set mean in Z in cm
bool getByToken(EDGetToken token, Handle< PROD > &result) const
edm::EDGetTokenT< HepMCProduct > signalLabel
std::vector< double > vtxOffset
#define DEFINE_FWK_MODULE(type)
Sin< T >::type sin(const T &t)
void emittance(double m=0)
emittance (no the normalized)
void X0(double m=0)
set mean in X in cm
bool exists(std::string const ¶meterName) const
checks if a parameter exists
std::vector< Vertex > VertexCollection
collection of Vertex objects
static std::string const input
void sigmaZ(double s=1.0)
set resolution in Z in cm
edm::EDGetTokenT< reco::VertexCollection > vtxLabel
virtual void produce(edm::Event &, const edm::EventSetup &) override
return a new event vertex
edm::EDGetTokenT< CrossingFrame< HepMCProduct > > mixLabel
Cos< T >::type cos(const T &t)
virtual TMatrixD * GetInvLorentzBoost()
Tan< T >::type tan(const T &t)
MixBoostEvtVtxGenerator(const edm::ParameterSet &p)
void Alpha(double m=0)
angle between crossing plane and horizontal plane
const HepMC::GenEvent * GetEvent() const
void Phi(double m=0)
set half crossing angle
T const * product() const
void betastar(double m=0)
set beta_star
void Y0(double m=0)
set mean in Y in cm
return(e1-e2)*(e1-e2)+dp *dp
virtual HepMC::FourVector * getRecVertex(edm::Event &)
virtual HepMC::FourVector * getVertex(edm::Event &)
double BetaFunction(double z, double z0)
beta function