Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:19:00

0001 #ifndef IOMC_GaussEvtVtxGenerator_H
0002 #define IOMC_GaussEvtVtxGenerator_H
0003 
0004 /**
0005  * Generate event vertices according to a Gauss distribution. 
0006  * Attention: All values are assumed to be cm!
0007  *
0008  */
0009 
0010 #include "IOMC/EventVertexGenerators/interface/BaseEvtVtxGenerator.h"
0011 #include "FWCore/Framework/interface/ESWatcher.h"
0012 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
0013 #include "FWCore/Utilities/interface/ESGetToken.h"
0014 #include "CondFormats/DataRecord/interface/SimBeamSpotObjectsRcd.h"
0015 #include "CondFormats/BeamSpotObjects/interface/SimBeamSpotObjects.h"
0016 
0017 namespace CLHEP {
0018   class HepRandomEngine;
0019 }
0020 
0021 class GaussEvtVtxGenerator : public BaseEvtVtxGenerator {
0022 public:
0023   GaussEvtVtxGenerator(const edm::ParameterSet& p);
0024   /** Copy constructor */
0025   GaussEvtVtxGenerator(const GaussEvtVtxGenerator& p) = delete;
0026   /** Copy assignment operator */
0027   GaussEvtVtxGenerator& operator=(const GaussEvtVtxGenerator& rhs) = delete;
0028   ~GaussEvtVtxGenerator() override = default;
0029 
0030   static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
0031 
0032   void beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override;
0033 
0034   /// return a new event vertex
0035   //virtual CLHEP::Hep3Vector* newVertex();
0036   HepMC::FourVector newVertex(CLHEP::HepRandomEngine*) const override;
0037 
0038   TMatrixD const* GetInvLorentzBoost() const override { return nullptr; }
0039 
0040   /// set resolution in X in cm
0041   void sigmaX(double s = 1.0);
0042   /// set resolution in Y in cm
0043   void sigmaY(double s = 1.0);
0044   /// set resolution in Z in cm
0045   void sigmaZ(double s = 1.0);
0046 
0047   /// set mean in X in cm
0048   void meanX(double m = 0) { fMeanX = m; }
0049   /// set mean in Y in cm
0050   void meanY(double m = 0) { fMeanY = m; }
0051   /// set mean in Z in cm
0052   void meanZ(double m = 0) { fMeanZ = m; }
0053 
0054 private:
0055   bool readDB_;
0056 
0057   double fSigmaX, fSigmaY, fSigmaZ;
0058   double fMeanX, fMeanY, fMeanZ;
0059   double fTimeOffset;
0060 
0061   void update(const edm::EventSetup& iEventSetup);
0062   edm::ESWatcher<SimBeamSpotObjectsRcd> parameterWatcher_;
0063   edm::ESGetToken<SimBeamSpotObjects, SimBeamSpotObjectsRcd> beamToken_;
0064 };
0065 
0066 #endif