Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Typedefs | Functions | Variables
JSUPPORT Namespace Reference

Support classes and methods for experiment specific I/O. More...

Classes

struct  JAutoTreeScanner
 Auxiliary class to select JTreeScanner based on ROOT class name. More...
 
class  JAutoTreeWriter
 Auxiliary class to copy input data to corresponding TTree. More...
 
class  JDAQFileReader
 DAQ object reading from binary file (i.e. .dat). More...
 
class  JDAQFileReader< T, true >
 Template specialisation of JDAQFileReader for DAQ compatible data types. More...
 
class  JDAQFileReader< T, false >
 Template specialisation of JDAQFileReader for DAQ incompatible data types. More...
 
class  JDAQWriterObjectOutput
 Auxiliary class for DAQ object writing to binary stream. More...
 
class  JDAQWriterObjectOutput< T, true >
 Implementation of object output for DAQ compatible data types. More...
 
class  JDAQWriterObjectOutput< T, false >
 Implementation of object output for DAQ incompatible data types. More...
 
class  JDAQWriter
 Implementation of object output to binary file for single data type. More...
 
class  JDAQWriter< JTypeList< JHead_t, JTail_t > >
 Implementation of object output to binary file for multiple data types. More...
 
class  JDAQWriter< JTypeList< JHead_t, JNullType > >
 Terminator class of recursive JDAQWriter class. More...
 
class  JDAQFileWriter
 Object(s) writing to binary file (i.e. .dat). More...
 
class  JFileRecorder
 Object writing to file. More...
 
class  JFileScanner
 Object reading from file. More...
 
struct  JLimit
 Auxiliary class for defining the range of iterations of objects. More...
 
struct  JMeta
 Auxiliary class for ROOT I/O of application specific meta data. More...
 
struct  JMetaOld_t
 Type definition of old meta data. More...
 
class  JMonteCarloASCIIFileReader
 Template definition of Monte Carlo object reader for ASCII formatted file (i.e. '.evt') More...
 
class  JMonteCarloGZFileReader
 Template definition of Monte Carlo object reader for gzipped ASCII formatted file (i.e. '.gz') More...
 
class  JMonteCarloFileReader
 Template definition of Monte Carlo object reader. More...
 
class  JMonteCarloFileReader< Head, JFileReader_t >
 Template specialisation of JMonteCarloFileReader for Head. More...
 
class  JMonteCarloFileReader< Evt, JFileReader_t >
 Template specialisation of JMonteCarloFileReader for Event. More...
 
class  JMonteCarloASCIIFileReader< Head >
 Template implementation of Monte Carlo object reader for ASCII formatted file (i.e. '.evt') More...
 
class  JMonteCarloASCIIFileReader< Evt >
 Template implementation of Monte Carlo object reader for ASCII formatted file (i.e. '.evt') More...
 
class  JMonteCarloGZFileReader< Head >
 Template implementation of Monte Carlo object reader for gzipped ASCII formatted file (i.e. '.gz') More...
 
class  JMonteCarloGZFileReader< Evt >
 Template implementation of Monte Carlo object reader for gzipped ASCII formatted file (i.e. '.gz') More...
 
class  JMonteCarloStreamObjectOutput< Head >
 Template specialisation of JMonteCarloStreamObjectOutput for Head. More...
 
class  JMonteCarloStreamObjectOutput< Evt >
 Template specialisation of JMonteCarloStreamObjectOutput for Evt. More...
 
class  JMultipleFileScanner< Head >
 Template specialisation of JMultipleFileScanner for Monte Carlo header. More...
 
class  JMonteCarloStreamObjectOutput
 Template definition of Monte Carlo stream output for single data type. More...
 
class  JMonteCarloStreamObjectOutput< JTypeList< JHead_t, JTail_t > >
 Template specialisation of Monte Carlo stream object output for multiple data types. More...
 
class  JMonteCarloStreamObjectOutput< JTypeList< JHead_t, JNullType > >
 Terminator class of recursive JMonteCarloStreamObjectOutput class. More...
 
class  JMonteCarloFileWriter
 Object(s) writing to Monte Carlo ASCII file (i.e. .evt) More...
 
struct  JMultipleFileSampler
 Auxiliary class to sample from a list of files. More...
 
struct  JMultipleFileScanner_t
 Auxiliary base class for list of file names. More...
 
class  JMultipleFileScanner
 General purpose class for object reading from a list of file names. More...
 
class  JMultipleFileScanner< JNullType >
 Template specialisation of JMultipleFileScanner for undefined type. More...
 
