#include "save.C" void drawHitMomAnim(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"); TH2F *hHits[141]; for(Int_t i=0; i<141; i++){ hHits[i] = new TH2F( Form("reflections_%d", i),Form("%d", i),1000,-2,32,1000,-10,10 ); hHits[i]->GetXaxis()->SetTitle("x, [cm]"); hHits[i]->GetYaxis()->SetTitle("y, [cm]"); hHits[i]->GetXaxis()->SetTitleOffset(1.15); hHits[i]->GetYaxis()->SetTitleOffset(1.2); hHits[i]->SetStats(0); } TH2F *hVertex = new TH2F("hVertex","",5000,-2,2, 1000,-10,10 ); hVertex->SetStats(0); PrtEvent* fEvent; PrtHit hit; TChain *ch = new TChain("data"); //ch->Add("../build/hits.root"); ch->Add("/SAT/hera/had1/dervish/data/prt/ba120e500l1b2g3w0xproton/hits*.root"); // ch->Add("/SAT/hera/had1/dervish/data/prt/ba120e500l1xpib1g3w0/hits*.root"); // ch->Add("/SAT/hera/had1/dervish/data/prt/ba120e500l1xmub1g3w0/hits*.root"); // ch->Add("/SAT/hera/had1/dervish/data/prt/ba120e500l1xkaonb1g3w0/hits*.root"); ch->SetBranchAddress("PrtEvent", &fEvent); std::cout<<"ch->GetEntries() "<< ch->GetEntries()<GetEntries(); ievent++){ ch->GetEntry(ievent); if(ievent%100==0) cout<<"Event # "<GetMomentum().Z()/100. +0.0000001; particle = fEvent->GetParticle(); for(Int_t h=0; hGetHitSize(); h++){ hit = fEvent->GetHit(h); Double_t time = hit.GetLeadTime(0); Int_t nref = hit.GetNreflectionsInPrizm(); if(time<30000) hHits[mom]->Fill(hit.GetGlobalPos().X()/10.,hit.GetGlobalPos().Y()/10.); } } TString sparticle = ""; if(particle==2212) sparticle="proton"; if(particle==321) sparticle="kaon"; if(particle==211) sparticle="pion"; if(particle==13) sparticle="muon"; std::cout<SetTitle(Form("%f GeV/c ",i*0.1)+sparticle); hHits[i]->Draw("colz"); save(cHits,path,sparticle+Form("_anim_%d",i),info,saveflag); } }