FairRoot/PandaRoot
Public Member Functions | Private Member Functions | Private Attributes | List of all members
PndFileNameCreator Class Reference

A simple class which adds the corresponding file extensions to a given base class. More...

#include <PndFileNameCreator.h>

Inheritance diagram for PndFileNameCreator:

Public Member Functions

 PndFileNameCreator ()
 
 PndFileNameCreator (std::string fileName)
 
void SetFileName (std::string fileName)
 
void SetVerbose (Int_t v)
 
std::string GetFileName () const
 
std::string GetParFileName (std::string addon="", bool cut=false)
 
std::string GetSimFileName (std::string addon="", bool cut=false)
 
std::string GetDigiFileName (std::string addon="", bool cut=false)
 
std::string GetRecoFileName (std::string addon="", bool cut=false)
 
std::string GetPidFileName (std::string addon="", bool cut=false)
 
std::string GetTrackFindingFileName (std::string addon="", bool cut=false)
 
std::string GetRiemannFileName (std::string addon="", bool cut=false)
 
std::string GetCombinedRiemannFileName (std::string addon="", bool cut=false)
 
std::string GetIdealTrackFindingFileName (std::string addon="", bool cut=false)
 
std::string GetKalmanFileName (std::string addon="", bool cut=false)
 
std::string GetVertexFileName (std::string addon="", bool cut=false)
 
std::string GetCustomFileName (std::string ext, std::string addon="", bool cut=false)
 
std::string GetCustomFileNameInitial (std::string ext)
 
std::string GetPath ()
 
std::string GetFileName ()
 

Private Member Functions

std::string TruncateFileName (bool cut)
 
std::string TruncateInitial ()
 
 ClassDef (PndFileNameCreator, 2)
 

Private Attributes

std::string fFileName
 
std::string fExtPar
 
std::string fExtSim
 
std::string fExtDigi
 
std::string fExtReco
 
std::string fExtPid
 
std::string fExtTrackF
 
std::string fExtIdealTrackF
 
std::string fExtRiemann
 
std::string fExtCombinedRiemann
 
std::string fExtKalman
 
std::string fExtVertex
 
Int_t fVerbose
 

Detailed Description

A simple class which adds the corresponding file extensions to a given base class.

PndFileNameCreator.h

Author
Tobias Stockmanns t.sto.nosp@m.ckma.nosp@m.nns@f.nosp@m.z-ju.nosp@m.elich.nosp@m..de PndFileNameCreator takes the simulation filename and creates all the other filenames of a simulation chain by adding an extension to the simulation filename. Example: <SimulationFileName>.root –> <SimulationFileName>_<extension>.root. The Extension is predefined for the different simulation stages but a custom extension can be given in the method: GetCustomFileName. If the cut parameter is set to true an existing extension of the given fileName is replaced by a new extension. Example: <SimulationFileName>_<OldExtension>.root –> <SimulationFileName>_<NewExtension>.root. An extension is defined as the last part of a FileName which is separated by a "_" from the rest of the FileName.

Definition at line 21 of file PndFileNameCreator.h.

Constructor & Destructor Documentation

PndFileNameCreator::PndFileNameCreator ( )

Definition at line 7 of file PndFileNameCreator.cxx.

7  :
8  fFileName(), fExtPar("par"), fExtSim("sim"), fExtDigi("digi"), fExtReco("reco"), fExtPid("pid"),
9  fExtTrackF("trackF"), fExtIdealTrackF("idealTrackF"), fExtRiemann("riemann"),
10  fExtCombinedRiemann("combRiemann"), fExtKalman("kalman"),fExtVertex("vertex"),
11  fVerbose(0)
12 {
13 }
std::string fExtIdealTrackF
std::string fExtCombinedRiemann
PndFileNameCreator::PndFileNameCreator ( std::string  fileName)

Definition at line 15 of file PndFileNameCreator.cxx.

15  :
16  fFileName(fileName), fExtPar("par"), fExtSim("sim"), fExtDigi("digi"), fExtReco("reco"), fExtPid("pid"),
17  fExtTrackF("trackF"), fExtIdealTrackF("idealTrackF"), fExtRiemann("riemann"),
18  fExtCombinedRiemann("combRiemann"), fExtKalman("kalman"),fExtVertex("vertex"),
19  fVerbose(0)
20 {
21  std::cout << "PndFileNameCreator::fFileName " << fileName << " " << fileName.size() << std::endl;
22 }
std::string fExtIdealTrackF
std::string fExtCombinedRiemann

Member Function Documentation

