#define analyseClass_cxx #include "analyseClass.h" #include #include #include void analyseClass::Loop() { // In a ROOT session, you can do: // root> .L analyseClass.C // root> analyseClass t // root> t.GetEntry(12); // Fill t data members with entry number 12 // root> t.Show(); // Show values of entry 12 // root> t.Show(16); // Read and show values of entry 16 // root> t.Loop(); // Loop on all entries // // This is the loop skeleton where: // jentry is the global entry number in the chain // ientry is the entry number in the current Tree // Note that the argument to GetEntry must be: // jentry for TChain::GetEntry // ientry for TTree::GetEntry and TBranch::GetEntry // // To read only selected branches, Insert statements like: // METHOD1: // fChain->SetBranchStatus("*",0); // disable all branches // fChain->SetBranchStatus("branchname",1); // activate branchname // METHOD2: replace line // fChain->GetEntry(jentry); //read all branches //by b_branchname->GetEntry(ientry); //read only this branch if (fChain == 0) return; int nbins = 150; gStyle->SetOptStat(111111); gStyle->SetPalette(57); TCanvas *can = new TCanvas("can","can",860,660); can->SetRightMargin(0.15); can->SetBottomMargin(0.2); can->SetLeftMargin(0.2); //bins more than 800 doesn't work to TH3F //TH2F *anaPos= new TH2F("anaPos","anaPos", nbins, -0.60,0.60, nbins, -0.60,0.60); TH2F *analyse= new TH2F("anaPos","anaPos", nbins, 0.0,0.0455, nbins, -25.0,25.0); TH2F *analyse1= new TH2F("anaPos","anaPos", nbins, -23.0,23.0,nbins, -23.0,23.0); TH2F *analyse2= new TH2F("anaPos","anaPos", nbins, 0.,0.0455, nbins, -25.0,25.0); TH3F *analyse3= new TH3F("anaPos","anaPos", nbins, -25.0,25.0, nbins, -25.0,25.0, nbins, -25.0,25.0); TH3F *analyse4= new TH3F("anaPos","anaPos", nbins, 0.,0.0455, nbins, -25.0,25.0, nbins, -25.0,25.0); //TNtuple *anaNt = new TNtuple("ntuple","data from root","posX:posY:Edep"); can->Divide(2,4); can->cd(1);//*/ Long64_t nentries = fChain->GetEntries(); for (Long64_t jentry=0; jentry<150000;jentry++) { Long64_t ientry = LoadTree(jentry); if (ientry < 0) break; nb = fChain->GetEntry(jentry); nbytes += nb; // if (Cut(ientry) < 0) continue; cout<<"size total = " <at(cont)=="G4_WATER")&&(Step_AccumulatedEnergyDeposited->at(cont)>0.0)){mm2++; /*cout<<"edepCont = "<at(cont)< SetFillColor(0); //anaPos->GetZaxis()->SetRangeUser(-0.6, 0.6); analyse -> Draw("colz"); can->cd(2); analyse1 -> SetNameTitle("energy", "PosX x PosZ; PosX [mm]; PosZ [mm]; Counts"); analyse1 -> SetFillColor(0); //anaPos->GetZaxis()->SetRangeUser(-0.6, 0.6); analyse1 -> Draw("COLZ"); can->cd(3); analyse2 -> SetNameTitle("energy", "Event_Energy x posX;Energy[MeV]; PosY [mm]"); analyse2-> SetFillColor(0); //anaPos->GetZaxis()->SetRangeUser(-0.6, 0.6); analyse2 -> Draw("colz"); can->cd(4); analyse3 -> SetNameTitle("energy", "posX x posY x posZ;posX[mm];posY[mm];posZ[mm]"); analyse3-> SetFillColor(0); //anaPos->GetZaxis()->SetRangeUser(-0.6, 0.6); analyse3 -> Draw("iso"); can->cd(5); analyse4 -> SetNameTitle("energy", "Edep x posX x posX;Edep[MeV];posX[mm];posY[mm]"); analyse4-> SetFillColor(0); //anaPos->GetZaxis()->SetRangeUser(-0.6, 0.6); analyse4 -> Draw("iso"); can->cd(6); analyse1 -> SetNameTitle("energy", "Energy versus PosX; Energy[MeV]; PosX [mm]; Counts"); analyse1-> SetFillColor(0); //anaPos->GetZaxis()->SetRangeUser(-0.6, 0.6); gPad->SetLogz(); analyse1 -> Draw("colz"); // out file TFile *p = new TFile("analyse.root", "RECREATE"); // Sam 0.05mm analyse->Write(); analyse1->Write(); analyse2->Write(); analyse3->Write(); analyse4->Write(); }