#include "save.C" TCanvas* c2 = new TCanvas("c2","c2",800,500); void drawHitAngleMomAnim(TString path = ".", TString name = ""){ Int_t saveflag = 1; TString info = "hits"; path = createDir("rdata", info, saveflag); const Int_t NRGBs = 5; const Int_t NCont = 255; Double_t stops[NRGBs] = { 0.00, 0.34, 0.61, 0.84, 1.00 }; Double_t red[NRGBs] = { 0.00, 0.00, 0.87, 1.00, 0.51 }; Double_t green[NRGBs] = { 0.00, 0.81, 1.00, 0.20, 0.00 }; Double_t blue[NRGBs] = { 0.51, 1.00, 0.12, 0.00, 0.00 }; TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont); gStyle->SetNumberContours(NCont); gSystem->Load("../build/libprtlib.so"); //gStyle->SetOptStat(0); Int_t referenceTime; Int_t referenceChannel; Int_t startInd = 0; TH2F *hHits[51][141]; TH2F *hist[51][141][15]; bool ismom[51]; for(Int_t m=0; m<51; m++){ ismom[m] = false; if(m!=15 && m!=20 && m!=27 && m!=50 ) continue; for(Int_t i=22; i<141; i++){ hHits[m][i] = new TH2F( Form("mom_%d_deg_%d", m, i),Form("%d_%d", m,i),500,-2,32,300,-10,10 ); hHits[m][i]->SetTitle(Form("%d degree",i)); hHits[m][i]->GetXaxis()->SetTitle("x, [cm]"); hHits[m][i]->GetYaxis()->SetTitle("y, [cm]"); hHits[m][i]->GetXaxis()->SetTitleOffset(1.15); hHits[m][i]->GetYaxis()->SetTitleOffset(1.2); hHits[m][i]->SetStats(0); for(int p=0; p<3*5;p++){ hist[m][i][p] = new TH2F( Form("mcp%d_%d_%d", p+startInd,i,m),Form("id%d_%d_%d", m,i,p+startInd),8,0.,8.,8,0.,8.); hist[m][i][p]->SetStats(0); hist[m][i][p]->SetTitle(0); hist[m][i][p]->GetXaxis()->SetNdivisions(10); hist[m][i][p]->GetYaxis()->SetNdivisions(10); hist[m][i][p]->GetXaxis()->SetLabelOffset(100); hist[m][i][p]->GetYaxis()->SetLabelOffset(100); hist[m][i][p]->GetXaxis()->SetTickLength(1); hist[m][i][p]->GetYaxis()->SetTickLength(1); hist[m][i][p]->GetXaxis()->SetAxisColor(15); hist[m][i][p]->GetYaxis()->SetAxisColor(15); } } } TH2F *hVertex = new TH2F("hVertex","",5000,-2,2, 1000,-10,10 ); hVertex->SetStats(0); TH1F *hTime[4]; for(Int_t i=0; i<4; i++){ hTime[i] = new TH1F(Form("tmeId-%d", i),Form("id%d", i),500,0,25); hTime[i]->SetLineColor(i+1); } PrtEvent* fEvent = 0; PrtHit hit; TChain *ch = new TChain("data"); // ch->Add("/SAT/hera/had1/dervish/data/prt/proton15i/hits*.root"); ch->Add("/SAT/hera/had1/dervish/data/prt/platePixel/hits*.root"); ch->SetBranchAddress("PrtEvent", &fEvent); std::cout<<"ch->GetEntries() "<< ch->GetEntries()<GetEntries(); ievent++){ ch->GetEntry(ievent); if(ievent%100==0) cout<<"Event # "<GetAngle() + 0.0000001; Int_t mom = fEvent->GetMomentum().Z()/100. +0.0000001; if(ievent%1000==0) std::cout<< "mom "<< mom << " angle "<< angle <GetHitSize(); h++){ hit = fEvent->GetHit(h); Double_t time = hit.GetLeadTime(0); if(time<30000) { hHits[mom][angle]->Fill(hit.GetGlobalPos().X()/10.,hit.GetGlobalPos().Y()/10.); hist[mom][angle][hit.GetMcpId()-startInd]->Fill((hit.GetPixelId()-startInd)/8, (hit.GetPixelId()-startInd)%8); ismom[mom]=true; } for(Int_t k=0; k<4; k++){ hTime[k]->Fill(hit.GetLeadTime(k)/1000.); } } } for(Int_t m=0; m<51; m++){ TString subpath = createSubDir(path+Form("/%d",m),saveflag); for(Int_t i=22; i<141; i++){ if(!ismom[m]) continue; c2->cd(); hHits[m][i]->Draw("colz"); c2->Modified(); c2->Update(); save(c2,subpath,Form("hits1_%d",i),info,saveflag); TCanvas* c1 = new TCanvas("c1","c1",800,500); //hHits[m][i]->Draw("colz"); TPad * pp = new TPad("P","T",0.06,0.135,0.93,0.865); pp->SetFillStyle(0); pp->Draw(); pp->cd(); Int_t nrow = 3, ncol = 5; TPad* pads[15]; float tbw, tbh, bw = 0.02, bh = 0.01, shift = 0,shiftw=-0.02; float tbw = bw, tbh = bh; int padi = 0; for(int ii=0; iiSetFillColor(kCyan-8); //pads[padi]->SetFillStyle(0); //pads[padi]->SetFrameFillColor(ci); pads[padi]->SetMargin(0.04,0.04,0.04,0.04); pads[padi]->Draw(); padi++; } } int tmax, max=0; for(int p=0; pGetMaximum(); if(maxcd(); hist[m][i][p]->Draw("col"); hist[m][i][p]->SetMaximum(max); } c1->Modified(); c1->Update(); save(c1,subpath,Form("hits2_%d",i),info,saveflag); } } }