PndFileNameCreator::ClassDef ( PndFileNameCreator  ,
 
)
private
std::string PndFileNameCreator::GetCombinedRiemannFileName ( std::string  addon = "",
bool  cut = false 
)

Definition at line 67 of file PndFileNameCreator.cxx.

References fExtCombinedRiemann, and GetCustomFileName().

68 {
70 }
double cut[MAX]
Definition: autocutx.C:36
std::string GetCustomFileName(std::string ext, std::string addon="", bool cut=false)
std::string fExtCombinedRiemann
std::string PndFileNameCreator::GetCustomFileName ( std::string  ext,
std::string  addon = "",
bool  cut = false 
)

Definition at line 145 of file PndFileNameCreator.cxx.

References cut, ext, fVerbose, and TruncateFileName().

Referenced by anaRadLength(), GetCombinedRiemannFileName(), GetDigiFileName(), GetIdealTrackFindingFileName(), GetKalmanFileName(), GetParFileName(), GetPidFileName(), GetRecoFileName(), GetRiemannFileName(), GetSimFileName(), GetTrackFindingFileName(), GetVertexFileName(), InitDefaultRun(), InitRun(), runTrackingPid(), and testFile().

146 {
147 
148  std::string result = TruncateFileName(cut);
149  if (fVerbose > 0){
150  std::cout << "PndFileNameCreator::GetCustomFileName ";
151  std::cout << "Ext: " << ext << " addon: " << addon << " cut: " << cut;
152  std::cout << " Truncated: " << result << std::endl;
153  }
154  if (addon.size() > 0){
155  result += "_";
156  result += addon;
157  }
158  if (ext.size() > 0){
159  result += "_";
160  result += ext;
161  }
162  result += ".root";
163  if(fVerbose>0) std::cout<<" -I- PndFileNameCreator file: "<<result.c_str()<<std::endl;
164  return result;
165 }
double cut[MAX]
Definition: autocutx.C:36
std::string TruncateFileName(bool cut)
TNtuple * ext
Definition: reco_muo.C:24
std::string PndFileNameCreator::GetCustomFileNameInitial ( std::string  ext)

Definition at line 173 of file PndFileNameCreator.cxx.

References ext, fVerbose, and TruncateInitial().

174 {
175  std::string result = ext;
176  result += TruncateInitial();
177 
178  if (fVerbose>0) std::cout << " -I- PndFileNameCreator::GetCustomFileNameInitial: " << result.c_str() << std::endl;
179  return result;
180 }
std::string TruncateInitial()
TNtuple * ext
Definition: reco_muo.C:24
std::string PndFileNameCreator::GetDigiFileName ( std::string  addon = "",
bool  cut = false 
)

Definition at line 37 of file PndFileNameCreator.cxx.

References fExtDigi, and GetCustomFileName().

Referenced by anaclust().

38 {
39  return GetCustomFileName(fExtDigi, addon, cut);
40 }
double cut[MAX]
Definition: autocutx.C:36
std::string GetCustomFileName(std::string ext, std::string addon="", bool cut=false)
std::string PndFileNameCreator::GetFileName ( ) const
inline

Definition at line 29 of file PndFileNameCreator.h.

References fFileName.

Referenced by TruncateFileName(), and TruncateInitial().

29 {return fFileName;};
std::string PndFileNameCreator::GetFileName ( )

Definition at line 209 of file PndFileNameCreator.cxx.

References fFileName, and PndStringSeparator::GetStringVector().

210 {
211  std::string result;
212  std::vector<std::string> resString;
213 
214  PndStringSeparator pathAna(fFileName,"/");
215  resString = pathAna.GetStringVector();
216  if (resString.size() > 0)
217  result = resString[resString.size()-1];
218  return result;
219 }
std::string PndFileNameCreator::GetIdealTrackFindingFileName ( std::string  addon = "",
bool  cut = false 
)

Definition at line 57 of file PndFileNameCreator.cxx.

References fExtIdealTrackF, and GetCustomFileName().

58 {
59  return GetCustomFileName(fExtIdealTrackF, addon, cut);
60 }
std::string fExtIdealTrackF
double cut[MAX]
Definition: autocutx.C:36
std::string GetCustomFileName(std::string ext, std::string addon="", bool cut=false)
std::string PndFileNameCreator::GetKalmanFileName ( std::string  addon = "",
bool  cut = false 
)

Definition at line 73 of file PndFileNameCreator.cxx.

References fExtKalman, and GetCustomFileName().

74 {
75  return GetCustomFileName(fExtKalman, addon, cut);
76 }
double cut[MAX]
Definition: autocutx.C:36
std::string GetCustomFileName(std::string ext, std::string addon="", bool cut=false)
std::string PndFileNameCreator::GetParFileName ( std::string  addon = "",
bool  cut = false 
)

