CMS 3D CMS Logo

/data/git/CMSSW_5_3_11_patch5/src/OnlineDB/EcalCondDB/src/EcalCommon.cc

Go to the documentation of this file.
00001 #include <math.h>
00002 #include <stdexcept>
00003 
00004 #include "OnlineDB/EcalCondDB/interface/EcalCommon.h"
00005 
00006 using namespace std;
00007 
00008 int EcalCommon::crystalToTriggerTower(int xtal)
00009   throw(std::runtime_error)
00010 {
00011   if (xtal < 1 || xtal > 1700) {
00012     throw(std::runtime_error("ERROR:  crystalToTriggerTower:  crystal number out of bounds"));
00013   }
00014   
00015   int i   = (int) floor((xtal-1)/20.0);
00016   int j   = (xtal-1) - 20*i;
00017   int tti = (int) floor(i/5.0);
00018   int ttj = (int) floor(j/5.0);
00019   int tt  = ttj + 4*tti + 1;
00020 
00021   return tt;
00022 }
00023