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
20
22{
23 // Enumerating the fSystemString must come after the total mnemonic has been parsed as the details of other parts of
24 // the mnemonic must be known
25 if(fSystemString.compare("CL") == 0) {
26 if(SubSystem() == EMnemonic::kS) {
28 } else {
30 }
31 } else if(fSystemString.compare("TT") == 0) {
32 if(SubSystem() == EMnemonic::kS) {
34 } else {
36 }
37 } else if(fSystemString.compare("SI") == 0) {
39 } else if(fSystemString.compare("PL") == 0) {
41 } else {
43 }
44}
45
47{
48 std::string name = digitizerName.Value();
49 std::transform(name.begin(), name.end(), name.begin(), ::toupper);
51 int tmpUnit = 10;
52 if(name.compare("PIXIE") == 0) {
53 tmpType = EDigitizer::kPixie;
54 } else if(name.compare("FASTPIXIE") == 0) {
55 tmpType = EDigitizer::kFastPixie;
56 } else if(name.compare("PIXIETAPEMOVE") == 0) {
58 } else {
59 std::cout<<"Warning, digitizer type '"<<name<<"' not recognized, options are 'GRF16', 'GRF4G', 'TIG10', 'TIG64', and 'CAEN'!"<<std::endl;
60 }
61 digitizerType.Set(tmpType, digitizerName.Priority());
62 timeStampUnit.Set(tmpUnit, digitizerName.Priority());
63}
64
65void TTdrMnemonic::Parse(std::string* name)
66{
67 if((name == nullptr) || name->length() < 9) {
68 return;
69 }
70 TMnemonic::Parse(name);
71 // Enumerating the fSystemString must come last as the details of other parts of
72 // the mnemonic must be known
74
75 return;
76}
77
78void TTdrMnemonic::Print(Option_t*) const
79{
80 printf("====== TdrMNEMONIC ======\n");
81 printf("fArrayPosition = %i\n", fArrayPosition);
82 printf("fSegment = %i\n", fSegment);
83 printf("fSystemString = %s\n", fSystemString.c_str());
84 printf("fSubSystemString = %s\n", fSubSystemString.c_str());
85 printf("fArraySubPositionString = %s\n", fArraySubPositionString.c_str());
86 printf("fCollectedChargeString = %s\n", fCollectedChargeString.c_str());
87 printf("fOutputSensorString = %s\n", fOutputSensorString.c_str());
88 printf("===============================\n");
89}
90
92{
93 if(fClassType != nullptr) {
94 return fClassType;
95 }
96
97 switch(System()) {
98 case ESystem::kTdrCloverBgo: fClassType = TTdrCloverBgo::Class(); break;
99 case ESystem::kTdrTigressBgo: fClassType = TTdrTigressBgo::Class(); break;
100 case ESystem::kTdrClover: fClassType = TTdrClover::Class(); break;
101 case ESystem::kTdrTigress: fClassType = TTdrTigress::Class(); break;
102 case ESystem::kTdrSiLi: fClassType = TTdrSiLi::Class(); break;
103 case ESystem::kTdrPlastic: fClassType = TTdrPlastic::Class(); break;
104 default: fClassType = nullptr;
105 };
106 return fClassType;
107}
108
109double TTdrMnemonic::GetTime(Long64_t timestamp, Float_t cfd, double energy, const TChannel* channel) const
110{
111 if(channel == nullptr) {
112 Error("GetTime", "No TChannel provided");
113 return static_cast<Double_t>(timestamp + gRandom->Uniform());
114 }
115 switch(static_cast<EDigitizer>(channel->GetDigitizerType())) {
116 Double_t dTime;
118 dTime = timestamp * channel->GetTimeStampUnit() + channel->CalibrateCFD(cfd/3276.8);// CFD is reported as 15bit interpolation of 10 ns
119 return dTime - channel->GetTZero(energy) - channel->GetTimeOffset();
121 dTime = timestamp * channel->GetTimeStampUnit() + channel->CalibrateCFD(cfd/6553.6);// CFD is reported as 16bit interpolation of 10 ns
122 return dTime - channel->GetTZero(energy) - channel->GetTimeOffset();
123 default:
124 dTime = static_cast<Double_t>((timestamp * channel->GetTimeStampUnit()) + gRandom->Uniform());
125 return dTime - channel->GetTZero(energy) - channel->GetTimeOffset();
126 }
127 return 0.;
128}
ClassImp(TTdrMnemonic) void TTdrMnemonic
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
std::string fArraySubPositionString
Definition TMnemonic.h:111
int16_t fSegment
Definition TMnemonic.h:108
TClass * fClassType
! TGRSIDetector Type that this mnemonic represents
Definition TMnemonic.h:120
virtual EMnemonic SubSystem() const
Definition TMnemonic.h:61
std::string fOutputSensorString
Definition TMnemonic.h:113
std::string fSystemString
Definition TMnemonic.h:109
virtual void Parse(std::string *name)
Definition TMnemonic.cxx:57
std::string fCollectedChargeString
Definition TMnemonic.h:112
void Clear(Option_t *opt="") override
Definition TMnemonic.cxx:8
std::string fSubSystemString
Definition TMnemonic.h:110
int16_t fArrayPosition
Definition TMnemonic.h:107
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