Public Member Functions | Public Attributes | List of all members
DataFile Class Reference

Public Member Functions

bool GetData ()
 
 DataFile ()
 
 DataFile (string dname, string dtitle)
 
 DataFile (string dtype, string dir, string ddname, string dtitle, string dcols, string dcut, double ddcth, int dcolor)
 
string getName ()
 
int GetID ()
 
bool valid ()
 
int analyzeTextFile ()
 

Public Attributes

string dir
 
string filename
 
string name
 
string title
 
string cols
 
string gType
 
string cut
 
float dcth
 
int color
 
TFile * file
 
bool isValid
 
TTree * dataTree
 
TNtuple * dataTuple
 

Detailed Description

Definition at line 76 of file rootgINukeVal.C.

Constructor & Destructor Documentation

DataFile::DataFile ( )

Definition at line 102 of file rootgINukeVal.C.

102 {}
DataFile::DataFile ( string  dname,
string  dtitle 
)

Definition at line 103 of file rootgINukeVal.C.

103  {
104  name = dname;
105  title = dtitle;
106  isValid = GetData();
107 }
bool isValid
Definition: rootgINukeVal.C:89
string title
Definition: rootgINukeVal.C:82
string name
Definition: rootgINukeVal.C:81
bool GetData()
DataFile::DataFile ( string  dtype,
string  dir,
string  ddname,
string  dtitle,
string  dcols,
string  dcut,
double  ddcth,
int  dcolor 
)

Definition at line 109 of file rootgINukeVal.C.

109  {
110  dir = ddir;
111  filename = ddname;
112  gType = dtype;
113  name = ddir+ddname;
114  title = dtitle;
115  cols = dcols;
116  cut = dcut;
117  dcth = ddcth;
118  color = dcolor;
119  if (color>=5) {color++;}
120  isValid = GetData();
121 }
string dir
Definition: rootgINukeVal.C:79
bool isValid
Definition: rootgINukeVal.C:89
string cols
Definition: rootgINukeVal.C:83
string cut
Definition: rootgINukeVal.C:85
float dcth
Definition: rootgINukeVal.C:86
string title
Definition: rootgINukeVal.C:82
string name
Definition: rootgINukeVal.C:81
bool GetData()
string gType
Definition: rootgINukeVal.C:84
string filename
Definition: rootgINukeVal.C:80

Member Function Documentation

int DataFile::analyzeTextFile ( )

Definition at line 217 of file rootgINukeVal.C.

217  {
218  //Determines the number of columns of numbers in the text file
219  // Assumes columns are separated by spaces
220  // Only actually determines if there are more than two columns, if so, it assumes there are 3
221  int size=0;
222  ifstream dataStream(name.c_str(),ios::in);
223  string line;
224  if(dataStream.is_open()){
225  getline(dataStream,line);
226  line = trim(line);
227  while(line[0]=='#'){
228  getline(dataStream,line);
229  }
230  size_t begin = line.find(" ",0);
231  size_t end = line.find_first_not_of(" ",begin);
232  size_t again = line.find(" ",end);
233  if(again!=string::npos){
234  size=3;
235  }
236  else{
237  size=2;
238  }
239  }
240  dataStream.close();
241  return size;
242 }
string trim(string in)
Definition: rootgINukeVal.C:65
auto begin(Data< Value > const &data)
auto end(Data< Value > const &data)
This add method has three it adds this message xid and id to the appropriate and it updates the dynamic information in counts The sequence is as the static apppropriate and timespan will be in the mapped CountAndLimit and there will be no need to recompute them If this xid is not yet in see if the category is in limits if the appropriate counts struct can be formed by using the precedence rules above to combine the limit and interval found in limits along with the severityLimits and severityIntervals arrays found in the ELlimitsTable Along the way the limits map for this category is filled in
string name
Definition: rootgINukeVal.C:81
DataFile::GetData ( )

Definition at line 123 of file rootgINukeVal.C.

