/***************************************************************************** * plugSpike.cc * * * * Author: Willis Sakumoto * * Description: plugSpike.cc is used to find isolated energy "spikes" in * * the plug. It finds the total energy in the towers adjacent * * to a target tower, specifed by TOWE coordinates (teta,tphi) * * and the tile index, itile. This function assumes that the * * west plug TOWE eta index spans 4-15 * *****************************************************************************/ #include "CalorObjects/plugSpike.hh" bool plugSpike (CalData_ch calData, const int teta, const int tphi, const int iTile, Detector iDet, float& eTwr, float& eSum, int& nTowers) { // plugSpike finds the energy in the plug towers directly adjacent to the // target tower specified by the input to this function. These coordinates // are TOWE coordinates. The tile/pmt needs to be specified in the region // that overlaps the central. The plug detector is specified via iDet, andi // nTowers gives the number of plug towers included in the energy sum. This // function is primarily for identifying "spikes" in the plug, where a tower // has lots of energy and the bordering towers have very little or none. If // there is real energy in a tower, the adjacent, neighboring towers will // have energy, about 1% per edge from light cross talk, and at least 5-10% // from the lateral spread of real showers (em and had). eSum = 0.0; // Energy sum eTwr = 0.0; // Energy in test tower nTowers = 0; // No. of towers in sum // Check that the target tower exists, if it does, set the tower energy. // For low energies, the adjacent tower energy sum can be zero because of // the calData tower energy threshold. CellKey cKey; cKey = CellKey( teta, tphi, iDet ); if ( !cKey.isValid() ) return false; const CalTower* tTwr = calData->tower( teta, tphi ); if ( !tTwr ) return false; eTwr = tTwr->pmtEnergy( cKey, iTile ); if ( eTwr < 3.0) return false; // Indeterminate // Convert the TOWE (teta,tphi) index of the tower to local coordinates: // leta -> 4-15; lphi -> 0-47. The leta is based on the west plug eta tower // numbering in TOWE. All plug towers from letaP75 and higher have 7.5 degree // phi segmentation. Plug towers from letaP15 and lower have 15 degree phi // segmentation, and lphi for these towers are 0, 2, 4, 6, ... const int letaMin = 4; // Min leta index const int letaMax = 15; // Max leta index const int letaP15 = 7; // Max physical 15 deg index const int letaP75 = 8; // Min physical 7.5 deg index const int letaL15 = 14; // Min logical 15 deg index const int leta = (teta < TOWER_NETA/2) ? teta : (TOWER_NETA-1) - teta; if (leta < letaMin || leta > letaMax) return false; const int lphi = (leta <= letaP15) ? 2*tphi : ( (leta >= letaL15) ? 2*tphi + iTile : tphi ); /* std::cout << "plugSpike: " << teta << " " << tphi << " " << iDet << " -- leta/lphi " << leta << " " << lphi << std::endl; */ // Set up the lphi range for the energy sum: MinP->MaxP, incr = IncP. The mphi // index are for the 5 cases depending on the leta of the target tower: 0 - all // 7.5 degree towers; 1 - leta=letaP75 and itile=0; 2 - leta=letaP75 and // itile=1; 3 - leta=letaP15; and 4 - all 15 degree towers //----------- mphi = 0 1 2 3 4 ---- const int MinP[5][3]={{-1,-1,-1},{-2,-1,-1},{ 0,-1,-1},{-2,-2,-1},{-2,-2,-2}}; const int MaxP[5][3]={{ 1, 1, 1},{ 0, 1, 1},{ 2, 1, 1},{ 2, 2, 2},{ 2, 2, 2}}; const int IncP[5][3]={{ 1, 1, 1},{ 2, 1, 1},{ 2, 1, 1},{ 2, 2, 1},{ 2, 2, 2}}; //----------------------------------------------------------------------------- int mphi = 0; // All 7.5 degree towers if (leta == letaP75) { if ( (lphi % 2) == 0 ) mphi = 1; else mphi = 2; } else if (leta == letaP15) mphi = 3; else if (leta < letaP15) mphi = 4; // All 15 degree towers // // Loop over the eta and phi indices about the target tower (leta,lphi) // for (int ie = 0; ie < 3; ie++) { int ieta = leta + ie - 1; if (ieta < letaMin || ieta > letaMax) continue; // Must be in plug int kETA = (teta < TOWER_NETA/2) ? ieta : (TOWER_NETA-1) - ieta; for (int ip = MinP[mphi][ie]; ip <= MaxP[mphi][ie]; ip += IncP[mphi][ie]) { int iphi = (lphi + 48 + ip) % 48; int kPHI = (ieta >= letaL15 || ieta <= letaP15) ? iphi / 2 : iphi; int itile = 0; if (ieta >= letaL15) itile = iphi % 2; /* std::cout << " plug ring 1: " << ieta << " " << iphi << " TOWE> " << kETA << " " << kPHI << " " << itile << std::endl; */ // // For CellKey, (kETA,kPHI) are TOWE coordinates // cKey = CellKey( kETA, kPHI, iDet ); if (cKey.isValid()) { const CalTower* cTwr = calData->tower( kETA, kPHI ); if ( !cTwr ) continue; if (ie == 1 && ip == 0) continue; // Skip the target tower... eSum += cTwr->pmtEnergy( cKey, itile ); ++nTowers; } } } return true; }