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::EDConsumerBase 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 ()
 return a new event vertex More...
 
void Phi (double m=0)
 set half crossing angle More...
 
virtual void produce (edm::Event &, const edm::EventSetup &) override
 
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 ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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
 
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
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- 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::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 49 of file MixBoostEvtVtxGenerator.cc.

Constructor & Destructor Documentation

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

Definition at line 117 of file MixBoostEvtVtxGenerator.cc.

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

117  :
118  fVertex(0), boost_(0), fTimeOffset(0),
119  signalLabel(pset.getParameter<edm::InputTag>("signalLabel")),
120  hiLabel(pset.getParameter<edm::InputTag>("heavyIonLabel")),
121  useRecVertex(pset.exists("useRecVertex")?pset.getParameter<bool>("useRecVertex"):false)
122 {
123 
124  vtxOffset.resize(3);
125  if(pset.exists("vtxOffset")) vtxOffset=pset.getParameter< std::vector<double> >("vtxOffset");
126 
127  produces<bool>("matchedVertex");
128 
129 }
std::vector< double > vtxOffset
MixBoostEvtVtxGenerator::~MixBoostEvtVtxGenerator ( )
virtual

Definition at line 131 of file MixBoostEvtVtxGenerator.cc.

References boost_, fRandom, and fVertex.

132 {
133  delete fVertex ;
134  if (boost_ != 0 ) delete boost_;
135  delete fRandom;
136 }
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 75 of file MixBoostEvtVtxGenerator.cc.

References visualization-live-secondInstance_cfg::m.

void MixBoostEvtVtxGenerator::Beta ( double  m = 0)
inline
double MixBoostEvtVtxGenerator::BetaFunction ( double  z,
double  z0 
)

beta function

Definition at line 167 of file MixBoostEvtVtxGenerator.cc.

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

Referenced by newVertex().

168 {
169  return sqrt(femittance*(fbetastar+(((z-z0)*(z-z0))/fbetastar)));
170 
171 }
float float float z
T sqrt(T t)
Definition: SSEVec.h:48
void MixBoostEvtVtxGenerator::betastar ( double  m = 0)
inline
void MixBoostEvtVtxGenerator::emittance ( double  m = 0)
inline
TMatrixD * MixBoostEvtVtxGenerator::GetInvLorentzBoost ( )
virtual

Definition at line 186 of file MixBoostEvtVtxGenerator.cc.

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

186  {
187 
188  //alpha_ = 0;
189  //phi_ = 142.e-6;
190 // if (boost_ != 0 ) return boost_;
191 
192  //boost_.ResizeTo(4,4);
193  //boost_ = new TMatrixD(4,4);
194  TMatrixD tmpboost(4,4);
195  TMatrixD tmpboostZ(4,4);
196  TMatrixD tmpboostXYZ(4,4);
197 
198  //if ( (alpha_ == 0) && (phi_==0) ) { boost_->Zero(); return boost_; }
199 
200  // Lorentz boost to frame where the collision is head-on
201  // phi is the half crossing angle in the plane ZS
202  // alpha is the angle to the S axis from the X axis in the XY plane
203 
204  tmpboost(0,0) = 1./cos(phi_);
205  tmpboost(0,1) = - cos(alpha_)*sin(phi_);
206  tmpboost(0,2) = - tan(phi_)*sin(phi_);
207  tmpboost(0,3) = - sin(alpha_)*sin(phi_);
208  tmpboost(1,0) = - cos(alpha_)*tan(phi_);
209  tmpboost(1,1) = 1.;
210  tmpboost(1,2) = cos(alpha_)*tan(phi_);
211  tmpboost(1,3) = 0.;
212  tmpboost(2,0) = 0.;
213  tmpboost(2,1) = - cos(alpha_)*sin(phi_);
214  tmpboost(2,2) = cos(phi_);
215  tmpboost(2,3) = - sin(alpha_)*sin(phi_);
216  tmpboost(3,0) = - sin(alpha_)*tan(phi_);
217  tmpboost(3,1) = 0.;
218  tmpboost(3,2) = sin(alpha_)*tan(phi_);
219  tmpboost(3,3) = 1.;
220  //cout<<"beta "<<beta_;
221  double gama=1.0/sqrt(1-beta_*beta_);
222  tmpboostZ(0,0)=gama;
223  tmpboostZ(0,1)=0.;
224  tmpboostZ(0,2)=-1.0*beta_*gama;
225  tmpboostZ(0,3)=0.;
226  tmpboostZ(1,0)=0.;
227  tmpboostZ(1,1) = 1.;
228  tmpboostZ(1,2)=0.;
229  tmpboostZ(1,3)=0.;
230  tmpboostZ(2,0)=-1.0*beta_*gama;
231  tmpboostZ(2,1) = 0.;
232  tmpboostZ(2,2)=gama;
233  tmpboostZ(2,3) = 0.;
234  tmpboostZ(3,0)=0.;
235  tmpboostZ(3,1)=0.;
236  tmpboostZ(3,2)=0.;
237  tmpboostZ(3,3) = 1.;
238 
239  tmpboostXYZ=tmpboost*tmpboostZ;
240  tmpboost.Invert();
241 
242 
243 
244  boost_ = new TMatrixD(tmpboostXYZ);
245  boost_->Print();
246 
247  return boost_;
248 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
T sqrt(T t)
Definition: SSEVec.h:48
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 283 of file MixBoostEvtVtxGenerator.cc.

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

Referenced by produce().

283  {
284 
286  evt.getByLabel(hiLabel,input);
287 
288  double aX,aY,aZ;
289 
290  aX = input->begin()->position().x() + vtxOffset[0];
291  aY = input->begin()->position().y() + vtxOffset[1];
292  aZ = input->begin()->position().z() + vtxOffset[2];
293 
294  if(!fVertex) fVertex = new HepMC::FourVector();
295  fVertex->set(10.0*aX,10.0*aY,10.0*aZ,0.0); // HepMC positions in mm (RECO in cm)
296 
297  return fVertex;
298 
299 }
std::vector< double > vtxOffset
static std::string const input
Definition: EdmProvDump.cc:43
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:405
HepMC::FourVector * MixBoostEvtVtxGenerator::getVertex ( edm::Event evt)
virtual

Definition at line 250 of file MixBoostEvtVtxGenerator.cc.

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

Referenced by produce().

250  {
251 
253  evt.getByLabel(hiLabel,input);
254 
255  const HepMC::GenEvent* inev = input->GetEvent();
256  HepMC::GenVertex* genvtx = inev->signal_process_vertex();
257  if(!genvtx){
258  cout<<"No Signal Process Vertex!"<<endl;
259  HepMC::GenEvent::particle_const_iterator pt=inev->particles_begin();
260  HepMC::GenEvent::particle_const_iterator ptend=inev->particles_end();
261  while(!genvtx || ( genvtx->particles_in_size() == 1 && pt != ptend ) ){
262  if(!genvtx) cout<<"No Gen Vertex!"<<endl;
263  if(pt == ptend) cout<<"End reached!"<<endl;
264  genvtx = (*pt)->production_vertex();
265  ++pt;
266  }
267  }
268  double aX,aY,aZ,aT;
269 
270  aX = genvtx->position().x();
271  aY = genvtx->position().y();
272  aZ = genvtx->position().z();
273  aT = genvtx->position().t();
274 
275  if(!fVertex) fVertex = new HepMC::FourVector();
276  fVertex->set(aX,aY,aZ,aT);
277 
278  return fVertex;
279 
280 }
static std::string const input
Definition: EdmProvDump.cc:43
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:405
tuple cout
Definition: gather_cfg.py:121
HepMC::FourVector * MixBoostEvtVtxGenerator::newVertex ( )
virtual

return a new event vertex

Definition at line 140 of file MixBoostEvtVtxGenerator.cc.

References BetaFunction(), fRandom, fSigmaZ, fTimeOffset, fVertex, fX0, fY0, fZ0, mathSSE::sqrt(), X, and Gflash::Z.

140  {
141 
142 
143  double X,Y,Z;
144 
145  double tmp_sigz = fRandom->fire(0., fSigmaZ);
146  Z = tmp_sigz + fZ0;
147 
148  double tmp_sigx = BetaFunction(Z,fZ0);
149  // need sqrt(2) for beamspot width relative to single beam width
150  tmp_sigx /= sqrt(2.0);
151  X = fRandom->fire(0.,tmp_sigx) + fX0; // + Z*fdxdz ;
152 
153  double tmp_sigy = BetaFunction(Z,fZ0);
154  // need sqrt(2) for beamspot width relative to single beam width
155  tmp_sigy /= sqrt(2.0);
156  Y = fRandom->fire(0.,tmp_sigy) + fY0; // + Z*fdydz;
157 
158  double tmp_sigt = fRandom->fire(0., fSigmaZ);
159  double T = tmp_sigt + fTimeOffset;
160 
161  if ( fVertex == 0 ) fVertex = new HepMC::FourVector();
162  fVertex->set(X,Y,Z,T);
163 
164  return fVertex;
165 }
const double Z[kNumberCalorimeter]
#define X(str)
Definition: MuonsGrabber.cc:48
T sqrt(T t)
Definition: SSEVec.h:48
long double T
double BetaFunction(double z, double z0)
beta function
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  
)
overridevirtual

