58 :
putToken_{produces<LumiInfo, edm::Transition::EndLuminosityBlock>(
60 .getUntrackedParameter<std::string>(
"outputProductName",
"alcaLumi"))},
62 .getUntrackedParameter<std::string>(
"OutputValue",
std::string(
"Totals"))},
64 iConfig.getParameter<
edm::ParameterSet>(
"RawPCCProducerParameters").getParameter<std::vector<int>>(
"modVeto")},
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");
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;
T getParameter(std::string const &) const
static boost::mutex mutex
bool getByToken(EDGetToken token, Handle< PROD > &result) const
const std::string csvOutLabel_
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
#define DEFINE_FWK_MODULE(type)
std::vector< int > const & readCounts() const
void setTotalInstLumi(float totalLumi)
std::vector< int > const & readModID() const
const edm::EDPutTokenT< LumiInfo > putToken_
T const * product() const
const std::vector< float > & getCorrectionsBX() const
~RawPCCProducer() override
void setTotalInstStatError(float statError)
const std::vector< int > modVeto_
void setErrorLumiAllBX(std::vector< float > &errLumiByBX)
void produce(edm::StreamID, edm::Event &iEvent, const edm::EventSetup &iSetup) const final
RawPCCProducer(const edm::ParameterSet &)
T const * product() const
std::vector< int > const & readEvents() const
edm::EDGetTokenT< reco::PixelClusterCounts > pccToken_
void globalEndLuminosityBlockProduce(edm::LuminosityBlock &lumiSeg, const edm::EventSetup &iSetup) const final