-
Notifications
You must be signed in to change notification settings - Fork 4.4k
/
Copy pathSiStripMonitorCluster.cc
1667 lines (1470 loc) · 85.3 KB
/
SiStripMonitorCluster.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// -*- C++ -*-
// Package: SiStripMonitorCluster
// Class: SiStripMonitorCluster
/**\class SiStripMonitorCluster SiStripMonitorCluster.cc
* DQM/SiStripMonitorCluster/src/SiStripMonitorCluster.cc
*/
// Original Author: Dorian Kcira
// Created: Wed Feb 1 16:42:34 CET 2006
// std library includes
#include <cmath>
#include <fstream>
#include <numeric>
#include <vector>
#include <iostream>
// user includes
#include "CalibTracker/SiStripCommon/interface/SiStripDCSStatus.h"
#include "CommonTools/TriggerUtils/interface/GenericTriggerEventFlag.h"
#include "CondFormats/DataRecord/interface/SiStripCondDataRecords.h"
#include "DPGAnalysis/SiStripTools/interface/APVCyclePhaseCollection.h"
#include "DPGAnalysis/SiStripTools/interface/EventWithHistory.h"
#include "DQM/SiStripCommon/interface/SiStripFolderOrganizer.h"
#include "DQM/SiStripCommon/interface/SiStripHistoId.h"
#include "DQM/SiStripMonitorCluster/interface/SiStripMonitorCluster.h"
#include "DQMServices/Core/interface/DQMStore.h"
#include "DataFormats/SiPixelCluster/interface/SiPixelCluster.h"
#include "DataFormats/SiStripCluster/interface/SiStripCluster.h"
#include "DataFormats/SiStripCluster/interface/SiStripClusterCollection.h"
#include "DataFormats/SiStripDetId/interface/StripSubdetector.h"
#include "DataFormats/TrackerCommon/interface/SiStripSubStructure.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/ServiceRegistry/interface/Service.h"
#include "FWCore/Utilities/interface/ESInputTag.h"
#include "FWCore/Utilities/interface/Transition.h"
// ROOT includes
#include "TNamed.h"
#include "TMath.h"
//--------------------------------------------------------------------------------------------
SiStripMonitorCluster::SiStripMonitorCluster(const edm::ParameterSet& iConfig)
: conf_(iConfig),
show_mechanical_structure_view(true),
show_readout_view(false),
show_control_view(false),
select_all_detectors(false),
reset_each_run(false),
m_cacheID_(0),
qualityLabel_{conf_.getParameter<std::string>("StripQualityLabel")},
trackerTopologyRunToken_{esConsumes<TrackerTopology, TrackerTopologyRcd, edm::Transition::BeginRun>()},
tkDetMapToken_{esConsumes<TkDetMap, TrackerTopologyRcd, edm::Transition::BeginRun>()},
siStripDetCablingRunToken_{esConsumes<SiStripDetCabling, SiStripDetCablingRcd, edm::Transition::BeginRun>()},
trackerTopologyEventToken_{esConsumes<TrackerTopology, TrackerTopologyRcd>()},
siStripNoisesToken_{esConsumes<SiStripNoises, SiStripNoisesRcd>()},
siStripGainToken_{esConsumes<SiStripGain, SiStripGainRcd>()},
siStripQualityToken_{esConsumes<SiStripQuality, SiStripQualityRcd>(edm::ESInputTag("", qualityLabel_))},
siStripDetCablingEventToken_{esConsumes<SiStripDetCabling, SiStripDetCablingRcd>()} {
// initialize
passBPTXfilter_ = true;
// initialize GenericTriggerEventFlag by specific configuration
// in this way, one can set specific selections for different MEs
genTriggerEventFlagBPTXfilter_ =
new GenericTriggerEventFlag(iConfig.getParameter<edm::ParameterSet>("BPTXfilter"), consumesCollector(), *this);
genTriggerEventFlagPixelDCSfilter_ = new GenericTriggerEventFlag(
iConfig.getParameter<edm::ParameterSet>("PixelDCSfilter"), consumesCollector(), *this);
genTriggerEventFlagStripDCSfilter_ = new GenericTriggerEventFlag(
iConfig.getParameter<edm::ParameterSet>("StripDCSfilter"), consumesCollector(), *this);
firstEvent = -1;
eventNb = 0;
// Detector Partitions
SubDetPhasePartMap["TIB"] = "TI";
SubDetPhasePartMap["TID__MINUS"] = "TI";
SubDetPhasePartMap["TID__PLUS"] = "TI";
SubDetPhasePartMap["TOB"] = "TO";
SubDetPhasePartMap["TEC__MINUS"] = "TM";
SubDetPhasePartMap["TEC__PLUS"] = "TP";
// get on/off option for every cluster from cfi
edm::ParameterSet ParametersnClusters = conf_.getParameter<edm::ParameterSet>("TH1nClusters");
layerswitchncluson = ParametersnClusters.getParameter<bool>("layerswitchon");
moduleswitchncluson = ParametersnClusters.getParameter<bool>("moduleswitchon");
edm::ParameterSet ParametersClusterCharge = conf_.getParameter<edm::ParameterSet>("TH1ClusterCharge");
layerswitchcluschargeon = ParametersClusterCharge.getParameter<bool>("layerswitchon");
moduleswitchcluschargeon = ParametersClusterCharge.getParameter<bool>("moduleswitchon");
subdetswitchcluschargeon = ParametersClusterCharge.getParameter<bool>("subdetswitchon");
edm::ParameterSet ParametersClusterStoN = conf_.getParameter<edm::ParameterSet>("TH1ClusterStoN");
layerswitchclusstonon = ParametersClusterStoN.getParameter<bool>("layerswitchon");
moduleswitchclusstonon = ParametersClusterStoN.getParameter<bool>("moduleswitchon");
edm::ParameterSet ParametersClusterStoNVsPos = conf_.getParameter<edm::ParameterSet>("TH1ClusterStoNVsPos");
layerswitchclusstonVsposon = ParametersClusterStoNVsPos.getParameter<bool>("layerswitchon");
moduleswitchclusstonVsposon = ParametersClusterStoNVsPos.getParameter<bool>("moduleswitchon");
edm::ParameterSet ParametersClusterPos = conf_.getParameter<edm::ParameterSet>("TH1ClusterPos");
layerswitchclusposon = ParametersClusterPos.getParameter<bool>("layerswitchon");
moduleswitchclusposon = ParametersClusterPos.getParameter<bool>("moduleswitchon");
edm::ParameterSet ParametersClusterDigiPos = conf_.getParameter<edm::ParameterSet>("TH1ClusterDigiPos");
layerswitchclusdigiposon = ParametersClusterDigiPos.getParameter<bool>("layerswitchon");
moduleswitchclusdigiposon = ParametersClusterDigiPos.getParameter<bool>("moduleswitchon");
edm::ParameterSet ParametersClusterNoise = conf_.getParameter<edm::ParameterSet>("TH1ClusterNoise");
layerswitchclusnoiseon = ParametersClusterNoise.getParameter<bool>("layerswitchon");
moduleswitchclusnoiseon = ParametersClusterNoise.getParameter<bool>("moduleswitchon");
edm::ParameterSet ParametersClusterWidth = conf_.getParameter<edm::ParameterSet>("TH1ClusterWidth");
layerswitchcluswidthon = ParametersClusterWidth.getParameter<bool>("layerswitchon");
moduleswitchcluswidthon = ParametersClusterWidth.getParameter<bool>("moduleswitchon");
subdetswitchcluswidthon = ParametersClusterWidth.getParameter<bool>("subdetswitchon");
edm::ParameterSet ParametersModuleLocalOccupancy = conf_.getParameter<edm::ParameterSet>("TH1ModuleLocalOccupancy");
layerswitchlocaloccupancy = ParametersModuleLocalOccupancy.getParameter<bool>("layerswitchon");
moduleswitchlocaloccupancy = ParametersModuleLocalOccupancy.getParameter<bool>("moduleswitchon");
edm::ParameterSet ParametersNrOfClusterizedStrips = conf_.getParameter<edm::ParameterSet>("TH1NrOfClusterizedStrips");
layerswitchnrclusterizedstrip = ParametersNrOfClusterizedStrips.getParameter<bool>("layerswitchon");
moduleswitchnrclusterizedstrip = ParametersNrOfClusterizedStrips.getParameter<bool>("moduleswitchon");
edm::ParameterSet ParametersClusterProf = conf_.getParameter<edm::ParameterSet>("TProfNumberOfCluster");
layerswitchnumclusterprofon = ParametersClusterProf.getParameter<bool>("layerswitchon");
edm::ParameterSet ParametersClusterWidthProf = conf_.getParameter<edm::ParameterSet>("TProfClusterWidth");
layerswitchclusterwidthprofon = ParametersClusterWidthProf.getParameter<bool>("layerswitchon");
edm::ParameterSet ParametersTotClusterProf = conf_.getParameter<edm::ParameterSet>("TProfTotalNumberOfClusters");
subdetswitchtotclusprofon = ParametersTotClusterProf.getParameter<bool>("subdetswitchon");
edm::ParameterSet ParametersTotClusterTH1 = conf_.getParameter<edm::ParameterSet>("TH1TotalNumberOfClusters");
subdetswitchtotclusth1on = ParametersTotClusterTH1.getParameter<bool>("subdetswitchon");
edm::ParameterSet ParametersClusterApvProf = conf_.getParameter<edm::ParameterSet>("TProfClustersApvCycle");
subdetswitchapvcycleprofon = ParametersClusterApvProf.getParameter<bool>("subdetswitchon");
edm::ParameterSet ParametersClustersApvTH2 = conf_.getParameter<edm::ParameterSet>("TH2ClustersApvCycle");
subdetswitchapvcycleth2on = ParametersClustersApvTH2.getParameter<bool>("subdetswitchon");
edm::ParameterSet ParametersApvCycleDBxProf2 = conf_.getParameter<edm::ParameterSet>("TProf2ApvCycleVsDBx");
subdetswitchapvcycledbxprof2on = ParametersApvCycleDBxProf2.getParameter<bool>("subdetswitchon");
edm::ParameterSet ParametersDBxCycleProf = conf_.getParameter<edm::ParameterSet>("TProfClustersVsDBxCycle");
subdetswitchdbxcycleprofon = ParametersDBxCycleProf.getParameter<bool>("subdetswitchon");
edm::ParameterSet ParametersCStripVsCPix = conf_.getParameter<edm::ParameterSet>("TH2CStripVsCpixel");
globalswitchcstripvscpix = ParametersCStripVsCPix.getParameter<bool>("globalswitchon");
edm::ParameterSet ParametersMultiplicityRegionsTH1 = conf_.getParameter<edm::ParameterSet>("TH1MultiplicityRegions");
globalswitchMultiRegions = ParametersMultiplicityRegionsTH1.getParameter<bool>("globalswitchon");
edm::ParameterSet ParametersApvCycleVsDBxGlobalTH2 = conf_.getParameter<edm::ParameterSet>("TH2ApvCycleVsDBxGlobal");
globalswitchapvcycledbxth2on = ParametersApvCycleVsDBxGlobalTH2.getParameter<bool>("globalswitchon");
edm::ParameterSet ParametersNoiseStrip2ApvCycle = conf_.getParameter<edm::ParameterSet>("TH1StripNoise2ApvCycle");
globalswitchstripnoise2apvcycle = ParametersNoiseStrip2ApvCycle.getParameter<bool>("globalswitchon");
edm::ParameterSet ParametersNoiseStrip3ApvCycle = conf_.getParameter<edm::ParameterSet>("TH1StripNoise3ApvCycle");
globalswitchstripnoise3apvcycle = ParametersNoiseStrip3ApvCycle.getParameter<bool>("globalswitchon");
edm::ParameterSet ParametersMainDiagonalPosition = conf_.getParameter<edm::ParameterSet>("TH1MainDiagonalPosition");
globalswitchmaindiagonalposition = ParametersMainDiagonalPosition.getParameter<bool>("globalswitchon");
edm::ParameterSet ClusterMultiplicityRegions = conf_.getParameter<edm::ParameterSet>("MultiplicityRegions");
k0 = ClusterMultiplicityRegions.getParameter<double>("k0");
q0 = ClusterMultiplicityRegions.getParameter<double>("q0");
dk0 = ClusterMultiplicityRegions.getParameter<double>("dk0");
maxClus = ClusterMultiplicityRegions.getParameter<double>("MaxClus");
minPix = ClusterMultiplicityRegions.getParameter<double>("MinPix");
edm::ParameterSet ParametersNclusVsCycleTimeProf2D = conf_.getParameter<edm::ParameterSet>("NclusVsCycleTimeProf2D");
globalswitchnclusvscycletimeprof2don = ParametersNclusVsCycleTimeProf2D.getParameter<bool>("globalswitchon");
edm::ParameterSet ParametersFEDCluster = conf_.getParameter<edm::ParameterSet>("TProfNClustersFED");
globalswitchFEDCluster = ParametersFEDCluster.getParameter<bool>("globalswitchon");
edm::ParameterSet ParametersClusWidthVsAmpTH2 = conf_.getParameter<edm::ParameterSet>("ClusWidthVsAmpTH2");
clusterWidth_vs_amplitude_on = ParametersClusWidthVsAmpTH2.getParameter<bool>("globalswitchon");
layer_clusterWidth_vs_amplitude_on = ParametersClusWidthVsAmpTH2.getParameter<bool>("layerswitchon");
subdet_clusterWidth_vs_amplitude_on = ParametersClusWidthVsAmpTH2.getParameter<bool>("subdetswitchon");
module_clusterWidth_vs_amplitude_on = ParametersClusWidthVsAmpTH2.getParameter<bool>("moduleswitchon");
clustertkhistomapon = conf_.getParameter<bool>("TkHistoMap_On");
clusterchtkhistomapon = conf_.getParameter<bool>("ClusterChTkHistoMap_On");
createTrendMEs = conf_.getParameter<bool>("CreateTrendMEs");
trendVs10Ls_ = conf_.getParameter<bool>("TrendVs10LS");
Mod_On_ = conf_.getParameter<bool>("Mod_On");
ClusterHisto_ = conf_.getParameter<bool>("ClusterHisto");
topFolderName_ = conf_.getParameter<std::string>("TopFolderName");
// Poducer name of input StripClusterCollection
clusterProducerStripToken_ =
consumes<edmNew::DetSetVector<SiStripCluster> >(conf_.getParameter<edm::InputTag>("ClusterProducerStrip"));
clusterProducerPixToken_ =
consumes<edmNew::DetSetVector<SiPixelCluster> >(conf_.getParameter<edm::InputTag>("ClusterProducerPix"));
/*
clusterProducerStrip_ =
conf_.getParameter<edm::InputTag>("ClusterProducerStrip"); clusterProducerPix_
= conf_.getParameter<edm::InputTag>("ClusterProducerPix");
*/
// cluster quality conditions
edm::ParameterSet cluster_condition = conf_.getParameter<edm::ParameterSet>("ClusterConditions");
applyClusterQuality_ = cluster_condition.getParameter<bool>("On");
sToNLowerLimit_ = cluster_condition.getParameter<double>("minStoN");
sToNUpperLimit_ = cluster_condition.getParameter<double>("maxStoN");
widthLowerLimit_ = cluster_condition.getParameter<double>("minWidth");
widthUpperLimit_ = cluster_condition.getParameter<double>("maxWidth");
// Event History Producer
// historyProducer_ = conf_.getParameter<edm::InputTag>("HistoryProducer");
historyProducerToken_ = consumes<EventWithHistory>(conf_.getParameter<edm::InputTag>("HistoryProducer"));
// Apv Phase Producer
// apvPhaseProducer_ = conf_.getParameter<edm::InputTag>("ApvPhaseProducer");
apvPhaseProducerToken_ = consumes<APVCyclePhaseCollection>(conf_.getParameter<edm::InputTag>("ApvPhaseProducer"));
// Create DCS Status
bool checkDCS = conf_.getParameter<bool>("UseDCSFiltering");
if (checkDCS)
dcsStatus_ = new SiStripDCSStatus(consumesCollector());
else
dcsStatus_ = nullptr;
}
SiStripMonitorCluster::~SiStripMonitorCluster() {
if (dcsStatus_)
delete dcsStatus_;
if (genTriggerEventFlagBPTXfilter_)
delete genTriggerEventFlagBPTXfilter_;
if (genTriggerEventFlagPixelDCSfilter_)
delete genTriggerEventFlagPixelDCSfilter_;
if (genTriggerEventFlagStripDCSfilter_)
delete genTriggerEventFlagStripDCSfilter_;
}
//--------------------------------------------------------------------------------------------
void SiStripMonitorCluster::dqmBeginRun(const edm::Run& run, const edm::EventSetup& es) {
// Initialize the GenericTriggerEventFlag
if (genTriggerEventFlagBPTXfilter_->on())
genTriggerEventFlagBPTXfilter_->initRun(run, es);
if (genTriggerEventFlagPixelDCSfilter_->on())
genTriggerEventFlagPixelDCSfilter_->initRun(run, es);
if (genTriggerEventFlagStripDCSfilter_->on())
genTriggerEventFlagStripDCSfilter_->initRun(run, es);
}
//--------------------------------------------------------------------------------------------
void SiStripMonitorCluster::createMEs(const edm::EventSetup& es, DQMStore::IBooker& ibooker) {
if (show_mechanical_structure_view) {
const TrackerTopology* const tTopo = &es.getData(trackerTopologyRunToken_);
const TkDetMap* tkDetMap = &es.getData(tkDetMapToken_);
const SiStripDetCabling& siStripDetCabling = es.getData(siStripDetCablingRunToken_);
// get list of active detectors from SiStripDetCabling
std::vector<uint32_t> activeDets;
siStripDetCabling.addActiveDetectorsRawIds(activeDets);
SiStripFolderOrganizer folder_organizer;
folder_organizer.setSiStripFolderName(topFolderName_);
folder_organizer.setSiStripFolder();
// Create TkHistoMap for Cluster
if (clustertkhistomapon) {
// std::cout << "[SiStripMonitorCluster::createMEs] topFolderName_: "
// << topFolderName_ << " ";
if ((topFolderName_ == "SiStrip") or (std::string::npos != topFolderName_.find("HLT")))
tkmapcluster =
std::make_unique<TkHistoMap>(tkDetMap, ibooker, topFolderName_, "TkHMap_NumberOfCluster", 0., true);
else
tkmapcluster = std::make_unique<TkHistoMap>(
tkDetMap, ibooker, topFolderName_ + "/TkHistoMap", "TkHMap_NumberOfCluster", 0., false);
}
if (clusterchtkhistomapon) {
if ((topFolderName_ == "SiStrip") or (std::string::npos != topFolderName_.find("HLT")))
tkmapclusterch =
std::make_unique<TkHistoMap>(tkDetMap, ibooker, topFolderName_, "TkHMap_ClusterCharge", 0., true);
else
tkmapclusterch = std::make_unique<TkHistoMap>(
tkDetMap, ibooker, topFolderName_ + "/TkHistoMap", "TkHMap_ClusterCharge", 0., false);
}
// loop over detectors and book MEs
edm::LogInfo("SiStripTkDQM|SiStripMonitorCluster") << "nr. of activeDets: " << activeDets.size();
for (std::vector<uint32_t>::iterator detid_iterator = activeDets.begin(); detid_iterator != activeDets.end();
detid_iterator++) {
uint32_t detid = (*detid_iterator);
// remove any eventual zero elements - there should be none, but just in
// case
if (detid == 0) {
activeDets.erase(detid_iterator);
continue;
}
if (Mod_On_) {
ModMEs mod_single;
// set appropriate folder using SiStripFolderOrganizer
folder_organizer.setDetectorFolder(detid, tTopo); // pass the detid to this method
if (reset_each_run)
ResetModuleMEs(detid);
createModuleMEs(mod_single, detid, ibooker, siStripDetCabling);
// append to ModuleMEsMap
ModuleMEsMap.insert(std::make_pair(detid, mod_single));
}
// Create Layer Level MEs if they are not created already
std::pair<std::string, int32_t> det_layer_pair = folder_organizer.GetSubDetAndLayer(detid, tTopo);
SiStripHistoId hidmanager;
std::string label = hidmanager.getSubdetid(detid, tTopo, false);
std::map<std::string, LayerMEs>::iterator iLayerME = LayerMEsMap.find(label);
if (iLayerME == LayerMEsMap.end()) {
// get detids for the layer
int32_t lnumber = det_layer_pair.second;
std::vector<uint32_t> layerDetIds;
if (det_layer_pair.first == "TIB") {
SiStripSubStructure::getTIBDetectors(activeDets, layerDetIds, tTopo, lnumber, 0, 0, 0);
} else if (det_layer_pair.first == "TOB") {
SiStripSubStructure::getTOBDetectors(activeDets, layerDetIds, tTopo, lnumber, 0, 0);
} else if (det_layer_pair.first == "TID" && lnumber > 0) {
SiStripSubStructure::getTIDDetectors(activeDets, layerDetIds, tTopo, 2, std::abs(lnumber), 0, 0);
} else if (det_layer_pair.first == "TID" && lnumber < 0) {
SiStripSubStructure::getTIDDetectors(activeDets, layerDetIds, tTopo, 1, std::abs(lnumber), 0, 0);
} else if (det_layer_pair.first == "TEC" && lnumber > 0) {
SiStripSubStructure::getTECDetectors(activeDets, layerDetIds, tTopo, 2, std::abs(lnumber), 0, 0, 0, 0);
} else if (det_layer_pair.first == "TEC" && lnumber < 0) {
SiStripSubStructure::getTECDetectors(activeDets, layerDetIds, tTopo, 1, std::abs(lnumber), 0, 0, 0, 0);
}
LayerDetMap[label] = layerDetIds;
// book Layer MEs
folder_organizer.setLayerFolder(detid, tTopo, det_layer_pair.second);
createLayerMEs(label, layerDetIds.size(), ibooker);
}
// book sub-detector plots
auto sdet_pair = folder_organizer.getSubDetFolderAndTag(detid, tTopo);
if (SubDetMEsMap.find(sdet_pair.second) == SubDetMEsMap.end()) {
ibooker.setCurrentFolder(sdet_pair.first);
createSubDetMEs(sdet_pair.second, ibooker);
}
} // end of loop over detectors
// Create Global Histogram
if (globalswitchapvcycledbxth2on) {
ibooker.setCurrentFolder(topFolderName_ + "/MechanicalView/");
edm::ParameterSet GlobalTH2Parameters = conf_.getParameter<edm::ParameterSet>("TH2ApvCycleVsDBxGlobal");
std::string HistoName = "DeltaBx_vs_ApvCycle";
GlobalApvCycleDBxTH2 = ibooker.book2D(HistoName,
HistoName,
GlobalTH2Parameters.getParameter<int32_t>("Nbinsx"),
GlobalTH2Parameters.getParameter<double>("xmin"),
GlobalTH2Parameters.getParameter<double>("xmax"),
GlobalTH2Parameters.getParameter<int32_t>("Nbinsy"),
GlobalTH2Parameters.getParameter<double>("ymin"),
GlobalTH2Parameters.getParameter<double>("ymax"));
GlobalApvCycleDBxTH2->setAxisTitle("APV Cycle (Corrected Absolute Bx % 70)", 1);
GlobalApvCycleDBxTH2->setAxisTitle("Delta Bunch Crossing Cycle", 2);
// plot DeltaBX ***************************
edm::ParameterSet GlobalTH1Parameters = conf_.getParameter<edm::ParameterSet>("TH1DBxGlobal");
HistoName = "DeltaBx";
GlobalDBxTH1 = ibooker.book1D(HistoName,
HistoName,
GlobalTH1Parameters.getParameter<int32_t>("Nbinsx"),
GlobalTH1Parameters.getParameter<double>("xmin"),
GlobalTH1Parameters.getParameter<double>("xmax"));
GlobalDBxTH1->setAxisTitle("Delta Bunch Crossing", 1);
// plot DeltaBXCycle ***************************
edm::ParameterSet DBxCycle = conf_.getParameter<edm::ParameterSet>("TH1DBxCycleGlobal");
HistoName = "DeltaBxCycle";
GlobalDBxCycleTH1 = ibooker.book1D(HistoName,
HistoName,
DBxCycle.getParameter<int32_t>("Nbinsx"),
DBxCycle.getParameter<double>("xmin"),
DBxCycle.getParameter<double>("xmax"));
GlobalDBxCycleTH1->setAxisTitle("Delta Bunch Crossing Cycle", 1);
}
if (globalswitchcstripvscpix) {
ibooker.setCurrentFolder(topFolderName_ + "/MechanicalView/");
edm::ParameterSet GlobalTH2Parameters = conf_.getParameter<edm::ParameterSet>("TH2CStripVsCpixel");
std::string HistoName = "StripClusVsPixClus";
GlobalCStripVsCpix = ibooker.book2D(HistoName,
HistoName,
GlobalTH2Parameters.getParameter<int32_t>("Nbinsx"),
GlobalTH2Parameters.getParameter<double>("xmin"),
GlobalTH2Parameters.getParameter<double>("xmax"),
GlobalTH2Parameters.getParameter<int32_t>("Nbinsy"),
GlobalTH2Parameters.getParameter<double>("ymin"),
GlobalTH2Parameters.getParameter<double>("ymax"));
GlobalCStripVsCpix->setAxisTitle("Strip Clusters", 1);
GlobalCStripVsCpix->setAxisTitle("Pix Clusters", 2);
// Absolute Bunch Crossing ***********************
edm::ParameterSet GlobalTH1Parameters = conf_.getParameter<edm::ParameterSet>("TH1ABx_CSCP");
HistoName = "AbsoluteBx_CStripVsCpixel";
GlobalABXTH1_CSCP = ibooker.book1D(HistoName,
HistoName,
GlobalTH1Parameters.getParameter<int32_t>("Nbinsx"),
GlobalTH1Parameters.getParameter<double>("xmin"),
GlobalTH1Parameters.getParameter<double>("xmax"));
GlobalABXTH1_CSCP->setAxisTitle("Absolute Bunch Crossing", 1);
}
if (globalswitchMultiRegions) {
ibooker.setCurrentFolder(topFolderName_ + "/MechanicalView/");
edm::ParameterSet GlobalTH2Parameters = conf_.getParameter<edm::ParameterSet>("TH1MultiplicityRegions");
std::string HistoName = "ClusterMultiplicityRegions";
PixVsStripMultiplicityRegions = ibooker.book1D(HistoName,
HistoName,
GlobalTH2Parameters.getParameter<int32_t>("Nbinx"),
GlobalTH2Parameters.getParameter<double>("xmin"),
GlobalTH2Parameters.getParameter<double>("xmax"));
PixVsStripMultiplicityRegions->setAxisTitle("");
PixVsStripMultiplicityRegions->setBinLabel(1, "Main Diagonal");
PixVsStripMultiplicityRegions->setBinLabel(2, "Strip Noise");
PixVsStripMultiplicityRegions->setBinLabel(3, "High Strip Noise");
PixVsStripMultiplicityRegions->setBinLabel(4, "Beam Background");
PixVsStripMultiplicityRegions->setBinLabel(5, "No Strip Clusters");
}
if (globalswitchmaindiagonalposition) {
ibooker.setCurrentFolder(topFolderName_ + "/MechanicalView/");
edm::ParameterSet GlobalTH1Parameters = conf_.getParameter<edm::ParameterSet>("TH1MainDiagonalPosition");
std::string HistoName = "MainDiagonal Position";
GlobalMainDiagonalPosition = ibooker.book1D(HistoName,
HistoName,
GlobalTH1Parameters.getParameter<int32_t>("Nbinsx"),
GlobalTH1Parameters.getParameter<double>("xmin"),
GlobalTH1Parameters.getParameter<double>("xmax"));
GlobalMainDiagonalPosition->setAxisTitle("atan(NPix/(k*NStrip))");
// PLOT MainDiagonalPosition_vs_BX ***************************
edm::ParameterSet GlobalTProfParameters = conf_.getParameter<edm::ParameterSet>("TProfMainDiagonalPosition");
HistoName = "MainDiagonalPosition_vs_BX";
GlobalMainDiagonalPosition_vs_BX = ibooker.bookProfile(HistoName,
HistoName,
GlobalTProfParameters.getParameter<int32_t>("Nbinsx"),
GlobalTProfParameters.getParameter<double>("xmin"),
GlobalTProfParameters.getParameter<double>("xmax"),
GlobalTProfParameters.getParameter<int32_t>("Nbinsy"),
GlobalTProfParameters.getParameter<double>("ymin"),
GlobalTProfParameters.getParameter<double>("ymax"));
GlobalMainDiagonalPosition_vs_BX->setAxisTitle("Absolute BX", 1);
GlobalMainDiagonalPosition_vs_BX->setAxisTitle("tan^{-1}(NPix/k*NStrip))", 2);
edm::ParameterSet GlobalTH2Parameters = conf_.getParameter<edm::ParameterSet>("TH2MainDiagonalPosition");
HistoName = "TH2MainDiagonalPosition_vs_BX";
GlobalTH2MainDiagonalPosition_vs_BX = ibooker.book2D(HistoName,
HistoName,
GlobalTH2Parameters.getParameter<int32_t>("Nbinsx"),
GlobalTH2Parameters.getParameter<double>("xmin"),
GlobalTH2Parameters.getParameter<double>("xmax"),
GlobalTH2Parameters.getParameter<int32_t>("Nbinsy"),
GlobalTH2Parameters.getParameter<double>("ymin"),
GlobalTH2Parameters.getParameter<double>("ymax"));
GlobalTH2MainDiagonalPosition_vs_BX->setAxisTitle("Absolute BX", 1);
GlobalTH2MainDiagonalPosition_vs_BX->setAxisTitle("tan^{-1}(NPix/k*NStrip))", 2);
}
// TO BE ADDED !!!
/*
if ( globalswitchapvcycledbxth2on or globalswitchcstripvscpix or
globalswitchMultiRegions or ClusterHisto_ ) {
ibooker.setCurrentFolder(topFolderName_+"/MechanicalView/");
std::string HistoName = "BPTX rate";
BPTXrateTrend = ibooker.bookProfile(HistoName,HistoName, LSBin, LSMin,
LSMax, 0, 10000.,""); BPTXrateTrend->getTH1()->SetCanExtend(TH1::kAllAxes);
BPTXrateTrend->setAxisTitle("#Lumi section",1);
BPTXrateTrend->setAxisTitle("Number of BPTX events per LS",2);
}
*/
if (globalswitchstripnoise2apvcycle) {
ibooker.setCurrentFolder(topFolderName_ + "/MechanicalView/");
edm::ParameterSet GlobalTH1Parameters = conf_.getParameter<edm::ParameterSet>("TH1StripNoise2ApvCycle");
std::string HistoName = "StripNoise_ApvCycle";
StripNoise2Cycle = ibooker.book1D(HistoName,
HistoName,
GlobalTH1Parameters.getParameter<int32_t>("Nbinsx"),
GlobalTH1Parameters.getParameter<double>("xmin"),
GlobalTH1Parameters.getParameter<double>("xmax"));
StripNoise2Cycle->setAxisTitle("APV Cycle");
}
if (globalswitchstripnoise3apvcycle) {
ibooker.setCurrentFolder(topFolderName_ + "/MechanicalView/");
edm::ParameterSet GlobalTH1Parameters = conf_.getParameter<edm::ParameterSet>("TH1StripNoise3ApvCycle");
std::string HistoName = "HighStripNoise_ApvCycle";
StripNoise3Cycle = ibooker.book1D(HistoName,
HistoName,
GlobalTH1Parameters.getParameter<int32_t>("Nbinsx"),
GlobalTH1Parameters.getParameter<double>("xmin"),
GlobalTH1Parameters.getParameter<double>("xmax"));
StripNoise3Cycle->setAxisTitle("APV Cycle");
}
if (globalswitchnclusvscycletimeprof2don) {
const char* HistoName = "StripClusVsBXandOrbit";
const char* HistoTitle =
"Strip cluster multiplicity vs BX mod(70) and Orbit;Event 1 BX "
"mod(70);time [Orb#]";
edm::ParameterSet ParametersNclusVsCycleTimeProf2D =
conf_.getParameter<edm::ParameterSet>("NclusVsCycleTimeProf2D");
NclusVsCycleTimeProf2D = ibooker.bookProfile2D(HistoName,
HistoTitle,
ParametersNclusVsCycleTimeProf2D.getParameter<int32_t>("Nbins"),
ParametersNclusVsCycleTimeProf2D.getParameter<double>("xmin"),
ParametersNclusVsCycleTimeProf2D.getParameter<double>("xmax"),
ParametersNclusVsCycleTimeProf2D.getParameter<int32_t>("Nbinsy"),
ParametersNclusVsCycleTimeProf2D.getParameter<double>("ymin"),
ParametersNclusVsCycleTimeProf2D.getParameter<double>("ymax"),
0,
0);
if (NclusVsCycleTimeProf2D->kind() == MonitorElement::Kind::TPROFILE2D)
NclusVsCycleTimeProf2D->setCanExtend(TH1::kAllAxes);
}
if (clusterWidth_vs_amplitude_on) {
ibooker.setCurrentFolder(topFolderName_ + "/MechanicalView/");
edm::ParameterSet ParametersClusWidthVsAmpTH2 = conf_.getParameter<edm::ParameterSet>("ClusWidthVsAmpTH2");
const char* HistoName = "ClusterWidths_vs_Amplitudes";
const char* HistoTitle =
"Cluster widths vs amplitudes;Amplitudes (integrated ADC "
"counts);Cluster widths";
ClusWidthVsAmpTH2 = ibooker.book2D(HistoName,
HistoTitle,
ParametersClusWidthVsAmpTH2.getParameter<int32_t>("Nbinsx"),
ParametersClusWidthVsAmpTH2.getParameter<double>("xmin"),
ParametersClusWidthVsAmpTH2.getParameter<double>("xmax"),
ParametersClusWidthVsAmpTH2.getParameter<int32_t>("Nbinsy"),
ParametersClusWidthVsAmpTH2.getParameter<double>("ymin"),
ParametersClusWidthVsAmpTH2.getParameter<double>("ymax"));
}
if (ClusterHisto_) {
ibooker.setCurrentFolder(topFolderName_ + "/MechanicalView/");
edm::ParameterSet PixelCluster = conf_.getParameter<edm::ParameterSet>("TH1NClusPx");
std::string HistoName = "NumberOfClustersInPixel";
NumberOfPixelClus = ibooker.book1D(HistoName,
HistoName,
PixelCluster.getParameter<int32_t>("Nbinsx"),
PixelCluster.getParameter<double>("xmin"),
PixelCluster.getParameter<double>("xmax"));
NumberOfPixelClus->setAxisTitle("# of Clusters in Pixel", 1);
NumberOfPixelClus->setAxisTitle("Number of Events", 2);
//
edm::ParameterSet StripCluster = conf_.getParameter<edm::ParameterSet>("TH1NClusStrip");
HistoName = "NumberOfClustersInStrip";
NumberOfStripClus = ibooker.book1D(HistoName,
HistoName,
StripCluster.getParameter<int32_t>("Nbinsx"),
StripCluster.getParameter<double>("xmin"),
StripCluster.getParameter<double>("xmax"));
NumberOfStripClus->setAxisTitle("# of Clusters in Strip", 1);
NumberOfStripClus->setAxisTitle("Number of Events", 2);
// NumberOfClustersinStrip vs BX PLOT ****************************
edm::ParameterSet StripClusterBX = conf_.getParameter<edm::ParameterSet>("TProfNClusStrip");
HistoName = "NumberOfClustersInStrip_vs_BX";
NumberOfStripClus_vs_BX = ibooker.bookProfile(HistoName,
HistoName,
StripClusterBX.getParameter<int32_t>("Nbinsx"),
StripClusterBX.getParameter<double>("xmin"),
StripClusterBX.getParameter<double>("xmax"),
StripClusterBX.getParameter<int32_t>("Nbinsy"),
StripClusterBX.getParameter<double>("ymin"),
StripClusterBX.getParameter<double>("ymax"));
NumberOfStripClus_vs_BX->setAxisTitle("Absolute BX", 1);
NumberOfStripClus_vs_BX->setAxisTitle("# of Clusters in Strip", 2);
// NumberOfClustersinStrip vs BX PLOT ****************************
edm::ParameterSet PixelClusterBX = conf_.getParameter<edm::ParameterSet>("TProfNClusPixel");
HistoName = "NumberOfClustersInPixel_vs_BX";
NumberOfPixelClus_vs_BX = ibooker.bookProfile(HistoName,
HistoName,
PixelClusterBX.getParameter<int32_t>("Nbinsx"),
PixelClusterBX.getParameter<double>("xmin"),
PixelClusterBX.getParameter<double>("xmax"),
PixelClusterBX.getParameter<int32_t>("Nbinsy"),
PixelClusterBX.getParameter<double>("ymin"),
PixelClusterBX.getParameter<double>("ymax"));
NumberOfPixelClus_vs_BX->setAxisTitle("Absolute BX", 1);
NumberOfPixelClus_vs_BX->setAxisTitle("# of Clusters in Pixel", 2);
if (globalswitchFEDCluster) {
// Number of clusters per FED
edm::ParameterSet FEDCluster = conf_.getParameter<edm::ParameterSet>("TProfNClustersFED");
HistoName = "NumberOfClustersinFED_v_FEDID";
NumberOfFEDClus = ibooker.bookProfile(HistoName,
HistoName,
FEDCluster.getParameter<int32_t>("Nbinsx"),
FEDCluster.getParameter<double>("xmin"),
FEDCluster.getParameter<double>("xmax"),
FEDCluster.getParameter<int32_t>("Nbinsy"),
FEDCluster.getParameter<double>("ymin"),
FEDCluster.getParameter<double>("ymax"),
"");
NumberOfFEDClus->setAxisTitle("FED ID", 1);
NumberOfFEDClus->setAxisTitle("Mean # of Cluster in FED", 2);
}
}
} // end of if
} // end of method
//--------------------------------------------------------------------------------------------
void SiStripMonitorCluster::bookHistograms(DQMStore::IBooker& ibooker, const edm::Run& run, const edm::EventSetup& es) {
if (show_mechanical_structure_view) {
unsigned long long cacheID = es.get<SiStripDetCablingRcd>().cacheIdentifier();
if (m_cacheID_ != cacheID) {
m_cacheID_ = cacheID;
edm::LogInfo("SiStripMonitorCluster") << "SiStripMonitorCluster::bookHistograms: "
<< " Creating MEs for new Cabling ";
createMEs(es, ibooker);
}
} else if (reset_each_run) {
edm::LogInfo("SiStripMonitorCluster") << "SiStripMonitorCluster::bookHistograms: "
<< " Resetting MEs ";
for (std::map<uint32_t, ModMEs>::const_iterator idet = ModuleMEsMap.begin(); idet != ModuleMEsMap.end(); idet++) {
ResetModuleMEs(idet->first);
}
}
}
//--------------------------------------------------------------------------------------------
void SiStripMonitorCluster::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
// Retrieve tracker topology from geometry
const TrackerTopology* const tTopo = &iSetup.getData(trackerTopologyEventToken_);
// Filter out events if Trigger Filtering is requested
passBPTXfilter_ = (iEvent.isRealData() and genTriggerEventFlagBPTXfilter_->on())
? genTriggerEventFlagBPTXfilter_->accept(iEvent, iSetup)
: true;
passPixelDCSfilter_ = (iEvent.isRealData() and genTriggerEventFlagPixelDCSfilter_->on())
? genTriggerEventFlagPixelDCSfilter_->accept(iEvent, iSetup)
: true;
passStripDCSfilter_ = (iEvent.isRealData() and genTriggerEventFlagStripDCSfilter_->on())
? genTriggerEventFlagStripDCSfilter_->accept(iEvent, iSetup)
: true;
// std::cout << "passBPTXfilter_ ? " << passBPTXfilter_ << std::endl;
// Filter out events if DCS Event if requested
bool passDCSFilter_ = !(dcsStatus_ && !dcsStatus_->getStatus(iEvent, iSetup));
runNb = iEvent.id().run();
eventNb++;
if (!iEvent.isRealData()) {
trendVar = trendVs10Ls_ ? iEvent.eventAuxiliary().luminosityBlock() / 10.f
: iEvent.eventAuxiliary().luminosityBlock(); // 10 lumisection : lumisection
} else {
trendVar = trendVs10Ls_ ? iEvent.orbitNumber() / (10 * 262144.0)
: iEvent.orbitNumber() / (1 * 262144.0); // 10 lumisection : lumisection
}
int NPixClusters = 0, NStripClusters = 0, MultiplicityRegion = 0;
bool isPixValid = false;
const SiStripNoises& siStripNoises = iSetup.getData(siStripNoisesToken_);
const SiStripGain& siStripGain = iSetup.getData(siStripGainToken_);
const SiStripQuality& siStripQuality = iSetup.getData(siStripQualityToken_);
const SiStripDetCabling& siStripDetCabling = iSetup.getData(siStripDetCablingEventToken_);
// get collection of DetSetVector of clusters from Event
edm::Handle<edmNew::DetSetVector<SiStripCluster> > cluster_detsetvektor;
iEvent.getByToken(clusterProducerStripToken_, cluster_detsetvektor);
// get pixel clusters
edm::Handle<edmNew::DetSetVector<SiPixelCluster> > cluster_detsetvektor_pix;
iEvent.getByToken(clusterProducerPixToken_, cluster_detsetvektor_pix);
if (!cluster_detsetvektor.isValid())
return;
const edmNew::DetSetVector<SiStripCluster>* StrC = cluster_detsetvektor.product();
NStripClusters = StrC->data().size();
if (cluster_detsetvektor_pix.isValid()) {
const edmNew::DetSetVector<SiPixelCluster>* PixC = cluster_detsetvektor_pix.product();
NPixClusters = PixC->data().size();
isPixValid = true;
MultiplicityRegion = FindRegion(NStripClusters, NPixClusters);
if (passBPTXfilter_ and passPixelDCSfilter_ and passStripDCSfilter_ and passDCSFilter_) {
if (globalswitchcstripvscpix)
GlobalCStripVsCpix->Fill(NStripClusters, NPixClusters);
if (globalswitchmaindiagonalposition && NStripClusters > 0)
GlobalMainDiagonalPosition->Fill(atan(NPixClusters / (k0 * NStripClusters)));
if (globalswitchMultiRegions)
PixVsStripMultiplicityRegions->Fill(MultiplicityRegion);
}
if (ClusterHisto_ and passDCSFilter_) {
if (passBPTXfilter_ and passPixelDCSfilter_)
NumberOfPixelClus->Fill(NPixClusters);
if (passBPTXfilter_ and passStripDCSfilter_)
NumberOfStripClus->Fill(NStripClusters);
}
}
// initialise # of clusters to zero
for (std::map<std::string, SubDetMEs>::iterator iSubdet = SubDetMEsMap.begin(); iSubdet != SubDetMEsMap.end();
iSubdet++) {
iSubdet->second.totNClusters = 0;
}
SiStripFolderOrganizer folder_organizer;
bool found_layer_me = false;
// Map of cumulative clusters per fed ID.
std::map<int, int> FEDID_v_clustersum;
for (std::map<std::string, std::vector<uint32_t> >::const_iterator iterLayer = LayerDetMap.begin();
iterLayer != LayerDetMap.end();
iterLayer++) {
std::string layer_label = iterLayer->first;
int ncluster_layer = 0;
std::map<std::string, LayerMEs>::iterator iLayerME = LayerMEsMap.find(layer_label);
// get Layer MEs
LayerMEs layer_single;
if (iLayerME != LayerMEsMap.end()) {
layer_single = iLayerME->second;
found_layer_me = true;
}
int ncluster_ring[20] = {0};
bool found_module_me = false;
uint16_t iDet = 0;
std::string subdet_label = "";
// loop over all modules in the layer
for (std::vector<uint32_t>::const_iterator iterDets = iterLayer->second.begin();
iterDets != iterLayer->second.end();
iterDets++) {
iDet++;
// detid and type of ME
uint32_t detid = (*iterDets);
// Get SubDet label once
if (subdet_label.empty())
subdet_label = folder_organizer.getSubDetFolderAndTag(detid, tTopo).second;
// DetId and corresponding set of MEs
ModMEs mod_single;
if (Mod_On_) {
std::map<uint32_t, ModMEs>::iterator imodME = ModuleMEsMap.find(detid);
if (imodME != ModuleMEsMap.end()) {
mod_single = imodME->second;
found_module_me = true;
}
} else
found_module_me = false;
edmNew::DetSetVector<SiStripCluster>::const_iterator isearch =
cluster_detsetvektor->find(detid); // search clusters of detid
if (isearch == cluster_detsetvektor->end() and passDCSFilter_) {
if (found_module_me && moduleswitchncluson && (mod_single.NumberOfClusters)) {
(mod_single.NumberOfClusters)->Fill(0.); // no clusters for this
// detector module,fill
// histogram with 0
}
if (clustertkhistomapon)
tkmapcluster->fill(detid, 0.);
if (clusterchtkhistomapon)
tkmapclusterch->fill(detid, 0.);
if (found_layer_me && layerswitchnumclusterprofon)
layer_single.LayerNumberOfClusterProfile->Fill(iDet, 0.0);
}
if (isearch == cluster_detsetvektor->end()) {
continue; // no clusters for this detid => jump to next step of loop
}
// cluster_detset is a structure, cluster_detset.data is a
// std::vector<SiStripCluster>, cluster_detset.id is uint32_t
// edmNew::DetSet<SiStripCluster> cluster_detset =
// (*cluster_detsetvektor)[detid]; // the statement above makes sure there
// exists an element with 'detid'
edmNew::DetSet<SiStripCluster> cluster_detset = (*isearch);
//////////////////////////////////////////////////////////////
// Get all FED connections associated with given detID.
// All connections for a detid have same FED Id therefore one FEDID is
// associated with a given detID. Vector of constant FedChannelConnection
// objects to variable pointers.
std::vector<const FedChannelConnection*> fedConnections = siStripDetCabling.getConnections(detid);
// Filling FED Id associated clusters map.
int good_fcc_index = -999;
for (unsigned int x = 0; x < fedConnections.size(); x++) {
if (fedConnections[x] != nullptr) {
good_fcc_index = x;
break;
}
}
if (good_fcc_index != -999 && fedConnections[good_fcc_index] != nullptr) {
int temp_fedid = fedConnections[good_fcc_index]->fedId();
if (FEDID_v_clustersum.find(temp_fedid) != FEDID_v_clustersum.end()) {
if (cluster_detset.size() < 1000 && !cluster_detset.empty()) {
FEDID_v_clustersum[temp_fedid] = FEDID_v_clustersum.find(temp_fedid)->second + cluster_detset.size();
}
} else {
if (cluster_detset.size() < 1000 && !cluster_detset.empty()) {
FEDID_v_clustersum[temp_fedid] = cluster_detset.size();
}
}
} else {
edm::LogInfo("SiStripMonitorCluster") << "SiStripMonitorCluster::analyze WARNING! no good connections "
"for detid = "
<< detid << endl;
}
//////////////////////////////////////////////////////////////
// Filling TkHistoMap with number of clusters for each module
if (clustertkhistomapon and passDCSFilter_) {
tkmapcluster->fill(detid, static_cast<float>(cluster_detset.size()));
}
if (moduleswitchncluson && found_module_me && (mod_single.NumberOfClusters != nullptr) &&
passDCSFilter_) { // nr. of clusters per module
(mod_single.NumberOfClusters)->Fill(static_cast<float>(cluster_detset.size()));
}
if (found_layer_me && layerswitchnumclusterprofon && passDCSFilter_)
layer_single.LayerNumberOfClusterProfile->Fill(iDet, static_cast<float>(cluster_detset.size()));
ncluster_layer += cluster_detset.size();
short total_clusterized_strips = 0;
SiStripNoises::Range detNoiseRange = siStripNoises.getRange(detid);
SiStripApvGain::Range detGainRange = siStripGain.getRange(detid);
SiStripQuality::Range qualityRange = siStripQuality.getRange(detid);
for (edmNew::DetSet<SiStripCluster>::const_iterator clusterIter = cluster_detset.begin();
clusterIter != cluster_detset.end();
clusterIter++) {
const auto& ampls = clusterIter->amplitudes();
// cluster position
float cluster_position = clusterIter->barycenter();
// start defined as nr. of first strip beloning to the cluster
short cluster_start = clusterIter->firstStrip();
// width defined as nr. of strips that belong to cluster
short cluster_width = ampls.size();
// add nr of strips of this cluster to total nr. of clusterized strips
total_clusterized_strips = total_clusterized_strips + cluster_width;
if (clusterchtkhistomapon and passDCSFilter_)
tkmapclusterch->fill(detid, static_cast<float>(clusterIter->charge()));
// cluster signal and noise from the amplitudes
float cluster_signal = 0.0;
float cluster_noise = 0.0;
int nrnonzeroamplitudes = 0;
float noise2 = 0.0;
float noise = 0.0;
for (uint iamp = 0; iamp < ampls.size(); iamp++) {
if (ampls[iamp] > 0) { // nonzero amplitude
cluster_signal += ampls[iamp];
if (!siStripQuality.IsStripBad(qualityRange, clusterIter->firstStrip() + iamp)) {
noise = siStripNoises.getNoise(clusterIter->firstStrip() + iamp, detNoiseRange) /
siStripGain.getStripGain(clusterIter->firstStrip() + iamp, detGainRange);
}
noise2 += noise * noise;
nrnonzeroamplitudes++;
}
} // End loop over cluster amplitude
if (nrnonzeroamplitudes > 0)
cluster_noise = sqrt(noise2 / nrnonzeroamplitudes);
if (applyClusterQuality_ &&
(cluster_signal / cluster_noise < sToNLowerLimit_ || cluster_signal / cluster_noise > sToNUpperLimit_ ||
cluster_width < widthLowerLimit_ || cluster_width > widthUpperLimit_))
continue;
ClusterProperties cluster_properties;
cluster_properties.charge = cluster_signal;
cluster_properties.position = cluster_position;
cluster_properties.start = cluster_start;
cluster_properties.width = cluster_width;
cluster_properties.noise = cluster_noise;
// Fill Module Level MEs
if (found_module_me and passDCSFilter_)
fillModuleMEs(mod_single, cluster_properties);
// Fill Layer Level MEs
if (found_layer_me and passDCSFilter_) {
fillLayerMEs(layer_single, cluster_properties);
if (layerswitchclusterwidthprofon)
layer_single.LayerClusterWidthProfile->Fill(iDet, cluster_width);
}
if (subdetswitchcluschargeon || subdetswitchcluswidthon) {
std::map<std::string, SubDetMEs>::iterator iSubdet = SubDetMEsMap.find(subdet_label);
if (iSubdet != SubDetMEsMap.end()) {
if (subdetswitchcluschargeon and passDCSFilter_)
iSubdet->second.SubDetClusterChargeTH1->Fill(cluster_signal);
if (subdetswitchcluswidthon and passDCSFilter_)
iSubdet->second.SubDetClusterWidthTH1->Fill(cluster_width);
}
}
if (subdet_clusterWidth_vs_amplitude_on and passDCSFilter_) {
std::map<std::string, SubDetMEs>::iterator iSubdet = SubDetMEsMap.find(subdet_label);
if (iSubdet != SubDetMEsMap.end())
iSubdet->second.SubDetClusWidthVsAmpTH2->Fill(cluster_signal, cluster_width);
}
if (clusterWidth_vs_amplitude_on and passDCSFilter_) {
ClusWidthVsAmpTH2->Fill(cluster_signal, cluster_width);
}
if (subdetswitchtotclusprofon &&
(subdet_label.find("TID") != std::string::npos || subdet_label.find("TEC") != std::string::npos)) {
std::pair<std::string, int32_t> det_ring_pair = folder_organizer.GetSubDetAndLayer(detid, tTopo, true);
ncluster_ring[std::abs(det_ring_pair.second)]++;
}
} // end loop over clusters
if (subdetswitchtotclusprofon) {
std::map<std::string, SubDetMEs>::iterator iSubdet = SubDetMEsMap.find(subdet_label);
std::pair<std::string, int32_t> det_layer_pair = folder_organizer.GetSubDetAndLayer(detid, tTopo);
iSubdet->second.SubDetNumberOfClusterPerLayerTrend->Fill(
trendVar, std::abs(det_layer_pair.second), ncluster_layer);
}
if (subdetswitchtotclusprofon &&
(subdet_label.find("TID") != std::string::npos || subdet_label.find("TEC") != std::string::npos)) {
std::pair<std::string, int32_t> det_ring_pair = folder_organizer.GetSubDetAndLayer(detid, tTopo, true);
layer_single.LayerNumberOfClusterPerRingTrend->Fill(
trendVar, std::abs(det_ring_pair.second), ncluster_ring[std::abs(det_ring_pair.second)]);
}
short total_nr_strips = siStripDetCabling.nApvPairs(detid) * 2 * 128; // get correct # of avp pairs
float local_occupancy = static_cast<float>(total_clusterized_strips) / static_cast<float>(total_nr_strips);
if (found_module_me and passDCSFilter_) {
if (moduleswitchnrclusterizedstrip && mod_single.NrOfClusterizedStrips) { // nr of clusterized strips
mod_single.NrOfClusterizedStrips->Fill(static_cast<float>(total_clusterized_strips));
}
if (moduleswitchlocaloccupancy && mod_single.ModuleLocalOccupancy) { // Occupancy
mod_single.ModuleLocalOccupancy->Fill(local_occupancy);
}
}
if (layerswitchlocaloccupancy && found_layer_me && layer_single.LayerLocalOccupancy && passDCSFilter_) {
fillME(layer_single.LayerLocalOccupancy, local_occupancy);
if (createTrendMEs)
fillME(layer_single.LayerLocalOccupancyTrend, trendVar, local_occupancy);
}
}
if (subdetswitchtotclusprofon)
fillME(layer_single.LayerNumberOfClusterTrend, trendVar, ncluster_layer);
std::map<std::string, SubDetMEs>::iterator iSubdet = SubDetMEsMap.find(subdet_label);
if (iSubdet != SubDetMEsMap.end())
iSubdet->second.totNClusters += ncluster_layer;
} /// end of layer loop
// EventHistory
edm::Handle<EventWithHistory> event_history;
iEvent.getByToken(historyProducerToken_, event_history);
// Phase of APV
edm::Handle<APVCyclePhaseCollection> apv_phase_collection;
iEvent.getByToken(apvPhaseProducerToken_, apv_phase_collection);
if (event_history.isValid() && !event_history.failedToGet() && apv_phase_collection.isValid() &&
!apv_phase_collection.failedToGet()) {
long long dbx = event_history->deltaBX();
long long tbx = event_history->absoluteBX();
bool global_histo_filled = false;
bool MultiplicityRegion_Vs_APVcycle_filled = false;
// plot n 2
if (passBPTXfilter_ and passPixelDCSfilter_ and passStripDCSfilter_ && passDCSFilter_) {
if (globalswitchcstripvscpix)
GlobalABXTH1_CSCP->Fill(tbx % 3564);
}
// plot n 2
for (std::map<std::string, SubDetMEs>::iterator it = SubDetMEsMap.begin(); it != SubDetMEsMap.end(); it++) {
std::string sdet = it->first;
// std::string sdet = sdet_tag.substr(0,sdet_tag.find_first_of("_"));
SubDetMEs sdetmes = it->second;