123  {
124  stringstream convert;
125  int nameVal = 0;
126  convert.str(filename);
127  convert >> nameVal;
128  bool success = false;
129  //Find file type
130  string type = "";
131  size_t pos = filename.find_last_of('.');
132  if(gType.compare("XS")==0){
133  TNtuple newData ("newData","", cols.c_str() );
134  newData.ReadFile(name.c_str());
135  cout<<"TNtuple created"<<endl;
136  dataTuple = (TNtuple*) newData.Clone();
137  cout<<name.c_str()<<endl;
138  cout<<dataTuple<<endl;
139  success = true;
140  }
141  else{
142  if(pos != string::npos){
143  if(filename[pos+1] == 'r'){
144  if(filename[pos-1] == 'e'){
145  type.assign("ginuke");
146  }
147  else{
148  type.assign("gst");
149  }
150  }
151  else{
152  type.assign("txt");
153  }
154  }
155  else{
156  type.assign("chain");
157  }
158  if(type[0]!='t'){
159  if(type[0]=='g'){
160  //Normal .ginuke file, Easy
161  file = new TFile(name.c_str());
162  if(file->IsOpen()){
163  TTree* dummy = file->Get(type.c_str());
164  dataTree = (TTree*)dummy->Clone();
165  delete dummy;
166  success=true;
167  }
168  else{
169  cout<<name.c_str()<<" was not found. Skipping [GENIE] tag."<<endl;
170  success=false;
171  }
172  }
173  //Chaining together some files
174  else{
175  TChain chain("ginuke");
176  TChain* dummy = &chain;
177  //Need to have name separate from directory in order to properly construct this filename.
178  string n = dir+"/gntp.*"+filename+"*.ginuke.root";
179  cout<<"Making a chain called "<<n<<endl;
180  chain.Add(n.c_str());
181  cout<<"Chain created."<<endl;
182  dataTree = (TTree*)dummy->Clone();
183  cout<<"dummy cloned"<<endl;
184  success=true;
185  }
186  }
187  else{
188  //Grabbing simple data from the text file
189  dataTree = new TTree("textData",title.c_str());
190  int nCol = this->analyzeTextFile();
191  success = true;
192  if(gType.compare("Energy")==0){
193  if(nCol==3){dataTree->ReadFile(name.c_str(),"E/D:xsec:err1");}
194  else if(nCol==2){dataTree->ReadFile(name.c_str(),"E/D:xsec");}
195  else{cout<<"Published data file has an unrecognized format."<<endl;
196  success=false;}
197  }
198  if(gType.compare("Momentum")==0){
199  if(nCol==3){dataTree->ReadFile(name.c_str(),"ph/D:xsec:err1");}
200  else if(nCol==2){dataTree->ReadFile(name.c_str(),"ph/D:xsec");}
201  else{cout<<"Published data file has an unrecognized format."<<endl;
202  success=false;}
203  }
204  if(gType.compare("Angle")==0){
205  if(nCol==3){dataTree->ReadFile(name.c_str(),"cth/D:xsec:err1");}
206  else if(nCol==2){dataTree->ReadFile(name.c_str(),"cth/D:xsec");}
207  else{cout<<"Published data file has an unrecognized format."<<endl;
208  success=false;}
209  }
210  }
211  }
212 
213  return success;
214 }
string dir
Definition: rootgINukeVal.C:79
string cols
Definition: rootgINukeVal.C:83
the ParameterSet object passed in for the configuration of a destination should be the only source that can affect the behavior of that destination This is to eliminate the dependencies of configuring a destination from multiple mostly from the defaults It suppresses possible glitches about changing the configuration file somewhere outside of a destination segament might still affect the behavior of that destination In the previous configuration for a specific the value of a certain e may come from following and have been suppressed It the configuring ParameterSet object for each destination will be required to carry a parameter list as complete as possible If a parameter still cannot be found in the ParameterSet the configuration code will go look for a hardwired default directly The model is a great simplicity comparing with the previous especially when looking for default values Another great advantage is most of the parameters now have very limited places that allows to appear Usually they can only appear at one certain level in a configuration file For in the old configuring model or in a default ParameterSet object inside of a or in a category or in a severity object This layout of multiple sources for a single parameter brings great confusion in both writing a configuration and in processing the configuration file Under the new the only allowed place for the parameter limit to appear is inside of a category which is inside of a destination object Other improvements simplify the meaning of a destination name In the old a destination name has multiple folds of meanings the e cout and cerr have the special meaning of logging messages to standard output or standard error the name also serves as the output filename if the destination is a file these names are also references to look up for detailed configurations in configuring the MessageFacility The multi purpose of the destination name might cause some unwanted behavior in either writing or parsing the configuration file To amend in the new model the destination name is now merely a name for a which might represent the literal purpose of this or just an id All other meanings of the destinations names now go into the destination ParameterSet as individual such as the type parameter and filename parameter Following is the deatiled rule for the new configuring Everything that is related with MessageFacility configuration must be wrapped in a single ParameterSet object with the name MessageFacility The MessageFacility ParameterSet object contains a series of top level parameters These parameters can be chosen a vector of string listing the name of debug enabled models Or use *to enable debug messages in all modules a vector of string a vector of string a vector of string a ParameterSet object containing the list of all destinations The destinations ParameterSet object is a combination of ParameterSet objects for individual destinations There are two types of destinations that you can insert in the destinations ParameterSet ordinary including cout
string title
Definition: rootgINukeVal.C:82
TNtuple * dataTuple
Definition: rootgINukeVal.C:99
these are called *plugin *libraries Plugin libraries are loaded by the *LibraryManager *see above The source file in which a module is implemented must be named< module > _plugin cc It must contain an invocation of the *DEFINE_EDM_PLUGIN *macro The *DEFINE_EDM_PLUGIN *macro is responsible for writing the appropriate *factory **function and that takes a const reference to a *ParameterSet *and that returns a newly created instance of the associated module type
TTree * dataTree
Definition: rootgINukeVal.C:98
TFile * file
Definition: rootgINukeVal.C:88
cet::LibraryManager dummy("noplugin")
int analyzeTextFile()
string name
Definition: rootgINukeVal.C:81
string gType
Definition: rootgINukeVal.C:84
string filename
Definition: rootgINukeVal.C:80
int DataFile::GetID ( )
inline

