// $Header: GetTrackLookUps.cxx $
// extract lookup table for track parameter smear
// Version 1.0 7-Jan-1999 Richard creation
#include "GetTrackLookups.h"
#include <assert.h>
#include "TString.h"
//______________________________________________________________________
//
// GetTrackLookups
//
// Extracts lookup tables for track parameter smear
ClassImp(GetTrackLookups)
GetTrackLookups::GetTrackLookups(FILE* parFile) {
// parses parameter file to get track block and then create the
// requested lookup tables
TString input_line, input_string;
char temp[100];
int pos;
// rewind the file
fseek(parFile, 0L, 0);
while ( (pos = fscanf(parFile,"%s",&temp)) > 0 ) {
input_line = temp;
if(input_line.Contains(":")) {
Ssiz_t patLen=1, colonPos=0;
Ssiz_t colonLen = input_line.Index(":",patLen,colonPos,TString::kExact);
TString parName = TString(temp,colonLen);
int inpos;
int numTables, numPbins;
inpos = fscanf(parFile,"%i %i",&numTables,&numPbins);
Float_t* par = new Float_t[numTables*numPbins];
Float_t* cArray = new Float_t[numTables];
Float_t* pArray = new Float_t[numPbins];
for (int itable=0; itable < numTables; itable++) {
float costh;
inpos = fscanf(parFile,"%f",&costh);
cArray[itable] = costh;
for (int pBin=0; pBin < numPbins; pBin++) {
float p, res;
inpos = fscanf(parFile,"%f %f",&p, &res);
pArray[pBin] = p;
par[itable*numPbins+pBin] = res;
};
};
LookUp2d* Cvs = new LookUp2d(parName,cArray,pArray,par,
numTables,numPbins);
m_lookupsArray.Add(Cvs);
char endChar[100];
inpos = fscanf(parFile,"%s",&endChar);
TString endString = endChar;
assert ( endString.Contains("end"));
}; // close parameter read section
}; // close file read
}; // close GetTrackLookups()
GetTrackLookups::~GetTrackLookups() {};
LookUp2d* GetTrackLookups::getParamLookup(char* name) {
// gets pointer to appropriate lookup table given the name
TString tname = name;
Int_t numPar = m_lookupsArray.GetEntries();
for (int i=0; i<numPar; i++) {
if ( ((LookUp2d*)
m_lookupsArray[i])->getName()->CompareTo(tname, TString::kExact) ){
return (LookUp2d*)(m_lookupsArray[i]);
};
};
return 0; // name not found!
};
LookUp2d* GetTrackLookups::getParamLookup(int number) {
// gets pointer to appropriate lookup table given the number
return (LookUp2d*)m_lookupsArray[number];
};
ROOT page - Class index - Top of the page
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.