Jpp test-rotations-old
the software that should make you happy
Loading...
Searching...
No Matches
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, false >
 Template specialisation of JDAQFileReader for DAQ incompatible data types. More...
 
class  JDAQFileReader< T, true >
 Template specialisation of JDAQFileReader for DAQ compatible data types. More...
 
class  JDAQFileWriter
 Object(s) writing to binary file (i.e. .dat). More...
 
class  JDAQWriter
 Implementation of object output to binary file for single data type. More...
 
class  JDAQWriter< JTypeList< JHead_t, JNullType > >
 Terminator class of recursive JDAQWriter class. More...
 
class  JDAQWriter< JTypeList< JHead_t, JTail_t > >
 Implementation of object output to binary file for multiple data types. More...
 
class  JDAQWriterObjectOutput
 Auxiliary class for DAQ object writing to binary stream. More...
 
class  JDAQWriterObjectOutput< T, false >
 Implementation of object output for DAQ incompatible data types. More...
 
class  JDAQWriterObjectOutput< T, true >
 Implementation of object output for DAQ compatible data types. More...
 
struct  JEvtWeightFileScanner
 Template event-weighter-associated file scanner. More...
 
struct  JEvtWeightFileScannerSet
 Auxiliary class for organising Monte Carlo file scanners associated with event weighters. More...
 
class  JFileRecorder
 Object writing to file. More...
 
class  JFileScanner
 Object reading from file. More...
 
struct  JHeadSet
 Auxiliary class for organising Monte Carlo run headers. 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  JMonteCarloASCIIFileReader< Evt >
 Template implementation of Monte Carlo object reader for ASCII formatted file (i.e. '.evt') More...
 
class  JMonteCarloASCIIFileReader< Head >
 Template implementation of Monte Carlo object reader for ASCII formatted file (i.e. '.evt') More...
 
class  JMonteCarloFileReader
 Template definition of Monte Carlo object reader. More...
 
class  JMonteCarloFileReader< Evt, JFileReader_t >
 Template specialisation of JMonteCarloFileReader for Event. More...
 
class  JMonteCarloFileReader< Head, JFileReader_t >
 Template specialisation of JMonteCarloFileReader for Head. More...
 
class  JMonteCarloFileWriter
 Object(s) writing to Monte Carlo ASCII file (i.e. .evt) More...
 
class  JMonteCarloGZFileReader
 Template definition 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  JMonteCarloGZFileReader< Head >
 Template implementation of Monte Carlo object reader for gzipped ASCII formatted file (i.e. '.gz') More...
 
class  JMonteCarloStreamObjectOutput
 Template definition of Monte Carlo stream output for single data type. More...
 
class  JMonteCarloStreamObjectOutput< Evt >
 Template specialisation of JMonteCarloStreamObjectOutput for Evt. More...
 
class  JMonteCarloStreamObjectOutput< Head >
 Template specialisation of JMonteCarloStreamObjectOutput for Head. More...
 
class  JMonteCarloStreamObjectOutput< JTypeList< JHead_t, JNullType > >
 Terminator class of recursive JMonteCarloStreamObjectOutput class. More...
 
class  JMonteCarloStreamObjectOutput< JTypeList< JHead_t, JTail_t > >
 Template specialisation of Monte Carlo stream object output for multiple data types. More...
 
struct  JMultipleFileSampler
 Auxiliary class to sample from a list of files. More...
 
struct  JMultipleFileSampler_t
 Auxiliary base class to sample from a list of files. More...
 
class  JMultipleFileScanner
 General purpose class for object reading from a list of file names. More...
 
class  JMultipleFileScanner< Head >
 Template specialisation of JMultipleFileScanner for Monte Carlo header. More...
 
class  JMultipleFileScanner< JNullType >
 Template specialisation of JMultipleFileScanner for undefined type. More...
 
class  JMultipleFileScanner< JTriggerParameters >
 Template specialisation of JMultipleFileScanner for trigger parameters. More...
 
class  JMultipleFileScanner< JTypeList< JHead_t, JNullType > >
 Terminator class of recursive JMultipleFileScanner class. More...
 
class  JMultipleFileScanner< JTypeList< JHead_t, JTail_t > >
 Implementation of object reading for multiple data types from a list of file names. More...
 
struct  JMultipleFileScanner_t
 Auxiliary base class for list of file names. More...
 
