/* * CollimatorGraphAnalyzer.cpp * * Created on: Apr 24, 2015 * Author: Hovanes Egiyan */ #include "CollimatorGraphAnalyzer.hh" CollimatorGraphAnalyzer::CollimatorGraphAnalyzer( TGraph2DErrors* graph, string sName, string label ) : GraphAnalyzer( graph, sName, label ) { cout << "In CollimatorGraphAnalyzer::CollimatorGraphAnalyzer()" << endl; // CreateSubGraph(); return; } CollimatorGraphAnalyzer::CollimatorGraphAnalyzer( const CollimatorGraphAnalyzer& analyzer ) : GraphAnalyzer( analyzer ) { cout << "In CollimatorGraphAnalyzer copy constructor" << endl; return; } CollimatorGraphAnalyzer::~CollimatorGraphAnalyzer() { // if( twgaSubGraph!= 0 ) delete twgaSubGraph; return; } TObject* CollimatorGraphAnalyzer::Clone( const char* newname ) const { cout << "Cloning object called " << GetName() << " with a new name " << newname << endl; CollimatorGraphAnalyzer* newObject = new CollimatorGraphAnalyzer( *this ); newObject->SetName( newname ); const_cast(this)->SetName( this->GetName() ); return newObject; } //void CollimatorGraphAnalyzer::CreateSubGraph() { //// unsigned long nSubPoints = 0; //// unsigned long minIndex = 0; //// unsigned long maxIndex = 0; // vector subX, subY, subZ, subErrX, subErrY, subErrZ; // for ( Int_t iPoint = 0; iPoint < fNpoints; iPoint++ ) { // subX.push_back( fX[iPoint] ); // subY.push_back( fY[iPoint] ); // subZ.push_back( fZ[iPoint] ); // // subErrX.push_back( fEX[iPoint] ); // subErrY.push_back( fEY[iPoint] ); // subErrZ.push_back( fEZ[iPoint] ); // } // twgaSubGraph = new TGraph2DErrors( subX.size(), &subX[0], &subY[0], &subZ[0], &subErrX[0], // &subErrY[0], &subErrZ[0] ); // // double xLength = twgaSubGraph->GetXmax() - twgaSubGraph->GetXmin(); // double yLength = twgaSubGraph->GetYmax() - twgaSubGraph->GetYmin(); // // double smallFraction = 0.6; // twgaSubGraph->GetXaxis()->SetRangeUser( twgaSubGraph->GetXmin() - smallFraction * xLength, // twgaSubGraph->GetXmax() + smallFraction * xLength ); // twgaSubGraph->GetYaxis()->SetRangeUser( twgaSubGraph->GetYmin() - smallFraction * yLength, // twgaSubGraph->GetYmax() + smallFraction * yLength ); // return; //} // //map > CollimatorGraphAnalyzer::InitRanges() { // map > localMap; // { // map tmpMap; // tmpMap["low"] = 30.0; // tmpMap["high"] = 55.0; // localMap["X"] = tmpMap; // } // { // map tmpMap; // tmpMap["low"] = 65.0; // tmpMap["high"] = 90.0; // localMap["Y"] = tmpMap; // } // return localMap; //} //void CollimatorGraphAnalyzer::FindInitialParValues() { // cout << "In TwoWireGraphAnalyzer::FindInitialParValues() for " << fName << ":" << gaLabel << endl; // double xMin, xMax, yMin, yMax; // twgaSubGraph->ComputeRange( xMin, yMin, xMax, yMax ); // twgaFitFun->SetParLimits(0, 0.05*yMax, 5.0*yMax ); // twgaFitFun->SetParLimits(1, twgaFitRange[gaLabel]["low"]/sqrt(2), twgaFitRange[gaLabel]["high"]/sqrt(2) ); // twgaFitFun->SetParLimits(2, 0.010, 0.5*(twgaFitRange[gaLabel]["high"] - twgaFitRange[gaLabel]["low"])); // twgaFitFun->SetParLimits(3, 0.0, 2*yMax ); // twgaFitFun->SetParameter(0, yMax ); // twgaFitFun->SetParameter(1, twgaSubGraph->GetMean() / sqrt(2.0) ) ; // twgaFitFun->SetParameter(2, twgaSubGraph->GetRMS() / sqrt(2.0) / 2.0 ); // twgaFitFun->SetParameter(3, 0.005 * yMax ); // cout << "Parameter "<< twgaFitFun->GetParName(0) << " is " << twgaFitFun->GetParameter(0) << endl; // cout << "Parameter "<< twgaFitFun->GetParName(1) << " is " << twgaFitFun->GetParameter(1) << endl; // cout << "Parameter "<< twgaFitFun->GetParName(2) << " is " << twgaFitFun->GetParameter(2) << endl; // cout << "Parameter "<< twgaFitFun->GetParName(3) << " is " << twgaFitFun->GetParameter(3) << endl; // cout << "Initial parameters set for " << fName << ":" << gaLabel << endl; // return; //} //void CollimatorGraphAnalyzer::Draw( Option_t* opt ) { // TGraph2DErrors::Draw( opt ); //// TGraph2DErrors::Draw( opt ); // return; //} // //double CollimatorGraphAnalyzer::TwoWireScanFitFun( double* xArray, double* param ) { //// cout << "In TwoWireGraphAnalyzer::TwoWireScanFitFun" << endl; // // Define a fit function with a flat background and a gaussian // // the parameters are defined for the X or Y directions, not the // // direction of the motion of the motor. // double ampl = param[0]; // double mean = param[1]; // double sigma = param[2]; // // double bkg0 = param[3]; // // // Scale by square root of too since the motion of the harp is at 45 degrees. // double x = xArray[0] / sqrt( 2.0 ); //// double x = xArray[0]; // // // Calculate non-distorted value // double value = ampl * exp( -(x - mean) * (x - mean) / (2.0 * sigma * sigma) ) + bkg0; // // return value; //}