CbmRoot
CbmStsRecoModule.cxx
Go to the documentation of this file.
1 
6 #include "CbmStsRecoModule.h"
7 
8 #include <TGeoBBox.h>
9 #include <TGeoPhysicalNode.h>
10 #include <TMath.h>
11 
12 #include <FairField.h>
13 #include <FairLogger.h>
14 #include <FairRun.h>
15 
16 #include "CbmStsAlgoAnaCluster.h"
17 #include "CbmStsAlgoFindClusters.h"
18 #include "CbmStsAlgoFindHits.h"
19 #include "CbmStsDigi.h"
20 #include "CbmStsModule.h"
21 #include "CbmStsParSensor.h"
22 #include "CbmStsSensor.h"
23 
24 using std::pair;
25 
26 
28 
29 
30  // ----- Standard constructor ------------------------------------------
32 // -------------------------------------------------------------------------
33 
34 
35 // ----- Default constructor -------------------------------------------
37  const CbmStsParModule& parModule,
38  const CbmStsParSensor& parSensor,
39  Double_t lorentzShiftF,
40  Double_t lorentzShiftB)
41  : fSetupModule(setupModule)
42  , fParModule(&parModule)
43  , fParSensor(&parSensor)
44  , fLorentzShiftF(lorentzShiftF)
45  , fLorentzShiftB(lorentzShiftB) {
46  Init();
47 }
48 // -------------------------------------------------------------------------
49 
50 
51 // ----- Destructor ----------------------------------------------------
53 // -------------------------------------------------------------------------
54 
55 
56 // --------------- Add digi to queues ----------------------------------
57 void CbmStsRecoModule::AddDigiToQueue(const CbmStsDigi* digi, Int_t digiIndex) {
58  fLock.lock();
59  Int_t moduleAddress =
61  assert(moduleAddress == fSetupModule->GetAddress());
62  assert(digi->GetChannel() < 2 * fNofStrips);
63  if (digi->GetChannel() < fNofStrips)
64  fDigisF.push_back({digi, digiIndex});
65  else
66  fDigisB.push_back({digi, digiIndex});
67  fLock.unlock();
68 }
69 // -------------------------------------------------------------------------
70 
71 
72 // ----- Reconstruction ------------------------------------------------
74 
75  // --- Sort the digi queues by digi time stamp
76  std::sort(fDigisF.begin(),
77  fDigisF.end(),
78  [](pair<const CbmStsDigi*, Int_t> digi1,
79  pair<const CbmStsDigi*, Int_t> digi2) {
80  return digi1.first->GetTime() < digi2.first->GetTime();
81  });
82  std::sort(fDigisB.begin(),
83  fDigisB.end(),
84  [](pair<const CbmStsDigi*, Int_t> digi1,
85  pair<const CbmStsDigi*, Int_t> digi2) {
86  return digi1.first->GetTime() < digi2.first->GetTime();
87  });
88 
89  // --- Perform cluster finding
91  fClustersF,
93  fNofStrips,
94  0,
98  fParModule);
100  fClustersB,
102  fNofStrips,
103  fNofStrips,
107  fParModule);
108 
109  // --- Perform cluster analysis
110  for (auto& cluster : fClustersF)
111  fClusterAna->Exec(cluster, fParModule);
112  for (auto& cluster : fClustersB)
113  fClusterAna->Exec(cluster, fParModule);
114 
115  // --- Sort clusters by time
116  std::sort(fClustersF.begin(),
117  fClustersF.end(),
118  [](const CbmStsCluster& cluster1, const CbmStsCluster& cluster2) {
119  return (cluster1.GetTime() < cluster2.GetTime());
120  });
121  std::sort(fClustersB.begin(),
122  fClustersB.end(),
123  [](const CbmStsCluster& cluster1, const CbmStsCluster& cluster2) {
124  return (cluster1.GetTime() < cluster2.GetTime());
125  });
126 
127  // --- Perform hit finding
128  assert(fHitFinder);
130  fClustersB,
131  fHits,
135  fDyActive,
136  fNofStrips,
137  fStripPitch,
138  fStereoFront,
139  fStereoBack,
142  fMatrix);
143 }
144 // -------------------------------------------------------------------------
145 
146 
147 // ----- Reset before new time slice -----------------------------------
149  fDigisF.clear();
150  fDigisB.clear();
151 }
152 // -------------------------------------------------------------------------
153 
154 
155 // ----- Get the sensor parameters -------------------------------------
157 
158  // Reconstruction is currently implemented for double-sided strip
159  // sensor with the same number of strips and strip pitch on the
160  // front and on the back side.
161 
162  // --- Sensor class must be DssdStereo
164 
165  // --- Check for physical node of sensor
166  assert(fSetupModule);
167  assert(fSetupModule->GetNofDaughters() == 1);
168  TGeoPhysicalNode* sensorNode = fSetupModule->GetDaughter(0)->GetPnode();
169  assert(sensorNode);
170 
171  // --- Check consistency of parameters with geometry
172  TGeoBBox* shape = dynamic_cast<TGeoBBox*>(sensorNode->GetShape());
173  assert(shape);
174  assert(TMath::Abs(2. * shape->GetDX() - fParSensor->GetPar(0)) < 0.001);
175  assert(TMath::Abs(2. * shape->GetDY() - fParSensor->GetPar(1)) < 0.001);
176  assert(TMath::Abs(2. * shape->GetDZ() - fParSensor->GetPar(2)) < 0.001);
177 
178  // --- Positioning of sensor in global C.S.
179  fMatrix = sensorNode->GetMatrix();
180 
181  // --- Number of strips must be the same on both sides
182  Int_t nStripsF = fParSensor->GetParInt(4);
183  Int_t nStripsB = fParSensor->GetParInt(5);
184  assert(nStripsF > 0 && nStripsF == nStripsB);
185  fNofStrips = nStripsF;
186 
187  // --- Strip pitch must be the same on both sides
189  assert(fStripPitch > 0. && fStripPitch == fParSensor->GetPar(7));
190 
191  // --- Check that active size in x fits the geometrical extension
192  assert(Double_t(fNofStrips) * fStripPitch <= fParSensor->GetPar(0));
193 
194  // --- Check that active size in y fits the geometrical extension
196  assert(fDyActive <= fParSensor->GetPar(1));
197 
198  // --- Horizontal cross-connection for non-vanishing stereo angles
201  if (fStereoFront > 1.) fConnectEdgeFront = kTRUE;
202  if (fStereoBack > 1.) fConnectEdgeBack = kTRUE;
203 
204  // Disable cross-connection (needs bug fixing still)
205  // TODO: Enable again
206  fConnectEdgeFront = kFALSE;
207  fConnectEdgeBack = kFALSE;
208 
209  // Algorithms
213 
214  // Name
215  fName = fSetupModule->GetName();
216 }
217 // -------------------------------------------------------------------------
218 
219 
220 // ----- Info to string -------------------------------------------------
221 std::string CbmStsRecoModule::ToString() const {
222  std::stringstream ss;
223  ss << fSetupModule->ToString() << " Strips " << fNofStrips;
224  return ss.str();
225 }
226 // -------------------------------------------------------------------------
CbmStsAlgoFindClusters.h
CbmStsRecoModule::AddDigiToQueue
void AddDigiToQueue(const CbmStsDigi *digi, Int_t digiIndex)
Add a digi to the processing queue.
Definition: CbmStsRecoModule.cxx:57
CbmStsElement::GetAddress
Int_t GetAddress() const
Definition: CbmStsElement.h:65
ClassImp
ClassImp(CbmStsRecoModule) CbmStsRecoModule
Definition: CbmStsRecoModule.cxx:27
CbmStsAlgoAnaCluster.h
CbmStsCluster
Data class for STS clusters.
Definition: CbmStsCluster.h:31
CbmStsRecoModule::fMatrix
TGeoHMatrix * fMatrix
Sensor position in global C.S. [cm].
Definition: CbmStsRecoModule.h:138
CbmStsRecoModule::fDigisF
std::vector< std::pair< const CbmStsDigi *, Long64_t > > fDigisF
Definition: CbmStsRecoModule.h:143
CbmStsRecoModule::fDyActive
Double_t fDyActive
Active sensor size in y.
Definition: CbmStsRecoModule.h:133
CbmStsRecoModule::Reset
void Reset()
Clear input queue.
Definition: CbmStsRecoModule.cxx:148
CbmStsRecoModule::fParModule
const CbmStsParModule * fParModule
Definition: CbmStsRecoModule.h:131
CbmStsModule::ToString
std::string ToString() const
Definition: CbmStsModule.cxx:100
CbmStsRecoModule::fHits
std::vector< CbmStsHit > fHits
Definition: CbmStsRecoModule.h:147
CbmStsRecoModule::fTimeCutClusterSig
Double_t fTimeCutClusterSig
Time cut for hit finding (in ns)
Definition: CbmStsRecoModule.h:152
CbmStsRecoModule
Class for reconstruction in one STS module.
Definition: CbmStsRecoModule.h:44
CbmStsRecoModule::fParSensor
const CbmStsParSensor * fParSensor
Definition: CbmStsRecoModule.h:132
CbmStsRecoModule::fConnectEdgeBack
Bool_t fConnectEdgeBack
Round-the edge clustering back side.
Definition: CbmStsRecoModule.h:155
CbmStsRecoModule::Reconstruct
void Reconstruct()
Perform reconstruction.
Definition: CbmStsRecoModule.cxx:73
CbmStsParSensor::GetClass
CbmStsSensorClass GetClass() const
Get the sensor class.
Definition: CbmStsParSensor.h:56
CbmStsRecoModule::fClustersF
std::vector< CbmStsCluster > fClustersF
Definition: CbmStsRecoModule.h:145
CbmStsParSensor.h
CbmStsAlgoFindClusters::Exec
Long64_t Exec(const std::vector< InputData > &input, std::vector< CbmStsCluster > &output, UInt_t address, UShort_t nChannels, UShort_t channelOffset, Double_t timeCutSigma, Double_t timeCutAbs, Bool_t connectEdge, const CbmStsParModule *modPar)
Algorithm execution.
Definition: CbmStsAlgoFindClusters.cxx:55
CbmStsElement::GetPnode
TGeoPhysicalNode * GetPnode() const
Definition: CbmStsElement.h:106
CbmStsRecoModule::fStereoFront
Double_t fStereoFront
Strip stereo angle front side [deg].
Definition: CbmStsRecoModule.h:136
CbmStsModule
Class representing an instance of a readout unit in the CBM-STS.
Definition: CbmStsModule.h:31
CbmStsSensorClass::kDssdStereo
@ kDssdStereo
CbmStsParSensor
Constructional parameters of a STS sensor.
Definition: CbmStsParSensor.h:38
CbmStsDigi.h
CbmStsAlgoFindHits
Algorithm for hit finding in the sensors of the CBM-STS.
Definition: CbmStsAlgoFindHits.h:34
CbmStsRecoModule::fHitFinder
CbmStsAlgoFindHits * fHitFinder
///< Algo
Definition: CbmStsRecoModule.h:126
kStsModule
@ kStsModule
Definition: CbmStsAddress.h:21
CbmStsParModule
Parameters for one STS module.
Definition: CbmStsParModule.h:28
CbmStsRecoModule::Init
void Init()
Set and check the needed parameters.
Definition: CbmStsRecoModule.cxx:156
CbmStsRecoModule::fLorentzShiftF
Double_t fLorentzShiftF
Average Lorentz shift front side [cm|.
Definition: CbmStsRecoModule.h:139
CbmStsRecoModule.h
CbmStsRecoModule::fStereoBack
Double_t fStereoBack
Strip stereo angle back side [deg].
Definition: CbmStsRecoModule.h:137
CbmStsRecoModule::fTimeCutClusterAbs
Double_t fTimeCutClusterAbs
Time cut for hit finding (in sigma)
Definition: CbmStsRecoModule.h:153
CbmStsRecoModule::fLock
std::mutex fLock
///< Algo
Definition: CbmStsRecoModule.h:127
CbmStsRecoModule::fSetupModule
CbmStsModule * fSetupModule
Definition: CbmStsRecoModule.h:130
CbmStsDigi
Data class for a single-channel message in the STS.
Definition: CbmStsDigi.h:29
CbmStsRecoModule::fDigisB
std::vector< std::pair< const CbmStsDigi *, Long64_t > > fDigisB
Definition: CbmStsRecoModule.h:144
CbmStsRecoModule::fTimeCutDigiAbs
Double_t fTimeCutDigiAbs
Time cut for cluster finding (in ns)
Definition: CbmStsRecoModule.h:151
CbmStsRecoModule::fStripPitch
Double_t fStripPitch
Sensor strip pitch [cm].
Definition: CbmStsRecoModule.h:135
CbmStsDigi::GetAddress
Int_t GetAddress() const
Definition: CbmStsDigi.h:53
CbmStsRecoModule::fNofStrips
UInt_t fNofStrips
Number of sensor strips.
Definition: CbmStsRecoModule.h:134
CbmStsRecoModule::ToString
std::string ToString() const
Info to string.
Definition: CbmStsRecoModule.cxx:221
CbmStsParSensor::GetParInt
Int_t GetParInt(UInt_t index) const
Get the nearest integer value of a parameter.
Definition: CbmStsParSensor.cxx:31
shape
UInt_t shape
Definition: CbmMvdSensorDigiToHitTask.cxx:73
CbmStsElement::GetDaughter
CbmStsElement * GetDaughter(Int_t index) const
Definition: CbmStsElement.cxx:120
CbmStsRecoModule::CbmStsRecoModule
CbmStsRecoModule()
Default constructor.
CbmStsParSensor::GetPar
Float_t GetPar(UInt_t index) const
Get a parameter.
Definition: CbmStsParSensor.cxx:22
CbmStsElement::GetNofDaughters
Int_t GetNofDaughters() const
Definition: CbmStsElement.h:95
CbmStsRecoModule::fClusterFinder
CbmStsAlgoFindClusters * fClusterFinder
///< Algo
Definition: CbmStsRecoModule.h:125
CbmStsAlgoAnaCluster::Exec
void Exec(CbmStsCluster &cluster, const CbmStsParModule *module)
Algorithm execution.
Definition: CbmStsAlgoAnaCluster.cxx:220
CbmStsRecoModule::fLorentzShiftB
Double_t fLorentzShiftB
Average Lorentz shift back side [cm|.
Definition: CbmStsRecoModule.h:140
CbmStsAlgoAnaCluster
Determination of cluster parameters.
Definition: CbmStsAlgoAnaCluster.h:31
CbmStsAlgoFindHits.h
CbmStsRecoModule::~CbmStsRecoModule
virtual ~CbmStsRecoModule()
Destructor.
Definition: CbmStsRecoModule.cxx:52
CbmStsModule.h
CbmStsAlgoFindClusters
Algorithm for cluster finding in a linear array of channels.
Definition: CbmStsAlgoFindClusters.h:54
CbmStsAddress::GetMotherAddress
Int_t GetMotherAddress(Int_t address, Int_t level)
Construct the address of an element from the address of a descendant element.
Definition: CbmStsAddress.cxx:168
CbmStsRecoModule::fClusterAna
CbmStsAlgoAnaCluster * fClusterAna
Definition: CbmStsRecoModule.h:124
CbmStsRecoModule::fConnectEdgeFront
Bool_t fConnectEdgeFront
Round-the edge clustering front side.
Definition: CbmStsRecoModule.h:154
CbmStsRecoModule::fTimeCutDigiSig
Double_t fTimeCutDigiSig
Time cut for cluster finding (in sigma)
Definition: CbmStsRecoModule.h:150
CbmStsRecoModule::fClustersB
std::vector< CbmStsCluster > fClustersB
Definition: CbmStsRecoModule.h:146
CbmStsDigi::GetChannel
UShort_t GetChannel() const
Channel number in module @value Channel number.
Definition: CbmStsDigi.h:59
CbmStsAlgoFindHits::Exec
Long64_t Exec(const std::vector< CbmStsCluster > &clustersF, const std::vector< CbmStsCluster > &clustersB, std::vector< CbmStsHit > &hits, UInt_t address, Double_t timeCutSig, Double_t timeCutAbs, Double_t dY, UInt_t nStrips, Double_t pitch, Double_t stereoF, Double_t stereoB, Double_t lorentzF, Double_t lorentzB, TGeoHMatrix *matrix)
Execute algorithm.
Definition: CbmStsAlgoFindHits.cxx:85
CbmStsSensor.h