class  JMultipleFileScanner< JTypeList< JHead_t, JTail_t > >
 Implementation of object reading for multiple data types from a list of file names. More...
 
class  JMultipleFileScanner< JTypeList< JHead_t, JNullType > >
 Terminator class of recursive JMultipleFileScanner class. More...
 
class  JParallelFileScanner
 General purpose class for parallel reading of objects from a single file or multiple files. More...
 
class  JParallelFileScanner< JTypeList< JHead_t, JTail_t >, JFileScanner_t >
 Template specialisation of JParallelFileScanner for multiple data types. More...
 
class  JParallelFileScanner< JTypeList< JHead_t, JNullType >, JFileScanner_t >
 Terminator class of recursive JParallelFileScanner class. More...
 
struct  JRandomSampler
 Template class for randomly sampling from a JLANG::JRewindableObjectIterator using a JLANG::JObjectSampler. More...
 
struct  JSingleFileScanner_t
 Auxiliary base class for file name. More...
 
class  JSingleFileScanner
 Object reading from a list of files. More...
 
class  JSingleFileScanner< JNullType >
 Template specialisation of JSingleFileScanner for undefined type. More...
 
class  JSingleFileScanner< JTypeList< JHead_t, JTail_t > >
 Template specialisation of JSingleFileScanner for single data types. More...
 
class  JSingleFileScanner< JTypeList< JHead_t, JNullType > >
 Terminator class of recursive JSingleFileScanner class. More...
 
class  JSummaryFileRouter
 File router for fast addressing of summary data. More...
 
class  JSummaryRouter
 Router for fast addressing of summary data in JDAQSummaryslice data structure as a function of the optical module identifier. More...
 
class  JTreeRecorder
 ROOT TTree object output. More...
 
class  JTreeScanner_t
 Base class for JTreeScanner. More...
 
struct  JTreeScanner
 Template definition for direct access of elements in ROOT TChain. More...
 
struct  JTreeScanner< JNullType, JNullType >
 Auxiliary base class for reporting messages. More...
 
class  JTreeScanner< JAssertConversion< JDerived_t, JBase_t >, JNullType >
 Specialiation of class JTreeScanner for unordered direct access of elements in ROOT TChain. More...
 
struct  JTreeScanner< JClass_t, JNullType >
 Specialiation of class JTreeScanner for unordered direct access of elements in ROOT TChain. More...
 
class  JTreeScanner< JAssertConversion< JDerived_t, JBase_t >, JEvaluator_t >
 Specialiation of class JTreeScanner for ordered direct access of elements in ROOT TChain. More...
 
struct  JTreeScannerInterface
 Auxiliary interface for direct access of elements in ROOT TChain. More...
 
struct  JTreeScannerInterface< JClass_t, JNullType >
 Specialiation of interface JTreeScannerInterface for unordered direct access of elements in ROOT TChain. More...
 
struct  JTriggeredFileScanner
 Auxiliary class to synchronously read DAQ events and Monte Carlo events (and optionally other events). More...
 
class  JMultipleFileScanner< JTriggerParameters >
 Template specialisation of JMultipleFileScanner for trigger parameters. More...
 

Typedefs

typedef JLimit JLimit_t
 Type definition of limit. More...
 
typedef JTOOLS::JRange< int > JFrameIndexRange
 Type definition for frame index range. More...
 
typedef JTOOLS::JRange
< JDAQUTCExtended
JDAQUTCTimeRange
 Type definition for DAQ UTC time range. More...
 

Functions

bool isROOTFile (const char *file_name)
 Check file format. More...
 
bool isDAQFile (const char *file_name)
 Check file format. More...
 
bool isMonteCarloFile (const char *file_name)
 Check file format. More...
 
bool isGzipFile (const char *file_name)
 Check file format. More...
 
const char * getName (const JType< JMeta > &type)
 Get ROOT name of given data type. More...
 
int getNumberOfCycles (TFile *file, const TString key)
 Get number of cycles of named objects with same title as given key. More...
 
void getObject (TFile *file, const char *key, JMeta *&ps)
 Read object from ROOT file. More...
 
bool putMeta (TDirectory *dir, const std::string key, const std::string buffer)
 Write meta data as ROOT TNamed object. More...
 
bool putObject (TDirectory *dir, const JMeta &meta)
 Write meta data to ROOT directory. More...
 
const char * getName (const JType< JMetaOld_t > &type)
 Get ROOT name of given data type. More...
 
void getObject (TFile *file, const char *key, JMetaOld_t *&ps)
 Read object from ROOT file. More...
 
