CMS 3D CMS Logo

AlcaPCCProducer.cc
Go to the documentation of this file.
1 
10 // C++ standard
11 #include <string>
12 // CMS
30 #include "TMath.h"
31 //The class
32 class AlcaPCCProducer : public edm::one::EDProducer<edm::EndLuminosityBlockProducer, edm::one::WatchLuminosityBlocks> {
33 public:
34  explicit AlcaPCCProducer(const edm::ParameterSet&);
35  ~AlcaPCCProducer() override;
36 
37 private:
38  void beginLuminosityBlock(edm::LuminosityBlock const& lumiSeg, const edm::EventSetup& iSetup) override;
39  void endLuminosityBlock(edm::LuminosityBlock const& lumiSeg, const edm::EventSetup& iSetup) override;
40  void endLuminosityBlockProduce(edm::LuminosityBlock& lumiSeg, const edm::EventSetup& iSetup) override;
41  void produce(edm::Event& iEvent, const edm::EventSetup& iSetup) override;
42 
45 
46  std::string trigstring_; //specifies the trigger Rand or ZeroBias
47  int countEvt_; //counter
48  int countLumi_; //counter
49 
50  std::unique_ptr<reco::PixelClusterCounts> thePCCob;
51 };
52 
53 //--------------------------------------------------------------------------------------------------
55  fPixelClusterLabel = iConfig.getParameter<edm::InputTag>("pixelClusterLabel");
56  trigstring_ = iConfig.getUntrackedParameter<std::string>("trigstring", "alcaPCC");
57 
58  countLumi_ = 0;
59 
60  produces<reco::PixelClusterCounts, edm::Transition::EndLuminosityBlock>(trigstring_);
61  pixelToken = consumes<edmNew::DetSetVector<SiPixelCluster> >(fPixelClusterLabel);
62 }
63 
64 //--------------------------------------------------------------------------------------------------
66 
67 //--------------------------------------------------------------------------------------------------
69  countEvt_++;
70 
71  unsigned int bx = iEvent.bunchCrossing();
72  //std::cout<<"The Bunch Crossing"<<bx<<std::endl;
73  thePCCob->eventCounter(bx);
74 
75  //Looping over the clusters and adding the counts up
77  iEvent.getByToken(pixelToken, hClusterColl);
78 
79  const edmNew::DetSetVector<SiPixelCluster>& clustColl = *(hClusterColl.product());
80  // ----------------------------------------------------------------------
81  // -- Clusters without tracks
82  for (auto const& mod : clustColl) {
83  if (mod.empty()) {
84  continue;
85  }
86  DetId detId = mod.id();
87 
88  //--The following will be used when we make a theshold for the clusters.
89  //--Keeping this for features that may be implemented later.
90  // -- clusters on this det
91  //edmNew::DetSet<SiPixelCluster>::const_iterator di;
92  //int nClusterCount=0;
93  //for (di = mod.begin(); di != mod.end(); ++di) {
94  // nClusterCount++;
95  //}
96  int nCluster = mod.size();
97  thePCCob->increment(detId(), bx, nCluster);
98  }
99 }
100 
101 //--------------------------------------------------------------------------------------------------
103  //New PCC object at the beginning of each lumi section
104  thePCCob = std::make_unique<reco::PixelClusterCounts>();
105  countLumi_++;
106 }
107 
108 //--------------------------------------------------------------------------------------------------
110 
111 //--------------------------------------------------------------------------------------------------
113  //Saving the PCC object
115 }
116 
ConfigurationDescriptions.h
EDProducer.h
MessageLogger.h
edm::Handle::product
T const * product() const
Definition: Handle.h:70
ESHandle.h
edm::LuminosityBlock
Definition: LuminosityBlock.h:50
AlcaPCCProducer::countLumi_
int countLumi_
Definition: AlcaPCCProducer.cc:48
edm::EDGetTokenT
Definition: EDGetToken.h:33
LuminosityBlock.h
mod
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
SiPixelCluster.h
l1GtPatternGenerator_cfi.bx
bx
Definition: l1GtPatternGenerator_cfi.py:18
AlcaPCCProducer::thePCCob
std::unique_ptr< reco::PixelClusterCounts > thePCCob
Definition: AlcaPCCProducer.cc:50
edm::one::EDProducer
Definition: EDProducer.h:30
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
AlcaPCCProducer::endLuminosityBlock
void endLuminosityBlock(edm::LuminosityBlock const &lumiSeg, const edm::EventSetup &iSetup) override
Definition: AlcaPCCProducer.cc:109
edm::Handle
Definition: AssociativeIterator.h:50
AlcaPCCProducer::~AlcaPCCProducer
~AlcaPCCProducer() override
Definition: AlcaPCCProducer.cc:65
PixelClusterCounts.h
DetId
Definition: DetId.h:17
MakerMacros.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
AlcaPCCProducer::fPixelClusterLabel
edm::InputTag fPixelClusterLabel
Definition: AlcaPCCProducer.cc:44
Service.h
ParameterSetDescription.h
EDGetToken.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition: ParameterSet.h:36
Event.h
AlcaPCCProducer::endLuminosityBlockProduce
void endLuminosityBlockProduce(edm::LuminosityBlock &lumiSeg, const edm::EventSetup &iSetup) override
Definition: AlcaPCCProducer.cc:112
AlcaPCCProducer::beginLuminosityBlock
void beginLuminosityBlock(edm::LuminosityBlock const &lumiSeg, const edm::EventSetup &iSetup) override
Definition: AlcaPCCProducer.cc:102
AlcaPCCProducer::pixelToken
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > pixelToken
Definition: AlcaPCCProducer.cc:43
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::EventSetup
Definition: EventSetup.h:57
edm::LuminosityBlock::put
void put(std::unique_ptr< PROD > product)
Put a new product.
Definition: LuminosityBlock.h:115
AlcaPCCProducer::countEvt_
int countEvt_
Definition: AlcaPCCProducer.cc:47
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
edmNew::DetSetVector
Definition: DetSetNew.h:13
eostools.move
def move(src, dest)
Definition: eostools.py:511
AlcaPCCProducer
Definition: AlcaPCCProducer.cc:32
DetId.h
Frameworkfwd.h
EventSetup.h
ConsumesCollector.h
ParameterSet.h
edm::Event
Definition: Event.h:73
AlcaPCCProducer::produce
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
Definition: AlcaPCCProducer.cc:68
AlcaPCCProducer::trigstring_
std::string trigstring_
Definition: AlcaPCCProducer.cc:46
edm::InputTag
Definition: InputTag.h:15
AlcaPCCProducer::AlcaPCCProducer
AlcaPCCProducer(const edm::ParameterSet &)
Definition: AlcaPCCProducer.cc:54