struct  JMultiplexDAQUTCTimeRange
 Auxiliary class to extract UTC time range for list of data types. More...
 
class  JParallelFileScanner
 General purpose class for parallel reading of objects from a single file or multiple files. More...
 
class  JParallelFileScanner< JTypeList< JHead_t, JNullType >, JFileScanner_t >
 Terminator class of recursive JParallelFileScanner class. More...
 
class  JParallelFileScanner< JTypeList< JHead_t, JTail_t >, JFileScanner_t >
 Template specialisation of JParallelFileScanner for multiple data types. More...
 
struct  JRandomSampler
 Template class for randomly sampling from a JLANG::JRewindableObjectIterator using a JLANG::JObjectSampler. More...
 
struct  JRunByRun
 Auxiliary class to select summary data (KM3NETDAQ::JDAQSummaryslice) from the specified raw data file(s). 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, JNullType > >
 Terminator class of recursive JSingleFileScanner class. More...
 
class  JSingleFileScanner< JTypeList< JHead_t, JTail_t > >
 Template specialisation of JSingleFileScanner for single data types. More...
 
struct  JSingleFileScanner_t
 Auxiliary base class for file name. More...
 
class  JSummaryFileRouter
 File router for fast addressing of summary data. More...
 
class  JSummaryRouter
 Router for fast addressing of summary data in KM3NETDAQ::JDAQSummaryslice data structure as a function of the optical module identifier and PMT address. More...
 
class  JTreeRecorder
 ROOT TTree object output. More...
 
struct  JTreeSampler
 Auxiliary class to sample from a list of files. More...
 
class  JTreeScanner
 Template definition for direct access of elements in ROOT TChain. More...
 
class  JTreeScanner< JAssertConversion< JDerived_t, JBase_t >, JEvaluator_t >
 Specialisation of class JTreeScanner for ordered direct access of elements in ROOT TChain. More...
 
class  JTreeScanner< JAssertConversion< JDerived_t, JBase_t >, JNullType >
 Specialiation of class JTreeScanner for unordered direct access of elements in ROOT TChain. More...
 
class  JTreeScanner< JClass_t, JNullType >
 Specialiation of class JTreeScanner for unordered direct access of elements in ROOT TChain. More...
 
class  JTreeScanner< JNullType, JNullType >
 Auxiliary base class for reporting messages. More...
 
class  JTreeScanner_t
 Base class for JTreeScanner. More...
 
class  JTreeScannerInterface
 Auxiliary interface for direct access of elements in ROOT TChain. More...
 
class  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...
 

Typedefs

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

Functions

bool isROOTFile (const char *file_name)
 Check file format.
 
bool isJSONFile (const char *file_name)
 Check file format.
 
bool isDAQFile (const char *file_name)
 Check file format.
 
bool isJppFile (const char *file_name)
 Check file format.
 
bool isMonteCarloFile (const char *file_name)
 Check file format.
 
bool isGzipFile (const char *file_name)
 Check file format.
 
const char * getName (const JType< JMeta > &type)
 Get ROOT name of given data type.
 
int getNumberOfCycles (TFile *file, const TString &key)
 Get number of cycles of named objects with same title as given key.
 
void getObject (TFile *file, const TString &key, JMeta *&ps)
 Read object from ROOT file.
 
bool putMeta (TDirectory &dir, const std::string &key, const std::string &buffer)
 Write meta data as ROOT TNamed object.
 
bool putObject (TDirectory &dir, const JMeta &meta)
 Write meta data to ROOT directory.
 
bool putObject (TDirectory *dir, const JMeta &meta)
 Write meta data to ROOT directory.
 
TFile & operator<< (TFile &file, const JMeta &meta)
 Write meta data to ROOT file.
 
const char * getName (const JType< JMetaOld_t > &type)
 Get ROOT name of given data type.
 
void getObject (TFile *file, const TString &key, JMetaOld_t *&ps)
 Read object from ROOT file.
 
bool putObject (TDirectory &dir, const JMetaOld_t &meta)
 Write old meta data to ROOT directory in new format.
 
Head getHeader (const JMultipleFileScanner_t &file_list)
 Get Monte Carlo header.
 
Head getCommonHeader (const JMultipleFileScanner_t &file_list)
 Get common Monte Carlo header.
 
