CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
ClusterSummaryProducer Class Reference

#include <msegala/ClusterSummaryProducer/src/ClusterSummaryProducer.cc>

Inheritance diagram for ClusterSummaryProducer:
edm::stream::EDProducer<>

Public Member Functions

 ClusterSummaryProducer (const edm::ParameterSet &)
 
 ~ClusterSummaryProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Private Types

typedef std::pair< DetIdSelector, ClusterSummary::CMSTrackerModuleSelection
 
typedef std::vector< ModuleSelectionModuleSelections
 

Private Member Functions

void beginStream (edm::StreamID) override
 
void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

ClusterSummary cCluster
 
bool doPixels
 
bool doStrips
 
std::map< std::string, int > EnumMap
 
std::vector< std::string > moduleNames
 
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > pixelClusters_
 
ModuleSelections selectors
 
edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > stripClusters_
 
bool verbose
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 63 of file ClusterSummaryProducer.h.

Member Typedef Documentation

◆ ModuleSelection

Definition at line 72 of file ClusterSummaryProducer.h.

◆ ModuleSelections

Definition at line 73 of file ClusterSummaryProducer.h.

Constructor & Destructor Documentation

◆ ClusterSummaryProducer()

ClusterSummaryProducer::ClusterSummaryProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 3 of file ClusterSummaryProducer.cc.

References cCluster, Exception, edm::ParameterSet::getParameter(), moduleNames, ClusterSummary::NTRACKERENUMS, ClusterSummary::NVALIDENUMS, pixelClusters_, corrVsCorr::selection, AlCaHLTBitMon_QueryRunRegistry::string, ClusterSummary::STRIP, stripClusters_, ClusterSummary::subDetNames, ClusterSummary::subDetSelections, and verbose.