bool putObject (TDirectory *dir, const JMetaOld_t &meta)
 Write meta data to ROOT directory. More...
 
Head getHeader (const JMultipleFileScanner_t &file_list)
 Get Monte Carlo header. More...
 
JMultipleFileScanner_t getAAnetFiles (const JMultipleFileScanner_t &input, const JHead &header, const bool option=false)
 Get list of files compatible with geven header. More...
 
double getTimeDuration (const JDAQUTCTimeRange &utc)
 Get time duration of given UTC time range. More...
 
template<class T >
int getRunNumber (const std::string &file_name)
 Get run number for given file name of data taking run. More...
 
template<class T >
JFrameIndexRange getFrameIndexRange (JTreeScanner< T, KM3NETDAQ::JDAQEvaluator > &in)
 Get range of frame indices. More...
 
template<class T >
JFrameIndexRange getFrameIndexRange (const std::string &file_name)
 Get range of frame indices for given file name of data taking run. More...
 
template<class T >
JDAQUTCTimeRange getUTCTimeRange (JTreeScanner< T, KM3NETDAQ::JDAQEvaluator > &in)
 Get UTC time range. More...
 
template<class T >
JDAQUTCTimeRange getUTCTimeRange (const std::string &file_name)
 Get UTC time range for given file name of data taking run. More...
 
template<class T >
JDAQUTCTimeRange getUTCTimeRange (T __begin, T __end)
 Get UTC time range for given file name of data taking run. More...
 
double getLivetime (const std::string &file_name)
 Get data taking live time. More...
 
template<class T >
double getLivetime (T __begin, T __end)
 Get data taking live time. More...
 
JTriggerParameters getTriggerParameters (const JMultipleFileScanner_t &file_list)
 Get trigger parameters. More...
 

Variables

static const char *const ROOT_FILE_FORMAT = "root"
 ROOT file name extension. More...
 
static const char *const DAQ_FILE_FORMAT = "dat"
 DAQ binary file name extension. More...
 
static const char *const MONTE_CARLO_FILE_FORMAT = "evt"
 ASCII file name extension. More...
 
static const char *const GZIP_FILE_FORMAT = "gz"
 gzip file name extension More...
 
static const char *const META_NAME = "JMeta"
 ROOT name for meta data. More...
 
static const char *const META_DIRECTORY = "META"
 ROOT sub-directory for meta data. More...
 
static const char *const application_t = "application"
 Definition of meta data parameters. More...
 
static const char *const SVNrelease_t = "SVN"
 SVN release. More...
 
static const char *const GITrelease_t = "GIT"
 GIT release. More...
 
static const char *const ROOTrelease_t = "ROOT"
 ROOT release. More...
 
static const char *const namespace_t = "namespace"
 name space More...
 
static const char *const command_t = "command"
 Linux command. More...
 
static const char *const system_t = "system"
 system information More...
 
static const char *const BRANCH_PATTERN = "vector"
 Pattern match for names of sub-branches that will not be read when ordering elements in a TTree. More...
 

Detailed Description

Support classes and methods for experiment specific I/O.

Author
mdejong

Typedef Documentation

Type definition of limit.

Definition at line 215 of file JLimit.hh.

Type definition for frame index range.

Definition at line 37 of file JSupportToolkit.hh.

Type definition for DAQ UTC time range.

Definition at line 42 of file JSupportToolkit.hh.

Function Documentation

bool JSUPPORT::isROOTFile ( const char *  file_name)
inline

Check file format.

Returns
true if ROOT format; else false

Definition at line 32 of file JFilenameSupportkit.hh.

33  {
34  return getFilenameExtension(file_name) == ROOT_FILE_FORMAT;
35  }
std::string getFilenameExtension(const std::string &file_name)
Get file name extension, i.e. part after last JEEP::FILENAME_SEPARATOR if any.
Definition: JeepToolkit.hh:69
static const char *const ROOT_FILE_FORMAT
ROOT file name extension.
bool JSUPPORT::isDAQFile ( const char *  file_name)
inline

Check file format.

Returns
true if DAQ format; else false

Definition at line 43 of file JFilenameSupportkit.hh.

44  {
45  return getFilenameExtension(file_name) == DAQ_FILE_FORMAT;
46  }
static const char *const DAQ_FILE_FORMAT
DAQ binary file name extension.
std::string getFilenameExtension(const std::string &file_name)
Get file name extension, i.e. part after last JEEP::FILENAME_SEPARATOR if any.
Definition: JeepToolkit.hh:69
bool JSUPPORT::isMonteCarloFile ( const char *  file_name)
inline

