void plotscan20558(){ // Make a 2d histogram of Pmu at each dy vs dx shift for each x,y point TH2D * hscan[5][5]; double data[650] = { 0.995544791, 0.99501425, 0.992640853, 0.988207579, 0.982220471, 0.993613422, 0.99304682, 0.990635574, 0.986214101, 0.980095506, 0.989759803, 0.989132643, 0.986672044, 0.982361734, 0.97630161, 0.984077811, 0.983439088, 0.981093466, 0.976683676, 0.970695913, 0.97661376, 0.975969493, 0.973611057, 0.969269872, 0.963282287, 0.993080378, 0.99536097, 0.99569422, 0.99399519, 0.990404665, 0.991678953, 0.993927896, 0.99421066, 0.992521822, 0.988900483, 0.988441706, 0.990610898, 0.990730643, 0.989141226, 0.985547483, 0.983203888, 0.985338628, 0.985542595, 0.983916581, 0.980284691, 0.976448655, 0.978331685, 0.97860986, 0.976857364, 0.97337395, 0.986737669, 0.991688192, 0.994714499, 0.995880127, 0.994961321, 0.985924363, 0.990726173, 0.993742704, 0.994898736, 0.993995786, 0.983168006, 0.988015294, 0.99094069, 0.991992414, 0.99110347, 0.978693068, 0.983286798, 0.986259103, 0.987242937, 0.986355245, 0.972377121, 0.977039516, 0.979720891, 0.980684221, 0.979815364, 0.976717651, 0.984113634, 0.989839256, 0.993609905, 0.99559176, 0.976399302, 0.983718336, 0.989409924, 0.993209541, 0.995151997, 0.974302828, 0.981570065, 0.987062752, 0.99088496, 0.992744625, 0.970387399, 0.977606654, 0.983152032, 0.986657321, 0.988465071, 0.964745522, 0.971852779, 0.977215469, 0.980802357, 0.982426465, 0.963093042, 0.972913146, 0.981141806, 0.987518013, 0.99210006, 0.963348269, 0.973182738, 0.981340528, 0.987651944, 0.992189407, 0.961920083, 0.971609592, 0.979530632, 0.985908031, 0.990402162, 0.958883584, 0.968409657, 0.976112962, 0.982317269, 0.986677885, 0.954103768, 0.963271499, 0.9708969, 0.976943672, 0.981245637, 0.99503386, 0.994106531, 0.99116075, 0.986462295, 0.980139136, 0.995865464, 0.994872272, 0.991834521, 0.986993372, 0.9805246, 0.994674087, 0.993604064, 0.990603685, 0.985773504, 0.979151964, 0.991479695, 0.990527213, 0.987543643, 0.982767582, 0.976071596, 0.986588478, 0.985582054, 0.982609928, 0.977880001, 0.971219361, 0.992514014, 0.994328916, 0.994172513, 0.992034912, 0.988006592, 0.993864894, 0.995650887, 0.995449603, 0.993303657, 0.98923254, 0.993235588, 0.995074511, 0.994760871, 0.992548823, 0.988530099, 0.990664601, 0.992418468, 0.992133498, 0.98994863, 0.985929012, 0.986234546, 0.98794359, 0.987639904, 0.985494912, 0.981468678, 0.986162901, 0.990607083, 0.993190944, 0.993884444, 0.992481351, 0.988029122, 0.99239099, 0.995005727, 0.995660067, 0.994255364, 0.987913668, 0.99236387, 0.994919658, 0.995496452, 0.994095862, 0.985747993, 0.990263522, 0.992790341, 0.993402839, 0.991947472, 0.982064664, 0.986358583, 0.988871276, 0.989311039, 0.987931192, 0.976107597, 0.983036101, 0.988223851, 0.991609097, 0.993043065, 0.978345811, 0.985363662, 0.990539134, 0.993930161, 0.995340943, 0.978822827, 0.98571682, 0.990983129, 0.994383156, 0.995696902, 0.977442563, 0.984277189, 0.989485383, 0.992732584, 0.994118154, 0.974300027, 0.981074691, 0.986022532, 0.989284992, 0.990590453, 0.96242708, 0.971823752, 0.979508102, 0.985463798, 0.98958838, 0.965229988, 0.974664688, 0.982381642, 0.988259852, 0.992380798, 0.966230989, 0.975451827, 0.983216286, 0.989144206, 0.993252218, 0.96558249, 0.974639773, 0.982261062, 0.988120556, 0.992282569, 0.963110626, 0.972128451, 0.979624093, 0.985221446, 0.989206731, 0.990703523, 0.989275336, 0.986103296, 0.9809708, 0.974314868, 0.994117975, 0.992666721, 0.989264727, 0.984094799, 0.977268517, 0.995706916, 0.994173944, 0.990764141, 0.985426366, 0.978351057, 0.995294034, 0.993737876, 0.990289092, 0.984971464, 0.977865875, 0.992933214, 0.991460443, 0.98795867, 0.982677042, 0.975533485, 0.988166332, 0.989409506, 0.988862276, 0.98638314, 0.981992483, 0.99212724, 0.993398428, 0.992719412, 0.990116477, 0.985784173, 0.994192779, 0.995508432, 0.994810045, 0.992124915, 0.987606764, 0.994388819, 0.99562645, 0.99490571, 0.992162764, 0.987609208, 0.992525041, 0.993798614, 0.993034542, 0.990353882, 0.985839069, 0.981887698, 0.985799313, 0.987803519, 0.987951398, 0.986269534, 0.986219823, 0.990162313, 0.992260695, 0.992426217, 0.990655422, 0.988779783, 0.992768466, 0.994854808, 0.99497211, 0.993095219, 0.98940742, 0.993466437, 0.995553732, 0.995630026, 0.993710816, 0.988284945, 0.992165148, 0.994241297, 0.994252264, 0.992356777, 0.971849203, 0.978261471, 0.982854247, 0.985768139, 0.986722827, 0.976668715, 0.983123422, 0.987848103, 0.990703404, 0.991578937, 0.979644299, 0.986219764, 0.990905464, 0.993801892, 0.994704783, 0.980897427, 0.987363636, 0.992069304, 0.994956195, 0.995881081, 0.98029995, 0.986680627, 0.991223752, 0.994146943, 0.995041788, 0.958303988, 0.967154026, 0.974322915, 0.9797135, 0.983202577, 0.96359843, 0.972329378, 0.979616404, 0.985022604, 0.988679826, 0.967056751, 0.975915015, 0.983118057, 0.988598764, 0.992255926, 0.968905628, 0.977613747, 0.98476243, 0.990259767, 0.993907452, 0.968892992, 0.977561474, 0.984632492, 0.990029037, 0.993648171, 0.983002424, 0.981212318, 0.97743994, 0.972199142, 0.965319514, 0.988650262, 0.986718297, 0.98294425, 0.977315724, 0.970247746, 0.992760897, 0.990780532, 0.986946762, 0.981357038, 0.973898232, 0.995085835, 0.993076086, 0.989121139, 0.983419418, 0.975980878, 0.995494843, 0.993433774, 0.989564538, 0.983726144, 0.976139903, 0.980416059, 0.981110036, 0.980069637, 0.977072895, 0.972513795, 0.986601353, 0.98725909, 0.986241817, 0.983330011, 0.978532135, 0.991170108, 0.992009461, 0.990839422, 0.987882137, 0.98286289, 0.994079709, 0.994914114, 0.993692338, 0.990518987, 0.985512912, 0.995085359, 0.995848179, 0.994577169, 0.991411805, 0.986374497, 0.974145055, 0.977323771, 0.978893697, 0.978576183, 0.976422012, 0.980789721, 0.984200299, 0.985630095, 0.985336065, 0.983184636, 0.985923052, 0.989303768, 0.990904093, 0.990517259, 0.98818928, 0.989204645, 0.99262917, 0.994246721, 0.993903875, 0.991538882, 0.990652978, 0.994123757, 0.995714307, 0.995290279, 0.992877662, 0.96432215, 0.969956934, 0.974034846, 0.976269126, 0.976809382, 0.971346915, 0.977187991, 0.98132664, 0.983611047, 0.984122813, 0.976892531, 0.982762039, 0.986965418, 0.989277124, 0.989714742, 0.980590403, 0.986643732, 0.990827441, 0.99317956, 0.993590355, 0.982543409, 0.988499999, 0.992708206, 0.995139062, 0.995570958, 0.951103568, 0.958865047, 0.965429187, 0.970250785, 0.97328645, 0.958342075, 0.966527462, 0.973118007, 0.978075922, 0.981178105, 0.964270532, 0.972531676, 0.979265749, 0.984190106, 0.987307847, 0.968540132, 0.976834476, 0.983514369, 0.988512874, 0.991666734, 0.97112745, 0.97933656, 0.985998392, 0.990920186, 0.994114399, 0.972520888, 0.970206261, 0.96601218, 0.960275829, 0.953078151, 0.979862094, 0.977413058, 0.973323703, 0.967656672, 0.959943533, 0.98606348, 0.983691156, 0.979571521, 0.97349745, 0.965745091, 0.990880549, 0.988503039, 0.984211087, 0.978038311, 0.970336735, 0.99405843, 0.991539299, 0.987101614, 0.980941236, 0.973007679, 0.969785333, 0.969697654, 0.968281507, 0.964701116, 0.959863484, 0.977825463, 0.977915049, 0.976369619, 0.973061025, 0.968116403, 0.984646976, 0.984907568, 0.983357787, 0.979855299, 0.974588811, 0.989912152, 0.990234375, 0.988636255, 0.985066235, 0.97971797, 0.993576288, 0.993793488, 0.992141426, 0.988564432, 0.983153045, 0.963729799, 0.965992391, 0.966850579, 0.965976536, 0.963528156, 0.972130239, 0.974793375, 0.975736737, 0.974932373, 0.972432196, 0.979360282, 0.982178867, 0.983263135, 0.982423842, 0.979737997, 0.985166013, 0.988028467, 0.989054739, 0.988239467, 0.985505283, 0.989254296, 0.992105007, 0.993241549, 0.992322385, 0.989599347, 0.953935385, 0.958762765, 0.961843371, 0.963564336, 0.963661551, 0.962803364, 0.967935145, 0.971351743, 0.973225296, 0.973162532, 0.9705652, 0.975636065, 0.979413152, 0.981151044, 0.981113017, 0.976630747, 0.981947899, 0.985722065, 0.987515569, 0.987502992, 0.981180012, 0.986477792, 0.990299761, 0.992050767, 0.992081702, 0.940618873, 0.947875917, 0.953388691, 0.957632184, 0.960151613, 0.950241208, 0.957375526, 0.963303745, 0.967571914, 0.970249593, 0.958333552, 0.965768993, 0.971762896, 0.976114094, 0.978708506, 0.964906037, 0.972464323, 0.978455245, 0.983017385, 0.98559314, 0.96989423, 0.977356374, 0.983501077, 0.987922668, 0.99061954, 0.99716258, 0.996961117, 0.996534884, 0.994854808, 0.991467595, 0.994796872, 0.994796872, 0.994837224, 0.994854808, 0.994917333, 0.994830966, 0.994799793, 0.99472326, 0.994235694, 0.993672132}; //gStyle->SetPadLeftMargin(0.0); //gStyle->SetPadRightMargin(0.1); //gStyle->SetPadTopMargin(0.0); //gStyle->SetPadBottomMargin(0.0); //gStyle->SetPadBorderSize(0); //gStyle->SetPadBorderMode(0); c1=new TCanvas(); c1->Divide(5,5); c2=new TCanvas(); c2->Divide(5,5); gROOT->LoadMacro("my2dquadratic.C"); TF2* fpol2[5][5]; double pmax[5][5]; double A[5][5]; double x0[5][5]; double y0[5][5]; TH1D * hpmax = new TH1D("hpmax","Pmax",20,0.993,0.997); TH1D * hA = new TH1D("hA","A",20,-12.,-8.); char fname[256]; char hname[256]; char htitl[256]; int ndata=0; for ( int ix=0; ix<5; ix++ ){ for ( int iy=0; iy<5; iy++ ) { sprintf(hname,"hs_x%1d_y%1d",ix,iy); sprintf(htitl,"dY vs dX shift for X=%1dcm,Y=%1dcm;dX(rad);dY(rad)",2.-ix,2.-iy); hscan[ix][iy] = new TH2D(hname,htitl,5,-0.025,0.025,5,-0.025,0.025); hscan[ix][iy]->SetOption("colz"); hscan[ix][iy]->SetContour(99); hscan[ix][iy]->SetMaximum(0.9965); hscan[ix][iy]->SetMinimum(0.9900); for ( int idx=0; idx<5; idx++ ){ for (int idy=0; idy<5; idy++ ){ hscan[ix][iy]->SetBinContent(idx+1,idy+1,data[ndata]); ndata++; } } // =21 // c1->cd(-ix+iy*5+1); c1->cd(-ix+iy*5+5); hscan[ix][iy]->Draw("colz"); // sprintf(fname,"f_x%1d_y%1d",ix,iy); fpol2[ix][iy] = new TF2(fname,my2dquadratic,-0.025,0.025,-0.025,0.025,4); // fpol2[ix][iy]->SetParameters(0.9958,-9.796, -0.0129*float(2-ix) - 0.003167*float(2-iy) + 0.007549, 0.002384*float(2-ix) - 0.0137*float(2-iy) + 0.005796); //fpol2[ix][iy]->SetParameters(-0.95,-1000.,0.,0.); //hscan[ix][iy]->Fit(fpol2[ix][iy],"NO"); //hscan[ix][iy]->SetMaximum(0.9965); //hscan[ix][iy]->SetMinimum(0.9900); fpol2[ix][iy]->SetNpx(5); fpol2[ix][iy]->SetNpy(5); fpol2[ix][iy]->SetMinimum(0.9900); fpol2[ix][iy]->SetMaximum(0.9965); c2->cd(-ix+iy*5+5); fpol2[ix][iy]->Draw("colz"); pmax[ix][iy] = fpol2[ix][iy]->GetParameter(0); A[ix][iy] = fpol2[ix][iy]->GetParameter(1); x0[ix][iy] = fpol2[ix][iy]->GetParameter(2); y0[ix][iy] = fpol2[ix][iy]->GetParameter(3); hpmax->Fill(pmax[ix][iy]); hA->Fill(A[ix][iy]); } } c1->cd(3); ta1=new TArrow(0.,-200.,0.,0.01,0.2);ta1->SetLineWidth(2);ta1->Draw(); tl1=new TLatex(0.0,0.012,"Y(cm)"); tl1->SetTextSize(0.2); tl1->Draw(); tl2=new TLatex(-0.01,0.0,"2"); tl2->SetTextSize(0.2); tl2->Draw(); c1->cd(8); ta2=new TArrow(0.,-200.,0.,200.,0.2);ta2->SetLineWidth(2);ta2->Draw(); tl3=new TLatex(-0.01,0.0,"1"); tl3->SetTextSize(0.2); tl3->Draw(); c1->cd(13); ta3=new TArrow(0.,0.,0.,200.,0.2);ta3->SetLineWidth(2);ta3->Draw(); ta4=new TArrow(0.,0.,200.,0.,0.2);ta4->SetLineWidth(2);ta4->Draw(); tl4=new TLatex(-0.01,-0.01,"0"); tl4->SetTextSize(0.2); tl4->Draw(); c1->cd(14); ta5=new TArrow(-200.,0.,200.,0.,0.2);ta5->SetLineWidth(2);ta5->Draw(); tl5=new TLatex(0.0,-0.01,"1"); tl5->SetTextSize(0.2); tl5->Draw(); c1->cd(15); ta6=new TArrow(-200.,0.,0.01,0.0,0.2);ta6->SetLineWidth(2);ta6->Draw(); tl6=new TLatex(0.012,0.0,"X(cm)"); tl6->SetTextSize(0.2); tl6->Draw(); tl7=new TLatex(-0.005,-0.01,"2"); tl7->SetTextSize(0.2); tl7->Draw(); c2->cd(3); ta1=new TArrow(0.,-200.,0.,0.01,0.2);ta1->SetLineWidth(2);ta1->Draw(); tl1=new TLatex(0.0,0.012,"Y(cm)"); tl1->SetTextSize(0.2); tl1->Draw(); tl2=new TLatex(-0.01,0.0,"2"); tl2->SetTextSize(0.2); tl2->Draw(); c2->cd(8); ta2=new TArrow(0.,-200.,0.,200.,0.2);ta2->SetLineWidth(2);ta2->Draw(); tl3=new TLatex(-0.01,0.0,"1"); tl3->SetTextSize(0.2); tl3->Draw(); c2->cd(13); ta3=new TArrow(0.,0.,0.,200.,0.2);ta3->SetLineWidth(2);ta3->Draw(); ta4=new TArrow(0.,0.,200.,0.,0.2);ta4->SetLineWidth(2);ta4->Draw(); tl4=new TLatex(-0.01,-0.01,"0"); tl4->SetTextSize(0.2); tl4->Draw(); c2->cd(14); ta5=new TArrow(-200.,0.,200.,0.,0.2);ta5->SetLineWidth(2);ta5->Draw(); tl5=new TLatex(0.0,-0.01,"1"); tl5->SetTextSize(0.2); tl5->Draw(); c2->cd(15); ta6=new TArrow(-200.,0.,0.01,0.0,0.2);ta6->SetLineWidth(2);ta6->Draw(); tl6=new TLatex(0.012,0.0,"X(cm)"); tl6->SetTextSize(0.2); tl6->Draw(); tl7=new TLatex(-0.005,-0.01,"2"); tl7->SetTextSize(0.2); tl7->Draw(); c3=new TCanvas(); c3->Divide(2,2); TH1D * hxx0[5]; TH1D * hxy0[5]; TH1D * hyx0[5]; TH1D * hyy0[5]; for (int ix=0; ix<5; ix ++ ){ sprintf(hname,"hxx0_%1d",ix); sprintf(htitl,"x0 versus x for y=%d cm",ix-2); hxx0[ix] = new TH1D(hname,htitl,5,-2.5,2.5); hxx0[ix]->SetLineColor(ix+2); sprintf(hname,"hxy0_%1d",ix); sprintf(htitl,"y0 versus x for y=%d cm",ix-2); hxy0[ix] = new TH1D(hname,htitl,5,-2.5,2.5); hxy0[ix]->SetLineColor(ix+2); sprintf(hname,"hyx0_%1d",ix); sprintf(htitl,"x0 versus y for x=%d cm",ix-2); hyx0[ix] = new TH1D(hname,htitl,5,-2.5,2.5); hyx0[ix]->SetLineColor(ix+2); sprintf(hname,"hyy0_%1d",ix); sprintf(htitl,"y0 versus y for x=%d cm",ix-2); hyy0[ix] = new TH1D(hname,htitl,5,-2.5,2.5); hyy0[ix]->SetLineColor(ix+2); hxx0[ix]->SetMaximum(0.035); hxx0[ix]->SetMinimum(-0.035); hxy0[ix]->SetMaximum(0.035); hxy0[ix]->SetMinimum(-0.035); hyx0[ix]->SetMaximum(0.035); hyx0[ix]->SetMinimum(-0.035); hyy0[ix]->SetMaximum(0.035); hyy0[ix]->SetMinimum(-0.035); } std::cout<<" X Y Pmax A x0 y0\n"; for (int ix=0;ix<5;ix++) { for (int iy=0;iy<5;iy++) { printf("%2d %2d %6.4f %6.4f %6.5f %6.5f\n", ix-2,2+iy-2, pmax[ix][iy], A[ix][iy], x0[ix][iy], y0[ix][iy]); hxx0[iy]->SetBinContent(5-ix,x0[ix][iy]); hxy0[iy]->SetBinContent(5-ix,y0[ix][iy]); hyx0[ix]->SetBinContent(5-iy,x0[ix][iy]); hyy0[ix]->SetBinContent(5-iy,y0[ix][iy]); } } TLegend* tleg[4]; tleg[0]= new TLegend(0.6,0.6,0.95,0.95); tleg[1]= new TLegend(0.6,0.6,0.95,0.95); tleg[2]= new TLegend(0.6,0.6,0.95,0.95); tleg[3]= new TLegend(0.6,0.6,0.95,0.95); c3->cd(1); hxx0[2]->Fit("pol1"); hxx0[2]->Draw("l"); c3->cd(2); hxy0[2]->Fit("pol1");hxy0[2]->Draw("l"); c3->cd(3); hyx0[2]->Fit("pol1");hyx0[2]->Draw("l"); c3->cd(4); hyy0[2]->Fit("pol1");hyy0[2]->Draw("l"); //c3->cd(1); hxx0[0]->Draw("l"); tleg[0]->AddEntry((TObject*)hxx0[0],(const char*)hxx0[0]->GetTitle(),"l"); //c3->cd(2); hxy0[0]->Draw("l"); tleg[1]->AddEntry((TObject*)hxy0[0],(const char*)hxy0[0]->GetTitle(),"l"); //c3->cd(3); hyx0[0]->Draw("l"); tleg[2]->AddEntry((TObject*)hyx0[0],(const char*)hyx0[0]->GetTitle(),"l"); //c3->cd(4); hyy0[0]->Draw("l"); tleg[3]->AddEntry((TObject*)hyy0[0],(const char*)hyy0[0]->GetTitle(),"l"); for (int ii=0;ii<5; ii++){ c3->cd(1); hxx0[ii]->Draw("lsame"); tleg[0]->AddEntry((TObject*)hxx0[ii],(const char*)hxx0[ii]->GetTitle(),"l"); c3->cd(2); hxy0[ii]->Draw("lsame"); tleg[1]->AddEntry((TObject*)hxy0[ii],(const char*)hxy0[ii]->GetTitle(),"l"); c3->cd(3); hyx0[ii]->Draw("lsame"); tleg[2]->AddEntry((TObject*)hyx0[ii],(const char*)hyx0[ii]->GetTitle(),"l"); c3->cd(4); hyy0[ii]->Draw("lsame"); tleg[3]->AddEntry((TObject*)hyy0[ii],(const char*)hyy0[ii]->GetTitle(),"l"); } c4=new TCanvas(); c4->Divide(1,2); c4->cd(1); hA->Draw("hist"); c4->cd(2); hpmax->Draw("hist"); c3->cd(1); tleg[0]->Draw(); c3->cd(2); tleg[1]->Draw(); c3->cd(3); tleg[2]->Draw(); c3->cd(4); tleg[3]->Draw(); }