#include void runRadlenCalc(TGeoManager * gGeoMan, Int_t tpc) { TStopwatch timer; timer.Start(); // Bool_t dogif=kTRUE; Bool_t dogif=kFALSE; //gROOT->LoadMacro("macro/tpc/nicehist.C"); Int_t phistart, phiend, thestart, theend; Double_t phistep, thestep; Int_t piotr; Int_t phibin, thebin, lastbin; phistart=0; phiend=360; phistep=.25; thestart=0.; theend=180; thestep=.25; piotr=10; phibin=Int_t((phiend-phistart)/phistep); thebin=Int_t((theend-thestart)/(thestep)); cout<SetXtitle(" TH1F* hradvsphi = new TH1F("Radlen phimean vs theta","Radlen pimean vs theta",thebin,thestart,theend); hradvsphi->SetXTitle("Theta"); hradvsphi->SetYTitle("X_{0} (%)"); TH1F* hradvstheta = new TH1F("Radlen vs theta","Radlen vs theta",thebin,thestart,theend); hradvstheta->SetXTitle("Theta"); hradvstheta->SetYTitle("X/X_{0}(%)"); TH2F* hradphivstheta = new TH2F("Radlen","Radlen",phibin,phistart,phiend,thebin,thestart,theend); hradphivstheta->SetXTitle("Phi"); hradphivstheta->SetYTitle("Theta"); TH2F* hxzproj = new TH2F("XZ-Projection","XZ-Projection",(1.5*thebin),tzmin,tzmax,(phibin+10)/2,0.,trmax); hxzproj->SetXTitle("Z Position (cm)"); hxzproj->SetYTitle("Radius (cm)"); TH2F* hthetabin = new TH2F("Radiation Length","Radlen phi Thetabin",phibin,trmin,trmax,phibin,trmin,trmax); hthetabin->SetXTitle("X Position (cm)"); hthetabin->SetYTitle("Y Position (cm)"); // }}} TCanvas* c4 = new TCanvas("Radiation length vs Theta","Radiation length vs theta"); c4->cd(); c4->Divide(1,2); c4->GetPad(2)->Divide(2,1); c4->GetPad(1)->cd(); hradvsphi->Draw(); c4->GetPad(2)->GetPad(1)->cd(); hthetabin->Draw("colz"); c4->GetPad(2)->GetPad(2)->cd(); hxzproj->Draw("colz"); hradvsphi->SetStats(kFALSE); hthetabin->SetStats(kFALSE); hxzproj->SetStats(kFALSE); const Int_t histcount=5; TH1* histos[histcount]; histos[0]=hradmap; histos[1]=hradvsphi; histos[2]=hradvstheta; histos[3]=hradphivstheta; histos[4]=hxzproj; Double_t px,py,pz,dx,dy,dz; Double_t theta,phi; theta=90; phi=90; px=py=pz=0; // px=0.05; Bool_t debug = kFALSE; // Bool_t debug = kTRUE; TGeoNode* node; TGeoNode* lastnode; TGeoNode* lastlastnode; Double_t dist=2000.; Double_t X=0.; Double_t step=100; Double_t snext; Double_t thick=0; Double_t tx[2], ty[2], tz[3]; Double_t actpoint[5]; Double_t radlen; Double_t pradlen; Double_t gradlen; Double_t xpos,ypos,zpos,radi; Double_t lastx, lasty, lastz, lastr; lastr=trmax; lastx=trmax; lasty=0.; lastz=tzmax; gGeoMan->CheckGeometry(); if(debug)cout<<"Top Volume: "<GetTopVolume()->GetName()<SetVisLevel(2); TCanvas* c1 = new TCanvas("3d","3d"); gGeoMan->GetTopVolume()->Draw(); // gGeoMan->GetTopVolume()->Raytrace(); for(theta=thestart;thetaInitTrack(px,py,pz,dx,dy,dz); node=gGeoMan->GetCurrentNode(); for(Int_t i=0;i<5;i++) actpoint[i]=gGeoMan->GetCurrentPoint()[i]; if(debug)cout<<"actpoint: "<GetVolume()->GetName()<GetStep(); // cout<<"stepsize "<FindNextBoundaryAndStep(); if(debug)if(node)cout<<"Now in node: "<GetVolume()->GetName()<GetStep(); if(lastnode){ thick+=snext; radlen=lastnode->GetVolume()->GetMaterial()->GetRadLen(); if(debug)cout<<"Radlen of material: "<GetVolume()->GetName()<<" : "<SetLineColor(kBlack); if( (Int_t)(theta/thestep)%(Int_t)(piotr/thestep) == 0 ) if( (Int_t)(phi/phistep)%(Int_t)(piotr/phistep) == 0){ c1->cd(); if(labs>0)track->Draw("same"); //c1->Update(); } // }}} // cout<<"Total radlen: "<Fill(tx[0],ty[0],tz[0],gradlen); if(gradlen != 0 ){ rphimean+=gradlen; phicount++; } xpos=tx[0]; ypos=ty[0]; zpos=tz[0]; hradphivstheta->Fill(phi,theta,gradlen); if(lastbin != hthetabin->FindBin(xpos,ypos)) hthetabin->Fill(xpos,ypos,gradlen); lastbin=hthetabin->FindBin(xpos,ypos); if(phi==180){ radi=sqrt(xpos*xpos+ypos*ypos); } } // cout<Fill(theta,gradlen); hradvsphi->Fill(theta,rphimean); // cout<Fill(zpos+i*(hxzproj->GetXaxis()->GetBinWidth(1)),radi,rphimean); } if(TMath::Abs(lastr-radi)<1e-10){ // cout<<"rfill: "<Fill(zpos,radi+i*(hxzproj->GetYaxis()->GetBinWidth(1)),rphimean); } } // cout<Fill(zpos,radi,rphimean); lastr=radi; lastx=xpos; lasty=ypos; lastz=zpos; //cout<0){ c4->GetPad(1)->cd(); hradvsphi->Draw(); c4->GetPad(2)->GetPad(1)->cd(); // hthetabin->GetZaxis()->SetRangeUser(); hthetabin->Draw("colz"); c4->GetPad(2)->GetPad(2)->cd(); // hxzproj->GetZaxis()->SetRangeUser(); hxzproj->Draw("colz"); c4->Update(); c4->Print("radvstheta.gif+"); c4->Print(Form("animated/proto/radvstheta_%f.jpg",theta)); hthetabin->Reset("M"); } if( (Int_t)(theta/thestep)%(Int_t)(piotr/thestep) == 0 ){ cout<SetPalette(1); // gROOT->SetStyle("Plain"); //TCanvas* c2 = new TCanvas("3D RadMap","3D RadMap"); //c2->cd(); //gStyle->SetCanvasPreferGL(1); // nicehist(hradmap); // hradmap->Draw("iso"); //TCanvas* c3 = new TCanvas("Rad vs Theta","Rad vs theta"); //c3->cd(); //hradvsphi->Draw(); //TCanvas* c4 = new TCanvas("Rad vs Theta","Rad vs Theta"); //c4->cd(); // nicehist(hradvstheta); //hradvstheta->Draw(); //TCanvas* c5 = new TCanvas("Rad Phi vs Theta","Rad Phi vs Theta"); //c5->cd(); //hradphivstheta->Draw("colz"); //TCanvas* c6 = new TCanvas("XZ-Proj","XZ-Proj"); //c6->cd(); //hxzproj->Draw("colz"); TFile* outfile = new TFile(filename,"RECREATE"); for(Int_t i=0; iWrite(); c1->Write(); outfile->Close(); timer.Stop(); Double_t rtime = timer.RealTime(); Double_t ctime = timer.CpuTime(); cout<<"Realtime: "<