IAP GITLAB

Commit 9a95cbcd authored by Ralf Ulrich's avatar Ralf Ulrich

improved and fixed example analyser

git-svn-id: https://devel-ik.fzk.de/svn/mc/crmc/trunk@7297 c7a5e08c-de06-0410-9364-b41cf42a0b17
parent fa7c509e
...@@ -22,8 +22,8 @@ endif ...@@ -22,8 +22,8 @@ endif
ROOTCFLAGS = $(shell root-config --cflags) ROOTCFLAGS = $(shell root-config --cflags)
ROOTLIBS = $(shell root-config --libs) -lEG ROOTLIBS = $(shell root-config --libs) -lEG
HEPCFLAGS = -I$(HEP_ROOT)/include HEPCFLAGS = -I$(HEPMC_ROOT)/include
HEPLIBS = -L$(HEP_ROOT)/lib -lHepMC -lHepMCfio HEPLIBS = -L$(HEPMC_ROOT)/lib -lHepMC -lHepMCfio
BOOSTLIBS = -lboost_iostreams -lboost_system BOOSTLIBS = -lboost_iostreams -lboost_system
CFLAGS = $(ROOTCFLAGS) $(HEPCFLAGS) CFLAGS = $(ROOTCFLAGS) $(HEPCFLAGS)
...@@ -39,7 +39,7 @@ all: check dirs bin_dir bin/analyse ...@@ -39,7 +39,7 @@ all: check dirs bin_dir bin/analyse
.PHONY : check .PHONY : check
check: check:
@if [ -z "$(HEP_ROOT)" ]; then echo "Please set HEP_ROOT to the root directory of HepMC2"; exit 1; fi @if [ -z "$(HEPMC_ROOT)" ]; then echo "Please set HEPMC_ROOT to the root directory of HepMC2"; exit 1; fi
@if [ -z "$(ROOTSYS)" ]; then echo "Please set ROOTSYS to the root directory of root"; exit 1; fi @if [ -z "$(ROOTSYS)" ]; then echo "Please set ROOTSYS to the root directory of root"; exit 1; fi
bin/analyse: $(OBJS) $(CXXOBJS) bin/analyse: $(OBJS) $(CXXOBJS)
......
...@@ -41,16 +41,23 @@ using namespace std; ...@@ -41,16 +41,23 @@ using namespace std;
int main (int argc, char **argv) int main (int argc, char **argv)
{ {
if (argc==1) {
cout << "\n Please, provide input data file(s) in hepmc or hepmcgz format\n" << endl;
return 0;
}
//-------------------SET UP DATA //-------------------SET UP DATA
TFile* theOutFile; TFile* theOutFile;
string outFileName ("new_histogram_file.root"); string outFileName ("new_histogram_file.root");
cout << " ! Opening output file: " << outFileName << endl; cout << " ! Opening output file: " << outFileName << endl;
theOutFile = new TFile (outFileName.c_str(),"RECREATE"); theOutFile = new TFile (outFileName.c_str(),"RECREATE");
vector<string> filesModel1; vector<string> files;
filesModel1.push_back ("files/test.hepmc"); //add your files here with additional push_back() for (int ia=1; ia<argc; ++ia) {
files.push_back(argv[ia]);
}
DataManager data; DataManager data;
data.SetFiles (filesModel1); //for more models, loop over models and call SetFiles each time data.SetFiles (files); //for more models, loop over models and call SetFiles each time
theOutFile->mkdir ("model1"); theOutFile->mkdir ("model1");
//------------------SET UP HISTOGRAMS //------------------SET UP HISTOGRAMS
......
...@@ -41,8 +41,8 @@ private: ...@@ -41,8 +41,8 @@ private:
{ {
std::string filename = *current_file; std::string filename = *current_file;
bool use_compression = false; bool use_compression = false;
if((filename).find(".gz") != std::string::npos) use_compression = true; if(filename.find("gz") == filename.length()-2) use_compression = true;
std::cout << "DataMangager::Opening file " << (filename) << " with" << (use_compression?" ":"out ") << "compression. " << std::endl; std::cout << "DataMangager::Opening file " << filename << " with" << (use_compression?" ":"out ") << "compression. " << std::endl;
in.reset(); in.reset();
if(use_compression) if(use_compression)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment