CbmRoot
Loading...
Searching...
No Matches
CbmBbaAlignmentTask.h
Go to the documentation of this file.
1/* Copyright (C) 2023-2023 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: S.Gorbunov[committer], N.Bluhme */
4
11
12#ifndef CbmBbaAlignmentTask_H
13#define CbmBbaAlignmentTask_H
14
15
16#include "CbmDefs.h"
17#include "CbmKfTrackFitter.h"
18#include "FairTask.h"
19#include "TString.h"
20
21#include <vector>
22
23class TObject;
24class TH1F;
25class TClonesArray;
26class TFile;
27class TDirectory;
28class TH1F;
29
30
33
34class CbmBbaAlignmentTask : public FairTask {
35 public:
36 // Constructors/Destructors ---------
37 CbmBbaAlignmentTask(const char* name = "CbmBbaAlignmentTask", Int_t iVerbose = 0,
38 TString histoFileName = "CbmBbaAlignmentHisto.root");
40
41 Int_t GetZtoNStation(Double_t getZ);
42
43 InitStatus Init();
44 void Exec(Option_t* opt);
45 void Finish();
46
49
51 void SetRandomSeed(int seed) { fRandomSeed = seed; }
52
53 public:
55 {
57 kMcbm
58 };
59
63
66
67 int fNmvdHits{0}; // number of MVD hits
68 int fNstsHits{0}; // number of STS hits
69 int fNmuchHits{0}; // number of MUCH hits
70 int fNtrd1dHits{0}; // number of TRD hits
71 int fNtrd2dHits{0}; // number of TRD hits
72 int fNtofHits{0}; // number of TOF hits
73
74 bool fIsActive{1}; // is the track active
75 void MakeConsistent();
76 };
77
80 };
81
82 struct Sensor {
84 int fSensorId{-1};
87 std::string fNodePath{""};
88 bool operator<(const Sensor& other) const
89 {
90 if (fSystemId < other.fSystemId) return true;
91 if (fSystemId > other.fSystemId) return false;
92 if (fTrackingStation < other.fTrackingStation) return true;
93 if (fTrackingStation > other.fTrackingStation) return false;
94 return (fSensorId < other.fSensorId);
95 };
96
97 bool operator==(const Sensor& other) const
98 {
99 return (fSystemId == other.fSystemId) && (fSensorId == other.fSensorId);
100 };
101 };
102
103 private:
106
107 void WriteHistosCurFile(TObject* obj);
108
109 void ApplyAlignment(const std::vector<double>& par);
110
111 double CostFunction(const std::vector<double>& par);
112
113 void ApplyConstraints(std::vector<double>& par);
114
115 void ConstrainStation(std::vector<double>& par, int iSta, int ixyz);
116
117
119
120 // input data arrays
121
122 TClonesArray* fInputGlobalTracks{nullptr};
123 TClonesArray* fInputStsTracks{nullptr};
124
125 TClonesArray* fInputMcTracks{nullptr}; // Mc info for debugging
126 TClonesArray* fInputGlobalTrackMatches{nullptr}; // Mc info for debugging
127 TClonesArray* fInputStsTrackMatches{nullptr}; // Mc info for debugging
128
129 int fNthreads = 1;
130
132
133 // collection of selected tracks and hits
134 std::vector<TrackContainer> fTracks;
135
136 //output file with histograms
137 TString fHistoFileName{"CbmBbaAlignmentHisto.root"};
138 TFile* fHistoFile{nullptr};
139 TDirectory* fHistoDir{nullptr};
140
142
144
147
148 double fCostIdeal{1.e10};
149 double fCostInitial{0.};
150
151 double fSimulatedMisalignmentRange{0.}; // misalignment range for simulated misalignment
152
154
155 double fChi2Total{0.};
156 long fNdfTotal{0};
157 long fFixedNdf{-1};
158
159 std::vector<Sensor> fSensors;
160 std::vector<AlignmentBody> fAlignmentBodies;
161
162 //histograms
163
164 std::vector<TH1F*> hResidualsBeforeAlignmentX{};
165 std::vector<TH1F*> hResidualsBeforeAlignmentY{};
166 std::vector<TH1F*> hResidualsAfterAlignmentX{};
167 std::vector<TH1F*> hResidualsAfterAlignmentY{};
168
169 std::vector<TH1F*> hPullsBeforeAlignmentX{};
170 std::vector<TH1F*> hPullsBeforeAlignmentY{};
171 std::vector<TH1F*> hPullsAfterAlignmentX{};
172 std::vector<TH1F*> hPullsAfterAlignmentY{};
173
175};
176
177#endif
ECbmModuleId
Definition CbmDefs.h:39
int Int_t
an example of alignment using BBA package
TClonesArray * fInputGlobalTrackMatches
const CbmBbaAlignmentTask & operator=(const CbmBbaAlignmentTask &)
void WriteHistosCurFile(TObject *obj)
std::vector< TrackContainer > fTracks
void SetRandomSeed(int seed)
CbmBbaAlignmentTask(const char *name="CbmBbaAlignmentTask", Int_t iVerbose=0, TString histoFileName="CbmBbaAlignmentHisto.root")
std::vector< TH1F * > hPullsBeforeAlignmentX
TClonesArray * fInputStsTrackMatches
std::vector< TH1F * > hPullsAfterAlignmentX
CbmBbaAlignmentTask(const CbmBbaAlignmentTask &)
TClonesArray * fInputMcTracks
TClonesArray * fInputStsTracks
Int_t GetZtoNStation(Double_t getZ)
ClassDef(CbmBbaAlignmentTask, 1)
void SetSimulatedMisalignmentRange(double range)
std::vector< TH1F * > hResidualsAfterAlignmentX
std::vector< AlignmentBody > fAlignmentBodies
std::vector< TH1F * > hPullsBeforeAlignmentY
void ApplyAlignment(const std::vector< double > &par)
void ApplyConstraints(std::vector< double > &par)
TClonesArray * fInputGlobalTracks
std::vector< TH1F * > hResidualsAfterAlignmentY
std::vector< Sensor > fSensors
std::vector< TH1F * > hResidualsBeforeAlignmentX
void Exec(Option_t *opt)
std::vector< TH1F * > hResidualsBeforeAlignmentY
std::vector< TH1F * > hPullsAfterAlignmentY
double CostFunction(const std::vector< double > &par)
void ConstrainStation(std::vector< double > &par, int iSta, int ixyz)
bool operator<(const Sensor &other) const
bool operator==(const Sensor &other) const
CbmKfTrackFitter::Trajectory fUnalignedTrack
CbmKfTrackFitter::Trajectory fAlignedTrack
A trajectory to be fitted.