// $Header: GetParameters.cxx $
#include "GetParameters.h"
#include <stdlib.h>
//______________________________________________________________________
// GetParameters
//
// This class is a temporary expedient (until a more flexible method
// is available) for getting parameters to a reconstruction program,
// such as Fast MC or FullRecon.
ClassImp(GetParameters)
GetParameters::GetParameters(FILE* parFile) {
// Constructor. Read and digest parameter file and progeny.
// find the tracking section in the parameters file and extract them.
TString input_line, input_string;
char temp[100],
name[100],
equals[100];
float value;
int pos;
// rewind the file
fseek(parFile, 0L, 0);
while ( (pos = fscanf(parFile,"%s",&temp)) > 0 ) {
input_line = temp;
if(input_line.Contains("Detector:")) {
// form of parameters is: name = value
int inpos;
while( (inpos = fscanf(parFile,"%s",&name) ) > 0) {
input_string = name;
if ( input_string.Contains("end")) {
break;
}
inpos = fscanf(parFile,"%s %s",&equals,&temp);
if ( input_string.Contains("DetectorName" )) {
m_DetectorName = temp;
}
}
}
if(input_line.Contains("Tracking:")) {
// form of parameters is: name = value
int inpos;
while( (inpos =fscanf(parFile,"%s",&name) ) > 0){
input_string = name;
if ( input_string.Contains("end")) {
break;
}
inpos = fscanf(parFile,"%s %s",&equals,&temp);
if ( input_string.Contains("BarrelTableFile" )) {
m_BarrelTableFile = temp;
}
else if ( input_string.Contains("EndcapTableFile" )) {
m_EndcapTableFile = temp;
}
else {
value = strtod(temp,(char**)NULL);
if ( input_string.Contains("minHit" )) {
m_minHit = value;
}
else if ( input_string.Contains("PtMin" )) {
m_PtMin = value;
}
else if ( input_string.Contains("PolarInner" )) {
m_PolarInner = value;
}
else if ( input_string.Contains("PolarOuter" )) {
m_PolarOuter = value;
}
}
}
}
if(input_line.Contains("Calorimeter:")) {
// form of parameters is: name = value
int inpos;
while( (inpos =fscanf(parFile,"%s",&name) ) > 0){
input_string = name;
if ( input_string.Contains("end")) {
break;
}
inpos = fscanf(parFile,"%s %s",&equals,&temp);
value = strtod(temp,(char**)NULL);
if ( input_string.Contains("EMEnergyScale" )) {
m_EMEnergyScale = value;
}
else if ( input_string.Contains("HADEnergyScale" )) {
m_HADEnergyScale = value;
}
else if ( input_string.Contains("MUEnergyScale" )) {
m_MUEnergyScale = value;
}
else if ( input_string.Contains("LUMEnergyScale" )) {
m_LUMEnergyScale = value;
}
else if ( input_string.Contains("EMcosThetaSeg" )) {
m_EMcosThetaSeg = value;
}
else if ( input_string.Contains("HADcosThetaSeg" )) {
m_HADcosThetaSeg = value;
}
else if ( input_string.Contains("MUcosThetaSeg" )) {
m_MUcosThetaSeg = value;
}
else if ( input_string.Contains("LUMphiSeg" )) {
m_LUMphiSeg = value;
}
else if ( input_string.Contains("EMphiSeg" )) {
m_EMphiSeg = value;
}
else if ( input_string.Contains("HADphiSeg" )) {
m_HADphiSeg = value;
}
else if ( input_string.Contains("MUphiSeg" )) {
m_MUphiSeg = value;
}
else if ( input_string.Contains("LUMphiSeg" )) {
m_LUMphiSeg = value;
}
}
}
}
printf("Tracking Parameters Used: n n");
printf("PtMin= %f minHit= %i n",m_PtMin,m_minHit);
printf("PolarInner= %f n",m_PolarInner);
printf("PolarOuter= %f n", m_PolarOuter);
printf("BarrelTableFile= %s n", m_BarrelTableFile.Data());
printf("EndcapTableFile= %s n", m_EndcapTableFile.Data());
printf("DetectorName= %s n", m_DetectorName.Data());
// rewind the file again
fseek(parFile, 0L, 0);
};
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.