From: alla Date: Tue, 17 Oct 2006 05:53:52 +0000 (+0000) Subject: macros for reading RecPoints X-Git-Url: http://git.uio.no/git/?p=u%2Fmrichter%2FAliRoot.git;a=commitdiff_plain;h=e9f4d29d1a91179945e1a236b0fc642251809fc1 macros for reading RecPoints --- diff --git a/START/readRec.C b/START/readRec.C new file mode 100644 index 00000000000..362301c80b6 --- /dev/null +++ b/START/readRec.C @@ -0,0 +1,97 @@ +void readRec() +{ + //read START RecPoints and plots histos + + // Dynamically link some shared libs + /* if (gClassTable->GetID("AliRun") < 0) { + gROOT->LoadMacro("loadlibs.C"); + loadlibs(); + } + */ + char filename[100]; + sprintf(filename,"galice.root"); + AliRunLoader* rl = AliRunLoader::Open("galice.root",AliConfig::GetDefaultEventFolderName(),"read"); + if (rl == 0x0) + { + cerr<<"Can not open session for file galice.root\n"; + return; + } + + rl->LoadgAlice(); + gAlice = rl->GetAliRun(); + + AliSTART* START = (AliSTART *)gAlice->GetDetector("START"); + + rl->LoadHeader(); + Int_t retval; + AliLoader* lstart = rl->GetLoader("STARTLoader"); + + Int_t iNevents=rl->GetNumberOfEvents(); + cout<<" nevents "<GetEvent(ievent); + + AliHeader *header = gAlice->GetHeader(); + AliGenEventHeader* genHeader = header->GenEventHeader(); + TArrayF *o = new TArrayF(3); + genHeader->PrimaryVertex(*o); + Float_t zRealVertex=o->At(2); + hRealVertex->Fill( zRealVertex); + + lstart->LoadRecPoints("READ"); + TTree *recTree = lstart->TreeR(); + TBranch *brRec=recTree->GetBranch("START"); + AliSTARTRecPoint *fRec = new AliSTARTRecPoint(); + if (brRec) { + brRec->SetAddress(&fRec); + }else{ + cerr<<"EXEC Branch START Recpoints not found"<GetEntry(0); + Int_t mean = fRec->GetMeanTime(); + hMean->Fill(mean/1000.); + Int_t besttimeleft = fRec->GetBestTimeLeft(); + Int_t besttimeright = fRec->GetBestTimeRight(); + hBestTimeC->Fill(0.001 * besttimeright); + hBestTimeA->Fill(0.001 * besttimeleft ); + Float_t vertex= fRec->GetVertex(); + cout<Fill(zRealVertex-vertex/2.); + hVertex->Fill(vertex/2.); + } + Hfile = new TFile("FigRec.root","RECREATE","Histograms for START +digits"); + printf("Writting histograms to root file \n"); + Hfile->cd(); + //Create a canvas, set the view range, show histograms + gStyle->SetOptStat(111111); + // TCanvas *c1 = new TCanvas("c1","Alice START Time ",400,10,600,600); + // hTimediff->Write(); + hBestTimeC->Write(); + hBestTimeA ->Write(); + hVertex->Write(); + hRealVertex->Write(); + hAcc->Write(); + hMean->Write(); +} // end of macro + + + +