41 #include "TPaveStats.h" 49 SiStripApvGainContainer(
const std::shared_ptr<SiStripApvGain>&
payload,
53 payloadType_ =
"SiStripApvGain";
57 void storeAllValues()
override {
58 std::vector<uint32_t> detid;
59 payload_->getDetIds(detid);
61 for (
const auto&
d : detid) {
63 for (
int it = 0; it <
range.second -
range.first; it++) {
65 SiStripCondData_.fillByPushBack(
d, payload_->getApvGain(it,
range));
74 class SiStripApvGainTest :
public Histogram1D<SiStripApvGain, SINGLE_IOV> {
79 bool fill()
override {
80 auto tag = PlotBase::getTag<0>();
82 for (
auto const& iov :
tag.iovs) {
83 std::shared_ptr<SiStripApvGain>
payload = Base::fetchPayload(std::get<1>(iov));
85 SiStripApvGainContainer* objContainer =
new SiStripApvGainContainer(
payload, iov,
tagname);
86 objContainer->printAll();
94 class SiStripApvGainByPartition :
public PlotImage<SiStripApvGain, SINGLE_IOV> {
98 bool fill()
override {
99 auto tag = PlotBase::getTag<0>();
100 auto iov =
tag.iovs.front();
102 std::shared_ptr<SiStripApvGain>
payload = fetchPayload(std::get<1>(iov));
104 SiStripApvGainContainer* objContainer =
new SiStripApvGainContainer(
payload, iov,
tagname);
107 TCanvas
canvas(
"Partition summary",
"partition summary", 1400, 1000);
108 objContainer->fillByPartition(
canvas, 100, 0., 2.);
117 class SiStripApvGainCompareByPartition :
public PlotImage<SiStripApvGain, MULTI_IOV, 2> {
119 SiStripApvGainCompareByPartition()
122 bool fill()
override {
124 auto theIOVs = PlotBase::getTag<0>().iovs;
125 auto tagname1 = PlotBase::getTag<0>().
name;
126 auto tag2iovs = PlotBase::getTag<1>().iovs;
127 auto tagname2 = PlotBase::getTag<1>().
name;
131 std::shared_ptr<SiStripApvGain> last_payload = fetchPayload(std::get<1>(lastiov));
132 std::shared_ptr<SiStripApvGain> first_payload = fetchPayload(std::get<1>(firstiov));
134 SiStripApvGainContainer* l_objContainer =
new SiStripApvGainContainer(last_payload, lastiov, tagname1);
135 SiStripApvGainContainer* f_objContainer =
new SiStripApvGainContainer(first_payload, firstiov, tagname2);
137 l_objContainer->compare(f_objContainer);
141 TCanvas
canvas(
"Partition summary",
"partition summary", 1400, 1000);
142 l_objContainer->fillByPartition(
canvas, 100, 0.5, 1.5);
151 class SiStripApvGainRatioByPartition :
public PlotImage<SiStripApvGain, MULTI_IOV, 2> {
155 bool fill()
override {
157 auto theIOVs = PlotBase::getTag<0>().iovs;
158 auto tagname1 = PlotBase::getTag<0>().
name;
159 auto tag2iovs = PlotBase::getTag<1>().iovs;
160 auto tagname2 = PlotBase::getTag<1>().
name;
164 std::shared_ptr<SiStripApvGain> last_payload = fetchPayload(std::get<1>(lastiov));
165 std::shared_ptr<SiStripApvGain> first_payload = fetchPayload(std::get<1>(firstiov));
167 SiStripApvGainContainer* l_objContainer =
new SiStripApvGainContainer(last_payload, lastiov, tagname1);
168 SiStripApvGainContainer* f_objContainer =
new SiStripApvGainContainer(first_payload, firstiov, tagname2);
170 l_objContainer->divide(f_objContainer);
174 TCanvas
canvas(
"Partition summary",
"partition summary", 1400, 1000);
175 l_objContainer->fillByPartition(
canvas, 200, 0.5, 1.5);
186 class SiStripApvGainDiffByPartition :
public PlotImage<SiStripApvGain, MULTI_IOV, 2> {
190 bool fill()
override {
192 auto theIOVs = PlotBase::getTag<0>().iovs;
193 auto tagname1 = PlotBase::getTag<0>().
name;
194 auto tag2iovs = PlotBase::getTag<1>().iovs;
195 auto tagname2 = PlotBase::getTag<1>().
name;
199 std::shared_ptr<SiStripApvGain> last_payload = fetchPayload(std::get<1>(lastiov));
200 std::shared_ptr<SiStripApvGain> first_payload = fetchPayload(std::get<1>(firstiov));
202 SiStripApvGainContainer* l_objContainer =
new SiStripApvGainContainer(last_payload, lastiov, tagname1);
203 SiStripApvGainContainer* f_objContainer =
new SiStripApvGainContainer(first_payload, firstiov, tagname2);
205 l_objContainer->subtract(f_objContainer);
209 TCanvas
canvas(
"Partition summary",
"partition summary", 1400, 1000);
210 l_objContainer->fillByPartition(
canvas, 100, -0.1, 0.1);
224 class SiStripApvGainsValue :
public Histogram1D<SiStripApvGain, SINGLE_IOV> {
226 SiStripApvGainsValue()
230 bool fill()
override {
231 auto tag = PlotBase::getTag<0>();
232 for (
auto const& iov :
tag.iovs) {
233 std::shared_ptr<SiStripApvGain>
payload = Base::fetchPayload(std::get<1>(iov));
235 std::vector<uint32_t> detid;
238 for (
const auto&
d : detid) {
240 for (
int it = 0; it <
range.second -
range.first; it++) {
258 class SiStripApvBarrelGainsByLayer :
public Histogram1D<SiStripApvGain, SINGLE_IOV> {
260 SiStripApvBarrelGainsByLayer()
262 "Barrel layer (0-3: TIB), (4-9: TOB)",
266 "average SiStripApv Gain") {}
268 bool fill()
override {
269 auto tag = PlotBase::getTag<0>();
270 for (
auto const& iov :
tag.iovs) {
271 std::shared_ptr<SiStripApvGain>
payload = Base::fetchPayload(std::get<1>(iov));
276 std::vector<uint32_t> detid;
279 std::map<int, std::pair<float, float>> sumOfGainsByLayer;
281 for (
const auto&
d : detid) {
295 for (
int it = 0; it <
range.second -
range.first; it++) {
297 sumOfGainsByLayer[
layer].second += 1.;
302 for (
auto&
data : sumOfGainsByLayer) {
303 fillWithBinAndValue(
data.first - 1, (
data.second.first /
data.second.second));
317 class SiStripApvAbsoluteBarrelGainsByLayer :
public Histogram2D<SiStripApvGain, SINGLE_IOV> {
319 SiStripApvAbsoluteBarrelGainsByLayer()
321 "Barrel layer (0-3: TIB), (4-9: TOB)",
329 bool fill()
override {
330 auto tag = PlotBase::getTag<0>();
331 for (
auto const& iov :
tag.iovs) {
332 std::shared_ptr<SiStripApvGain>
payload = Base::fetchPayload(std::get<1>(iov));
337 std::vector<uint32_t> detid;
339 for (
const auto&
d : detid) {
341 if (subid != 3 && subid != 5)
345 for (
int it = 0; it <
range.second -
range.first; it++) {
347 fillWithValue(static_cast<float>((subid == 5) ? tTopo.
tobLayer(
d) + 3 : tTopo.
tibLayer(
d) - 1),
363 class SiStripApvEndcapMinusGainsByDisk :
public Histogram1D<SiStripApvGain, SINGLE_IOV> {
365 SiStripApvEndcapMinusGainsByDisk()
367 "Endcap (minus) disk (0-2: TID), (3-11: TEC)",
371 "average SiStripApv Gain") {}
373 bool fill()
override {
374 auto tag = PlotBase::getTag<0>();
375 for (
auto const& iov :
tag.iovs) {
376 std::shared_ptr<SiStripApvGain>
payload = Base::fetchPayload(std::get<1>(iov));
381 std::vector<uint32_t> detid;
384 std::map<int, std::pair<float, float>> sumOfGainsByDisk;
386 for (
const auto&
d : detid) {
408 for (
int it = 0; it <
range.second -
range.first; it++) {
409 sumOfGainsByDisk[disk].first +=
payload->getApvGain(it,
range);
410 sumOfGainsByDisk[disk].second += 1.;
415 for (
auto&
data : sumOfGainsByDisk) {
416 fillWithBinAndValue(
data.first - 1, (
data.second.first /
data.second.second));
431 class SiStripApvEndcapPlusGainsByDisk :
public Histogram1D<SiStripApvGain, SINGLE_IOV> {
433 SiStripApvEndcapPlusGainsByDisk()
435 "Endcap (plus) disk (0-2: TID), (3-11: TEC)",
439 "average SiStripApv Gain") {}
441 bool fill()
override {
442 auto tag = PlotBase::getTag<0>();
443 for (
auto const& iov :
tag.iovs) {
444 std::shared_ptr<SiStripApvGain>
payload = Base::fetchPayload(std::get<1>(iov));
449 std::vector<uint32_t> detid;
452 std::map<int, std::pair<float, float>> sumOfGainsByDisk;
454 for (
const auto&
d : detid) {
477 for (
int it = 0; it <
range.second -
range.first; it++) {
478 sumOfGainsByDisk[disk].first +=
payload->getApvGain(it,
range);
479 sumOfGainsByDisk[disk].second += 1.;
484 for (
auto&
data : sumOfGainsByDisk) {
485 fillWithBinAndValue(
data.first - 1, (
data.second.first /
data.second.second));
498 class SiStripApvAbsoluteEndcapMinusGainsByDisk :
public Histogram2D<SiStripApvGain, SINGLE_IOV> {
500 SiStripApvAbsoluteEndcapMinusGainsByDisk()
502 "Endcap (minus) disk (0-2: TID), (3-11: TEC)",
511 bool fill()
override {
512 auto tag = PlotBase::getTag<0>();
513 for (
auto const& iov :
tag.iovs) {
514 std::shared_ptr<SiStripApvGain>
payload = Base::fetchPayload(std::get<1>(iov));
519 std::vector<uint32_t> detid;
522 for (
const auto&
d : detid) {
541 for (
int it = 0; it <
range.second -
range.first; it++) {
543 fillWithValue((
float)disk - 1, (
gain > 2.0) ? 2.0 :
gain);
556 class SiStripApvAbsoluteEndcapPlusGainsByDisk :
public Histogram2D<SiStripApvGain, SINGLE_IOV> {
558 SiStripApvAbsoluteEndcapPlusGainsByDisk()
560 "Endcap (plus) disk (0-2: TID), (3-11: TEC)",
568 bool fill()
override {
569 auto tag = PlotBase::getTag<0>();
570 for (
auto const& iov :
tag.iovs) {
571 std::shared_ptr<SiStripApvGain>
payload = Base::fetchPayload(std::get<1>(iov));
576 std::vector<uint32_t> detid;
579 for (
const auto&
d : detid) {
598 for (
int it = 0; it <
range.second -
range.first; it++) {
600 fillWithValue((
float)disk - 1, (
gain > 2.0) ? 2.0 :
gain);
612 class SiStripApvGainsAverageTrackerMap :
public PlotImage<SiStripApvGain, SINGLE_IOV> {
616 bool fill()
override {
617 auto tag = PlotBase::getTag<0>();
618 auto iov =
tag.iovs.front();
619 std::shared_ptr<SiStripApvGain>
payload = fetchPayload(std::get<1>(iov));
621 std::string titleMap =
"SiStrip APV Gain average per module (payload : " + std::get<1>(iov) +
")";
623 std::unique_ptr<TrackerMap> tmap = std::make_unique<TrackerMap>(
"SiStripApvGains");
624 tmap->setTitle(titleMap);
627 std::vector<uint32_t> detid;
630 std::map<uint32_t, float> store;
632 for (
const auto&
d : detid) {
634 float sumOfGains = 0;
635 float nAPVsPerModule = 0.;
636 for (
int it = 0; it <
range.second -
range.first; it++) {
641 store[
d] = (sumOfGains / nAPVsPerModule);
642 tmap->fill(
d, (sumOfGains / nAPVsPerModule));
659 class SiStripApvGainsDefaultTrackerMap :
public PlotImage<SiStripApvGain, SINGLE_IOV> {
661 SiStripApvGainsDefaultTrackerMap()
664 bool fill()
override {
665 auto tag = PlotBase::getTag<0>();
666 auto iov =
tag.iovs.front();
667 std::shared_ptr<SiStripApvGain>
payload = fetchPayload(std::get<1>(iov));
669 std::unique_ptr<TrackerMap> tmap = std::make_unique<TrackerMap>(
"SiStripApvGains");
673 std::vector<uint32_t> detid;
681 float G1default = 690. / 640.;
682 float G2default = 1.;
684 int totalG1DefaultAPVs = 0;
685 int totalG2DefaultAPVs = 0;
687 for (
const auto&
d : detid) {
689 float sumOfGains = 0;
690 float nAPVsPerModule = 0.;
691 int countDefaults = 0;
692 for (
int it = 0; it <
range.second -
range.first; it++) {
699 if (countDefaults > 0.) {
700 tmap->fill(
d, countDefaults);
702 if (std::fmod((sumOfGains / countDefaults), G1default) == 0.) {
703 totalG1DefaultAPVs += countDefaults;
704 }
else if (std::fmod((sumOfGains / countDefaults), G2default) == 0.) {
705 totalG2DefaultAPVs += countDefaults;
712 std::string gainType = totalG1DefaultAPVs == 0 ?
"G2 value (=1)" :
"G1 value (=690./640.)";
714 std::string titleMap =
"# of APVs/module w/ default " + gainType +
" (payload : " + std::get<1>(iov) +
")";
715 tmap->setTitle(titleMap);
728 template <
int ntags, IOVMultiplicity nIOVs>
729 class SiStripApvGainsRatioTrackerMapBase :
public PlotImage<SiStripApvGain, nIOVs, ntags> {
731 SiStripApvGainsRatioTrackerMapBase()
736 bool fill()
override {
738 unsigned int nsigma(1);
741 auto ip = paramValues.find(
"nsigma");
742 if (ip != paramValues.end()) {
743 nsigma = std::stoul(ip->second);
747 auto theIOVs = PlotBase::getTag<0>().iovs;
748 auto tagname1 = PlotBase::getTag<0>().
name;
750 auto firstiov = theIOVs.front();
754 assert(this->m_plotAnnotations.ntags < 3);
756 if (this->m_plotAnnotations.ntags == 2) {
757 auto tag2iovs = PlotBase::getTag<1>().iovs;
758 tagname2 = PlotBase::getTag<1>().
name;
759 lastiov = tag2iovs.front();
761 lastiov = theIOVs.back();
764 std::shared_ptr<SiStripApvGain> last_payload = this->fetchPayload(std::get<1>(lastiov));
765 std::shared_ptr<SiStripApvGain> first_payload = this->fetchPayload(std::get<1>(firstiov));
767 std::string titleMap =
"SiStrip APV Gain ratio per module average (IOV: ";
770 titleMap +=
"/ IOV:";
774 titleMap += +
" " +
std::to_string(nsigma) +
" std. dev. saturation";
776 std::unique_ptr<TrackerMap> tmap = std::make_unique<TrackerMap>(
"SiStripApvGains");
777 tmap->setTitle(titleMap);
780 std::map<uint32_t, float> lastmap, firstmap;
782 std::vector<uint32_t> detid;
783 last_payload->getDetIds(detid);
786 for (
const auto&
d : detid) {
790 for (
int it = 0; it <
range.second -
range.first; it++) {
792 Gain += last_payload->getApvGain(it,
range);
794 lastmap[
d] = (
Gain / nAPV);
799 first_payload->getDetIds(detid);
802 for (
const auto&
d : detid) {
806 for (
int it = 0; it <
range.second -
range.first; it++) {
808 Gain += first_payload->getApvGain(it,
range);
810 firstmap[
d] = (
Gain / nAPV);
813 std::map<uint32_t, float> cachedRatio;
814 for (
const auto&
d : detid) {
815 float ratio = firstmap[
d] / lastmap[
d];
830 using SiStripApvGainsAvgDeviationRatioWithPreviousIOVTrackerMap = SiStripApvGainsRatioTrackerMapBase<1, MULTI_IOV>;
831 using SiStripApvGainsAvgDeviationRatioTrackerMapTwoTags = SiStripApvGainsRatioTrackerMapBase<2, SINGLE_IOV>;
837 template <
int ntags, IOVMultiplicity nIOVs>
838 class SiStripApvGainsRatioMaxDeviationTrackerMapBase :
public PlotImage<SiStripApvGain, nIOVs, ntags> {
840 SiStripApvGainsRatioMaxDeviationTrackerMapBase()
842 "Tracker Map of ratio (for largest deviation) of SiStripGains with previous IOV") {
846 bool fill()
override {
847 unsigned int nsigma(1);
849 auto ip = paramValues.find(
"nsigma");
850 if (ip != paramValues.end()) {
851 nsigma = std::stoul(ip->second);
853 <<
"using custom z-axis saturation: " << nsigma <<
" sigmas" << std::endl;
856 <<
"using default saturation: " << nsigma <<
" sigmas" << std::endl;
860 auto theIOVs = PlotBase::getTag<0>().iovs;
861 auto tagname1 = PlotBase::getTag<0>().
name;
863 auto firstiov = theIOVs.front();
867 assert(this->m_plotAnnotations.ntags < 3);
869 if (this->m_plotAnnotations.ntags == 2) {
870 auto tag2iovs = PlotBase::getTag<1>().iovs;
871 tagname2 = PlotBase::getTag<1>().
name;
872 lastiov = tag2iovs.front();
874 lastiov = theIOVs.back();
877 std::shared_ptr<SiStripApvGain> last_payload = this->fetchPayload(std::get<1>(lastiov));
878 std::shared_ptr<SiStripApvGain> first_payload = this->fetchPayload(std::get<1>(firstiov));
880 std::string titleMap =
"SiStrip APV Gain ratio for largest deviation per module (IOV: ";
883 titleMap +=
"/ IOV:";
887 titleMap += +
" - " +
std::to_string(nsigma) +
" std. dev. saturation";
889 std::unique_ptr<TrackerMap> tmap = std::make_unique<TrackerMap>(
"SiStripApvGains");
890 tmap->setTitle(titleMap);
893 std::map<std::pair<uint32_t, int>,
float> lastmap, firstmap;
895 std::vector<uint32_t> detid;
896 last_payload->getDetIds(detid);
899 for (
const auto&
d : detid) {
902 for (
int it = 0; it <
range.second -
range.first; it++) {
904 float Gain = last_payload->getApvGain(it,
range);
905 std::pair<uint32_t, int>
index = std::make_pair(
d, nAPV);
912 first_payload->getDetIds(detid);
915 for (
const auto&
d : detid) {
918 for (
int it = 0; it <
range.second -
range.first; it++) {
920 float Gain = first_payload->getApvGain(it,
range);
921 std::pair<uint32_t, int>
index = std::make_pair(
d, nAPV);
927 std::map<uint32_t, float> cachedRatio;
929 for (
const auto&
item : firstmap) {
936 if (cachedRatio[
mod]) {
946 for (
const auto& element : cachedRatio) {
947 tmap->fill(element.first, element.second);
962 using SiStripApvGainsMaxDeviationRatioWithPreviousIOVTrackerMap =
963 SiStripApvGainsRatioMaxDeviationTrackerMapBase<1, MULTI_IOV>;
965 using SiStripApvGainsMaxDeviationRatioTrackerMapTwoTags =
966 SiStripApvGainsRatioMaxDeviationTrackerMapBase<2, SINGLE_IOV>;
971 class SiStripApvGainsMaximumTrackerMap :
public PlotImage<SiStripApvGain, SINGLE_IOV> {
973 SiStripApvGainsMaximumTrackerMap()
976 bool fill()
override {
977 auto tag = PlotBase::getTag<0>();
978 auto iov =
tag.iovs.front();
979 std::shared_ptr<SiStripApvGain>
payload = fetchPayload(std::get<1>(iov));
981 std::string titleMap =
"SiStrip APV Gain maximum per module (payload : " + std::get<1>(iov) +
")";
983 std::unique_ptr<TrackerMap> tmap = std::make_unique<TrackerMap>(
"SiStripApvGains");
984 tmap->setTitle(titleMap);
987 std::vector<uint32_t> detid;
990 for (
const auto&
d : detid) {
992 float theMaxGain = 0;
993 for (
int it = 0; it <
range.second -
range.first; it++) {
995 if (currentGain > theMaxGain) {
996 theMaxGain = currentGain;
1000 tmap->fill(
d, theMaxGain);
1005 std::pair<float, float> extrema = tmap->getAutomaticRange();
1010 if (extrema.first != extrema.second) {
1013 tmap->save(
true, extrema.first * 0.95, extrema.first * 1.05,
fileName);
1023 class SiStripApvGainsMinimumTrackerMap :
public PlotImage<SiStripApvGain, SINGLE_IOV> {
1025 SiStripApvGainsMinimumTrackerMap()
1028 bool fill()
override {
1029 auto tag = PlotBase::getTag<0>();
1030 auto iov =
tag.iovs.front();
1032 std::shared_ptr<SiStripApvGain>
payload = fetchPayload(std::get<1>(iov));
1034 std::string titleMap =
"SiStrip APV Gain minumum per module (payload : " + std::get<1>(iov) +
")";
1036 std::unique_ptr<TrackerMap> tmap = std::make_unique<TrackerMap>(
"SiStripApvGains");
1037 tmap->setTitle(titleMap);
1038 tmap->setPalette(1);
1040 std::vector<uint32_t> detid;
1043 for (
const auto&
d : detid) {
1045 float theMinGain = 999.;
1046 for (
int it = 0; it <
range.second -
range.first; it++) {
1048 if (currentGain < theMinGain) {
1049 theMinGain = currentGain;
1053 tmap->fill(
d, theMinGain);
1058 std::pair<float, float> extrema = tmap->getAutomaticRange();
1063 if (extrema.first != extrema.second) {
1066 tmap->save(
true, extrema.first * 0.95, extrema.first * 1.05,
fileName);
1077 class SiStripApvGainByRunMeans :
public HistoryPlot<SiStripApvGain, float> {
1079 SiStripApvGainByRunMeans()
1081 ~SiStripApvGainByRunMeans()
override =
default;
1084 std::vector<uint32_t> detid;
1088 float sumOfGains = 0;
1090 for (
const auto&
d : detid) {
1092 for (
int it = 0; it <
range.second -
range.first; it++) {
1098 return sumOfGains / nAPVs;
1106 template <SiStripPI::estimator est>
1107 class SiStripApvGainProperties :
public HistoryPlot<SiStripApvGain, float> {
1109 SiStripApvGainProperties()
1112 ~SiStripApvGainProperties()
override =
default;
1115 std::vector<uint32_t> detid;
1119 float sumOfGains = 0;
1120 float meanOfGains = 0;
1121 float rmsOfGains = 0;
1124 for (
const auto&
d : detid) {
1126 for (
int it = 0; it <
range.second -
range.first; it++) {
1138 meanOfGains = sumOfGains / nAPVs;
1151 if ((rmsOfGains / nAPVs - meanOfGains * meanOfGains) > 0.) {
1152 return sqrt(rmsOfGains / nAPVs - meanOfGains * meanOfGains);
1165 typedef SiStripApvGainProperties<SiStripPI::min> SiStripApvGainMin_History;
1166 typedef SiStripApvGainProperties<SiStripPI::max> SiStripApvGainMax_History;
1167 typedef SiStripApvGainProperties<SiStripPI::mean> SiStripApvGainMean_History;
1168 typedef SiStripApvGainProperties<SiStripPI::rms> SiStripApvGainRMS_History;
1174 class SiStripApvTIBGainByRunMeans :
public HistoryPlot<SiStripApvGain, float> {
1176 SiStripApvTIBGainByRunMeans()
1178 "average Tracker Inner Barrel APV gain value") {}
1179 ~SiStripApvTIBGainByRunMeans()
override =
default;
1182 std::vector<uint32_t> detid;
1186 float sumOfGains = 0;
1188 for (
const auto&
d : detid) {
1194 for (
int it = 0; it <
range.second -
range.first; it++) {
1200 return sumOfGains / nAPVs;
1209 class SiStripApvTOBGainByRunMeans :
public HistoryPlot<SiStripApvGain, float> {
1211 SiStripApvTOBGainByRunMeans()
1213 ~SiStripApvTOBGainByRunMeans()
override =
default;
1216 std::vector<uint32_t> detid;
1220 float sumOfGains = 0;
1222 for (
const auto&
d : detid) {
1228 for (
int it = 0; it <
range.second -
range.first; it++) {
1234 return sumOfGains / nAPVs;
1243 class SiStripApvTIDGainByRunMeans :
public HistoryPlot<SiStripApvGain, float> {
1245 SiStripApvTIDGainByRunMeans()
1248 ~SiStripApvTIDGainByRunMeans()
override =
default;
1251 std::vector<uint32_t> detid;
1255 float sumOfGains = 0;
1256 for (
const auto&
d : detid) {
1262 for (
int it = 0; it <
range.second -
range.first; it++) {
1268 return sumOfGains / nAPVs;
1277 class SiStripApvTECGainByRunMeans :
public HistoryPlot<SiStripApvGain, float> {
1279 SiStripApvTECGainByRunMeans()
1281 "average Tracker Endcaps APV gain value") {}
1282 ~SiStripApvTECGainByRunMeans()
override =
default;
1285 std::vector<uint32_t> detid;
1289 float sumOfGains = 0;
1291 for (
const auto&
d : detid) {
1297 for (
int it = 0; it <
range.second -
range.first; it++) {
1303 return sumOfGains / nAPVs;
1312 class SiStripApvGainsTest :
public Histogram1D<SiStripApvGain, SINGLE_IOV> {
1314 SiStripApvGainsTest()
1319 bool fill()
override {
1320 auto tag = PlotBase::getTag<0>();
1321 for (
auto const& iov :
tag.iovs) {
1322 std::shared_ptr<SiStripApvGain>
payload = Base::fetchPayload(std::get<1>(iov));
1324 std::vector<uint32_t> detid;
1329 for (
const auto&
d : detid) {
1331 for (
int it = 0; it <
range.second -
range.first; ++it) {
1336 std::map<unsigned int, SiStripDetSummary::Values>
map = summaryGain.getCounts();
1340 std::stringstream
ss;
1341 ss <<
"Summary of gain values:" << std::endl;
1342 summaryGain.print(
ss,
true);
1357 template <
int ntags, IOVMultiplicity nIOVs>
1358 class SiStripApvGainsComparatorBase :
public PlotImage<SiStripApvGain, nIOVs, ntags> {
1362 bool fill()
override {
1364 auto theIOVs = PlotBase::getTag<0>().iovs;
1365 auto tagname1 = PlotBase::getTag<0>().
name;
1367 auto firstiov = theIOVs.front();
1371 assert(this->m_plotAnnotations.ntags < 3);
1373 if (this->m_plotAnnotations.ntags == 2) {
1374 auto tag2iovs = PlotBase::getTag<1>().iovs;
1375 tagname2 = PlotBase::getTag<1>().
name;
1376 lastiov = tag2iovs.front();
1378 lastiov = theIOVs.back();
1381 std::shared_ptr<SiStripApvGain> last_payload = this->fetchPayload(std::get<1>(lastiov));
1382 std::shared_ptr<SiStripApvGain> first_payload = this->fetchPayload(std::get<1>(firstiov));
1387 std::vector<uint32_t> detid;
1388 last_payload->getDetIds(detid);
1390 std::map<std::pair<uint32_t, int>,
float> lastmap, firstmap;
1393 for (
const auto&
d : detid) {
1397 for (
int it = 0; it <
range.second -
range.first; ++it) {
1399 Gain = last_payload->getApvGain(it,
range);
1400 std::pair<uint32_t, int>
index = std::make_pair(
d, nAPV);
1406 first_payload->getDetIds(detid);
1409 for (
const auto&
d : detid) {
1413 for (
int it = 0; it <
range.second -
range.first; ++it) {
1415 Gain = first_payload->getApvGain(it,
range);
1416 std::pair<uint32_t, int>
index = std::make_pair(
d, nAPV);
1421 TCanvas
canvas(
"Payload comparison",
"payload comparison", 1400, 1000);
1424 std::map<std::string, std::shared_ptr<TH1F>>
ratios;
1425 std::map<std::string, std::shared_ptr<TH2F>> scatters;
1426 std::map<std::string, int> colormap;
1427 std::map<std::string, int> markermap;
1428 colormap[
"TIB"] = kRed;
1429 markermap[
"TIB"] = kFullCircle;
1430 colormap[
"TOB"] = kGreen;
1431 markermap[
"TOB"] = kFullTriangleUp;
1432 colormap[
"TID"] = kBlack;
1433 markermap[
"TID"] = kFullSquare;
1434 colormap[
"TEC"] = kBlue;
1435 markermap[
"TEC"] = kFullTriangleDown;
1437 std::vector<std::string>
parts = {
"TEC",
"TOB",
"TIB",
"TID"};
1441 Form(
"hRatio_%s",
part.c_str()),
1442 Form(
"Gains ratio IOV: %s/ IOV: %s ;Previous Gain (%s) / New Gain (%s);Number of APV",
1443 firstIOVsince.c_str(),
1444 lastIOVsince.c_str(),
1445 firstIOVsince.c_str(),
1446 lastIOVsince.c_str()),
1451 std::make_shared<TH2F>(Form(
"hScatter_%s",
part.c_str()),
1452 Form(
"new Gain (%s) vs previous Gain (%s);Previous Gain (%s);New Gain (%s)",
1453 lastIOVsince.c_str(),
1454 firstIOVsince.c_str(),
1455 firstIOVsince.c_str(),
1456 lastIOVsince.c_str()),
1466 for (
const auto&
item : firstmap) {
1476 scatters[
"TIB"]->Fill(firstmap[
index], lastmap[
index]);
1481 scatters[
"TOB"]->Fill(firstmap[
index], lastmap[
index]);
1486 scatters[
"TID"]->Fill(firstmap[
index], lastmap[
index]);
1491 scatters[
"TEC"]->Fill(firstmap[
index], lastmap[
index]);
1495 auto legend = TLegend(0.60, 0.8, 0.92, 0.95);
1496 legend.SetTextSize(0.05);
1498 canvas.cd(1)->SetTopMargin(0.05);
1499 canvas.cd(1)->SetLeftMargin(0.13);
1500 canvas.cd(1)->SetRightMargin(0.08);
1518 auto legend2 = TLegend(0.60, 0.8, 0.92, 0.95);
1519 legend2.SetTextSize(0.05);
1521 canvas.cd(2)->SetTopMargin(0.05);
1522 canvas.cd(2)->SetLeftMargin(0.13);
1523 canvas.cd(2)->SetRightMargin(0.08);
1527 scatters[
part]->SetStats(
false);
1528 scatters[
part]->SetMarkerColor(colormap[
part]);
1529 scatters[
part]->SetMarkerStyle(markermap[
part]);
1530 scatters[
part]->SetMarkerSize(0.5);
1532 auto temp = (TH2F*)(scatters[
part]->Clone());
1533 temp->SetMarkerSize(1.3);
1536 scatters[
part]->Draw(
"P");
1538 scatters[
part]->Draw(
"Psame");
1540 legend2.AddEntry(
temp,
part.c_str(),
"P");
1543 TLine diagonal(0.5, 0.5, 1.8, 1.8);
1544 diagonal.SetLineWidth(3);
1545 diagonal.SetLineStyle(2);
1546 diagonal.Draw(
"same");
1548 legend2.Draw(
"same");
1557 using SiStripApvGainsComparatorSingleTag = SiStripApvGainsComparatorBase<1, MULTI_IOV>;
1558 using SiStripApvGainsComparatorTwoTags = SiStripApvGainsComparatorBase<2, SINGLE_IOV>;
1564 class SiStripApvGainsTHStack :
public PlotImage<SiStripApvGain, SINGLE_IOV> {
1566 SiStripApvGainsTHStack()
1571 bool fill()
override {
1573 auto tag = PlotBase::getTag<0>();
1574 auto iov =
tag.iovs.front();
1576 std::shared_ptr<SiStripApvGain>
payload = this->fetchPayload(std::get<1>(iov));
1579 std::map<partition, std::shared_ptr<TH1F>> h_gains;
1582 std::vector<partition>
regions;
1584 std::vector<uint32_t> detid;
1588 for (
const auto&
d : detid) {
1590 auto region = this->getThePartition(
d);
1596 LogDebug(
"SiStripApvGainsTHStack") <<
"regions.size()=" <<
regions.size() << std::endl;
1603 h_gains[
r] = std::make_shared<TH1F>(Form(
"hGains_%s",
part.c_str()),
1604 Form(
"Gains values for IOV: %s ;Gain;Number of APV", IOVsince.c_str()),
1611 for (
const auto&
d : detid) {
1613 auto region = this->getThePartition(
d);
1615 for (
int it = 0; it <
range.second -
range.first; ++it) {
1621 TCanvas
canvas(
"Payload breakout",
"payload breakout", 1200, 800);
1624 std::array<int, 6>
colors = {{kRed, kBlue, kGreen, kCyan, 8, kMagenta}};
1626 THStack* hs =
new THStack(
"hs", Form(
"Gains values for IOV: %s;Gain;Number of APV", IOVsince.c_str()));
1627 int colorCounter = 0;
1629 hs->Add(h_gains[
r].
get());
1631 h_gains[
r]->SetFillColor(
colors[colorCounter]);
1633 h_gains[
r]->SetLineWidth(2);
1637 TLegend
legend = TLegend(0.60, 0.65, 0.95, 0.93);
1638 legend.SetTextSize(0.05);
1639 legend.SetHeader(
"Gain break-out",
"C");
1642 legend.AddEntry(h_gains[
r].
get(),
part.c_str(),
"F");
1646 canvas.cd(1)->SetTopMargin(0.07);
1647 canvas.cd(1)->SetBottomMargin(0.10);
1648 canvas.cd(1)->SetLeftMargin(0.15);
1649 canvas.cd(1)->SetRightMargin(0.05);
1653 auto stack = hs->GetHists();
1654 double maximum = hs->GetMaximum(
"nostack");
1656 TLegend legend2 = TLegend(0.70, 0.65, 0.95, 0.93);
1657 legend2.SetTextSize(0.05);
1658 legend2.SetHeader(
"Partition",
"C");
1660 for (
const auto&& elem : *
stack) {
1661 auto clone = (TH1F*)(elem->Clone(Form(
"hclone_%s", elem->GetName())));
1663 clone->SetFillColor(0);
1664 clone->SetMarkerStyle(20);
1667 clone->SetMaximum(maximum * 10);
1669 legend2.AddEntry(
clone,
candName.ReplaceAll(
"hclone_hGains_",
""),
"L");
1671 clone->Draw(
"HIST");
1673 clone->Draw(
"HISTsame");
1678 legend2.Draw(
"same");
1681 canvas.cd(2)->SetTopMargin(0.07);
1682 canvas.cd(2)->SetBottomMargin(0.10);
1683 canvas.cd(2)->SetLeftMargin(0.12);
1684 canvas.cd(2)->SetRightMargin(0.05);
1687 hs->GetYaxis()->SetMaxDigits(2);
1688 SiStripPI::makeNiceStyle<THStack>(hs);
1716 partition getThePartition(
DetId detid) {
1728 side = m_trackerTopo.
tecSide(detid);
1733 side = m_trackerTopo.
tidSide(detid);
1739 return static_cast<partition
>(detNum);
1750 stereo = m_trackerTopo.
tibStereo(detid);
1755 stereo = m_trackerTopo.
tobStereo(detid);
1761 stereo = m_trackerTopo.
tecStereo(detid);
1767 stereo = m_trackerTopo.
tidStereo(detid);
1772 detNum +=
layer * 10 + stereo;
1781 template <
int ntags, IOVMultiplicity nIOVs>
1782 class SiStripApvGainsValuesComparatorBase :
public PlotImage<SiStripApvGain, nIOVs, ntags> {
1784 SiStripApvGainsValuesComparatorBase()
1787 bool fill()
override {
1788 TH1F::SetDefaultSumw2(
true);
1791 auto theIOVs = PlotBase::getTag<0>().iovs;
1792 auto tagname1 = PlotBase::getTag<0>().
name;
1794 auto firstiov = theIOVs.front();
1798 assert(this->m_plotAnnotations.ntags < 3);
1800 if (this->m_plotAnnotations.ntags == 2) {
1801 auto tag2iovs = PlotBase::getTag<1>().iovs;
1802 tagname2 = PlotBase::getTag<1>().
name;
1803 lastiov = tag2iovs.front();
1805 lastiov = theIOVs.back();
1808 std::shared_ptr<SiStripApvGain> last_payload = this->fetchPayload(std::get<1>(lastiov));
1809 std::shared_ptr<SiStripApvGain> first_payload = this->fetchPayload(std::get<1>(firstiov));
1814 std::vector<uint32_t> detid;
1815 last_payload->getDetIds(detid);
1817 std::map<std::pair<uint32_t, int>,
float> lastmap, firstmap;
1820 for (
const auto&
d : detid) {
1823 for (
int it = 0; it <
range.second -
range.first; ++it) {
1825 auto index = std::make_pair(
d, nAPV);
1826 lastmap[
index] = last_payload->getApvGain(it,
range);
1831 first_payload->getDetIds(detid);
1834 for (
const auto&
d : detid) {
1837 for (
int it = 0; it <
range.second -
range.first; ++it) {
1839 auto index = std::make_pair(
d, nAPV);
1840 firstmap[
index] = last_payload->getApvGain(it,
range);
1844 TCanvas
canvas(
"Payload comparison",
"payload comparison", 1000, 1000);
1847 TPad
pad1(
"pad1",
"pad1", 0, 0.3, 1, 1.0);
1848 pad1.SetBottomMargin(0.02);
1849 pad1.SetTopMargin(0.07);
1850 pad1.SetRightMargin(0.05);
1851 pad1.SetLeftMargin(0.15);
1856 std::make_shared<TH1F>(
"hFirstGains",
"SiStrip APV gains values; APV Gains;n. APVs", 200, 0.2, 1.8);
1858 std::make_shared<TH1F>(
"hLastGains",
"SiStrip APV gains values; APV Gains;n. APVs", 200, 0.2, 1.8);
1860 for (
const auto&
item : firstmap) {
1861 h_firstGains->Fill(
item.second);
1864 for (
const auto&
item : lastmap) {
1865 h_lastGains->Fill(
item.second);
1871 TH1F* hratio = (TH1F*)h_firstGains->Clone(
"hratio");
1873 h_firstGains->SetLineColor(kRed);
1874 h_lastGains->SetLineColor(kBlue);
1876 h_firstGains->SetMarkerColor(kRed);
1877 h_lastGains->SetMarkerColor(kBlue);
1879 h_firstGains->SetMarkerSize(1.);
1880 h_lastGains->SetMarkerSize(1.);
1882 h_firstGains->SetLineWidth(1);
1883 h_lastGains->SetLineWidth(1);
1885 h_firstGains->SetMarkerStyle(20);
1886 h_lastGains->SetMarkerStyle(21);
1888 h_firstGains->GetXaxis()->SetLabelOffset(2.);
1889 h_lastGains->GetXaxis()->SetLabelOffset(2.);
1891 h_firstGains->Draw(
"HIST");
1892 h_lastGains->Draw(
"HISTsame");
1894 TLegend
legend = TLegend(0.70, 0.7, 0.95, 0.9);
1895 legend.SetHeader(
"Gain Comparison",
"C");
1896 legend.AddEntry(h_firstGains.get(), (
"IOV: " +
std::to_string(std::get<0>(firstiov))).c_str(),
"PL");
1897 legend.AddEntry(h_lastGains.get(), (
"IOV: " +
std::to_string(std::get<0>(lastiov))).c_str(),
"PL");
1902 TPad
pad2(
"pad2",
"pad2", 0, 0.005, 1, 0.3);
1903 pad2.SetTopMargin(0.01);
1904 pad2.SetBottomMargin(0.2);
1905 pad2.SetRightMargin(0.05);
1906 pad2.SetLeftMargin(0.15);
1912 hratio->SetLineColor(kBlack);
1913 hratio->SetMarkerColor(kBlack);
1914 hratio->SetTitle(
"");
1915 hratio->SetMinimum(0.55);
1916 hratio->SetMaximum(1.55);
1917 hratio->SetStats(
false);
1918 hratio->Divide(h_lastGains.get());
1919 hratio->SetMarkerStyle(20);
1923 hratio->GetYaxis()->SetTitle(
1926 hratio->GetYaxis()->SetNdivisions(505);
1930 hratio->GetYaxis()->SetTitleSize(25);
1931 hratio->GetXaxis()->SetLabelSize(25);
1933 hratio->GetYaxis()->SetTitleFont(43);
1934 hratio->GetYaxis()->SetTitleOffset(2.5);
1935 hratio->GetYaxis()->SetLabelFont(43);
1936 hratio->GetYaxis()->SetLabelSize(25);
1939 hratio->GetXaxis()->SetTitleSize(30);
1940 hratio->GetXaxis()->SetTitleFont(43);
1941 hratio->GetXaxis()->SetTitle(
"SiStrip APV Gains");
1942 hratio->GetXaxis()->SetLabelFont(43);
1943 hratio->GetXaxis()->SetTitleOffset(3.);
1952 using SiStripApvGainsValuesComparatorSingleTag = SiStripApvGainsValuesComparatorBase<1, MULTI_IOV>;
1953 using SiStripApvGainsValuesComparatorTwoTags = SiStripApvGainsValuesComparatorBase<2, SINGLE_IOV>;
1959 template <
int ntags, IOVMultiplicity nIOVs>
1960 class SiStripApvGainsRatioComparatorByRegionBase :
public PlotImage<SiStripApvGain, nIOVs, ntags> {
1962 SiStripApvGainsRatioComparatorByRegionBase()
1967 bool fill()
override {
1972 auto theIOVs = PlotBase::getTag<0>().iovs;
1973 auto tagname1 = PlotBase::getTag<0>().
name;
1975 auto firstiov = theIOVs.front();
1979 assert(this->m_plotAnnotations.ntags < 3);
1981 if (this->m_plotAnnotations.ntags == 2) {
1982 auto tag2iovs = PlotBase::getTag<1>().iovs;
1983 tagname2 = PlotBase::getTag<1>().
name;
1984 lastiov = tag2iovs.front();
1986 lastiov = theIOVs.back();
1989 std::shared_ptr<SiStripApvGain> last_payload = this->fetchPayload(std::get<1>(lastiov));
1990 std::shared_ptr<SiStripApvGain> first_payload = this->fetchPayload(std::get<1>(firstiov));
1995 std::vector<uint32_t> detid;
1996 last_payload->getDetIds(detid);
1998 std::map<std::pair<uint32_t, int>,
float> lastmap, firstmap;
2001 for (
const auto&
d : detid) {
2005 for (
int it = 0; it <
range.second -
range.first; ++it) {
2007 Gain = last_payload->getApvGain(it,
range);
2008 std::pair<uint32_t, int>
index = std::make_pair(
d, nAPV);
2014 first_payload->getDetIds(detid);
2017 for (
const auto&
d : detid) {
2021 for (
int it = 0; it <
range.second -
range.first; ++it) {
2023 Gain = first_payload->getApvGain(it,
range);
2024 std::pair<uint32_t, int>
index = std::make_pair(
d, nAPV);
2029 TCanvas
canvas(
"Payload comparison by Tracker Region",
"payload comparison by Tracker Region", 1800, 800);
2032 auto h2first = std::make_unique<TH2F>(
2033 "byRegion1",
"SiStrip APV Gain values by region;; average SiStrip Gain", 38, 1., 39., 100., 0., 2.);
2034 auto h2last = std::make_unique<TH2F>(
2035 "byRegion2",
"SiStrip APV Gain values by region;; average SiStrip Gain", 38, 1., 39., 100., 0., 2.);
2037 auto h2ratio = std::make_unique<TH2F>(
"byRegionRatio",
2038 Form(
"SiStrip APV Gains ratio by region;; Gains ratio IOV: %s/ IOV %s",
2039 lastIOVsince.c_str(),
2040 firstIOVsince.c_str()),
2048 h2first->SetStats(
false);
2049 h2last->SetStats(
false);
2050 h2ratio->SetStats(
false);
2052 canvas.cd(1)->SetBottomMargin(0.18);
2053 canvas.cd(1)->SetLeftMargin(0.12);
2054 canvas.cd(1)->SetRightMargin(0.05);
2057 std::vector<int> boundaries;
2061 for (
const auto& element : lastmap) {
2062 auto region = this->getTheRegion(element.first.first);
2066 h2last->Fill(
bin, element.second);
2067 h2last->GetXaxis()->SetBinLabel(
bin,
label);
2068 h2ratio->Fill(
bin, element.second / firstmap[element.first]);
2069 h2ratio->GetXaxis()->SetBinLabel(
bin,
label);
2072 for (
const auto& element : firstmap) {
2073 auto region = this->getTheRegion(element.first.first);
2077 h2first->Fill(
bin, element.second);
2078 h2first->GetXaxis()->SetBinLabel(
bin,
label);
2081 h2first->GetXaxis()->LabelsOption(
"v");
2082 h2last->GetXaxis()->LabelsOption(
"v");
2083 h2ratio->GetXaxis()->LabelsOption(
"v");
2085 h2last->SetLineColor(kBlue);
2086 h2first->SetLineColor(kRed);
2087 h2first->SetFillColor(kRed);
2089 h2first->SetMarkerStyle(20);
2090 h2last->SetMarkerStyle(21);
2092 h2first->SetMarkerColor(kRed);
2093 h2last->SetMarkerColor(kBlue);
2096 h2first->Draw(
"BOX");
2097 h2last->Draw(
"BOXsame");
2099 TLegend
legend = TLegend(0.70, 0.8, 0.95, 0.9);
2100 legend.SetHeader(
"Gain Comparison",
"C");
2101 legend.AddEntry(h2first.get(), (
"IOV: " +
std::to_string(std::get<0>(firstiov))).c_str(),
"F");
2106 canvas.cd(2)->SetBottomMargin(0.18);
2107 canvas.cd(2)->SetLeftMargin(0.12);
2108 canvas.cd(2)->SetRightMargin(0.12);
2110 h2ratio->Draw(
"COLZ");
2111 auto hpfx_tmp = (TProfile*)(h2ratio->ProfileX(
"_pfx", 1, -1,
"o"));
2112 hpfx_tmp->SetStats(kFALSE);
2113 hpfx_tmp->SetMarkerColor(kRed);
2114 hpfx_tmp->SetLineColor(kRed);
2115 hpfx_tmp->SetMarkerSize(1.2);
2116 hpfx_tmp->SetMarkerStyle(20);
2117 hpfx_tmp->Draw(
"same");
2137 stereo = m_trackerTopo.
tibStereo(detid);
2142 stereo = m_trackerTopo.
tobStereo(detid);
2148 stereo = m_trackerTopo.
tecStereo(detid);
2154 stereo = m_trackerTopo.
tidStereo(detid);
2159 detNum +=
layer * 10 + stereo;
2164 using SiStripApvGainsRatioComparatorByRegionSingleTag = SiStripApvGainsRatioComparatorByRegionBase<1, MULTI_IOV>;
2165 using SiStripApvGainsRatioComparatorByRegionTwoTags = SiStripApvGainsRatioComparatorByRegionBase<2, SINGLE_IOV>;
2171 template <
int ntags, IOVMultiplicity nIOVs>
2172 class SiStripApvGainsComparatorByRegionBase :
public PlotImage<SiStripApvGain, nIOVs, ntags> {
2174 SiStripApvGainsComparatorByRegionBase()
2179 bool fill()
override {
2181 auto theIOVs = PlotBase::getTag<0>().iovs;
2182 auto tagname1 = PlotBase::getTag<0>().
name;
2184 auto firstiov = theIOVs.front();
2188 assert(this->m_plotAnnotations.ntags < 3);
2190 if (this->m_plotAnnotations.ntags == 2) {
2191 auto tag2iovs = PlotBase::getTag<1>().iovs;
2192 tagname2 = PlotBase::getTag<1>().
name;
2193 lastiov = tag2iovs.front();
2195 lastiov = theIOVs.back();
2198 std::shared_ptr<SiStripApvGain> last_payload = this->fetchPayload(std::get<1>(lastiov));
2199 std::shared_ptr<SiStripApvGain> first_payload = this->fetchPayload(std::get<1>(firstiov));
2201 std::vector<uint32_t> detid;
2202 last_payload->getDetIds(detid);
2206 for (
const auto&
d : detid) {
2208 for (
int it = 0; it <
range.second -
range.first; ++it) {
2209 summaryLastGain.add(
d, last_payload->getApvGain(it,
range));
2215 for (
const auto&
d : detid) {
2217 for (
int it = 0; it <
range.second -
range.first; ++it) {
2218 summaryFirstGain.add(
d, first_payload->getApvGain(it,
range));
2222 std::map<unsigned int, SiStripDetSummary::Values> firstmap = summaryFirstGain.getCounts();
2223 std::map<unsigned int, SiStripDetSummary::Values> lastmap = summaryLastGain.getCounts();
2226 TCanvas
canvas(
"Region summary",
"region summary", 1200, 1000);
2229 auto hfirst = std::make_unique<TH1F>(
"byRegion1",
2230 "SiStrip APV Gain average by region;; average SiStrip Gain",
2234 auto hlast = std::make_unique<TH1F>(
2235 "byRegion2",
"SiStrip APV Gain average by region;; average SiStrip Gain", lastmap.size(), 0., lastmap.size());
2237 hfirst->SetStats(
false);
2238 hlast->SetStats(
false);
2240 canvas.SetBottomMargin(0.18);
2241 canvas.SetLeftMargin(0.12);
2242 canvas.SetRightMargin(0.05);
2245 std::vector<int> boundaries;
2246 unsigned int iBin = 0;
2251 for (
const auto& element : lastmap) {
2253 int count = element.second.count;
2254 double mean = (element.second.mean) /
count;
2256 if (currentDetector.empty())
2257 currentDetector =
"TIB";
2259 switch ((element.first) / 1000) {
2274 hlast->SetBinContent(iBin,
mean);
2275 hlast->SetBinError(iBin,
mean / 10000.);
2277 hlast->GetXaxis()->LabelsOption(
"v");
2280 boundaries.push_back(iBin);
2288 for (
const auto& element : firstmap) {
2290 int count = element.second.count;
2291 double mean = (element.second.mean) /
count;
2293 hfirst->SetBinContent(iBin,
mean);
2294 hfirst->SetBinError(iBin,
mean / 10000.);
2296 hfirst->GetXaxis()->LabelsOption(
"v");
2300 hlast->GetYaxis()->SetRangeUser(extrema.first, extrema.second);
2302 hlast->SetMarkerStyle(20);
2303 hlast->SetMarkerSize(1);
2305 hlast->Draw(
"Psame");
2307 hfirst->SetMarkerStyle(18);
2308 hfirst->SetMarkerSize(1);
2309 hfirst->SetLineColor(kBlue);
2310 hfirst->SetMarkerColor(kBlue);
2311 hfirst->Draw(
"E1same");
2312 hfirst->Draw(
"Psame");
2317 TLine
l[boundaries.size()];
2319 for (
const auto&
line : boundaries) {
2321 hfirst->GetBinLowEdge(
line),
canvas.cd()->GetUymin(), hfirst->GetBinLowEdge(
line),
canvas.cd()->GetUymax());
2322 l[
i].SetLineWidth(1);
2323 l[
i].SetLineStyle(9);
2324 l[
i].SetLineColor(2);
2329 TLegend
legend = TLegend(0.70, 0.8, 0.95, 0.9);
2330 legend.SetHeader(
"Gain Comparison",
"C");
2331 legend.AddEntry(hfirst.get(), (
"IOV: " +
std::to_string(std::get<0>(firstiov))).c_str(),
"PL");
2345 using SiStripApvGainsComparatorByRegionSingleTag = SiStripApvGainsComparatorByRegionBase<1, MULTI_IOV>;
2346 using SiStripApvGainsComparatorByRegionTwoTags = SiStripApvGainsComparatorByRegionBase<2, SINGLE_IOV>;
2352 class SiStripApvGainsByRegion :
public PlotImage<SiStripApvGain, SINGLE_IOV> {
2354 SiStripApvGainsByRegion()
2359 bool fill()
override {
2360 auto tag = PlotBase::getTag<0>();
2361 auto iov =
tag.iovs.front();
2362 std::shared_ptr<SiStripApvGain>
payload = fetchPayload(std::get<1>(iov));
2364 std::vector<uint32_t> detid;
2369 for (
const auto&
d : detid) {
2371 for (
int it = 0; it <
range.second -
range.first; ++it) {
2376 std::map<unsigned int, SiStripDetSummary::Values>
map = summaryGain.getCounts();
2379 TCanvas
canvas(
"Region summary",
"region summary", 1200, 1000);
2381 auto h1 = std::make_unique<TH1F>(
2382 "byRegion",
"SiStrip Gain average by region;; average SiStrip Gain",
map.size(), 0.,
map.size());
2383 h1->SetStats(
false);
2384 canvas.SetBottomMargin(0.18);
2385 canvas.SetLeftMargin(0.12);
2386 canvas.SetRightMargin(0.05);
2389 std::vector<int> boundaries;
2390 unsigned int iBin = 0;
2395 for (
const auto& element :
map) {
2397 int count = element.second.count;
2398 double mean = (element.second.mean) /
count;
2400 if (currentDetector.empty())
2401 currentDetector =
"TIB";
2403 switch ((element.first) / 1000) {
2418 h1->SetBinContent(iBin,
mean);
2420 h1->GetXaxis()->LabelsOption(
"v");
2423 boundaries.push_back(iBin);
2428 h1->SetMarkerStyle(20);
2429 h1->SetMarkerSize(1);
2435 TLine
l[boundaries.size()];
2437 for (
const auto&
line : boundaries) {
2439 l[
i].SetLineWidth(1);
2440 l[
i].SetLineStyle(9);
2441 l[
i].SetLineColor(2);
2446 TLegend
legend = TLegend(0.52, 0.82, 0.95, 0.9);
2447 legend.SetHeader((std::get<1>(iov)).c_str(),
"C");
2449 legend.SetTextSize(0.025);
static constexpr auto TEC
unsigned int tobLayer(const DetId &id) const
std::pair< int, const char * > regionType(int index)
uint32_t tidStereo(const DetId &id) const
unsigned int tidSide(const DetId &id) const
unsigned int tidWheel(const DetId &id) const
unsigned int tecWheel(const DetId &id) const
std::string to_string(const V &value)
void setPaletteStyle(SiStripPI::palette palette)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
constexpr std::array< uint8_t, layerIndexSize > layer
std::tuple< cond::Time_t, cond::Hash > MetaData
std::pair< float, float > getTheRange(std::map< uint32_t, float > values, const float nsigma)
#define PAYLOAD_INSPECTOR_CLASS(CLASS_NAME)
std::pair< float, float > getExtrema(TH1 *h1, TH1 *h2)
uint32_t tobStereo(const DetId &id) const
void drawStatBox(std::map< std::string, std::shared_ptr< TH1F >> histos, std::map< std::string, int > colormap, std::vector< std::string > legend, double X=0.15, double Y=0.93, double W=0.15, double H=0.10)
unsigned int tecSide(const DetId &id) const
Abs< T >::type abs(const T &t)
std::pair< ContainerIterator, ContainerIterator > Range
void makeNicePlotStyle(TH1 *hist)
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
static constexpr auto TOB
#define PAYLOAD_INSPECTOR_MODULE(PAYLOAD_TYPENAME)
std::string estimatorType(SiStripPI::estimator e)
Log< level::Warning, true > LogPrint
const std::map< std::string, std::string > & inputParamValues() const
void addInputParam(const std::string ¶mName)
static constexpr auto TIB
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
char data[epos_bytes_allocation]
TrackerTopology fromTrackerParametersXMLFile(const std::string &xmlFileName)
uint32_t tecStereo(const DetId &id) const
unsigned int tibLayer(const DetId &id) const
Log< level::Warning, false > LogWarning
T mod(const T &a, const T &b)
static constexpr auto TID
uint32_t tibStereo(const DetId &id) const