Check file format.

Returns
true if MONTE CARLO format; else false

Definition at line 54 of file JFilenameSupportkit.hh.

55  {
56  return getFilenameExtension(file_name) == MONTE_CARLO_FILE_FORMAT;
57  }
static const char *const MONTE_CARLO_FILE_FORMAT
ASCII file name extension.
std::string getFilenameExtension(const std::string &file_name)
Get file name extension, i.e. part after last JEEP::FILENAME_SEPARATOR if any.
Definition: JeepToolkit.hh:69
bool JSUPPORT::isGzipFile ( const char *  file_name)
inline

Check file format.

Returns
true if gzip format; else false

Definition at line 65 of file JFilenameSupportkit.hh.

66  {
67  return getFilenameExtension(file_name) == GZIP_FILE_FORMAT;
68  }
static const char *const GZIP_FILE_FORMAT
gzip file name extension
std::string getFilenameExtension(const std::string &file_name)
Get file name extension, i.e. part after last JEEP::FILENAME_SEPARATOR if any.
Definition: JeepToolkit.hh:69
const char* JSUPPORT::getName ( const JType< JMeta > &  type)
inline

Get ROOT name of given data type.

Parameters
typeJMeta type
Returns
name of object to be read

Definition at line 237 of file JMeta.hh.

238  {
239  return META_NAME;
240  }
static const char *const META_NAME
ROOT name for meta data.
Definition: JMeta.hh:47
int JSUPPORT::getNumberOfCycles ( TFile *  file,
const TString  key 
)
inline

Get number of cycles of named objects with same title as given key.

Parameters
filepointer to file
keyROOT key (including possible directory)
Returns
number of cycles

Definition at line 250 of file JMeta.hh.

251  {
252  using namespace std;
253 
254  int counter = 0;
255 
256  if (file != NULL) {
257 
258  TNamed* __p = NULL;
259 
260  file->GetObject(key, __p);
261 
262  if (__p != NULL) {
263 
264  ++counter;
265 
266  const TString title = __p->GetTitle();
267 
268  string buffer(key);
269 
270  const string::size_type pos = buffer.find(';');
271 
272  if (pos != string::npos) {
273 
274  int cycle = -1;
275 
276  istringstream(buffer.substr(pos + 1)) >> cycle;
277 
278  buffer = buffer.substr(0, pos);
279 
280  for (int i = 1; i < cycle; ++i) {
281 
282  file->GetObject(MAKE_CSTRING(buffer << ';' << i), __p);
283 
284  if (__p != NULL && __p->GetTitle() == title) {
285  ++counter;
286  }
287  }
288  }
289  }
290  }
291 
292  return counter;
293  }
#define MAKE_CSTRING(A)
Make C-string.
Definition: JPrint.hh:708
void JSUPPORT::getObject ( TFile *  file,
const char *  key,
JMeta *&  ps 
)
inline

Read object from ROOT file.

Parameters
filepointer to file
keykey of object to be read
pspointer to object

Definition at line 303 of file JMeta.hh.

304  {
305  using namespace std;
306  using namespace JPP;
307 
308  if (ps != NULL) {
309 
310  delete ps;
311 
312  ps = NULL;
313  }
314 
315  if (file != NULL) {
316 
317  const int number_of_cycles = getNumberOfCycles(file, MAKE_CSTRING(META_DIRECTORY << '/' << key));
318 
319  if (number_of_cycles != 0) {
320 
321  TNamed* __p = NULL;
322 
323  file->GetObject(MAKE_CSTRING(META_DIRECTORY << '/' << key), __p);
324 
325  ps = new JMeta();
326 
327  (*ps)[application_t] = __p->GetTitle();
328 
329  file->GetObject(MAKE_CSTRING(META_DIRECTORY << '/' << (*ps)[application_t] << ';' << number_of_cycles), __p);
330 
331  if (__p != NULL) {
332  *ps = JMeta::valueOf(__p->GetTitle());
333  }
334  }
335  }
336  }
Auxiliary class for ROOT I/O of application specific meta data.
Definition: JMeta.hh:71
static const char *const application_t
Definition of meta data parameters.
Definition: JMeta.hh:59
#define MAKE_CSTRING(A)
Make C-string.
Definition: JPrint.hh:708
int getNumberOfCycles(TFile *file, const TString key)
Get number of cycles of named objects with same title as given key.
Definition: JMeta.hh:250
static const char *const META_DIRECTORY
ROOT sub-directory for meta data.
Definition: JMeta.hh:53
bool JSUPPORT::putMeta ( TDirectory *  dir,
const std::string  key,
const std::string  buffer 
)
inline