4  : doStrips(iConfig.getParameter<bool>("doStrips")),
5  doPixels(iConfig.getParameter<bool>("doPixels")),
6  verbose(iConfig.getParameter<bool>("verbose")) {
8  consumes<edmNew::DetSetVector<SiPixelCluster> >(iConfig.getParameter<edm::InputTag>("pixelClusters"));
10  consumes<edmNew::DetSetVector<SiStripCluster> >(iConfig.getParameter<edm::InputTag>("stripClusters"));
11 
13 
14  std::vector<std::string> wantedsubdets = iConfig.getParameter<std::vector<std::string> >("wantedSubDets");
15  for (const auto& iS : wantedsubdets) {
17  for (int iN = 0; iN < ClusterSummary::NVALIDENUMS; ++iN)
18  if (ClusterSummary::subDetNames[iN] == iS)
19  subdet = ClusterSummary::CMSTracker(iN);
20  if (subdet == ClusterSummary::NVALIDENUMS)
21  throw cms::Exception("No standard selection: ") << iS;
22 
24  if (subdet > maxEnum)
25  maxEnum = subdet;
26  if (verbose)
27  moduleNames.push_back(ClusterSummary::subDetNames[subdet]);
28  }
29 
30  std::vector<edm::ParameterSet> wantedusersubdets_ps =
31  iConfig.getParameter<std::vector<edm::ParameterSet> >("wantedUserSubDets");
32  for (const auto& iS : wantedusersubdets_ps) {
33  ClusterSummary::CMSTracker subdet = (ClusterSummary::CMSTracker)iS.getParameter<unsigned int>("detSelection");
34  std::string detname = iS.getParameter<std::string>("detLabel");
35  std::vector<std::string> selection = iS.getParameter<std::vector<std::string> >("selection");
36 
37  if (subdet <= ClusterSummary::NVALIDENUMS)
38  throw cms::Exception("Already predefined selection: ") << subdet;
39  if (subdet >= ClusterSummary::NTRACKERENUMS)
40  throw cms::Exception("Selection is out of range: ") << subdet;
41 
42  selectors.push_back(ModuleSelection(DetIdSelector(selection), subdet));
43  if (subdet > maxEnum)
44  maxEnum = subdet;
45  if (verbose)
46  moduleNames.push_back(detname);
47  }
48 
49  cCluster = ClusterSummary(maxEnum + 1);
50  produces<ClusterSummary>().setBranchAlias("trackerClusterSummary");
51 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
std::vector< std::string > moduleNames
edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > stripClusters_
static const std::vector< std::string > subDetNames
selection
main part
Definition: corrVsCorr.py:100
static const std::vector< std::vector< std::string > > subDetSelections
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > pixelClusters_
std::pair< DetIdSelector, ClusterSummary::CMSTracker > ModuleSelection

◆ ~ClusterSummaryProducer()

ClusterSummaryProducer::~ClusterSummaryProducer ( )
inlineoverride

Definition at line 66 of file ClusterSummaryProducer.h.

66 {};

Member Function Documentation

◆ beginStream()

void ClusterSummaryProducer::beginStream ( edm::StreamID  )
overrideprivate

Definition at line 135 of file ClusterSummaryProducer.cc.

References moduleNames, and verbose.

135  {
136  if (!verbose)
137  return;
138  edm::LogInfo("ClusterSummaryProducer") << "+++++++++++++++++++++++++++++++ " << std::endl << "Getting info on ";
139  for (const auto& iS : moduleNames) {
140  edm::LogInfo("ClusterSummaryProducer") << iS << " ";
141  }
142  edm::LogInfo("ClusterSummaryProducer") << std::endl;
143 }
std::vector< std::string > moduleNames
Log< level::Info, false > LogInfo

◆ produce()

void ClusterSummaryProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 53 of file ClusterSummaryProducer.cc.

References ClusterSummary::addClusChargeByIndex(), ClusterSummary::addClusSizeByIndex(), ClusterSummary::addNClusByIndex(), edmNew::DetSetVector< T >::begin(), cCluster, ClusterVariables::charge(), ClusterVariables::clusterSize(), nano_mu_local_reco_cff::clusterSize, doPixels, doStrips, edmNew::DetSetVector< T >::end(), dqmdumpme::first, nano_mu_digi_cff::float, ClusterSummary::getClusChargeByIndex(), ClusterSummary::getClusSizeByIndex(), ClusterSummary::getNClusByIndex(), edmNew::DetSetVector< T >::id(), iEvent, callgraph::module, moduleNames, eostools::move(), DQMOffline_LumiMonitoring_cff::pixelClusters, pixelClusters_, ClusterSummary::reset(), mps_fire::result, HLT_2024v12_cff::stripClusters, stripClusters_, and verbose.

53  {
54  using namespace edm;
55  cCluster.reset();
56  std::vector<bool> selectedVector(selectors.size(), false);
57 
58  auto getSelections = [&](const uint32_t detid) {
59  for (unsigned int iS = 0; iS < selectors.size(); ++iS)
60  selectedVector[iS] = selectors[iS].first.isSelected(detid);
61  };
62  auto fillSelections = [&](const int clusterSize, const float clusterCharge) {
63  for (unsigned int iS = 0; iS < selectors.size(); ++iS) {
64  if (!selectedVector[iS])
65  continue;
66  const ClusterSummary::CMSTracker module = selectors[iS].second;
69  cCluster.addClusChargeByIndex(module, clusterCharge);
70  }
71  };
72 
73  //===================++++++++++++========================
74  // For SiStrips
75  //===================++++++++++++========================
76  if (doStrips) {
78  iEvent.getByToken(stripClusters_, stripClusters);
80  for (; itClusters != stripClusters->end(); ++itClusters) {
81  getSelections(itClusters->id());
82  for (edmNew::DetSet<SiStripCluster>::const_iterator cluster = itClusters->begin(); cluster != itClusters->end();
83  ++cluster) {
84  const ClusterVariables Summaryinfo(*cluster);
85  fillSelections(Summaryinfo.clusterSize(), Summaryinfo.charge());
86  }
87  }
88  }
89 
90  //===================++++++++++++========================
91  // For SiPixels
92  //===================++++++++++++========================
93  if (doPixels) {
95  iEvent.getByToken(pixelClusters_, pixelClusters);
97  for (; itClusters != pixelClusters->end(); ++itClusters) {
98  getSelections(itClusters->id());
99  for (edmNew::DetSet<SiPixelCluster>::const_iterator cluster = itClusters->begin(); cluster != itClusters->end();
100  ++cluster) {
101  fillSelections(cluster->size(), float(cluster->charge()) / 1000.);
102  }
103  }
104  }
105 
106  //===================+++++++++++++========================
107  // Fill Producer
108  //===================+++++++++++++========================
109  if (verbose) {
110  for (const auto& iS : selectors) {
111  const ClusterSummary::CMSTracker module = iS.second;
112  if (cCluster.getNClusByIndex(module) != 0) {
113  edm::LogInfo("ClusterSummaryProducer")
114  << "n" << moduleNames[module] << ", avg size, avg charge = " << cCluster.getNClusByIndex(module) << ", "
117  } else {
118  edm::LogInfo("ClusterSummaryProducer")
119  << "n" << moduleNames[module] << ", avg size, avg charge = " << cCluster.getNClusByIndex(module) << ", "
120  << "0"
121  << ", "
122  << "0" << std::endl;
123  }
124  edm::LogInfo("ClusterSummaryProducer") << "-------------------------------------------------------" << std::endl;
125  }
126  }
127 
128  //Put the filled class into the producer
129  auto result = std::make_unique<ClusterSummary>();
130  //Cleanup empty selections
131  result->copyNonEmpty(cCluster);
132  iEvent.put(std::move(result));
133 }
float getClusChargeByIndex(const int mod) const
std::vector< std::string > moduleNames
edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > stripClusters_
void addClusChargeByIndex(const int mod, const float val)
void addClusSizeByIndex(const int mod, const int val)
data_type const * const_iterator
Definition: DetSetNew.h:31
const_iterator end(bool update=false) const
int iEvent
Definition: GenABIO.cc:224
int getNClusByIndex(const int mod) const
id_type id(size_t cell) const
Log< level::Info, false > LogInfo
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
const_iterator begin(bool update=false) const
HLT enums.
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > pixelClusters_
int getClusSizeByIndex(const int mod) const
void addNClusByIndex(const int mod, const int val)
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ cCluster

ClusterSummary ClusterSummaryProducer::cCluster
private

Definition at line 83 of file ClusterSummaryProducer.h.

Referenced by ClusterSummaryProducer(), and produce().

◆ doPixels

bool ClusterSummaryProducer::doPixels
private

Definition at line 87 of file ClusterSummaryProducer.h.

Referenced by produce().

◆ doStrips

bool ClusterSummaryProducer::doStrips
private

Definition at line 86 of file ClusterSummaryProducer.h.

Referenced by produce().

◆ EnumMap

std::map<std::string, int> ClusterSummaryProducer::EnumMap
private

Definition at line 84 of file ClusterSummaryProducer.h.

◆ moduleNames

std::vector<std::string> ClusterSummaryProducer::moduleNames
private

Definition at line 81 of file ClusterSummaryProducer.h.

Referenced by beginStream(), ClusterSummaryProducer(), and produce().

◆ pixelClusters_

edm::EDGetTokenT<edmNew::DetSetVector<SiPixelCluster> > ClusterSummaryProducer::pixelClusters_
private

Definition at line 77 of file ClusterSummaryProducer.h.

Referenced by ClusterSummaryProducer(), and produce().

◆ selectors

ModuleSelections ClusterSummaryProducer::selectors
private

Definition at line 80 of file ClusterSummaryProducer.h.

◆ stripClusters_

edm::EDGetTokenT<edmNew::DetSetVector<SiStripCluster> > ClusterSummaryProducer::stripClusters_
private

Definition at line 78 of file ClusterSummaryProducer.h.

Referenced by ClusterSummaryProducer(), and produce().

◆ verbose

bool ClusterSummaryProducer::verbose
private

Definition at line 88 of file ClusterSummaryProducer.h.

Referenced by beginStream(), ClusterSummaryProducer(), and produce().