- for ( int fec = 0; fec < mapping->GetNfec(patch, branch); fec++ ) {
- for ( int altro = 0; altro < 8; altro++ ) {
- Float_t rms = 0.;
- Float_t ctr = 0.;
- for ( int channel = 0; channel < 16; channel++ ) {
- Int_t hwadd = mapping->CodeHWAddress(branch, fec, altro, channel);
- Int_t row = mapping->GetPadRow(patch, hwadd);
- Int_t pad = mapping->GetPad(patch, hwadd);
- Float_t ped = calibPedestal.GetCalRocPedestal(roc)->GetValue(row,pad);
- // fixed pedestal
- if ( ped > 1.e-10 ) {
- pedfile << ctr_channel << "\t" << side << "\t" << sector << "\t" << patch << "\t"
- << hwadd << "\t" << ped << std::endl;
- ctr_channel++;
- }
- // pedestal(t)
- if ( timePed && fabs(timePed[row][pad].GetSum()) > 1e-10 ) {
- pedmemfile << ctr_pattern << "\t" << side << "\t" << sector << "\t" << patch
- << "\t" << hwadd;
- for ( Int_t timebin = 0; timebin < 1024; timebin++ )
- pedmemfile << "\t" << timePed[row][pad].At(timebin);
- pedmemfile << std::endl;
- ctr_pattern++;
- }
- // rms=noise
- Float_t rms2 = calibPedestal.GetCalRocRMS(roc)->GetValue(row,pad);
- if ( rms2 > 1.e-10 ) { rms += rms2; ctr += 1.; }
- } // end channel for loop
- // noise data (rms) averaged over all channels in this ALTRO.
- Int_t hwadd = mapping->CodeHWAddress(branch, fec, altro, 0);
- if ( ctr > 1.e-10 ) {
- noisefile << ctr_altro << "\t" << side << "\t" << sector << "\t" << patch << "\t"
- << hwadd << "\t" << rms/ctr << std::endl;
- ctr_altro++;
- }
- } // end altro for loop
- } // end fec for loop
+ for ( int fec = 0; fec < mapping->GetNfec(rcu, branch); fec++ ) {
+ for ( int altro = 0; altro < 8; altro++ ) {
+ Float_t rms = 0.;
+ Float_t maxrms = 0.;
+ Float_t ctr_altrochannel = 0.;
+ for ( int channel = 0; channel < 16; channel++ ) {
+ Int_t hwadd = mapping->CodeHWAddress(branch, fec, altro, channel);
+ Int_t row = mapping->GetPadRow(rcu, hwadd); // row in a ROC
+ Int_t globalrow = mapping->GetGlobalPadRow(rcu, hwadd); // row in full sector
+ Int_t pad = mapping->GetPad(rcu, hwadd);
+ Float_t ped = calibPedestal.GetCalRocPedestal(roc)->GetValue(row,pad);
+ // fixed pedestal
+ pedfile << ctr_channel++ << "\t" << side << "\t" << sector << "\t" << rcu << "\t"
+ << hwadd << "\t" << ped << std::endl;
+ // pedestal(t)=pedestal memories
+ if ( timePed && fabs(timePed[globalrow][pad].GetSum()) > 1e-10 ) {
+ pedmemfile << ctr_pattern++ << "\t" << side << "\t" << sector << "\t" << rcu
+ << "\t" << hwadd;
+ for ( Int_t timebin = 0; timebin < 1024; timebin++ )
+ pedmemfile << "\t" << timePed[globalrow][pad].At(timebin);
+ pedmemfile << std::endl;
+ }
+ // rms=noise
+ Float_t rms2 = calibPedestal.GetCalRocRMS(roc)->GetValue(row,pad);
+ if ( fabs(ped) < 1.e-10 ) { // dead channel
+ deadchannelfile << ctr_dead++ << "\t" << side << "\t" << sector << "\t"
+ << rcu << "\t" << hwadd << "\t" << rms2 << std::endl;
+ } else if ( (ped > 1.e-10) && (rms2 > 1.e-10) ) { // not dead
+ // Find noisy channels
+ if ( rms2 > 6.0 ) { // VERY noisy
+ verynoisychannelfile << ctr_vnoisy++ << "\t" << side << "\t" << sector << "\t"
+ << rcu << "\t" << hwadd << "\t" << rms2 << std::endl;
+
+ } else if ( ((roc<36) && (rms2 > 2.0)) || // IROC
+ ((roc>35) && (row<65) && (rms2 > 2.0)) || // OROC, small pads
+ ((roc>35) && (row>64) && (rms2 > 3.0)) ) { // OROC, large pads (50% more signal)
+ noisychannelfile << ctr_noisy++ << "\t" << side << "\t" << sector << "\t"
+ << rcu << "\t" << hwadd << "\t" << rms2 << std::endl;
+ } else {
+ // Not noisy. Get average and maximum noise in this ALTRO
+ rms += rms2;
+ ctr_altrochannel += 1.;
+ if (rms2 > maxrms) maxrms = rms2;
+ } // end if noisy
+ } // end if some signal
+ } // end channel for loop
+ Int_t hwadd = mapping->CodeHWAddress(branch, fec, altro, 0); // ALTRO address
+ // Noise data (rms) averaged over all channels in this ALTRO.
+ if ( ctr_altrochannel > 1.e-10 ) {
+ /*
+ // average noise of this ALTRO (excluding high-noise channels)
+ noisefile << ctr_altro << "\t" << side << "\t" << sector << "\t" << rcu << "\t"
+ << hwadd << "\t" << rms/ctr_altrochannel << std::endl;
+ */
+ // maximum noise of this ALTRO (excluding high-noise channels)
+ noisefile << ctr_altro << "\t" << side << "\t" << sector << "\t" << rcu << "\t"
+ << hwadd << "\t" << maxrms << std::endl;
+ ctr_altro++;
+ }
+ } // end altro for loop
+ } // end fec for loop