int lutmean(TString baseFile = "lut_all") { gInterpreter->GenerateDictionary("vector","TVector3.h"); TString inFile =baseFile+".root"; TString outFile =baseFile+"_avr.root"; TFile* f = new TFile(inFile); TTree *t=(TTree *) f->Get("dircsim") ; TClonesArray* fLut[5]; for(Int_t l=0; l<5; l++){ fLut[l] = new TClonesArray("PndDrcLutNode"); t->SetBranchAddress(Form("LUT%d",l),&fLut[l]); } t->GetEntry(0); TFile *fFileNew = TFile::Open(outFile, "RECREATE"); TClonesArray *fLutNew[5]; TTree *fTreeNew = new TTree("dircsim","Look-up table for DIRC. Averaged"); for(Int_t l=0; l<5; l++){ fLutNew[l] = new TClonesArray("PndDrcLutNode"); fTreeNew->Branch(Form("LUT%d",l),&fLutNew[l],256000,0); } Int_t Nnodes = 30000; for(Int_t l=0; l<5; l++){ TClonesArray &fLutaNew = *fLutNew[l]; for (Long64_t n=0; nDivide(1,2); // TH1F * histNode = new TH1F("LutNode","Node vs Multiplicity",30000,0,150000); // TH1F * hTime = new TH1F("hTime","Time",5000,0,10); // TH1F * hDir = new TH1F("hDir","X component",1000,-1,1); const Int_t max(100); std::vector vArray[max]; std::vector tArray[max]; std::vector pArray; TVector3 dir, dir2, sum; Double_t angle, minangle,pathid,time,sumt; PndDrcLutNode *node; for(Int_t l=0; l<5; l++){ for (Int_t inode=0; inodeGetEntriesFast(); inode++){ if(inode%1000==0) cout<<"Node # "<At(inode); //histNode->Fill(node->GetNodeId(),node->Entries()); Int_t size = node->Entries(); if(size<1) continue; for(int i=0; iGetEntry(i); time = node->GetTime(i); pathid = node->GetPath(i); // hDir->Fill(dir.X()); // hTime->Fill(time); bool newid = true; for(int j=0; jFill(vArray[j][v].X()); // hTime->Fill(tArray[j][v]); } // c->cd(1); // hTime->Draw(); // c->cd(2); // hDir->Draw(); // c->Update(); // c->WaitPrimitive(); // hDir->Reset(); // hTime->Reset(); if(vArray[j].size()<5) continue; sum *= 1/(Double_t)vArray[j].size(); sumt *= 1./(Double_t)tArray[j].size(); ((PndDrcLutNode*)(fLutNew[l]->At(inode)))->AddEntry(node->GetDetectorId(), sum,pArray[j],j,sumt, node->GetPos()); } for(int i=0; iFill(); fTreeNew->Write(); fFileNew->Write(); return 0; }