JMultiHead getMultiHeader (const JMultipleFileScanner_t &file_list)
 Get multi-header corresponding to a given file list.
 
template<class JFunction_t >
JMultipleFileScanner_t getAAnetFiles (const JMultipleFileScanner_t &input, JFunction_t test)
 Get list of files compatible with geven header.
 
JAANET::JEvtCategorySet getCategories (const JMultipleFileScanner_t &file_list)
 Get the unique event categories corresponding to a given list of MC files.
 
double getTimeDuration (const JDAQUTCTimeRange &utc)
 Get time duration of given UTC time range.
 
template<class T >
int getRunNumber (const std::string &file_name)
 Get run number for given file name of data taking run.
 
template<class T >
JFrameIndexRange getFrameIndexRange (JTreeScannerInterface< T, KM3NETDAQ::JDAQEvaluator > &in)
 Get range of frame indices.
 
template<class T >
JFrameIndexRange getFrameIndexRange (const std::string &file_name)
 Get range of frame indices for given file name of data taking run.
 
JDAQUTCTimeRange getUTCTimeRange ()
 Get UTC time range.
 
template<class T >
JDAQUTCTimeRange getUTCTimeRange (JTreeScannerInterface< T, KM3NETDAQ::JDAQEvaluator > &in)
 Get UTC time range.
 
template<class T >
JDAQUTCTimeRange getUTCTimeRange (const std::string &file_name)
 Get UTC time range for given file name of data taking run.
 
template<class T >
JDAQUTCTimeRange getUTCTimeRange (T __begin, T __end)
 Get UTC time range for given file names of data taking runs.
 
double getLivetime (const std::string &file_name)
 Get data taking live time.
 
template<class T >
double getLivetime (T __begin, T __end)
 Get data taking live time.
 
double getLivetime (const JMultipleFileScanner_t &file_list)
 Get data taking live time.
 
JTriggerParameters getTriggerParameters (const JMultipleFileScanner_t &file_list)
 Get trigger parameters.
 

Variables

static const char *const ROOT_FILE_FORMAT = "root"
 file name extension ROOT format
 
static const char *const JSON_FILE_FORMAT = "json"
 file name extension JSON format
 
static const char *const DAQ_FILE_FORMAT = "dat"
 file name extension DAQ binary format
 
static const char *const JPP_FILE_FORMAT = "jpp"
 file name extension Jpp binary format
 
static const char *const MONTE_CARLO_FILE_FORMAT = "evt"
 file name extension ASCII format
 
static const char *const GZIP_FILE_FORMAT = "gz"
 file name extension gzip format
 
static const char *const ASCII_FILE_FORMAT = "txt"
 file name extension ASCII format
 
static const char *const FILE_LIST_FORMAT = "files"
 file name extension ASCII format with list of file names
 
static const char *const META_NAME = "JMeta"
 ROOT name for meta data.
 
static const char *const META_DIRECTORY = "META"
 ROOT sub-directory for meta data.
 
static const char *const application_t = "application"
 Definition of meta data parameters.
 
static const char *const SVNrelease_t = "SVN"
 SVN release.
 
static const char *const GITrelease_t = "GIT"
 GIT release.
 
static const char *const ROOTrelease_t = "ROOT"
 ROOT release.
 
static const char *const namespace_t = "namespace"
 name space
 
static const char *const command_t = "command"
 Linux command.
 
static const char *const system_t = "system"
 system information
 
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.
 

Detailed Description

Support classes and methods for experiment specific I/O.

Author
mdejong
bjung

Typedef Documentation

◆ JLimit_t

Type definition of limit.

Definition at line 226 of file JLimit.hh.

◆ JFrameIndexRange

Type definition for frame index range.

Definition at line 46 of file JSupportToolkit.hh.

◆ JDAQUTCTimeRange

Type definition for DAQ UTC time range.

Definition at line 51 of file JSupportToolkit.hh.

Function Documentation

◆ isROOTFile()

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

Check file format.

Returns
true if ROOT format; else false

Definition at line 36 of file JFilenameSupportkit.hh.

37 {
38 return getFilenameExtension(file_name) == ROOT_FILE_FORMAT;
39 }
static const char *const ROOT_FILE_FORMAT
file name extension ROOT format

◆ isJSONFile()

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

Check file format.

Returns
true if ROOT format; else false

