void UnitTestGaussNoise(){ // // Unit Test pulls Gauss // Compare 2 Regression objects obtained from 2 indpendent training sample // // Test: // Bias < 10 *error // Pull < 1+ 3*error // TCanvas * canvasUnitGausNoise = new TCanvas("canvasUnitGausNoise","canvasUnitGausNoise",800,800); treeIn->Draw("(AliNDLocalRegression::GetCorrND(3,xyz0,xyz1)-AliNDLocalRegression::GetCorrND(2,xyz0,xyz1))/sqrt(AliNDLocalRegression::GetCorrNDError(3,xyz0,xyz1)**2+AliNDLocalRegression::GetCorrNDError(2,xyz0,xyz1)**2)>>pullsGaus32(401,-20.5,20.5)","",""); TH1F *pullsGaus32 = (TH1F*)gPad->GetPrimitive("pullsGaus32"); Double_t meanPullsGaus01 = treeIn->GetHistogram()->GetMean(); Double_t meanPullsGaus01Err = treeIn->GetHistogram()->GetMeanError(); Double_t rmsPullsGaus01 = treeIn->GetHistogram()->GetRMS(); Double_t rmsPullsGaus01Err = treeIn->GetHistogram()->GetRMSError(); if (TMath::Abs(meanPullsGaus01)<10*meanPullsGaus01Err) { ::Info( "AliNDLocalRegressionTest","mean pull OK %3.3f\t+-%3.3f", meanPullsGaus01, meanPullsGaus01Err); }else{ ::Error( "AliNDLocalRegressionTest","mean pull NOT OK %3.3f\t+-%3.3f", meanPullsGaus01, meanPullsGaus01Err); } if (rmsPullsGaus01<1+rmsPullsGaus01Err) { ::Info( "AliNDLocalRegressionTest"," rms pull OK %3.3f\t+-%3.3f", rmsPullsGaus01, rmsPullsGaus01Err); }else{ ::Error( "AliNDLocalRegressionTest"," rms pull NOT OK %3.3f\t+-%3.3f", rmsPullsGaus01, rmsPullsGaus01Err); } // // // PlotData(pullsGaus32,"Gaus pulls","counts (arb. units)",kRed+2,"zTitle",rmsPullsGaus01,rmsPullsGaus01Err,meanPullsGaus01,meanPullsGaus01Err); canvasUnitGausNoise->SaveAs("AliNDLocalRegressionTest.canvasUnitTestGaussNoise.png"); }
void UnitTestBreitWignerNoise(){ // // Unit Test pulls BreitWigner // Compare 2 Regression objects obtained from 2 independent training sample // // Test: // Bias < 10 *error // Pull < 1+ 3*error // TCanvas * canvasUnitBreitWigner = new TCanvas("canvasUnitBretWigner","canvasUnitBreitWigner",800,800); treeIn->Draw("(AliNDLocalRegression::GetCorrND(5,xyz0,xyz1)-AliNDLocalRegression::GetCorrND(4,xyz0,xyz1))/sqrt(AliNDLocalRegression::GetCorrNDError(4,xyz0,xyz1)**2+AliNDLocalRegression::GetCorrNDError(5,xyz0,xyz1)**2)>>pullsBreiWigner54(401,-20.5,20.5)","",""); TH1F *pullsBreiWigner54 = (TH1F*)gPad->GetPrimitive("pullsBreiWigner54"); Double_t meanPullsBreitWigner = treeIn->GetHistogram()->GetMean(); Double_t meanPullsBreitWignerErr = treeIn->GetHistogram()->GetMeanError(); Double_t rmsPullsBreitWigner = treeIn->GetHistogram()->GetRMS(); Double_t rmsPullsBreitWignerErr = treeIn->GetHistogram()->GetRMSError(); if (TMath::Abs(meanPullsBreitWigner)<10*meanPullsBreitWignerErr) { ::Info( "AliNDLocalRegressionTest::UnitTestBreitWignerNoise","mean pull OK %3.3f\t+-%3.3f", meanPullsBreitWigner, meanPullsBreitWignerErr); }else{ ::Error( "AliNDLocalRegressionTest::UnitTestBreitWignerNoise","mean pull NOT OK %3.3f\t+-%3.3f", meanPullsBreitWigner, meanPullsBreitWignerErr); } if (rmsPullsBreitWigner<1+rmsPullsBreitWignerErr) { ::Info( "AliNDLocalRegressionTest::UnitTestBreitWignerNoise"," rms pull OK %3.3f\t+-%3.3f", rmsPullsBreitWigner, rmsPullsBreitWignerErr); }else{ ::Error( "AliNDLocalRegressionTest::UnitTestBreitWignerNoise"," rms pull NOT OK %3.3f\t+-%3.3f", rmsPullsBreitWigner, rmsPullsBreitWignerErr); } PlotData(pullsBreiWigner54,"BreitWigner pulls","counts (arb. units)",kBlue+2,"zTitle",rmsPullsBreitWigner,rmsPullsBreitWignerErr,meanPullsBreitWigner,meanPullsBreitWignerErr); canvasUnitBreitWigner->SaveAs("AliNDLocalRegressionTest.canvasUnitBreitWigner.png"); }
void LinePlot::readFromInport() { // create local copy of data and assign it to property if (dynamic_cast<PlotData*>(inport_.getData())) { data_ = *dynamic_cast<PlotData*>(inport_.getData()); if (!data_.sorted()) data_.sortRows(); dataProp_.set(&data_); plotEntitiesProp_.setPlotData(&data_); selectionProp_.setPlotData(&data_); plotPickingManager_.setColumnCount(data_.getColumnCount()); inportHasPlotFunction_ = false; discreteStep_.setVisible(false); } else if (dynamic_cast<PlotFunction*>(inport_.getData()) && inport_.getData()->getKeyColumnCount() == 1) { function_ = *dynamic_cast<PlotFunction*>(inport_.getData()); inportHasPlotFunction_ = true; selectDataFromFunction(); createSimpleZoomState(); discreteStep_.setVisible(true); } else { LWARNINGC("LinePlot", "LinePlot can only handle PlotData objects and PlotFunction objects with one key column"); data_ = PlotData(0,0); dataProp_.set(&data_); plotEntitiesProp_.setPlotData(&data_); selectionProp_.setPlotData(&data_); plotPickingManager_.setColumnCount(data_.getColumnCount()); } }
void BarPlot::readFromInport() { // create local copy of data and assign it to property if (dynamic_cast<PlotData*>(inport_.getData())) { data_ = *dynamic_cast<PlotData*>(inport_.getData()); if (!data_.sorted()) data_.sortRows(); dataProp_.set(&data_); plotEntitiesProp_.setPlotData(&data_); selectionProp_.setPlotData(&data_); plotPickingManager_.setColumnCount(data_.getColumnCount()); } else { LWARNINGC("BarPlot", "BarPlot can only handle PlotData objects"); data_ = PlotData(0,0); dataProp_.set(&data_); plotEntitiesProp_.setPlotData(&data_); selectionProp_.setPlotData(&data_); plotPickingManager_.setColumnCount(data_.getColumnCount()); } }
void UnitTestStreamer(){ // // Check consistency of streamer // TCanvas * canvasUnitTestStreamer = new TCanvas("canvasUnitTestStreamer","canvasUnitTestStreamer",800,800); TFile * f = TFile::Open("fitNDLocalTestStreamer.root","recreate"); pfitNDGaus0->Write("pfitNDGaus0"); f->Close(); f = TFile::Open("fitNDLocalTestStreamer.root"); AliNDLocalRegression *streamTest1 = (AliNDLocalRegression *)f->Get("pfitNDGaus0"); streamTest1->AddVisualCorrection(streamTest1,100); Int_t entries = treeIn->Draw("AliNDLocalRegression::GetCorrND(100,xyz0,xyz1)-AliNDLocalRegression::GetCorrND(2,xyz0,xyz1)>>streamerTest(201,-1.05,1.05)",""); TH1F *streamerTest = (TH1F*)gPad->GetPrimitive("streamerTest"); Int_t rms = TMath::RMS(entries,treeIn->GetV1()); if (rms!=0){ ::Error( "AliNDLocalRegressionTest::UnitTestStreamer","Streamer problem"); }else{ ::Info( "AliNDLocalRegressionTest::UnitTestStreamer","Streamer OK"); } PlotData(streamerTest,"streamer test","counts (arb. units)",kGreen+2,"zTitle",rms); canvasUnitTestStreamer->SaveAs(" AliNDLocalRegressionTest.UnitTestStreamer.png"); }
void PlotHandler() { unsigned int i,j,k; int classIdx1,levelIdx1,classIdx2,levelIdx2; boolean found, addCellcountToLine; switch(PlotOption) { case PLOTNOPROPSELECTED: CNsave.cellcount[1] = 0.0; for(i=1;i<=(unsigned int)active_ntypes;i++) { if (SubsetOption == SUBSETALLCELLSSELECTED) //if all cells selected, no need to check in cellindicesToPlot { CNsave.cellcount[1] = CNsave.cellcount[1] + CN[i]; } else { k=1; found = false; while((k<=numCellIndicesToPlot) && (!found)) { if(LookUp[i].LookUpId == cellIndicesToPlot[k]) { found = true; CNsave.cellcount[1] = CNsave.cellcount[1] + CN[i]; } else { k++; } } } } break; case PLOTALLPROPSELECTED: for(i=1;i<=(unsigned int)active_ntypes;i++) { if (SubsetOption == SUBSETALLCELLSSELECTED) //if all cells selected, no need to check in cellindicesToPlot { CNsave.cellcount[LookUp[i].LookUpId] = CN[i]; } else { k=1; found = false; while((k<=numCellIndicesToPlot) && (!found)) { if(LookUp[i].LookUpId == cellIndicesToPlot[k]) { found = true; CNsave.cellcount[LookUp[i].LookUpId] = CN[i]; } else { k++; } } } } break; case PLOTSOMEPROPSELECTED: // for each line for(i=1;i<=numPlotLines;i++) { CNsave.cellcount[i] = 0.0; if (SubsetOption == SUBSETALLCELLSSELECTED) //if all cells selected, no need to check in cellindicesToPlot { // for each celltype in the subset for(j=1;j<=(unsigned int)active_ntypes;j++) { addCellcountToLine = true; for(k=1;k<=numPlotProperty;k++) { classIdx1 = PlotProperty[k]; levelIdx1 = getCellLevelbyClassforPlotting(i,k-1); classIdx2 = classIdx1; levelIdx2 = getcelllevelbyclass(LookUp[j].LookUpId,classIdx2); //if the level of the line does not match the level of the celltype then //do not add this celltype to the line if(levelIdx2 != levelIdx1) { addCellcountToLine = false; } } if (addCellcountToLine == true) { CNsave.cellcount[i]=CNsave.cellcount[i] + getcellcounts(LookUp[j].LookUpId,!VEGF); } } } else { // for each celltype in the subset for(j=1;j<=numCellIndicesToPlot;j++) { addCellcountToLine = true; for(k=1;k<=numPlotProperty;k++) { classIdx1 = PlotProperty[k]; levelIdx1 = getCellLevelbyClassforPlotting(i,k-1); classIdx2 = classIdx1; levelIdx2 = getcelllevelbyclass(cellIndicesToPlot[j],classIdx2); //if the level of the line does not match the level of the celltype then //do not add this celltype to the line if(levelIdx2 != levelIdx1) { addCellcountToLine = false; } } if (addCellcountToLine == true) { CNsave.cellcount[i]=CNsave.cellcount[i] + getcellcounts(cellIndicesToPlot[j],!VEGF); } } } } break; } PlotData(); }