File indexing completed on 2024-04-06 12:23:01
0001 #include <cmath>
0002 #include <stdexcept>
0003
0004 #include "OnlineDB/EcalCondDB/interface/EcalCommon.h"
0005
0006 using namespace std;
0007
0008 int EcalCommon::crystalToTriggerTower(int xtal) noexcept(false) {
0009 if (xtal < 1 || xtal > 1700) {
0010 throw(std::runtime_error("ERROR: crystalToTriggerTower: crystal number out of bounds"));
0011 }
0012
0013 int i = (int)floor((xtal - 1) / 20.0);
0014 int j = (xtal - 1) - 20 * i;
0015 int tti = (int)floor(i / 5.0);
0016 int ttj = (int)floor(j / 5.0);
0017 int tt = ttj + 4 * tti + 1;
0018
0019 return tt;
0020 }