58 : putToken_{produces<LumiInfo, edm::Transition::EndLuminosityBlock>(
61 takeAverageValue_{iConfig.getParameter<
edm::ParameterSet>(
"RawPCCProducerParameters")
62 .getUntrackedParameter<std::string>(
"OutputValue",
std::string(
"Totals"))},
66 .getUntrackedParameter<std::string>(
"label",
std::string(
"rawPCC.csv"))},
68 .getUntrackedParameter<bool>(
"saveCSVFile",
false)},
70 .getUntrackedParameter<bool>(
"ApplyCorrections",
false)} {
74 iConfig.getParameter<
edm::ParameterSet>(
"RawPCCProducerParameters").getParameter<std::string>(
"ProdInst");
76 pccToken_ = consumes<reco::PixelClusterCounts, edm::InLumi>(
edm::InputTag(pccSource, prodInst));
88 float totalLumi = 0.0;
89 float statErrOnLumi = 0.0;
97 std::vector<int> goodMods;
108 auto clustersPerBXInput = inputPcc.
readCounts();
111 for (
unsigned int i = 0;
i < modID.size();
i++) {
113 goodMods.push_back(
i);
119 for (
unsigned int i = 0;
i < goodMods.size();
i++) {
124 std::vector<float> correctionScaleFactors;
134 for (
unsigned int i = 0;
i < clustersPerBXOutput.size();
i++) {
136 corrClustersPerBXOutput[
i] = clustersPerBXOutput[
i] * correctionScaleFactors[
i];
138 corrClustersPerBXOutput[
i] = 0.0;
140 totalLumi += corrClustersPerBXOutput[
i];
144 std::vector<float> errorPerBX;
148 unsigned int NActiveBX = 0;
159 if (statErrOnLumi != 0) {
160 totalLumi = totalLumi / statErrOnLumi *
float(NActiveBX);
161 statErrOnLumi = 1 /
sqrt(statErrOnLumi) * totalLumi;
176 csfile << std::to_string(lumiSeg.
run()) <<
",";
178 csfile << std::to_string(totalLumi);
182 csfile <<
"," << std::to_string(corrClustersPerBXOutput[
bx]);
185 }
else if (totalLumi < 0) {
186 edm::LogInfo(
"WARNING") <<
"WHY IS LUMI NEGATIVE?!?!?!? " << totalLumi;