23 #include "GaudiKernel/SystemOfUnits.h"
38 ATH_MSG_WARNING(
"Event selection triggers not specified. Switching off trigger-aware monitoring");
63 int segmClustCount[33];
68 for(
unsigned int kl = 0;
kl < 33;
kl++ ) {
69 for(
unsigned int cm3 = 0;
cm3 < 9;
cm3++ ){
70 clusCount[
kl][
cm3] = 0;
78 return StatusCode::FAILURE;
81 if ( segments->
empty() ){
83 return StatusCode::SUCCESS;
89 if(segments->
size() > 0){
91 ATH_MSG_DEBUG(
"This algorithm is designed to operate for single segm / event only" );
92 ATH_MSG_DEBUG(
"Processing only the first segm in the segm collection" );
110 if (
cscHits(segm)<1 )
continue;
119 if ( n_clust < 2 )
continue;
125 for(
int sect = 0; sect < 33; sect++) {
126 segmClustCount[sect] = 0;
127 for(
unsigned int ilay = 0; ilay < 9; ilay++ ){
128 clusCount[sect][ilay] = 0;
148 bool segmAngle_cut =
segmSlopeCut(segm_ly, segm_ayz, segm_cut);
149 ATH_MSG_DEBUG(
" local_pos: " << segm_ly <<
"\tangle_yz: " << segm_ayz <<
"\tcut: " << segm_cut <<
"\t pass = " << segmAngle_cut );
176 int segm_stationPhi =
m_idHelperSvc->cscIdHelper().stationPhi(segmId);
177 int segm_stationEta =
m_idHelperSvc->cscIdHelper().stationEta(segmId);
178 int segm_stationName =
m_idHelperSvc->cscIdHelper().stationName(segmId);
179 int segm_chamberType =
m_idHelperSvc->cscIdHelper().stationNameIndex(
"CSS") == segm_stationName ? 0 : 1;
180 auto segm_sectorNo =
Monitored::Scalar<int>(
"segm_sectorNo", (segm_stationEta * (2 * segm_stationPhi - segm_chamberType)) );
181 int segm_isec = segm_sectorNo < 0 ? segm_sectorNo*(-1) : segm_sectorNo+16;
182 ATH_MSG_DEBUG(
" sgsec = " << segm_isec <<
"\tsec = " << segm_sectorNo);
187 float clus_kiloele = 1.0e-3;
188 int eta_clus_count[2][2] = {{0, 0},{0, 0}}, phi_clus_count[2][2] = {{0, 0},{0, 0}};
189 float eta_clus_qsum[2][5] = {{-1., 0., 0., 0., 0.}, {-1., 0., 0., 0., 0.}}, phi_clus_qsum[2][5] = {{-1., 0., 0., 0., 0.}, {-1., 0., 0., 0., 0.}};
190 float eta_clus_time[2][5] = {{-1., 0., 0., 0., 0.}, {-1., 0., 0., 0., 0.}}, phi_clus_time[2][5] = {{-1., 0., 0., 0., 0.}, {-1., 0., 0., 0., 0.}};
191 int eta_clus_use[2][5] = {{0, 0, 0, 0, 0 },{0, 0, 0, 0, 0}}, phi_clus_use[2][5] = {{0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}};
201 int clus_stationName =
m_idHelperSvc->cscIdHelper().stationName(clusId);
202 int clus_chamberType =
m_idHelperSvc->cscIdHelper().stationNameIndex(
"CSS") == clus_stationName ? 0 : 1;
203 int clus_stationEta =
m_idHelperSvc->cscIdHelper().stationEta(clusId);
204 int clus_stationPhi =
m_idHelperSvc->cscIdHelper().stationPhi(clusId);
205 int clus_wireLayer =
m_idHelperSvc->cscIdHelper().wireLayer(clusId);
206 int clus_measuresPhi =
m_idHelperSvc->cscIdHelper().measuresPhi(clusId);
209 int clus_sectorNo = clus_stationEta * (2 * clus_stationPhi - clus_chamberType);
211 int clus_isec = clus_sectorNo < 0 ? clus_sectorNo*(-1) : clus_sectorNo+16;
212 int clus_ilay = (clus_measuresPhi ? clus_wireLayer : clus_wireLayer+4);
217 auto sideA_phi0 =
Monitored::Scalar<int>(
"sideA_phi0",(
int) (segm_stationEta==1)&& (
int)(clus_measuresPhi==0));
218 auto sideC_phi0 =
Monitored::Scalar<int>(
"sideC_phi0",(
int) (segm_stationEta==-1) && (
int)(clus_measuresPhi == 0));
219 auto sideA_phi =
Monitored::Scalar<int>(
"sideA_phi", (
int) (segm_stationEta==1) && (
int)(clus_measuresPhi!=0));
220 auto sideC_phi =
Monitored::Scalar<int>(
"sideC_phi", (
int) (segm_stationEta==-1) && (
int)(clus_measuresPhi!=0));
222 fill(
"CscSegmMonitor",status_mon, sideA_phi0, sideC_phi0, sideA_phi, sideC_phi);
230 float clus_qsum = 0, clus_time = -1.;
231 unsigned int clus_noStrips=0;
233 clus_qsum = theClus->
charge() * clus_kiloele;
234 clus_time = theClus->
time();
236 if(clus_measuresPhi == 0){
237 if(clus_stationEta == 1) eta_clus_count[0][0]++;
238 else eta_clus_count[1][0]++;
240 if(clus_stationEta == 1) phi_clus_count[0][0]++;
241 else phi_clus_count[1][0]++;
244 clus_noStrips = theClus->
rdoList().size();
249 bool clus_eta_status = clus_status && ( clus_noStrips > 2 ) && (clus_measuresPhi == 0);
250 bool clus_eta_eff = clus_stat_eff && ( clus_noStrips > 2 ) && (clus_measuresPhi == 0);
252 if(clus_stationEta == 1) eta_clus_count[0][1]++;
253 else eta_clus_count[1][1]++;
256 if(clus_stationEta == 1){
257 eta_clus_qsum[0][clus_wireLayer] = clus_qsum;
258 eta_clus_time[0][clus_wireLayer] = clus_time;
259 eta_clus_use[0][clus_wireLayer] = 1;
262 eta_clus_qsum[1][clus_wireLayer] = clus_qsum;
263 eta_clus_time[1][clus_wireLayer] = clus_time;
264 eta_clus_use[1][clus_wireLayer] = 1;
269 bool clus_phi_status = clus_status && ( clus_noStrips > 0 ) && (clus_measuresPhi == 1);
270 if(clus_phi_status) {
271 if(clus_stationEta==1){
272 phi_clus_qsum[0][clus_wireLayer] = clus_qsum;
273 phi_clus_time[0][clus_wireLayer] = clus_time;
274 phi_clus_use[0][clus_wireLayer] = 1;
275 phi_clus_count[0][1]++;
277 phi_clus_qsum[1][clus_wireLayer] = clus_qsum;
278 phi_clus_time[1][clus_wireLayer] = clus_time;
279 phi_clus_use[1][clus_wireLayer] = 1;
280 phi_clus_count[1][1]++;
285 if(clus_eta_status || clus_phi_status) clusCount[clus_isec][clus_ilay]++;
288 if(clus_eta_status) segmClustCount[clus_isec]++;
290 if(clus_eta_status) layerindex+=clus_wireLayer;
292 ATH_MSG_DEBUG(
"status = " << clus_stat <<
"\tcharge = " << clus_qsum <<
"\ttime= " << clus_time <<
"\tnstrips = " << clus_noStrips);
296 auto checkStatusEtaA =
Monitored::Scalar<int>(
"checkStatusEtaA", (
int) (clus_eta_status && (clus_stationEta==1)));
297 auto checkStatusEtaC =
Monitored::Scalar<int>(
"checkStatusEtaC", (
int) (clus_eta_status && (clus_stationEta==-1)));
298 auto checkTimeEtaA =
Monitored::Scalar<int>(
"checkTimeEtaA", (
int) (clus_eta_status && (clus_stationEta==1) && (std::abs(clus_time) <= 200)));
299 auto checkTimeEtaC =
Monitored::Scalar<int>(
"checkTimeEtaC", (
int) (clus_eta_status && (clus_stationEta==-1) && (std::abs(clus_time) <= 200)));
301 auto checkStatusPhiA =
Monitored::Scalar<int>(
"checkStatusPhiA", (
int) (clus_phi_status && (clus_stationEta==1)));
302 auto checkStatusPhiC =
Monitored::Scalar<int>(
"checkStatusPhiC", (
int) (clus_phi_status && (clus_stationEta==-1)));
303 auto checkTimePhiA =
Monitored::Scalar<int>(
"checkTimePhiA", (
int) (clus_phi_status && (clus_stationEta==1) && (std::abs(clus_time) <= 200)));
304 auto checkTimePhiC =
Monitored::Scalar<int>(
"checkTimePhiC", (
int) (clus_phi_status && (clus_stationEta==-1) && (std::abs(clus_time) <= 200)));
305 fill(
"CscSegmMonitor", clus_qsum_mon, clus_secLayer, clus_time_mon, checkStatusEtaA, checkStatusEtaC, checkTimeEtaA, checkTimeEtaC, checkStatusPhiA, checkStatusPhiC, checkTimePhiA, checkTimePhiC );
336 fill(
"CscSegmMonitor", tmp_etaClusA, checkClusEtaA, tmp_etaClusGoodA, checkClusEtaGoodA, tmp_phiClusA, tmp_phiClusGoodA, checkClusPhiA, checkClusPhiGoodA, tmp_etaClusC, checkClusEtaC, tmp_etaClusGoodC, checkClusEtaGoodC, tmp_phiClusC, tmp_phiClusGoodC, checkClusPhiC, checkClusPhiGoodC);
339 std::vector<int> tmp_layerIndexA;
340 std::vector<int> tmp_isectA;
341 std::vector<int> tmp_layerIndexC;
342 std::vector<int> tmp_isectC;
344 for(
int isect = 1; isect < 17; isect++) {
346 if(segmClustCount[isect+16] > 2 ) {
347 tmp_layerIndexA.push_back(layerindex-5);
348 tmp_isectA.push_back(isect);
351 if(segmClustCount[isect+16] > 3){
352 for(
int i=1;
i<=4;
i++) {
353 tmp_layerIndexA.push_back(
i);
354 tmp_isectA.push_back(isect);
358 if(segmClustCount[isect] > 2) {
359 tmp_layerIndexC.push_back(layerindex-5);
360 tmp_isectC.push_back(-1.*isect);
364 if(segmClustCount[isect] > 3) {
365 for(
int i=1;
i<=4;
i++) {
366 tmp_layerIndexC.push_back(
i);
367 tmp_isectC.push_back(-1.*isect);
376 fill(
"CscSegmMonitor", tmp_layerIndexA_mon, tmp_isectA_mon, tmp_layerIndexC_mon, tmp_isectC_mon);
378 float eta_clus_qsum_tot = 0., phi_clus_qsum_tot = 0.;
380 for(
unsigned int i=0;
i < 2;
i++){
381 eta_clus_qsum_tot = 0; phi_clus_qsum_tot = 0.;
383 for(
unsigned int j = 1; j <5; j++) {
387 fill(
"CscSegmMonitor", etaClusQSumA, phiClusQSumA);
389 if(std::abs(eta_clus_time[
i][j]) <= 200) {
391 fill(
"CscSegmMonitor", etaTimeClusA);
394 if(std::abs(phi_clus_time[
i][j]) <= 200) {
396 fill(
"CscSegmMonitor", phiTimeClusA);
403 fill(
"CscSegmMonitor", etaClusQSumC, phiClusQSumC);
405 if(std::abs(eta_clus_time[
i][j]) <= 200) {
407 fill(
"CscSegmMonitor", etaTimeClusC);
410 if(std::abs(phi_clus_time[
i][j]) <= 200) {
412 fill(
"CscSegmMonitor", phiTimeClusC);
416 if(phi_clus_use[
i][j] && eta_clus_use[
i][j]){
417 eta_clus_qsum_tot += eta_clus_qsum[
i][j];
418 phi_clus_qsum_tot += phi_clus_qsum[
i][j];
423 fill(
"CscSegmMonitor", etaQSumGoodClusA, phiQSumGoodClusA);
424 if(std::abs(eta_clus_time[
i][j]) <= 200){
426 fill(
"CscSegmMonitor", etaTimeGoodClusA);
429 if(std::abs(phi_clus_time[
i][j]) <= 200) {
431 fill(
"CscSegmMonitor", phiTimeGoodClusA);
438 fill(
"CscSegmMonitor", etaQSumGoodClusC, phiQSumGoodClusC);
439 if(std::abs(eta_clus_time[
i][j]) <= 200){
441 fill(
"CscSegmMonitor", etaTimeGoodClusC);
444 if(std::abs(phi_clus_time[
i][j]) <= 200) {
446 fill(
"CscSegmMonitor", phiTimeGoodClusC);
455 fill(
"CscSegmMonitor", etaQSumTotA, phiQSumTotA);
461 fill(
"CscSegmMonitor", etaQSumTotC, phiQSumTotC);
468 return StatusCode::SUCCESS;
490 for(
unsigned int i = 0;
i< mbs.size(); ++
i){
509 unsigned int nrHits(0);
512 for(
unsigned int i = 0;
i< mbs.size(); ++
i){
532 float s1corr =
s1 - 0.000119 * s0;
533 bool good_segm = std::abs(s1corr)<
cut ? true :
false;