Definition at line 27 of file PndFileNameCreator.cxx.

References fExtPar, and GetCustomFileName().

Referenced by anaRadLength(), InitDefaultRun(), InitRun(), runDigiReco(), runSim(), and runTrackingPid().

28 {
29  return GetCustomFileName(fExtPar, addon, cut);
30 }
double cut[MAX]
Definition: autocutx.C:36
std::string GetCustomFileName(std::string ext, std::string addon="", bool cut=false)
std::string PndFileNameCreator::GetPath ( )

Definition at line 182 of file PndFileNameCreator.cxx.

References fFileName, fVerbose, PndStringSeparator::GetStringVector(), i, and PndStringSeparator::Print().

Referenced by TruncateFileName(), and TruncateInitial().

183 {
184  std::stringstream result;
185  std::vector<std::string> resString;
186 
187  PndStringSeparator pathAna(fFileName,"/");
188  resString = pathAna.GetStringVector();
189  if(fVerbose>1) pathAna.Print();
190 
191  if (fFileName.find("/") != 0){
192  if (fFileName.find("./") != 0){
193  result << "./";
194  }
195  }
196  else {
197  result << "/";
198  }
199  if (fVerbose > 0)
200  std::cout << "resString.size() " << resString.size() << std::endl;
201  if (resString.size() > 0){
202  for (size_t i = 0; i < resString.size()-1; i++){
203  result << resString[i] << "/";
204  }
205  }
206  return result.str();
207 }
Int_t i
Definition: run_full.C:25
std::string PndFileNameCreator::GetPidFileName ( std::string  addon = "",
bool  cut = false 
)

Definition at line 47 of file PndFileNameCreator.cxx.

References fExtPid, and GetCustomFileName().

48 {
49  return GetCustomFileName(fExtPid, addon, cut);
50 }
double cut[MAX]
Definition: autocutx.C:36
std::string GetCustomFileName(std::string ext, std::string addon="", bool cut=false)
std::string PndFileNameCreator::GetRecoFileName ( std::string  addon = "",
bool  cut = false 
)

Definition at line 42 of file PndFileNameCreator.cxx.

References fExtReco, and GetCustomFileName().

Referenced by anaclust(), InitDefaultRun(), InitRun(), runDigiReco(), runTrackingPid(), and testFile().

43 {
44  return GetCustomFileName(fExtReco, addon, cut);
45 }
double cut[MAX]
Definition: autocutx.C:36
std::string GetCustomFileName(std::string ext, std::string addon="", bool cut=false)
std::string PndFileNameCreator::GetRiemannFileName ( std::string  addon = "",
bool  cut = false 
)

Definition at line 62 of file PndFileNameCreator.cxx.

References fExtRiemann, and GetCustomFileName().

63 {
64  return GetCustomFileName(fExtRiemann, addon, cut);
65 }
double cut[MAX]
Definition: autocutx.C:36
std::string GetCustomFileName(std::string ext, std::string addon="", bool cut=false)
std::string PndFileNameCreator::GetSimFileName ( std::string  addon = "",
bool  cut = false 
)

Definition at line 32 of file PndFileNameCreator.cxx.

References fExtSim, and GetCustomFileName().

Referenced by anaclust(), anaRadLength(), InitDefaultRun(), InitRun(), runDigiReco(), runSim(), runTrackingPid(), and testFile().

33 {
34  return GetCustomFileName(fExtSim, addon, cut);
35 }
double cut[MAX]
Definition: autocutx.C:36
std::string GetCustomFileName(std::string ext, std::string addon="", bool cut=false)
std::string PndFileNameCreator::GetTrackFindingFileName ( std::string  addon = "",
bool  cut = false 
)

Definition at line 52 of file PndFileNameCreator.cxx.

References fExtTrackF, and GetCustomFileName().

53 {
54  return GetCustomFileName(fExtTrackF, addon, cut);
55 }
double cut[MAX]
Definition: autocutx.C:36
std::string GetCustomFileName(std::string ext, std::string addon="", bool cut=false)
std::string PndFileNameCreator::GetVertexFileName ( std::string  addon = "",
bool  cut = false 
)

Definition at line 78 of file PndFileNameCreator.cxx.

References fExtVertex, and GetCustomFileName().

79 {
80  return GetCustomFileName(fExtVertex, addon, cut);
81 }
double cut[MAX]
Definition: autocutx.C:36
std::string GetCustomFileName(std::string ext, std::string addon="", bool cut=false)
void PndFileNameCreator::SetFileName ( std::string  fileName)
inline

Definition at line 27 of file PndFileNameCreator.h.

References fFileName.

27 {fFileName = fileName;};
void PndFileNameCreator::SetVerbose ( Int_t  v)
inline

Definition at line 28 of file PndFileNameCreator.h.

References fVerbose, and v.

28 {fVerbose = v;};
__m128 v
Definition: P4_F32vec4.h:4
std::string PndFileNameCreator::TruncateFileName ( bool  cut)
private

Definition at line 221 of file PndFileNameCreator.cxx.

References GetFileName(), GetPath(), PndStringSeparator::GetStringVector(), i, and name.

Referenced by GetCustomFileName().

222 {
223  std::vector<std::string> resString;
224  std::stringstream result;
225  std::string path, name;
226  Int_t cutLast = 0;
227 
228 
229  path = GetPath();
230  name = GetFileName();
231  //if(fVerbose>1) std::cout << "Path: " << path << " FileName: " << name << std::endl;
232  result.str("");
233 
234  PndStringSeparator stringAna(name, "._");
235  resString = stringAna.GetStringVector();
236  //if(fVerbose>1) stringAna.Print();
237 
238  if (cut == true)
239  cutLast = 2;
240  else cutLast = 1;
241  if (resString.size() > 0){
242  if (resString[resString.size()-1] != "root")
243  cutLast--;
244 
245  if (resString.size() - cutLast <= 0)
246  return "";
247 
248  result << path;
249  for (UInt_t i = 0; i < resString.size()-1 - cutLast; i++){
250  result << resString[i] << "_";
251  }
252  result << resString[resString.size()-1 - cutLast];
253  }
254  return result.str();
255 }
std::string GetFileName() const
Int_t i
Definition: run_full.C:25
double cut[MAX]
Definition: autocutx.C:36
TString name
std::string PndFileNameCreator::TruncateInitial ( )
private

Definition at line 257 of file PndFileNameCreator.cxx.

References GetFileName(), GetPath(), PndStringSeparator::GetStringVector(), i, and name.

Referenced by GetCustomFileNameInitial().

258 {
259  std::vector<std::string> resString;
260  std::stringstream result;
261  std::string path, name;
262 
263  path = GetPath();
264  name = GetFileName();
265 
266  PndStringSeparator stringAna(name, "._");
267  resString = stringAna.GetStringVector();
268  if (resString.size() > 0){
269  for (UInt_t i = 1; i < resString.size() - 1; i++){
270  result << "_" << resString[i];
271  }
272  }
273  result << ".root";
274  return result.str();
275 }
std::string GetFileName() const
Int_t i
Definition: run_full.C:25
TString name

Member Data Documentation

std::string PndFileNameCreator::fExtCombinedRiemann
private

Definition at line 61 of file PndFileNameCreator.h.

Referenced by GetCombinedRiemannFileName().

std::string PndFileNameCreator::fExtDigi
private

Definition at line 55 of file PndFileNameCreator.h.

Referenced by GetDigiFileName().

std::string PndFileNameCreator::fExtIdealTrackF
private

Definition at line 59 of file PndFileNameCreator.h.

Referenced by GetIdealTrackFindingFileName().

std::string PndFileNameCreator::fExtKalman
private

Definition at line 62 of file PndFileNameCreator.h.

Referenced by GetKalmanFileName().

std::string PndFileNameCreator::fExtPar
private

Definition at line 53 of file PndFileNameCreator.h.

Referenced by GetParFileName().

std::string PndFileNameCreator::fExtPid
private

Definition at line 57 of file PndFileNameCreator.h.

Referenced by GetPidFileName().

std::string PndFileNameCreator::fExtReco
private

Definition at line 56 of file PndFileNameCreator.h.

Referenced by GetRecoFileName().

std::string PndFileNameCreator::fExtRiemann
private

Definition at line 60 of file PndFileNameCreator.h.

Referenced by GetRiemannFileName().

std::string PndFileNameCreator::fExtSim
private

Definition at line 54 of file PndFileNameCreator.h.

Referenced by GetSimFileName().

std::string PndFileNameCreator::fExtTrackF
private

Definition at line 58 of file PndFileNameCreator.h.

Referenced by GetTrackFindingFileName().

std::string PndFileNameCreator::fExtVertex
private

Definition at line 63 of file PndFileNameCreator.h.

Referenced by GetVertexFileName().

std::string PndFileNameCreator::fFileName
private

Definition at line 52 of file PndFileNameCreator.h.

Referenced by GetFileName(), GetPath(), and SetFileName().

Int_t PndFileNameCreator::fVerbose
private

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