Project
Loading...
Searching...
No Matches
FairGenericStack.cxx
Go to the documentation of this file.
1/********************************************************************************
2 * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
3 * *
4 * This software is distributed under the terms of the *
5 * GNU Lesser General Public Licence (LGPL) version 3, *
6 * copied verbatim in the file "LICENSE" *
7 ********************************************************************************/
8// -------------------------------------------------------------------------
9// ----- FairGenericStack source file -----
10// ----- Created 10/08/04 by D. Bertini -----
11// -------------------------------------------------------------------------
12#include "FairGenericStack.h"
13
14#include "FairLogger.h" // for FairLogger
15
16#include <TGeoManager.h>
17#include <TLorentzVector.h>
18#include <TMCProcess.h>
19#include <TRefArray.h>
20#include <TString.h>
21#include <TVirtualMC.h>
22#include <cstring> // strcmp
23
26 , fLogger(FairLogger::GetLogger())
27 , fDetList(0)
28 , fDetIter(0)
29 , fVerbose(1)
30 , fFSTrackMap()
31 , fFSTrackIter()
32 , fFSMovedIndex(-2)
33 , fFSFirstSecondary(-2)
34 , fFSNofSecondaries(0)
35{}
36
37// ----- Constructor with estimated array dimension --------------------
40 , fLogger(FairLogger::GetLogger())
41 , fDetList(0)
42 , fDetIter(0)
43 , fVerbose(1)
44 , fFSTrackMap()
45 , fFSTrackIter()
46 , fFSMovedIndex(-2)
47 , fFSFirstSecondary(-2)
48 , fFSNofSecondaries(0)
49{}
50
52
54 : TVirtualMCStack(rhs)
55 , fLogger(FairLogger::GetLogger())
56 , fDetList(rhs.fDetList)
57 , fDetIter(0)
58 , fVerbose(rhs.fVerbose)
59{}
60
62{
63 // check assignment to self
64 if (this == &rhs)
65 return *this;
66
67 // base class assignment
68 TVirtualMCStack::operator=(rhs);
69
70 // assignment oiperator
71 fLogger = 0;
72 fDetList = 0;
73 fDetIter = 0;
74 fVerbose = rhs.fVerbose;
75
76 return *this;
77}
78
79void FairGenericStack::SetDetArrayList(TRefArray* detArray)
80{
81 fDetList = detArray;
82 if (fDetList != 0) {
83 fDetIter = fDetList->MakeIterator();
84 }
85}
86
88{
89 Fatal("CloneStack", "Has to be overriden in multi-threading applications.");
90 return 0;
91}
92
94 Double_t yy,
95 Double_t zz,
96 Double_t tt,
97 Double_t px,
98 Double_t py,
99 Double_t pz,
100 Double_t en)
101{
102 TLorentzVector curPos;
103 TVirtualMC::GetMC()->TrackPosition(curPos);
104 LOG(debug) << "track is in " << curPos.X() << "," << curPos.Y() << "," << curPos.Z() << ", moving to " << xx << ","
105 << yy << "," << zz;
106 TString curVolName(TVirtualMC::GetMC()->CurrentVolName());
107 TString targetVolName(gGeoManager->FindNode(xx, yy, zz)->GetVolume()->GetName());
108 if (curVolName.EqualTo(targetVolName)) {
109 LOG(fatal) << "FairStack::FastSimMoveParticleTo(" << xx << "," << yy << "," << zz << ": " << curVolName << " = "
110 << targetVolName << ") crashes the simulation.";
111 } else {
112 LOG(debug) << "gMC says track is in \"" << curVolName << "\" moving particle to \"" << targetVolName << "\".";
113 }
114
115 Int_t tobedone = 1;
116 Int_t parent = 0; // do not store it as mother
117 Int_t pdg = TVirtualMC::GetMC()->TrackPid();
118 Double_t polx = 0.;
119 Double_t poly = 0.;
120 Double_t polz = 0.;
121 TMCProcess proc = kPPrimary; // not important, the track will not be saved
122 Int_t ntr = 0; // Track number; to be filled by the stack
123 Int_t status = 0; // not important, the track will not be saved
124 Double_t weight = 0.;
125
126 PushTrack(tobedone, parent, pdg, px, py, pz, en, xx, yy, zz, tt, polx, poly, polz, proc, ntr, weight, status, -1);
127 fFSMovedIndex = GetListOfParticles()->GetEntries() - 1;
128 Int_t trackID = TVirtualMC::GetMC()->GetStack()->GetCurrentTrackNumber();
129 fFSTrackIter = fFSTrackMap.find(trackID); // check if this track is not already created by FastSimulation
130 if (fFSTrackIter != fFSTrackMap.end()) // indeed the track has been created by the FastSimulation mechanism
131 trackID = fFSTrackIter->second; // use the ID of the original track
132 fFSTrackMap[ntr] = trackID;
133
134 LOG(debug) << "FairStack::FastSimMoveParticleTo() created track number " << ntr << " to replace track number "
135 << trackID;
136
137 if (strcmp(TVirtualMC::GetMC()->GetName(), "TGeant3TGeo") == 0) {
138 TVirtualMC::GetMC()->StopTrack();
139 }
140}
141
143{
144 if (TVirtualMC::GetMC()->IsTrackStop())
145 LOG(fatal) << "FairStack::FastSimStopParticle() tries to stop particle that was probably moved!";
146 fFSMovedIndex = -1;
147 TVirtualMC::GetMC()->StopTrack();
148}
149
151 Int_t pdgCode,
152 Double_t xx,
153 Double_t yy,
154 Double_t zz,
155 Double_t tt,
156 Double_t px,
157 Double_t py,
158 Double_t pz,
159 Double_t en,
160 Double_t polx,
161 Double_t poly,
162 Double_t polz,
163 TMCProcess proc,
164 Double_t weight,
165 Int_t is)
166{
167 Int_t tobedone = 1;
168
169 Int_t ntr = 0; // Track number; to be filled by the stack
170 PushTrack(tobedone, parentID, pdgCode, px, py, pz, en, xx, yy, zz, tt, polx, poly, polz, proc, ntr, weight, is, -1);
171 if (fFSNofSecondaries == 0)
172 fFSFirstSecondary = GetListOfParticles()->GetEntries() - 1;
174}
175
std::ostringstream debug
ClassImp(FairGenericStack)
configStandalone Reconstruction rec_tpc multiplier for the combined cluster track error during track following area in cm for the search of for z only used if decrease removal by when above this local occupancy rowx Shift of TPC revert cluster flag edge bit distance to edge exceeds this ZOffset for secondary multiple of radius max P of electron K BB bands crossing max P of electron p BB bands crossing max P of electron d BB bands crossing max P of electron t BB bands crossing min accepted dEdxMaxTPC of the track Additive extra cluster error for Y2 if edge flag set Additive extra cluster error for Y2 if single set Additive extra cluster error for Y2 if or single set Additive extra cluster error for Z2 if or single set Extra errors to add to track when crossing depending on addErrorsCECrossing Inner portion of y range in sector that is not used in searching for extrapolated track candidates factor2YS for track merging factor2K for track merging Margin in cm of Y position when rejecting edge clusters based on uncorrected track Y Max fraction of shared clusters for tracklet Except pad from cluster finding if total number of charges in a fragment is above this Except pad from cluster finding if number of consecutive charges in a fragment is above this Threshold where a timebin is considered disabling the noisy pad check for that pad Treat signal above this minimum as saturated Smoothing factor for the exponential Highly Ionising Particle tail filter Number of timebins to use for the averaging Add additional custom track errors when crossing relative as fraction of Do N fit passes in final fit of< 0:reject at max -n hits") AddOptionRTC(rejectIFCLowRadiusCluster, uint8_t, 1, "", 0, "Reject clusters that get the IFC mask error during refit") AddOptionRTC(dEdxTruncLow, uint8_t, 2, "", 0, "Low truncation threshold, fraction of 128") AddOptionRTC(dEdxTruncHigh, uint8_t, 77, "", 0, "High truncation threshold, fraction of 128") AddOptionRTC(extrapolationTracking, int8_t, 1, "", 0, "Enable Extrapolation Tracking(prolong tracks to adjacent sectors to find short segments)") AddOptionRTC(disableRefitAttachment, uint8_t, 0, "", 0, "Bitmask to disable certain attachment steps during refit(1:attachment, 2:propagation, 4:loop following, 8:mirroring)") AddOptionRTC(rejectionStrategy, uint8_t, o2::gpu::GPUSettings::RejectionStrategyA, "", 0, "Enable rejection of TPC clusters for compression(0=no, 1=strategy A, 2=strategy B)") AddOptionRTC(mergeLoopersAfterburner, uint8_t, 1, "", 0, "Run afterburner for additional looper merging") AddOptionRTC(compressionTypeMask, uint8_t, o2::gpu::GPUSettings::CompressionFull, "", 0, "TPC Compression mode bits(1=truncate charge/width LSB, 2=differences, 4=track-model)") AddOptionRTC(compressionSortOrder, uint8_t, o2::gpu::GPUSettings::SortTime, "", 0, "Sort order of TPC compression(0=time, 1=pad, 2=Z-time-pad, 3=Z-pad-time, 4=no sorting(use incoming order))") AddOptionRTC(sigBitsCharge, uint8_t, 4, "", 0, "Number of significant bits for TPC cluster charge in compression mode 1") AddOptionRTC(sigBitsWidth, uint8_t, 3, "", 0, "Number of significant bits for TPC cluster width in compression mode 1") AddOptionRTC(dropLoopers, uint8_t, 0, "", 0, "Drop looping tracks starting from second loop") AddOptionRTC(mergerInterpolateErrors, uint8_t, 1, "", 0, "Use interpolation instead of extrapolation for chi2 based cluster rejection") AddOptionRTC(mergerInterpolateRejectAlsoOnCurrentPosition, uint8_t, 1, "", 0, "When using mergerInterpolateErrors, reject based on chi2 twice computed with interpolated and current track position starting from NDF > mergerNonInterpolateRejectMinNDF Merge tracks accross the central electrode Enable PID response Add sub threshold clusters in TPC dEdx computation OR mask of TPC flags that will reject the cluster in alternative dEdx Reject edge clusters based on uncorrected track Y during track fit Increase decrease removal by when on this number of pads from the edge h configStandalone Reconstruction rec_trd Max chi2 for TRD tracklets to be matched to a track Chi2 cut for strict matching mode Number of sigmas for ITS TPC track time error estimate Addition to search road around track prolongation along Y in cm Optimal tracklet rphi resolution in maximum chi2 per attached tracklet for TRD tracks take into account the full likelihood of the slope including exponential tails Tracks with less attached tracklets are discarded after the tracking Post trigger Pile up integration time in BCs fits all iterations but the last one in projections Use material lookup table for TPC refit Apply workarounds to avoid cyclic merge should not be needed tpc dyn configStandalone proc
std::map< Int_t, Int_t > fFSTrackMap
virtual void FastSimMoveParticleTo(Double_t xx, Double_t yy, Double_t zz, Double_t tt, Double_t px, Double_t py, Double_t pz, Double_t en)
virtual void FastSimPushSecondary(Int_t parentID, Int_t pdgCode, Double_t xx, Double_t yy, Double_t zz, Double_t tt, Double_t px, Double_t py, Double_t pz, Double_t en, Double_t polx, Double_t poly, Double_t polz, TMCProcess proc, Double_t weight, Int_t is)
virtual void FastSimStopParticle()
std::map< Int_t, Int_t >::iterator fFSTrackIter
FairGenericStack & operator=(const FairGenericStack &)
void SetDetArrayList(TRefArray *detArray)
virtual TClonesArray * GetListOfParticles()
virtual void PushTrack(Int_t toBeDone, Int_t parentID, Int_t pdgCode, Double_t px, Double_t py, Double_t pz, Double_t e, Double_t vx, Double_t vy, Double_t vz, Double_t time, Double_t polx, Double_t poly, Double_t polz, TMCProcess proc, Int_t &ntr, Double_t weight, Int_t is, Int_t secondparentID)=0
virtual FairGenericStack * CloneStack() const
GLuint GLuint GLfloat weight
Definition glcorearb.h:5477
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"