void renderScene() { // Set color and depth clear value glClearDepth(1.f); glClearColor(0.4f, 0.4f, 0.4f, 0.4f); // Enable Z-buffer read and write glEnable(GL_DEPTH_TEST); glDepthMask(GL_TRUE); // Clear color and depth buffer glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); //variables for 3D render shader if(GL20Support) glUseProgram(shaderProg); else glUseProgramObjectARB(shaderProg); setShaderVariables(shaderProg); //Draw everything /*glPushMatrix(); setShaderVariables(shaderProg); drawExampleCube(); glPopMatrix();*/ drawShapes(); //Draw the UI (does not use lighting) if(GL20Support) glUseProgram(noLightProg); else glUseProgramObjectARB(noLightProg); setShaderVariables(noLightProg); draw_xy_grid(20,20,1.0,1.0); glPushMatrix(); glLoadIdentity(); glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadIdentity(); gluOrtho2D(0.0,currentRes[0],0.0,currentRes[1]); setShaderVariables(noLightProg); drawButtons(); glPopMatrix(); glMatrixMode(GL_MODELVIEW); glPopMatrix(); //copy buffer to texture /*glBindTexture(GL_TEXTURE_2D,textureTarget); glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, currentRes[0], currentRes[1], 0); texRender.useProgram(); //variables for texture shader //texture unit id is handled in ShowTexture setShaderVariables(texRender.getProgram()); //sets up a few shader variables and draws the texture on a full view quad texRender.render(textureTarget, currentRes, currentRes);*/ }
void display(void) { glClear(GL_COLOR_BUFFER_BIT); drawShapes(); if (gHelpMenu) drawHelpText(gWidth / 9, gHeight / 5); drawDirectionIndicator(); glutSwapBuffers(); // double buffer }
// This callback function gets called by the Glut // system whenever it decides things need to be redrawn. void display(void) { glClear(GL_COLOR_BUFFER_BIT); glColor3d(0,0,1); drawButtons(); drawShapes(); drawFeedback(); glutSwapBuffers(); }
int main(){ Shape* shapes[4]; shapes[0]=(Shape*)new Circle; shapes[0]->type_=Shape::circle; shapes[1]=(Shape*)new Square; shapes[1]->type_=Shape::square; shapes[2]=(Shape*)new Square; shapes[2]->type_=Shape::square; shapes[3]=(Shape*)new Circle; shapes[3]->type_=Shape::circle; drawShapes(shapes, 4); }
void showInterpolation (TGraph ** tg_sample_par, TString sample, int Npar) { TCanvas * c_merge = new TCanvas () ; bkg = (TH1F *) c_merge->DrawFrame (200, 0.0000001, 1500, 0.002) ; // c_merge->SetLogy () ; bkg->GetXaxis ()->SetTitle ("m_{WW}") ; bkg->GetYaxis ()->SetTitle ("signal") ; drawShapes (tg_sample_par, Npar) ; // c_merge->Print (TString ("interpol_log_") + sample + TString (".pdf"), "pdf") ; // c_merge->SetLogy (0) ; c_merge->Print (TString ("interpol_lin_") + sample + TString (".pdf"), "pdf") ; return ; }
// This callback function gets called by the Glut // system whenever it decides things need to be redrawn. void display(void) { glClear(GL_COLOR_BUFFER_BIT); // Test lines that draw all three shapes and some text. // Delete these when you get your code working. drawShapes(); drawPoints(); drawButtons(); drawSliders(); glColor3d(1, 1, 1); drawText(300, 10, "CS-3005 - Illustrator"); glutSwapBuffers(); }
int OC_main_fun () { void drawShapes (Shape shapes[], int count); Shape shapes[3]; ShapeRect rect0 = {0, 0, 10, 30}; shapes[0].type = kCircle; shapes[0].fillColor = kRedColor; shapes[0].bounds = rect0; ShapeRect rect1 = {30, 40 ,50, 60}; shapes[1].type = kRectangle; shapes[1].fillColor = kGreenColor; shapes[1].bounds = rect1; ShapeRect rect2 = {15, 18, 37, 29}; shapes[2].type = kEgg; shapes[2].fillColor = kBlueColor; shapes[2].bounds = rect2; drawShapes(shapes, 3); return 0; }
void Display(){ glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); //View1 LEFT ///////////////////////////// //Set the viewport and projection matrix. glViewport(0,0,windowWidth,windowHeight); //Set the viewport glMatrixMode(GL_PROJECTION); //Set projection matrix. glLoadIdentity(); //Reset projection matrix. glOrtho(-1, 1, -1, 1, 0.0001f, 1000); //Orthographic projection. //Change to modelview in order to draw. glMatrixMode(GL_MODELVIEW); //Set modelview matrix. glLoadIdentity(); //Reset modelview matrix. //Set rendering parameters if needed. glPolygonMode(GL_FRONT_AND_BACK,GL_FILL); //Set polygon render mode. //Set camera. gluLookAt(0, 0, -10, 0, 0, 0, 0, 1, 0); //Draw stuff. // view1.drawSquare(); //TEXTURING ///////////////// glEnable(GL_TEXTURE_2D); //LOAD TEXTURE FROM FILE img_data.loadFromFile("images/box.bmp"); //Generate OpenGL texture object glGenTextures(1, &texture_handle); //Binds texture (this texture will be mapped to polygons) glBindTexture(GL_TEXTURE_2D, texture_handle); // Upload data to GPU glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, img_data.getSize().x, img_data.getSize().y, 0, GL_RGBA, GL_UNSIGNED_BYTE, img_data.getPixelsPtr() ); // some texture parameters glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); // glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); // glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); if (currentState == MAIN) { view1.drawSquare(); } //View 2 RIGHT //Set the viewport and projection matrix. glViewport(0, 0, windowWidth, windowHeight);//viewport size glMatrixMode(GL_PROJECTION); //Set projection matrix. glLoadIdentity(); //Reset projection matrix. gluPerspective(60, 1, 0.1f, 1000); //Perspective //Change to modelview in order to draw. glMatrixMode(GL_MODELVIEW); //Set modelview matrix. glLoadIdentity(); //Reset modelview matrix. //Set rendering parameters if needed. glPolygonMode(GL_FRONT_AND_BACK,GL_FILL); //Set polygon render mode. //Set camera. gluLookAt(view2.eye.x, view2.eye.y, view2.eye.z, view2.tar.x+view2.eye.x, view2.tar.y+view2.eye.y, view2.tar.z, 0, 1, 0); //Draw stuff. if (currentState == GAME) { Test.drawBox(-24,22,0,0.4); drawShapes(); } }
void ShapesExperiment::processInteractiveEvaluation(int _genNumber) { vector <int> fitnessScores; writeAndTeeUpParentsOrderFile(); //if the command line is telling us which orgs to select, handle that and return (skip the rest of the function) if(int(NEAT::Globals::getSingleton()->getParameterValue("NeedToInjectFitnessValuesFromCommandLine"))) { NEAT::Globals::getSingleton()->setParameterValue("NeedToInjectFitnessValuesFromCommandLine", 0.0); //set flag so we don't enter this condition the next time around if(int(NEAT::Globals::getSingleton()->getParameterValue("SeedingSoDecrementByOne"))) firstGenSeedingSoDontPrintParentsFile = true; //initialize default (non-selected) fitness values for(int z=0;z< group.size();z++) { fitnessScores.push_back(1); } if(int(NEAT::Globals::getSingleton()->getParameterValue("StartVfFileIndexesAtOne"))) { firstGen = false; //don't make the gen num zero if branching } //get vector that lists the orgs we need to mark as selected (variable sized) vector <int> listOfOrgsInjectedAsSelected = NEAT::Globals::getSingleton()->getInjectOrgsSelected(); if (!listOfOrgsInjectedAsSelected.size()>=1) { cout << "You must provide a list of orgs to mark as selected with the -F flag" << endl; } //mark those orgs as selected for(int z=0;z<listOfOrgsInjectedAsSelected.size();z++) { PRINT(listOfOrgsInjectedAsSelected[z]); fitnessScores[(listOfOrgsInjectedAsSelected[z])] = 1000; } cout << "result of command line arguments being used to make initial selection" << endl; for(int z=0;z< group.size();z++) { PRINT(fitnessScores[z]); shared_ptr<NEAT::GeneticIndividual> individual = group[z]; if (fitnessScores[z]> 5) individual->reward(fitnessScores[z]); //if picked by user (either as champ or tie-for-second, use those scores else individual->reward(1); } return; } // writeAndTeeUpParentsOrderFile(); //delme if you moved this up above the one-time for inserted fitness and like it...this was it's original position viewThresh = 100000; //how long the user has to input their champ vector <CMesh> meshesToDraw; NEAT::FastNetwork <double> network; //initializes continuous space array with zeros. +1 is because we need to sample // these points at all corners of each voxel, leading to n+1 points in any dimension CArray3Df ContinuousArray(num_x_voxels, num_y_voxels, num_z_voxels); //evolved array CArray3Df rColorArray(num_x_voxels, num_y_voxels, num_z_voxels); //evolved array of red color for each voxel CArray3Df gColorArray(num_x_voxels, num_y_voxels, num_z_voxels); //evolved array of green color for each voxel CArray3Df bColorArray(num_x_voxels, num_y_voxels, num_z_voxels); //evolved array of blue color for each voxel int px, py, pz; //temporary variable to store locations as we iterate float xNormalized; float yNormalized; float zNormalized; float distanceFromCenter = 0.0; float distanceFromCenterXY = 0.0; float distanceFromCenterYZ = 0.0; float distanceFromCenterXZ = 0.0; float arcTan2Val = 0.0; float distanceFromShell = 0.0; float insideOutside = 0.0; int ai; float e; //START HACK v.2 string line; ifstream file("/home/achen/csv/pure.csv"); //FILE NAME float store2 [2000]; int i= 0; while (getline(file,line)){ store2[i]= atof(line.c_str()); i++; } file.close(); i= 0; int voxelCount=0; shared_ptr<NEAT::GeneticIndividual> individual; for(int z=0;z< group.size();z++) { cout << "generating shape: " << z << endl; individual = group[z]; network = individual->spawnFastPhenotypeStack<double>(); //JMC: this is the CPPN network voxelCount=0; cout << "JMC INTERACTIVE HACKING" << endl; for (int j=0; j<ContinuousArray.GetFullSize(); j++) //iterate through each location of the continuous matrix { ContinuousArray.GetXYZ(&px, &py, &pz, j); //gets XYZ location of this element in the array xNormalized = mapXYvalToNormalizedGridCoord(px, num_x_voxels); yNormalized = mapXYvalToNormalizedGridCoord(py, num_y_voxels); zNormalized = mapXYvalToNormalizedGridCoord(pz, num_z_voxels); cout << px << endl; //ACHEN: Will change variable name... e= store2[i]; i++; //ACHEN: LOGGING POSITIONS //cout << "(" << xNormalized << "," << yNormalized << "," << zNormalized << ")" << endl; //calculate input vars if(addDistanceFromCenter) distanceFromCenter = sqrt(pow(double(xNormalized),2.0)+pow(double(yNormalized),2.0)+pow(double(zNormalized),2.0)); if(addDistanceFromCenterXY) distanceFromCenterXY = sqrt(pow(double(xNormalized),2.0)+pow(double(yNormalized),2.0)); if(addDistanceFromCenterYZ) distanceFromCenterYZ = sqrt(pow(double(yNormalized),2.0)+pow(double(zNormalized),2.0)); if(addDistanceFromCenterXZ) distanceFromCenterXZ = sqrt(pow(double(xNormalized),2.0)+pow(double(zNormalized),2.0)); if(addArcTan2) arcTan2Val = atan2(yNormalized, zNormalized); network.reinitialize(); //reset CPPN //next three lines are zeroed out for shell debugging //cout << "JMC HACKING VALUES TO ZERO" << endl; //network.setValue("x",0); //set the input numbers //network.setValue("y",0); //network.setValue("z",0); //network.setValue("x",xNormalized); //set the input numbers //network.setValue("y",yNormalized); //network.setValue("z",zNormalized); if(addDistanceFromShell) network.setValue("ds",e); //ACHEN: Shell distance if(addDistanceFromCenter) network.setValue("d",distanceFromCenter); if(addDistanceFromCenterXY) network.setValue("dxy",distanceFromCenterXY); if(addDistanceFromCenterYZ) network.setValue("dyz",distanceFromCenterYZ); if(addDistanceFromCenterXZ) network.setValue("dxz",distanceFromCenterXZ); if(addArcTan2) network.setValue("arcTan2",arcTan2Val); //network.setValue("Bias",0.3); network.update(); //JMC: on this line we run the CPPN network... ContinuousArray[j] = network.getValue("Output"); //JMC: and here we get the CPPN output (which is the weight of the connection between the two) //hack directly into array @# //ContinuousArray[j] = e; //cout << "e: " << e << " i " << i ; if(useColor){ rColorArray[j] = (1 + network.getValue("Output-colorR"))/2.0; gColorArray[j] = (1 + network.getValue("Output-colorG"))/2.0; bColorArray[j] = (1 + network.getValue("Output-colorB"))/2.0; } // PRINT(rColorArray[j]); if (ContinuousArray[j]>voxelExistsThreshold) voxelCount++; } i=0; std::cout << "Performing marching cubes...\n"; CMesh OutputMesh; CMarchCube::SingleMaterialMultiColor(&OutputMesh, &ContinuousArray, &rColorArray, &gColorArray, &bColorArray, voxelExistsThreshold, VoxelSize*1000); //jmc: last argument is the threshold above which we consider the voxel to be extant meshesToDraw.push_back(OutputMesh); } cout << "drawing shapes" << endl; fitnessScores = drawShapes(meshesToDraw, _genNumber); cout << "fitness values used when not getting list of selected orgs from command line" << endl; for(int z=0;z< group.size();z++) { PRINT(fitnessScores[z]); shared_ptr<NEAT::GeneticIndividual> individual = group[z]; if (fitnessScores[z]> 5) individual->reward(fitnessScores[z]); //if picked by user (either as champ or tie-for-second, use those scores else { individual->reward(1); } } }
void LaserManager::draw() { if(testPattern==1) { //addLaserRectEased(pmin, pmax, white); //addLaserLineEased(maskRectangle.getTopLeft(), maskRectangle.getBottomRight(), white); //addLaserLineEased(maskRectangle.getTopRight(), maskRectangle.getBottomLeft(), white); ofPoint v = maskRectangle.getBottomRight() - maskRectangle.getTopLeft(); for(float x =0 ; x<=1; x+=0.2) { for(float y = 0; y<=1; y+=0.2) { //addLaserDot(ofPoint(maskRectangle.x + (v.x*x), maskRectangle.y + (v.y*y)), white, 1); if(x ==0) { addLaserLineEased(ofPoint(maskRectangle.getLeft(), maskRectangle.getTop()+v.y*y),ofPoint(maskRectangle.getRight(), maskRectangle.getTop()+v.y*y), ofColor::white ); } } addLaserLineEased(ofPoint(maskRectangle.x + v.x*x, maskRectangle.getTop()),ofPoint(maskRectangle.x + v.x*x, maskRectangle.getBottom()), ofColor::red ); } addLaserCircle(maskRectangle.getCenter(), white, 10); addLaserCircle(maskRectangle.getCenter(), ofFloatColor(1,0,0), 50); /* addLaserDot(pmin, white, 1); addLaserDot(ofPoint(pmax.x, pmin.y), white, 1); addLaserDot(pmax, white, 1); addLaserDot(ofPoint(pmin.x, pmax.y), white, 1); */ } else if((testPattern>=2) && (testPattern<=5)) { ofColor c; ofRectangle rect(appWidth*0.3, appHeight*0.3, appWidth*0.3, appHeight*0.3); for(int row = 0; row<5; row ++ ) { float y = rect.getTop() + (rect.getHeight()*row/4); ofPoint left = ofPoint(rect.getLeft(), y); ofPoint right = ofPoint(rect.getRight(), y); moveLaser(left); for(int i = 0; i<shapePreBlank; i++) { addIldaPoint(left, black, 1); } if(testPattern == 2) c.set(255,0,0); else if(testPattern == 3) c.set(0,255,0); else if(testPattern == 4) c.set(0,0,255); else if(testPattern == 5) c.set(255,255,255); switch (row) { case 0 : c.r *= red100; c.g *= green100; c.b *= blue100; break; case 1 : c.r *= red75; c.g *= green75; c.b *= blue75; break; case 2 : c.r *= red50; c.g *= green50; c.b *= blue50; break; case 3 : c.r *= red25; c.g *= green25; c.b *= blue25; break; case 4 : c.r *= red0; c.g *= green0; c.b *= blue0; break; } for(int i = 0; i<shapePreBlank; i++) { addIldaPoint(left, c, 1, true); } float speed = 20 * ( 1- (row*0.25)); if(speed<5) speed = 5; for(float x = rect.getLeft(); x<=rect.getRight(); x+=speed) { addIldaPoint(ofPoint(x,y),c,1, false); } for(int i = 0; i<shapePostBlank; i++) { addIldaPoint(right, c, 1, false); } for(int i = 0; i<shapePostBlank; i++) { addIldaPoint(right, black, 1); } // 0 = normalspeed; // 1 = normalspeed * 0.75 // 2 = normalspeed * 0.5 // 3 = normalspeed * 0.25 // 0 = 1; // 1 = 0.75 // 2 = 0.5; // 3 = 0.25 //float brightness = 1 - (row*0.25); //if(brightness < 0) brightness = } } // if we're using the clever laser render delay // system if(delay > 0) { float currentTime = ofGetElapsedTimef(); //cout << "------------pushing history " << shapes.size() << endl; // add the current shapes and time to the // histories shapesHistory.push_back(shapes); frameTimes.push_back(currentTime); //start from the oldest shapes and while the next set of // shapes are due, delete the oldest int numDeleted = 0; while((frameTimes.size()>1) && (frameTimes[1]+delay < currentTime)) { shapes = shapesHistory.front(); // DELETE ALL SHAPES IN HISTORY.FRONT for(int i = 0; i<shapes.size(); i++) { delete shapes[i]; } shapesHistory.pop_front(); frameTimes.pop_front(); //resetIldaPoints(); //cout << "deleting oldest " << endl; numDeleted++; } shapes = shapesHistory.front(); if(numDeleted == 0 ) { //cout << "NONE DELETED" << endl; } //cout << "using shapes " << shapesHistory.size() << endl; //cout << "shapes size " << shapes.size() << endl; //cout << "pathMesh vertices " << pathMesh.getVertices().size() << endl; /* if((frameTimes.size()>0) && (frameTimes[0]+delay <= ofGetElapsedTimef())) { // if we have too many, we have to delete some! while((frameTimes.size()>1) && (frameTimes[1]+delay <= ofGetElapsedTimef())) { shapes = shapesHistory.front(); shapesHistory.pop_front(); frameTimes.pop_front(); //resetIldaPoints(); } shapes = shapesHistory.front(); shapesHistory.pop_front(); frameTimes.pop_front(); } else { // we're not ready to show the next shapes yet so show // the oldest ones. // need to do this otherwise the shapes get deleted // more than once clearShapes = true; shapes = shapesHistory.front(); //shapes.clear(); }*/ } else if(shapesHistory.size()!=0) { // TODO need to also delete shapes otherwise memory leak for(int i = 0; i<shapesHistory.size(); i++) { for(int j = 0; j<shapesHistory[i].size(); j++) { delete shapesHistory[i][j]; } } shapesHistory.clear(); frameTimes.clear(); } //ofDrawBitmapString(ofToString(shapesHistory.size()), 200,200); drawShapes(); if(renderLaserPreview) { renderPreview(); //ofRect(0,0,100,100); } while(ildaPoints.size()<minPoints) { addIldaPoint(currentPosition, black); } vector<ofxIlda::Point> adjustedPoints; // SORT OUT COLOUR CHANGE DELAY. for(int i = 0; i<ildaPoints.size(); i++) { ofxIlda::Point p = ildaPoints.at(i); int colourPointIndex = i+colourChangeDelay; while(colourPointIndex<0) colourPointIndex+=ildaPoints.size(); ofxIlda::Point colourPoint = ildaPoints.at(colourPointIndex%ildaPoints.size()); p.r = round(colourPoint.r); p.g = round(colourPoint.g); p.b = round(colourPoint.b); adjustedPoints.push_back(p); } if(!useTCP) { etherdream.setPoints(adjustedPoints); etherdream.setPPS(pps); } else { sendPointsTCP(adjustedPoints); } ofPushStyle(); if(maskRectangleBrightness>0) { ofNoFill(); ofSetColor(maskRectangleBrightness * 255); ofRect(maskRectangle); maskRectangleBrightness-=0.01; } ofPopStyle(); // TODO if we're not using the delay system, let's // delete all the shapes if(delay==0) { for(int i = 0; i<shapes.size(); i++) { delete shapes[i]; } } // clear the shapes vector no matter what shapes.clear(); // cout << "pathMesh vertices " << pathMesh.getVertices().size() << " " << ildaPoints.size() << endl; }
// This callback function gets called by the Glut // system whenever it decides things need to be redrawn. void display(void) { glClear(GL_COLOR_BUFFER_BIT); drawShapes(); for (int i = 0; i < shapes.size() - 1; i++) { double gnextX = shapes[i]->getnextx(); double gnextY = shapes[i]->getnexty(); double radius = shapes[i]->getradius(); for (int j = i+1; j < shapes.size(); j++) { double jnextx = shapes[j]->getnextx(); double jnexty = shapes[j]->getnexty(); double jradius = shapes[j]->getradius(); double a = pow((jnextx-gnextX),2); double b = pow((jnexty-gnextY),2); double distance = sqrt(a+b); if (distance < radius+jradius) { Collide(i, j, shapes); } } } for (int i = 0; i < shapes.size(); i++) { double gX = shapes[i]->getx(); double gY = shapes[i]->gety(); double gDY = shapes[i]->getdy(); double gDX = shapes[i]->getdx(); double gnextX = shapes[i]->getnextx(); double gnextY = shapes[i]->getnexty(); double radius = shapes[i]->getradius(); gX += gDX; gY += gDY; if (gX-radius <= 0) { gX = 0; gX += radius; } if (gY-radius <= 0) { gY = radius; } if (gX+radius >= screen_x) { gX = screen_x - radius; } if (gY+radius >= screen_y) { gY = screen_y - radius; } double r = shapes[i]->getr(); double g = shapes[i]->getg(); double b = shapes[i]->getb(); solid = shapes[i]->getsolid(); if (gnextY-radius > 0) { gDY -= 1; } shapes[i] = new Circle(gX, gY, gX+radius, gY, r, g, b, solid); if (gnextX+radius >= screen_x) { gDX = -gDX; gDX *= COLLISION_FRICTION; } if (gnextY+radius >= screen_y) { gDY = -gDY; gDY *= COLLISION_FRICTION; } if (gnextX-radius <= 0) { gDX = -gDX; gDX *= COLLISION_FRICTION; } if (gnextY-radius <= 0) { gDY = -gDY; gDY *= COLLISION_FRICTION; } shapes[i]->setdx(gDX); shapes[i]->setdy(gDY); } drawShapes(); glutPostRedisplay(); glutSwapBuffers(); }
// 在paintEvent事件函式中呼叫,就不怕圖形被覆蓋了. 當呼叫repaint()或update()時,此函數就會被執行,或是視窗有任何變動時,update()就會直接被系統執行 void DrawView::paintEvent(QPaintEvent*) { QPainter p(this); drawShapes(&p, 10, 10); }
void testInterpolation (TGraph ** tg_sample_par, TString sample, int Npar) { //PG testing sets for the test TGraph ** tg_test_par = new TGraph * [7] ; // [parameter][mass] for (int k = 0 ; k < Npar ; ++k) tg_test_par[k] = new TGraph (4) ; TCanvas * c_merge = new TCanvas () ; bkg = (TH1F *) c_merge->DrawFrame (200, 0.0000001, 1500, 0.002) ; // c_merge->SetLogy () ; bkg->GetXaxis ()->SetTitle ("m_{WW}") ; bkg->GetYaxis ()->SetTitle ("signal") ; //PG loop on the point to be removed for (int iTest = 0 ; iTest < 5 ; ++iTest) { cout << " ==== iTest " << iTest << endl ; int iActualMass = 0 ; //PG fill the temporary graphs for (int iMass = 0 ; iMass < 5 ; ++iMass) { if (iMass == iTest) continue ; double x = 0 ; double y = 0 ; for (int k = 0 ; k < 7 ; ++k) { tg_sample_par[k]->GetPoint (iMass, x, y) ; tg_test_par[k]->SetPoint (iActualMass, x, y) ; } ++iActualMass ; } //PG fill the temporary graphs // plot the interpolation bkg->Draw () ; drawShapes (tg_test_par, Npar) ; // overlap the missing point double dummy = 0 ; double mass = 0 ; tg_sample_par[0]->GetPoint (iTest, mass, dummy) ; TF1 * func = new TF1 ("func",crystalBallLowHigh, 200, 2000, 7) ; TGraph * log_tg_this_sample_par0 = makeLog (tg_sample_par[0]) ; func->SetParameter (0, TMath::Exp (log_tg_this_sample_par0->Eval (mass))) ; for (int iPar = 1 ; iPar < Npar ; ++iPar) func->SetParameter (iPar, tg_sample_par[iPar]->Eval (mass)) ; func->SetLineColor (kRed) ; func->Draw ("same") ; // output // c_merge->SetLogy (1) ; // TString name = "test_interpol_log_" ; // name += sample ; name += "_" ; name += iTest ; name += ".pdf" ; // c_merge->Print (name, "pdf") ; TString name = "test_interpol_lin_" ; name += sample ; name += "_" ; name += iTest ; name += ".pdf" ; c_merge->SetLogy (0) ; c_merge->Print (name, "pdf") ; } //PG loop on the point to be removed return ; }