File indexing completed on 2024-04-06 12:04:40
0001 #include "DataFormats/Luminosity/interface/LumiInfo.h"
0002
0003 #include <vector>
0004 #include <iomanip>
0005 #include <ostream>
0006 #include <iostream>
0007
0008 float LumiInfo::instLuminosityBXSum() const {
0009 float totLum = 0;
0010 for (std::vector<float>::const_iterator it = instLumiByBX_.begin(); it != instLumiByBX_.end(); ++it) {
0011 totLum += *it;
0012 }
0013 return totLum;
0014 }
0015
0016 float LumiInfo::integLuminosity() const { return getTotalInstLumi() * lumiSectionLength(); }
0017
0018 void LumiInfo::setTotalInstToBXSum() { setTotalInstLumi(instLuminosityBXSum()); }
0019
0020 float LumiInfo::recordedLuminosity() const { return integLuminosity() * (1 - deadtimeFraction_); }
0021
0022 float LumiInfo::lumiSectionLength() const {
0023
0024 return LumiConstants::numOrbits * LumiConstants::numBX * LumiConstants::bxSpacingExact;
0025 }
0026
0027 bool LumiInfo::isProductEqual(LumiInfo const& next) const {
0028 return (deadtimeFraction_ == next.deadtimeFraction_ && instLumiByBX_ == next.instLumiByBX_);
0029 }
0030
0031 void LumiInfo::setInstLumiAllBX(std::vector<float>& instLumiByBX) {
0032 instLumiByBX_.assign(instLumiByBX.begin(), instLumiByBX.end());
0033 }
0034
0035 void LumiInfo::setErrorLumiAllBX(std::vector<float>& errLumiByBX) {
0036 instLumiStatErrByBX_.assign(errLumiByBX.begin(), errLumiByBX.end());
0037 }
0038
0039 std::ostream& operator<<(std::ostream& s, const LumiInfo& lumiInfo) {
0040 s << "\nDumping LumiInfo\n\n";
0041 s << " getTotalInstLumi = " << lumiInfo.getTotalInstLumi() << "\n";
0042 s << " integLuminosity = " << lumiInfo.integLuminosity() << "\n";
0043 s << " recordedLuminosity = " << lumiInfo.recordedLuminosity() << "\n";
0044 s << " deadtimeFraction = " << lumiInfo.getDeadFraction() << "\n";
0045 s << " instLumiByBX = ";
0046 const std::vector<float>& lumiBX = lumiInfo.getInstLumiAllBX();
0047 for (unsigned int i = 0; i < 10 && i < lumiBX.size(); ++i) {
0048 s << lumiBX.at(i) << " ";
0049 }
0050 s << " ...\n";
0051
0052 return s << "\n";
0053 }