FairRoot/PandaRoot
PndSttTubeIdMapCreatorRoot.cxx
Go to the documentation of this file.
1 /*
2  * PndSttTubeMapIdCreatorRoot.cpp
3  *
4  * Created on: 02.08.2018
5  * Author: tstockmanns
6  */
7 
8 #include <PndSttTubeIdMap.h>
10 #include "PndGeoHandling.h"
11 #include "PndStringSeparator.h"
12 
13 #include <vector>
14 #include <string>
15 #include <algorithm>
16 #include <iostream>
17 
19 
21  // TODO Auto-generated constructor stub
22 
23 }
24 
26  // TODO Auto-generated destructor stubPndSttTubeIdMapeMap* PndSttTubeIdMapCreatorRoot::CreateTubeMap()
27 }
28 
31  std::vector<TString> nodeNames = PndGeoHandling::Instance()->GetSensorNamesWithString("ArCO2Sensitive");
32 // std::cout << "PndSttTubeIdMapCreatorRoot::CreateTubeMap " << nodeNames.size() << std::endl;
33  for (auto name : nodeNames){
34 // std::cout << "Prozessing Node: " << name.Data() << std::endl;
35  int sector = GetSector(name);
36  int row = GetRow(name);
37 // std::cout << "Sector: " << sector << " row " << row << std::endl;
38 // std::cout << "ShortID: " << PndGeoHandling::Instance()->GetShortID(name) << std::endl;
39  result->AddTube(sector, row, PndGeoHandling::Instance()->GetShortID(name));
40  }
41 
42  return result;
43 }
44 
46  std::string nameString(name.Data());
47  PndStringSeparator sep(nameString, "/-_");
48  std::vector<std::string> stringVector = sep.GetStringVector();
49 // std::cout << "GetSector StringVector.size() " << stringVector.size() << std::endl;
50  auto i = std::find_if(stringVector.begin(), stringVector.end(),[&](const std::string& val){auto found = val.find("sector"); return found != std::string::npos;});
51  int pos = std::distance (stringVector.begin(), i);
52 // std::cout << "GetSector pos of sector " << pos << std::endl;
53  int halfSide = std::stoi(stringVector[pos-1]);
54  int sectorId = std::stoi(stringVector[pos+1]);
55  // int sectorCpy = std::stoi(stringVector[pos+2]);
56 
57  int sector = -1;
58  // int sector2 = halfSide*3 + sectorCpy*2 + sectorId;
59 
60  if (halfSide == 0 && sectorId == 0)
61  sector = 0;
62  else if (halfSide == 0 && sectorId == 1)
63  sector = 1;
64  else if (halfSide == 0 && sectorId == 2)
65  sector = 2;
66  else if (halfSide == 1 && sectorId == 0)
67  sector = 3;
68  else if (halfSide == 1 && sectorId == 1)
69  sector = 4;
70  else if (halfSide == 1 && sectorId == 2)
71  sector = 5;
72 
73 // std::cout << "halfSide = " << halfSide << " ,SectorID = " << sectorId
74 // << " ,Sector = " << sector << std::endl;
75 
76  return sector;
77 }
78 
80  std::string nameString(name.Data());
81  PndStringSeparator sep(nameString, "/-_");
82  std::vector<std::string> stringVector = sep.GetStringVector();
83  auto i = std::find_if(stringVector.begin(), stringVector.end(),[&](const std::string& val){auto found = val.find("strawLayer"); return found != std::string::npos;});
84  int pos = std::distance (stringVector.begin(), i);
85  int strawLayer = std::stoi(stringVector[pos+1]);
86 // std::cout << "strawLayer = " << strawLayer << std::endl;
87  return strawLayer;
88 }
int row
Definition: anaLmdDigi.C:67
TVector3 pos
void AddTube(int sector, int row, int tubeId)
Int_t i
Definition: run_full.C:25
Double_t val[nBoxes][nFEBox]
Definition: createCalib.C:11
std::vector< TString > GetSensorNamesWithString(TString value)
static PndSttTubeIdMap * Instance()
static PndGeoHandling * Instance()
TString name
ClassImp(PndAnaContFact)