@@ -33,7 +33,6 @@ Quality ITSClusterCheck::check(std::map<std::string, std::shared_ptr<MonitorObje
3333{
3434 Quality result = Quality::Null;
3535 double averageClusterSizeLimit[NLayer] = { 5 , 5 , 5 , 5 , 5 , 5 , 5 };
36- double clusterOccupationLimit[NLayer] = { 40 , 30 , 20 , 60 , 25 , 15 , 14 };
3736
3837 std::map<std::string, std::shared_ptr<MonitorObject>>::iterator iter;
3938 for (iter = moMap->begin (); iter != moMap->end (); ++iter) {
@@ -52,16 +51,48 @@ Quality ITSClusterCheck::check(std::map<std::string, std::shared_ptr<MonitorObje
5251
5352 if (iter->second ->getName ().find (" General_Occupancy" ) != std::string::npos) {
5453 auto * hp = dynamic_cast <TH2D *>(iter->second ->getObject ());
54+ std::vector<int > skipxbins = convertToIntArray (mCustomParameters [" skipxbinsoccupancy" ]);
55+ std::vector<int > skipybins = convertToIntArray (mCustomParameters [" skipybinsoccupancy" ]);
56+ std::vector<std::pair<int , int >> xypairs;
57+ for (int i = 0 ; i < (int )skipxbins.size (); i++) {
58+ xypairs.push_back (std::make_pair (skipxbins[i], skipybins[i]));
59+ }
60+ result.set (Quality::Good);
5561 for (int iy = 1 ; iy <= hp->GetNbinsY (); iy++) {
5662 int ilayer = iy <= hp->GetNbinsY () / 2 ? hp->GetNbinsY () / 2 - iy : iy - hp->GetNbinsY () / 2 - 1 ;
5763 std::string tb = iy <= hp->GetNbinsY () / 2 ? " B" : " T" ;
5864 result.addMetadata (Form (" Layer%d%s" , ilayer, tb.c_str ()), " good" );
5965 for (int ix = 1 ; ix <= hp->GetNbinsX (); ix++) { // loop on staves
60- if (hp->GetBinContent (ix) > clusterOccupationLimit[ilayer]) {
66+ if (std::find (xypairs.begin (), xypairs.end (), std::make_pair (ix, iy)) != xypairs.end ()) {
67+ continue ;
68+ }
69+ if (hp->GetBinContent (ix, iy) > std::stod (mCustomParameters [Form (" maxcluoccL%d" , ilayer)])) {
6170 result.set (Quality::Medium);
6271 result.updateMetadata (Form (" Layer%d%s" , ilayer, tb.c_str ()), " medium" );
6372 }
6473 }
74+ // check for empty bins (empty staves)
75+ result.addMetadata (Form (" Layer%d%s_empty" , ilayer, tb.c_str ()), " good" );
76+ for (int ix = 12 ; ix > 12 - mNStaves [ilayer] / 4 ; ix--) {
77+ if (std::find (xypairs.begin (), xypairs.end (), std::make_pair (ix, iy)) != xypairs.end ()) {
78+ continue ;
79+ }
80+ if (hp->GetBinContent (ix, iy) < 1e-15 ) {
81+ result.updateMetadata (Form (" Layer%d%s_empty" , ilayer, tb.c_str ()), " bad" );
82+ result.set (Quality::Bad);
83+ LOG (info) << " ************************ " << Form (" Layer%d%s_empty" , ilayer, tb.c_str ());
84+ }
85+ }
86+ int stop = (iy == 2 || iy == 13 ) ? 13 + mNStaves [ilayer] / 4 + 1 : 13 + mNStaves [ilayer] / 4 ; // for L5
87+ for (int ix = 13 ; ix < stop; ix++) {
88+ if (std::find (xypairs.begin (), xypairs.end (), std::make_pair (ix, iy)) != xypairs.end ()) {
89+ continue ;
90+ }
91+ if (hp->GetBinContent (ix, iy) < 1e-15 ) {
92+ result.updateMetadata (Form (" Layer%d%s_empty" , ilayer, tb.c_str ()), " bad" );
93+ result.set (Quality::Bad);
94+ }
95+ }
6596 }
6697 } // end GeneralOccupancy
6798 }
@@ -74,7 +105,7 @@ std::string ITSClusterCheck::getAcceptedType() { return "TH2D"; }
74105void ITSClusterCheck::beautify (std::shared_ptr<MonitorObject> mo, Quality checkResult)
75106{
76107
77- TString text ;
108+ TString status ;
78109 int textColor;
79110 Double_t positionX, positionY;
80111
@@ -84,18 +115,18 @@ void ITSClusterCheck::beautify(std::shared_ptr<MonitorObject> mo, Quality checkR
84115 int iLayer = histoName[histoName.find (" Layer" ) + 5 ] - 48 ; // Searching for position of "Layer" in the name of the file, then +5 is the NUMBER of the layer, -48 is conversion to int
85116
86117 if (checkResult == Quality::Medium) {
87- text = " INFO: large clusters - do not call expert" ;
118+ status = " INFO: large clusters - do not call expert" ;
88119 textColor = kYellow ;
89120 positionX = 0.15 ;
90121 positionY = 0.8 ;
91122 } else {
92- text = " Quality::GOOD" ;
123+ status = " Quality::GOOD" ;
93124 textColor = kGreen ;
94125 positionX = 0.02 ;
95126 positionY = 0.91 ;
96127 }
97128
98- msg = std::make_shared<TLatex>(positionX, positionY, Form (" #bf{%s}" , text .Data ()));
129+ msg = std::make_shared<TLatex>(positionX, positionY, Form (" #bf{%s}" , status .Data ()));
99130 msg->SetTextColor (textColor);
100131 msg->SetTextSize (0.06 );
101132 msg->SetTextFont (43 );
@@ -105,28 +136,62 @@ void ITSClusterCheck::beautify(std::shared_ptr<MonitorObject> mo, Quality checkR
105136
106137 if (mo->getName ().find (" General_Occupancy" ) != std::string::npos) {
107138 auto * h = dynamic_cast <TH2D *>(mo->getObject ());
108-
109- std::string histoName = mo->getName ();
110-
111139 if (checkResult == Quality::Good) {
112- text = " Quality::GOOD" ;
140+ status = " Quality::GOOD" ;
113141 textColor = kGreen ;
114- positionX = 0.02 ;
115- positionY = 0.91 ;
142+ positionX = 0.12 ;
143+ positionY = 0.75 ;
116144 } else {
117- text = " Large cluster occupancy - notify expert, do not call" ;
118- textColor = kYellow ;
119- positionX = 0.15 ;
120- positionY = 0.8 ;
145+ for (int il = 0 ; il < 14 ; il++) {
146+ std::string tb = il < 7 ? " T" : " B" ;
147+ if (strcmp (checkResult.getMetadata (Form (" Layer%d%s" , il % 7 , tb.c_str ())).c_str (), " medium" ) == 0 ) {
148+ text[il] = std::make_shared<TLatex>(0.3 , 0.1 + il * 0.05 , Form (" L%d%s has large cluster occupancy" , il % 7 , tb.c_str ()));
149+ text[il]->SetTextFont (43 );
150+ text[il]->SetTextSize (0.03 );
151+ text[il]->SetTextColor (kOrange );
152+ text[il]->SetNDC ();
153+ h->GetListOfFunctions ()->Add (text[il]->Clone ());
154+ status = " #splitline{Quality::Medium}{do NOT call, create log entry}" ;
155+ textColor = kOrange ;
156+ positionX = 0.12 ;
157+ positionY = 0.75 ;
158+ }
159+
160+ if (strcmp (checkResult.getMetadata (Form (" Layer%d%s_empty" , il % 7 , tb.c_str ())).c_str (), " bad" ) == 0 ) {
161+ text2[il] = std::make_shared<TLatex>(0.7 , 0.1 + il * 0.05 , Form (" L%d%s has empty staves" , il % 7 , tb.c_str ()));
162+ text2[il]->SetTextFont (43 );
163+ text2[il]->SetTextSize (0.03 );
164+ text2[il]->SetTextColor (kRed );
165+ text2[il]->SetNDC ();
166+ h->GetListOfFunctions ()->Add (text2[il]->Clone ());
167+ status = " #splitline{Quality::Bad}{Call expert}" ;
168+ textColor = kRed ;
169+ positionX = 0.12 ;
170+ positionY = 0.75 ;
171+ }
172+ }
121173 }
122- msg = std::make_shared<TLatex>(positionX, positionY, Form (" #bf{%s}" , text .Data ()));
174+ msg = std::make_shared<TLatex>(positionX, positionY, Form (" #bf{%s}" , status .Data ()));
123175 msg->SetTextColor (textColor);
124- msg->SetTextSize (0.06 );
176+ msg->SetTextSize (0.04 );
125177 msg->SetTextFont (43 );
126178 msg->SetNDC ();
127-
128179 h->GetListOfFunctions ()->Add (msg->Clone ());
129180 }
130181}
131182
183+ std::vector<int > ITSClusterCheck::convertToIntArray (std::string input)
184+ {
185+ std::replace (input.begin (), input.end (), ' ,' , ' ' );
186+ std::istringstream stringReader{ input };
187+
188+ std::vector<int > result;
189+ int number;
190+ while (stringReader >> number) {
191+ result.push_back (number);
192+ }
193+
194+ return result;
195+ }
196+
132197} // namespace o2::quality_control_modules::its
0 commit comments