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