er  dev
ERTelescopeGeoComponentDoubleSi.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 "ERTelescopeGeoComponentDoubleSi.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 //--------------------------------------------------------------------------------------------------
21 ERTelescopeGeoComponentDoubleSi::ERTelescopeGeoComponentDoubleSi(
22  const TString& typeFromXML, const TString& id, const TString& orientAroundZ)
23 : ERTelescopeGeoComponentSensetive(typeFromXML, id)
24 {
25  TString volumeNameInd = (orientAroundZ == "X") ? "_XY" : "_YX";
26  fOrientAroundZ = volumeNameInd;
27  fVolumeName += volumeNameInd;
28 }
29 //--------------------------------------------------------------------------------------------------
30 ERTelescopeGeoComponentDoubleSi::ERTelescopeGeoComponentDoubleSi(
31  const TString& typeFromXML, const TString& id, const TVector3& position,
32  const TVector3& rotation, const TString& orientAroundZ)
33 : ERTelescopeGeoComponentSensetive(typeFromXML, id, position, rotation)
34 {
35  TString volumeNameInd = (orientAroundZ == "X") ? "_XY" : "_YX";
36  fOrientAroundZ = volumeNameInd;
37  fVolumeName += volumeNameInd;
38 }
39 //--------------------------------------------------------------------------------------------------
40 TString ERTelescopeGeoComponentDoubleSi::GetBranchName(
41  ERDataObjectType objectType, OrientationAroundZ orientationAroundZ /*= OrientationAroundZ::Default*/,
42  ChannelSide channelSide /*= ChannelSide::None*/) const {
43  return GetBranchNamePrefix(SensetiveType::Si, objectType)
44  + "_" + OrientationAroundZStr(orientationAroundZ)
45  + (channelSide != ChannelSide::None ? TString("_") + ChannelSideStr(channelSide) : "");
46 }
47 //--------------------------------------------------------------------------------------------------
48 std::list<OrientationAroundZ> ERTelescopeGeoComponentDoubleSi::GetOrientationsAroundZ() const {
49  return {OrientationAroundZ::X, OrientationAroundZ::Y};
50 }
51 //--------------------------------------------------------------------------------------------------
52 std::list<ChannelSide> ERTelescopeGeoComponentDoubleSi::GetChannelSides() const {
53  if (fHasTwoSidedChannel) {
54  return {ChannelSide::First, ChannelSide::Second};
55  }
56  return {ChannelSide::None};
57 }
58 //--------------------------------------------------------------------------------------------------
59 Int_t ERTelescopeGeoComponentDoubleSi::GetChannelFromSensetiveNodePath(
60  const TString& path, OrientationAroundZ orientation /*= OrientationAroundZ::Default*/) const {
61  TString pathWithChannelPostfix = path;
62  if (orientation == OrientationAroundZ::X)
63  pathWithChannelPostfix.Remove(pathWithChannelPostfix.Last('/'), pathWithChannelPostfix.Length());
64  const TString channelStr(pathWithChannelPostfix(pathWithChannelPostfix.Last('_') + 1,
65  pathWithChannelPostfix.Length()));
66  return channelStr.Atoi();
67 }
68 //--------------------------------------------------------------------------------------------------
70