18#include "CbmGeoStsPar.h"
21#include "CbmStsDigiPar.h"
24#include "CbmStsSector.h"
25#include "CbmStsSensor.h"
26#include "CbmStsStation.h"
27#include "FairRootManager.h"
28#include "FairRunAna.h"
29#include "FairRuntimeDb.h"
36#include "TProfile2D.h"
49CbmL1* CbmL1::fInstance = 0;
89 , listMvdHitMatches(0)
99 , fFindParticlesMode()
100 , fMatBudgetFileName(
"")
101 , fExtrapolateToTheEndOfSTS(false)
113 TString fSTAPDataDir_,
114 int findParticleMode_)
128 fPerformance(_fPerformance)
129 , fSTAPDataMode(fSTAPDataMode_)
130 , fSTAPDataDir(fSTAPDataDir_)
155 , listMvdHitMatches(0)
165 , fFindParticlesMode(findParticleMode_)
166 , fMatBudgetFileName(
"")
167 , fExtrapolateToTheEndOfSTS(false)
177 if (fInstance ==
this)
187 FairRuntimeDb* rtdb = FairRuntimeDb::instance();
189 rtdb->getContainer(
"FairGeoPassivePar");
190 rtdb->getContainer(
"CbmGeoStsPar");
191 rtdb->getContainer(
"CbmStsDigiPar");
205 char y[20] =
" [0;33;44m";
206 char Y[20] =
" [1;33;44m";
207 char W[20] =
" [1;37;44m";
208 char o[20] =
" [0m\n";
209 Y[0] = y[0] =
W[0] = o[0] = 0x1B;
211 cout << endl << endl;
212 cout <<
" " <<
W <<
" " << o;
213 cout <<
" " <<
W <<
" ===////====================================================== " << o;
214 cout <<
" " <<
W <<
" = = " << o;
215 cout <<
" " <<
W <<
" = " << Y <<
"L1 on-line finder" <<
W <<
" = "
217 cout <<
" " <<
W <<
" = = " << o;
218 cout <<
" " <<
W <<
" = " <<
W <<
"Cellular Automaton 3.1 Vector" << y <<
" with " <<
W <<
"KF Quadro" << y
219 <<
" technology" <<
W <<
" = " << o;
220 cout <<
" " <<
W <<
" = = " << o;
221 cout <<
" " <<
W <<
" = " << y <<
"Designed for CBM collaboration" <<
W <<
" = "
223 cout <<
" " <<
W <<
" = " << y <<
"All rights reserved" <<
W <<
" = "
225 cout <<
" " <<
W <<
" = = " << o;
226 cout <<
" " <<
W <<
" ========================================================////= " << o;
227 cout <<
" " <<
W <<
" " << o;
228 cout << endl << endl;
231 FairRootManager* fManger = FairRootManager::Instance();
236 FairRuntimeDb* RunDB = FairRuntimeDb::instance();
239 CbmGeoStsPar* StsPar = L1_DYNAMIC_CAST<CbmGeoStsPar*>(RunDB->findContainer(
"CbmGeoStsPar"));
240 CbmStsDigiPar* digiPar = L1_DYNAMIC_CAST<CbmStsDigiPar*>(RunDB->findContainer(
"CbmStsDigiPar"));
242 StsDigi->
Init(StsPar, digiPar);
253 histodir = gROOT->mkdir(
"L1");
256 listMCTracks = L1_DYNAMIC_CAST<TClonesArray*>(fManger->GetObject(
"MCTrack"));
257 listStsPts = L1_DYNAMIC_CAST<TClonesArray*>(fManger->GetObject(
"StsPoint"));
258 listStsClusters = L1_DYNAMIC_CAST<TClonesArray*>(fManger->GetObject(
"StsCluster"));
259 listStsDigi = L1_DYNAMIC_CAST<TClonesArray*>(fManger->GetObject(
"StsDigi"));
266 listStsHits = L1_DYNAMIC_CAST<TClonesArray*>(fManger->GetObject(
"StsHit"));
271 listMvdHitMatches = 0;
273 listMvdPts = L1_DYNAMIC_CAST<TClonesArray*>(fManger->GetObject(
"MvdPoint"));
274 listMvdHitMatches = L1_DYNAMIC_CAST<TClonesArray*>(fManger->GetObject(
"MvdHitMatch"));
278 listMvdHitMatches = 0;
283 listMvdHits = L1_DYNAMIC_CAST<TClonesArray*>(fManger->GetObject(
"MvdHit"));
294 for (
int i = 0;
i < 3;
i++) {
295 Double_t point[3] = {0, 0, 2.5 *
i};
296 Double_t B[3] = {0, 0, 0};
299 geo[ind++] = 2.5 *
i;
308 NStation = NMvdStations + NStsStations;
309 geo[ind++] = NStation;
310 geo[ind++] = NMvdStations;
314 const int N = (M + 1) * (M + 2) / 2;
369 for (Int_t ist = 0; ist < NStation; ist++) {
373 if (ist < NMvdStations) {
380 fscal f_phi = 0, f_sigma = 5.e-4, b_phi = 3.14159265358 / 2., b_sigma = 5.e-4;
383 b_phi = 3.14159265358 / 2.;
386 geo[ind++] = f_sigma;
388 geo[ind++] = b_sigma;
395 geo[ind++] = st->
GetZ();
396 geo[ind++] = st->
GetD();
402 fscal f_phi, f_sigma, b_phi, b_sigma;
406 b_phi += 3.14159265358 / 2.;
412 f_sigma = sector->
GetDx() / TMath::Sqrt(12);
424 geo[ind++] = f_sigma;
426 geo[ind++] = b_sigma;
433 for (
int isec = 0; isec < st->
GetNSectors(); isec++) {
435 for (
int isen = 0; isen < sect->
GetNSensors(); isen++) {
446 cout <<
" AZ - station " << ist <<
" " << f_phi * TMath::RadToDeg() <<
" " << b_phi * TMath::RadToDeg()
447 <<
" " << Xmax <<
" " << Ymax << endl;
448 Xmax = TMath::Abs(Xmax);
449 Ymax = TMath::Abs(Ymax);
455 if (dx > Xmax / N / 2)
457 if (dy > Ymax / N / 2)
460 for (
int i = 0;
i < 3;
i++)
461 for (
int k = 0; k < N; k++)
464 TVectorD b0(N), b1(N), b2(N);
465 for (
int i = 0;
i < N;
i++) {
466 for (
int j = 0; j < N; j++)
468 b0(
i) = b1(
i) = b2(
i) = 0.;
470 for (
double x = -Xmax; x <= Xmax; x += dx)
471 for (
double y = -Ymax; y <= Ymax; y += dy) {
472 double r =
sqrt(
fabs(x * x / Xmax / Xmax + y / Ymax * y / Ymax));
475 Double_t w = 1. / (r * r + 1);
476 Double_t p[3] = {x, y, z};
477 Double_t B[3] = {0., 0., 0.};
481 for (
int i = 1;
i <= M;
i++) {
482 int k = (
i - 1) * (
i) / 2;
483 int l =
i * (
i + 1) / 2;
484 for (
int j = 0; j <
i; j++)
485 m(l + j) = x *
m(k + j);
486 m(l +
i) = y *
m(k +
i - 1);
490 for (
int i = 0;
i < N;
i++) {
491 for (
int j = 0; j < N; j++)
492 A(
i, j) += w *
m(
i) *
m(j);
493 b0(
i) += w * B[0] *
m(
i);
494 b1(
i) += w * B[1] *
m(
i);
495 b2(
i) += w * B[2] *
m(
i);
500 TVectorD c0 = A * b0, c1 = A * b1, c2 = A * b2;
501 for (
int i = 0;
i < N;
i++) {
508 for (
int k = 0; k < 3; k++) {
509 for (
int j = 0; j < N; j++)
510 geo[ind++] = C[k][j];
514 geo[ind++] = fTrackingLevel;
515 geo[ind++] = fMomentumCutOff;
516 geo[ind++] = fGhostSuppression;
519 if (fSTAPDataMode % 2 == 1) {
520 WriteSTAPGeoData(
static_cast<void*
>(geo), ind);
522 if (fSTAPDataMode >= 2) {
524 ReadSTAPGeoData(
static_cast<void*
>(geo), ind2);
526 cout <<
"-E- CbmL1: Read geometry from file " << fSTAPDataDir +
"geo_algo.txt was NOT successful."
539 algo->
fRadThick[iSta].table[0][0] =
algo->vStations[iSta].materialInfo.RadThick[0];
543 if (fMatBudgetFileName !=
"") {
544 TFile* oldfile = gFile;
545 TFile* rlFile =
new TFile(fMatBudgetFileName);
547 cout <<
"STS Material budget file is " << fMatBudgetFileName <<
"." << endl;
549 TString name =
"Radiation Thickness [%]";
553 TProfile2D* hStaRadLen = (TProfile2D*)rlFile->Get(name);
555 cout <<
"L1: incorrect " << fMatBudgetFileName <<
" file. No " << name << endl;
559 const int NBins = hStaRadLen->GetNbinsX();
560 const float RMax = hStaRadLen->GetXaxis()->GetXmax();
564 for (
int iB = 0; iB <
NBins; iB++) {
566 for (
int iB2 = 0; iB2 <
NBins; iB2++) {
568 0.01 * hStaRadLen->GetBinContent(iB, iB2);
569 if (
algo->
fRadThick[iSta].table[iB][iB2] <
algo->vStations[iSta].materialInfo.RadThick[0])
570 algo->
fRadThick[iSta].table[iB][iB2] =
algo->vStations[iSta].materialInfo.RadThick[0];
580 cout <<
"No material budget file is found. Homogenious budget will be used" << endl;
586 algo->
fRadThick[iSta].table[0][0] =
algo->vStations[iSta].materialInfo.RadThick[0];
597 static int nevent = 0;
599 cout << endl <<
"CbmL1::Exec event " << ++nevent <<
" ..." << endl << endl;
605 if (fSTAPDataMode % 2 == 1) {
609 if (fSTAPDataMode >= 2) {
617 vector<int> sF, sB, zP;
621 for (
unsigned int iH = 0; iH <
algo->
vStsHits.size(); ++iH) {
623 if (vStsHits[iH].mcPointIds.size() == 0)
626 const CbmL1MCPoint& mcp = vMCPoints[vStsHits[iH].mcPointIds[0]];
629 if (std::find(sF.begin(), sF.end(), h.
f) != sF.end()) {
635 if (std::find(sB.begin(), sB.end(), h.
b) != sB.end()) {
641 if (std::find(zP.begin(), zP.end(), h.
iz) != zP.end()) {
673 cout <<
"L1 Track finder..." << endl;
677 cout <<
"L1 Track finder ok" << endl;
681 cout <<
"L1 Track fitter ok" << endl;
688 for (
int i = 0;
i < 6;
i++)
689 t.
T[
i] = it->TFirst[
i];
690 for (
int i = 0;
i < 15;
i++)
691 t.
C[
i] = it->CFirst[
i];
692 for (
int i = 0;
i < 6;
i++)
694 for (
int i = 0;
i < 15;
i++)
699 for (
int i = 0;
i < it->NHits;
i++) {
715 cout <<
"Performance..." << endl;
719 if (fFindParticlesMode) {
726 EfficienciesPerformance();
728 TrackFitPerformance();
730 if (fFindParticlesMode) {
732 FindReconstructableMCParticles();
734 PartEffPerformance();
735 PartHistoPerformance();
740 cout <<
"End of L1" << endl;
745 std::cout << std::endl <<
"L1 run (any/r/q) > ";
747 std::cin.get(symbol);
750 if ((symbol ==
'e') || (symbol ==
'q'))
752 }
while (symbol !=
'\n');
759 TDirectory* curr = gDirectory;
760 TFile* currentFile = gFile;
762 TFile* outfile =
new TFile(
"L1_histo.root",
"RECREATE");
764 writedir2current(histodir);
771void CbmL1::writedir2current(TObject* obj)
773 if (!obj->IsFolder())
776 TDirectory* cur = gDirectory;
777 TDirectory* sub = cur->mkdir(obj->GetName());
779 TList* listSub = (L1_DYNAMIC_CAST<TDirectory*>(obj))->GetList();
781 while (TObject* obj1 = it())
782 writedir2current(obj1);
789void CbmL1::IdealTrackFinder()
794 for (vector<CbmL1MCTrack>::iterator
i = vMCTracks.begin();
i != vMCTracks.end(); ++
i) {
806 int lastStation = -1;
807 for (
unsigned int iH = 0; iH < MC.
StsHits.size(); iH++) {
808 const int hitI = MC.
StsHits[iH];
810 if (vMCPoints[hit.
mcPointIds[0]].iStation <= lastStation) {
813 lastStation = vMCPoints[hit.
mcPointIds[0]].iStation;
826void CbmL1::WriteSTAPGeoData(
void* geo_,
int size)
830 TString fgeo_name = fSTAPDataDir +
"geo_algo.txt";
831 ofstream fgeo(fgeo_name);
832 fgeo.setf(ios::scientific, ios::floatfield);
834 for (
int i = 0;
i < size;
i++) {
835 fgeo << geo[
i] << endl;
838 cout <<
"-I- CbmL1: Geometry data has been written in " << fgeo_name << endl;
841void CbmL1::WriteSTAPAlgoData()
844 static int vNEvent = 1;
847 TString fadata_name = fSTAPDataDir +
"data_algo.txt";
852 fadata.open(fadata_name, fstream::out);
854 fadata.open(fadata_name, fstream::out | fstream::app);
856 fadata <<
"Event:" <<
" ";
857 fadata << vNEvent << endl;
861 for (
int i = 0;
i < n;
i++) {
865 cout <<
"vStsStrips[" << n <<
"]" <<
" have been written." << endl;
869 for (
int i = 0;
i < n;
i++) {
873 cout <<
"vStsStripsB[" << n <<
"]" <<
" have been written." << endl;
877 for (
int i = 0;
i < n;
i++) {
881 cout <<
"vStsZPos[" << n <<
"]" <<
" have been written." << endl;
885 unsigned char element;
886 for (
int i = 0;
i < n;
i++) {
888 fadata << static_cast<int>(element) << endl;
891 cout <<
"vSFlag[" << n <<
"]" <<
" have been written." << endl;
895 for (
int i = 0;
i < n;
i++) {
897 fadata << static_cast<int>(element) << endl;
900 cout <<
"vSFlagB[" << n <<
"]" <<
" have been written." << endl;
904 for (
int i = 0;
i < n;
i++) {
910 cout <<
"vStsHits[" << n <<
"]" <<
" have been written." << endl;
913 for (
int i = 0;
i < n;
i++) {
919 for (
int i = 0;
i < n;
i++) {
928 cout <<
"-I- CbmL1: CATrackFinder data for event number " << vNEvent <<
" have been written in file " << fadata_name
933void CbmL1::WriteSTAPPerfData()
936 fpdata << setprecision(8);
938 static int vNEvent = 1;
940 TString fpdata_name = fSTAPDataDir +
"data_perfo.txt";
946 fpdata.open(fpdata_name, fstream::out);
948 fpdata.open(fpdata_name, fstream::out | fstream::app);
951 fpdata << vNEvent << endl;
953 Int_t n = vMCPoints.size();
955 for (
int i = 0;
i < n;
i++) {
956 fpdata << vMCPoints[
i].xIn <<
" ";
957 fpdata << vMCPoints[
i].yIn <<
" ";
958 fpdata << vMCPoints[
i].zIn <<
" ";
959 fpdata << vMCPoints[
i].pxIn <<
" ";
960 fpdata << vMCPoints[
i].pyIn <<
" ";
961 fpdata << vMCPoints[
i].pzIn <<
" " << endl;
962 fpdata << vMCPoints[
i].xOut <<
" ";
963 fpdata << vMCPoints[
i].yOut <<
" ";
964 fpdata << vMCPoints[
i].zOut <<
" ";
965 fpdata << vMCPoints[
i].pxOut <<
" ";
966 fpdata << vMCPoints[
i].pyOut <<
" ";
967 fpdata << vMCPoints[
i].pzOut <<
" " << endl;
969 fpdata << vMCPoints[
i].p <<
" ";
970 fpdata << vMCPoints[
i].q <<
" ";
971 fpdata << vMCPoints[
i].mass <<
" ";
973 fpdata << vMCPoints[
i].pdg <<
" ";
974 fpdata << vMCPoints[
i].ID <<
" ";
975 fpdata << vMCPoints[
i].mother_ID <<
" ";
976 fpdata << vMCPoints[
i].iStation << endl;
978 const int nhits = vMCPoints[
i].hitIds.size();
979 fpdata << nhits << endl <<
" ";
980 for (
int k = 0; k < nhits; k++) {
981 fpdata << vMCPoints[
i].hitIds[k] <<
" ";
986 cout <<
"vMCPoints[" << n <<
"]" <<
" have been written." << endl;
989 n = vMCTracks.size();
991 for (
int i = 0;
i < n;
i++) {
992 fpdata << vMCTracks[
i].x <<
" ";
993 fpdata << vMCTracks[
i].y <<
" ";
994 fpdata << vMCTracks[
i].z <<
" ";
995 fpdata << vMCTracks[
i].px <<
" ";
996 fpdata << vMCTracks[
i].py <<
" ";
997 fpdata << vMCTracks[
i].pz <<
" ";
998 fpdata << vMCTracks[
i].p <<
" ";
999 fpdata << vMCTracks[
i].q <<
" ";
1000 fpdata << vMCTracks[
i].mass <<
" ";
1002 fpdata << vMCTracks[
i].pdg <<
" ";
1003 fpdata << vMCTracks[
i].ID <<
" ";
1004 fpdata << vMCTracks[
i].mother_ID << endl;
1006 int nhits = vMCTracks[
i].StsHits.size();
1007 fpdata <<
" " << nhits << endl <<
" ";
1008 for (
int k = 0; k < nhits; k++) {
1009 fpdata << vMCTracks[
i].StsHits[k] <<
" ";
1013 const int nPoints = vMCTracks[
i].Points.size();
1014 fpdata << nPoints << endl <<
" ";
1015 for (
int k = 0; k < nPoints; k++) {
1016 fpdata << vMCTracks[
i].Points[k] <<
" ";
1020 fpdata << vMCTracks[
i].nMCContStations <<
" ";
1021 fpdata << vMCTracks[
i].nHitContStations <<
" ";
1022 fpdata << vMCTracks[
i].maxNStaMC <<
" ";
1023 fpdata << vMCTracks[
i].maxNSensorMC <<
" ";
1024 fpdata << vMCTracks[
i].maxNStaHits <<
" ";
1025 fpdata << vMCTracks[
i].nStations << endl;
1028 cout <<
"vMCTracks[" << n <<
"]" <<
" have been written." << endl;
1031 n = vHitMCRef.size();
1032 fpdata << n << endl;
1033 for (
int i = 0;
i < n;
i++) {
1034 fpdata << vHitMCRef[
i] << endl;
1037 cout <<
"vHitMCRef[" << n <<
"]" <<
" have been written." << endl;
1041 fpdata << n << endl;
1042 for (
int i = 0;
i < n;
i++) {
1050 cout <<
"vHitStore[" << n <<
"]" <<
" have been written." << endl;
1053 n = vStsHits.size();
1054 fpdata << n << endl;
1055 for (
int i = 0;
i < n;
i++) {
1056 fpdata << vStsHits[
i].hitId <<
" ";
1057 fpdata << vStsHits[
i].extIndex << endl;
1059 const int nPoints = vStsHits[
i].mcPointIds.size();
1060 fpdata << nPoints << endl <<
" ";
1061 for (
int k = 0; k < nPoints; k++) {
1062 fpdata << vStsHits[
i].mcPointIds[k] <<
" ";
1067 cout <<
"vStsHits[" << n <<
"]" <<
" have been written." << endl;
1071 cout <<
"-I- CbmL1: Data for performance of event number " << vNEvent <<
" have been written in file "
1072 << fpdata_name << endl;
1076istream& CbmL1::eatwhite(istream& is)
1080 if (isspace(c) == 0) {
1088void CbmL1::ReadSTAPGeoData(
void* geo_,
int& size)
1091 TString fgeo_name = fSTAPDataDir +
"geo_algo.txt";
1092 ifstream fgeo(fgeo_name);
1094 cout <<
"-I- CbmL1: Read geometry from file " << fgeo_name << endl;
1096 for (
i = 0; !fgeo.eof();
i++) {
1098 fgeo >> tmp >> eatwhite;
1105void CbmL1::ReadSTAPAlgoData()
1107 static int nEvent = 1;
1108 static fstream fadata;
1109 TString fadata_name = fSTAPDataDir +
"data_algo.txt";
1113 fadata.open(fadata_name, fstream::in);
1124 char s[] =
"Event: ";
1129 cout <<
"-E- CbmL1: Can't read event number " << nEvent <<
" from file " << fadata_name << endl;
1134 for (
int i = 0;
i < n;
i++) {
1140 cout <<
"vStsStrips[" << n <<
"]" <<
" have been read." << endl;
1143 for (
int i = 0;
i < n;
i++) {
1149 cout <<
"vStsStripsB[" << n <<
"]" <<
" have been read." << endl;
1152 for (
int i = 0;
i < n;
i++) {
1158 cout <<
"vStsZPos[" << n <<
"]" <<
" have been read." << endl;
1161 for (
int i = 0;
i < n;
i++) {
1164 algo->
vSFlag.push_back(
static_cast<unsigned char>(element));
1167 cout <<
"vSFlag[" << n <<
"]" <<
" have been read." << endl;
1170 for (
int i = 0;
i < n;
i++) {
1173 algo->
vSFlagB.push_back(
static_cast<unsigned char>(element));
1176 cout <<
"vSFlagB[" << n <<
"]" <<
" have been read." << endl;
1182 for (
int i = 0;
i < n;
i++) {
1184 fadata >> element_f >> element_b >> element_iz;
1185 element.
f =
static_cast<THitI>(element_f);
1186 element.
b =
static_cast<THitI>(element_b);
1187 element.
iz =
static_cast<TZPosI>(element_iz);
1191 cout <<
"vStsHits[" << n <<
"]" <<
" have been read." << endl;
1194 for (
int i = 0;
i < n;
i++) {
1200 for (
int i = 0;
i < n;
i++) {
1207 cout <<
"-I- CbmL1: CATrackFinder data for event " << nEvent <<
" has been read from file " << fadata_name
1208 <<
" successfully." << endl;
1214void CbmL1::ReadSTAPPerfData()
1216 static int nEvent = 1;
1217 static fstream fpdata;
1218 TString fpdata_name = fSTAPDataDir +
"data_perfo.txt";
1222 fpdata.open(fpdata_name, fstream::in);
1232 char s[] =
"EVENT: ";
1238 cout <<
"-E- CbmL1: Performance: can't read event number " << nEvent <<
" from file " <<
"data_perfo.txt"
1243 for (
int i = 0;
i < n;
i++) {
1246 fpdata >> element.
xIn;
1247 fpdata >> element.
yIn;
1248 fpdata >> element.
zIn;
1249 fpdata >> element.
pxIn;
1250 fpdata >> element.
pyIn;
1251 fpdata >> element.
pzIn;
1253 fpdata >> element.
xOut;
1254 fpdata >> element.
yOut;
1255 fpdata >> element.
zOut;
1256 fpdata >> element.
pxOut;
1257 fpdata >> element.
pyOut;
1258 fpdata >> element.
pzOut;
1260 fpdata >> element.
p;
1261 fpdata >> element.
q;
1262 fpdata >> element.
mass;
1264 fpdata >> element.
pdg;
1265 fpdata >> element.
ID;
1271 for (
int k = 0; k < nhits; k++) {
1274 element.
hitIds.push_back(helement);
1277 vMCPoints.push_back(element);
1280 cout <<
"vMCPoints[" << n <<
"]" <<
" have been read." << endl;
1284 for (
int i = 0;
i < n;
i++) {
1287 fpdata >> element.
x;
1288 fpdata >> element.
y;
1289 fpdata >> element.
z;
1290 fpdata >> element.
px;
1291 fpdata >> element.
py;
1292 fpdata >> element.
pz;
1293 fpdata >> element.
p;
1294 fpdata >> element.
q;
1295 fpdata >> element.
mass;
1297 fpdata >> element.
pdg;
1298 fpdata >> element.
ID;
1303 for (
int k = 0; k < nhits; k++) {
1306 element.
StsHits.push_back(helement);
1309 for (
int k = 0; k < nhits; k++) {
1312 element.
Points.push_back(helement);
1315 fpdata >> element.nMCContStations;
1316 fpdata >> element.nHitContStations;
1317 fpdata >> element.maxNStaMC;
1318 fpdata >> element.maxNSensorMC;
1319 fpdata >> element.maxNStaHits;
1320 fpdata >> element.nStations;
1322 element.CalculateIsReconstructable();
1323 vMCTracks.push_back(element);
1326 cout <<
"vMCTracks[" << n <<
"]" <<
" have been read." << endl;
1330 for (
int i = 0;
i < n;
i++) {
1333 vHitMCRef.push_back(element);
1336 cout <<
"vHitMCRef[" << n <<
"]" <<
" have been read." << endl;
1340 for (
int i = 0;
i < n;
i++) {
1345 fpdata >> element.
x;
1346 fpdata >> element.
y;
1350 cout <<
"vHitStore[" << n <<
"]" <<
" have been read." << endl;
1354 for (
int i = 0;
i < n;
i++) {
1356 fpdata >> element.
hitId;
1361 for (
int k = 0; k < nPoints; k++) {
1366 vStsHits.push_back(element);
1369 cout <<
"vStsHits[" << n <<
"]" <<
" have been read." << endl;
1375 cout <<
"-I- CbmL1: L1Performance data for event " << nEvent <<
" has been read from file " << fpdata_name
1376 <<
" successfully." << endl;
1382void CbmL1::WriteSIMDKFData()
1384 static bool first = 1;
1391 FileGeo.open(
"geo.dat", ios::out);
1394 FieldCheck.open(
"field.dat", ios::out);
1396 Double_t bfg[3], rfg[3];
1401 dMF->GetFieldValue(rfg, bfg);
1402 FileGeo << rfg[2] <<
" " << bfg[0] <<
" " << bfg[1] <<
" " << bfg[2] <<
" " << endl;
1407 dMF->GetFieldValue(rfg, bfg);
1408 FileGeo << rfg[2] <<
" " << bfg[0] <<
" " << bfg[1] <<
" " << bfg[2] <<
" " << endl;
1413 dMF->GetFieldValue(rfg, bfg);
1414 FileGeo << rfg[2] <<
" " << bfg[0] <<
" " << bfg[1] <<
" " << bfg[2] <<
" " << endl << endl;
1415 FileGeo << NStation << endl;
1418 const int N = (M + 1) * (M + 2) / 2;
1420 for (Int_t ist = 0; ist < NStation; ist++) {
1421 fscal f_phi, f_sigma, b_phi, b_sigma;
1426 if (ist < NMvdStations) {
1430 b_phi = 3.14159265358 / 2.;
1441 b_phi += 3.14159265358 / 2.;
1447 f_sigma = sector->
GetDx() / TMath::Sqrt(12);
1458 for (
int isec = 0; isec < st->
GetNSectors(); isec++) {
1460 for (
int isen = 0; isen < sect->
GetNSensors(); isen++) {
1474 if (dx > Xmax / N / 2)
1476 if (dy > Ymax / N / 2)
1479 for (
int i = 0;
i < 3;
i++)
1480 for (
int k = 0; k < N; k++)
1483 TVectorD b0(N), b1(N), b2(N);
1484 for (
int i = 0;
i < N;
i++) {
1485 for (
int j = 0; j < N; j++)
1487 b0(
i) = b1(
i) = b2(
i) = 0.;
1489 for (
double x = -Xmax; x <= Xmax; x += dx)
1490 for (
double y = -Ymax; y <= Ymax; y += dy) {
1491 double r =
sqrt(
fabs(x * x / Xmax / Xmax + y / Ymax * y / Ymax));
1494 Double_t w = 1. / (r * r + 1);
1495 Double_t p[3] = {x, y, z};
1496 Double_t B[3] = {0., 0., 0.};
1500 for (
int i = 1;
i <= M;
i++) {
1501 int k = (
i - 1) * (
i) / 2;
1502 int l =
i * (
i + 1) / 2;
1503 for (
int j = 0; j <
i; j++)
1504 m(l + j) = x *
m(k + j);
1505 m(l +
i) = y *
m(k +
i - 1);
1509 for (
int i = 0;
i < N;
i++) {
1510 for (
int j = 0; j < N; j++)
1511 A(
i, j) += w *
m(
i) *
m(j);
1512 b0(
i) += w * B[0] *
m(
i);
1513 b1(
i) += w * B[1] *
m(
i);
1514 b2(
i) += w * B[2] *
m(
i);
1519 TVectorD c0 = A * b0, c1 = A * b1, c2 = A * b2;
1520 for (
int i = 0;
i < N;
i++) {
1526 double c_f =
cos(f_phi);
1527 double s_f =
sin(f_phi);
1528 double c_b =
cos(b_phi);
1529 double s_b =
sin(b_phi);
1531 double det_m = c_f * s_b - s_f * c_b;
1539 FileGeo <<
" " << ist <<
" ";
1540 if (ist < NMvdStations) {
1542 FileGeo << t.
z <<
" ";
1543 FileGeo << t.
dz <<
" ";
1545 }
else if (ist < (NStsStations + NMvdStations)) {
1548 FileGeo << st->
GetZ() <<
" ";
1549 FileGeo << st->
GetD() <<
" ";
1552 FileGeo << f_sigma <<
" ";
1553 FileGeo << b_sigma <<
" ";
1554 FileGeo << f_phi <<
" ";
1555 FileGeo << b_phi << endl;
1556 FileGeo <<
" " << N << endl;
1558 for (
int ik = 0; ik < N; ik++)
1559 FileGeo << C[0][ik] <<
" ";
1562 for (
int ik = 0; ik < N; ik++)
1563 FileGeo << C[1][ik] <<
" ";
1566 for (
int ik = 0; ik < N; ik++)
1567 FileGeo << C[2][ik] <<
" ";
1575 static int TrNumber = 0;
1576 fstream Tracks, McTracksCentr, McTracksIn, McTracksOut;
1578 Tracks.open(
"tracks.dat", fstream::out);
1579 McTracksCentr.open(
"mctrackscentr.dat", fstream::out);
1580 McTracksIn.open(
"mctracksin.dat", fstream::out);
1581 McTracksOut.open(
"mctracksout.dat", fstream::out);
1584 Tracks.open(
"tracks.dat", fstream::out | fstream::app);
1585 McTracksCentr.open(
"mctrackscentr.dat", fstream::out | fstream::app);
1586 McTracksIn.open(
"mctracksin.dat", fstream::out | fstream::app);
1587 McTracksOut.open(
"mctracksout.dat", fstream::out | fstream::app);
1590 for (vector<CbmL1Track>::iterator RecTrack =
vRTracks.begin(); RecTrack !=
vRTracks.end(); ++RecTrack) {
1591 if (RecTrack->IsGhost())
1598 int NHits = (RecTrack->StsHits).size();
1599 float x[20], y[20], z[20];
1602 for (
int iHit = 0; iHit < NHits; iHit++) {
1607 x[jHit] = MvdH->GetX();
1608 y[jHit] = MvdH->GetY();
1609 z[jHit] = MvdH->GetZ();
1613 x[jHit] = StsH->GetX();
1614 y[jHit] = StsH->GetY();
1615 z[jHit] = StsH->GetZ();
1620 Tracks << TrNumber <<
" " << MCTrack->
x <<
" " << MCTrack->
y <<
" " << MCTrack->
z <<
" " << MCTrack->
px <<
" "
1621 << MCTrack->
py <<
" " << MCTrack->
pz <<
" " << MCTrack->
q <<
" " << NHits << endl;
1623 float AngleXAxis = 0, AngleYAxis = 0;
1624 for (
int i = 0;
i < NHits;
i++)
1625 Tracks <<
" " << st[
i] <<
" " << x[
i] <<
" " << y[
i] <<
" " << z[
i] <<
" " << AngleXAxis <<
" "
1626 << AngleYAxis << endl;
1629 int NMCPoints = (MCTrack->
Points).size();
1631 McTracksIn << TrNumber <<
" " << MCTrack->
x <<
" " << MCTrack->
y <<
" " << MCTrack->
z <<
" " << MCTrack->
px
1632 <<
" " << MCTrack->
py <<
" " << MCTrack->
pz <<
" " << MCTrack->
q <<
" " << NMCPoints << endl;
1633 McTracksOut << TrNumber <<
" " << MCTrack->
x <<
" " << MCTrack->
y <<
" " << MCTrack->
z <<
" " << MCTrack->
px
1634 <<
" " << MCTrack->
py <<
" " << MCTrack->
pz <<
" " << MCTrack->
q <<
" " << NMCPoints << endl;
1635 McTracksCentr << TrNumber <<
" " << MCTrack->
x <<
" " << MCTrack->
y <<
" " << MCTrack->
z <<
" " << MCTrack->
px
1636 <<
" " << MCTrack->
py <<
" " << MCTrack->
pz <<
" " << MCTrack->
q <<
" " << NMCPoints << endl;
1638 for (
int iPoint = 0; iPoint < NMCPoints; iPoint++) {
1640 McTracksIn <<
" " << MCPoint.
iStation <<
" " << MCPoint.
xIn <<
" " << MCPoint.
yIn <<
" " << MCPoint.
zIn
1641 <<
" " << MCPoint.
pxIn <<
" " << MCPoint.
pyIn <<
" " << MCPoint.
pzIn << endl;
1642 McTracksOut <<
" " << MCPoint.
iStation <<
" " << MCPoint.
xOut <<
" " << MCPoint.
yOut <<
" "
1643 << MCPoint.
zOut <<
" " << MCPoint.
pxOut <<
" " << MCPoint.
pyOut <<
" " << MCPoint.
pzOut << endl;
1644 McTracksCentr <<
" " << MCPoint.
iStation <<
" " << MCPoint.
x <<
" " << MCPoint.
y <<
" " << MCPoint.
z
1645 <<
" " << MCPoint.
px <<
" " << MCPoint.
py <<
" " << MCPoint.
pz << endl;
1648 McTracksOut << endl;
1649 McTracksCentr << endl;
vector< Double_t > W(vector< Double_t > dist, Double_t sig)
unsigned short int TZPosI
friend F32vec4 sin(const F32vec4 &a)
friend F32vec4 sqrt(const F32vec4 &a)
friend F32vec4 fabs(const F32vec4 &a)
friend F32vec4 cos(const F32vec4 &a)
static CbmKF * Instance()
BmnNewFieldMap * GetMagneticField()
std::vector< CbmKFTube > vMvdMaterial
bool IsReconstructable() const
vector< CbmKFParticle > & GetParticles()
void FindParticles(vector< CbmL1Track > &vRTracks)
vector< CbmL1HitStore > vHitStore
virtual InitStatus Init()
vector< CbmL1Track > vRTracks
void Exec(Option_t *option)
CbmL1ParticlesFinder * PF
for access to L1 Algorithm from L1::Instance
virtual InitStatus ReInit()
static CbmStsDigiScheme * Instance(int version=1)
CbmStsStation * GetStation(Int_t iStation)
Double_t GetStereoF() const
Double_t GetRotation() const
CbmStsSensor * GetSensor(Int_t iSensor)
Double_t GetStereoB() const
Int_t GetNSensors() const
Double_t GetRadLength() const
Int_t GetNSectors() const
Double_t GetZ(Int_t it=0)
CbmStsSector * GetSector(Int_t iSector)
vector< unsigned char > vSFlag
THitI StsHitsStopIndex[MaxNStations+1]
vector< L1Strip > vStsStrips
vector< L1Track > vTracks
--— Output data --—
vector< unsigned char > vSFlagB
THitI StsHitsStartIndex[MaxNStations+1]
vector< THitI > vRecoHits
vector< L1StsHit > vStsHits
vector< L1Strip > vStsStripsB
void CATrackFinder()
The main procedure - find tracks.
void L1KFTrackFitter(bool extrapolateToTheEndOfSTS=false)
void Init(const fscal geo[])
vector< L1Material > fRadThick
L1UMeasurementInfo backInfo
L1UMeasurementInfo frontInfo