Definition at line 47 of file JFilenameSupportkit.hh.

48 {
49 return getFilenameExtension(file_name) == JSON_FILE_FORMAT;
50 }
static const char *const JSON_FILE_FORMAT
file name extension JSON format

◆ isDAQFile()

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

Check file format.

Returns
true if DAQ format; else false

Definition at line 58 of file JFilenameSupportkit.hh.

59 {
60 return getFilenameExtension(file_name) == DAQ_FILE_FORMAT;
61 }
static const char *const DAQ_FILE_FORMAT
file name extension DAQ binary format

◆ isJppFile()

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

Check file format.

Returns
true if Jpp format; else false

Definition at line 69 of file JFilenameSupportkit.hh.

70 {
71 return getFilenameExtension(file_name) == JPP_FILE_FORMAT;
72 }
static const char *const JPP_FILE_FORMAT
file name extension Jpp binary format

◆ isMonteCarloFile()

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

Check file format.

Returns
true if MONTE CARLO format; else false

Definition at line 80 of file JFilenameSupportkit.hh.

81 {
82 return getFilenameExtension(file_name) == MONTE_CARLO_FILE_FORMAT;
83 }
static const char *const MONTE_CARLO_FILE_FORMAT
file name extension ASCII format

◆ isGzipFile()

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

Check file format.

Returns
true if gzip format; else false

Definition at line 91 of file JFilenameSupportkit.hh.

92 {
93 return getFilenameExtension(file_name) == GZIP_FILE_FORMAT;
94 }
static const char *const GZIP_FILE_FORMAT
file name extension gzip format

◆ getName() [1/2]

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 236 of file JMeta.hh.

237 {
238 return META_NAME;
239 }
static const char *const META_NAME
ROOT name for meta data.
Definition JMeta.hh:46

◆ getNumberOfCycles()

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 249 of file JMeta.hh.

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

◆ getObject() [1/2]

