Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-12-10 02:31:53

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/ParameterSet/interface/ConfigurationDescriptions.h"
0024 #include "FWCore/Utilities/interface/ESGetToken.h"
0025 #include "CondFormats/DataRecord/interface/SimBeamSpotObjectsRcd.h"
0026 #include "CondFormats/BeamSpotObjects/interface/SimBeamSpotObjects.h"
0027 
0028 namespace CLHEP {
0029   class HepRandomEngine;
0030 }
0031 
0032 class BetafuncEvtVtxGenerator : public BaseEvtVtxGenerator {
0033 public:
0034   BetafuncEvtVtxGenerator(const edm::ParameterSet& p);
0035   /** Copy constructor */
0036   BetafuncEvtVtxGenerator(const BetafuncEvtVtxGenerator& p) = delete;
0037   /** Copy assignment operator */
0038   BetafuncEvtVtxGenerator& operator=(const BetafuncEvtVtxGenerator& rhs) = delete;
0039   ~BetafuncEvtVtxGenerator() override = default;
0040 
0041   static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
0042 
0043   void beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override;
0044 
0045   /// return a new event vertex
0046   ROOT::Math::XYZTVector vertexShift(CLHEP::HepRandomEngine*) const override;
0047 
0048   TMatrixD const* GetInvLorentzBoost() const override;
0049 
0050   /// set resolution in Z in cm
0051   void sigmaZ(double s = 1.0);
0052 
0053   /// set mean in X in cm
0054   void X0(double m = 0) { fX0 = m; }
0055   /// set mean in Y in cm
0056   void Y0(double m = 0) { fY0 = m; }
0057   /// set mean in Z in cm
0058   void Z0(double m = 0) { fZ0 = m; }
0059 
0060   /// set beta_star
0061   void betastar(double m = 0) { fbetastar = m; }
0062   /// emittance (no the normalized)
0063   void emittance(double m = 0) { femittance = m; }
0064 
0065   /// beta function
0066   double BetaFunction(double z, double z0) const;
0067 
0068 private:
0069   void setBoost(double alpha, double phi);
0070 
0071 private:
0072   bool readDB_;
0073 
0074   double fX0, fY0, fZ0;
0075   double fSigmaZ;
0076   //double fdxdz, fdydz;
0077   double fbetastar, femittance;
0078   //  double falpha;
0079   double fTimeOffset;
0080 
0081   TMatrixD boost_;
0082 
0083   void update(const edm::EventSetup& iEventSetup);
0084   edm::ESWatcher<SimBeamSpotObjectsRcd> parameterWatcher_;
0085   edm::ESGetToken<SimBeamSpotObjects, SimBeamSpotObjectsRcd> beamToken_;
0086 };
0087 
0088 #endif