Write meta data as ROOT TNamed object.

Parameters
dirpointer to directory
keyROOT key
bufferuser data
Returns
true if OK; else false

Definition at line 347 of file JMeta.hh.

348  {
349  static TNamed object;
350 
351  if (dir != NULL) {
352 
353  if (dir->GetListOfKeys()->FindObject(META_DIRECTORY) == NULL) {
354  dir->mkdir(META_DIRECTORY);
355  }
356 
357  dir = dir->GetDirectory(META_DIRECTORY);
358 
359  object.SetName (key.c_str()); // ROOT key
360  object.SetTitle(buffer.c_str()); // user data
361 
362  return (dir->WriteTObject(&object) > 0);
363  }
364 
365  return false;
366  }
static const char *const META_DIRECTORY
ROOT sub-directory for meta data.
Definition: JMeta.hh:53
bool JSUPPORT::putObject ( TDirectory *  dir,
const JMeta meta 
)
inline

Write meta data to ROOT directory.

Parameters
dirpointer to directory
metameta data
Returns
true if OK; else false

Definition at line 376 of file JMeta.hh.

377  {
378  JMeta::const_iterator p = meta.find(application_t);
379 
380  if (p != meta.end()) {
381  if (putMeta(dir, getName(JType<JMeta>()), p->second)) {
382  return putMeta(dir, p->second, meta.toString());
383  }
384  }
385 
386  return false;
387  }
static const char *const application_t
Definition of meta data parameters.
Definition: JMeta.hh:59
std::string toString() const
Convert meta data to string.
Definition: JMeta.hh:188
bool putMeta(TDirectory *dir, const std::string key, const std::string buffer)
Write meta data as ROOT TNamed object.
Definition: JMeta.hh:347
const char * getName()
Get ROOT name of given data type.
Definition: JRootToolkit.hh:53
const char* JSUPPORT::getName ( const JType< JMetaOld_t > &  type)
inline

Get ROOT name of given data type.

Parameters
typeJMetaOld_t type
Returns
name of object to be read

Definition at line 423 of file JMeta.hh.

424  {
425  return META_NAME;
426  }
static const char *const META_NAME
ROOT name for meta data.
Definition: JMeta.hh:47
void JSUPPORT::getObject ( TFile *  file,
const char *  key,
JMetaOld_t *&  ps 
)
inline

Read object from ROOT file.

Parameters
filepointer to file
keykey of object to be read
pspointer to object

< application name

< SVN release

< ROOT release

< name space

< Linux command

< system information

< number of items

Definition at line 436 of file JMeta.hh.

437  {
438  enum JParameter_t {
439  JApplication_t = 0, //!< application name
440  JSVNRelease_t, //!< SVN release
441  JROOTRelease_t, //!< ROOT release
442  JNamespace_t, //!< name space
443  JCommand_t, //!< Linux command
444  JSystem_t, //!< system information
445  number_of_items //!< number of items
446  };
447 
448  const char* buffer[number_of_items] = {
450  SVNrelease_t,
452  namespace_t,
453  command_t,
454  system_t
455  };
456 
457  if (ps != NULL) {
458 
459  delete ps;
460 
461  ps = NULL;
462  }
463 
464  if (file != NULL) {
465 
466  const int number_of_cycles = getNumberOfCycles(file, key);
467 
468  if (number_of_cycles != 0) {
469 
470  TNamed* __p = NULL;
471 
472  file->GetObject(key, __p);
473 
474  ps = new JMetaOld_t();
475 
476  (*ps)[application_t] = __p->GetTitle();
477 
478  for (int i = 1; i != number_of_items; ++i) {
479 
480  file->GetObject(MAKE_CSTRING((*ps)[application_t] << ';' << ((number_of_cycles - 1) * (number_of_items - 1) + i)), __p);
481 
482  if (__p != NULL)
483  (*ps)[buffer[i]] = __p->GetTitle();
484  else
485  break;
486  }
487  }
488  }
489  }
static const char *const application_t
Definition of meta data parameters.
Definition: JMeta.hh:59
#define MAKE_CSTRING(A)
Make C-string.
Definition: JPrint.hh:708
static const char *const ROOTrelease_t
ROOT release.
Definition: JMeta.hh:62
static const char *const SVNrelease_t
SVN release.
Definition: JMeta.hh:60
static const char *const system_t
system information
Definition: JMeta.hh:65
static const char *const namespace_t
name space
Definition: JMeta.hh:63
Type definition of old meta data.
Definition: JMeta.hh:414
static const char *const command_t
Linux command.
Definition: JMeta.hh:64
int getNumberOfCycles(TFile *file, const TString key)
Get number of cycles of named objects with same title as given key.
Definition: JMeta.hh:250
bool JSUPPORT::putObject ( TDirectory *  dir,
const JMetaOld_t meta 
)
inline

