61 StatusCode
sc = StatusCode::SUCCESS;
76 return StatusCode::FAILURE;
79 ATH_MSG_DEBUG (
" Size of Cluster Collection : " << cscCluster->size() );
80 ATH_MSG_DEBUG (
" Size of Strip Collection : " << cscStrip->size() );
90 int clusCount[33][9], sigclusCount[33][9];
91 unsigned int nEtaClusWidthCnt = 0, nPhiClusWidthCnt = 0;
92 for(
unsigned int kl = 0; kl < 33; kl++ ) {
93 for(
unsigned int km = 0; km < 9; km++ ) {
94 clusCount[kl][km] = 0;
95 sigclusCount[kl][km] = 0;
99 float stripsSum_EA = 0.;
100 float stripsSum_EAtest = -50.;
101 float stripsSum_EC = 0.;
102 float stripsSum_ECtest = -50.;
104 ATH_MSG_DEBUG (
" Begin loop over clusters ============================");
108 const std::vector<Identifier>& stripIds = iClus.
rdoList();
109 float clu_charge = iClus.
charge();
112 ATH_MSG_DEBUG(
" cluster charge = " << clu_charge <<
"\t cluster time = " << clu_time );
114 unsigned int noStrips = stripIds.size();
119 int stationName =
m_idHelperSvc->cscIdHelper().stationName(clusId);
120 std::string stationString =
m_idHelperSvc->cscIdHelper().stationNameString(stationName);
121 int chamberType = stationString ==
"CSS" ? 0 : 1;
124 int wireLayer =
m_idHelperSvc->cscIdHelper().wireLayer(clusId);
125 int measuresPhi =
m_idHelperSvc->cscIdHelper().measuresPhi(clusId);
132 fill(
"CscClusMonitor",
z,
r);
133 fill(
"CscClusMonitor",
y,
x);
138 int xfac = measuresPhi ? -1 : 1;
142 stripsSum_EA = stripsSum_EA + noStrips;
144 if(stripsSum_EA > stripsSum_EAtest) {
145 stripsSum_EAtest = stripsSum_EA;
148 if(secLayer < 0. || secLayer == 0.) {
149 stripsSum_EC = stripsSum_EC + noStrips;
151 if(stripsSum_EC > stripsSum_ECtest) {
152 stripsSum_ECtest = stripsSum_EC;
156 int ns = sectorNo < 0 ? sectorNo*(-1) : sectorNo+16;
157 int nl = (measuresPhi ? wireLayer : wireLayer+4);
164 ATH_MSG_DEBUG(
" ns = " << ns <<
"\tm_nl = " << nl <<
"\tm_sec = " << sectorNo <<
"\t m_lay= " << wireLayer <<
"\tmPhi = " << measuresPhi);
171 bool cluster_status = ( (stat ==
"unspoiled") ||
172 (stat ==
"unspoiled with split") ||
177 bool eta_cluster_status = cluster_status && ( noStrips > 2 ) && (measuresPhi == 0);
180 bool phi_cluster_status = cluster_status && ( noStrips > 0 ) && (measuresPhi == 1);
182 ATH_MSG_DEBUG (
" ClusterStatus eta = " << eta_cluster_status <<
" ,phi = " << phi_cluster_status);
184 << measuresPhi <<
",wire:" << wireLayer <<
") = " << secLayer <<
" status = "
185 << stat <<
" #of strips = " << noStrips );
188 if(eta_cluster_status || phi_cluster_status ) {
190 bool found_id =
true;
191 std::vector <const CscStripPrepData*> stripVec;
192 std::vector <float> fStripIDs;
194 float maxStripCharge = 0., maxStipId = 0.;
195 int sIdx = 0, mxIdx = 0;
199 fill(
"CscClusMonitor",noStrips_mon, secLayer,clus_phi_mon, clus_eta_mon);
209 for ( std::vector<Identifier>::const_iterator sId = stripIds.begin(); sId != stripIds.end(); ++sId, sIdx++ ) {
213 fStripIDs.push_back(stripid);
215 fill(
"CscClusMonitor",stripid, secLayer);
219 if ( icol ==
nullptr ) {
227 bool found_strip =
false;
228 float maxsampChVal = 0.;
231 found_strip = ( *istrip )->identify() == id ;
233 stripVec.push_back(*istrip);
234 std::vector<float> samp_charges = ( *istrip )->sampleCharges();
235 for(
unsigned int i = 0; i < samp_charges.size(); i++ ) {
236 if(samp_charges[i] > maxsampChVal) maxsampChVal = samp_charges[i];
238 if(maxsampChVal > maxStripCharge ) {
239 maxStripCharge = maxsampChVal;
246 ATH_MSG_DEBUG (
" " << (found_strip?
"FoundStrip " :
"NoStripFound ") <<
" with max sampling = " << maxsampChVal);
251 ATH_MSG_DEBUG (
" Max Strip charge = " << maxStripCharge <<
" and strip Id = " << maxStipId <<
" and index = " << mxIdx);
252 float qmax = 0., qleft = 0., qright = 0., qsum = 0.;
255 bool size_ids_coll = (noStrips == stripVec.size() ?
true :
false) ;
257 if(found_id && size_ids_coll ) {
259 std::vector<ICscStripFitter::Result>
res;
261 bool range_check = (mxIdx > -1) && (mxIdx <
int(noStrips));
263 ATH_MSG_DEBUG (
" Range check = (" << mxIdx <<
" > -1 ) && (" << mxIdx <<
" < " << noStrips <<
" ) = " << range_check
264 <<
"\t size of vec check " << noStrips <<
" == " << stripVec.size());
270 qleft =
res[0].charge;
273 <<
res[0].time <<
" +- " <<
res[0].dtime <<
"\t w +- dw = " <<
res[0].
width <<
" +- "
274 <<
res[0].dwidth <<
"\t status= " <<
res[0].status <<
"\t chisq= " <<
res[0].chsq);
278 qmax =
res[1].charge;
281 <<
res[1].time <<
" +- " <<
res[1].dtime <<
"\t w +- dw = " <<
res[1].
width <<
" +- "
282 <<
res[1].dwidth <<
"\t status= " <<
res[1].status <<
"\t chisq= " <<
res[1].chsq);
284 if(mxIdx+1 <
int(noStrips)) {
286 qright =
res[2].charge;
289 <<
res[2].time <<
" +- " <<
res[2].dtime <<
"\t w +- dw = " <<
res[2].
width <<
" +- "
290 <<
res[2].dwidth <<
"\t status= " <<
res[2].status <<
"\t chisq= " <<
res[2].chsq);
298 float kiloele = 1.0e-3;
326 if(signal) sigclusCount[ns][nl]++;
330 fill(
"CscClusMonitor",fStripIDs_col, QmaxADC, secLayer, noStrips_mon, QsumADC, clu_time, clu_charge_kiloele, clus_phi, clus_eta, clus_phiSig, clus_etaSig, clus_phiNoise, clus_etaNoise, signal_mon, noise_mon, sideA, sideC, sideA_phiSig, sideC_phiSig);
339 fill(
"CscClusMonitor",stripsSum_EA_mon, stripsSum_EC_mon);
342 ATH_MSG_DEBUG (
" End loop over clusters ============================");
345 fill(
"CscClusMonitor",nPhiClusWidthCnt_mon,nEtaClusWidthCnt_mon);
348 int numeta = 0, numphi = 0;
349 int numetasignal = 0, numphisignal = 0;
352 for(
int kl = 1; kl < 33; kl++ ) {
355 int eta_hits[4] = {0,0,0,0};
356 bool chamber_empty =
true;
357 int sec = kl < 17 ? kl*(-1) : kl;
358 for(
int km = 1; km < 9; km++ ) {
359 int lay = (km > 4 && km < 9) ? km-4 : km;
360 bool mphi = (km > 0 && km < 5) ?
true :
false;
361 std::string wlay = mphi ?
"Phi-Layer " :
"Eta-Layer: ";
362 int count = clusCount[kl][km];
363 int scount = sigclusCount[kl][km];
366 ATH_MSG_DEBUG (
"sec[" << sec <<
"]\t" << wlay <<
"[" << lay <<
"] = " << monstruct.secLayer.back() <<
"= " <<
"\tNsig = " << scount <<
", Ntot = " <<
count);
370 chamber_empty =
false;
371 numphisignal += scount;
378 chamber_empty =
false;
379 numetasignal +=scount;
382 ATH_MSG_DEBUG ( wlay <<
"Counts sec: [" << kl-16 <<
"]\tlayer: [" << km <<
"] = " << monstruct.secLayer.back() <<
"\t = " <<
count <<
"\t" << scount);
385 monstruct.count_mon.push_back(
count);
386 monstruct.scount_mon.push_back(scount);
387 monstruct.count_diff.push_back(
count-scount);
388 monstruct.mphi_true.push_back((
int)mphi &&
count);
389 monstruct.mphi_false.push_back((
int)!(mphi) &&
count);
390 monstruct.scount_phi_true.push_back((
int)mphi &&
count && scount);
391 monstruct.scount_phi_false.push_back((
int)mphi &&
count && !scount);
392 monstruct.scount_eta_true.push_back((
int)!(mphi) &&
count && scount);
393 monstruct.scount_eta_false.push_back((
int)!(mphi) &&
count && !scount);
394 monstruct.secLayer.push_back((sec + 0.2 * (lay - 1) + 0.1));
398 int segNum_new = -999.;
400 std::ostringstream nseglist;
401 std::bitset<4> segNum;
402 for(
unsigned int mm = 0; mm < 4; mm++) {
403 bool set = (eta_hits[mm] > 0 ? true :
false);
404 if(
set) segNum.set(mm);
405 nseglist << (
set ?
"1" :
"0");
407 segNum_new = segNum.to_ulong();
408 ATH_MSG_DEBUG(
"segments= " << nseglist.str() <<
"\t = " << segNum.to_ulong());
412 fill(
"CscClusMonitor", segNum_mon, sec_mon);
415 ATH_MSG_DEBUG(
" numphi = " << numphi <<
"\t numeta = " << numeta <<
"\tm_sphi = " << numphisignal <<
"\t m_seta = " << numetasignal);
422 auto num_num_noise_mon =
Monitored::Scalar<int>(
"num_num_noise_mon", (numphi-numphisignal)+(numeta-numetasignal));
426 fill(
"CscClusMonitor",numphi_mon,numeta_mon,numphi_sig_mon,numeta_sig_mon,numphi_numeta_mon,numphi_numeta_sig_mon,num_num_noise_mon,numphi_diff_mon,numeta_diff_mon);
441 fill(
"CscClusMonitor", count_mon, scount_mon, count_diff, secLayer, mphi_true, mphi_false, scount_phi_true, scount_phi_false, scount_eta_true, scount_eta_false);