GRSISort "v4.0.0.5"
An extension of the ROOT analysis Framework
Loading...
Searching...
No Matches
TTdrMnemonic.cxx
Go to the documentation of this file.
1#include "TTdrMnemonic.h"
2
3#include <algorithm>
4
5// Detector dependent includes
6#include "TTdrClover.h"
7#include "TTdrTigress.h"
8#include "TTdrSiLi.h"
9#include "TTdrPlastic.h"
10#include "TTdrCloverBgo.h"
11#include "TTdrTigressBgo.h"
12
13void TTdrMnemonic::Clear(Option_t*)
14{
17}
18
20{
21 // Enumerating the fSystemString must come after the total mnemonic has been parsed as the details of other parts of
22 // the mnemonic must be known
23 if(SystemString() == "CL") {
24 if(SubSystem() == EMnemonic::kS) {
26 } else {
28 }
29 } else if(SystemString() == "TT") {
30 if(SubSystem() == EMnemonic::kS) {
32 } else {
34 }
35 } else if(SystemString() == "SI") {
37 } else if(SystemString() == "PL") {
39 } else {
41 }
42}
43
45{
46 std::string name = digitizerName.Value();
47 std::transform(name.begin(), name.end(), name.begin(), ::toupper);
49 int tmpUnit = 10;
50 if(name.compare("PIXIE") == 0) {
51 tmpType = EDigitizer::kPixie;
52 } else if(name.compare("FASTPIXIE") == 0) {
53 tmpType = EDigitizer::kFastPixie;
54 } else if(name.compare("PIXIETAPEMOVE") == 0) {
56 } else {
57 std::cout << "Warning, digitizer type '" << name << "' not recognized, options are 'GRF16', 'GRF4G', 'TIG10', 'TIG64', and 'CAEN'!" << std::endl;
58 }
59 digitizerType.Set(tmpType, digitizerName.Priority());
60 timeStampUnit.Set(tmpUnit, digitizerName.Priority());
61}
62
63void TTdrMnemonic::Parse(std::string* name)
64{
65 if((name == nullptr) || name->length() < 9) {
66 return;
67 }
68 TMnemonic::Parse(name);
69 // Enumerating the fSystemString must come last as the details of other parts of
70 // the mnemonic must be known
72
73 return;
74}
75
76void TTdrMnemonic::Print(Option_t*) const
77{
78 std::ostringstream str;
79 std::cout << "====== TdrMNEMONIC ======" << std::endl;
81 std::cout << "=========================" << std::endl;
82}
83
85{
86 if(TMnemonic::GetClassType() != nullptr) {
88 }
89
90 switch(System()) {
91 case ESystem::kTdrCloverBgo: SetClassType(TTdrCloverBgo::Class()); break;
92 case ESystem::kTdrTigressBgo: SetClassType(TTdrTigressBgo::Class()); break;
93 case ESystem::kTdrClover: SetClassType(TTdrClover::Class()); break;
94 case ESystem::kTdrTigress: SetClassType(TTdrTigress::Class()); break;
95 case ESystem::kTdrSiLi: SetClassType(TTdrSiLi::Class()); break;
96 case ESystem::kTdrPlastic: SetClassType(TTdrPlastic::Class()); break;
97 default: SetClassType(nullptr);
98 };
100}
101
102double TTdrMnemonic::GetTime(Long64_t timestamp, Float_t cfd, double energy, const TChannel* channel) const
103{
104 if(channel == nullptr) {
105 Error("GetTime", "No TChannel provided");
106 return static_cast<Double_t>(timestamp + gRandom->Uniform());
107 }
108 switch(static_cast<EDigitizer>(channel->GetDigitizerType())) {
109 Double_t dTime;
111 dTime = timestamp * channel->GetTimeStampUnit() + channel->CalibrateCFD(cfd / 3276.8); // CFD is reported as 15bit interpolation of 10 ns
112 return dTime - channel->GetTZero(energy) - channel->GetTimeOffset();
114 dTime = timestamp * channel->GetTimeStampUnit() + channel->CalibrateCFD(cfd / 6553.6); // CFD is reported as 16bit interpolation of 10 ns
115 return dTime - channel->GetTZero(energy) - channel->GetTimeOffset();
116 default:
117 dTime = static_cast<Double_t>((timestamp * channel->GetTimeStampUnit()) + gRandom->Uniform());
118 return dTime - channel->GetTZero(energy) - channel->GetTimeOffset();
119 }
120 return 0.;
121}
EDigitizer
Definition TTdrMnemonic.h:9
Long64_t GetTimeOffset() const
Definition TChannel.h:176
EDigitizer GetDigitizerType() const
Definition TChannel.h:174
double CalibrateCFD(double) const
Definition TChannel.cxx:705
int GetTimeStampUnit() const
Definition TChannel.h:175
double GetTZero(double tempd) const
Definition TChannel.h:294
virtual std::string SystemString() const
Definition TMnemonic.h:69
virtual EMnemonic SubSystem() const
Definition TMnemonic.h:61
void Print(Option_t *opt="") const override
virtual void Parse(std::string *name)
Definition TMnemonic.cxx:57
void Clear(Option_t *opt="") override
Definition TMnemonic.cxx:8
virtual TClass * GetClassType() const
virtual void SetClassType(TClass *classType) const
Definition TMnemonic.h:92
void Set(const T &val, EPriority priority)
EPriority Priority() const
const T & Value() const
void Print(Option_t *opt="") const override
double GetTime(Long64_t timestamp, Float_t cfd, double energy, const TChannel *channel) const override
TClass * GetClassType() const override
void EnumerateSystem()
void Parse(std::string *name) override
ESystem System() const
void EnumerateDigitizer(TPriorityValue< std::string > &digitizerName, TPriorityValue< EDigitizer > &digitizerType, TPriorityValue< int > &timeStampUnit) override
void Clear(Option_t *opt="") override
ESystem fSystem