194 static constexpr
int stationBinOrder[
NStationMAX] = {0, 4, 1};
195 return (
arm * 2 + stationBinOrder[stn] + 1);
218 :
verbosity(ps.getUntrackedParameter<unsigned
int>(
"verbosity", 0)),
220 rpStatusWord(ps.getUntrackedParameter<unsigned
int>(
"RPStatusWord", 0x8008)) {
231 vector<string> disabledPlanePlotsVec =
235 for (
auto s : disabledPlanePlotsVec) {
237 if (
count(
s.begin(),
s.end(),
'_') != 3)
238 throw cms::Exception(
"RPixPlaneCombinatoryTracking") <<
"Invalid string in turnOffPlanePlots: " <<
s;
240 vector<string> armStationRpPlane;
242 while ((
pos =
s.find(
'_')) != string::npos) {
243 armStationRpPlane.push_back(
s.substr(0,
pos));
246 armStationRpPlane.push_back(
s);
248 int arm = stoi(armStationRpPlane.at(0));
249 int station = stoi(armStationRpPlane.at(1));
250 int rp = stoi(armStationRpPlane.at(2));
251 int plane = stoi(armStationRpPlane.at(3));
256 <<
"Shutting off plots for: Arm " <<
arm <<
" Station " <<
station <<
" Rp " << rp <<
" Plane " << plane;
259 throw cms::Exception(
"RPixPlaneCombinatoryTracking") <<
"Invalid string in turnOffPlanePlots: " <<
s;
289 rpSts = (rpSts >> 1);
297 for (
int ind = 0; ind < 2 * 3 *
NRPotsMAX; ind++)
310 string armTitleShort, stnTitleShort;
312 TAxis *yah1st =
nullptr;
313 TAxis *xaRPact =
nullptr;
314 TAxis *xah1trk =
nullptr;
316 hBX = ibooker.
book1D(
"events per BX",
"ctpps_pixel;Event.BX", 4002, -1.5, 4000. + 0.5);
317 hBXshort = ibooker.
book1D(
"events per BX(short)",
"ctpps_pixel;Event.BX", 102, -1.5, 100. + 0.5);
319 string str1st =
"Pixel planes activity";
323 h1st->SetOption(
"colz");
324 yah1st = h1st->GetYaxis();
326 string str2 =
"Pixel RP active";
334 str2 =
"Pixel Local Tracks";
342 const float minErrCode = 25.;
350 "Event number mismatch",
351 "Invalid/no FED header",
352 "Invalid/no FED trailer",
354 "Conversion: inv. channel",
355 "Conversion: inv. ROC number",
356 "Conversion: inv. pixel address",
361 const string tbmMessage[8] = {
"Stack full ",
363 "Clear trigger counter",
365 "Synch trigger error",
370 const string tbmType[5] = {
371 "All bits 0",
"bit 8 : Overflow",
"bit 9 : PKAM",
"bit 10 : Auto Reset",
"bit 11 : Number of ROC Error"};
374 "Errors in Unidentified Det;;fed",
381 for (
unsigned int iBin = 1; iBin <=
errCodeSize; iBin++)
387 ibooker.
book2D(
"TBM Message Unid Det",
"TBM Message Unid Det;;fed", 8, -0.5, 7.5, 2, 1461.5, 1463.5);
388 for (
unsigned int iBin = 1; iBin <= 8; iBin++)
393 ibooker.
book2D(
"TBM Type in Unid Det",
"TBM Type in Unid Det;;fed", 5, -0.5, 4.5, 2, 1461.5, 1463.5);
394 for (
unsigned int iBin = 1; iBin <= 5; iBin++)
398 h2FullType = ibooker.
book2D(
"Full FIFO",
"Full FIFO;;fed", 7, 0.5, 7.5, 2, 1461.5, 1463.5);
408 "Errors in FED" + s_fed +
";;channel",
415 for (
unsigned int iBin = 1; iBin <=
errCodeSize; iBin++)
420 "TBM Message in FED" + s_fed,
"TBM Message in FED" + s_fed +
";;channel", 8, -0.5, 7.5, 37, -0.5, 36.5);
421 for (
unsigned int iBin = 1; iBin <= 8; iBin++)
426 "TBM Type in FED" + s_fed,
"TBM Type in FED" + s_fed +
";;channel", 5, -0.5, 4.5, 37, -0.5, 36.5);
427 for (
unsigned int iBin = 1; iBin <= 5; iBin++)
428 h2TBMTypeFED[iFed]->setBinLabel(iBin, tbmType[iBin - 1]);
445 string stnd, stnTitle;
458 string rpBinName = armTitleShort +
"_" + stnTitleShort +
"_" + rpTitle;
474 const float x0Maximum = 70.;
475 const float y0Maximum = 15.;
476 string st =
"track intercept point";
477 string st2 =
": " + stnTitle;
479 st, st + st2 +
";x0;y0",
int(x0Maximum) * 2, 0., x0Maximum,
int(y0Maximum) * 4, -y0Maximum, y0Maximum);
483 st + st2 +
";;plane",
490 for (
unsigned int iBin = 1; iBin <=
errCodeSize; iBin++)
494 h2TBMMessageRP[indexP] = ibooker.
book2D(
"TBM Message",
"TBM Message;;plane", 8, -0.5, 7.5, 6, -0.5, 5.5);
495 for (
unsigned int iBin = 1; iBin <= 8; iBin++)
499 h2TBMTypeRP[indexP] = ibooker.
book2D(
"TBM Type",
"TBM Type;;plane", 5, -0.5, 4.5, 6, -0.5, 5.5);
500 for (
unsigned int iBin = 1; iBin <= 5; iBin++)
501 h2TBMTypeRP[indexP]->setBinLabel(iBin, tbmType[iBin - 1]);
504 st =
"number of tracks per event";
506 rpTitle +
";number of tracks",
516 rpTitle +
";nPlanes;Probability",
526 rpTitle +
";LumiSection;Plane#___ROC#",
541 sprintf(
s,
"plane%d_0",
p);
544 sprintf(
s,
" %d_%d",
p,
r);
551 "Hits per plane per BX - random triggers", rpTitle +
";Event.BX;Plane", 4002, -1.5, 4000. + 0.5, 6, 0, 6);
554 string st3 =
";PlaneIndex(=pixelPot*PlaneMAX + plane)";
556 st =
"hit multiplicity in planes";
561 st =
"cluster size in planes";
563 st + st2 + st3 +
";Cluster size",
572 st =
"number of hits per track";
573 htrackHits[indexP] = ibooker.
bookProfile(st, rpTitle +
";number of hits", 5, 1.5, 6.5, -0.1, 1.1,
"");
577 rpTitle +
";plane # ;ROC #",
592 ibooker.
book1D(
"5 fired planes per BX", rpTitle +
";Event.BX", 4002, -1.5, 4000. + 0.5);
595 ibooker.
book1D(
"4 fired ROCs per BX", rpTitle +
";Event.BX", 4002, -1.5, 4000. + 0.5);
597 ibooker.
book1D(
"3 fired ROCs per BX", rpTitle +
";Event.BX", 4002, -1.5, 4000. + 0.5);
599 ibooker.
book1D(
"2 fired ROCs per BX", rpTitle +
";Event.BX", 4002, -1.5, 4000. + 0.5);
601 hRPotActivBXall[indexP] = ibooker.
book1D(
"hits per BX", rpTitle +
";Event.BX", 4002, -1.5, 4000. + 0.5);
608 sprintf(
s,
"plane_%d",
p);
609 string pd = rpd +
"/" +
string(
s);
611 string st1 =
": " + rpTitle +
"_" +
string(
s);
613 st =
"adc average value";
615 st1 +
";pix col;pix row",
628 st =
"hits position";
630 st1 +
";pix col;pix row",
639 st =
"hits multiplicity";
645 st =
"plane efficiency";
647 st, st1 +
";x0;y0",
mapXbins,
mapXmin,
mapXmax,
mapYbins,
mapYmin,
mapYmax, 0, 1,
"");
663 int lumiId =
event.getLuminosityBlock().id().luminosityBlock();
671 RPactivity[rp] = RPdigiSize[rp] = pixRPTracks[rp] = 0;
707 for (
const auto &ds_tr : *pixTrack) {
708 int idet =
getDet(ds_tr.id);
711 LogPrint(
"CTPPSPixelDQMSource") <<
"not CTPPS: ds_tr.id" << ds_tr.id;
715 int arm = theId.
arm() & 0x1;
717 int rpot = theId.
rp() & 0x7;
721 ++pixRPTracks[rpInd];
731 float x0 = dit->x0();
732 float y0 = dit->y0();
747 std::map<int, int> numberOfPointPerPlaneEff;
748 for (
const auto &ds_frh : fittedHits) {
753 if (frh_it != ds_frh.begin())
755 LogPrint(
"CTPPSPixelDQMSource") <<
"More than one FittedRecHit found in plane " << plane;
756 if (frh_it->isRealHit())
759 numberOfPointPerPlaneEff[
p]++;
765 for (
auto planeAndHitsOnOthers : numberOfPointPerPlaneEff) {
767 <<
"For plane " << planeAndHitsOnOthers.first <<
", " << planeAndHitsOnOthers.second
768 <<
" hits on other planes were found" << endl;
771 for (
const auto &ds_frh : fittedHits) {
777 float frhX0 = frh_it->globalCoordinates().x() + frh_it->xResidual();
778 float frhY0 = frh_it->globalCoordinates().y() + frh_it->yResidual();
779 if (numberOfPointPerPlaneEff[plane] >= 3) {
780 if (frh_it->isRealHit())
797 LogPrint(
"CTPPSPixelDQMSource") <<
"No valid data in Event " <<
nEvents;
800 for (
const auto &ds_digi : *pixDigi) {
801 int idet =
getDet(ds_digi.id);
804 LogPrint(
"CTPPSPixelDQMSource") <<
"not CTPPS: ds_digi.id" << ds_digi.id;
812 int arm = theId.
arm() & 0x1;
814 int rpot = theId.
rp() & 0x7;
816 RPactivity[rpInd] = 1;
827 int nh = ds_digi.data.size();
837 int row = dit->row();
838 int col = dit->column();
839 int adc = dit->adc();
850 if (trocId >= 0 && trocId <
NROCsMAX) {
861 std::map<CTPPSPixelFramePosition, CTPPSPixelROCInfo> rocMapping =
mapping->ROCMapping;
862 for (
const auto &ds_error : *pixError) {
863 int idet =
getDet(ds_error.id);
870 if (dit->errorType() == 32 || dit->errorType() == 33 || dit->errorType() == 34) {
871 long long errorWord = dit->errorWord64();
874 uint32_t errorWord = dit->errorWord32();
880 std::map<CTPPSPixelFramePosition, CTPPSPixelROCInfo>::const_iterator mit;
883 bool goodRecovery =
false;
884 mit = rocMapping.find(fPos);
885 if (mit != rocMapping.end()) {
888 plane = recoveredDetId.
plane();
891 [recoveredDetId.
rp()][recoveredDetId.
plane()])
901 bool fillFED =
false;
906 if (dit->errorType() == 28) {
908 uint32_t errorWord = dit->errorWord32();
945 if (dit->errorType() == 30) {
946 uint32_t errorWord = dit->errorWord32();
1027 int stateMach_bits = 4;
1028 int stateMach_shift = 8;
1029 uint32_t stateMach_mask = ~(~uint32_t(0) << stateMach_bits);
1030 uint32_t stateMach = (errorWord >> stateMach_shift) & stateMach_mask;
1031 if (stateMach == 0) {
1084 LogPrint(
"CTPPSPixelDQMSource") <<
"not CTPPS: ds_error.id" << ds_error.id;
1090 int arm = theId.
arm() & 0x1;
1092 int rpot = theId.
rp() & 0x7;
1094 RPactivity[rpInd] = 1;
1105 if (dit->errorType() == 32 || dit->errorType() == 33 || dit->errorType() == 34) {
1106 long long errorWord = dit->errorWord64();
1109 uint32_t errorWord = dit->errorWord32();
1112 bool fillFED =
false;
1116 if (dit->errorType() == 28) {
1118 uint32_t errorWord = dit->errorWord32();
1156 if (dit->errorType() == 30) {
1157 uint32_t errorWord = dit->errorWord32();
1206 int stateMach_bits = 4;
1207 int stateMach_shift = 8;
1208 uint32_t stateMach_mask = ~(~uint32_t(0) << stateMach_bits);
1209 uint32_t stateMach = (errorWord >> stateMach_shift) & stateMach_mask;
1210 if (stateMach == 0) {
1247 for (
const auto &ds : *pixClus) {
1248 int idet =
getDet(ds.id);
1250 LogPrint(
"CTPPSPixelDQMSource") <<
"not CTPPS: cluster.id" << ds.id;
1256 int arm = theId.
arm() & 0x1;
1258 int rpot = theId.
rp() & 0x7;
1263 for (
const auto &
p : ds) {
1264 int clusize =
p.size();
1273 bool allRPactivity =
false;
1275 if (RPactivity[rp] > 0)
1276 allRPactivity =
true;
1279 for (
int rp = 0; rp <
NRPotsMAX; rp++) {
1291 int ntr = pixRPTracks[
index];
1329 planesFiredAtROC[
r] = 0;
1334 ++planesFiredAtROC[
r];
1343 if (
max < planesFiredAtROC[
r])
1344 max = planesFiredAtROC[
r];
int StationStatus[StationIDMAX]
edm::EDGetTokenT< edm::DetSetVector< CTPPSPixelDataError > > tokenError
edm::ESGetToken< CTPPSPixelDAQMapping, CTPPSPixelDAQMappingRcd > tokenPixelDAQMapping
MonitorElement * hHitsMult[RPotsTotalNumber][NplaneMAX]
int HitsMultPlane[RPotsTotalNumber][NplaneMAX]
MonitorElement * hp2xyADC[RPotsTotalNumber][NplaneMAX]
MonitorElement * hpRPactive
Contains mappind data related to a ROC.
MonitorElement * hp2HitsMultROC_LS[RPotsTotalNumber]
static constexpr int ClusMultMAX
static constexpr int mapYbins
edm::EDGetTokenT< edm::DetSetVector< CTPPSPixelCluster > > tokenCluster
MonitorElement * bookProfile2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, double lowZ, double highZ, char const *option="s", FUNC onbooking=NOOP())
virtual TProfile * getTProfile() const
MonitorElement * h2CluSize[NArms][NStationMAX]
static constexpr int ADCMax
edm::EDGetTokenT< edm::DetSetVector< CTPPSPixelDigi > > tokenDigi
void dqmBeginRun(edm::Run const &, edm::EventSetup const &) override
static constexpr int RPotsIDMAX
virtual void setCurrentFolder(std::string const &fullpath)
static constexpr int DB2_shift
static constexpr int LINK_bits
MonitorElement * htrackMult[RPotsTotalNumber]
MonitorElement * h2HitsMultROC[RPotsTotalNumber]
MonitorElement * h2trackXY0[RPotsTotalNumber]
MonitorElement * hpixLTrack
std::string randomHLTPath
static constexpr int NRPotBinsInStation
MonitorElement * hRPotActivBXroc_3[RPotsTotalNumber]
static constexpr int RPn_last
static constexpr int hitMultMAX
static constexpr int dimension
static constexpr int NRPotsMAX
std::string to_string(const V &value)
static constexpr int NPlaneBins
static constexpr int DB3_shift
MonitorElement * h2TBMMessageFED[2]
static constexpr uint32_t DataBit_mask
static constexpr int DataBit_bits
CTPPSPixelIndices thePixIndices
MonitorElement * h2HitsVsBXRandoms[RPotsTotalNumber]
static constexpr int RPotsTotalNumber
static constexpr int mapXbins
static constexpr float mapYmax
static constexpr int DCOL_shift
T getUntrackedParameter(std::string const &, T const &) const
uint32_t iD
the symbolic id
MonitorElement * h2TBMMessageUnidDet
MonitorElement * htrackHits[RPotsTotalNumber]
void analyze(edm::Event const &e, edm::EventSetup const &eSetup) override
edm::EDGetTokenT< edm::DetSetVector< CTPPSPixelLocalTrack > > tokenTrack
virtual TH2F * getTH2F() const
static constexpr int DB6_shift
MonitorElement * h2TBMTypeUnidDet
static constexpr int ROC_bits
int prIndex(int rp, int plane)
MonitorElement * book1DD(TString const &name, TString const &title, int nchX, double lowX, double highX, FUNC onbooking=NOOP())
static constexpr int ROC_shift
int RPindexValid[RPotsTotalNumber]
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
MonitorElement * h2Efficiency[RPotsTotalNumber][NplaneMAX]
MonitorElement * hROCadc[RPotsTotalNumber *NplaneMAX][NROCsMAX]
static constexpr int minFedNumber
CTPPSPixelDQMSource(const edm::ParameterSet &ps)
static constexpr int ADC_bits
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())
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
static constexpr int errCodeSize
MonitorElement * hRPotActivBX[RPotsTotalNumber]
MonitorElement * h2ErrorCodeFED[2]
static constexpr int NLocalTracksMAX
static constexpr int PXID_shift
#define DEFINE_FWK_MODULE(type)
static constexpr int numberOfFeds
static constexpr int DB0_shift
static constexpr int ClusterSizeMax
int transformToROC(const int col, const int row, int &rocId, int &colROC, int &rowROC) const
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)
int getRPindex(int arm, int station, int rp)
Log< level::Warning, true > LogPrint
MonitorElement * hRPotActivBXroc_2[RPotsTotalNumber]
MonitorElement * hRPotActivBXroc[RPotsTotalNumber]
static constexpr int DB7_shift
MonitorElement * h2xyROCHits[RPotsTotalNumber *NplaneMAX][NROCsMAX]
static const char *const trigNames[]
unsigned int rpStatusWord
MonitorElement * hRPotActivBXall[RPotsTotalNumber]
constexpr int defaultDetSizeInX
static constexpr int NRPglobalBins
static constexpr int StationIDMAX
MonitorElement * h2ErrorCodeRP[RPotsTotalNumber]
static constexpr int NStationMAX
static constexpr uint32_t DCOL_mask
static constexpr int DB5_shift
static constexpr int NROCsMAX
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
~CTPPSPixelDQMSource() override
static constexpr uint32_t LINK_mask
static constexpr int PXID_bits
static constexpr uint32_t PXID_mask
MonitorElement * book2DD(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Base class for CTPPS detector IDs.
static constexpr int DB1_shift
MonitorElement * h2FullType
static const int kDetOffset
MonitorElement * h2ErrorCodeUnidDet
static constexpr int NArms
MonitorElement * h2TBMTypeFED[2]
MonitorElement * h2AllPlanesActive
static constexpr int RPn_first
virtual TProfile2D * getTProfile2D() const
static constexpr int DB4_shift
int getRPglobalBin(int arm, int stn)
int HitsMultROC[RPotsTotalNumber *NplaneMAX][NROCsMAX]
MonitorElement * h2TBMMessageRP[RPotsTotalNumber]
static constexpr uint32_t ADC_mask
static constexpr int NplaneMAX
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
int getRPInStationBin(int rp)
collection_type::const_iterator const_iterator
int getPlaneIndex(int arm, int station, int rp, int plane)
MonitorElement * h2xyHits[RPotsTotalNumber][NplaneMAX]
MonitorElement * hRPotActivPlanes[RPotsTotalNumber]
static constexpr int LINK_shift
int RPstatus[StationIDMAX][RPotsIDMAX]
static constexpr int ADC_shift
MonitorElement * hBXshort
static constexpr uint32_t ROC_mask
bool isPlanePlotsTurnedOff[NArms][NStationMAX][NRPotsMAX][NplaneMAX]
MonitorElement * h2HitsMultipl[NArms][NStationMAX]
uint16_t *__restrict__ uint16_t const *__restrict__ adc
MonitorElement * h2TBMTypeRP[RPotsTotalNumber]
edm::EDGetTokenT< edm::TriggerResults > tokenTrigResults
The mapping between FramePosition and ROCInfo.
static constexpr float mapYmin
static constexpr int DCOL_bits
virtual TH2D * getTH2D() const