From 8d8cdb872bb86d2547a8ef925162d47f1d631b6e Mon Sep 17 00:00:00 2001
From: Alexey <shevelevalex@gmail.com>
Date: Thu, 3 Oct 2024 12:01:13 +0200
Subject: [PATCH 1/2] adding configuration for per roc data

---
 .../plugins/AlcaPCCEventProducer.cc           | 33 +++++++++++--------
 1 file changed, 19 insertions(+), 14 deletions(-)

diff --git a/Calibration/LumiAlCaRecoProducers/plugins/AlcaPCCEventProducer.cc b/Calibration/LumiAlCaRecoProducers/plugins/AlcaPCCEventProducer.cc
index 906b5a112c434..d7a8776295436 100644
--- a/Calibration/LumiAlCaRecoProducers/plugins/AlcaPCCEventProducer.cc
+++ b/Calibration/LumiAlCaRecoProducers/plugins/AlcaPCCEventProducer.cc
@@ -37,7 +37,8 @@ class AlcaPCCEventProducer : public edm::global::EDProducer<> {
 
 private:
   const edm::InputTag pixelClusterLabel_;
-  const std::string trigstring_;  //specifies the trigger Rand or ZeroBias
+  const std::string trigstring_;      //specifies the trigger Rand or ZeroBias
+  const bool savePerROCInfo_;  // save per ROC data (important for the special fills)
   const edm::EDGetTokenT<edmNew::DetSetVector<SiPixelCluster> > pixelToken_;
 
   static constexpr int rowsperroc = 52;
@@ -49,6 +50,7 @@ class AlcaPCCEventProducer : public edm::global::EDProducer<> {
 AlcaPCCEventProducer::AlcaPCCEventProducer(const edm::ParameterSet& iConfig)
     : pixelClusterLabel_(iConfig.getParameter<edm::InputTag>("pixelClusterLabel")),
       trigstring_(iConfig.getUntrackedParameter<std::string>("trigstring", "alcaPCCEvent")),
+      savePerROCInfo_(iConfig.getParameter<bool>("savePerROCInfo")),
       pixelToken_(consumes<edmNew::DetSetVector<SiPixelCluster> >(pixelClusterLabel_)) {
   produces<reco::PixelClusterCountsInEvent, edm::Transition::Event>(trigstring_);
 }
@@ -71,19 +73,21 @@ void AlcaPCCEventProducer::produce(edm::StreamID id, edm::Event& iEvent, edm::Ev
     }
     DetId detId = mod.id();
 
-    // Iterate over Clusters in module to fill per ROC histogram
-    for (auto const& cluster : mod) {
-      for (int i = 0; i < cluster.size(); ++i) {
-        const auto pix = cluster.pixel(i);
-        // TODO: add roc threshold to config if(di.adc > fRocThreshold_) {
-        if (pix.adc > 0) {
-          int irow = pix.x / rowsperroc; /* constant column direction is along x-axis */
-          int icol = pix.y / colsperroc; /* constant row direction is along y-axis */
-          /* generate the folling roc index that is going to map with ROC id as
-          8  9  10 11 12 13 14 15
-          0  1  2  3  4  5  6  7 */
-          int key = icol + irow * nROCcolumns;
-          thePCCob->incrementRoc(((detId << 7) + key), 1);
+    if (savePerROCInfo_) {
+      // Iterate over Clusters in module to fill per ROC histogram
+      for (auto const& cluster : mod) {
+        for (int i = 0; i < cluster.size(); ++i) {
+          const auto pix = cluster.pixel(i);
+          // TODO: add roc threshold to config if(di.adc > fRocThreshold_) {
+          if (pix.adc > 0) {
+            int irow = pix.x / rowsperroc; /* constant column direction is along x-axis */
+            int icol = pix.y / colsperroc; /* constant row direction is along y-axis */
+            /* generate the folling roc index that is going to map with ROC id as
+            8  9  10 11 12 13 14 15
+            0  1  2  3  4  5  6  7 */
+            int key = icol + irow * nROCcolumns;
+            thePCCob->incrementRoc(((detId << 7) + key), 1);
+          }
         }
       }
     }
@@ -101,6 +105,7 @@ void AlcaPCCEventProducer::fillDescriptions(edm::ConfigurationDescriptions& desc
   edm::ParameterSetDescription evtParamDesc;
   evtParamDesc.add<edm::InputTag>("pixelClusterLabel", edm::InputTag("siPixelClustersForLumi"));
   evtParamDesc.addUntracked<std::string>("trigstring", "alcaPCCEvent");
+  evtParamDesc.add<bool>("savePerROCInfo", true);
   descriptions.add("alcaPCCEventProducer", evtParamDesc);
 }
 

From 85804f2f8d51a8caf0fe76af24f557de300fab5f Mon Sep 17 00:00:00 2001
From: Alexey <shevelevalex@gmail.com>
Date: Thu, 3 Oct 2024 18:00:53 +0200
Subject: [PATCH 2/2] code checks

---
 .../LumiAlCaRecoProducers/plugins/AlcaPCCEventProducer.cc     | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Calibration/LumiAlCaRecoProducers/plugins/AlcaPCCEventProducer.cc b/Calibration/LumiAlCaRecoProducers/plugins/AlcaPCCEventProducer.cc
index d7a8776295436..e9a9ad92290a6 100644
--- a/Calibration/LumiAlCaRecoProducers/plugins/AlcaPCCEventProducer.cc
+++ b/Calibration/LumiAlCaRecoProducers/plugins/AlcaPCCEventProducer.cc
@@ -37,8 +37,8 @@ class AlcaPCCEventProducer : public edm::global::EDProducer<> {
 
 private:
   const edm::InputTag pixelClusterLabel_;
-  const std::string trigstring_;      //specifies the trigger Rand or ZeroBias
-  const bool savePerROCInfo_;  // save per ROC data (important for the special fills)
+  const std::string trigstring_;  //specifies the trigger Rand or ZeroBias
+  const bool savePerROCInfo_;     // save per ROC data (important for the special fills)
   const edm::EDGetTokenT<edmNew::DetSetVector<SiPixelCluster> > pixelToken_;
 
   static constexpr int rowsperroc = 52;