Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:01:56

0001 #include "CondFormats/BeamSpotObjects/interface/SimBeamSpotObjects.h"
0002 
0003 #include <cmath>
0004 #include <iostream>
0005 
0006 // Get SigmaX and SigmaY:
0007 // - directly fSigmaX if >= 0 (in case of Gaussian Smearing)
0008 // - else from LPC-like calculation (in case of BetaFunc Smearing)
0009 double SimBeamSpotObjects::sigmaX() const {
0010   if (fSigmaX >= 0.)  // Gaussian smearing
0011     return fSigmaX;
0012   else  // BetaFunc smearing
0013     return (1 / std::sqrt(2)) * std::sqrt(femittance * fbetastar);
0014 }
0015 
0016 double SimBeamSpotObjects::sigmaY() const {
0017   if (fSigmaY >= 0.)  // Gaussian smearing
0018     return fSigmaY;
0019   else  // BetaFunc smearing
0020     return (1 / std::sqrt(2)) * std::sqrt(femittance * fbetastar);
0021 }
0022 
0023 // Printout SimBeamSpotObjects
0024 void SimBeamSpotObjects::print(std::stringstream& ss) const {
0025   ss << "-----------------------------------------------------\n"
0026      << "              Sim Beam Spot Data\n\n"
0027      << "       X0     = " << x() << " [cm]\n"
0028      << "       Y0     = " << y() << " [cm]\n"
0029      << "       Z0     = " << z() << " [cm]\n"
0030      << "    MeanX     = " << meanX() << " [cm]\n"
0031      << "    MeanY     = " << meanY() << " [cm]\n"
0032      << "    MeanZ     = " << meanZ() << " [cm]\n"
0033      << " Sigma X0     = " << sigmaX() << " [cm]\n"
0034      << " Sigma Y0     = " << sigmaY() << " [cm]\n"
0035      << " Sigma Z0     = " << sigmaZ() << " [cm]\n"
0036      << " Beta star    = " << betaStar() << " [cm]\n"
0037      << " Emittance X  = " << emittance() << " [cm]\n"
0038      << " Phi          = " << phi() << " [radians]\n"
0039      << " Alpha        = " << alpha() << " [radians]\n"
0040      << " TimeOffset   = " << timeOffset() << " [ns]\n"
0041      << "-----------------------------------------------------\n\n";
0042 }
0043 
0044 std::ostream& operator<<(std::ostream& os, SimBeamSpotObjects beam) {
0045   std::stringstream ss;
0046   beam.print(ss);
0047   os << ss.str();
0048   return os;
0049 }