void JSUPPORT::getObject ( TFile * file,
const TString & 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 302 of file JMeta.hh.

303 {
304 using namespace std;
305 using namespace JPP;
306
307 if (ps != NULL) {
308
309 delete ps;
310
311 ps = NULL;
312 }
313
314 if (file != NULL) {
315
316 const int number_of_cycles = getNumberOfCycles(file, MAKE_CSTRING(META_DIRECTORY << '/' << key));
317
318 if (number_of_cycles != 0) {
319
320 TNamed* __p = NULL;
321
322 file->GetObject(MAKE_CSTRING(META_DIRECTORY << '/' << key), __p);
323
324 ps = new JMeta();
325
326 (*ps)[application_t] = __p->GetTitle();
327
328 file->GetObject(MAKE_CSTRING(META_DIRECTORY << '/' << (*ps)[application_t] << ';' << number_of_cycles), __p);
329
330 if (__p != NULL) {
331 *ps = JMeta::valueOf(__p->GetTitle());
332 }
333 }
334 }
335 }
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary class for ROOT I/O of application specific meta data.
Definition JMeta.hh:72

◆ putMeta()

bool JSUPPORT::putMeta ( TDirectory & dir,
const std::string & key,
const std::string & buffer )
inline

Write meta data as ROOT TNamed object.

Parameters
dirdirectory
keyROOT key
bufferuser data
Returns
true if OK; else false

Definition at line 346 of file JMeta.hh.

347 {
348 static TNamed object;
349
350 if (dir.GetListOfKeys()->FindObject(META_DIRECTORY) == NULL) {
351 dir.mkdir(META_DIRECTORY);
352 }
353
354 TDirectory* p = dir.GetDirectory(META_DIRECTORY);
355
356 object.SetName (key.c_str()); // ROOT key
357 object.SetTitle(buffer.c_str()); // user data
358
359 return (p->WriteTObject(&object) > 0);
360 }

◆ putObject() [1/3]

bool JSUPPORT::putObject ( TDirectory & dir,
const JMeta & meta )
inline

Write meta data to ROOT directory.

Parameters
dirdirectory
metameta data
Returns
true if OK; else false

Definition at line 370 of file JMeta.hh.

371 {
372 JMeta::const_iterator p = meta.find(application_t);
373
374 if (p != meta.end()) {
375 if (putMeta(dir, getName(JType<JMeta>()), p->second)) {
376 return putMeta(dir, p->second, meta.toString());
377 }
378 }
379
380 return false;
381 }
bool putMeta(TDirectory &dir, const std::string &key, const std::string &buffer)
Write meta data as ROOT TNamed object.
Definition JMeta.hh:346
Auxiliary class for a type holder.
Definition JType.hh:19
std::string toString() const
Convert meta data to string.
Definition JMeta.hh:187

◆ putObject() [2/3]

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 391 of file JMeta.hh.

392 {
393 if (dir != NULL)
394 return putObject(*dir, meta);
395 else
396 return false;
397 }

◆ operator<<()

TFile & JSUPPORT::operator<< ( TFile & file,
const JMeta & meta )
inline

Write meta data to ROOT file.

Parameters
fileROOT file
metameta data
Returns
ROOT file

Definition at line 407 of file JMeta.hh.

408 {
409 putObject(file, meta);
410
411 return file;
412 }

◆ getName() [2/2]

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 448 of file JMeta.hh.

449 {
450 return META_NAME;
451 }

◆ getObject() [2/2]

void JSUPPORT::getObject ( TFile * file,
const TString & 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 461 of file JMeta.hh.

462 {
463 enum JParameter_t {
464 JApplication_t = 0, //!< application name
465 JSVNRelease_t, //!< SVN release
466 JROOTRelease_t, //!< ROOT release
467 JNamespace_t, //!< name space
468 JCommand_t, //!< Linux command
469 JSystem_t, //!< system information
470 number_of_items //!< number of items
471 };
472
473 const char* buffer[number_of_items] = {
474 application_t,
475 SVNrelease_t,
476 ROOTrelease_t,
477 namespace_t,
478 command_t,
479 system_t
480 };
481
482 if (ps != NULL) {
483
484 delete ps;
485
486 ps = NULL;
487 }
488
489 if (file != NULL) {
490
491 const int number_of_cycles = getNumberOfCycles(file, key);
492
493 if (number_of_cycles != 0) {
494
495 TNamed* __p = NULL;
496
497 file->GetObject(key, __p);
498
499 ps = new JMetaOld_t();
500
501 (*ps)[application_t] = __p->GetTitle();
502
503 for (int i = 1; i != number_of_items; ++i) {
504
505 file->GetObject(MAKE_CSTRING((*ps)[application_t] << ';' << ((number_of_cycles - 1) * (number_of_items - 1) + i)), __p);
506
507 if (__p != NULL)
508 (*ps)[buffer[i]] = __p->GetTitle();
509 else
510 break;
511 }
512 }
513 }
514 }
static const char *const application_t
Definition of meta data parameters.
Definition JMeta.hh:58
int getNumberOfCycles(TFile *file, const TString &key)
Get number of cycles of named objects with same title as given key.
Definition JMeta.hh:249

◆ putObject() [3/3]

bool JSUPPORT::putObject ( TDirectory & dir,
const JMetaOld_t & meta )
inline

Write old meta data to ROOT directory in new format.

Parameters
dirdirectory
metameta data
Returns
true if OK; else false

Definition at line 524 of file JMeta.hh.

525 {
526 return putObject(dir, static_cast<const JMeta&>(meta));
527 }

◆ getHeader()

Head JSUPPORT::getHeader ( const JMultipleFileScanner_t & file_list)
inline

Get Monte Carlo header.

Parameters
file_listfile list
Returns
Monte Carlo header

Definition at line 547 of file JMonteCarloFileSupportkit.hh.

548 {
549 return JMultipleFileScanner<Head>(file_list).getHeader();
550 }
General purpose class for object reading from a list of file names.

◆ getCommonHeader()

Head JSUPPORT::getCommonHeader ( const JMultipleFileScanner_t & file_list)
inline

Get common Monte Carlo header.

Parameters
file_listfile list
Returns
Monte Carlo header

Definition at line 559 of file JMonteCarloFileSupportkit.hh.

560 {
561 Head head;
562
563 if (!file_list.empty()) {
564
565 JHead buffer = getHeader(file_list[0]);
566
567 buffer.createUUID();
568
569 for (size_t i = 1; i != file_list.size(); ++i) {
570 buffer = buffer.getMatch(getHeader(file_list[i]));
571 }
572
573 copy(buffer, head);
574 }
575
576 return head;
577 }
Monte Carlo run header.
Definition JHead.hh:1236
void createUUID()
Create UUID if not already set.
Definition JHead.hh:1301
JHead getMatch(const JHead &header) const
Get matching fields.
Definition JHead.hh:1410
void copy(const Head &from, JHead &to)
Copy header from from to to.
Definition JHead.cc:163
Head getHeader(const JMultipleFileScanner_t &file_list)
Get Monte Carlo header.
The Head class reflects the header of Monte-Carlo event files, which consists of keys (also referred ...
Definition Head.hh:65

◆ getMultiHeader()

JMultiHead JSUPPORT::getMultiHeader ( const JMultipleFileScanner_t & file_list)
inline

Get multi-header corresponding to a given file list.

Parameters
file_listfile list
Returns
Monte Carlo multi header

Definition at line 586 of file JMonteCarloFileSupportkit.hh.

587 {
588 using namespace JPP;
589
590 JMultiHead multiHeader;
591
592 for (JMultipleFileScanner<MultiHead> in(file_list); in.hasNext(); ) {
593
594 const MultiHead* p = in.next();
595
596 for (MultiHead::const_iterator i = p->cbegin(); i != p->cend(); ++i) {
597
598 JHead header = *i;
599
600 multiHeader.insert(header);
601 }
602 }
603
604 multiHeader.merge();
605
606 return multiHeader;
607 }
virtual bool hasNext() override
Check availability of next element.
Auxiliary data structure to store multiple headers and bookkeep event-weight normalisations.
Definition JMultiHead.hh:39
bool insert(const JHead &header)
Insert the given header.
Definition JMultiHead.hh:69
void merge(const JHead &header)
Merge the given header into this object.
Definition JMultiHead.hh:56

◆ getAAnetFiles()

template<class JFunction_t >
JMultipleFileScanner_t JSUPPORT::getAAnetFiles ( const JMultipleFileScanner_t & input,
JFunction_t test )

Get list of files compatible with geven header.

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

Parameters
inputfile list
testtest function
Returns
file list

Definition at line 621 of file JMonteCarloFileSupportkit.hh.

622 {
623 using namespace JPP;
624
626
627 for (JMultipleFileScanner_t::const_iterator i = input.begin(); i != input.end(); ++i) {
628 if (test(getHeader(*i))) {
629 result.push_back(*i);
630 }
631 }
632
633 return result;
634 }
return result
Definition JPolint.hh:862
Auxiliary base class for list of file names.

◆ getCategories()

JAANET::JEvtCategorySet JSUPPORT::getCategories ( const JMultipleFileScanner_t & file_list)
inline

Get the unique event categories corresponding to a given list of MC files.

Parameters
file_listlist of MC files
Returns
unique event categories

Definition at line 643 of file JMonteCarloFileSupportkit.hh.

644 {
645 using namespace std;
646 using namespace JPP;
647
648 JEvtCategorySet categories;
649
650 for (JMultipleFileScanner_t::const_iterator i = file_list.cbegin(); i != file_list.cend(); ++i) {
651 const JHead& header = getHeader(*i);
652
653 JEvtCategorySet cats = getCategories(header);
654
655 categories.insert(cats.begin(), cats.end());
656 }
657
658 return categories;
659 }
JEvtCategorySet getCategories(const JHead &header)
Auxiliary method to retrieve the unique event categories corresponding to a MC header.
Container for a set of event categories.

◆ getTimeDuration()

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 60 of file JSupportToolkit.hh.

61 {
62 if (utc.is_valid())
63 return (utc.getUpperLimit().getTimeNanoSecond() -
64 utc.getLowerLimit().getTimeNanoSecond()) * 1.0e-9;
65 else
66 return 0.0;
67 }
bool is_valid() const
Check validity of range.
Definition JRange.hh:311
T getLowerLimit() const
Get lower limit.
Definition JRange.hh:202
T getUpperLimit() const
Get upper limit.
Definition JRange.hh:213

◆ getRunNumber()

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 77 of file JSupportToolkit.hh.

78 {
79 JFileScanner<T> in(file_name.c_str());
80
81 if (in.hasNext())
82 return in.next()->getRunNumber();
83 else
84 return -1;
85 }
Object reading from file.

◆ getFrameIndexRange() [1/2]

template<class T >
JFrameIndexRange JSUPPORT::getFrameIndexRange ( JTreeScannerInterface< T, KM3NETDAQ::JDAQEvaluator > & in)
inline

Get range of frame indices.

Parameters
inTTree scanner
Returns
frame index range

Definition at line 95 of file JSupportToolkit.hh.

96 {
97 if (!in.empty())
98 return JFrameIndexRange(in.begin()->getFrameIndex(), in.rbegin()->getFrameIndex());
99 else
100 return JFrameIndexRange(0,0);
101 }
JTOOLS::JRange< int > JFrameIndexRange
Type definition for frame index range.

◆ getFrameIndexRange() [2/2]

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 111 of file JSupportToolkit.hh.

112 {
114
115 TDirectory* dir = TDirectory::CurrentDirectory();
116
117 if (isROOTFile(file_name.c_str())) {
118
120
121 return getFrameIndexRange(in);
122
123 } else {
124
125 JFileScanner<T> in(file_name.c_str());
126
127 while (in.hasNext()) {
128 result.include(in.next()->getFrameIndex());
129 }
130 }
131
132 if (dir != NULL) {
133 dir->cd(); // restore current working directory
134 }
135
136 return result;
137 }
Template definition for direct access of elements in ROOT TChain.
static JRange< int, std::less< int > > DEFAULT_RANGE()
Definition JRange.hh:555
bool isROOTFile(const char *file_name)
Check file format.
JFrameIndexRange getFrameIndexRange(JTreeScannerInterface< T, KM3NETDAQ::JDAQEvaluator > &in)
Get range of frame indices.

◆ getUTCTimeRange() [1/4]

JDAQUTCTimeRange JSUPPORT::getUTCTimeRange ( )
inline

Get UTC time range.

Returns
UTC time range

Definition at line 145 of file JSupportToolkit.hh.

146 {
148 }
Data structure for UTC time.
JTOOLS::JRange< JDAQUTCExtended > JDAQUTCTimeRange
Type definition for DAQ UTC time range.

◆ getUTCTimeRange() [2/4]

template<class T >
JDAQUTCTimeRange JSUPPORT::getUTCTimeRange ( JTreeScannerInterface< T, KM3NETDAQ::JDAQEvaluator > & in)
inline

Get UTC time range.

Parameters
inTTree scanner
Returns
UTC time range

Definition at line 158 of file JSupportToolkit.hh.

159 {
160 if (!in.empty())
161 return JDAQUTCTimeRange(in.begin()->getTimesliceStart(), in.rbegin()->getTimesliceStart());
162 else
163 return getUTCTimeRange();
164 }
JDAQUTCTimeRange getUTCTimeRange()
Get UTC time range.

◆ getUTCTimeRange() [3/4]

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 174 of file JSupportToolkit.hh.

175 {
177
178 TDirectory* dir = TDirectory::CurrentDirectory();
179
180 if (isROOTFile(file_name.c_str())) {
181
183
185
186 } else {
187
188 for (JFileScanner<T> in(file_name.c_str()); in.hasNext(); ) {
189 result.include(in.next()->getTimesliceStart());
190 }
191 }
192
193 if (dir != NULL) {
194 dir->cd(); // restore current working directory
195 }
196
197 return result;
198 }
virtual bool hasNext() override
Check availability of next element.

◆ getUTCTimeRange() [4/4]

template<class T >
JDAQUTCTimeRange JSUPPORT::getUTCTimeRange ( T __begin,
T __end )
inline

Get UTC time range for given file names of data taking runs.

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

Definition at line 251 of file JSupportToolkit.hh.

252 {
253 using namespace JPP;
254
256
257 for (T i = __begin; i != __end; ++i) {
258
262 KM3NETDAQ::JDAQTimesliceL1>::typelist> buffer(*i);
263
264 result.combine(buffer);
265 }
266
267 return result;
268 }
Auxiliary class for recursive type list generation.
Definition JTypeList.hh:351
Auxiliary class to extract UTC time range for list of data types.
Timeslice data structure for L1 data.
Timeslice data structure for L2 data.
Timeslice data structure for SN data.

◆ getLivetime() [1/3]

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 277 of file JSupportToolkit.hh.

278 {
279 using namespace KM3NETDAQ;
280 using namespace JTRIGGER;
281
282 TDirectory* dir = TDirectory::CurrentDirectory();
283
284 double livetime = 0.0;
285
286 try {
287
288 const JTriggerParameters parameters = getTriggerParameters(file_name);
289
290 if (parameters.writeSummary.prescale != 0) {
291
292 JTreeScanner<JDAQSummaryslice> in(file_name);
293
294 livetime = in.getEntries() * getFrameTime() * 1.0e-9 / parameters.writeSummary.prescale;
295 }
296 }
297 catch(const std::exception& error) {}
298
299 if (dir != NULL) {
300 dir->cd(); // restore current working directory
301 }
302
303 return livetime;
304 }
long long int prescale
Definition JPrescaler.hh:96
Data structure for all trigger parameters.
JPrescaler writeSummary
write JDAQSummaryslice
JTriggerParameters getTriggerParameters(const JMultipleFileScanner_t &file_list)
Get trigger parameters.
Auxiliary classes and methods for triggering.
KM3NeT DAQ data structures and auxiliaries.
Definition DataQueue.cc:39
double getFrameTime()
Get frame time duration.
Definition JDAQClock.hh:162
Normalisation of MUPAGE events.
Definition JHead.hh:835

◆ getLivetime() [2/3]

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 315 of file JSupportToolkit.hh.

316 {
317 double livetime = 0.0;
318
319 for (T i = __begin; i != __end; ++i) {
320 livetime += getLivetime(*i);
321 }
322
323 return livetime;
324 }
double getLivetime(const std::string &file_name)
Get data taking live time.

◆ getLivetime() [3/3]

double JSUPPORT::getLivetime ( const JMultipleFileScanner_t & file_list)
inline

Get data taking live time.

Parameters
file_listfile list
Returns
live time [s]

Definition at line 333 of file JSupportToolkit.hh.

334 {
335 return getLivetime(file_list.begin(), file_list.end());
336 }

◆ getTriggerParameters()

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 {
150 return JMultipleFileScanner<JTriggerParameters>(file_list).getTriggerParameters();
151 }

Variable Documentation

◆ ROOT_FILE_FORMAT

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

file name extension ROOT format

Definition at line 21 of file JFilenameSupportkit.hh.

◆ JSON_FILE_FORMAT

const char* const JSUPPORT::JSON_FILE_FORMAT = "json"
static

file name extension JSON format

Definition at line 22 of file JFilenameSupportkit.hh.

◆ DAQ_FILE_FORMAT

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

file name extension DAQ binary format

Definition at line 23 of file JFilenameSupportkit.hh.

◆ JPP_FILE_FORMAT

const char* const JSUPPORT::JPP_FILE_FORMAT = "jpp"
static

file name extension Jpp binary format

Definition at line 24 of file JFilenameSupportkit.hh.

◆ MONTE_CARLO_FILE_FORMAT

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

file name extension ASCII format

Definition at line 25 of file JFilenameSupportkit.hh.

◆ GZIP_FILE_FORMAT

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

file name extension gzip format

Definition at line 26 of file JFilenameSupportkit.hh.

◆ ASCII_FILE_FORMAT

const char* const JSUPPORT::ASCII_FILE_FORMAT = "txt"
static

file name extension ASCII format

Definition at line 27 of file JFilenameSupportkit.hh.

◆ FILE_LIST_FORMAT

const char* const JSUPPORT::FILE_LIST_FORMAT = "files"
static

file name extension ASCII format with list of file names

Definition at line 28 of file JFilenameSupportkit.hh.

◆ META_NAME

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

ROOT name for meta data.

Definition at line 46 of file JMeta.hh.

◆ META_DIRECTORY

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

ROOT sub-directory for meta data.

Definition at line 52 of file JMeta.hh.

◆ application_t

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

Definition of meta data parameters.

application name

Definition at line 58 of file JMeta.hh.

◆ SVNrelease_t

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

SVN release.

Definition at line 59 of file JMeta.hh.

◆ GITrelease_t

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

GIT release.

Definition at line 60 of file JMeta.hh.

◆ ROOTrelease_t

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

ROOT release.

Definition at line 61 of file JMeta.hh.

◆ namespace_t

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

name space

Definition at line 62 of file JMeta.hh.

◆ command_t

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

Linux command.

Definition at line 63 of file JMeta.hh.

◆ system_t

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

system information

Definition at line 64 of file JMeta.hh.

◆ BRANCH_PATTERN

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 44 of file JTreeScanner.hh.