CMS 3D CMS Logo

AlcaPCCEventProducer.cc
Go to the documentation of this file.
1 
7 // C++ standard
8 #include <string>
9 
10 // CMS
28 #include "TMath.h"
29 
30 //The class
32 public:
33  explicit AlcaPCCEventProducer(const edm::ParameterSet&);
34  ~AlcaPCCEventProducer() override = default;
35  void produce(edm::StreamID id, edm::Event& e, edm::EventSetup const& c) const final;
36  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
37 
38 private:
40  const std::string trigstring_; //specifies the trigger Rand or ZeroBias
42 
43  static constexpr int rowsperroc = 52;
44  static constexpr int colsperroc = 80;
45  static constexpr int nROCcolumns = 8;
46 };
47 
48 //--------------------------------------------------------------------------------------------------
50  : pixelClusterLabel_(iConfig.getParameter<edm::InputTag>("pixelClusterLabel")),
51  trigstring_(iConfig.getUntrackedParameter<std::string>("trigstring", "alcaPCCEvent")),
52  pixelToken_(consumes<edmNew::DetSetVector<SiPixelCluster> >(pixelClusterLabel_)) {
53  produces<reco::PixelClusterCountsInEvent, edm::Transition::Event>(trigstring_);
54 }
55 
56 //--------------------------------------------------------------------------------------------------
58  std::unique_ptr<reco::PixelClusterCountsInEvent> thePCCob = std::make_unique<reco::PixelClusterCountsInEvent>();
59  unsigned int bx = iEvent.bunchCrossing();
60 
61  //Looping over the clusters and adding the counts up
63  iEvent.getByToken(pixelToken_, hClusterColl);
64 
65  const edmNew::DetSetVector<SiPixelCluster>& clustColl = *(hClusterColl.product());
66  // ----------------------------------------------------------------------
67  // -- Clusters without tracks
68  for (auto const& mod : clustColl) {
69  if (mod.empty()) {
70  continue;
71  }
72  DetId detId = mod.id();
73 
74  // Iterate over Clusters in module to fill per ROC histogram
75  for (auto const& cluster : mod) {
76  for (int i = 0; i < cluster.size(); ++i) {
77  const auto pix = cluster.pixel(i);
78  // TODO: add roc threshold to config if(di.adc > fRocThreshold_) {
79  if (pix.adc > 0) {
80  int irow = pix.x / rowsperroc; /* constant column direction is along x-axis */
81  int icol = pix.y / colsperroc; /* constant row direction is along y-axis */
82  /* generate the folling roc index that is going to map with ROC id as
83  8 9 10 11 12 13 14 15
84  0 1 2 3 4 5 6 7 */
85  int key = icol + irow * nROCcolumns;
86  thePCCob->incrementRoc(((detId << 7) + key), 1);
87  }
88  }
89  }
90 
91  int nCluster = mod.size();
92  thePCCob->increment(detId(), nCluster);
93  thePCCob->setbxID(bx);
94  }
95 
96  iEvent.put(std::move(thePCCob), std::string(trigstring_));
97 }
98 
99 //--------------------------------------------------------------------------------------------------
101  edm::ParameterSetDescription evtParamDesc;
102  evtParamDesc.add<edm::InputTag>("pixelClusterLabel", edm::InputTag("siPixelClustersForLumi"));
103  evtParamDesc.addUntracked<std::string>("trigstring", "alcaPCCEvent");
104  descriptions.add("alcaPCCEventProducer", evtParamDesc);
105 }
106 
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
const edm::InputTag pixelClusterLabel_
AlcaPCCEventProducer(const edm::ParameterSet &)
T const * product() const
Definition: Handle.h:70
void produce(edm::StreamID id, edm::Event &e, edm::EventSetup const &c) const final
static constexpr int colsperroc
int iEvent
Definition: GenABIO.cc:224
const edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > pixelToken_
~AlcaPCCEventProducer() override=default
static constexpr int nROCcolumns
static constexpr int rowsperroc
key
prepare the HTCondor submission files and eventually submit them
const std::string trigstring_
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: DetId.h:17
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Pixel cluster – collection of neighboring pixels above threshold.
HLT enums.
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
def move(src, dest)
Definition: eostools.py:511