Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-06-18 23:27:15

0001 #ifndef RecoVertex_BeamSpotProducer_BeamSpotWrite2Txt_h
0002 #define RecoVertex_BeamSpotProducer_BeamSpotWrite2Txt_h
0003 
0004 #include <fstream>
0005 
0006 #include "DataFormats/BeamSpot/interface/BeamSpot.h"
0007 
0008 namespace beamspot {
0009 
0010   struct BeamSpotContainer {
0011     reco::BeamSpot beamspot;
0012     int run;
0013     char beginTimeOfFit[32];
0014     char endTimeOfFit[32];
0015     int beginLumiOfFit;
0016     int endLumiOfFit;
0017     std::time_t reftime[2];
0018   };
0019 
0020   inline void dumpBeamSpotTxt(std::ofstream& outFile, BeamSpotContainer const& bsContainer) {
0021     outFile << "Runnumber " << bsContainer.run << std::endl;
0022     outFile << "BeginTimeOfFit " << bsContainer.beginTimeOfFit << " " << bsContainer.reftime[0] << std::endl;
0023     outFile << "EndTimeOfFit " << bsContainer.endTimeOfFit << " " << bsContainer.reftime[1] << std::endl;
0024     outFile << "LumiRange " << bsContainer.beginLumiOfFit << " - " << bsContainer.endLumiOfFit << std::endl;
0025     outFile << "Type " << bsContainer.beamspot.type() << std::endl;
0026     outFile << "X0 " << bsContainer.beamspot.x0() << std::endl;
0027     outFile << "Y0 " << bsContainer.beamspot.y0() << std::endl;
0028     outFile << "Z0 " << bsContainer.beamspot.z0() << std::endl;
0029     outFile << "sigmaZ0 " << bsContainer.beamspot.sigmaZ() << std::endl;
0030     outFile << "dxdz " << bsContainer.beamspot.dxdz() << std::endl;
0031     outFile << "dydz " << bsContainer.beamspot.dydz() << std::endl;
0032     outFile << "BeamWidthX " << bsContainer.beamspot.BeamWidthX() << std::endl;
0033     outFile << "BeamWidthY " << bsContainer.beamspot.BeamWidthY() << std::endl;
0034     for (int i = 0; i < 6; ++i) {
0035       outFile << "Cov(" << i << ",j) ";
0036       for (int j = 0; j < 7; ++j) {
0037         outFile << bsContainer.beamspot.covariance(i, j) << " ";
0038       }
0039       outFile << std::endl;
0040     }
0041     // Uncertainties on sigmaX and sigmaY are set to be equal. Legacy from a distant past
0042     outFile << "Cov(6,j) 0 0 0 0 0 0 " << bsContainer.beamspot.covariance(6, 6) << std::endl;
0043     outFile << "EmittanceX " << bsContainer.beamspot.emittanceX() << std::endl;
0044     outFile << "EmittanceY " << bsContainer.beamspot.emittanceY() << std::endl;
0045     outFile << "BetaStar " << bsContainer.beamspot.betaStar() << std::endl;
0046   }
0047 
0048 }  // end namespace beamspot
0049 
0050 #endif