GlobalEventTime.cpp
Go to the documentation of this file.
1 /*
2  * File: GlobalEventTime.cxx
3  * Author: denis
4  *
5  * Created on February 10, 2010, 11:31 AM
6  */
7 #ifdef NOVACMAKE
10 #else
11 #include "MockDataDAQ/GlobalEventTime.h"
12 #include "MockDataDAQ/Configuration.h"
13 #endif
14 #include "DAQDataFormats/RawNanoSlice.h"
15 #include <stdio.h>
16 #include <iostream>
17 
18 
19 namespace mcdatadaq{
20 
21 GlobalEventTime* GlobalEventTime::finstanceID = NULL;
22 
23 //------------------------------------------------------------------------------
25 
26  /// Check if there is an instance active
27  /// If there is not, make a new one
28  if(finstanceID == NULL){
31  }
32  return finstanceID;
33 }
34 
35 //------------------------------------------------------------------------------
38  , fGlobalEventTime(0)
39 {
40  print();
41 }
42 
43 //------------------------------------------------------------------------------
44 GlobalEventTime::GlobalEventTime(const unsigned long long time_difference,
45  const unsigned long long global_event_time):
46  fEventTimeDifference(time_difference)
47  , fGlobalEventTime(global_event_time)
48 {
49  print();
50 }
51 
52 //------------------------------------------------------------------------------
53 //Destructor
55 
56 
57 //------------------------------------------------------------------------------
59 
60 
61 //------------------------------------------------------------------------------
63 
64  std::cout<<"GlobalEventTime::print :"<<std::endl;
65  std::cout<<" First Event Time="<<fGlobalEventTime<<std::endl;
66  std::cout<<" Event Time Difference="<<fEventTimeDifference<<std::endl;
67 }
68 
69 
70 //------------------------------------------------------------------------------
72  printf("------------------------------\n");
73  printf("Event time = %llu\n", (unsigned long long)fGlobalEventTime);
74  printf("------------------------------\n");
75 }
76 
77 //------------------------------------------------------------------------------
79 
80  const unsigned long long Nanoslice_Time = fGlobalEventTime + Nanoslice->getTimeStamp();
81 
82  printf("------------------------------\n");
83  printf("Raw NanoSlice time = %d\n", Nanoslice->getTimeStamp());
84  printf("Global Nanoslice time = %llu\n", (unsigned long long)Nanoslice_Time);
85  printf("------------------------------\n");
86 }
87 
88 //------------------------------------------------------------------------------
89 unsigned long long GlobalEventTime::getNanoSliceGlobalTime(const daqdataformats::RawNanoSlice* Nanoslice) const {
90  const unsigned long long Nanoslice_Time = fGlobalEventTime + Nanoslice->getTimeStamp();
91  return Nanoslice_Time;
92 }
93 
94 //------------------------------------------------------------------------------
95 unsigned long long GlobalEventTime::getGlobalEventTime() const{return fGlobalEventTime;}
96 
97 //------------------------------------------------------------------------------
99 
100 }// end of namespace
unsigned long long getGlobalEventTime() const
GetGlobal Time.
unsigned long long getNextEventGlobalTime() const
GetGlobal Time.
unsigned long long getNanoSliceGlobalTime(const daqdataformats::RawNanoSlice *Nanoslice) const
Get Global Time for the nanoslice.
unsigned long long fEventTimeDifference
!< Instance pointer for singleton class
Definition: config.py:1
void advanceEventTime()
Increment the time of the next event time by fEventTimeDifference.
void printNanoSliceTime(const daqdataformats::RawNanoSlice *Nanoslice) const
static GlobalEventTime * finstanceID
static Configuration * getInstance()
Method to obtain the class instance.
uint32_t getEventTimeDifference() const
Event time difference in NOvA clock ticks (15.626 ns)
Something conflicts with RandomNumberGenerator. Keep DAQSimulator.h include below Art Framework inclu...
printf("%d Experimental points found\n", nlines)
void print() const
Print methods.
static const uint32_t DEFAULT_TIME_DIFF
OStream cout
Definition: OStream.cxx:6
unsigned long long fGlobalEventTime
! Time difference between events (in ticks)
static GlobalEventTime * getInstance()
Method to obtain the class instance.