1 #include "ERNeuRadSetup.h" 8 #include "TGeoManager.h" 10 #include "FairRootManager.h" 11 #include "FairRunAna.h" 12 #include "FairRuntimeDb.h" 16 Float_t ERNeuRadSetup::fZ;
17 Float_t ERNeuRadSetup::fLength;
18 Float_t ERNeuRadSetup::fFiberWidth;
19 Int_t ERNeuRadSetup::fRowNofFibers;
20 Int_t ERNeuRadSetup::fRowNofModules;
21 Int_t ERNeuRadSetup::fRowNofPixels;
23 std::vector<ERNeuRadModule*> ERNeuRadSetup::fModules;
24 std::vector<std::vector<ERNeuRadFiber*> > ERNeuRadSetup::fFibers;
26 ERNeuRadSetup::ERNeuRadSetup(){
28 if ( ! gGeoManager ) {
29 std::cerr <<
"ERNeuRadSetup: cannot initialise without TGeoManager!"<< std::endl;
32 TGeoNode* cave = gGeoManager->GetCurrentNode();
33 TGeoNode* neuRad = NULL;
34 for (Int_t iNode = 0; iNode < cave->GetNdaughters(); iNode++) {
35 TString name = cave->GetDaughter(iNode)->GetName();
36 if ( name.Contains(
"NeuRad", TString::kIgnoreCase) ) {
37 neuRad = cave->GetDaughter(iNode);
40 fZ = neuRad->GetMatrix()->GetTranslation()[2];
41 std::cout <<
"NeuRad Z position:" << fZ << std::endl;
43 TGeoNode* module = neuRad->GetDaughter(0);
44 TGeoBBox* module_box = (TGeoBBox*)module->GetVolume()->GetShape();
45 fLength = module_box->GetDZ()*2;
46 std::cout <<
"NeuRad length:" << fLength << std::endl;
48 TGeoNode* pixel = module->GetDaughter(0);
49 TGeoNode* fiber = pixel->GetDaughter(0);
50 TGeoBBox* fiber_box = (TGeoBBox*)fiber->GetVolume()->GetShape();
51 fFiberWidth = fiber_box->GetDX()*2;
52 std::cout <<
"NeuRad fiber width:" << fFiberWidth << std::endl;
54 fRowNofModules = Int_t(TMath::Sqrt(neuRad->GetNdaughters()));
55 fRowNofPixels = Int_t(TMath::Sqrt(module->GetNdaughters()));
56 fRowNofFibers = Int_t(TMath::Sqrt(pixel->GetNdaughters()));
61 for (Int_t iNode = 0; iNode < module->GetNdaughters(); iNode++){
62 if (TString(module->GetDaughter(iNode)->GetName()).Contains(
"submodul")){
67 Int_t nPixel_in_subm = 0;
69 std::cout <<
"Submodules in geometry!" << std::endl;
70 TGeoNode* subm = module->GetDaughter(iSubm);
71 for (Int_t iNode = 0; iNode < subm->GetNdaughters(); iNode++){
72 if (TString(subm->GetDaughter(iNode)->GetName()).Contains(
"pixel")){
73 pixel = subm->GetDaughter(iNode);
77 fRowNofPixels = Int_t(TMath::Sqrt(nSubm))*Int_t(TMath::Sqrt(nPixel_in_subm));
78 fRowNofFibers = Int_t(TMath::Sqrt(pixel->GetNdaughters()));
81 std::cout <<
"NeuRad modules in row count:" << fRowNofModules << std::endl;
82 std::cout <<
"NeuRad pixels in row count:" << fRowNofPixels << std::endl;
83 std::cout <<
"NeuRad fibers in row count:" << fRowNofFibers << std::endl;
85 std::cout <<
"ERNeuRadSetup initialized! "<< std::endl;
89 if (fInstance == NULL)
95 Int_t ERNeuRadSetup::SetParContainers(){
97 FairRunAna* run = FairRunAna::Instance();
98 if ( ! run ) Fatal(
"SetParContainers",
"No analysis run");
100 FairRuntimeDb* rtdb = run->GetRuntimeDb();
101 if ( ! rtdb ) Fatal(
"SetParContainers",
"No runtime database");
103 (rtdb->getContainer(
"ERNeuRadDigiPar"));
105 std::cout <<
"ERNeuRadSetup::SetParContainers() "<< std::endl;
106 std::cout <<
"ERNeuRadDigiPar initialized! "<< std::endl;
112 Int_t ERNeuRadSetup::NofFibers() {
113 return fRowNofFibers*fRowNofFibers;
116 Int_t ERNeuRadSetup::NofPixels(){
117 return fRowNofPixels*fRowNofPixels;
120 Int_t ERNeuRadSetup::NofModules() {
121 return fRowNofModules*fRowNofModules;
124 Float_t ERNeuRadSetup::FiberLength() {
128 Float_t ERNeuRadSetup::FiberWidth() {
132 Float_t ERNeuRadSetup::ModuleX(Int_t iModule){
133 return fModules[iModule]->fX;
136 Float_t ERNeuRadSetup::ModuleY(Int_t iModule){
137 return fModules[iModule]->fY;
140 Float_t ERNeuRadSetup::FiberX(Int_t iModule, Int_t iFiber){
141 return fFibers[iModule][iFiber]->fX;
144 Float_t ERNeuRadSetup::FiberY(Int_t iModule, Int_t iFiber){
145 return fFibers[iModule][iFiber]->fY;
148 Float_t ERNeuRadSetup::PixelQuantumEfficiency(Int_t iModule, Int_t iFiber){
149 return fDigiPar->PixelQuantumEfficiency(iFiber);
152 Float_t ERNeuRadSetup::PixelGain(Int_t iModule, Int_t iFiber){
153 return fDigiPar->PixelGain(iFiber);
156 Float_t ERNeuRadSetup::PixelSigma(Int_t iModule, Int_t iFiber){
157 return fDigiPar->PixelSigma(iFiber);
160 void ERNeuRadSetup::Print(){
164 void ERNeuRadSetup::Crosstalks(Int_t iFiber, TArrayF& crosstalks){
165 return fDigiPar->Crosstalks(iFiber, crosstalks);
168 Int_t ERNeuRadSetup::RowNofFibers(){
169 return fRowNofFibers;
172 Int_t ERNeuRadSetup::RowNofPixels(){
173 return fRowNofPixels;
176 Int_t ERNeuRadSetup::RowNofModules(){
177 return fRowNofModules;
180 Bool_t ERNeuRadSetup::UseCrosstalks(){
181 return fDigiPar->UseCrosstalks();