CbmRoot
Loading...
Searching...
No Matches
CbmLitCreateStandaloneData.cxx
Go to the documentation of this file.
1/* Copyright (C) 2010-2013 GSI/JINR-LIT, Darmstadt/Dubna
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Andrey Lebedev [committer] */
4
6
7#include "CbmMuchPixelHit.h"
8#include "CbmStsTrack.h"
9#include "FairRootManager.h"
10#include "FairTrackParam.h"
11#include "TClonesArray.h"
12
13#include <Logger.h>
14
15#include <fstream>
16#include <iostream>
17
19
21
23{
24 std::cout << "-I- CbmLitCreateStandaloneData::Init Creating MUCH layout" << std::endl;
25
26 // Save MUCH layout to text file
27 // CbmLitEnvironment* env = CbmLitEnvironment::Instance();
28 // lit::parallel::LitDetectorLayoutMuonScal layout;
29 // env->GetMuchLayoutScal(layout);
30
31 std::ofstream outfile("sa_geometry.txt");
32 //outfile << layout;
33 // outfile << layout.ToString();
34 // outfile << layout.GetNofStationGroups() << std::endl;
35 // for (int isg = 0; isg < layout.GetNofStationGroups(); isg++) {
36 // LitStationGroupScal sg = layout.GetStationGroup(isg);
37 // outfile << isg << " " << sg.GetNofStations() << std::endl;
38 //
39 // LitAbsorber ab = sg.absorber;
40 //
41 // for (int ist = 0; ist < sg.GetNofStations(); ist++) {
42 //
43 // }
44 // }
45
46 outfile.close();
47
48 std::cout << "-I- CbmLitCreateStandaloneData::Init Finish creating MUCH layout" << std::endl;
49 //
50
51 //
52 FairRootManager* ioman = FairRootManager::Instance();
53 if (NULL == ioman) {
54 LOG(fatal) << GetName() << "::Init: CbmRootManager is not instantiated";
55 }
56
57 fStsTracks = (TClonesArray*) ioman->GetObject("StsTrack");
58 if (NULL == fStsTracks) {
59 LOG(fatal) << GetName() << "::Init: No StsTrack array!";
60 }
61
62 fMuchPixelHits = (TClonesArray*) ioman->GetObject("MuchPixelHit");
63 if (NULL == fMuchPixelHits) {
64 LOG(fatal) << GetName() << "::Init: No MuchPixelHit array!";
65 }
66
67 fHitsFile.open("sa_hits.txt");
68 fSeedsFile.open("sa_seeds.txt");
69 //
70
71 return kSUCCESS;
72}
73
75
76void CbmLitCreateStandaloneData::Exec(Option_t* /*opt*/)
77{
78 fSeedsFile << fEventNo << " " << fStsTracks->GetEntriesFast() << std::endl;
79 for (Int_t iStsTrack = 0; iStsTrack < fStsTracks->GetEntriesFast(); iStsTrack++) {
80 CbmStsTrack* stsTrack = (CbmStsTrack*) fStsTracks->At(iStsTrack);
81 const FairTrackParam* par = stsTrack->GetParamLast();
82 fSeedsFile << par->GetX() << " " << par->GetY() << " " << par->GetZ() << " " << par->GetTx() << " " << par->GetTy()
83 << " " << par->GetQp() << " ";
84 double cov[15];
85 par->CovMatrix(cov);
86 for (unsigned int i = 0; i < 15; ++i) {
87 fSeedsFile << cov[i] << " ";
88 }
89 fSeedsFile << std::endl;
90 }
91
92 fHitsFile << fEventNo << " " << fMuchPixelHits->GetEntriesFast() << std::endl;
93 for (Int_t iMuchHit = 0; iMuchHit < fMuchPixelHits->GetEntriesFast(); iMuchHit++) {
94 CbmMuchPixelHit* muchHit = (CbmMuchPixelHit*) fMuchPixelHits->At(iMuchHit);
95 fHitsFile << muchHit->GetX() << " " << muchHit->GetY() << " " << muchHit->GetZ() << " " << muchHit->GetDx() << " "
96 << muchHit->GetDy() << " " << muchHit->GetDxy() << " " << (muchHit->GetPlaneId()) - 1 << " "
97 << muchHit->GetRefId() << std::endl;
98 }
99
100 std::cout << "Event: " << fEventNo++ << std::endl;
101}
102
104{
105 fHitsFile.close();
106 fSeedsFile.close();
107}
108
ClassImp(CbmLitCreateStandaloneData)
Class for pixel hits in MUCH detector.
Data class for STS tracks.
double GetZ() const
Definition CbmHit.h:71
int32_t GetRefId() const
Definition CbmHit.h:73
virtual int32_t GetPlaneId() const
Inherited from CbmBaseHit.
double GetDy() const
Definition CbmPixelHit.h:76
double GetDx() const
Definition CbmPixelHit.h:75
double GetY() const
Definition CbmPixelHit.h:74
double GetX() const
Definition CbmPixelHit.h:73
double GetDxy() const
Definition CbmPixelHit.h:77
const FairTrackParam * GetParamLast() const
Definition CbmTrack.h:69