Definition at line 95 of file rootgINukeVal.C.

95 {return this->ID;};
unsigned int ID
string DataFile::getName ( )
inline

Definition at line 94 of file rootgINukeVal.C.

94 {return name;};
string name
Definition: rootgINukeVal.C:81
bool DataFile::valid ( )
inline

Definition at line 96 of file rootgINukeVal.C.

96 {return isValid;};
bool isValid
Definition: rootgINukeVal.C:89

Member Data Documentation

int DataFile::color

Definition at line 87 of file rootgINukeVal.C.

string DataFile::cols

Definition at line 83 of file rootgINukeVal.C.

string DataFile::cut

Definition at line 85 of file rootgINukeVal.C.

TTree* DataFile::dataTree

Definition at line 98 of file rootgINukeVal.C.

TNtuple* DataFile::dataTuple

Definition at line 99 of file rootgINukeVal.C.

float DataFile::dcth

Definition at line 86 of file rootgINukeVal.C.

string DataFile::dir

Definition at line 79 of file rootgINukeVal.C.

TFile* DataFile::file

Definition at line 88 of file rootgINukeVal.C.

string DataFile::filename

Definition at line 80 of file rootgINukeVal.C.

string DataFile::gType

Definition at line 84 of file rootgINukeVal.C.

bool DataFile::isValid

Definition at line 89 of file rootgINukeVal.C.

string DataFile::name

Definition at line 81 of file rootgINukeVal.C.

string DataFile::title

Definition at line 82 of file rootgINukeVal.C.


The documentation for this class was generated from the following file: