Changeset 13787


Ignore:
Timestamp:
05/18/12 21:38:51 (12 years ago)
Author:
Jens Buss
Message:
changed all savelists from objarray to lists, add SetHostsPath function
File:
1 edited

Legend:

Unmodified
Added
Removed
  • fact/tools/rootmacros/PulseTemplates/rootfilehandler.C

    r13737 r13787  
    11#include <iostream>
     2#include <string>
    23#include "TObjArray.h"
    34
     
    111112        TString         loc_fname,
    112113        TString         subdirectory,
    113         TObjArray*      histList,
     114        TList*          histList,
    114115        bool            saveResults,
    115116        int             verbosityLevel
    116117        )
    117118{
     119
    118120    if (!saveResults) return;
     121    if (histList==NULL) return;
    119122    if (verbosityLevel > 2) cout << endl
    120123                                 << "...saving pixel histograms to subdirectory: "
     
    127130                                 << "...writing histogram list to root file "
    128131                                 << endl ;
    129     gFile->WriteTObject(histList, subdirectory); // write the histograms into one Key in the top level directory
    130 
     132    gFile->mkdir(subdirectory.Data());
     133    gFile->cd(subdirectory.Data());
     134    gDirectory->pwd();
     135    cout << histList;
     136    for ( int idx = 0; idx < histList->GetSize(); idx++)
     137    {
     138        histList->At(idx)->Write();
     139    }
     140//    gFile->WriteTObject(histList, subdirectory); // write the histograms into one Key in the top level directory
     141    gFile->cd("..");
    131142
    132143    if (verbosityLevel > 3) output_rootfile->ls();
     
    175186        cout << "...opening root-file: ";
    176187    }
    177 
    178188    path += filename;
    179189    TFile* file = TFile::Open( path );
     
    186196    return file;
    187197}
     198
     199TString
     200SetHostsPaths(
     201        bool    isInHomeDir,
     202        TString path
     203        )
     204{
     205    TString hostName = gSystem->HostName();
     206    TString dataDirectory;
     207    TString homeDirectory;
     208
     209    TString temp_filename;
     210
     211    if ( hostName.Contains("isdc") ) //IF ONE IS WORKING AT ISDC
     212    {
     213
     214        dataDirectory = "/fact/";
     215        homeDirectory = "/home_nfs/isdc/jbbuss/";
     216    }
     217    if ( hostName.Contains("hpc")||hostName.Contains("node") ) //IF ONE IS WORKING AT PHIDO
     218    {
     219
     220        dataDirectory = "/fhgfs/groups/app/fact-construction/";
     221        homeDirectory = "/home/jbuss/";
     222    }
     223    else
     224    {
     225        exit(-1);
     226    }
     227    if (!isInHomeDir)
     228    {
     229        temp_filename = dataDirectory;
     230        temp_filename += path;
     231        path = temp_filename;
     232    }
     233    else if (isInHomeDir)
     234    {
     235        temp_filename = homeDirectory;
     236        temp_filename += path;
     237        path = temp_filename;
     238    }
     239
     240    return path;
     241}
Note: See TracChangeset for help on using the changeset viewer.