Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-08-04 02:02:43

0001 #ifndef IOMC_BetafuncEvtVtxGenerator_H
0002 #define IOMC_BetafuncEvtVtxGenerator_H
0003 
0004 /*
0005 ________________________________________________________________________
0006 
0007  BetafuncEvtVtxGenerator
0008 
0009  Smear vertex according to the Beta function on the transverse plane
0010  and a Gaussian on the z axis. It allows the beam to have a crossing
0011  angle (dx/dz and dy/dz).
0012 
0013  Based on GaussEvtVtxGenerator.h
0014  implemented by Francisco Yumiceva (yumiceva@fnal.gov)
0015 
0016  FERMILAB
0017  2006
0018 ________________________________________________________________________
0019 */
0020 
0021 #include "IOMC/EventVertexGenerators/interface/BaseEvtVtxGenerator.h"
0022 #include "FWCore/Framework/interface/ESWatcher.h"
0023 #include "FWCore/Utilities/interface/ESGetToken.h"
0024 #include "CondFormats/DataRecord/interface/SimBeamSpotObjectsRcd.h"
0025 #include "CondFormats/BeamSpotObjects/interface/SimBeamSpotObjects.h"
0026 
0027 namespace CLHEP {
0028   class HepRandomEngine;
0029 }
0030 
0031 class BetafuncEvtVtxGenerator : public BaseEvtVtxGenerator {
0032 public:
0033   BetafuncEvtVtxGenerator(const edm::ParameterSet& p);
0034   /** Copy constructor */
0035   BetafuncEvtVtxGenerator(const BetafuncEvtVtxGenerator& p) = delete;
0036   /** Copy assignment operator */
0037   BetafuncEvtVtxGenerator& operator=(const BetafuncEvtVtxGenerator& rhs) = delete;
0038   ~BetafuncEvtVtxGenerator() override;
0039 
0040   void beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override;
0041 
0042   /// return a new event vertex
0043   //virtual CLHEP::Hep3Vector * newVertex();
0044   HepMC::FourVector newVertex(CLHEP::HepRandomEngine*) const override;
0045 
0046   TMatrixD const* GetInvLorentzBoost() const override;
0047 
0048   /// set resolution in Z in cm
0049   void sigmaZ(double s = 1.0);
0050 
0051   /// set mean in X in cm
0052   void X0(double m = 0) { fX0 = m; }
0053   /// set mean in Y in cm
0054   void Y0(double m = 0) { fY0 = m; }
0055   /// set mean in Z in cm
0056   void Z0(double m = 0) { fZ0 = m; }
0057 
0058   /// set beta_star
0059   void betastar(double m = 0) { fbetastar = m; }
0060   /// emittance (no the normalized)
0061   void emittance(double m = 0) { femittance = m; }
0062 
0063   /// beta function
0064   double BetaFunction(double z, double z0) const;
0065 
0066 private:
0067   void setBoost(double alpha, double phi);
0068 
0069 private:
0070   bool readDB_;
0071 
0072   double fX0, fY0, fZ0;
0073   double fSigmaZ;
0074   //double fdxdz, fdydz;
0075   double fbetastar, femittance;
0076   //  double falpha;
0077   double fTimeOffset;
0078 
0079   TMatrixD boost_;
0080 
0081   void update(const edm::EventSetup& iEventSetup);
0082   edm::ESWatcher<SimBeamSpotObjectsRcd> parameterWatcher_;
0083   edm::ESGetToken<SimBeamSpotObjects, SimBeamSpotObjectsRcd> beamToken_;
0084 };
0085 
0086 #endif