Skip to content

Commit

Permalink
Merge pull request #14760 from schneiml/phase1pixeldqm-bugfixes
Browse files Browse the repository at this point in the history
Phase1 Pixel DQM Bugfixes
  • Loading branch information
cmsbuild committed Jun 11, 2016
2 parents 45b40a8 + 5b03e23 commit b132d1c
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 27 deletions.
2 changes: 2 additions & 0 deletions DQM/SiPixelPhase1Common/README.md
Expand Up @@ -9,6 +9,8 @@ This document decomposes into three sections:
2. *How to actually use it* -- practical examples with explanation.
3. *How it really works* -- explanations on the implementation.

Further information can be found on the TWiki page: https://twiki.cern.ch/twiki/bin/viewauth/CMS/PixelDQMPhaseI . Note that parts migh be historical and not reflect the current state.

The Concept
-----------

Expand Down
5 changes: 4 additions & 1 deletion DQM/SiPixelPhase1Common/python/SpecificationBuilder_cfi.py
Expand Up @@ -146,4 +146,7 @@ def saveAll(self):
self.groupBy("/".join(cols), self._lastMode)
self.save()
return self


# this is used for serialization, and for that this is just a PSet.
def pythonTypeName(self):
return 'cms.PSet';
33 changes: 18 additions & 15 deletions DQM/SiPixelPhase1Common/src/GeometryInterface.cc
Expand Up @@ -175,7 +175,7 @@ void GeometryInterface::loadFromTopology(edm::EventSetup const& iSetup, const ed
std::vector<ID> geomquantities;

struct TTField {
edm::ESHandle<TrackerTopology> tt;
const TrackerTopology* tt;
TrackerTopology::DetIdFields field;
Value operator()(InterestingQuantities const& iq) {
if (tt->hasField(iq.sourceModule, field))
Expand All @@ -185,17 +185,20 @@ void GeometryInterface::loadFromTopology(edm::EventSetup const& iSetup, const ed
};
};

std::vector<std::pair<std::string, TTField>> namedPartitions {
{"PXEndcap" , {trackerTopologyHandle, TrackerTopology::PFSide}},
const TrackerTopology* tt = trackerTopologyHandle.operator->();

{"PXLayer" , {trackerTopologyHandle, TrackerTopology::PBLayer}},
{"PXLadder" , {trackerTopologyHandle, TrackerTopology::PBLadder}},
{"PXBModule", {trackerTopologyHandle, TrackerTopology::PBModule}},

{"PXBlade" , {trackerTopologyHandle, TrackerTopology::PFBlade}},
{"PXDisk" , {trackerTopologyHandle, TrackerTopology::PFDisk}},
{"PXPanel" , {trackerTopologyHandle, TrackerTopology::PFPanel}},
{"PXFModule", {trackerTopologyHandle, TrackerTopology::PFModule}},
std::vector<std::pair<std::string, TTField>> namedPartitions {
{"PXEndcap" , {tt, TrackerTopology::PFSide}},

{"PXLayer" , {tt, TrackerTopology::PBLayer}},
{"PXLadder" , {tt, TrackerTopology::PBLadder}},
{"PXBModule", {tt, TrackerTopology::PBModule}},

{"PXBlade" , {tt, TrackerTopology::PFBlade}},
{"PXDisk" , {tt, TrackerTopology::PFDisk}},
{"PXPanel" , {tt, TrackerTopology::PFPanel}},
{"PXFModule", {tt, TrackerTopology::PFModule}},
};

for (auto& e : namedPartitions) {
Expand All @@ -209,7 +212,7 @@ void GeometryInterface::loadFromTopology(edm::EventSetup const& iSetup, const ed
addExtractor(intern("PXForward"), pxforward, 0, 0);

// Redefine the disk numbering to use the sign
auto& pxendcap = extractors[intern("PXEndcap")];
auto pxendcap = extractors[intern("PXEndcap")];
auto diskid = intern("PXDisk");
auto pxdisk = extractors[diskid];
extractors[diskid] = [pxdisk, pxendcap] (InterestingQuantities const& iq) {
Expand All @@ -225,8 +228,8 @@ void GeometryInterface::loadFromTopology(edm::EventSetup const& iSetup, const ed
assert(trackerGeometryHandle.isValid());

// We need to track some extra stuff here for the Shells later.
auto& pxlayer = extractors[intern("PXLayer")];
auto& pxladder = extractors[intern("PXLadder")];
auto pxlayer = extractors[intern("PXLayer")];
auto pxladder = extractors[intern("PXLadder")];
std::vector<Value> maxladders;

// Now travrse the detector and collect whatever we need.
Expand Down Expand Up @@ -257,7 +260,7 @@ void GeometryInterface::loadFromTopology(edm::EventSetup const& iSetup, const ed
// of the code, but it might work for Phase0 as well.
Value innerring = iConfig.getParameter<int>("n_inner_ring_blades");
Value outerring = max_value[intern("PXBlade")] - innerring;
auto& pxblade = extractors[intern("PXBlade")];
auto pxblade = extractors[intern("PXBlade")];
addExtractor(intern("PXRing"),
[pxblade, innerring] (InterestingQuantities const& iq) {
auto blade = pxblade(iq);
Expand All @@ -267,7 +270,7 @@ void GeometryInterface::loadFromTopology(edm::EventSetup const& iSetup, const ed
}, 1, 2
);

auto& pxmodule = extractors[intern("PXBModule")];
auto pxmodule = extractors[intern("PXBModule")];
Value maxmodule = max_value[intern("PXBModule")];
addExtractor(intern("HalfCylinder"),
[pxendcap, pxblade, innerring, outerring] (InterestingQuantities const& iq) {
Expand Down
5 changes: 3 additions & 2 deletions DQM/SiPixelPhase1Common/src/HistogramManager.cc
Expand Up @@ -224,10 +224,10 @@ std::string HistogramManager::makePath(

void HistogramManager::book(DQMStore::IBooker& iBooker,
edm::EventSetup const& iSetup) {
if (!enabled) return;
if (!geometryInterface.loaded()) {
geometryInterface.load(iSetup);
}
if (!enabled) return;

for (unsigned int i = 0; i < specs.size(); i++) {
auto& s = specs[i];
Expand Down Expand Up @@ -494,7 +494,8 @@ void HistogramManager::executeReduce(SummationStep& step, Table& t) {
edm::LogError("HistogramManager") << "+++ Reduction '" << step.arg
<< " not yet implemented\n";
}
new_histo.th1 = new TH1D(name.c_str(), (";;" + label).c_str(), 1, 0, 1);
new_histo.th1 = new TH1F(name.c_str(), (std::string("") + th1->GetTitle()
+ ";;" + label).c_str(), 1, 0, 1);
new_histo.th1->SetBinContent(1, reduced_quantity);
}
t.swap(out);
Expand Down
9 changes: 2 additions & 7 deletions DQM/SiPixelPhase1Digis/python/SiPixelPhase1Digis_cfi.py
Expand Up @@ -4,7 +4,6 @@
from DQM.SiPixelPhase1Common.HistogramManager_cfi import *

SiPixelPhase1DigisADC = DefaultHisto.clone(
enabled = True, # ADC
name = "adc",
title = "Digi ADC values",
xlabel = "adc readout",
Expand All @@ -24,7 +23,6 @@
)

SiPixelPhase1DigisNdigis = DefaultHisto.clone(
enabled = True, # Ndigis
name = "digis", # 'Count of' added automatically
title = "Digis",
xlabel = "digis",
Expand All @@ -51,7 +49,6 @@
)

SiPixelPhase1DigisNdigisPerFED = DefaultHisto.clone(
enabled = True, # Ndigis per FED
name = "digis", # This is the same as above up to the ranges. maybe we
title = "Digis", # should allow setting the range per spec, but OTOH a
xlabel = "digis",# HistogramManager is almost free.
Expand All @@ -73,7 +70,6 @@
)

SiPixelPhase1DigisEvents = DefaultHisto.clone(
enabled = True, # Event Rate
name = "eventrate",
title = "Rate of Pixel Events",
xlabel = "Lumisection",
Expand All @@ -88,7 +84,6 @@
)

SiPixelPhase1DigisHitmap = DefaultHisto.clone(
enabled = True, # hitmaps
name = "hitmap",
title = "Position of digis on module",
ylabel = "#digis",
Expand Down Expand Up @@ -128,7 +123,6 @@
)

SiPixelPhase1DigisDebug = DefaultHisto.clone(
enabled = True, # Geometry Debug
name = "debug",
xlabel = "ladder #",
range_min = 1,
Expand All @@ -141,7 +135,8 @@
.groupBy(parent(DefaultHisto.defaultGrouping), "EXTEND_X")
.saveAll(),
Specification().groupBy(parent(DefaultHisto.defaultGrouping)) # per-layer
.save()
.save(),
Specification(PerModule).groupBy(DefaultHisto.defaultPerModule).save(),
)
)

Expand Down
5 changes: 3 additions & 2 deletions DQM/SiPixelPhase1RecHits/python/SiPixelPhase1RecHits_cfi.py
Expand Up @@ -66,8 +66,8 @@
)
)

SiPixelPhase1RecHitsErrorY = DefaultHisto.clone(
name = "rechiterror_x",
SiPixelPhase1RecHitsErrorY = SiPixelPhase1RecHitsErrorX.clone(
name = "rechiterror_y",
title = "RecHit Error in Y-direction",
xlabel = "Y error"
)
Expand All @@ -79,6 +79,7 @@
range_y_min = -4, range_y_max = 4, range_y_nbins = 100,
xlabel = "x offset",
ylabel = "y offset",
dimensions = 2,
specs = cms.VPSet(
Specification().groupBy(DefaultHisto.defaultGrouping).save(),
Specification(PerModule).groupBy(DefaultHisto.defaultPerModule).save(),
Expand Down

0 comments on commit b132d1c

Please sign in to comment.