// root macro to analyze the simulation output //void convertMCPoints() { // ----- Load libraries ------------------------------------------------ //``gSystem->Load("fstream.h"); gROOT->Macro("$VMCWORKDIR/gconfig/rootlogon.C"); gSystem->Load("libHypGe"); // ----- Timer -------------------------------------------------------- TStopwatch timer; timer.Start(); // ------------------------------------------------------------------------ #include //photons from hyp electromag. decay string Filename = "../sim_pseudodata/sim_hypGe_BgUrqmd2_Marcell_1,332MeV_2er_seedtest.root"; TFile* g = new TFile(Filename.c_str()); // the sim file you want to analyse TTree *b=(TTree *) g->Get("cbmsim") ; TClonesArray* hit_bar=new TClonesArray("PndHypGePoint"); b->SetBranchAddress("HypGePoint",&hit_bar);//Branch names TClonesArray* mc_bar=new TClonesArray("PndMCTrack"); b->SetBranchAddress("MCTrack",&mc_bar);//Branch names //**** Energy deposited from particle background //****photons from hyp elect. decay string Name = "total gam energy deposit, " + Filename; TH1D* gamTde = new TH1D("gamTde",Name.c_str(),20000,0.0000,0.002); bool verbose = false; Int_t MotherId,Motherpdg; TVector3 vecs,pos; int mcpdg = -1,ev; Double_t mult,En,Eng,Enth; //vector event; int count; cout<GetEntriesFast()<GetEntriesFast(); k++) { Eng=0.; b->GetEntry(k); //if(verbose) cout<<"Event No "<GetEntriesFast(); i++) { PndHypGePoint *hitgam=(PndHypGePoint*)hit_bar->At(i); PndMCTrack *mcgam = (PndMCTrack*)mc_bar->At(hitgam->GetTrackID()); Double_t rande; //rande= gRandom->Gaus(hitgam->GetEnergyLoss(),0.000003); //if (sci->Getpdgcode()) //if (sci)cout<GetEnergyLoss()<Gaus(0,0.000003); //randy= gRandom->Gaus(0,1); Eng =Eng + (hitgam->GetEnergyLoss()); //Eng =Eng + (rande); }//end for i (points in event) //count =0; if(Eng>0)gamTde->Fill(Eng); }// end for j (events) TCanvas* can3 = new TCanvas("can3","germanium detector",0,0,1000,1000); gamTde->Draw(); Double_t PeakX = gamTde->GetMaximumBin(), PeakY = gamTde->GetMaximum(), DPeakY = sqrt(gamTde->GetMaximum()); cout <<"MaxX: "<< PeakX << "; MaxY: " << PeakY << " +- " << DPeakY<< endl; Double_t SumCompton=0, DSumCompton = 0; for (int i =9622; i <= 11176; i++) SumCompton += gamTde->GetBinContent(i); DSumCompton = sqrt(SumCompton); cout <<"N. of Compton Events: "<< SumCompton<< " +- " << DSumCompton << endl; cout << "Peak/Compton: "<< gamTde->GetMaximum()/SumCompton << " +- "<< sqrt(pow(DPeakY/SumCompton,2)+ pow(PeakY*DSumCompton/SumCompton/SumCompton,2)) << endl; Double_t AllEntries = gamTde->GetEntries(); cout << "Entries: " << AllEntries << endl; // ----- Finish ------------------------------------------------------- timer.Stop(); Double_t rtime = timer.RealTime(); Double_t ctime = timer.CpuTime(); cout << endl << endl; cout << "Macro finished succesfully." << endl; //cout << "Output file is " << outFile << endl; //cout << "Parameter file is " << parFile << endl; cout << "Real time " << rtime << " s, CPU time " << ctime << " s" << endl; cout << endl; // ------------------------------------------------------------------------ }