Write meta data to ROOT directory.

Parameters
dirpointer to directory
metameta data
Returns
true if OK; else false

Definition at line 499 of file JMeta.hh.

500  {
501  return putObject(dir, static_cast<const JMeta&>(meta));
502  }
bool putObject(TDirectory *dir, const T &object)
Write object to ROOT directory.
Head JSUPPORT::getHeader ( const JMultipleFileScanner_t file_list)
inline

Get Monte Carlo header.

Parameters
file_listfile list
Returns
Monte Carlo header

Definition at line 458 of file JMonteCarloFileSupportkit.hh.

459  {
460  return JMultipleFileScanner<Head>(file_list).getHeader();
461  }
Head getHeader(const JMultipleFileScanner_t &file_list)
Get Monte Carlo header.
Template specialisation of JMultipleFileScanner for Monte Carlo header.
JMultipleFileScanner_t JSUPPORT::getAAnetFiles ( const JMultipleFileScanner_t input,
const JHead header,
const bool  option = false 
)

Get list of files compatible with geven header.

Note that the option corresponds to that of method JHead::match.

Parameters
inputfile list
headerheader
optionoption
Returns
file list

Definition at line 474 of file JMonteCarloFileSupportkit.hh.

477  {
478  using namespace JPP;
479 
481 
482  for (JMultipleFileScanner_t::const_iterator i = input.begin(); i != input.end(); ++i) {
483  try {
484  if (JHead(getHeader(*i)).match(header, option)) {
485  result.push_back(*i);
486  }
487  }
488  catch(std::exception&) {}
489  }
490 
491  return result;
492  }
Head getHeader(const JMultipleFileScanner_t &file_list)
Get Monte Carlo header.
return result
Definition: JPolint.hh:695
Monte Carlo run header.
Definition: JHead.hh:836
Auxiliary base class for list of file names.
bool match(const JHead &header, const bool option=true) const
Test match of headers.
Definition: JHead.hh:991
double JSUPPORT::getTimeDuration ( const JDAQUTCTimeRange utc)
inline

Get time duration of given UTC time range.

Parameters
utcUTC time range
Returns
time duration [s]

Definition at line 51 of file JSupportToolkit.hh.

52  {
53  if (utc.is_valid())
54  return (utc.getUpperLimit().getTimeNanoSecond() -
55  utc.getLowerLimit().getTimeNanoSecond()) * 1.0e-9;
56  else
57  return 0.0;
58  }
T getLowerLimit() const
Get lower limit.
Definition: JRange.hh:215
T getUpperLimit() const
Get upper limit.
Definition: JRange.hh:226
bool is_valid() const
Check validity of range.
Definition: JRange.hh:324
template<class T >
int JSUPPORT::getRunNumber ( const std::string &  file_name)
inline

Get run number for given file name of data taking run.

Parameters
file_namefile name
Returns
run number

Definition at line 68 of file JSupportToolkit.hh.

69  {
70  JFileScanner<T> in(file_name.c_str());
71 
72  if (in.hasNext())
73  return in.next()->getRunNumber();
74  else
75  return -1;
76  }
esac print_variable DETECTOR INPUT_FILE OUTPUT_FILE CDF for TYPE in
Definition: JSirene.sh:45
Object reading from file.
Definition: JFileScanner.hh:36
template<class T >
JFrameIndexRange JSUPPORT::getFrameIndexRange ( JTreeScanner< T, KM3NETDAQ::JDAQEvaluator > &  in)
inline

Get range of frame indices.

Parameters
inTTree scanner
Returns
frame index range

Definition at line 86 of file JSupportToolkit.hh.

87  {
88  if (!in.empty())
89  return JFrameIndexRange(in.begin()->getFrameIndex(), in.rbegin()->getFrameIndex());
90  else
91  return JFrameIndexRange(0,0);
92  }
JTOOLS::JRange< int > JFrameIndexRange
Type definition for frame index range.
template<class T >
JFrameIndexRange JSUPPORT::getFrameIndexRange ( const std::string &  file_name)
inline

Get range of frame indices for given file name of data taking run.

Parameters
file_namefile name
Returns
frame index range

