59 putToken_{ produces<LumiInfo, edm::Transition::EndLuminosityBlock>(iConfig.
getParameter<
edm::ParameterSet>(
"RawPCCProducerParameters").getUntrackedParameter<std::string>(
"outputProductName",
"alcaLumi"))},
64 applyCorr_{ iConfig.getParameter<
edm::ParameterSet>(
"RawPCCProducerParameters").getUntrackedParameter<bool>(
"ApplyCorrections",
false) }
67 auto prodInst = iConfig.getParameter<
edm::ParameterSet>(
"RawPCCProducerParameters").getParameter<std::string>(
"ProdInst");
85 float statErrOnLumi=0.0;
93 std::vector<int> goodMods;
104 auto clustersPerBXInput = inputPcc.
readCounts();
107 for (
unsigned int i=0;
i<modID.size();
i++){
109 goodMods.push_back(
i);
115 for (
unsigned int i=0;
i<goodMods.size();
i++){
121 std::vector<float> correctionScaleFactors;
131 for (
unsigned int i=0;
i<clustersPerBXOutput.size();
i++){
133 corrClustersPerBXOutput[
i]=clustersPerBXOutput[
i]*correctionScaleFactors[
i];
135 corrClustersPerBXOutput[
i]=0.0;
137 totalLumi+=corrClustersPerBXOutput[
i];
141 std::vector<float> errorPerBX;
145 unsigned int NActiveBX=0;
156 if (statErrOnLumi!=0) {
157 totalLumi=totalLumi/statErrOnLumi*
float(NActiveBX);
158 statErrOnLumi=1/
sqrt(statErrOnLumi)*totalLumi;
174 csfile<<std::to_string(lumiSeg.
run())<<
",";
176 csfile<<std::to_string(totalLumi);
180 csfile<<
","<<std::to_string(corrClustersPerBXOutput[bx]);
183 }
else if (totalLumi<0) {
184 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_
#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
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