#include // if mode == 0 the macro exit after having printed the maps void PlotsTheta(std::string nome, Int_t mode=0) { Int_t steps = 20; // Int_t steps = 1; gROOT->Macro("$VMCWORKDIR/gconfig/rootlogon.C"); //gROOT->Macro("../Libs.C"); // ----- Timer -------------------------------------------------------- TStopwatch timer; timer.Start(); // ------------------------------------------------------------------------ Int_t size,sizebase; size = nome.length(); sizebase = size - 12; char base[120]; strncpy(base,nome.c_str(),sizebase); base[sizebase]='\0'; // std::string outfileStr = Form("%s%s", base.c_str(), "ZIP.root"); char strseed[5]; strncpy(strseed,(nome.c_str()+sizebase),4); strseed[4] = '\0'; cout << "seed: " << strseed << endl; cout << base << endl; Int_t seed = atoi(strseed); cout << seed << endl; std::string buff; //std::string inFile = "/hiskp1/bianco/mvd/THOMAS/HV/B2/HV/CORE/Mvd-00-0031_100000_0_0.500000_0.000000_0.000000_-20.000000_90_90_5000ZIP.root"; TCanvas *can1 = new TCanvas(); TCanvas *can2 = new TCanvas(); TH3F *mapMat = new TH3F("Map","Map",500,-3.14,+3.14,500,5.,180.,2000,0,1.); TH2F *mapMat2 = new TH2F("z scan","z scan",500,5.,180.,5000,0.,6.); //***************************************** for (Int_t k = 1 ; k < steps +1 ; k++) { std::string inFile = Form("%s%dZIP.root",base,seed+k-1); cout << "--------------------------------------------------------------------------\nReading: " << inFile.c_str()<<"\n--------------------------------------------------------------------------" << endl; TFile* file = TFile::Open(inFile.c_str()); file->cd(); TNtuple *ntp = (TNtuple*) file->Get("ntp1"); Int_t n=ntp->GetEntries(); Float_t phi, rl, theta; ntp->SetBranchAddress("phi",&phi); ntp->SetBranchAddress("radlengths",&rl); ntp->SetBranchAddress("zeta",&theta); for (Int_t j = 0 ; j < n ; j++) { // cout << "Event " << j << endl; ntp->GetEntry(j); theta = 180*theta/(TMath::Pi()); mapMat->Fill(phi,theta,rl); mapMat2->Fill(theta,rl); //vedophi->Fill(phi); }// end for event } //vedophi->Draw(); // mapMat->Draw(); gStyle->SetPalette(1.); TProfile2D *proj = mapMat->Project3DProfile("yx"); can1->cd(); proj->Draw("COLZ"); can2->cd(); TProfile *sum = mapMat2->ProfileX(); sum->Draw(); std::string figMap = Form("%sMap.png",base); std::string figProf = Form("%sProf.png",base); std::string figMapLOG = Form("%sMapLOG.png",base); can1->Print(figMap.c_str(),"png"); can2->Print(figProf.c_str(),"png"); can1->cd(); gPad->SetLogz(1); can1->Print(figMapLOG.c_str(),"png"); if (mode==0) exit(); }