#include "TCesClusterFitter.hh" #include #include // ***************************************************************** TCesClusterFitter::TCesClusterFitter() { // constants CESRADIUS = 184.15; N_PHI_STRIP = 64; PHI_STRIP_OFFSET = 21.82258; PHI_STRIP_PITCH = 1.45484; N_Z_STRIP1 = 69; N_Z_STRIP2 = 59; Z_STRIP_OFFSET1 = 6.16; Z_STRIP_OFFSET2 = 121.183; Z_STRIP_PITCH1 = 1.667; Z_STRIP_PITCH2 = 2.007; GEV_TO_ADC_WIRE = 240.3846; GEV_TO_ADC_STRIP = 120.0480; CONST1 = 0.036864; CONST2 = 0.002704; DXMIN = 0.05; double currentLocation = Z_STRIP_OFFSET1; for(int i=0; i<129; ++i) { _strippos[i] = currentLocation; if(i>=N_Z_STRIP1) { currentLocation += Z_STRIP_PITCH2; } else { currentLocation += Z_STRIP_PITCH1; } } currentLocation = PHI_STRIP_OFFSET; for(int i=0; i<33; ++i) { if(i==0) { currentLocation = PHI_STRIP_OFFSET + PHI_STRIP_PITCH/2.0; } else if(i==1) { currentLocation = PHI_STRIP_OFFSET; } else if(i==32) { currentLocation = PHI_STRIP_OFFSET - PHI_STRIP_PITCH*(i-2) - PHI_STRIP_PITCH/2.0; } else { currentLocation = PHI_STRIP_OFFSET - PHI_STRIP_PITCH*(i-1); } _wirepos[i] = currentLocation; } initArrays(); } // ***************************************************************** TCesClusterFitter::~TCesClusterFitter() {} // ***************************************************************** void TCesClusterFitter::initArrays() { // frozen electron shower profile (1985 test beam) // initialize here so cint can compile it static const double pos1[300] = { -100.,-99.,-98.,-97.,-96.,-95.,-94.,-93., -92.,-91.,-90.,-89.,-88.,-87.,-86.,-85.,-84.,-83.,-82.,-81.,-80., -79.,-78.,-77.,-76.,-75.,-74.,-73.,-72.,-71.,-70.,-69.,-68.,-67., -66.,-65.,-64.,-63.,-62.,-61.,-60.,-59.,-58.,-57.,-56.,-55.,-54., -53.,-52.,-51.,-50.,-49.,-48.,-47.,-46.,-45.,-44.,-43.,-42.,-41., -40.,-39.,-38.,-37.,-36.,-35.,-34.,-33.,-32.,-31.,-30.,-29.,-28., -27.,-26.,-25.,-24.,-23.,-22.,-21.,-20.,-19.,-18.,-17.,-16.,-15., -14.,-13.,-12.,-11.,-10.,-9.,-8.,-7.,-6.,-5.,-4.,-3.,-2.,-1.,0., 1.,2.,3.,4.,5.,6.,7.,8.,9.,10.,11.,12.,13.,14.,15.,16.,17.,18., 19.,20.,21.,22.,23.,24.,25.,26.,27.,28.,29.,30.,31.,32.,33.,34., 35.,36.,37.,38.,39.,40.,41.,42.,43.,44.,45.,46.,47.,48.,49.,50., 51.,52.,53.,54.,55.,56.,57.,58.,59.,60.,61.,62.,63.,64.,65.,66., 67.,68.,69.,70.,71.,72.,73.,74.,75.,76.,77.,78.,79.,80.,81.,82., 83.,84.,85.,86.,87.,88.,89.,90.,91.,92.,93.,94.,95.,96.,97.,98., 99.,100.,101.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0., 0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0., 0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0., 0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0., 0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. }; static const double corrections[6][300] = { .0028901, .0029476,.0030095,.0030758,.0031463,.003221,.0032999,.0033831, .0034706,.0035624,.0036586,.0037594,.0038648,.0039749,.0040899, .0042099,.0043351,.0044657,.0046018,.0047437,.0048915,.0050455, .005206,.0053732,.0055473,.0057288,.0059178,.0061147,.0063199, .0065337,.0067565,.0069888,.0072308,.0074832,.0077463,.0080208, .008307,.0086057,.0089173,.0092425,.009582,.0099366,.010307, .010694,.011098,.01152,.011962,.012424,.012908,.013414,.013943, .014498,.01508,.015689,.016329,.016999,.017704,.018444,.019222, .02004,.020902,.02181,.022767,.023778,.024846,.025976,.027173, .028443,.029793,.03123,.032762,.0344,.036154,.038038,.040067, .042259,.044635,.047218,.050039,.053133,.056541,.060312,.064508, .0692,.074478,.080449,.087245,.095027,.10399,.11439,.12653,.14077, .1576,.1776,.20151,.23025,.26499,.30721,.35876,.42202,.5,.57798, .64124,.69279,.73501,.76975,.79849,.8224,.8424,.85923,.87347, .88561,.89601,.90497,.91275,.91955,.92552,.9308,.93549,.93969, .94346,.94687,.94996,.95278,.95537,.95774,.95993,.96196,.96385, .9656,.96724,.96877,.97021,.97156,.97283,.97402,.97515,.97622, .97723,.97819,.9791,.97996,.98078,.98156,.9823,.983,.98367,.98431, .98492,.9855,.98606,.98659,.98709,.98758,.98804,.98848,.9889, .98931,.98969,.99006,.99042,.99076,.99108,.99139,.99169,.99198, .99225,.99252,.99277,.99301,.99324,.99347,.99368,.99389,.99408, .99427,.99445,.99463,.99479,.99495,.99511,.99526,.9954,.99553, .99566,.99579,.99591,.99603,.99614,.99624,.99634,.99644,.99653, .99662,.9967,.99678,.99685,.99692,.99699,.99705,.99711,.99716,0., 0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0., 0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0., 0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0., 0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0., 0.,0.,0.,0.,0.,0.,0.,0.,0.,.0028586,.0029333,.0030109,.0030915, .0031751,.003262,.0033522,.0034458,.003543,.0036438,.0037485, .0038573,.0039701,.0040873,.004209,.0043353,.0044666,.0046029, .0047444,.0048915,.0050444,.0052032,.0053683,.0055399,.0057183, .0059038,.0060968,.0062975,.0065064,.0067238,.0069501,.0071858, .0074312,.0076868,.0079532,.0082308,.0085203,.0088221,.009137, .0094656,.0098087,.010167,.010541,.010932,.011341,.011769,.012216, .012685,.013175,.01369,.014229,.014795,.015389,.016014,.01667, .017361,.018089,.018856,.019666,.020521,.021425,.022383,.023398, .024476,.025622,.026842,.028144,.029535,.031024,.032622,.03434, .036192,.038192,.040358,.042711,.045274,.048073,.05114,.054512, .058232,.062348,.06692,.072016,.077718,.08412,.091335,.099499, .10877,.11934,.13142,.1453,.1613,.1798,.20126,.22626,.25546, .28968,.32991,.37735,.43346,.5,.56654,.62265,.67009,.71032,.74454, .77374,.79874,.8202,.8387,.8547,.86858,.88066,.89123,.9005,.90866, .91588,.92228,.92798,.93308,.93765,.94177,.94549,.94886,.95193, .95473,.95729,.95964,.96181,.96381,.96566,.96738,.96898,.97047, .97186,.97316,.97438,.97552,.9766,.97762,.97857,.97948,.98033, .98114,.98191,.98264,.98333,.98399,.98461,.9852,.98577,.98631, .98682,.98732,.98778,.98823,.98866,.98907,.98946,.98983,.99019, .99053,.99086,.99118,.99148,.99177,.99205,.99231,.99257,.99281, .99305,.99328,.99349,.9937,.9939,.9941,.99428,.99446,.99463,.9948, .99496,.99511,.99526,.9954,.99553,.99566,.99579,.99591,.99603, .99614,.99625,.99636,.99646,.99655,.99665,.99674,.99682,.99691, .99699,.99707,.99714,.99721,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0., 0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0., 0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0., 0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0., 0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0., 9.531e-5,-1.6773e-5,-1.3116e-4,-2.4577e-4,-3.6375e-4,-4.8198e-4, -6.0255e-4,-7.2443e-4,-8.4869e-4,-9.7323e-4,-.0011002,-.0012285, -.0013592,-.0014903,-.0016238,-.0017576,-.001894,-.0020318, -.002171,-.0023107,-.0024529,-.0025966,-.0027408,-.0028875, -.0030348,-.0031847,-.0033351,-.0034871,-.0036408,-.0037961, -.0039531,-.0041118,-.004271,-.0044332,-.0045971,-.0047627, -.0049313,-.0051018,-.0052741,-.0054493,-.0056277,-.0058091, -.0059936,-.0061824,-.0063754,-.0065717,-.0067747,-.0069821, -.0071962,-.0074172,-.0076451,-.007881,-.0081263,-.0083822, -.0086487,-.0089282,-.0092198,-.009527,-.00985,-.010191,-.010551, -.010931,-.011335,-.011763,-.012217,-.012701,-.013213,-.013759, -.014339,-.014956,-.015609,-.016303,-.017039,-.017816,-.018636, -.0195,-.020406,-.021352,-.022339,-.023362,-.024416,-.025496, -.026596,-.027704,-.028812,-.029904,-.030968,-.031985,-.032938, -.033805,-.034566,-.0352,-.035685,-.036008,-.036158,-.036137, -.035959,-.035663,-.03532,-.035046,-.035016,-.035046,-.03532, -.035663,-.035959,-.036137,-.036158,-.036008,-.035685,-.0352, -.034566,-.033805,-.032938,-.031985,-.030968,-.029904,-.028812, -.027704,-.026596,-.025496,-.024416,-.023362,-.022339,-.021352, -.020406,-.0195,-.018636,-.017816,-.017039,-.016303,-.015609, -.014956,-.014339,-.013759,-.013213,-.012701,-.012217,-.011763, -.011335,-.010931,-.010551,-.010191,-.00985,-.009527,-.0092198, -.0089282,-.0086487,-.0083822,-.0081263,-.007881,-.0076451, -.0074172,-.0071962,-.0069821,-.0067747,-.0065717,-.0063754, -.0061824,-.0059936,-.0058091,-.0056277,-.0054493,-.0052741, -.0051018,-.0049313,-.0047627,-.0045971,-.0044332,-.004271, -.0041118,-.0039531,-.0037961,-.0036408,-.0034871,-.0033351, -.0031847,-.0030348,-.0028875,-.0027408,-.0025966,-.0024529, -.0023107,-.002171,-.0020318,-.001894,-.0017576,-.0016238, -.0014903,-.0013592,-.0012285,-.0011002,-9.7323e-4,-8.4869e-4, -7.2443e-4,-6.0255e-4,-4.8198e-4,-3.6375e-4,-2.4577e-4,-1.3116e-4, -1.6773e-5,9.531e-5,.0028901,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0., 0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0., 0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0., 0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0., 0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0., 5.5339e-5,5.9759e-5,6.4089e-5,6.8358e-5,7.2593e-5,7.6818e-5, 8.1054e-5,8.5322e-5,8.9639e-5,9.4022e-5,9.8489e-5,1.0305e-4, 1.0773e-4,1.1254e-4,1.1748e-4,1.2259e-4,1.2786e-4,1.3331e-4, 1.3895e-4,1.4481e-4,1.5089e-4,1.5721e-4,1.6378e-4,1.7062e-4, 1.7775e-4,1.8517e-4,1.9292e-4,2.01e-4,2.0943e-4,2.1824e-4, 2.2745e-4,2.3708e-4,2.4714e-4,2.5768e-4,2.687e-4,2.8025e-4, 2.9235e-4,3.0503e-4,3.1832e-4,3.3226e-4,3.469e-4,3.6226e-4, 3.7841e-4,3.9537e-4,4.1321e-4,4.3198e-4,4.5174e-4,4.7255e-4, 4.945e-4,5.1764e-4,5.4208e-4,5.6791e-4,5.9522e-4,6.2413e-4, 6.5477e-4,6.8729e-4,7.2183e-4,7.5857e-4,7.9773e-4,8.3951e-4, 8.8418e-4,9.3203e-4,9.834e-4,.0010387,.0010983,.0011628,.0012327, .0013089,.001392,.0014831,.0015833,.001694,.0018169,.0019538, .0021072,.0022798,.0024751,.0026972,.0029511,.003243,.0035804, .0039726,.0044308,.0049691,.0056047,.0063591,.0072592,.008338, .0096373,.011209,.013119,.01545,.018305,.021817,.026153,.031524, .038203,.046535,.056963,.070056,.086547,.070056,.056963,.046535, .038203,.031524,.026153,.021817,.018305,.01545,.013119,.011209, .0096373,.008338,.0072592,.0063591,.0056047,.0049691,.0044308, .0039726,.0035804,.003243,.0029511,.0026972,.0024751,.0022798, .0021072,.0019538,.0018169,.001694,.0015833,.0014831,.001392, .0013089,.0012327,.0011628,.0010983,.0010387,9.834e-4,9.3203e-4, 8.8418e-4,8.3951e-4,7.9773e-4,7.5857e-4,7.2183e-4,6.8729e-4, 6.5477e-4,6.2413e-4,5.9522e-4,5.6791e-4,5.4208e-4,5.1764e-4, 4.945e-4,4.7255e-4,4.5174e-4,4.3198e-4,4.1321e-4,3.9537e-4, 3.7841e-4,3.6226e-4,3.469e-4,3.3226e-4,3.1832e-4,3.0503e-4, 2.9235e-4,2.8025e-4,2.687e-4,2.5768e-4,2.4714e-4,2.3708e-4, 2.2745e-4,2.1824e-4,2.0943e-4,2.01e-4,1.9292e-4,1.8517e-4, 1.7775e-4,1.7062e-4,1.6378e-4,1.5721e-4,1.5089e-4,1.4481e-4, 1.3895e-4,1.3331e-4,1.2786e-4,1.2259e-4,1.1748e-4,1.1254e-4, 1.0773e-4,1.0305e-4,9.8489e-5,9.4022e-5,8.9639e-5,8.5322e-5, 8.1054e-5,7.6818e-5,7.2593e-5,6.8358e-5,6.4089e-5,5.9759e-5, 5.5339e-5,5.0795e-5,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0., 0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0., 0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0., 0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0., 0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,7.328e-5, 7.6121e-5,7.9057e-5,8.2094e-5,8.5237e-5,8.8494e-5,9.1869e-5, 9.5369e-5,9.9002e-5,1.0277e-4,1.0669e-4,1.1076e-4,1.15e-4, 1.194e-4,1.2398e-4,1.2875e-4,1.3372e-4,1.389e-4,1.4429e-4, 1.4992e-4,1.5578e-4,1.619e-4,1.6829e-4,1.7496e-4,1.8193e-4, 1.892e-4,1.9681e-4,2.0476e-4,2.1308e-4,2.2178e-4,2.309e-4, 2.4044e-4,2.5044e-4,2.6092e-4,2.7191e-4,2.8345e-4,2.9555e-4, 3.0827e-4,3.2164e-4,3.357e-4,3.5049e-4,3.6607e-4,3.8249e-4, 3.998e-4,4.1808e-4,4.3739e-4,4.578e-4,4.7941e-4,5.023e-4, 5.2659e-4,5.5238e-4,5.798e-4,6.0899e-4,6.4012e-4,6.7336e-4, 7.0891e-4,7.47e-4,7.8787e-4,8.3183e-4,8.7918e-4,9.3032e-4, 9.8565e-4,.0010457,.0011109,.001182,.0012598,.001345,.0014386, .0015418,.0016559,.0017824,.0019231,.0020802,.002256,.0024535, .0026761,.0029277,.0032132,.003538,.0039088,.0043336,.0048216, .0053841,.0060344,.0067884,.0076653,.0086879,.0098839,.011286, .012935,.014879,.017176,.019897,.023128,.026974,.031562,.037046, .043617,.051507,.060998,.072441,.060998,.051507,.043617,.037046, .031562,.026974,.023128,.019897,.017176,.014879,.012935,.011286, .0098839,.0086879,.0076653,.0067884,.0060344,.0053841,.0048216, .0043336,.0039088,.003538,.0032132,.0029277,.0026761,.0024535, .002256,.0020802,.0019231,.0017824,.0016559,.0015418,.0014386, .001345,.0012598,.001182,.0011109,.0010457,9.8565e-4,9.3032e-4, 8.7918e-4,8.3183e-4,7.8787e-4,7.47e-4,7.0891e-4,6.7336e-4, 6.4012e-4,6.0899e-4,5.798e-4,5.5238e-4,5.2659e-4,5.023e-4, 4.7941e-4,4.578e-4,4.3739e-4,4.1808e-4,3.998e-4,3.8249e-4, 3.6607e-4,3.5049e-4,3.357e-4,3.2164e-4,3.0827e-4,2.9555e-4, 2.8345e-4,2.7191e-4,2.6092e-4,2.5044e-4,2.4044e-4,2.309e-4, 2.2178e-4,2.1308e-4,2.0476e-4,1.9681e-4,1.892e-4,1.8193e-4, 1.7496e-4,1.6829e-4,1.619e-4,1.5578e-4,1.4992e-4,1.4429e-4, 1.389e-4,1.3372e-4,1.2875e-4,1.2398e-4,1.194e-4,1.15e-4,1.1076e-4, 1.0669e-4,1.0277e-4,9.9002e-5,9.5369e-5,9.1869e-5,8.8494e-5, 8.5237e-5,8.2094e-5,7.9057e-5,7.6121e-5,7.328e-5,7.0528e-5,0.,0., 0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0., 0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0., 0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0., 0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0., 0.,0.,0.,0.,0.,0.,0.,0.,-1.1208e-4,-1.1324e-4,-1.145e-4,-1.163e-4, -1.181e-4,-1.194e-4,-1.2123e-4,-1.2307e-4,-1.244e-4,-1.2574e-4, -1.2762e-4,-1.2951e-4,-1.3089e-4,-1.3228e-4,-1.3369e-4,-1.3511e-4, -1.3707e-4,-1.3852e-4,-1.3945e-4,-1.4093e-4,-1.4296e-4,-1.4394e-4, -1.4547e-4,-1.4701e-4,-1.4858e-4,-1.5016e-4,-1.5122e-4,-1.5284e-4, -1.5448e-4,-1.5614e-4,-1.5783e-4,-1.5899e-4,-1.6071e-4,-1.6301e-4, -1.6478e-4,-1.6713e-4,-1.6951e-4,-1.7136e-4,-1.738e-4,-1.7682e-4, -1.7987e-4,-1.8296e-4,-1.8664e-4,-1.9092e-4,-1.9469e-4,-1.9962e-4, -2.0517e-4,-2.1077e-4,-2.1756e-4,-2.2442e-4,-2.3192e-4,-2.4063e-4, -2.5056e-4,-2.6117e-4,-2.7302e-4,-2.8556e-4,-2.9939e-4,-3.1508e-4, -3.3208e-4,-3.5042e-4,-3.7011e-4,-3.9233e-4,-4.1595e-4,-4.4099e-4, -4.6866e-4,-4.978e-4,-5.2904e-4,-5.6299e-4,-5.9853e-4,-6.3507e-4, -6.7384e-4,-7.1488e-4,-7.5642e-4,-7.9848e-4,-8.4169e-4,-8.8486e-4, -9.2617e-4,-9.6684e-4,-.001005,-.0010382,-.001067,-.00109, -.0011041,-.0011079,-.0011,-.0010783,-.0010406,-9.8474e-4, -9.098e-4,-8.1411e-4,-6.9728e-4,-5.5956e-4,-4.0442e-4,-2.3674e-4, -6.4103e-5,9.976e-5,2.3682e-4,3.1925e-4,3.0847e-4,1.5208e-4,0., -1.5208e-4,-3.0847e-4,-3.1925e-4,-2.3682e-4,-9.976e-5,6.4103e-5, 2.3674e-4,4.0442e-4,5.5956e-4,6.9728e-4,8.1411e-4,9.098e-4, 9.8474e-4,.0010406,.0010783,.0011,.0011079,.0011041,.00109, .001067,.0010382,.001005,9.6684e-4,9.2617e-4,8.8486e-4,8.4169e-4, 7.9848e-4,7.5642e-4,7.1488e-4,6.7384e-4,6.3507e-4,5.9853e-4, 5.6299e-4,5.2904e-4,4.978e-4,4.6866e-4,4.4099e-4,4.1595e-4, 3.9233e-4,3.7011e-4,3.5042e-4,3.3208e-4,3.1508e-4,2.9939e-4, 2.8556e-4,2.7302e-4,2.6117e-4,2.5056e-4,2.4063e-4,2.3192e-4, 2.2442e-4,2.1756e-4,2.1077e-4,2.0517e-4,1.9962e-4,1.9469e-4, 1.9092e-4,1.8664e-4,1.8296e-4,1.7987e-4,1.7682e-4,1.738e-4, 1.7136e-4,1.6951e-4,1.6713e-4,1.6478e-4,1.6301e-4,1.6071e-4, 1.5899e-4,1.5783e-4,1.5614e-4,1.5448e-4,1.5284e-4,1.5122e-4, 1.5016e-4,1.4858e-4,1.4701e-4,1.4547e-4,1.4394e-4,1.4296e-4, 1.4093e-4,1.3945e-4,1.3852e-4,1.3707e-4,1.3511e-4,1.3369e-4, 1.3228e-4,1.3089e-4,1.2951e-4,1.2762e-4,1.2574e-4,1.244e-4, 1.2307e-4,1.2123e-4,1.194e-4,1.181e-4,1.163e-4,1.145e-4,1.1324e-4, .0014534,.0027948,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0., 0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0., 0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0., 0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0., 0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. }; memcpy(_pos1, pos1, 300*sizeof(double)); memcpy(_corrections, corrections, 6*300*sizeof(double)); return; } // ***************************************************************** int TCesClusterFitter::Fit(int* adcs, bool qWires, int firstchan, int nchan) { // error return values _rawPosition = -1.0; _rawEnergy = -1.0; _fitPosition = -1.0; _fitEnergy = -1.0; _chi2 = -1.0; _wires = qWires; for(int i=0; i<11; i++) { _e[i]=_pos[i]=0.0; ADCs[i]=0;} firstChan = firstchan; if(qWires && firstChan>31) firstChan -= 32; nChan = nchan; int maxADC = 0; int iMax = -1; for(int i=0; i maxADC) { maxADC = ADCs[i]; iMax = i; } if(qWires) { _e[i] = ADCs[i]/GEV_TO_ADC_WIRE; } else { _e[i] = ADCs[i]/GEV_TO_ADC_STRIP; } if(_verbose) printf(" energies %f %i \n",_e[i], i); } if(_verbose) std::cout<<"iMax = "< (_rawPosition+25)) _fitPosition = _rawPosition+25; if (fabs(dx) < DXMIN) break; } // end of iter loop _fitEnergy = qval; // compute the chi2 _chi2=0.; double ftot=0.; double fitval[128]; //double fitder[128]; for (int i=0; i<128; i++){ fitval[i]=0.; //fitder[i]=0.; } for(int i=0; i 0.25){ if (_fitEnergy > _rawEnergy) _fitEnergy = 1.25 * _rawEnergy; if (_fitEnergy < _rawEnergy) _fitEnergy = 0.75 * _rawEnergy; if (fabs(_fitPosition-_rawPosition) > 20) _fitPosition = (_fitPosition + _rawPosition)/2; } _rawPosition = _rawPosition/_sinth/10.0 + _offset; _fitPosition = _fitPosition/_sinth/10.0 + _offset; return 0; } // ***************************************************************** int TCesClusterFitter::fitt2_strip(double x1, double delta, double R[2]) { double Rces = CESRADIUS; double x2 = x1 - delta; double x[2]; x[0]=x1; x[1]=x2; double sin_theta = Rces / sqrt(fabs(_posMax*_posMax + Rces*Rces)); double cos_theta = 0.; if (sin_theta < 1.) { cos_theta = sqrt(1.0-sin_theta*sin_theta); } else { std::cout<<"sqrt on negative, sin_theta = "<100) w[i]=1.; if (fabs(x[i])<100.0){ int n1=int(x[i]+100.); if (n1<1) n1=1; if (n1>200) n1=200; double del=_pos1[n1]-x[i]; for (int kder=0; kder<2; kder++){ int k = 1 + kder*3; double c = _corrections[k][n1-1]+_corrections[k][n1+1]-2*_corrections[k][n1]; c=c/2; double b = _corrections[k][n1+1]-_corrections[k][n1-1]-4*c*del; b=b/2; double a = _corrections[k][n1]-del*(b+c*del); k=k+1; // shift to asy profile table! double acor=(_corrections[k][n1-1]+_corrections[k][n1+1])*0.5; a = a+acor*tan_theta; if (kder == 0) w[i]=a; if (kder == 1) p[i]=a; } } } R[0] = w[0] - w[1]; R[1] = p[1] - p[0]; return 0; } // ***************************************************************** int TCesClusterFitter::fitt2_wire(double x1, double delta, double R[2]){ double x2 = x1 - delta; double x[2]; x[0]=x1; x[1]=x2; double w[2]; double p[2]; for (int i=0; i<2; i++){ w[i]=0.; p[i]=0.; if (x[i]>100) w[i]=1.; if (fabs(x[i])<100.0){ int n1=int(x[i]+100.); if (n1<1) n1=1; if (n1>200) n1=200; double del=_pos1[n1]-x[i]; for (int kder=0; kder<2; kder++){ int k = kder*3; double c = _corrections[k][n1-1]+_corrections[k][n1+1]-2*_corrections[k][n1]; c=c/2; double b = _corrections[k][n1+1]-_corrections[k][n1-1]-4*c*del; b=b/2; double a = _corrections[k][n1]-del*(b+c*del); if (kder == 0) w[i]=a; if (kder == 1) p[i]=a; } } } R[0] = w[0] - w[1]; R[1] = p[1] - p[0]; return 0; }