Implements edm::EDProducer.

Definition at line 302 of file MixBoostEvtVtxGenerator.cc.

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

303 {
304 
305 
306  Handle<HepMCProduct> HepMCEvt ;
307 
308  evt.getByLabel( signalLabel, HepMCEvt ) ;
309 
310  // generate new vertex & apply the shift
311  //
312 
313  HepMCEvt->applyVtxGen( useRecVertex ? getRecVertex(evt) : getVertex(evt) ) ;
314 
315  // HepMCEvt->boostToLab( GetInvLorentzBoost(), "vertex" );
316  // HepMCEvt->boostToLab( GetInvLorentzBoost(), "momentum" );
317 
318  // OK, create a (pseudo)product and put in into edm::Event
319  //
320  auto_ptr<bool> NewProduct(new bool(true)) ;
321  evt.put( NewProduct ,"matchedVertex") ;
322 
323  return ;
324 
325 }
return((rh^lh)&mask)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:113
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:405
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 174 of file MixBoostEvtVtxGenerator.cc.

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

175 {
176  if (s>=0 ) {
177  fSigmaZ=s;
178  }
179  else {
180  throw cms::Exception("LogicError")
181  << "Error in MixBoostEvtVtxGenerator::sigmaZ: "
182  << "Illegal resolution in Z (negative)";
183  }
184 }
void MixBoostEvtVtxGenerator::X0 ( double  m = 0)
inline
void MixBoostEvtVtxGenerator::Y0 ( double  m = 0)
inline
void MixBoostEvtVtxGenerator::Z0 ( double  m = 0)
inline

Member Data Documentation

double MixBoostEvtVtxGenerator::alpha_
private

Definition at line 92 of file MixBoostEvtVtxGenerator.cc.

Referenced by GetInvLorentzBoost().

double MixBoostEvtVtxGenerator::beta_
private

Definition at line 94 of file MixBoostEvtVtxGenerator.cc.

Referenced by GetInvLorentzBoost().

TMatrixD* MixBoostEvtVtxGenerator::boost_
private

Definition at line 102 of file MixBoostEvtVtxGenerator.cc.

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

double MixBoostEvtVtxGenerator::falpha
private

Definition at line 99 of file MixBoostEvtVtxGenerator.cc.

double MixBoostEvtVtxGenerator::fbetastar
private

Definition at line 98 of file MixBoostEvtVtxGenerator.cc.

Referenced by BetaFunction().

double MixBoostEvtVtxGenerator::femittance
private

Definition at line 98 of file MixBoostEvtVtxGenerator.cc.

Referenced by BetaFunction().

CLHEP::RandGaussQ* MixBoostEvtVtxGenerator::fRandom
private

Definition at line 107 of file MixBoostEvtVtxGenerator.cc.

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

double MixBoostEvtVtxGenerator::fSigmaZ
private

Definition at line 96 of file MixBoostEvtVtxGenerator.cc.

Referenced by newVertex(), and sigmaZ().

double MixBoostEvtVtxGenerator::fTimeOffset
private

Definition at line 103 of file MixBoostEvtVtxGenerator.cc.

Referenced by newVertex().

HepMC::FourVector* MixBoostEvtVtxGenerator::fVertex
private
double MixBoostEvtVtxGenerator::fX0
private

Definition at line 95 of file MixBoostEvtVtxGenerator.cc.

Referenced by newVertex().

double MixBoostEvtVtxGenerator::fY0
private

Definition at line 95 of file MixBoostEvtVtxGenerator.cc.

Referenced by newVertex().

double MixBoostEvtVtxGenerator::fZ0
private

Definition at line 95 of file MixBoostEvtVtxGenerator.cc.

Referenced by newVertex().

edm::InputTag MixBoostEvtVtxGenerator::hiLabel
private

Definition at line 110 of file MixBoostEvtVtxGenerator.cc.

Referenced by getRecVertex(), and getVertex().

double MixBoostEvtVtxGenerator::phi_
private

Definition at line 92 of file MixBoostEvtVtxGenerator.cc.

Referenced by GetInvLorentzBoost().

edm::InputTag MixBoostEvtVtxGenerator::signalLabel
private

Definition at line 109 of file MixBoostEvtVtxGenerator.cc.

Referenced by produce().

edm::InputTag MixBoostEvtVtxGenerator::sourceLabel
private

Definition at line 105 of file MixBoostEvtVtxGenerator.cc.

bool MixBoostEvtVtxGenerator::useRecVertex
private

Definition at line 111 of file MixBoostEvtVtxGenerator.cc.

Referenced by produce().

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

Definition at line 112 of file MixBoostEvtVtxGenerator.cc.

Referenced by getRecVertex(), and MixBoostEvtVtxGenerator().