46 const double NORBITS_PER_LS = 262144.;
53 show_mechanical_structure_view(
true),
54 show_readout_view(
false),
55 show_control_view(
false),
56 select_all_detectors(
true),
57 reset_each_run(
false),
75 for (
auto const&
tag : digiProducerList) {
187 if (subdetswitchtotdigifailureon) {
218 edm::LogInfo(
"SiStripMonitorDigi") <<
"SiStripMonitorDigi::bookHistograms: "
219 <<
" Creating MEs for new Cabling ";
223 edm::LogInfo(
"SiStripMonitorDigi") <<
"SiStripMonitorDigi::bookHistograms: "
224 <<
" Resetting MEs ";
225 for (std::map<uint32_t, ModMEs>::const_iterator idet =
DigiMEs.begin(); idet !=
DigiMEs.end(); idet++) {
255 std::vector<int> FedsInIds = sumFED->m_fed_in;
256 for (
unsigned int it = 0; it < FedsInIds.size(); ++it) {
257 int fedID = FedsInIds[it];
260 if (fedID >= 50 && fedID <= 133)
262 if (fedID >= 134 && fedID <= 148)
264 if (fedID >= 149 && fedID <= 163)
266 if (fedID >= 164 && fedID <= 259)
268 if (fedID >= 260 && fedID <= 355)
270 if (fedID >= 356 && fedID <= 489)
281 bool isStableBeams =
false;
282 return std::make_shared<bool>(isStableBeams);
288 const bool isStableBeams = luminosityBlockCache(lb.
index());
295 int nFeds[6] = {96, 96, 84, 15, 15, 134};
299 for (
int ibin = 1; ibin < 7; ibin++) {
309 (
float)nFedsConnected[ibin - 1] / nFeds[ibin - 1] > 0.5 && value < 50.) {
335 for (std::vector<uint32_t>::iterator idets = activeDets.begin(); idets != activeDets.end(); idets++) {
337 activeDets.erase(idets);
351 std::make_unique<TkHistoMap>(tkDetMap, ibooker,
topFolderName_,
"TkHMap_NStripApvShots", 0.0,
true);
354 std::make_unique<TkHistoMap>(tkDetMap, ibooker,
topFolderName_,
"TkHMap_MedianChargeApvShots", 0.0,
true);
356 std::vector<uint32_t> tibDetIds;
359 edm::LogInfo(
"SiStripTkDQM|SiStripMonitorDigi") <<
"nr. of activeDets: " << activeDets.size();
360 for (std::vector<uint32_t>::const_iterator detid_iterator = activeDets.begin(); detid_iterator != activeDets.end();
362 uint32_t detid = (*detid_iterator);
381 DigiMEs.insert(std::make_pair(detid, local_modmes));
385 std::pair<std::string, int32_t> det_layer_pair = folder_organizer.
GetSubDetAndLayer(detid, tTopo);
390 std::map<std::string, LayerMEs>::iterator iLayerME =
LayerMEsMap.find(label);
393 int32_t lnumber = det_layer_pair.second;
394 std::vector<uint32_t> layerDetIds;
395 if (det_layer_pair.first ==
"TIB") {
397 }
else if (det_layer_pair.first ==
"TOB") {
399 }
else if (det_layer_pair.first ==
"TID" && lnumber > 0) {
401 }
else if (det_layer_pair.first ==
"TID" && lnumber < 0) {
403 }
else if (det_layer_pair.first ==
"TEC" && lnumber > 0) {
405 }
else if (det_layer_pair.first ==
"TEC" && lnumber < 0) {
412 folder_organizer.
setLayerFolder(detid, tTopo, det_layer_pair.second);
419 ibooker.setCurrentFolder(sdet_pair.first);
427 ibooker.setCurrentFolder(topFolderName_ +
"/MechanicalView/");
430 const char*
HistoName =
"Summary Mean Apv shots for SubDets";
431 NApvShotsGlobalProf = ibooker.bookProfile(HistoName, HistoName, 6, 0.5, 6.5, 100, 0., 0.,
"");
444 const char*
HistoName =
"NApv_Shots_vs_Time";
463 const char*
HistoName =
"Number_of_Strips_in_Apv_Shots";
475 const char*
HistoName =
"Number_of_Apv_Shots";
488 const char*
HistoName =
"Apv_Shots_Charge_Median";
501 const char*
HistoName =
"Apv_Shots_Apv_Number";
513 const char*
HistoName =
"NumberOfDigisinFED_v_FEDID";
535 std::stringstream
ss;
538 ibooker.setCurrentFolder(ss.str());
541 const char*
HistoName =
"NumberOfDigisInLastLS";
595 std::vector<edm::EDGetTokenT<edm::DetSetVector<SiStripDigi> > >::const_iterator iToken =
609 iSubdet->second.totNDigis = 0;
610 iSubdet->second.SubDetApvShots.clear();
613 std::map<int, int> FEDID_v_digisum;
620 std::vector<uint32_t> layer_dets = iterLayer->second;
621 std::map<std::string, LayerMEs>::iterator iLayerME =
LayerMEsMap.find(layer_label);
629 local_layermes = iLayerME->second;
631 int largest_adc_layer = 0;
632 int smallest_adc_layer = 99999;
641 for (std::vector<uint32_t>::const_iterator iterDets = layer_dets.begin(); iterDets != layer_dets.end();
646 uint32_t detid = (*iterDets);
649 if (subdet_label.empty())
654 std::map<uint32_t, ModMEs>::iterator pos =
DigiMEs.find(detid);
655 ModMEs local_modmes = pos->second;
673 int good_fcc_index = -999;
674 for (
unsigned int x = 0;
x < fedConnections.size();
x++) {
675 if (fedConnections[
x] !=
nullptr) {
680 if (fedConnections[good_fcc_index] !=
nullptr) {
681 int temp_fedid = fedConnections[good_fcc_index]->fedId();
682 if (FEDID_v_digisum.find(temp_fedid) != FEDID_v_digisum.end()) {
683 if (ndigi_det < 1000 && ndigi_det > 0) {
684 FEDID_v_digisum[temp_fedid] = FEDID_v_digisum.find(temp_fedid)->second + ndigi_det;
687 if (ndigi_det < 1000 && ndigi_det > 0) {
688 FEDID_v_digisum[temp_fedid] = ndigi_det;
693 <<
"SiStripMonitorDigi::analyze WARNING! no good connections for detid = " << detid << std::endl;
698 const std::vector<APVShot>& shots = theShotFinder.
getShots();
722 ndigi_layer += ndigi_det;
725 int largest_adc = (digi_detset.
data.begin())->
adc();
726 int smallest_adc = (digi_detset.
data.begin())->
adc();
729 float det_occupancy = 0.0;
732 digiIter != digi_detset.
data.end();
734 int this_adc = digiIter->adc();
739 if (this_adc > largest_adc)
740 largest_adc = this_adc;
741 if (this_adc < smallest_adc)
742 smallest_adc = this_adc;
749 (local_modmes.
DigiADCs)->Fill(static_cast<float>(this_adc));
765 if (nstrips > 0 && det_occupancy > 0) {
766 det_occupancy = det_occupancy / nstrips;
776 if (largest_adc > largest_adc_layer)
777 largest_adc_layer = largest_adc;
778 if (smallest_adc < smallest_adc_layer)
779 smallest_adc_layer = smallest_adc;
807 std::map<std::string, SubDetMEs>::iterator iSubdet =
SubDetMEsMap.find(subdet_label);
809 iSubdet->second.totNDigis += ndigi_layer;
825 edm::LogInfo(
"DQMProvInfo") <<
" gtfeEvmWord inaccessible";
828 if (gtfeEvmExtWord.
beamMode() == 11)
829 isStableBeams =
true;
834 if (strcmp(it->first.c_str(),
"TEC__MINUS") == 0) {
836 }
else if (strcmp(it->first.c_str(),
"TEC__PLUS") == 0) {
838 }
else if (strcmp(it->first.c_str(),
"TIB") == 0) {
840 }
else if (strcmp(it->first.c_str(),
"TID__MINUS") == 0) {
842 }
else if (strcmp(it->first.c_str(),
"TID__PLUS") == 0) {
844 }
else if (strcmp(it->first.c_str(),
"TOB") == 0) {
850 if (strcmp(it->first.c_str(),
"TEC__MINUS") == 0) {
852 }
else if (strcmp(it->first.c_str(),
"TEC__PLUS") == 0) {
854 }
else if (strcmp(it->first.c_str(),
"TIB") == 0) {
856 }
else if (strcmp(it->first.c_str(),
"TID__MINUS") == 0) {
858 }
else if (strcmp(it->first.c_str(),
"TID__PLUS") == 0) {
860 }
else if (strcmp(it->first.c_str(),
"TOB") == 0) {
878 for (
uint i = 0;
i < ShotsSize;
908 std::map<int, int>::iterator it;
909 for (it = FEDID_v_digisum.begin(); it != FEDID_v_digisum.end(); it++) {
925 long long tbx = event_history->absoluteBX();
930 subdetmes = it->second;
933 long long tbx_corr = tbx;
940 tbx_corr -= the_phase;
951 std::map<uint32_t, ModMEs>::iterator pos =
DigiMEs.find(idet);
952 ModMEs mod_me = pos->second;
969 const char* ParameterSetLabel,
987 me->setAxisTitle(
"Lumisection", 1);
989 me->setCanExtend(TH1::kAllAxes);
995 const char* ParameterSetLabel,
998 return ibooker.
book1D(HistoName,
1009 me->
Fill(timeinorbit, value);
1022 hid = hidmanager.
createHistoId(
"NumberOfDigis",
"det", detid);
1030 hid = hidmanager.
createHistoId(
"NumberOfDigisPerStrip",
"det", detid);
1038 hid = hidmanager.
createHistoId(
"ADCsHottestStrip",
"det", detid);
1045 hid = hidmanager.
createHistoId(
"ADCsCoolestStrip",
"det", detid);
1059 hid = hidmanager.
createHistoId(
"StripOccupancy",
"det", detid);
1070 std::map<std::string, LayerMEs>::iterator iLayerME =
LayerMEsMap.find(label);
1092 hidmanager.
createHistoLayer(
"Summary_TotalNumberOfDigis",
"layer", label,
"").c_str());
1097 hidmanager.
createHistoLayer(
"Trend_NumberOfDigis",
"layer", label,
"").c_str());
1104 "TH1ADCsHottestStrip",
1105 hidmanager.
createHistoLayer(
"Summary_ADCsHottestStrip",
"layer", label,
"").c_str());
1109 "TH1ADCsHottestStrip",
1110 hidmanager.
createHistoLayer(
"Trend_ADCsHottestStrip",
"layer", label,
"").c_str());
1117 "TH1ADCsCoolestStrip",
1118 hidmanager.
createHistoLayer(
"Summary_ADCsCoolestStrip",
"layer", label,
"").c_str());
1122 "TH1ADCsCoolestStrip",
1123 hidmanager.
createHistoLayer(
"Trend_ADCsCoolestStrip",
"layer", label,
"").c_str());
1132 ibooker,
"TH1DigiADCs", hidmanager.
createHistoLayer(
"Trend_DigiADCs",
"layer", label,
"").c_str());
1139 "TH1StripOccupancy",
1140 hidmanager.
createHistoLayer(
"Summary_StripOccupancy",
"layer", label,
"").c_str());
1144 "TH1StripOccupancy",
1145 hidmanager.
createHistoLayer(
"Trend_StripOccupancy",
"layer", label,
"").c_str());
1183 HistoName =
"TotalNumberOfDigiProfile__" +
label;
1202 HistoName =
"Digi_vs_ApvCycle__" +
label;
1219 HistoName =
"Digi_vs_ApvCycle_2D__" +
label;
1221 double h2ymax = 9999.0;
1222 double yfact = Parameters.
getParameter<
double>(
"yfactor");
1223 if (label.find(
"TIB") != std::string::npos)
1224 h2ymax = (6984. * 256.) * yfact;
1225 else if (label.find(
"TID") != std::string::npos)
1226 h2ymax = (2208. * 256.) * yfact;
1227 else if (label.find(
"TOB") != std::string::npos)
1228 h2ymax = (12906. * 256.) * yfact;
1229 else if (label.find(
"TEC") != std::string::npos)
1230 h2ymax = (7552. * 2. * 256.) * yfact;
1232 ibooker.
book2D(HistoName,
1247 HistoName =
"Number_of_Apv_Shots_" +
label;
1260 HistoName =
"Number_of_Strips_in_Apv_Shots_" +
label;
1273 HistoName =
"Apv_Shots_Charge_Median_" +
label;
1285 HistoName =
"Apv_Shots_Apv_Number_" +
label;
1297 HistoName =
"NApv_Shots_vs_Time_" +
label;
1331 std::vector<APVShot>& subdetShots) {
1332 for (
uint i = 0;
i < moduleShots.size();
i++) {
1333 subdetShots.push_back(moduleShots[
i]);
1338 for (
uint i = 0;
i < shots.size();
i++) {
LuminosityBlockID id() const
void ResetModuleMEs(uint32_t idet)
bool subdetswitchapvcycleth2on
std::optional< T > tryToGet() const
std::map< std::string, LayerMEs > LayerMEsMap
void getTIBDetectors(const std::vector< uint32_t > &inputDetRawIds, std::vector< uint32_t > &tibDetRawIds, const TrackerTopology *trackerTopology, uint32_t layer=0, uint32_t bkw_frw=0, uint32_t int_ext=0, uint32_t string=0)
bool globalswitchNDigisFEDID
bool moduleswitchnumdigison
void addActiveDetectorsRawIds(std::vector< uint32_t > &) const
int integrateNLumisections_
virtual DQM_DEPRECATED void setCanExtend(unsigned int value)
void createMEs(DQMStore::IBooker &ibooker, const edm::EventSetup &es)
MonitorElement * LayerNumberOfDigisTrend
std::pair< const std::string, const char * > getSubDetFolderAndTag(const uint32_t &detid, const TrackerTopology *tTopo)
LuminosityBlockIndex index() const
MonitorElement * SubDetTotDigiProf
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
MonitorElement * LayerStripOccupancy
bool globalswitchapvshotsonprof
bool layerswitchdigiadcson
MonitorElement * LayerADCsHottestStrip
bool layerswitchnumdigisprofon
bool subdetswitchapvshotsApvon
MonitorElement * SubDetDigiFailures2D
edm::InputTag historyProducer_
const L1GtfeExtWord gtfeWord() const
get / set GTFE word (record) in the GT readout record
MonitorElement * LayerADCsHottestStripTrend
std::unique_ptr< TkHistoMap > tkmapNstripApvshot
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoTokenRun_
void getTIDDetectors(const std::vector< uint32_t > &inputDetRawIds, std::vector< uint32_t > &tidDetRawIds, const TrackerTopology *trackerTopology, uint32_t side=0, uint32_t wheel=0, uint32_t ring=0, uint32_t ster=0)
Kind kind() const
Get the type of the monitor element.
MonitorElement * NApvShotsGlobalProf
std::map< uint32_t, ModMEs > DigiMEs
std::map< std::string, std::string > SubDetPhasePartMap
void getLayerFolderName(std::stringstream &ss, uint32_t rawdetid, const TrackerTopology *tTopo, bool ring_flag=false)
MonitorElement * MedianChargeApvShotsGlobal
MonitorElement * StripMultiplicityApvShotsGlobal
const SiStripDetCabling * SiStripDetCabling_
bool globalsummaryapvshotson
void setLayerFolder(uint32_t rawdetid, const TrackerTopology *tTopo, int32_t layer=0, bool ring_flag=false)
bool layerswitchdigiadcprofon
MonitorElement * SubDetDigiApvTH2
MonitorElement * StripOccupancy
bool subdetswitchtotdigiprofon
MonitorElement * SubDetDigiApvProf
edm::ESGetToken< RunInfo, RunInfoRcd > runInfoTokenRun_
void getTECDetectors(const std::vector< uint32_t > &inputDetRawIds, std::vector< uint32_t > &tecDetRawIds, const TrackerTopology *trackerTopology, uint32_t side=0, uint32_t wheel=0, uint32_t petal_bkw_frw=0, uint32_t petal=0, uint32_t ring=0, uint32_t ster=0)
edm::ESGetToken< TkDetMap, TrackerTopologyRcd > tkDetMapTokenRun_
std::unique_ptr< TkHistoMap > tkmapMedianChargeApvshots
MonitorElement * LayerNumberOfDigisProfile
tuple nStrips
1.2 is to make the matching window safely the two nearest strips 0.35 is the size of an ME0 chamber i...
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
bool globalswitchnapvshotson
void dqmBeginRun(const edm::Run &r, const edm::EventSetup &c) override
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
bool subdetswitchchargemedianapvshotson
std::vector< APVShot > SubDetApvShots
void setDetectorFolder(uint32_t rawdetid, const TrackerTopology *tTopo)
unsigned long long m_cacheID_
MonitorElement * SubDetNApvShotsNApvTH1
void createSubDetMEs(DQMStore::IBooker &ibooker, std::string label)
bool getData(T &iHolder) const
const std::vector< const FedChannelConnection * > & getConnections(uint32_t det_id) const
virtual void Reset()
Remove all data from the ME, keept the empty histogram with all its settings.
void globalEndLuminosityBlock(const edm::LuminosityBlock &lumi, const edm::EventSetup &iSetup) override
bool getStatus(edm::Event const &e, edm::EventSetup const &eSetup)
MonitorElement * NumberOfDigisPerStrip
const std::vector< APVShot > & getShots() const
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken_
bool subdetswitchapvcycleprofon
MonitorElement * ADCsCoolestStrip
vector< ParameterSet > Parameters
bool moduleswitchadchotteston
bool globalswitchapvshotsApvon
SiStripDCSStatus * dcsStatus_
MonitorElement * bookProfile(TString const &name, TString const &title, int nchX, double lowX, double highX, int, double lowY, double highY, char const *option="s", FUNC onbooking=NOOP())
MonitorElement * LayerADCsCoolestStripTrend
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
MonitorElement * SubDetNStripsApvShotsTH1
bool shotsstripshistomapon
DigiFailureMEs digiFailureMEs
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
edm::EDGetTokenT< EventWithHistory > historyProducerToken_
MonitorElement * SubDetTotDigiProfLS
std::vector< uint32_t > activeDets
void fillME(MonitorElement *ME, float value1)
MonitorElement * bookME1D(DQMStore::IBooker &ibooker, const char *ParameterSetLabel, const char *HistoName)
MonitorElement * LayerDigiADCs
MonitorElement * LayerNumberOfDigis
MonitorElement * NApvApvShotsGlobal
Abs< T >::type abs(const T &t)
std::vector< float > vecSubDetTotDigiProfLS
bool layerswitchnumdigison
LuminosityBlock const & getLuminosityBlock() const
std::shared_ptr< bool > globalBeginLuminosityBlock(const edm::LuminosityBlock &lumi, const edm::EventSetup &iSetup) const override
edm::ESGetToken< SiStripDetCabling, SiStripDetCablingRcd > SiStripDetCablingTokenRun_
bool globalswitchnstripsapvshotson
std::map< std::string, SubDetMEs > SubDetMEsMap
std::string getSubdetid(uint32_t id, const TrackerTopology *tTopo, bool flag_ring)
MonitorElement * ADCsHottestStrip
virtual void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
virtual double getBinContent(int binx) const
get content of bin (1-D)
bool shotschargehistomapon
void createLayerMEs(DQMStore::IBooker &ibooker, std::string label, int ndet)
void fillTrend(MonitorElement *me, float value, float timeinorbit)
MonitorElement * SubDetNApvShotsProf
edm::EDGetTokenT< L1GlobalTriggerEvmReadoutRecord > gtEvmToken_
MonitorElement * NApvShotsGlobal
std::vector< edm::EDGetTokenT< edm::DetSetVector< SiStripDigi > > > digiProducerTokenList
MonitorElement * LayerDigiADCProfile
bool moduleswitchstripoccupancyon
SiStripHistoId hidmanager
bool subdetswitchtotdigifailureon
std::vector< const edm::DetSetVector< SiStripDigi > * > digi_detset_handles
~SiStripMonitorDigi() override
Log< level::Info, false > LogInfo
int getDigiSourceIndex(uint32_t id)
void analyze(const edm::Event &, const edm::EventSetup &) override
SiStripMonitorDigi(const edm::ParameterSet &)
edm::InputTag apvPhaseProducer_
std::unique_ptr< TkHistoMap > tkmapNApvshots
MonitorElement * NumberOfDigis
T const * product() const
std::string createHistoId(std::string description, std::string id_type, uint32_t component_id)
MonitorElement * SubDetChargeMedianApvShotsTH1
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
void fill(DetId detid, float value)
bool moduleswitchadccooleston
T getParameter(std::string const &) const
SiStripFolderOrganizer folder_organizer
LuminosityBlockNumber_t luminosityBlock() const
virtual DQM_DEPRECATED void setStatOverflows(bool value)
MonitorElement * bookMETrend(DQMStore::IBooker &ibooker, const char *ParameterSetLabel, const char *HistoName)
std::map< std::string, std::vector< uint32_t > > LayerDetMap
bool globalswitchchargemedianapvshotson
std::string topFolderName_
std::pair< std::string, int32_t > GetSubDetAndLayer(const uint32_t &detid, const TrackerTopology *tTopo, bool ring_flag=false)
bool subdetswitchnstripsapvshotson
std::unique_ptr< TkHistoMap > tkmapdigi
std::vector< edm::InputTag > digiProducerList
const uint16_t nApvPairs(uint32_t det_id) const
edm::EDGetTokenT< APVCyclePhaseCollection > apvPhaseProducerToken_
bool layerswitchadchotteston
MonitorElement * LayerStripOccupancyTrend
bool moduleswitchnumdigispstripon
MonitorElement * LayerADCsCoolestStrip
int ignoreFirstNLumisections_
bool moduleswitchdigiadcson
bool layerswitchstripoccupancyon
MonitorElement * SubDetNApvShotsTH1
void AddApvShotsToSubDet(const std::vector< APVShot > &, std::vector< APVShot > &)
SiStripFolderOrganizer folder_organizer
bool subdetswitchapvshotsonprof
MonitorElement * ShotsVsTimeApvShotsGlobal
MonitorElement * DigiADCs
void getTOBDetectors(const std::vector< uint32_t > &inputDetRawIds, std::vector< uint32_t > &tobDetRawIds, const TrackerTopology *trackerTopology, uint32_t layer=0, uint32_t bkw_frw=0, uint32_t rod=0)
std::string createHistoLayer(std::string description, std::string id_type, std::string path, std::string flag)
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
collection_type::const_iterator const_iterator
collection_type::const_iterator const_iterator
const cms_uint16_t beamMode() const
void FillApvShotsMap(TkHistoMap *, const std::vector< APVShot > &, uint32_t id, int)
MonitorElement * LayerDigiADCsTrend
MonitorElement * NumberOfFEDDigis
bool show_mechanical_structure_view
bool layerswitchadccooleston
void createModuleMEs(DQMStore::IBooker &ibooker, ModMEs &mod_single, uint32_t detid)
uint16_t *__restrict__ uint16_t const *__restrict__ adc
bool subdetswitchnapvshotson
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)