CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
MixBoostEvtVtxGenerator Class Reference
Inheritance diagram for MixBoostEvtVtxGenerator:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

Public Member Functions

void Alpha (double m=0)
 angle between crossing plane and horizontal plane More...
 
void Beta (double m=0)
 
double BetaFunction (double z, double z0)
 beta function More...
 
void betastar (double m=0)
 set beta_star More...
 
void emittance (double m=0)
 emittance (no the normalized) More...
 
virtual TMatrixD * GetInvLorentzBoost ()
 
virtual HepMC::FourVector * getRecVertex (edm::Event &)
 
virtual HepMC::FourVector * getVertex (edm::Event &)
 
 MixBoostEvtVtxGenerator (const edm::ParameterSet &p)
 
virtual HepMC::FourVector * newVertex ()
 
void Phi (double m=0)
 set half crossing angle More...
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 
void sigmaZ (double s=1.0)
 set resolution in Z in cm More...
 
void X0 (double m=0)
 set mean in X in cm More...
 
void Y0 (double m=0)
 set mean in Y in cm More...
 
void Z0 (double m=0)
 set mean in Z in cm More...
 
virtual ~MixBoostEvtVtxGenerator ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Private Member Functions

 MixBoostEvtVtxGenerator (const MixBoostEvtVtxGenerator &p)
 
MixBoostEvtVtxGeneratoroperator= (const MixBoostEvtVtxGenerator &rhs)
 

Private Attributes

double alpha_
 
double beta_
 
TMatrixD * boost_
 
double falpha
 
double fbetastar
 
double femittance
 
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
 
bool verbosity_
 
std::vector< double > vtxOffset
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

Definition at line 27 of file MixBoostEvtVtxGenerator.cc.

Constructor & Destructor Documentation

MixBoostEvtVtxGenerator::MixBoostEvtVtxGenerator ( const edm::ParameterSet p)

Definition at line 96 of file MixBoostEvtVtxGenerator.cc.

References alpha_, beta_, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), phi_, and vtxOffset.

96  :
97  fVertex(0), boost_(0), fTimeOffset(0),
98  signalLabel(pset.getParameter<edm::InputTag>("signalLabel")),
99  hiLabel(pset.getParameter<edm::InputTag>("heavyIonLabel")),
100  useRecVertex(pset.exists("useRecVertex")?pset.getParameter<bool>("useRecVertex"):false),
101  verbosity_(pset.getUntrackedParameter<bool>("verbosity",false))
102 {
103 
104  vtxOffset.resize(3);
105  if(pset.exists("vtxOffset")) vtxOffset=pset.getParameter< std::vector<double> >("vtxOffset");
106  beta_ = pset.getParameter<double>("Beta");
107 
108  alpha_ = 0;
109  phi_ = 0;
110  if(pset.exists("Alpha")){
111  alpha_ = pset.getParameter<double>("Alpha")*radian;
112  phi_ = pset.getParameter<double>("Phi")*radian;
113  }
114 
115  produces<bool>("matchedVertex");
116 
117 }
std::vector< double > vtxOffset
MixBoostEvtVtxGenerator::~MixBoostEvtVtxGenerator ( )
virtual

Definition at line 119 of file MixBoostEvtVtxGenerator.cc.

References boost_, and fVertex.

120 {
121  delete fVertex ;
122  if (boost_ != 0 ) delete boost_;
123 }
MixBoostEvtVtxGenerator::MixBoostEvtVtxGenerator ( const MixBoostEvtVtxGenerator p)
private

Copy constructor

Member Function Documentation

void MixBoostEvtVtxGenerator::Alpha ( double  m = 0)
inline

angle between crossing plane and horizontal plane

Definition at line 51 of file MixBoostEvtVtxGenerator.cc.

References m.

void MixBoostEvtVtxGenerator::Beta ( double  m = 0)
inline

Definition at line 52 of file MixBoostEvtVtxGenerator.cc.

References m.

double MixBoostEvtVtxGenerator::BetaFunction ( double  z,
double  z0 
)

beta function

Definition at line 130 of file MixBoostEvtVtxGenerator.cc.

References fbetastar, femittance, and mathSSE::sqrt().

