//----------------------------------------------------------- // File and Version Information: // $Id$ // // Description: // Implementation of class TpcPRLookupTable // see TpcPRLookupTable.h for details // // Environment: // Software developed for the PANDA Detector at FAIR. // // Author List: // Sebastian Neubert TUM (original author) // Cristoforo Simonetto TUM // // //----------------------------------------------------------- // This Class' Header ------------------ #include "TpcPRLookupTable.h" // C/C++ Headers ---------------------- #include #include // Collaborating Class Headers -------- #include "TpcAbsPadShape.h" #include "TpcGem.h" #include "TError.h" #include "TMath.h" // Class Member definitions ----------- TpcPRLookupTable::TpcPRLookupTable() : isbuilt(false),range(0),step(0),nx(0),ny(0),table(0) {;} TpcPRLookupTable::~TpcPRLookupTable() { if(table!=0) { for(int i=0;i=nx){ //ErrMsg(warning)<<"ilx out of range"<=ny){ //ErrMsg(warning)<<"ily out of range"<=nx){ //ErrMsg(warning)<<"iux out of range"<=ny){ //ErrMsg(warning)<<"iuy out of range"<=nx and iux>=nx) ilx=nx-1; if(ily<0 and iuy<0) iuy=0; if(ily>=ny and iuy>=ny) ily=ny-1; */ if (ilx>=0 and ilx=0 and ily=0 and iuy=0 and iux=0 and ily=0 and iuy>nx>>ny>>step)) { std::string msg("TpcPRLookupTable: error while reading file (first line)!"); std::cout<>ix>>iy>>response)) { std::string msg("TpcPRLookupTable: error while reading file!"); std::cout<Eval(r)*1/gem.spread()*1/sqrt(2*3.1416); // TODO: cache these values!!! } //normalize to area double s2=intStep*intStep; sum*=s2; return sum; } double TpcPRLookupTable::GetLTValue(const int x, const int y) { if (x=0 and y>=0) return table[x][y]; else return -1; } double TpcPRLookupTable::GetWeight(double amp, double dirX, double dirY) { double val=1.; double X=0; double Y=0; //std::cout<<"start calculating weight: "<amp) { val=this->GetValue(X,Y); std::cout<<"xpos: "<GetValue(X,Y); while (fabs((val-amp)/amp)>0.001) { searchCounter+=1; if (searchCounter>100) { X=0; Y=0; //std::cout<<"TpcPRLookupTable: weighting: Can't find point "<amp) { if (not isbigger) scale/=2; X+=scale*xdir; Y+=scale*ydir; //std::cout<<"bigger\n"; isbigger=true; } if (valGetValue(X,Y); /* if (sqrt(X*X+Y*Y)/mag > 2) { std::cout<<"xpos: "<1) { //std::cout<<"distance was bigger than 1 "<