Definition at line 102 of file JSupportToolkit.hh.

103  {
104  JFrameIndexRange result(JFrameIndexRange::DEFAULT_RANGE);
105 
106  TDirectory*& dir = TDirectory::CurrentDirectory();
107 
108  if (isROOTFile(file_name.c_str())) {
109 
111 
112  return getFrameIndexRange(in);
113 
114  } else {
115 
116  JFileScanner<T> in(file_name.c_str());
117 
118  while (in.hasNext()) {
119  result.include(in.next()->getFrameIndex());
120  }
121  }
122 
123  if (dir != NULL) {
124  dir->cd(); // restore current working directory
125  }
126 
127  return result;
128  }
esac print_variable DETECTOR INPUT_FILE OUTPUT_FILE CDF for TYPE in
Definition: JSirene.sh:45
Template definition for direct access of elements in ROOT TChain.
Definition: JTreeScanner.hh:91
bool isROOTFile(const char *file_name)
Check file format.
return result
Definition: JPolint.hh:695
Object reading from file.
Definition: JFileScanner.hh:36
JFrameIndexRange getFrameIndexRange(JTreeScanner< T, KM3NETDAQ::JDAQEvaluator > &in)
Get range of frame indices.
template<class T >
JDAQUTCTimeRange JSUPPORT::getUTCTimeRange ( JTreeScanner< T, KM3NETDAQ::JDAQEvaluator > &  in)
inline

Get UTC time range.

Parameters
inTTree scanner
Returns
UTC time range

Definition at line 138 of file JSupportToolkit.hh.

139  {
140  if (!in.empty())
141  return JDAQUTCTimeRange(in.begin()->getTimesliceStart(), in.rbegin()->getTimesliceStart());
142  else
144  }
Data structure for UTC time.
JTOOLS::JRange< JDAQUTCExtended > JDAQUTCTimeRange
Type definition for DAQ UTC time range.
template<class T >
JDAQUTCTimeRange JSUPPORT::getUTCTimeRange ( const std::string &  file_name)
inline

Get UTC time range for given file name of data taking run.

Parameters
file_namefile name
Returns
UTC time range

Definition at line 154 of file JSupportToolkit.hh.

155  {
156  JDAQUTCTimeRange result(JDAQUTCTimeRange::DEFAULT_RANGE);
157 
158  TDirectory*& dir = TDirectory::CurrentDirectory();
159 
160  if (isROOTFile(file_name.c_str())) {
161 
163 
165 
166  } else {
167 
168  for (JFileScanner<T> in(file_name.c_str()); in.hasNext(); ) {
169  result.include(in.next()->getTimesliceStart());
170  }
171  }
172 
173  if (dir != NULL) {
174  dir->cd(); // restore current working directory
175  }
176 
177  return result;
178  }
esac print_variable DETECTOR INPUT_FILE OUTPUT_FILE CDF for TYPE in
Definition: JSirene.sh:45
Template definition for direct access of elements in ROOT TChain.
Definition: JTreeScanner.hh:91
JDAQUTCTimeRange getUTCTimeRange(JTreeScanner< T, KM3NETDAQ::JDAQEvaluator > &in)
Get UTC time range.
bool isROOTFile(const char *file_name)
Check file format.
return result
Definition: JPolint.hh:695
Range of values.
Definition: JRange.hh:34
Object reading from file.
Definition: JFileScanner.hh:36
template<class T >
JDAQUTCTimeRange JSUPPORT::getUTCTimeRange ( T  __begin,
T  __end 
)
inline

Get UTC time range for given file name of data taking run.

Get data taking live time.

Parameters
__beginbegin of file list
__endend of file list
Returns
UTC time range

Definition at line 190 of file JSupportToolkit.hh.

191  {
192  JDAQUTCTimeRange result(JDAQUTCTimeRange::DEFAULT_RANGE);
193 
194  for (T i = __begin; i != __end; ++i) {
195  result.combine(getUTCTimeRange<KM3NETDAQ::JDAQSummaryslice>(*i));
196  }
197 
198  return result;
199  }
return result
Definition: JPolint.hh:695
do set_variable OUTPUT_DIRECTORY $WORKDIR T
Range of values.
Definition: JRange.hh:34
double JSUPPORT::getLivetime ( const std::string &  file_name)
inline

Get data taking live time.

Parameters
file_namefile name
Returns
live time [s]

Definition at line 208 of file JSupportToolkit.hh.

