CMS 3D CMS Logo

AlcaPCCProducer.cc
Go to the documentation of this file.
1 
10 // C++ standard
11 #include <string>
12 // CMS
28 //The class
30  : public edm::one::EDProducer<edm::EndLuminosityBlockProducer, edm::LuminosityBlockCache<reco::PixelClusterCounts>> {
31 public:
32  explicit AlcaPCCProducer(const edm::ParameterSet&);
33 
34 private:
35  std::shared_ptr<reco::PixelClusterCounts> globalBeginLuminosityBlock(edm::LuminosityBlock const& lumiSeg,
36  edm::EventSetup const& iSetup) const final;
37  void endLuminosityBlockProduce(edm::LuminosityBlock& lumiSeg, const edm::EventSetup& iSetup) final;
39  void produce(edm::Event& iEvent, const edm::EventSetup& iSetup) final;
40 
43 };
44 
45 //--------------------------------------------------------------------------------------------------
47  : pixelToken_(consumes(iConfig.getParameter<edm::InputTag>("pixelClusterLabel"))),
48  //specifies the trigger Rand or ZeroBias
49  putToken_(produces<reco::PixelClusterCounts, edm::Transition::EndLuminosityBlock>(
50  iConfig.getUntrackedParameter<std::string>("trigstring", "alcaPCC"))) {}
51 
52 //--------------------------------------------------------------------------------------------------
54  unsigned int bx = iEvent.bunchCrossing();
55  //std::cout<<"The Bunch Crossing"<<bx<<std::endl;
56  auto* pccOb = luminosityBlockCache(iEvent.getLuminosityBlock().index());
57  pccOb->eventCounter(bx);
58 
59  //Looping over the clusters and adding the counts up
61  // ----------------------------------------------------------------------
62  // -- Clusters without tracks
63  for (auto const& mod : clustColl) {
64  if (mod.empty()) {
65  continue;
66  }
67  DetId detId = mod.id();
68 
69  //--The following will be used when we make a theshold for the clusters.
70  //--Keeping this for features that may be implemented later.
71  // -- clusters on this det
72  //edmNew::DetSet<SiPixelCluster>::const_iterator di;
73  //int nClusterCount=0;
74  //for (di = mod.begin(); di != mod.end(); ++di) {
75  // nClusterCount++;
76  //}
77  int nCluster = mod.size();
78  pccOb->increment(detId(), bx, nCluster);
79  }
80 }
81 
82 //--------------------------------------------------------------------------------------------------
83 std::shared_ptr<reco::PixelClusterCounts> AlcaPCCProducer::globalBeginLuminosityBlock(
84  edm::LuminosityBlock const& lumiSeg, edm::EventSetup const& iSetup) const {
85  //New PCC object at the beginning of each lumi section
86  return std::make_shared<reco::PixelClusterCounts>();
87 }
88 
89 //--------------------------------------------------------------------------------------------------
91  //Saving the PCC object
92  lumiSeg.emplace(putToken_, std::move(*luminosityBlockCache(lumiSeg.index())));
93 }
94 
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) final
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > pixelToken_
void endLuminosityBlockProduce(edm::LuminosityBlock &lumiSeg, const edm::EventSetup &iSetup) final
int iEvent
Definition: GenABIO.cc:224
void globalEndLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) final
Transition
Definition: Transition.h:12
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
AlcaPCCProducer(const edm::ParameterSet &)
Definition: DetId.h:17
std::shared_ptr< reco::PixelClusterCounts > globalBeginLuminosityBlock(edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &iSetup) const final
void emplace(EDPutTokenT< PROD > token, Args &&... args)
puts a new product
edm::EDPutTokenT< reco::PixelClusterCounts > putToken_
LuminosityBlockIndex index() const
fixed size matrix
HLT enums.
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
def move(src, dest)
Definition: eostools.py:511