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
39class CbmBbaAlignmentTask : public FairTask {
40 public:
41 // Constructors/Destructors ---------
42 CbmBbaAlignmentTask(const char* name = "CbmBbaAlignmentTask", Int_t iVerbose = 0,
43 TString histoFileName = "CbmBbaAlignmentHisto.root");
45
46 Int_t GetZtoNStation(Double_t getZ);
47
48 InitStatus Init();
49 void Exec(Option_t* opt);
50 void Finish();
51
54
56
57 public:
59 {
61 kMcbm
62 };
63
67
70
71 int fNmvdHits{0}; // number of MVD hits
72 int fNstsHits{0}; // number of STS hits
73 int fNmuchHits{0}; // number of MUCH hits
74 int fNtrd1dHits{0}; // number of TRD hits
75 int fNtrd2dHits{0}; // number of TRD hits
76 int fNtofHits{0}; // number of TOF hits
77
78 bool fIsActive{1}; // is the track active
79 void MakeConsistent();
80 };
81
84 };
85
86 struct Sensor {
88 int fSensorId{-1};
91 std::string fNodePath{""};
92 bool operator<(const Sensor& other) const
93 {
94 if (fSystemId < other.fSystemId) return true;
95 if (fSystemId > other.fSystemId) return false;
96 if (fTrackingStation < other.fTrackingStation) return true;
97 if (fTrackingStation > other.fTrackingStation) return false;
98 return (fSensorId < other.fSensorId);
99 };
100
101 bool operator==(const Sensor& other) const
102 {
103 return (fSystemId == other.fSystemId) && (fSensorId == other.fSensorId);
104 };
105 };
106
107 private:
110
111 void WriteHistosCurFile(TObject* obj);
112
113 void ApplyAlignment(const std::vector<double>& par);
114
115 double CostFunction(const std::vector<double>& par);
116
117 void ApplyConstraints(std::vector<double>& par);
118
119 void ConstrainStation(std::vector<double>& par, int iSta, int ixyz);
120
121
123
124 // input data arrays
125
126 TClonesArray* fInputGlobalTracks{nullptr};
127 TClonesArray* fInputStsTracks{nullptr};
128
129 TClonesArray* fInputMcTracks{nullptr}; // Mc info for debugging
130 TClonesArray* fInputGlobalTrackMatches{nullptr}; // Mc info for debugging
131 TClonesArray* fInputStsTrackMatches{nullptr}; // Mc info for debugging
132
133 int fNthreads = 1;
134
136
137 // collection of selected tracks and hits
138 std::vector<TrackContainer> fTracks;
139
140 //output file with histograms
141 TString fHistoFileName{"CbmBbaAlignmentHisto.root"};
142 TFile* fHistoFile{nullptr};
143 TDirectory* fHistoDir{nullptr};
144
145 Int_t fNEvents{0};
146
147 Int_t fMaxNtracks{100000};
148
151
152 double fCostIdeal{1.e10};
153 double fCostInitial{0.};
154
155 double fSimulatedMisalignmentRange{0.}; // misalignment range for simulated misalignment
156
157 double fChi2Total{0.};
158 long fNdfTotal{0};
159 long fFixedNdf{-1};
160
161 std::vector<Sensor> fSensors;
162 std::vector<AlignmentBody> fAlignmentBodies;
163
164 //histograms
165
166 std::vector<TH1F*> hResidualsBeforeAlignmentX{};
167 std::vector<TH1F*> hResidualsBeforeAlignmentY{};
168 std::vector<TH1F*> hResidualsAfterAlignmentX{};
169 std::vector<TH1F*> hResidualsAfterAlignmentY{};
170
171 std::vector<TH1F*> hPullsBeforeAlignmentX{};
172 std::vector<TH1F*> hPullsBeforeAlignmentY{};
173 std::vector<TH1F*> hPullsAfterAlignmentX{};
174 std::vector<TH1F*> hPullsAfterAlignmentY{};
175
177};
178
179#endif
ECbmModuleId
Definition CbmDefs.h:39
TClonesArray * fInputGlobalTrackMatches
const CbmBbaAlignmentTask & operator=(const CbmBbaAlignmentTask &)
void WriteHistosCurFile(TObject *obj)
std::vector< TrackContainer > fTracks
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.