@@ -47,6 +47,10 @@ ITSClusterTask::~ITSClusterTask()
4747 if (!mEnableLayers [iLayer])
4848 continue ;
4949
50+ if (iLayer < NLayerIB) {
51+ delete hLongClustersPerChip[iLayer];
52+ delete hMultPerChipWhenLongClusters[iLayer];
53+ }
5054 delete hClusterSizeLayerSummary[iLayer];
5155 delete hClusterTopologyLayerSummary[iLayer];
5256 delete hGroupedClusterSizeLayerSummary[iLayer];
@@ -137,8 +141,6 @@ void ITSClusterTask::monitorData(o2::framework::ProcessingContext& ctx)
137141 auto clusPatternArr = ctx.inputs ().get <gsl::span<unsigned char >>(" patterns" );
138142 auto pattIt = clusPatternArr.begin ();
139143
140- int ChipIDprev = -1 ;
141-
142144 // Reset this histo to have the latest picture
143145 hEmptyLaneFractionGlobal->Reset (" ICES" );
144146
@@ -153,34 +155,46 @@ void ITSClusterTask::monitorData(o2::framework::ProcessingContext& ctx)
153155 const auto & ROF = clusRofArr[iROF];
154156 const auto bcdata = ROF.getBCData ();
155157 int nClustersForBunchCrossing = 0 ;
158+ int nLongClusters[ChipBoundary[NLayerIB]] = {};
159+ int nHitsFromClusters[ChipBoundary[NLayerIB]] = {}; // only IB is implemented at the moment
160+
156161 for (int icl = ROF.getFirstEntry (); icl < ROF.getFirstEntry () + ROF.getNEntries (); icl++) {
157162
158163 auto & cluster = clusArr[icl];
159164 auto ChipID = cluster.getSensorID ();
160165 int ClusterID = cluster.getPatternID (); // used for normal (frequent) cluster shapes
161166 int lay, sta, ssta, mod, chip, lane;
162167
163- if ( ChipID != ChipIDprev) {
164- mGeom ->getChipId (ChipID, lay, sta, ssta, mod, chip);
165- mod = mod + (ssta * (mNHicPerStave [lay] / 2 ));
166- int chipIdLocal = (ChipID - ChipBoundary[lay]) % (14 * mNHicPerStave [lay]);
167- lane = (chipIdLocal % (14 * mNHicPerStave [lay])) / (14 / 2 );
168- }
168+ // TODO: avoid call Geom if ChipID is the same as previous cluster
169+ mGeom ->getChipId (ChipID, lay, sta, ssta, mod, chip);
170+ mod = mod + (ssta * (mNHicPerStave [lay] / 2 ));
171+ int chipIdLocal = (ChipID - ChipBoundary[lay]) % (14 * mNHicPerStave [lay]);
172+ lane = (chipIdLocal % (14 * mNHicPerStave [lay])) / (14 / 2 );
173+
169174 int npix = -1 ;
175+ int colspan = -1 ;
176+ int rowspan = -1 ;
170177 int isGrouped = -1 ;
171178
172179 o2::math_utils::Point3D<float > locC; // local coordinates
173180
174181 if (ClusterID != o2::itsmft::CompCluster::InvalidPatternID) { // Normal (frequent) cluster shapes
175182 if (!mDict ->isGroup (ClusterID)) {
176183 npix = mDict ->getNpixels (ClusterID);
184+
185+ // TODO: is there way other than calling the pattern?
186+ colspan = mDict ->getPattern (ClusterID).getColumnSpan ();
187+ rowspan = mDict ->getPattern (ClusterID).getRowSpan ();
188+
177189 if (mDoPublishDetailedSummary == 1 ) {
178190 locC = mDict ->getClusterCoordinates (cluster);
179191 }
180192 isGrouped = 0 ;
181193 } else {
182194 o2::itsmft::ClusterPattern patt (pattIt);
183195 npix = patt.getNPixels ();
196+ colspan = patt.getColumnSpan ();
197+ rowspan = patt.getRowSpan ();
184198 if (mDoPublishDetailedSummary == 1 ) {
185199 locC = mDict ->getClusterCoordinates (cluster, patt, true );
186200 }
@@ -190,6 +204,8 @@ void ITSClusterTask::monitorData(o2::framework::ProcessingContext& ctx)
190204 } else { // invalid pattern
191205 o2::itsmft::ClusterPattern patt (pattIt);
192206 npix = patt.getNPixels ();
207+ colspan = patt.getColumnSpan ();
208+ rowspan = patt.getRowSpan ();
193209 isGrouped = 0 ;
194210 if (mDoPublishDetailedSummary == 1 ) {
195211 locC = mDict ->getClusterCoordinates (cluster, patt, false );
@@ -200,6 +216,15 @@ void ITSClusterTask::monitorData(o2::framework::ProcessingContext& ctx)
200216 nClustersForBunchCrossing++;
201217 }
202218
219+ if (lay < NLayerIB) {
220+ nHitsFromClusters[ChipID] += npix;
221+ }
222+
223+ if (lay < NLayerIB && colspan >= minColSpanLongCluster && rowspan <= maxRowSpanLongCluster) {
224+ // definition of long cluster
225+ nLongClusters[ChipID]++;
226+ }
227+
203228 if (lay < NLayerIB) {
204229 hAverageClusterOccupancySummaryIB[lay]->getNum ()->Fill (chip, sta);
205230 hAverageClusterSizeSummaryIB[lay]->getNum ()->Fill (chip, sta, (double )npix);
@@ -249,6 +274,21 @@ void ITSClusterTask::monitorData(o2::framework::ProcessingContext& ctx)
249274 }
250275 }
251276 hClusterVsBunchCrossing->Fill (bcdata.bc , nClustersForBunchCrossing); // we count only the number of clusters, not their sizes
277+
278+ // filling these anomaly plots once per ROF, ignoring chips w/o long clusters
279+ for (int ichip = 0 ; ichip < ChipBoundary[NLayerIB]; ichip++) {
280+
281+ int nLong = TMath::Min (nLongClusters[ichip], 21 );
282+ if (nLong < 1 ) {
283+ continue ;
284+ }
285+ int ilayer = -1 ;
286+ while (ichip >= ChipBoundary[ilayer + 1 ]) {
287+ ilayer++;
288+ }
289+ hLongClustersPerChip[ilayer]->Fill (ichip, nLong);
290+ hMultPerChipWhenLongClusters[ilayer]->Fill (ichip, nHitsFromClusters[ichip]);
291+ }
252292 }
253293
254294 if ((int )clusRofArr.size () > 0 ) {
@@ -364,6 +404,8 @@ void ITSClusterTask::reset()
364404 hClusterTopologyLayerSummary[iLayer]->Reset ();
365405
366406 if (iLayer < NLayerIB) {
407+ hLongClustersPerChip[iLayer]->Reset ();
408+ hMultPerChipWhenLongClusters[iLayer]->Reset ();
367409 hAverageClusterOccupancySummaryIB[iLayer]->Reset ();
368410 hAverageClusterSizeSummaryIB[iLayer]->Reset ();
369411 if (mDoPublish1DSummary == 1 ) {
@@ -396,7 +438,7 @@ void ITSClusterTask::reset()
396438
397439void ITSClusterTask::createAllHistos ()
398440{
399- hClusterVsBunchCrossing = new TH2D (" BunchCrossingIDvsClusters" , " BunchCrossingIDvsClusters" , nBCbins, 0 , 4095 , 100 , 0 , 1000 );
441+ hClusterVsBunchCrossing = new TH2D (" BunchCrossingIDvsClusters" , " BunchCrossingIDvsClusters" , nBCbins, 0 , 4095 , 100 , 0 , 2000 );
400442 hClusterVsBunchCrossing->SetTitle (" #clusters vs BC id for clusters with npix > 2" );
401443 addObject (hClusterVsBunchCrossing);
402444 formatAxes (hClusterVsBunchCrossing, " Bunch Crossing ID" , " Number of clusters with npix > 2 in ROF" , 1 , 1.10 );
@@ -419,6 +461,17 @@ void ITSClusterTask::createAllHistos()
419461 if (!mEnableLayers [iLayer])
420462 continue ;
421463
464+ if (iLayer < NLayerIB) {
465+ hLongClustersPerChip[iLayer] = new TH2D (Form (" Anomalies/Layer%d/LongClusters" , iLayer), Form (" Layer%d/LongClusters" , iLayer), ChipBoundary[iLayer + 1 ] - ChipBoundary[iLayer], ChipBoundary[iLayer], ChipBoundary[iLayer + 1 ], 21 , 0 , 21 );
466+ hMultPerChipWhenLongClusters[iLayer] = new TH2D (Form (" Anomalies/Layer%d/HitsWhenLongClusters" , iLayer), Form (" Layer%d/HitsWhenLongClusters" , iLayer), ChipBoundary[iLayer + 1 ] - ChipBoundary[iLayer], ChipBoundary[iLayer], ChipBoundary[iLayer + 1 ], 200 , 0 , 20000 );
467+ addObject (hLongClustersPerChip[iLayer]);
468+ formatAxes (hLongClustersPerChip[iLayer], " Chip ID" , " number of long clusters" , 1 , 1.10 );
469+ hLongClustersPerChip[iLayer]->SetStats (0 );
470+ addObject (hMultPerChipWhenLongClusters[iLayer]);
471+ formatAxes (hMultPerChipWhenLongClusters[iLayer], " Chip ID" , " Sum of clusters size (events w/ long clus)" , 1 , 1.10 );
472+ hMultPerChipWhenLongClusters[iLayer]->SetStats (0 );
473+ }
474+
422475 hClusterSizeLayerSummary[iLayer] = new TH1D (Form (" Layer%d/AverageClusterSizeSummary" , iLayer), Form (" Layer%dAverageClusterSizeSummary" , iLayer), 100 , 0 , 100 );
423476 hClusterSizeLayerSummary[iLayer]->SetTitle (Form (" Cluster size summary for Layer %d" , iLayer));
424477 addObject (hClusterSizeLayerSummary[iLayer]);
0 commit comments