er  dev
ERTelescopeGeoComponentSingleSi.cxx
1 /********************************************************************************
2  * Copyright (C) Joint Institute for Nuclear Research *
3  * *
4  * This software is distributed under the terms of the *
5  * GNU Lesser General Public Licence version 3 (LGPL) version 3, *
6  * copied verbatim in the file "LICENSE" *
7  ********************************************************************************/
8 
9 #include "ERTelescopeGeoComponentSingleSi.h"
10 
11 #include "TGeoManager.h"
12 #include "TGeoMatrix.h"
13 #include <TDOMParser.h>
14 #include <TXMLAttr.h>
15 #include <TXMLNode.h>
16 #include <TList.h>
17 
18 #include "FairLogger.h"
19 
20 using namespace std;
21 
22 //--------------------------------------------------------------------------------------------------
23 ERTelescopeGeoComponentSingleSi::ERTelescopeGeoComponentSingleSi(
24  const TString& typeFromXML, const TString& id, const TString& orientAroundZ)
25 : ERTelescopeGeoComponentSensetive(typeFromXML, id)
26 {
27  TString volumeNameInd = (orientAroundZ == "X") ? "_X" : "_Y";
28  fOrientAroundZ = (orientAroundZ == "X") ? OrientationAroundZ::X : OrientationAroundZ::Y;
29  fVolumeName += volumeNameInd;
30 }
31 //--------------------------------------------------------------------------------------------------
32 ERTelescopeGeoComponentSingleSi::ERTelescopeGeoComponentSingleSi(
33  const TString& typeFromXML, const TString& id, const TVector3& position,
34  const TVector3& rotation, const TString& orientAroundZ)
35 : ERTelescopeGeoComponentSensetive(typeFromXML, id, position, rotation)
36 {
37  TString volumeNameInd = (orientAroundZ == "X") ? "_X" : "_Y";
38  fOrientAroundZ = (orientAroundZ == "X") ? OrientationAroundZ::X : OrientationAroundZ::Y;
39  fVolumeName += volumeNameInd;
40 }
41 //--------------------------------------------------------------------------------------------------
42 TString ERTelescopeGeoComponentSingleSi::GetBranchName(
43  ERDataObjectType objectType, OrientationAroundZ /*orientationAroundZ = OrientationAroundZ::Default*/,
44  ChannelSide channelSide /*= ChannelSide::None*/) const {
45  return GetBranchNamePrefix(SensetiveType::Si, objectType)
46  + (channelSide != ChannelSide::None ? TString("_") + ChannelSideStr(channelSide) : "");
47 }
48 //--------------------------------------------------------------------------------------------------
49 std::list<OrientationAroundZ> ERTelescopeGeoComponentSingleSi::GetOrientationsAroundZ() const {
50  return {fOrientAroundZ};
51 }
52 //--------------------------------------------------------------------------------------------------
53 std::list<ChannelSide> ERTelescopeGeoComponentSingleSi::GetChannelSides() const {
54  if (fHasTwoSidedChannel) {
55  return {ChannelSide::First, ChannelSide::Second};
56  }
57  return {ChannelSide::None};
58 }
59 //--------------------------------------------------------------------------------------------------
60 Int_t ERTelescopeGeoComponentSingleSi::GetChannelFromSensetiveNodePath(
61  const TString& path, OrientationAroundZ /*orientation = OrientationAroundZ::Default*/) const {
62  const TString channelStr(path(path.Last('_') + 1, path.Length()));
63  return channelStr.Atoi();
64 }
65 //--------------------------------------------------------------------------------------------------
67