// root macro to analyze the simulation output //void convertMCPoints() { // ----- Load libraries ------------------------------------------------ //``gSystem->Load("fstream.h"); gROOT->LoadMacro("$VMCWORKDIR/gconfig/basiclibs.C"); basiclibs(); gSystem->Load("libGeoBase"); gSystem->Load("libParBase"); gSystem->Load("libBase"); gSystem->Load("libMCStack"); gSystem->Load("libField"); gSystem->Load("libGen"); gSystem->Load("libPassive"); gSystem->Load("libMvd"); // ----- Timer -------------------------------------------------------- TStopwatch timer; timer.Start(); // ------------------------------------------------------------------------ /* Convert MvdWaferMCPoints to the STAR Format (text, "x y z layer") for the conformal mapping stuff */ TFile* f = new TFile("MvdDigi.root"); // the sim file you want to analyse TTree *t=(TTree *) f->Get("cbmsim") ; TClonesArray* hit_array=new TClonesArray("MvdDigiPixel"); t->SetBranchAddress("MVDDigiPixel",&hit_array);//Branch names // TClonesArray* mc_array=new TClonesArray("CbmMCTrack"); // t->SetBranchAddress("MCTrack",&mc_array);//Branch names TH2D* hisxy = new TH2D("hisxy","MVD MC Points, xy view",400,-15.,15.,400,-15.,15.); TH2D* hisrz = new TH2D("hisrz","MVD MC Points, rz view",400,-20.,20.,400,0.,40.); TH1D* hisde = new TH1D("hisde","MVD MC Points, Energyloss",500,0.,0.002); TH1I* hisclustsize = new TH1I("hisclustsize","Pixel Cluster size",20,0,20); TH2D* hiswaferhit = new TH2D("hiswaferhit","wafer pixels",84,0.,83.,76,0.,75.); int nEvents = 1; bool verbose = false; TVector3 vecs; for (Int_t j=0; jGetEntriesFast(); j++) { t->GetEntry(j); if(verbose) cout<<"Event No "<GetEntriesFast()<GetEntriesFast(); i++) { if(verbose) cout<<"Point No "<At(i); // int mcpdg = -1; // CbmMCTrack *mctruth = (CbmMCTrack*)mc_array->At(hit->GetTrackID()); // mcpdg = mctruth->GetPdgCode(); // cout<<"mcpdg="<Fill(hit->GetPixelRow(),hit->GetPixelColumn(),hit->GetCharge()); }//end for i (points in event) }// end for j (events) TCanvas* can1 = new TCanvas("can1","MCHit view in MVD",0,0,1000,500); can1->Divide(2); can1->cd(1); hiswaferhit->DrawCopy("box"); delete hiswaferhit; // ----- 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; // ------------------------------------------------------------------------ }