int main(int args, char **argv) { RegexIsFunny *regexTest = new RegexIsFunny(); float quantity[4]; float price[5]; if (!CHECK_ARGS(args)) { std::cerr << "NOT ENOUGH ARGS" << std::endl; exit (84); } for (int i = 1; i < 5; ++i) { quantity[i - 1] = regexTest->checkQuantity(argv[i]); } for (int i = 5; i < 10; ++i) { price[i - 5] = regexTest->checkPrice(argv[i]); } Simplex toto(price, quantity); toto.algorithm(); toto.display_result(price); delete regexTest; return 0; }
int bar (int a, int b, int c, int d, int e, int f, int g, int h) { int res; toto (&res); return h; }
int main() { srand(time(0)); MonitorModuleCpu mmc; MonitorModuleRam mmr; MonitorModuleUser mmu; MonitorModuleNetwork mmn; mmc.initialize(); mmr.initialize(); mmu.initialize(); mmn.initialize(); while (1) { NCursesDisplayUser titi(&mmu); titi.display(6, 69, 1, 1); NCursesDisplayCpu toto(&mmc); toto.display(7, 69, 8, 1); NCursesDisplayRam tata(&mmr); tata.display(6, 69, 16, 1); NCursesDisplayNetwork tutu(&mmn); tutu.display(6, 69, 23, 1); refresh(); sleep(1); } }
int petitml_entry(int a){ int b; b = 2 ; a = a+b ; a = toto( a ) ; return a; }
int bar2 () { int res; toto (&res); return res; }
//________________________________________________________________ void KVZAFinderDialog::ProcessIdentification() { fZmin = fZminEntry->GetIntNumber(); fZmax = fZmaxEntry->GetIntNumber(); fAList = fAEntry->GetText(); Int_t zmin = ((KVIDentifier*)fGrid->GetIdentifiers()->First())->GetPID(); if (fZmin < zmin) fZmin = zmin; Int_t zmax = ((KVIDentifier*)fGrid->GetIdentifiers()->Last())->GetPID(); if (fZmax > zmax) fZmax = zmax; KVZALineFinder toto((KVIDZAGrid*)fGrid, fHisto); // fLinearBar->SetRange(0, ((TH2F*)fHisto)->GetSum()); // fLinearBar->SetRange(0, fHisto->GetNbinsX()*fHisto->GetNbinsY()); // fLinearBar->Reset(); // toto.Connect("IncrementLinear(Float_t)","TGHProgressBar", // fLinearBar, "SetPosition(Float_t)"); fProgressBar->SetRange(0, zmax - zmin); fProgressBar->Reset(); toto.Connect("Increment(Float_t)", "TGHProgressBar", fProgressBar, "SetPosition(Float_t)"); toto.SetAList(fAList.Data()); toto.SetNbinsByZ(fBinsByZ); fTestButton->SetEnabled(kFALSE); fCloseButton->SetEnabled(kFALSE); toto.ProcessIdentification(fZmin, fZmax); fTestButton->SetEnabled(kTRUE); fCloseButton->SetEnabled(kTRUE); toto.Disconnect("IncrementLinear(Float_t)", fLinearBar, "SetPosition(Float_t)"); toto.Disconnect("Increment(Float_t)", fProgressBar, "SetPosition(Float_t)"); if (!gIDGridEditor) { new KVIDGridEditor; gIDGridEditor->StartViewer(); } gIDGridEditor->SetHisto(toto.GetHisto()); gIDGridEditor->SetGrid(toto.GetGrid(), kFALSE); DoClose(); }
int main() { try { ios_fc::DatagramSocket toto(1478); ios_fc::Datagram titi(toto.getBroadcastAddress()/*ios_fc::SocketAddress("durandal")*/, 1478, ios_fc::VoidBuffer("Hello", 5), 5); toto.send(titi); ios_fc::Buffer<char> resultBuf(1024); ios_fc::Datagram result = toto.receive(resultBuf); printf("Recu:%s du port %d\n", (const void *)(result.getMessage()), result.getPortNum()); ios_fc::Datagram titi2(result.getAddress(), result.getPortNum(), ios_fc::VoidBuffer("Tiens", 5), 5); toto.send(titi2); } catch (ios_fc::Exception e) { e.printMessage(); } return 0; }
int main(int ac, char** av) { while (1) toto(); }
int main() { toto(); }
main() { return toto(); }
void TJerFile::CopyStrucFile(const char *SrcDir, const char *DestDir, BList *Diff) { entry_ref *truc; BEntry *entry; BPath chemin; BPath Destination; char *Relative; char *TheRelativePathAndName; /* printf("------------------------------------\n"); printf("ZIPPathName : %s \n",ZIPPathName); printf("SrcDir : %s \n",SrcDir); printf("DestDir : %s \n",DestDir); printf("------------------------------------\n"); */ BMessage *AMessage; AMessage = new BMessage(B_RESET_STATUS_BAR); AMessage->AddFloat("maximum",Diff->CountItems()); MyInvoker.Invoke(AMessage); delete AMessage; try { for (int ind=0;ind < Diff->CountItems();ind++ ) { truc = (entry_ref *)(Diff->ItemAt(ind)); if (truc!=NULL) { entry = new BEntry(truc); entry->GetPath(&chemin); if (CreateZIP == true) { // printf("Zipping............\n"); char *titi; titi = (char *)malloc(sizeof(char)*(strlen(DestDir) + strlen(FBackupName) +2 )); //count the \0 and the / for the directory! strcpy(titi,DestDir); strcat(titi,"/"); strcat(titi,FBackupName); // string titi(DestDir); /* printf("------------------------------------\n"); printf("ZIPPathName : %s \n",ZIPPathName); printf("chemin : %s \n",chemin.Path()); printf("titi : %s \n",titi.c_str()); printf("SrcDir : %s \n",SrcDir); printf("DestDir : %s \n",DestDir); printf("------------------------------------\n"); */ // titi = titi + "/BeBackup.zip"; // AddFileToZIP(chemin.Path(),titi.c_str()); AddFileToZIP(chemin.Path(),titi); } else { GetRelativePath(SrcDir,chemin.Path(),&Relative); CreateCompletePath(DestDir,Relative); GetRelativePathAndName(SrcDir,chemin.Path(),&TheRelativePathAndName); Destination.SetTo(DestDir); string toto(Destination.Path()); toto = toto + TheRelativePathAndName; CopyFile(chemin.Path(),toto.c_str()); } delete entry; } else printf("Items is null...\n"); } } //Try catch(GeneralException &e) { printf("Exception while copying... %s %s",e.Message.c_str(),e.Location.c_str()); } }
int main() { toto(); return (0); }
void Body::ApplyImpulse(float _x,float _y) { b2Vec2 toto(_x,_y); this->body->ApplyLinearImpulse(toto,this->body->GetWorldCenter(),true); //TODO check last param wake == true }
void PlotAndRun(TString channel, bool print = true) { if (print) gROOT->SetBatch(true); //Speeds things up by not displaying plots in canvas gROOT->ProcessLine(".L ../PlotIt/PlotIt_cc.so"); if ( channel.Contains("mu") || channel.Contains("Mu") ) { //PlotIt toto("../PlotIt/input_mu.list",19771,1.); PlotIt toto("../PlotIt/input_mu_0jets.list",19771,1.); } if ( channel.Contains("el") || channel.Contains("El") ) { //PlotIt toto("../PlotIt/input_el.list",19767,1.); PlotIt toto("../PlotIt/input_el_0jets.list",19767,1.); } if ( channel.Contains("mu") || channel.Contains("Mu") ) { toto.plotstack("MUONS_ETA",2,1,"#eta(isolated #mu)","right"); toto._hdata->GetXaxis()->SetRangeUser(-2.2,2.2); toto._hdata->GetYaxis()->SetRangeUser(0.,50.); c1->Modified(); TString header = "CMS preliminary, 19.8 fb^{-1}, #sqrt{s} = 8 TeV"; TLatex *latex = new TLatex(); latex->SetTextSize(0.05); latex->SetTextFont(62); latex->SetTextAlign(12); latex->SetTextColor(1); latex->DrawLatex(-2.4,1.04*toto._hdata->GetMaximum(),header); TString textchannel = "#mu + Jets channel"; TLatex *latex2 = new TLatex(); latex2->SetTextSize(0.05); latex2->SetTextFont(52); latex2->SetTextAlign(12); latex2->SetTextColor(1); latex2->DrawLatex(-2.2,0.9*toto._hdata->GetMaximum(),textchannel); c1->Modified(); if (print) { c1->Print("Plots/MUONS_ETA.pdf"); c1->Print("Plots/MUONS_ETA.jpg"); c1->Print("Plots/MUONS_ETA.eps"); c1->Print("Plots/MUONS_ETA.C"); } toto.plotstack("MUONS_PFISO",1,1,"#mu isolation","right"); toto._hdata->GetXaxis()->SetRangeUser(0,0.13); c1->Modified(); TString header = "CMS preliminary, 19.8 fb^{-1}, #sqrt{s} = 8 TeV"; TLatex *latex = new TLatex(); latex->SetTextSize(0.05); latex->SetTextFont(62); latex->SetTextAlign(12); latex->SetTextColor(1); latex->DrawLatex(toto._hdata->GetXaxis()->GetXmin(),1.04*toto._hdata->GetMaximum(),header); TString textchannel = "#mu + Jets channel"; TLatex *latex2 = new TLatex(); latex2->SetTextSize(0.05); latex2->SetTextFont(52); latex2->SetTextAlign(12); latex2->SetTextColor(1); latex2->DrawLatex(0.01,0.9*toto._hdata->GetMaximum(),textchannel); c1->Modified(); if (print) { c1->Print("Plots/MUONS_PFISO.pdf"); c1->Print("Plots/MUONS_PFISO.jpg"); c1->Print("Plots/MUONS_PFISO.eps"); c1->Print("Plots/MUONS_PFISO.C"); } toto.plotstack("MUONS_PT",10,1,"p_{T}(isolated #mu) (GeV/c)","right"); toto._hdata->GetXaxis()->SetRangeUser(0,245); toto._hdata->GetYaxis()->SetRangeUser(0,70.); c1->Modified(); TString header = "CMS preliminary, 19.8 fb^{-1}, #sqrt{s} = 8 TeV"; TLatex *latex = new TLatex(); latex->SetTextSize(0.05); latex->SetTextFont(62); latex->SetTextAlign(12); latex->SetTextColor(1); latex->DrawLatex(toto._hdata->GetXaxis()->GetXmin(),1.04*toto._hdata->GetMaximum(),header); TString textchannel = "#mu + Jets channel"; TLatex *latex2 = new TLatex(); latex2->SetTextSize(0.05); latex2->SetTextFont(52); latex2->SetTextAlign(12); latex2->SetTextColor(1); latex2->DrawLatex(10.,0.9*toto._hdata->GetMaximum(),textchannel); c1->Modified(); if (print) { c1->Print("Plots/MUONS_PT.pdf"); c1->Print("Plots/MUONS_PT.jpg"); c1->Print("Plots/MUONS_PT.eps"); c1->Print("Plots/MUONS_PT.C"); } } if ( channel.Contains("el") || channel.Contains("El") ) { toto.plotstack("ELECTRONS_ETA",2,1,"#eta(isolated e)","right"); toto._hdata->GetXaxis()->SetRangeUser(-2.5,2.5); toto._hdata->GetYaxis()->SetRangeUser(0,60); c1->Modified(); TString header = "CMS preliminary, 19.8 fb^{-1}, #sqrt{s} = 8 TeV"; TLatex *latex = new TLatex(); latex->SetTextSize(0.05); latex->SetTextFont(62); latex->SetTextAlign(12); latex->SetTextColor(1); latex->DrawLatex(-2.55,1.04*toto._hdata->GetMaximum(),header); TString textchannel = "e + Jets channel"; TLatex *latex2 = new TLatex(); latex2->SetTextSize(0.05); latex2->SetTextFont(52); latex2->SetTextAlign(12); latex2->SetTextColor(1); latex2->DrawLatex(-2.2,0.9*toto._hdata->GetMaximum(),textchannel); c1->Modified(); if (print) { c1->Print("Plots/ELECTRONS_ETA.pdf"); c1->Print("Plots/ELECTRONS_ETA.jpg"); c1->Print("Plots/ELECTRONS_ETA.eps"); c1->Print("Plots/ELECTRONS_ETA.C"); } toto.plotstack("ELECTRONS_PFISO",1,1,"e isolation","right"); toto._hdata->GetXaxis()->SetRangeUser(0,0.15); toto._hdata->GetYaxis()->SetTitle("Events / 0.01"); c1->Modified(); TString header = "CMS preliminary, 19.8 fb^{-1}, #sqrt{s} = 8 TeV"; TLatex *latex = new TLatex(); latex->SetTextSize(0.05); latex->SetTextFont(62); latex->SetTextAlign(12); latex->SetTextColor(1); latex->DrawLatex(toto._hdata->GetXaxis()->GetXmin(),1.04*toto._hdata->GetMaximum(),header); TString textchannel = "e + Jets channel"; TLatex *latex2 = new TLatex(); latex2->SetTextSize(0.05); latex2->SetTextFont(52); latex2->SetTextAlign(12); latex2->SetTextColor(1); latex2->DrawLatex(0.01,0.9*toto._hdata->GetMaximum(),textchannel); c1->Modified(); if (print) { c1->Print("Plots/ELECTRONS_PFISO.pdf"); c1->Print("Plots/ELECTRONS_PFISO.jpg"); c1->Print("Plots/ELECTRONS_PFISO.eps"); c1->Print("Plots/ELECTRONS_PFISO.C"); } toto.plotstack("ELECTRONS_PT",20,1,"p_{T}(isolated e) (GeV/c)","right"); toto._hdata->GetXaxis()->SetRangeUser(0,250); toto._hdata->GetYaxis()->SetRangeUser(0,55); c1->Modified(); TString header = "CMS preliminary, 19.8 fb^{-1}, #sqrt{s} = 8 TeV"; TLatex *latex = new TLatex(); latex->SetTextSize(0.05); latex->SetTextFont(62); latex->SetTextAlign(12); latex->SetTextColor(1); latex->DrawLatex(toto._hdata->GetXaxis()->GetXmin(),1.04*toto._hdata->GetMaximum(),header); TString textchannel = "e + Jets channel"; TLatex *latex2 = new TLatex(); latex2->SetTextSize(0.05); latex2->SetTextFont(52); latex2->SetTextAlign(12); latex2->SetTextColor(1); latex2->DrawLatex(10,0.9*toto._hdata->GetMaximum(),textchannel); c1->Modified(); if (print) { c1->Print("Plots/ELECTRONS_PT.pdf"); c1->Print("Plots/ELECTRONS_PT.jpg"); c1->Print("Plots/ELECTRONS_PT.eps"); c1->Print("Plots/ELECTRONS_PT.C"); } } toto.plotstack("GOODJET_N",1,1,"Number of jets with p_{T}>20 GeV/c","right"); toto._hdata->GetXaxis()->SetRangeUser(0,11); if (channel.Contains("mu") || channel.Contains("Mu")) toto._hdata->GetYaxis()->SetRangeUser(0.,140.); c1->Modified(); TString header = "CMS preliminary, 19.8 fb^{-1}, #sqrt{s} = 8 TeV"; TLatex *latex = new TLatex(); latex->SetTextSize(0.05); latex->SetTextFont(62); latex->SetTextAlign(12); latex->SetTextColor(1); latex->DrawLatex(toto._hdata->GetXaxis()->GetXmin(),1.04*toto._hdata->GetMaximum(),header); TString textchannel; if (channel.Contains("mu") || channel.Contains("Mu")) textchannel = "#mu + Jets channel"; if (channel.Contains("el") || channel.Contains("El")) textchannel = "e + Jets channel"; TLatex *latex2 = new TLatex(); latex2->SetTextSize(0.05); latex2->SetTextFont(52); latex2->SetTextAlign(12); latex2->SetTextColor(1); latex2->DrawLatex(0.6,0.9*toto._hdata->GetMaximum(),textchannel); c1->Modified(); if (print) { c1->Print("Plots/GOODJET_20_N.pdf"); c1->Print("Plots/GOODJET_20_N.jpg"); c1->Print("Plots/GOODJET_20_N.eps"); c1->Print("Plots/GOODJET_20_N.C"); } toto.plotstack("GOODJET_30_N",1,1,"Number of jets with p_{T}>30 GeV/c","right"); toto._hdata->GetXaxis()->SetRangeUser(0,11); if (channel.Contains("mu") || channel.Contains("Mu")) toto._hdata->GetYaxis()->SetRangeUser(0.,140.); if (channel.Contains("el") || channel.Contains("El")) toto._hdata->GetYaxis()->SetRangeUser(0,130); c1->Modified(); TString header = "CMS preliminary, 19.8 fb^{-1}, #sqrt{s} = 8 TeV"; TLatex *latex = new TLatex(); latex->SetTextSize(0.05); latex->SetTextFont(62); latex->SetTextAlign(12); latex->SetTextColor(1); latex->DrawLatex(toto._hdata->GetXaxis()->GetXmin(),1.04*toto._hdata->GetMaximum(),header); TString textchannel; if (channel.Contains("mu") || channel.Contains("Mu")) textchannel = "#mu + Jets channel"; if (channel.Contains("el") || channel.Contains("El")) textchannel = "e + Jets channel"; TLatex *latex2 = new TLatex(); latex2->SetTextSize(0.05); latex2->SetTextFont(52); latex2->SetTextAlign(12); latex2->SetTextColor(1); latex2->DrawLatex(0.6,0.9*toto._hdata->GetMaximum(),textchannel); c1->Modified(); if (print) { c1->Print("Plots/GOODJET_30_N.pdf"); c1->Print("Plots/GOODJET_30_N.jpg"); c1->Print("Plots/GOODJET_30_N.eps"); c1->Print("Plots/GOODJET_30_N.C"); } toto.plotstack("GOODJET_40_N",1,1,"Number of jets with p_{T}>40 GeV/c","right"); toto._hdata->GetXaxis()->SetRangeUser(1,9); if (channel.Contains("mu") || channel.Contains("Mu")) toto._hdata->GetYaxis()->SetRangeUser(0.,140.); if (channel.Contains("el") || channel.Contains("El")) toto._hdata->GetYaxis()->SetRangeUser(0,135); c1->Modified(); TString header = "CMS preliminary, 19.8 fb^{-1}, #sqrt{s} = 8 TeV"; TLatex *latex = new TLatex(); latex->SetTextSize(0.05); latex->SetTextFont(62); latex->SetTextAlign(12); latex->SetTextColor(1); latex->DrawLatex(1.,1.04*toto._hdata->GetMaximum(),header); TString textchannel; if (channel.Contains("mu") || channel.Contains("Mu")) textchannel = "#mu + Jets channel"; if (channel.Contains("el") || channel.Contains("El")) textchannel = "e + Jets channel"; TLatex *latex2 = new TLatex(); latex2->SetTextSize(0.05); latex2->SetTextFont(52); latex2->SetTextAlign(12); latex2->SetTextColor(1); latex2->DrawLatex(1.4,0.9*toto._hdata->GetMaximum(),textchannel); c1->Modified(); if (print) { c1->Print("Plots/GOODJET_40_N.pdf"); c1->Print("Plots/GOODJET_40_N.jpg"); c1->Print("Plots/GOODJET_40_N.eps"); c1->Print("Plots/GOODJET_40_N.C"); } toto.plotstack("GOODJET_50_N",1,1,"Number of jets with p_{T}>50 GeV/c","right"); toto._hdata->GetXaxis()->SetRangeUser(0,8); if (channel.Contains("mu") || channel.Contains("Mu")) toto._hdata->GetYaxis()->SetRangeUser(0.,140.); c1->Modified(); TString header = "CMS preliminary, 19.8 fb^{-1}, #sqrt{s} = 8 TeV"; TLatex *latex = new TLatex(); latex->SetTextSize(0.05); latex->SetTextFont(62); latex->SetTextAlign(12); latex->SetTextColor(1); latex->DrawLatex(toto._hdata->GetXaxis()->GetXmin(),1.04*toto._hdata->GetMaximum(),header); TString textchannel; if (channel.Contains("mu") || channel.Contains("Mu")) textchannel = "#mu + Jets channel"; if (channel.Contains("el") || channel.Contains("El")) textchannel = "e + Jets channel"; TLatex *latex2 = new TLatex(); latex2->SetTextSize(0.05); latex2->SetTextFont(52); latex2->SetTextAlign(12); latex2->SetTextColor(1); latex2->DrawLatex(0.4,0.9*toto._hdata->GetMaximum(),textchannel); c1->Modified(); if (print) { c1->Print("Plots/GOODJET_50_N.pdf"); c1->Print("Plots/GOODJET_50_N.jpg"); c1->Print("Plots/GOODJET_50_N.eps"); c1->Print("Plots/GOODJET_50_N.C"); } toto.plotstack("GOODJET_PT",20,1,"p_{T} of jets (GeV/c)","right"); toto._hdata->GetXaxis()->SetRangeUser(0,448); toto._hdata->GetYaxis()->SetRangeUser(0,260); c1->Modified(); TString header = "CMS preliminary, 19.8 fb^{-1}, #sqrt{s} = 8 TeV"; TLatex *latex = new TLatex(); latex->SetTextSize(0.05); latex->SetTextFont(62); latex->SetTextAlign(12); latex->SetTextColor(1); latex->DrawLatex(toto._hdata->GetXaxis()->GetXmin(),1.04*toto._hdata->GetMaximum(),header); TString textchannel; if (channel.Contains("mu") || channel.Contains("Mu")) textchannel = "#mu + Jets channel"; if (channel.Contains("el") || channel.Contains("El")) textchannel = "e + Jets channel"; TLatex *latex2 = new TLatex(); latex2->SetTextSize(0.05); latex2->SetTextFont(52); latex2->SetTextAlign(12); latex2->SetTextColor(1); latex2->DrawLatex(20,0.9*toto._hdata->GetMaximum(),textchannel); c1->Modified(); if (print) { c1->Print("Plots/GOODJET_20_PT.pdf"); c1->Print("Plots/GOODJET_20_PT.jpg"); c1->Print("Plots/GOODJET_20_PT.eps"); c1->Print("Plots/GOODJET_20_PT.C"); } toto.plotstack("JPSI_M",5,1,"J/#psi mass (GeV/c^{2})","right"); toto._hdata->GetXaxis()->SetRangeUser(3,3.195); toto._hdata->GetYaxis()->SetRangeUser(0.,55.); toto._hdata->GetXaxis()->SetNdivisions(506); c1->Modified(); TString header = "CMS preliminary, 19.8 fb^{-1}, #sqrt{s} = 8 TeV"; TLatex *latex = new TLatex(); latex->SetTextSize(0.05); latex->SetTextFont(62); latex->SetTextAlign(12); latex->SetTextColor(1); latex->DrawLatex(3.,1.04*toto._hdata->GetMaximum(),header); TString textchannel; if (channel.Contains("mu") || channel.Contains("Mu")) textchannel = "#mu + Jets channel"; if (channel.Contains("el") || channel.Contains("El")) textchannel = "e + Jets channel"; TLatex *latex2 = new TLatex(); latex2->SetTextSize(0.05); latex2->SetTextFont(52); latex2->SetTextAlign(12); latex2->SetTextColor(1); latex2->DrawLatex(3.01,0.9*toto._hdata->GetMaximum(),textchannel); c1->Modified(); if (print) { c1->Print("Plots/JPSI_M.pdf"); c1->Print("Plots/JPSI_M.jpg"); c1->Print("Plots/JPSI_M.eps"); c1->Print("Plots/JPSI_M.C"); } toto.plotstack("JPSI_ETA",2,1,"J/#psi #eta","right"); toto._hdata->GetXaxis()->SetRangeUser(-2.5,2.5); toto._hdata->GetYaxis()->SetRangeUser(0,50); c1->Modified(); TString header = "CMS preliminary, 19.8 fb^{-1}, #sqrt{s} = 8 TeV"; TLatex *latex = new TLatex(); latex->SetTextSize(0.05); latex->SetTextFont(62); latex->SetTextAlign(12); latex->SetTextColor(1); latex->DrawLatex(-2.55,1.04*toto._hdata->GetMaximum(),header); TString textchannel; if (channel.Contains("mu") || channel.Contains("Mu")) textchannel = "#mu + Jets channel"; if (channel.Contains("el") || channel.Contains("El")) textchannel = "e + Jets channel"; TLatex *latex2 = new TLatex(); latex2->SetTextSize(0.05); latex2->SetTextFont(52); latex2->SetTextAlign(12); latex2->SetTextColor(1); latex2->DrawLatex(-2.35,0.9*toto._hdata->GetMaximum(),textchannel); c1->Modified(); if (print) { c1->Print("Plots/JPSI_ETA.pdf"); c1->Print("Plots/JPSI_ETA.jpg"); c1->Print("Plots/JPSI_ETA.eps"); c1->Print("Plots/JPSI_ETA.C"); } toto.plotstack("JPSI_PT",5,1,"J/#psi p_{T} (GeV/c)","right"); toto._hdata->GetXaxis()->SetRangeUser(0,138); if (channel.Contains("mu") || channel.Contains("Mu")) toto._hdata->GetYaxis()->SetRangeUser(0.,50.); if (channel.Contains("el") || channel.Contains("El")) toto._hdata->GetYaxis()->SetRangeUser(0,45); c1->Modified(); TString header = "CMS preliminary, 19.8 fb^{-1}, #sqrt{s} = 8 TeV"; TLatex *latex = new TLatex(); latex->SetTextSize(0.05); latex->SetTextFont(62); latex->SetTextAlign(12); latex->SetTextColor(1); latex->DrawLatex(toto._hdata->GetXaxis()->GetXmin(),1.04*toto._hdata->GetMaximum(),header); TString textchannel; if (channel.Contains("mu") || channel.Contains("Mu")) textchannel = "#mu + Jets channel"; if (channel.Contains("el") || channel.Contains("El")) textchannel = "e + Jets channel"; TLatex *latex2 = new TLatex(); latex2->SetTextSize(0.05); latex2->SetTextFont(52); latex2->SetTextAlign(12); latex2->SetTextColor(1); latex2->DrawLatex(6,0.9*toto._hdata->GetMaximum(),textchannel); c1->Modified(); if (print) { c1->Print("Plots/JPSI_PT.pdf"); c1->Print("Plots/JPSI_PT.jpg"); c1->Print("Plots/JPSI_PT.eps"); c1->Print("Plots/JPSI_PT.C"); } toto.plotstack("JPSI_L",20,1,"c#tau(J/#psi) (cm)","right"); toto._hdata->GetXaxis()->SetRangeUser(0,0.51); c1->Modified(); TString header = "CMS preliminary, 19.8 fb^{-1}, #sqrt{s} = 8 TeV"; TLatex *latex = new TLatex(); latex->SetTextSize(0.05); latex->SetTextFont(62); latex->SetTextAlign(12); latex->SetTextColor(1); latex->DrawLatex(toto._hdata->GetXaxis()->GetXmin(),1.04*toto._hdata->GetMaximum(),header); TString textchannel; if (channel.Contains("mu") || channel.Contains("Mu")) textchannel = "#mu + Jets channel"; if (channel.Contains("el") || channel.Contains("El")) textchannel = "e + Jets channel"; TLatex *latex2 = new TLatex(); latex2->SetTextSize(0.05); latex2->SetTextFont(52); latex2->SetTextAlign(12); latex2->SetTextColor(1); latex2->DrawLatex(0.03,0.9*toto._hdata->GetMaximum(),textchannel); c1->Modified(); if (print) { c1->Print("Plots/JPSI_L.pdf"); c1->Print("Plots/JPSI_L.jpg"); c1->Print("Plots/JPSI_L.eps"); c1->Print("Plots/JPSI_L.C"); } toto.plotstack("JPSI_L",2,1,"c#tau(J/#psi) (cm)","right"); toto._hdata->GetXaxis()->SetRangeUser(0,0.051); toto._hdata->GetYaxis()->SetRangeUser(0,30); c1->Modified(); TString header = "CMS preliminary, 19.8 fb^{-1}, #sqrt{s} = 8 TeV";; TLatex *latex = new TLatex(); latex->SetTextSize(0.05); latex->SetTextFont(62); latex->SetTextAlign(12); latex->SetTextColor(1); latex->DrawLatex(toto._hdata->GetXaxis()->GetXmin(),1.04*toto._hdata->GetMaximum(),header); TString textchannel; if (channel.Contains("mu") || channel.Contains("Mu")) textchannel = "#mu + Jets channel"; if (channel.Contains("el") || channel.Contains("El")) textchannel = "e + Jets channel"; TLatex *latex2 = new TLatex(); latex2->SetTextSize(0.05); latex2->SetTextFont(52); latex2->SetTextAlign(12); latex2->SetTextColor(1); latex2->DrawLatex(0.003,0.9*toto._hdata->GetMaximum(),textchannel); c1->Modified(); if (print) { c1->Print("Plots/JPSI_L_ZOOM.pdf"); c1->Print("Plots/JPSI_L_ZOOM.jpg"); c1->Print("Plots/JPSI_L_ZOOM.eps"); c1->Print("Plots/JPSI_L_ZOOM.C"); } toto.plotstack("JPSI_SIGMAL",100,1,"#Delta(c#tau)(J/#psi) (cm)","right"); toto._hdata->GetXaxis()->SetRangeUser(0,0.0051); toto._hdata->GetXaxis()->SetNdivisions(506); c1->Modified(); TString header = "CMS preliminary, 19.8 fb^{-1}, #sqrt{s} = 8 TeV"; TLatex *latex = new TLatex(); latex->SetTextSize(0.05); latex->SetTextFont(62); latex->SetTextAlign(12); latex->SetTextColor(1); latex->DrawLatex(toto._hdata->GetXaxis()->GetXmin(),1.04*toto._hdata->GetMaximum(),header); TString textchannel; if (channel.Contains("mu") || channel.Contains("Mu")) textchannel = "#mu + Jets channel"; if (channel.Contains("el") || channel.Contains("El")) textchannel = "e + Jets channel"; TLatex *latex2 = new TLatex(); latex2->SetTextSize(0.05); latex2->SetTextFont(52); latex2->SetTextAlign(12); latex2->SetTextColor(1); latex2->DrawLatex(0.0002,0.9*toto._hdata->GetMaximum(),textchannel); c1->Modified(); if (print) { c1->Print("Plots/JPSI_SIGMAL.pdf"); c1->Print("Plots/JPSI_SIGMAL.jpg"); c1->Print("Plots/JPSI_SIGMAL.eps"); c1->Print("Plots/JPSI_SIGMAL.C"); } toto.plotstack("JPSI_LOVERSIG",500,1,"(c#tau)/#Delta(c#tau)(J/#psi)","right"); c1->Modified(); TString header = "CMS preliminary, 19.8 fb^{-1}, #sqrt{s} = 8 TeV"; TLatex *latex = new TLatex(); latex->SetTextSize(0.05); latex->SetTextFont(62); latex->SetTextAlign(12); latex->SetTextColor(1); latex->DrawLatex(toto._hdata->GetXaxis()->GetXmin(),1.04*toto._hdata->GetMaximum(),header); TString textchannel; if (channel.Contains("mu") || channel.Contains("Mu")) textchannel = "#mu + Jets channel"; if (channel.Contains("el") || channel.Contains("El")) textchannel = "e + Jets channel"; TLatex *latex2 = new TLatex(); latex2->SetTextSize(0.05); latex2->SetTextFont(52); latex2->SetTextAlign(12); latex2->SetTextColor(1); latex2->DrawLatex(300.,0.9*toto._hdata->GetMaximum(),textchannel); c1->Modified(); if (print) { c1->Print("Plots/JPSI_LOVERSIG.pdf"); c1->Print("Plots/JPSI_LOVERSIG.jpg"); c1->Print("Plots/JPSI_LOVERSIG.eps"); c1->Print("Plots/JPSI_LOVERSIG.C"); } toto.plotstack("JPSI_CHI2",5,1,"#chi^{2}(J/#psi vertex)","right"); c1->Modified(); TString header = "CMS preliminary, 19.8 fb^{-1}, #sqrt{s} = 8 TeV"; TLatex *latex = new TLatex(); latex->SetTextSize(0.05); latex->SetTextFont(62); latex->SetTextAlign(12); latex->SetTextColor(1); latex->DrawLatex(toto._hdata->GetXaxis()->GetXmin(),1.04*toto._hdata->GetMaximum(),header); TString textchannel; if (channel.Contains("mu") || channel.Contains("Mu")) textchannel = "#mu + Jets channel"; if (channel.Contains("el") || channel.Contains("El")) textchannel = "e + Jets channel"; TLatex *latex2 = new TLatex(); latex2->SetTextSize(0.05); latex2->SetTextFont(52); latex2->SetTextAlign(12); latex2->SetTextColor(1); latex2->DrawLatex(1.,0.9*toto._hdata->GetMaximum(),textchannel); c1->Modified(); if (print) { c1->Print("Plots/JPSI_CHI2.pdf"); c1->Print("Plots/JPSI_CHI2.jpg"); c1->Print("Plots/JPSI_CHI2.eps"); c1->Print("Plots/JPSI_CHI2.C"); } toto.plotstack("DPHIJPSIJETMIN",1,1,"#Delta#phi (J/#psi-jet) min","right"); toto._hdata->GetXaxis()->SetRangeUser(0,0.58); c1->Modified(); TString header = "CMS preliminary, 19.8 fb^{-1}, #sqrt{s} = 8 TeV"; TLatex *latex = new TLatex(); latex->SetTextSize(0.05); latex->SetTextFont(62); latex->SetTextAlign(12); latex->SetTextColor(1); latex->DrawLatex(toto._hdata->GetXaxis()->GetXmin(),1.04*toto._hdata->GetMaximum(),header); TString textchannel; if (channel.Contains("mu") || channel.Contains("Mu")) textchannel = "#mu + Jets channel"; if (channel.Contains("el") || channel.Contains("El")) textchannel = "e + Jets channel"; TLatex *latex2 = new TLatex(); latex2->SetTextSize(0.05); latex2->SetTextFont(52); latex2->SetTextAlign(12); latex2->SetTextColor(1); latex2->DrawLatex(0.025,0.9*toto._hdata->GetMaximum(),textchannel); c1->Modified(); if (print) { c1->Print("Plots/DPHIJPSIJETMIN.pdf"); c1->Print("Plots/DPHIJPSIJETMIN.jpg"); c1->Print("Plots/DPHIJPSIJETMIN.eps"); c1->Print("Plots/DPHIJPSIJETMIN.C"); } toto.plotstack("DPHIJPSILEPTON",5,1,"#Delta#phi (J/#psi-isolated lepton)",""); toto._hdata->GetYaxis()->SetTitle("Events / 0.25"); toto._hdata->GetXaxis()->SetRangeUser(0,3.4); toto._hdata->GetYaxis()->SetRangeUser(0,55); c1->Modified(); TString header = "CMS preliminary, 19.8 fb^{-1}, #sqrt{s} = 8 TeV"; TLatex *latex = new TLatex(); latex->SetTextSize(0.05); latex->SetTextFont(62); latex->SetTextAlign(12); latex->SetTextColor(1); latex->DrawLatex(toto._hdata->GetXaxis()->GetXmin(),1.04*toto._hdata->GetMaximum(),header); TString textchannel; if (channel.Contains("mu") || channel.Contains("Mu")) textchannel = "#mu + Jets channel"; if (channel.Contains("el") || channel.Contains("El")) textchannel = "e + Jets channel"; TLatex *latex2 = new TLatex(); latex2->SetTextSize(0.05); latex2->SetTextFont(52); latex2->SetTextAlign(12); latex2->SetTextColor(1); latex2->DrawLatex(2.,0.9*toto._hdata->GetMaximum(),textchannel); c1->Modified(); if (print) { c1->Print("Plots/DPHIJPSILEPTON.pdf"); c1->Print("Plots/DPHIJPSILEPTON.jpg"); c1->Print("Plots/DPHIJPSILEPTON.eps"); c1->Print("Plots/DPHIJPSILEPTON.C"); } toto.plotstack("DRJPSIJETMIN",1,1,"#DeltaR (J/#psi - jet) min","right"); toto._hdata->GetYaxis()->SetTitle("Events / 0.25"); toto._hdata->GetXaxis()->SetRangeUser(0,0.98); c1->Modified(); TString header = "CMS preliminary, 19.8 fb^{-1}, #sqrt{s} = 8 TeV"; TLatex *latex = new TLatex(); latex->SetTextSize(0.05); latex->SetTextFont(62); latex->SetTextAlign(12); latex->SetTextColor(1); latex->DrawLatex(toto._hdata->GetXaxis()->GetXmin(),1.04*toto._hdata->GetMaximum(),header); TString textchannel; if (channel.Contains("mu") || channel.Contains("Mu")) textchannel = "#mu + Jets channel"; if (channel.Contains("el") || channel.Contains("El")) textchannel = "e + Jets channel"; TLatex *latex2 = new TLatex(); latex2->SetTextSize(0.05); latex2->SetTextFont(52); latex2->SetTextAlign(12); latex2->SetTextColor(1); latex2->DrawLatex(0.04,0.9*toto._hdata->GetMaximum(),textchannel); c1->Modified(); if (print) { c1->Print("Plots/DRJPSIJETMIN.pdf"); c1->Print("Plots/DRJPSIJETMIN.jpg"); c1->Print("Plots/DRJPSIJETMIN.eps"); c1->Print("Plots/DRJPSIJETMIN.C"); } if ( channel.Contains("mu") || channel.Contains("Mu") ) toto.plotstack("DRJPSILEPTON",5,1,"#DeltaR (J/#psi - isolated lepton)","right"); if ( channel.Contains("el") || channel.Contains("El") ) toto.plotstack("DRJPSILEPTON",5,1,"#DeltaR (J/#psi - isolated lepton)",""); toto._hdata->GetXaxis()->SetRangeUser(0,4.5); if (channel.Contains("mu") || channel.Contains("Mu")) toto._hdata->GetYaxis()->SetRangeUser(0.,70.); if (channel.Contains("el") || channel.Contains("El")) toto._hdata->GetYaxis()->SetRangeUser(0.,60.); c1->Modified(); TString header = "CMS preliminary, 19.8 fb^{-1}, #sqrt{s} = 8 TeV"; TLatex *latex = new TLatex(); latex->SetTextSize(0.05); latex->SetTextFont(62); latex->SetTextAlign(12); latex->SetTextColor(1); latex->DrawLatex(toto._hdata->GetXaxis()->GetXmin(),1.04*toto._hdata->GetMaximum(),header); TString textchannel; if (channel.Contains("mu") || channel.Contains("Mu")) textchannel = "#mu + Jets channel"; if (channel.Contains("el") || channel.Contains("El")) textchannel = "e + Jets channel"; TLatex *latex2 = new TLatex(); latex2->SetTextSize(0.05); latex2->SetTextFont(52); latex2->SetTextAlign(12); latex2->SetTextColor(1); if (channel.Contains("mu") || channel.Contains("Mu")) latex2->DrawLatex(0.2,0.9*toto._hdata->GetMaximum(),textchannel); if (channel.Contains("el") || channel.Contains("El")) latex2->DrawLatex(3.,0.9*toto._hdata->GetMaximum(),textchannel); c1->Modified(); if (print) { c1->Print("Plots/DRJPSILEPTON.pdf"); c1->Print("Plots/DRJPSILEPTON.jpg"); c1->Print("Plots/DRJPSILEPTON.eps"); c1->Print("Plots/DRJPSILEPTON.C"); } toto.plotstack("TOP_M_RECO_ALL",10,1,"M_{J/#psi+l} (GeV/c^{2})","right"); if (channel.Contains("mu") || channel.Contains("Mu")) toto._hdata->GetYaxis()->SetRangeUser(0.,50.); if (channel.Contains("el") || channel.Contains("El")) toto._hdata->GetYaxis()->SetRangeUser(0,40); TString header = "CMS preliminary, 19.8 fb^{-1}, #sqrt{s} = 8 TeV"; TLatex *latex = new TLatex(); latex->SetTextSize(0.05); latex->SetTextFont(62); latex->SetTextAlign(12); latex->SetTextColor(1); latex->DrawLatex(toto._hdata->GetXaxis()->GetXmin(),1.04*toto._hdata->GetMaximum(),header); TString textchannel; if (channel.Contains("mu") || channel.Contains("Mu")) textchannel = "#mu + Jets channel"; if (channel.Contains("el") || channel.Contains("El")) textchannel = "e + Jets channel"; TLatex *latex2 = new TLatex(); latex2->SetTextSize(0.05); latex2->SetTextFont(52); latex2->SetTextAlign(12); latex2->SetTextColor(1); latex2->DrawLatex(10,0.9*toto._hdata->GetMaximum(),textchannel); c1->Modified(); if (print) { c1->Print("Plots/TOP_M.pdf"); c1->Print("Plots/TOP_M.jpg"); c1->Print("Plots/TOP_M.eps"); c1->Print("Plots/TOP_M.C"); } toto.plotstackratio("TOP_M_RECO_ALL",10,1,"M_{J/#psi+l} (GeV/c^{2})","right"); if (print) { c1->Print("Plots/TOP_M_ratio.pdf"); c1->Print("Plots/TOP_M_ratio.jpg"); c1->Print("Plots/TOP_M_ratio.eps"); c1->Print("Plots/TOP_M_ratio.C"); } toto.plotstack("MET_MET",10,1,"MET (GeV)","right"); toto._hdata->GetXaxis()->SetRangeUser(0,345); toto._hdata->GetYaxis()->SetRangeUser(0,50); c1->Modified(); TString header = "CMS preliminary, 19.8 fb^{-1}, #sqrt{s} = 8 TeV"; TLatex *latex = new TLatex(); latex->SetTextSize(0.05); latex->SetTextFont(62); latex->SetTextAlign(12); latex->SetTextColor(1); latex->DrawLatex(toto._hdata->GetXaxis()->GetXmin(),1.04*toto._hdata->GetMaximum(),header); TString textchannel; if (channel.Contains("mu") || channel.Contains("Mu")) textchannel = "#mu + Jets channel"; if (channel.Contains("el") || channel.Contains("El")) textchannel = "e + Jets channel"; TLatex *latex2 = new TLatex(); latex2->SetTextSize(0.05); latex2->SetTextFont(52); latex2->SetTextAlign(12); latex2->SetTextColor(1); latex2->DrawLatex(15,0.9*toto._hdata->GetMaximum(),textchannel); c1->Modified(); if (print) { c1->Print("Plots/MET_MET.pdf"); c1->Print("Plots/MET_MET.jpg"); c1->Print("Plots/MET_MET.eps"); c1->Print("Plots/MET_MET.C"); } toto.plotstack("JPSIJET_FRAC",10,1,"p_{T}(J/#psi)/p_{T}(nearest jet)","right"); toto._hdata->GetYaxis()->SetRangeUser(0,35); if (channel.Contains("mu") || channel.Contains("Mu")) toto._hdata->GetYaxis()->SetRangeUser(0.,45.); c1->Modified(); TString header = "CMS preliminary, 19.8 fb^{-1}, #sqrt{s} = 8 TeV"; TLatex *latex = new TLatex(); latex->SetTextSize(0.05); latex->SetTextFont(62); latex->SetTextAlign(12); latex->SetTextColor(1); latex->DrawLatex(toto._hdata->GetXaxis()->GetXmin(),1.04*toto._hdata->GetMaximum(),header); TString textchannel; if (channel.Contains("mu") || channel.Contains("Mu")) textchannel = "#mu + Jets channel"; if (channel.Contains("el") || channel.Contains("El")) textchannel = "e + Jets channel"; TLatex *latex2 = new TLatex(); latex2->SetTextSize(0.05); latex2->SetTextFont(52); latex2->SetTextAlign(12); latex2->SetTextColor(1); latex2->DrawLatex(0.04,0.9*toto._hdata->GetMaximum(),textchannel); c1->Modified(); if (print) { c1->Print("Plots/JPSIJET_FRAC.pdf"); c1->Print("Plots/JPSIJET_FRAC.jpg"); c1->Print("Plots/JPSIJET_FRAC.eps"); c1->Print("Plots/JPSIJET_FRAC.C"); } toto.plotstack("VERTEX_N",2,1,"Number of vertices","right"); toto._hdata->GetXaxis()->SetRangeUser(0,39); if (channel.Contains("mu") || channel.Contains("Mu")) toto._hdata->GetYaxis()->SetRangeUser(0.,50.); if (channel.Contains("el") || channel.Contains("El")) toto._hdata->GetYaxis()->SetRangeUser(0,45); c1->Modified(); TString header = "CMS preliminary, 19.8 fb^{-1}, #sqrt{s} = 8 TeV"; TLatex *latex = new TLatex(); latex->SetTextSize(0.05); latex->SetTextFont(62); latex->SetTextAlign(12); latex->SetTextColor(1); latex->DrawLatex(toto._hdata->GetXaxis()->GetXmin(),1.04*toto._hdata->GetMaximum(),header); TString textchannel; if (channel.Contains("mu") || channel.Contains("Mu")) textchannel = "#mu + Jets channel"; if (channel.Contains("el") || channel.Contains("El")) textchannel = "e + Jets channel"; TLatex *latex2 = new TLatex(); latex2->SetTextSize(0.05); latex2->SetTextFont(52); latex2->SetTextAlign(12); latex2->SetTextColor(1); latex2->DrawLatex(2,0.9*toto._hdata->GetMaximum(),textchannel); c1->Modified(); if (print) { c1->Print("Plots/VERTEX_N.pdf"); c1->Print("Plots/VERTEX_N.jpg"); c1->Print("Plots/VERTEX_N.eps"); c1->Print("Plots/VERTEX_N.C"); } toto.plotstack("TOPHAD_MASS",20,1,"M_{bjj} (GeV/c^{2})","right"); TString header = "CMS preliminary, 19.8 fb^{-1}, #sqrt{s} = 8 TeV"; TLatex *latex = new TLatex(); latex->SetTextSize(0.05); latex->SetTextFont(62); latex->SetTextAlign(12); latex->SetTextColor(1); latex->DrawLatex(toto._hdata->GetXaxis()->GetXmin(),1.04*toto._hdata->GetMaximum(),header); TString textchannel; if (channel.Contains("mu") || channel.Contains("Mu")) textchannel = "#mu + Jets channel"; if (channel.Contains("el") || channel.Contains("El")) textchannel = "e + Jets channel"; TLatex *latex2 = new TLatex(); latex2->SetTextSize(0.05); latex2->SetTextFont(52); latex2->SetTextAlign(12); latex2->SetTextColor(1); latex2->DrawLatex(20.,0.9*toto._hdata->GetMaximum(),textchannel); c1->Modified(); if (print) { c1->Print("Plots/TOPHAD_MASS.pdf"); c1->Print("Plots/TOPHAD_MASS.jpg"); c1->Print("Plots/TOPHAD_MASS.eps"); c1->Print("Plots/TOPHAD_MASS.C"); } }
int main(int argc, char * argv[]) { // Read Table filename if (argc > 0) { ChemTableFilename = argv[1]; } time_t start0; time(&start0); PressureTable NewTable; NewTable.Load(ChemTableFilename); NewTable.print(); int nPress = NewTable.GetDimension1(); int nZm = NewTable.GetDimension2(); int nZv = NewTable.GetDimension3(); int nC = NewTable.GetDimension4(); // Check Pressure array //double *myP = new double[nPress]; //NewTable.CopyCoordinate1(myP); //for(int i=0; i<nPress; ++i) cout << myP[i] << " "; //cout << endl; //ChemtableCartesianLinear_single ChemTableFPVA; //ChemTableFPVA.Load("RUN_P2.9000e05/database"); double Zm = 0.2; double Zvar = 0.1; double C = 0.233; cout << "Interpolating T0" << endl; //cout << NewTable.Lookup(2.9e5, Zm, Zvar, C, "T0")<< endl; // Get Interpolation Index used previously InterpolationIndex toto(4,2); //NewTable.GetInterpolation(toto); //toto.print(); // Copy toto to tata and add one to Prog dimension InterpolationIndex tata(4,2); //toto.copy(tata); //tata.index[3] += 1; //tata.print(); //NewTable.SetInterpolation(tata); //double temp = NewTable.Lookup("T0"); //cout << "ic + 1 : " << temp <<endl; /* // -------------------------- // Test change of interpolation mode // -------------------------- time_t start, end; time(&start); for (int i=0; i< 1e6 ; ++i) { C = ( double (rand()) )/( double (RAND_MAX) ); //cout << "C = " << C << endl; Zm = ( double (rand()) )/( double (RAND_MAX) ); //cout << "Z = " << Zm << endl; Zvar = ( double (rand()) )/( double (RAND_MAX) ); //cout << "Zvar = " << Zvar << endl; NewTable.InterpolatePoint_old(2.9e5,Zm, Zvar,C); NewTable.GetInterpolation(toto); //toto.print(); NewTable.InterpolatePoint(2.9e5,Zm, Zvar,C); NewTable.GetInterpolation(tata); //tata.print(); if (!toto.compare(tata)) { cout << "OLD and NEW disagree" << endl; throw(-1); } } time(&end); cout << difftime(end, start) << " seconds have passed in test 0" << endl; // Time for old interp only time(&start); for (int i=0; i< 4e7 ; ++i) { C = ( double (rand()) )/( double (RAND_MAX) ); Zm = ( double (rand()) )/( double (RAND_MAX) ); Zvar = ( double (rand()) )/( double (RAND_MAX) ); NewTable.InterpolatePoint_old(2.9e5,Zm, Zvar,C); } time(&end); cout << difftime(end, start) << " seconds have passed in test 1" << endl; // Time for new interp only time(&start); for (int i=0; i< 4e7 ; ++i) { C = ( double (rand()) )/( double (RAND_MAX) ); Zm = ( double (rand()) )/( double (RAND_MAX) ); Zvar = ( double (rand()) )/( double (RAND_MAX) ); NewTable.InterpolatePoint(2.9e5,Zm, Zvar,C); } time(&end); cout << difftime(end, start) << " seconds have passed in test 2" << endl; cout << difftime(end, start0) << " seconds have passed in total" << endl; */ /* // -------------------------- // Test Newton/Broyden ierations to compute C,P // -------------------------- // Here is the solution I want to retrieve C = 0.0; double P = 0.879425145e5; Zm = 0.000621758; double Sz = 0.068987; // normalized // What are the corresponding rho, rhoZ, rhoZv, RhoYc //double rho = NewTable.Lookup(P, Zm, Sz, C,"rho0"); //double rho = NewTable.Lookup(P, Zm, Sz, 1.0,"rho0"); double rho = 0.612164; //double Zv = Sz*Zm*(1.0-Zm); // non-normalized double Zv = 0.00220893; //double Yc = NewTable.Lookup(P, Zm, Sz, C,"PROG"); //double Yc_eq = NewTable.Lookup(P,Zm,Sz,1.0,"PROG"); //double Yc = C*Yc_eq; double Yc = 0.00501301; cout << "Inputs :" << endl; cout << " - rho : " << rho << endl; cout << " - Z : " << Zm << endl; cout << " - Sz : " << Sz << endl; cout << " - Yc : " << Yc << endl; cout << endl; // Initial guess: double C_ini = 0.5; double P_ini = 1.0e5; // Call Newton/Broyden method double Sz_out, C_out, P_out; NewTable.ComputeDatabaseInputs(rho, Zm, Zv, Yc, P_out, Sz_out, C_out, P_ini, C_ini); // Ouput: cout << "Solution :" << endl; cout << " - P : " << P_out << " vs " << P << endl; cout << " - Z : " << Zm << endl; cout << " - Sz : " << Sz_out << " vs " << Sz << endl; cout << " - C : " << C_out << " vs " << C << endl; cout << endl; double rho_test = NewTable.Lookup(P_out, Zm, Sz_out, C_out,"rho0"); double Yc_test = C_out*NewTable.Lookup(P,Zm,Sz,1.0,"PROG"); cout << "Outputs :" << endl; cout << " - rho : " << rho_test << endl; cout << " - Yc : " << Yc_test << endl; cout << endl; double P_scale = PressureTable::GetPscale(); cout << "L2 error : " << sqrt( (P-P_out)/P_scale*(P-P_out)/P_scale + (Sz-Sz_out)*(Sz-Sz_out) + (C-C_out)*(C-C_out) ) << endl; */ // -------------------------- // Compare Pressure scaling // -------------------------- ofstream tecplotfile; tecplotfile.open("Compare_pressure_fixed_Z_SZ.dat"); tecplotfile << "VARIABLES = Pressure HR HR_approx P_scaled HR_scaled HR_approx_scaled" << " SRC SRC_approx SRC_scaled SRC_appprox_scaled" << endl; Zm = 0.03; Zvar = 0.0; //C = 0.5; double press0 = 1.5e5; int nP = 20; double HR0, HR, HR_approx; double SRC0, SRC, SRC_approx; int nzone = 10; for (int izone = 0; izone < nzone ; ++izone) { C = ((double) izone)/((double) nzone - 1.0); tecplotfile << "ZONE T=\"C=" << C << "\", I=" << nP << endl; HR0 = NewTable.Lookup(press0, Zm, Zvar, C,"HeatRelease"); SRC0 = NewTable.Lookup(press0, Zm, Zvar, C,"SRC_PROG"); double rho0 = NewTable.Lookup(press0, Zm, Zvar, C,"rho0"); for (int i=0; i<nP; ++i) { double press = 5.0e4 + (5.0e5-5.0e4)*((double) i)/((double) nP - 1.0); HR = NewTable.Lookup(press, Zm, Zvar, C,"HeatRelease"); double rho = NewTable.Lookup(press, Zm, Zvar, C,"rho0"); HR_approx = pow(press/press0,2.0)*HR0; SRC = NewTable.Lookup(press, Zm, Zvar, C,"SRC_PROG"); SRC_approx = pow(press/press0,2.0)*SRC0; tecplotfile << press << " " << rho*HR << " " << rho*HR_approx << " " << press/press0 << " " << rho*HR/(rho0*HR0) << " " << pow(press/press0,2.0) << " " << SRC << " " << rho*SRC_approx << " " << rho*SRC/(rho0*SRC0) << " " << pow(press/press0,2.0) << endl; } } tecplotfile.close(); // tecplotfile.open("Compare_pressure_fixed_C_SZ.dat"); tecplotfile << "VARIABLES = Pressure HR HR_approx P_scaled HR_scaled HR_approx_scaled" << " SRC SRC_approx SRC_scaled SRC_appprox_scaled" << endl; Zvar = 0.0; C = 0.5; nzone = 30; for (int izone = 1; izone < nzone-1 ; ++izone) { Zm = ((double) izone)/((double) nzone - 1.0); tecplotfile << "ZONE T=\"Zm=" << Zm << "\", I=" << nP << endl; HR0 = NewTable.Lookup(press0, Zm, Zvar, C,"HeatRelease"); SRC0 = NewTable.Lookup(press0, Zm, Zvar, C,"SRC_PROG"); double rho0 = NewTable.Lookup(press0, Zm, Zvar, C,"rho0"); for (int i=0; i<nP; ++i) { double press = 5.0e4 + (5.0e5-5.0e4)*((double) i)/((double) nP - 1.0); HR = NewTable.Lookup(press, Zm, Zvar, C,"HeatRelease"); double rho = NewTable.Lookup(press, Zm, Zvar, C,"rho0"); HR_approx = pow(press/press0,2.0)*HR0; SRC = NewTable.Lookup(press, Zm, Zvar, C,"SRC_PROG"); SRC_approx = pow(press/press0,2.0)*SRC0; tecplotfile << press << " " << rho*HR << " " << rho*HR_approx << " " << press/press0 << " " << rho*HR/(rho0*HR0) << " " << pow(press/press0,2.0) << " " << SRC << " " << rho*SRC_approx << " " << rho*SRC/(rho0*SRC0) << " " << pow(press/press0,2.0) << endl; } } tecplotfile.close(); // Compare Yceq at different pressure ofstream Yceqfile; Yceqfile.open("Yceq.dat"); Yceqfile << "VARIABLES = Z Yceq T" << endl; for (int i=0; i<nPress; ++i) { double myP = NewTable.GetCoordinate1(i); Yceqfile << "Zone T = \"P=" << myP << "\", I =" << nZm << endl; for (int j=0; j<nZm; ++j) { double myZ = NewTable.GetCoordinate2(j); Yceqfile << myZ << " " << NewTable.Lookup(myP, myZ, 0.0, 1.0, "PROG") << " " << NewTable.Lookup(myP, myZ, 0.0, 1.0, "T0") << endl; } } Yceqfile.close(); // Compare Yceq at different Zvar Yceqfile.open("Yceq_Sz.dat"); Yceqfile << "VARIABLES = Z Yceq T" << endl; double myP = NewTable.GetCoordinate1(nPress); for (int i=0; i<nZv; ++i) { double mySz = NewTable.GetCoordinate3(i); Yceqfile << "Zone T = \"Sz=" << mySz << "\", I =" << nZm << endl; for (int j=0; j<nZm; ++j) { double myZ = NewTable.GetCoordinate2(j); Yceqfile << myZ << " " << NewTable.Lookup(myP, myZ, mySz, 1.0, "PROG") << " " << NewTable.Lookup(myP, myZ, mySz, 1.0, "T0") << endl; } } Yceqfile.close(); // Plot surfaces rho_min, rho_max (Zvar = 0.0) ofstream rhofile; rhofile.open("Rho_min_max.dat"); rhofile << "VARIABLES = z c rho_min rho_max" << endl; rhofile << "ZONE I=" << nZm << " ,J=" << nC << " F=POINT" << endl; double myC, myZ, rho; double rho_min, rho_max; for (int i=0; i<nC; ++i) { myC = NewTable.GetCoordinate4(i); for (int j=0; j<nZm; ++j) { myZ = NewTable.GetCoordinate2(j); rho_min = 1.e6; rho_max = -1.0; for (int k=0; k<nPress; ++k) { double P = NewTable.GetCoordinate1(k); double r = NewTable.Lookup(P, myZ, 0.0, myC, "ROM"); double temp = NewTable.Lookup(P, myZ, 0.0, myC, "T0"); rho = P/r/temp; rho_min = min(rho_min,rho); rho_max = max(rho_max,rho); } rhofile << myZ << " " << myC << " " << rho_min << " " << rho_max << endl; } } rhofile.close(); // Pressure scaling oh max OH ofstream ohfile; ohfile.open("max_Yoh.dat"); ohfile << "VARIABLES = pressure YOH_max omega_max" << endl; double myZv; double oh_max, omega_max; for (int i=0; i<nPress; ++i) { myP = NewTable.GetCoordinate1(i); oh_max = -1.0; omega_max = -1.0; for (int j=0; j<nZm; ++j) { myZ = NewTable.GetCoordinate2(j); for (int k=0; k<nZv; ++k) { myZv = NewTable.GetCoordinate3(k); //for (int l=0; l<nC; ++l) { //myC = NewTable.GetCoordinate4(l); myC = 0.7; oh_max = max(oh_max,NewTable.Lookup(myP, myZ, myZv, myC,"OH")); omega_max = max(omega_max, NewTable.Lookup(myP, myZ, myZv, myC,"SRC_PROG")); //} } } ohfile << myP << " " << oh_max << " " << omega_max << endl; } ohfile.close(); // Compare YOH at different pressure ofstream YOHfile; YOHfile.open("Maps_ZC_P.dat"); YOHfile << "VARIABLES = Z C YOH HR rhoHR YH2O T YH2" << endl; for (int i=0; i<nPress; ++i) { double myP = NewTable.GetCoordinate1(i); YOHfile << "Zone T = \"P=" << myP << "\", I =" << nZm << " ,J=" << nC << " F=POINT" << endl; for (int k=0; k<nC; ++k) { double myC = NewTable.GetCoordinate4(k); for (int j=0; j<nZm; ++j) { double myZ = NewTable.GetCoordinate2(j); HR0 = NewTable.Lookup(myP, myZ, 0.0, myC,"HeatRelease"); double rho = NewTable.Lookup(myP, myZ, 0.0, myC,"rho0"); YOHfile << myZ << " " << myC << " " << NewTable.Lookup(myP, myZ, 0.0, myC, "OH") << HR0 << rho*HR0 << NewTable.Lookup(myP, myZ, 0.0, myC, "H2O") << NewTable.Lookup(myP, myZ, 0.0, myC, "T0") << NewTable.Lookup(myP, myZ, 0.0, myC, "H2") << endl; } } } YOHfile.close(); return 0; }
int toto(int a){ int b; b = toto( a) ; return a + 1 ; }