60 putToken_{produces<LumiInfo, edm::Transition::EndLuminosityBlock>(
62 .getUntrackedParameter<std::string>(
"outputProductName",
"alcaLumi"))},
64 .getUntrackedParameter<std::string>(
"OutputValue",
std::string(
"Totals"))},
68 .getUntrackedParameter<std::string>(
"label",
std::string(
"rawPCC.csv"))},
70 .getUntrackedParameter<bool>(
"saveCSVFile",
false)},
72 .getUntrackedParameter<bool>(
"ApplyCorrections",
false)} {
90 float totalLumi = 0.0;
91 float statErrOnLumi = 0.0;
99 std::vector<int> goodMods;
110 auto clustersPerBXInput = inputPcc.
readCounts();
113 for (
unsigned int i = 0;
i < modID.size();
i++) {
115 goodMods.push_back(
i);
121 for (
unsigned int i = 0;
i < goodMods.size();
i++) {
126 std::vector<float> correctionScaleFactors;
130 correctionScaleFactors = pccCorrections->getCorrectionsBX();
135 for (
unsigned int i = 0;
i < clustersPerBXOutput.size();
i++) {
137 corrClustersPerBXOutput[
i] = clustersPerBXOutput[
i] * correctionScaleFactors[
i];
139 corrClustersPerBXOutput[
i] = 0.0;
141 totalLumi += corrClustersPerBXOutput[
i];
142 statErrOnLumi += float(
events[
i]);
145 std::vector<float> errorPerBX;
149 unsigned int NActiveBX = 0;
156 corrClustersPerBXOutput[
bx] /= float(
events[
bx]);
160 if (statErrOnLumi != 0) {
161 totalLumi = totalLumi / statErrOnLumi * float(NActiveBX);
162 statErrOnLumi = 1 /
sqrt(statErrOnLumi) * totalLumi;
177 csfile << std::to_string(lumiSeg.
run()) <<
",";
179 csfile << std::to_string(totalLumi);
183 csfile <<
"," << std::to_string(corrClustersPerBXOutput[
bx]);
186 }
else if (totalLumi < 0) {
187 edm::LogInfo(
"WARNING") <<
"WHY IS LUMI NEGATIVE?!?!?!? " << totalLumi;
const edm::ESGetToken< LumiCorrections, LumiCorrectionsRcd > lumiCorrectionsToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
const std::string csvOutLabel_
#define DEFINE_FWK_MODULE(type)
static const unsigned int numBX
void setInstLumiAllBX(std::vector< float > &instLumiByBX)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
void emplace(EDPutTokenT< PROD > token, Args &&...args)
puts a new product
const std::string takeAverageValue_
LuminosityBlockNumber_t luminosityBlock() const
bool getData(T &iHolder) const
std::vector< int > const & readCounts() const
void setTotalInstLumi(float totalLumi)
std::vector< int > const & readModID() const
const edm::EDPutTokenT< LumiInfo > putToken_
Log< level::Info, false > LogInfo
void globalEndLuminosityBlockProduce(edm::LuminosityBlock &lumiSeg, const edm::EventSetup &iSetup) const final
T const * product() const
~RawPCCProducer() override
void setTotalInstStatError(float statError)
T getParameter(std::string const &) const
const std::vector< int > modVeto_
void setErrorLumiAllBX(std::vector< float > &errLumiByBX)
RawPCCProducer(const edm::ParameterSet &)
void produce(edm::StreamID, edm::Event &iEvent, const edm::EventSetup &iSetup) const final
std::vector< int > const & readEvents() const
edm::EDGetTokenT< reco::PixelClusterCounts > pccToken_