Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:31:57

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 }