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
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

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<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache 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.

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 }

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.

◆ ~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 127 of file ClusterSummaryProducer.cc.

127  {
128  if (!verbose)
129  return;
130  edm::LogInfo("ClusterSummaryProducer") << "+++++++++++++++++++++++++++++++ " << std::endl << "Getting info on ";
131  for (const auto& iS : moduleNames) {
132  edm::LogInfo("ClusterSummaryProducer") << iS << " ";
133  }
134  edm::LogInfo("ClusterSummaryProducer") << std::endl;
135 }

References moduleNames, and verbose.

◆ produce()

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

Definition at line 53 of file ClusterSummaryProducer.cc.

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;
67  cCluster.addNClusByIndex(module, 1);
68  cCluster.addClusSizeByIndex(module, clusterSize);
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  edm::LogInfo("ClusterSummaryProducer")
113  << "n" << moduleNames[module] << ", avg size, avg charge = " << cCluster.getNClusByIndex(module) << ", "
114  << cCluster.getClusSizeByIndex(module) / cCluster.getNClusByIndex(module) << ", "
115  << cCluster.getClusChargeByIndex(module) / cCluster.getNClusByIndex(module) << std::endl;
116  }
117  std::cout << "-------------------------------------------------------" << std::endl;
118  }
119 
120  //Put the filled class into the producer
121  auto result = std::make_unique<ClusterSummary>();
122  //Cleanup empty selections
123  result->copyNonEmpty(cCluster);
124  iEvent.put(std::move(result));
125 }

References ClusterSummary::addClusChargeByIndex(), ClusterSummary::addClusSizeByIndex(), ClusterSummary::addNClusByIndex(), edmNew::DetSetVector< T >::begin(), cCluster, ClusterVariables::charge(), ClusterVariables::clusterSize(), gather_cfg::cout, doPixels, doStrips, edmNew::DetSetVector< T >::end(), first, dqmMemoryStats::float, ClusterSummary::getClusChargeByIndex(), ClusterSummary::getClusSizeByIndex(), ClusterSummary::getNClusByIndex(), edmNew::DetSetVector< T >::id(), iEvent, moduleNames, eostools::move(), LumiMonitor_cff::pixelClusters, pixelClusters_, ClusterSummary::reset(), mps_fire::result, HLT_FULL_cff::stripClusters, stripClusters_, and verbose.

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().

ClusterSummaryProducer::cCluster
ClusterSummary cCluster
Definition: ClusterSummaryProducer.h:83
dqmMemoryStats.float
float
Definition: dqmMemoryStats.py:127
LumiMonitor_cff.pixelClusters
pixelClusters
Definition: LumiMonitor_cff.py:10
edmNew::DetSetVector::id
id_type id(size_t cell) const
Definition: DetSetVectorNew.h:564
ClusterSummary::NVALIDENUMS
Definition: ClusterSummary.h:92
edm
HLT enums.
Definition: AlignableModifier.h:19
gather_cfg.cout
cout
Definition: gather_cfg.py:144
edmNew::DetSetVector::const_iterator
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
Definition: DetSetVectorNew.h:197
ClusterSummary::getClusSizeByIndex
int getClusSizeByIndex(const int mod) const
Definition: ClusterSummary.h:113
edmNew::DetSetVector::begin
const_iterator begin(bool update=false) const
Definition: DetSetVectorNew.h:530
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
ClusterSummary::STRIP
Definition: ClusterSummary.h:84
edm::Handle
Definition: AssociativeIterator.h:50
ClusterSummaryProducer::pixelClusters_
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > pixelClusters_
Definition: ClusterSummaryProducer.h:77
ClusterSummary::addClusChargeByIndex
void addClusChargeByIndex(const int mod, const float val)
Definition: ClusterSummary.h:135
corrVsCorr.selection
selection
main part
Definition: corrVsCorr.py:100
ClusterSummary::subDetNames
static const std::vector< std::string > subDetNames
Definition: ClusterSummary.h:95
first
auto first
Definition: CAHitNtupletGeneratorKernelsImpl.h:112
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HLT_FULL_cff.stripClusters
stripClusters
Definition: HLT_FULL_cff.py:10014
ClusterSummary::addNClusByIndex
void addNClusByIndex(const int mod, const int val)
Definition: ClusterSummary.h:133
ClusterSummary::reset
void reset()
Definition: ClusterSummary.cc:83
ClusterSummaryProducer::ModuleSelection
std::pair< DetIdSelector, ClusterSummary::CMSTracker > ModuleSelection
Definition: ClusterSummaryProducer.h:72
ClusterSummary::addClusSizeByIndex
void addClusSizeByIndex(const int mod, const int val)
Definition: ClusterSummary.h:134
selectors
Definition: selectors.py:1
iEvent
int iEvent
Definition: GenABIO.cc:224
ClusterSummaryProducer::moduleNames
std::vector< std::string > moduleNames
Definition: ClusterSummaryProducer.h:81
ClusterSummaryProducer::stripClusters_
edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > stripClusters_
Definition: ClusterSummaryProducer.h:78
ClusterSummary::getClusChargeByIndex
float getClusChargeByIndex(const int mod) const
Definition: ClusterSummary.h:114
ClusterVariables
Definition: ClusterVariables.h:13
ClusterSummary::NTRACKERENUMS
Definition: ClusterSummary.h:93
ClusterSummary::CMSTracker
CMSTracker
Definition: ClusterSummary.h:83
ClusterSummary::getNClusByIndex
int getNClusByIndex(const int mod) const
Definition: ClusterSummary.h:112
eostools.move
def move(src, dest)
Definition: eostools.py:511
ClusterSummary
Definition: ClusterSummary.h:59
ClusterSummaryProducer::doStrips
bool doStrips
Definition: ClusterSummaryProducer.h:86
ClusterSummaryProducer::verbose
bool verbose
Definition: ClusterSummaryProducer.h:88
edmNew::DetSetVector::end
const_iterator end(bool update=false) const
Definition: DetSetVectorNew.h:535
Exception
Definition: hltDiff.cc:245
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
mps_fire.result
result
Definition: mps_fire.py:311
ClusterSummaryProducer::doPixels
bool doPixels
Definition: ClusterSummaryProducer.h:87
edm::InputTag
Definition: InputTag.h:15
DetIdSelector
Definition: DetIdSelector.h:12
ClusterSummary::subDetSelections
static const std::vector< std::vector< std::string > > subDetSelections
Definition: ClusterSummary.h:96
edmNew::DetSet::const_iterator
const data_type * const_iterator
Definition: DetSetNew.h:31