209  {
210  using namespace KM3NETDAQ;
211  using namespace JTRIGGER;
212 
213  TDirectory*& dir = TDirectory::CurrentDirectory();
214 
215  double livetime = 0.0;
216 
217  try {
218 
220 
221  if (parameters.writeSummary.prescale != 0) {
222 
224 
225  livetime = in.getEntries() * getFrameTime() * 1.0e-9 / parameters.writeSummary.prescale;
226  }
227  }
228  catch(const std::exception& error) {}
229 
230  if (dir != NULL) {
231  dir->cd(); // restore current working directory
232  }
233 
234  return livetime;
235  }
esac print_variable DETECTOR INPUT_FILE OUTPUT_FILE CDF for TYPE in
Definition: JSirene.sh:45
*fatal Wrong number of arguments esac JCookie sh typeset Z DETECTOR typeset Z SOURCE_RUN typeset Z TARGET_RUN set_variable PARAMETERS_FILE $WORKDIR parameters
Definition: diff-Tuna.sh:38
Template definition for direct access of elements in ROOT TChain.
Definition: JTreeScanner.hh:91
double getFrameTime()
Get frame time duration.
Definition: JDAQClock.hh:162
Normalisation of MUPAGE events.
Definition: JHead.hh:604
JTriggerParameters getTriggerParameters(const JMultipleFileScanner_t &file_list)
Get trigger parameters.
template<class T >
double JSUPPORT::getLivetime ( T  __begin,
T  __end 
)
inline

Get data taking live time.

Parameters
__beginbegin of file list
__endend of file list
Returns
live time [s]

Definition at line 246 of file JSupportToolkit.hh.

247  {
248  double livetime = 0.0;
249 
250  for (T i = __begin; i != __end; ++i) {
251  livetime += getLivetime(*i);
252  }
253 
254  return livetime;
255  }
do set_variable OUTPUT_DIRECTORY $WORKDIR T
Normalisation of MUPAGE events.
Definition: JHead.hh:604
double getLivetime(const std::string &file_name)
Get data taking live time.
JTriggerParameters JSUPPORT::getTriggerParameters ( const JMultipleFileScanner_t file_list)
inline

Get trigger parameters.

Parameters
file_listfile list
Returns
trigger parameters

Definition at line 148 of file JTriggerParametersSupportkit.hh.

149  {
151  }
Template specialisation of JMultipleFileScanner for trigger parameters.
JTriggerParameters getTriggerParameters(const JMultipleFileScanner_t &file_list)
Get trigger parameters.

Variable Documentation

const char* const JSUPPORT::ROOT_FILE_FORMAT = "root"
static

ROOT file name extension.

Definition at line 21 of file JFilenameSupportkit.hh.

const char* const JSUPPORT::DAQ_FILE_FORMAT = "dat"
static

DAQ binary file name extension.

Definition at line 22 of file JFilenameSupportkit.hh.

const char* const JSUPPORT::MONTE_CARLO_FILE_FORMAT = "evt"
static

ASCII file name extension.

Definition at line 23 of file JFilenameSupportkit.hh.

const char* const JSUPPORT::GZIP_FILE_FORMAT = "gz"
static

gzip file name extension

Definition at line 24 of file JFilenameSupportkit.hh.

const char* const JSUPPORT::META_NAME = "JMeta"
static

ROOT name for meta data.

Definition at line 47 of file JMeta.hh.

const char* const JSUPPORT::META_DIRECTORY = "META"
static

ROOT sub-directory for meta data.

Definition at line 53 of file JMeta.hh.

const char* const JSUPPORT::application_t = "application"
static

Definition of meta data parameters.

application name

Definition at line 59 of file JMeta.hh.

const char* const JSUPPORT::SVNrelease_t = "SVN"
static

SVN release.

Definition at line 60 of file JMeta.hh.

const char* const JSUPPORT::GITrelease_t = "GIT"
static

GIT release.

Definition at line 61 of file JMeta.hh.

const char* const JSUPPORT::ROOTrelease_t = "ROOT"
static

ROOT release.

Definition at line 62 of file JMeta.hh.

const char* const JSUPPORT::namespace_t = "namespace"
static

name space

Definition at line 63 of file JMeta.hh.

const char* const JSUPPORT::command_t = "command"
static

Linux command.

Definition at line 64 of file JMeta.hh.

const char* const JSUPPORT::system_t = "system"
static

system information

Definition at line 65 of file JMeta.hh.

const char* const JSUPPORT::BRANCH_PATTERN = "vector"
static

Pattern match for names of sub-branches that will not be read when ordering elements in a TTree.

Definition at line 42 of file JTreeScanner.hh.