9 #include "ERTelescopeDigitizer.h" 12 #include "TGeoMatrix.h" 16 #include "FairRootManager.h" 17 #include "FairRuntimeDb.h" 19 #include "FairLogger.h" 21 #include "ERDetectorList.h" 25 ERTelescopeDigitizer::ERTelescopeDigitizer()
28 fAvailibleRunManagers.push_back(
"ERRunSim");
29 fAvailibleRunManagers.push_back(
"ERRunAna");
32 ERTelescopeDigitizer::ERTelescopeDigitizer(Int_t verbose)
33 :
ERDigitizer(
"ER telescope digitization ", verbose)
43 FairRootManager* ioman = FairRootManager::Instance();
44 if ( ! ioman ) Fatal(
"Init",
"No FairRootManager");
46 TList* allbrNames = ioman->GetBranchNameList();
47 TIter nextBranch(allbrNames);
49 std::vector<TString> pointBranches;
50 while (bName = (TObjString*)nextBranch()) {
51 TString bFullName = bName->GetString();
52 LOG(DEBUG) <<
"Branch full name " << bFullName << FairLogger::endl;
53 if (bFullName.Contains(
"Point") && bFullName.Contains(
"Telescope")) {
57 Int_t bPrefixNameLength = bFullName.First(
'_');
58 TString brName(bFullName(bPrefixNameLength + 1, bFullName.Length()));
59 fQTelescopePoints[brName] = (TClonesArray*) ioman->GetObject(bFullName);
60 TString bPrefixName(bFullName(0, bPrefixNameLength));
61 bPrefixName.Replace(bPrefixNameLength - 5, bPrefixNameLength,
"Digi");
62 TString outBrName = bPrefixName +
"_" + brName;
63 fQTelescopeDigi[brName] =
new TClonesArray(
"ERDigi", consts::approx_telescope_digi_number);
64 LOG(DEBUG) <<
"Branch name " << brName << FairLogger::endl;
65 ioman->Register(outBrName,
"Telescope", fQTelescopeDigi[brName], kTRUE);
73 for (
const auto &itPointBranches : fQTelescopePoints) {
74 Double_t elossThreshold, timeThreshold;
75 Double_t elossSigma, timeSigma;
76 std::map<Int_t, std::vector<Int_t>> sortedPoints;
77 if (itPointBranches.first.Contains(
"Si")) {
78 elossThreshold = fSiElossThreshold;
79 elossSigma = fSiElossSigma;
80 timeSigma = fSiTimeSigma;
82 if (itPointBranches.first.Contains(
"CsI")) {
83 elossThreshold = fCsIElossThreshold;
84 elossSigma = fCsIElossSigma;
85 timeSigma = fCsITimeSigma;
87 for (Int_t iPoint = 0; iPoint < itPointBranches.second->GetEntriesFast(); iPoint++){
89 sortedPoints[point->GetVolNb()].push_back(iPoint);
91 for (
const auto &itPoint : sortedPoints) {
93 Float_t time = std::numeric_limits<float>::max();
94 for (
const auto itPointsForCurrentVolume : itPoint.second) {
95 const auto* point = (
ERPoint*)(itPointBranches.second->At(itPointsForCurrentVolume));
96 edep += point->GetEnergyLoss();
97 if (point->GetTime() < time) {
98 time = point->GetTime();
104 edep = gRandom->Gaus(edep, elossSigma);
105 if (edep < elossThreshold)
107 time = gRandom->Gaus(time, timeSigma);
108 auto* digi = AddDigi(edep, time, itPoint.first, itPointBranches.first);
116 for (
const auto &itDigiBranch : fQTelescopeDigi ) {
117 TString branchName = itDigiBranch.first;
118 TClonesArray* digiCol = itDigiBranch.second;
119 for (
const auto &trigger : fTriggers) {
120 TString triggerStation = trigger.first;
121 if (branchName.Contains(triggerStation)){
122 LOG(DEBUG) <<
"Apply trigger to station " << triggerStation << FairLogger::endl;
123 ApplyTrigger(triggerStation,digiCol);
130 for (
const auto itDigiBranches : fQTelescopeDigi) {
131 if (itDigiBranches.second) {
132 itDigiBranches.second->Delete();
140 ERDigi* ERTelescopeDigitizer::AddDigi(Float_t edep, Double_t time, Int_t stripNb,
141 TString digiBranchName) {
142 ERDigi *digi =
new((*fQTelescopeDigi[digiBranchName])
143 [fQTelescopeDigi[digiBranchName]->GetEntriesFast()])
ERDigi(edep, time, stripNb);
virtual InitStatus Init()
virtual InitStatus Init()
The data class for storing pieces of charged tracks in sensitive volumes in NeuRad.
std::vector< TString > fAvailibleRunManagers
Run managers that are availible for this task.
virtual void Exec(Option_t *opt)