131 {
132  return sqrt(femittance*(fbetastar+(((z-z0)*(z-z0))/fbetastar)));
133 
134 }
double double double z
T sqrt(T t)
Definition: SSEVec.h:46
void MixBoostEvtVtxGenerator::betastar ( double  m = 0)
inline

set beta_star

Definition at line 55 of file MixBoostEvtVtxGenerator.cc.

References m.

void MixBoostEvtVtxGenerator::emittance ( double  m = 0)
inline

emittance (no the normalized)

Definition at line 57 of file MixBoostEvtVtxGenerator.cc.

References m.

TMatrixD * MixBoostEvtVtxGenerator::GetInvLorentzBoost ( )
virtual

Definition at line 149 of file MixBoostEvtVtxGenerator.cc.

References alpha_, beta_, boost_, funct::cos(), phi_, funct::sin(), mathSSE::sqrt(), funct::tan(), and verbosity_.

Referenced by produce().

149  {
150 
151  TMatrixD tmpboost(4,4);
152  TMatrixD tmpboostZ(4,4);
153  TMatrixD tmpboostXYZ(4,4);
154 
155  // Lorentz boost to frame where the collision is head-on
156  // phi is the half crossing angle in the plane ZS
157  // alpha is the angle to the S axis from the X axis in the XY plane
158 
159  tmpboost(0,0) = 1./cos(phi_);
160  tmpboost(0,1) = - cos(alpha_)*sin(phi_);
161  tmpboost(0,2) = - tan(phi_)*sin(phi_);
162  tmpboost(0,3) = - sin(alpha_)*sin(phi_);
163  tmpboost(1,0) = - cos(alpha_)*tan(phi_);
164  tmpboost(1,1) = 1.;
165  tmpboost(1,2) = cos(alpha_)*tan(phi_);
166  tmpboost(1,3) = 0.;
167  tmpboost(2,0) = 0.;
168  tmpboost(2,1) = - cos(alpha_)*sin(phi_);
169  tmpboost(2,2) = cos(phi_);
170  tmpboost(2,3) = - sin(alpha_)*sin(phi_);
171  tmpboost(3,0) = - sin(alpha_)*tan(phi_);
172  tmpboost(3,1) = 0.;
173  tmpboost(3,2) = sin(alpha_)*tan(phi_);
174  tmpboost(3,3) = 1.;
175  double gama=1.0/sqrt(1-beta_*beta_);
176  tmpboostZ(0,0)=gama;
177  tmpboostZ(0,1)=0.;
178  tmpboostZ(0,2)=-1.0*beta_*gama;
179  tmpboostZ(0,3)=0.;
180  tmpboostZ(1,0)=0.;
181  tmpboostZ(1,1) = 1.;
182  tmpboostZ(1,2)=0.;
183  tmpboostZ(1,3)=0.;
184  tmpboostZ(2,0)=-1.0*beta_*gama;
185  tmpboostZ(2,1) = 0.;
186  tmpboostZ(2,2)=gama;
187  tmpboostZ(2,3) = 0.;
188  tmpboostZ(3,0)=0.;
189  tmpboostZ(3,1)=0.;
190  tmpboostZ(3,2)=0.;
191  tmpboostZ(3,3) = 1.;
192 
193  tmpboostXYZ=tmpboost*tmpboostZ;
194  tmpboostXYZ.Invert();
195 
196  boost_ = new TMatrixD(tmpboostXYZ);
197  if ( verbosity_ )boost_->Print();
198 
199  return boost_;
200 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
T sqrt(T t)
Definition: SSEVec.h:46
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
HepMC::FourVector * MixBoostEvtVtxGenerator::getRecVertex ( edm::Event evt)
virtual

Definition at line 236 of file MixBoostEvtVtxGenerator.cc.

References fVertex, edm::Event::getByLabel(), hiLabel, LaserDQM_cfg::input, and vtxOffset.

Referenced by produce().

236  {
237 
239  evt.getByLabel(hiLabel,input);
240 
241  double aX,aY,aZ;
242 
243  aX = input->begin()->position().x() + vtxOffset[0];
244  aY = input->begin()->position().y() + vtxOffset[1];
245  aZ = input->begin()->position().z() + vtxOffset[2];
246 
247  if(!fVertex) fVertex = new HepMC::FourVector();
248  fVertex->set(10.0*aX,10.0*aY,10.0*aZ,0.0); // HepMC positions in mm (RECO in cm)
249 
250  return fVertex;
251 
252 }
std::vector< double > vtxOffset
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
HepMC::FourVector * MixBoostEvtVtxGenerator::getVertex ( edm::Event evt)
virtual

Definition at line 202 of file MixBoostEvtVtxGenerator.cc.

References gather_cfg::cout, fVertex, edm::Event::getByLabel(), hiLabel, and LaserDQM_cfg::input.

Referenced by produce().

202  {
203 
205  evt.getByLabel(hiLabel,input);
206 
207  const HepMC::GenEvent* inev = input->GetEvent();
208  HepMC::GenVertex* genvtx = inev->signal_process_vertex();
209  if(!genvtx){
210  cout<<"No Signal Process Vertex!"<<endl;
211  HepMC::GenEvent::particle_const_iterator pt=inev->particles_begin();
212  HepMC::GenEvent::particle_const_iterator ptend=inev->particles_end();
213  while(!genvtx || ( genvtx->particles_in_size() == 1 && pt != ptend ) ){
214  if(!genvtx) cout<<"No Gen Vertex!"<<endl;
215  if(pt == ptend) cout<<"End reached!"<<endl;
216  genvtx = (*pt)->production_vertex();
217  ++pt;
218  }
219  }
220 
221  double aX,aY,aZ,aT;
222 
223  aX = genvtx->position().x();
224  aY = genvtx->position().y();
225  aZ = genvtx->position().z();
226  aT = genvtx->position().t();
227 
228  if(!fVertex) fVertex = new HepMC::FourVector();
229  fVertex->set(aX,aY,aZ,aT);
230 
231  return fVertex;
232 
233 }
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
tuple cout
Definition: gather_cfg.py:121
HepMC::FourVector * MixBoostEvtVtxGenerator::newVertex ( )
virtual

Definition at line 126 of file MixBoostEvtVtxGenerator.cc.

126  {
127  return 0;
128 }
MixBoostEvtVtxGenerator& MixBoostEvtVtxGenerator::operator= ( const MixBoostEvtVtxGenerator rhs)
private

Copy assignment operator

void MixBoostEvtVtxGenerator::Phi ( double  m = 0)
inline

set half crossing angle

Definition at line 49 of file MixBoostEvtVtxGenerator.cc.

References m.

void MixBoostEvtVtxGenerator::produce ( edm::Event evt,
const edm::EventSetup  
)
virtual

Implements edm::EDProducer.

Definition at line 255 of file MixBoostEvtVtxGenerator.cc.

References edm::Event::getByLabel(), GetInvLorentzBoost(), getRecVertex(), getVertex(), edm::Event::put(), hitfit::return, signalLabel, and useRecVertex.

256 {
257 
258 
259  Handle<HepMCProduct> HepMCEvt ;
260 
261  evt.getByLabel( signalLabel, HepMCEvt ) ;
262 
263  // generate new vertex & apply the shift
264  //
265 
266  HepMCEvt->boostToLab( GetInvLorentzBoost(), "vertex" );
267  HepMCEvt->boostToLab( GetInvLorentzBoost(), "momentum" );
268 
269  HepMCEvt->applyVtxGen( useRecVertex ? getRecVertex(evt) : getVertex(evt) ) ;
270 
271  // OK, create a (pseudo)product and put in into edm::Event
272  //
273  auto_ptr<bool> NewProduct(new bool(true)) ;
274  evt.put( NewProduct ,"matchedVertex") ;
275 
276  return ;
277 
278 }
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
virtual TMatrixD * GetInvLorentzBoost()
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
virtual HepMC::FourVector * getRecVertex(edm::Event &)
virtual HepMC::FourVector * getVertex(edm::Event &)
void MixBoostEvtVtxGenerator::sigmaZ ( double  s = 1.0)

set resolution in Z in cm

Definition at line 137 of file MixBoostEvtVtxGenerator.cc.

References edm::hlt::Exception, fSigmaZ, and alignCSCRings::s.

138 {
139  if (s>=0 ) {
140  fSigmaZ=s;
141  }
142  else {
143  throw cms::Exception("LogicError")
144  << "Error in MixBoostEvtVtxGenerator::sigmaZ: "
145  << "Illegal resolution in Z (negative)";
146  }
147 }
void MixBoostEvtVtxGenerator::X0 ( double  m = 0)
inline

set mean in X in cm

Definition at line 42 of file MixBoostEvtVtxGenerator.cc.

References m.

void MixBoostEvtVtxGenerator::Y0 ( double  m = 0)
inline

set mean in Y in cm

Definition at line 44 of file MixBoostEvtVtxGenerator.cc.

References m.

void MixBoostEvtVtxGenerator::Z0 ( double  m = 0)
inline

set mean in Z in cm

Definition at line 46 of file MixBoostEvtVtxGenerator.cc.

References m.

Member Data Documentation

double MixBoostEvtVtxGenerator::alpha_
private

Definition at line 69 of file MixBoostEvtVtxGenerator.cc.

Referenced by GetInvLorentzBoost(), and MixBoostEvtVtxGenerator().

double MixBoostEvtVtxGenerator::beta_
private

Definition at line 71 of file MixBoostEvtVtxGenerator.cc.

Referenced by GetInvLorentzBoost(), and MixBoostEvtVtxGenerator().

TMatrixD* MixBoostEvtVtxGenerator::boost_
private

Definition at line 79 of file MixBoostEvtVtxGenerator.cc.

Referenced by GetInvLorentzBoost(), and ~MixBoostEvtVtxGenerator().

double MixBoostEvtVtxGenerator::falpha
private

Definition at line 76 of file MixBoostEvtVtxGenerator.cc.

double MixBoostEvtVtxGenerator::fbetastar
private

Definition at line 75 of file MixBoostEvtVtxGenerator.cc.

Referenced by BetaFunction().

double MixBoostEvtVtxGenerator::femittance
private

Definition at line 75 of file MixBoostEvtVtxGenerator.cc.

Referenced by BetaFunction().

double MixBoostEvtVtxGenerator::fSigmaZ
private

Definition at line 73 of file MixBoostEvtVtxGenerator.cc.

Referenced by sigmaZ().

double MixBoostEvtVtxGenerator::fTimeOffset
private

Definition at line 80 of file MixBoostEvtVtxGenerator.cc.

HepMC::FourVector* MixBoostEvtVtxGenerator::fVertex
private

Definition at line 78 of file MixBoostEvtVtxGenerator.cc.

Referenced by getRecVertex(), getVertex(), and ~MixBoostEvtVtxGenerator().

double MixBoostEvtVtxGenerator::fX0
private

Definition at line 72 of file MixBoostEvtVtxGenerator.cc.

double MixBoostEvtVtxGenerator::fY0
private

Definition at line 72 of file MixBoostEvtVtxGenerator.cc.

double MixBoostEvtVtxGenerator::fZ0
private

Definition at line 72 of file MixBoostEvtVtxGenerator.cc.

edm::InputTag MixBoostEvtVtxGenerator::hiLabel
private

Definition at line 88 of file MixBoostEvtVtxGenerator.cc.

Referenced by getRecVertex(), and getVertex().

double MixBoostEvtVtxGenerator::phi_
private

Definition at line 69 of file MixBoostEvtVtxGenerator.cc.

Referenced by GetInvLorentzBoost(), and MixBoostEvtVtxGenerator().

edm::InputTag MixBoostEvtVtxGenerator::signalLabel
private

Definition at line 87 of file MixBoostEvtVtxGenerator.cc.

Referenced by produce().

edm::InputTag MixBoostEvtVtxGenerator::sourceLabel
private

Definition at line 83 of file MixBoostEvtVtxGenerator.cc.

bool MixBoostEvtVtxGenerator::useRecVertex
private

Definition at line 89 of file MixBoostEvtVtxGenerator.cc.

Referenced by produce().

bool MixBoostEvtVtxGenerator::verbosity_
private

Definition at line 91 of file MixBoostEvtVtxGenerator.cc.

Referenced by GetInvLorentzBoost().

std::vector<double> MixBoostEvtVtxGenerator::vtxOffset
private

Definition at line 90 of file MixBoostEvtVtxGenerator.cc.

Referenced by getRecVertex(), and MixBoostEvtVtxGenerator().