Public Member Functions | Protected Attributes | Static Protected Attributes | Private Member Functions | List of all members
CRT::ToFlat Class Reference

#include <ToFlat.h>

Public Member Functions

template<class TFS >
 ToFlat (TFS &fileService)
 
virtual ~ToFlat ()
 
void AnalyzeEvent (const std::vector< CRT::Trigger > &triggers)
 

Protected Attributes

size_t fNTriggers
 
short fADCs [MaxTriggers][NChannels]
 
unsigned long long fTimestamps [MaxTriggers]
 
short fModules [MaxTriggers]
 
TTree * fTree
 

Static Protected Attributes

static constexpr size_t NChannels = 64
 
static constexpr size_t MaxTriggers = 32*2
 

Private Member Functions

void ResetBranches ()
 

Detailed Description

Definition at line 25 of file ToFlat.h.

Constructor & Destructor Documentation

template<class TFS >
CRT::ToFlat::ToFlat ( TFS &  fileService)
inline

Definition at line 30 of file ToFlat.h.

31  {
32  fTree = fileService->template make<TTree>("EBuilder", "CRT::Triggers");
33 
34  fTree->Branch("NTriggers", &fNTriggers, "NTriggers/l");
35  fTree->Branch("Modules", &fModules, "Modules[NTriggers]/s");
36  fTree->Branch("ADCs", &fADCs, "ADCs[NTriggers][64]/s"); //Second index is explicitly channel number
37  fTree->Branch("Timestamps", &fTimestamps, "Timestamps[NTriggers]/l");
38  }
unsigned long long fTimestamps[MaxTriggers]
Definition: ToFlat.h:53
TTree * fTree
Definition: ToFlat.h:56
short fModules[MaxTriggers]
Definition: ToFlat.h:54
short fADCs[MaxTriggers][NChannels]
Definition: ToFlat.h:52
size_t fNTriggers
Definition: ToFlat.h:51
CRT::ToFlat::~ToFlat ( )
virtual

Definition at line 16 of file ToFlat.cpp.

16 {}

Member Function Documentation

void CRT::ToFlat::AnalyzeEvent ( const std::vector< CRT::Trigger > &  triggers)

Definition at line 18 of file ToFlat.cpp.

19  {
20  ResetBranches();
21 
22  size_t trigIt = 0;
23  fNTriggers = triggers.size();
24  for(const auto& trigger: triggers)
25  {
26  fTimestamps[trigIt] = trigger.Timestamp();
27  fModules[trigIt] = trigger.Channel();
28 
29  const auto& hits = trigger.Hits();
30  for(const auto& hit: hits)
31  {
32  fADCs[trigIt][hit.Channel()] = hit.ADC();
33  }
34  ++trigIt;
35  }
36 
37  fTree->Fill();
38  }
unsigned long long fTimestamps[MaxTriggers]
Definition: ToFlat.h:53
TTree * fTree
Definition: ToFlat.h:56
short fModules[MaxTriggers]
Definition: ToFlat.h:54
short fADCs[MaxTriggers][NChannels]
Definition: ToFlat.h:52
void ResetBranches()
Definition: ToFlat.cpp:40
Detector simulation of raw signals on wires.
size_t fNTriggers
Definition: ToFlat.h:51
void CRT::ToFlat::ResetBranches ( )
private

Definition at line 40 of file ToFlat.cpp.

41  {
42  for(size_t trigger = 0; trigger < MaxTriggers; ++trigger)
43  {
44  fNTriggers = 0;
45  fTimestamps[trigger] = -1;
46  fModules[trigger] = -1;
47  for(size_t channel = 0; channel < NChannels; ++channel) fADCs[trigger][channel] = 0;
48  }
49  }
unsigned long long fTimestamps[MaxTriggers]
Definition: ToFlat.h:53
short fModules[MaxTriggers]
Definition: ToFlat.h:54
static constexpr size_t MaxTriggers
Definition: ToFlat.h:46
short fADCs[MaxTriggers][NChannels]
Definition: ToFlat.h:52
uint8_t channel
Definition: CRTFragment.hh:201
static constexpr size_t NChannels
Definition: ToFlat.h:45
size_t fNTriggers
Definition: ToFlat.h:51

Member Data Documentation

short CRT::ToFlat::fADCs[MaxTriggers][NChannels]
protected

Definition at line 52 of file ToFlat.h.

short CRT::ToFlat::fModules[MaxTriggers]
protected

Definition at line 54 of file ToFlat.h.

size_t CRT::ToFlat::fNTriggers
protected

Definition at line 51 of file ToFlat.h.

unsigned long long CRT::ToFlat::fTimestamps[MaxTriggers]
protected

Definition at line 53 of file ToFlat.h.

TTree* CRT::ToFlat::fTree
protected

Definition at line 56 of file ToFlat.h.

constexpr size_t CRT::ToFlat::MaxTriggers = 32*2
staticprotected

Definition at line 46 of file ToFlat.h.

constexpr size_t CRT::ToFlat::NChannels = 64
staticprotected

Definition at line 45 of file ToFlat.h.


The documentation for this class was generated from the following files: