DUNEGeometryHelper_service.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////////////
2 /// \file DUNEGeometryHelper_service.cc
3 ///
4 /// \author rs@fnal.gov
5 ////////////////////////////////////////////////////////////////////////////////
6 
7 // class header
9 
11 
12 // LArSoft libraries
29 
30 // C/C++ standard libraries
31 #include <string>
32 
33 using std::string;
38 
39 //**********************************************************************
40 
41 DUNEGeometryHelper::DUNEGeometryHelper(const fhicl::ParameterSet& pset)
42  : fChannelMapClass{pset.get<string>("ChannelMapClass", {})}
43  , fGeoSorterClass{pset.get<string>("GeoSorterClass", {})}
44 {}
45 
46 //**********************************************************************
47 
48 std::unique_ptr<geo::ChannelMapAlg>
50  std::string const& detectorName) const
51 {
52  std::unique_ptr<geo::ChannelMapAlg> channelMap{nullptr};
53 
54  // The APA sorting algorithm requires special handling.
55  // This flag is set if that map is used.
56  bool useApaMap = false;
57  bool is35t = false;
58 
59  // If class name is given use it.
60  if ( fChannelMapClass.size() ) {
61  if ( fChannelMapClass == "DuneApaChannelMapAlg" ) {
62  useApaMap = true;
63  } else if ( fChannelMapClass == "ChannelMap35Alg" ) {
64  channelMap = std::make_unique<geo::ChannelMap35Alg>(pset);
65  } else if ( fChannelMapClass == "ChannelMap35OptAlg" ) {
66  channelMap = std::make_unique<geo::ChannelMap35OptAlg>(pset);
67  } else if ( fChannelMapClass == "ChannelMapAPAAlg" ) {
68  channelMap = std::make_unique<geo::ChannelMapAPAAlg>(pset);
69  } else if ( fChannelMapClass == "ProtoDUNEChannelMapAlg" ) {
70  channelMap = std::make_unique<geo::ProtoDUNEChannelMapAlg>(pset);
71  } else if ( fChannelMapClass == "ProtoDUNEChannelMapAlgv7" ) {
72  channelMap = std::make_unique<geo::ProtoDUNEChannelMapAlgv7>(pset);
73  } else if ( fChannelMapClass == "ProtoDUNEChannelMapAlgv8" ) {
74  channelMap = std::make_unique<geo::ProtoDUNEChannelMapAlgv8>(pset);
75  } else {
76  throw cet::exception("DUNEGeometryHelper") << "Invalid channel map class name:" << fChannelMapClass << "\n";
77  }
78 
79  // Otherwise derive class name from detector name.
80  } else {
81  // DUNE 35t prototype
82  if ( ( detectorName.find("dune35t") != std::string::npos ) ||
83  ( detectorName.find("lbne35t") != std::string::npos ) ) {
84  std::string const detectorVersion = pset.get< std::string >("DetectorVersion");
85  if (( detectorVersion.find("v3") != std::string::npos )
86  || ( detectorVersion.find("v4") != std::string::npos )
87  || ( detectorVersion.find("v5") != std::string::npos )
88  || ( detectorVersion.find("v6") != std::string::npos )) {
89  useApaMap = true;
90  is35t = true;
91  } else {
92  channelMap = std::make_unique<geo::ChannelMap35Alg>(pset);
93  }
94 
95  // DUNE 10kt
96  } else if (( detectorName.find("dune10kt") != std::string::npos )
97  || ( detectorName.find("lbne10kt") != std::string::npos )) {
98  useApaMap = true;
99 
100  // DUNE 10kt dual phase
101  } else if ( detectorName.find("dunedphase10kt") != std::string::npos ) {
102  channelMap = std::make_unique<geo::ChannelMapCRMAlg>(pset);
103 
104  // DUNE 10kt vd
105  } else if ( ( detectorName.find("dunevd10kt") != std::string::npos ) ) {
106  channelMap = std::make_unique<geo::ChannelMapCRUAlg>(pset);
107 
108  // VD CRP cold box channel map
109  } else if ( ( detectorName.find("dunevdcb") != std::string::npos ) ) {
110  channelMap = std::make_unique<geo::ColdBoxChannelMapAlg>(pset);
111  //channelMap = std::make_unique<geo::ChannelMapCRUAlg>(pset);
112 
113  // protoDUNE 6x6x6 dual phase
114  } else if ( detectorName.find("protodunedphase") != std::string::npos ) {
115  channelMap = std::make_unique<geo::ChannelMapCRMAlg>(pset);
116 
117  // 3x1x1 dual phase
118  } else if ( detectorName.find("3x1x1dphase") != std::string::npos ) {
119  channelMap = std::make_unique<geo::ChannelMapCRMAlg>(pset);
120 
121  // DUNE 34kt
122  } else if ( ( detectorName.find("dune34kt") != std::string::npos )
123  || ( detectorName.find("lbne34kt") != std::string::npos ) ) {
124  channelMap = std::make_unique<geo::ChannelMapAPAAlg>(pset);
125 
126  // protoDUNE with arapucas
127  } else if ( detectorName.find("protodunev7") != std::string::npos ) {
128  channelMap = std::make_unique<geo::ProtoDUNEChannelMapAlgv7>(pset);
129 
130  // protoDUNE with arapucas and updated paddles
131  } else if ( detectorName.find("protodunev8") != std::string::npos ) {
132  channelMap = std::make_unique<geo::ProtoDUNEChannelMapAlgv8>(pset);
133 
134  // protoDUNE
135  } else if ( ( detectorName.find("protodune") != std::string::npos )
136  || ( detectorName.find("protolbne") != std::string::npos ) ) {
137  channelMap = std::make_unique<geo::ProtoDUNEChannelMapAlg>(pset);
138 
139  // iceberg
140  } else if ( detectorName.find("iceberg") != std::string::npos ) {
141  channelMap = std::make_unique<geo::ProtoDUNEChannelMapAlg>(pset);
142 
143  // LArND
144  } else if ( detectorName.find("larnd") != std::string::npos ) {
145  channelMap = std::make_unique<geo::ChannelMapAPAAlg>(pset);
146  }
147  else {
148  throw cet::exception("DUNEGeometryHelper") << "Unsupported detector: '" << detectorName << "'\n";
149  }
150  }
151 
152  if ( useApaMap ) {
153  // Find the sorter.
154  bool useApaSort = false;
155  bool use35tSort = false;
156  GeoObjectSorter* psort = nullptr;
157  if ( fGeoSorterClass.size() ) {
158  if ( fGeoSorterClass == "GeoObjectSorterAPA" ) {
159  useApaSort = true;
160  } else if ( fGeoSorterClass == "GeoObjectSorter35" ) {
161  use35tSort = true;
162  }
163  } else {
164  if ( is35t ) use35tSort = true;
165  else useApaSort = true;
166  }
167  // Construct the sorter.
168  if ( useApaSort ) {
169  psort = new GeoObjectSorterAPA(pset);
170  } else if ( use35tSort ) {
171  psort = new GeoObjectSorter35(pset);
172  }
173  // Create channel map and set sorter.
174  auto alg = new geo::DuneApaChannelMapAlg(pset);
175  alg->setSorter(*psort);
176  channelMap = std::unique_ptr<geo::DuneApaChannelMapAlg>(alg);
177  }
178 
179  return channelMap;
180 }
181 
182 //**********************************************************************
183 
185 
186 //**********************************************************************
std::string string
Definition: nybbler.cc:12
Interface to a service with detector-specific geometry knowledge.
Interface to algorithm class for a specific detector channel mapping in protoDUNE.
Interface to algorithm class for standard sorting of geo::XXXGeo objects.
Interface to algorithm class for a specific detector channel mapping in protoDUNE.
Interface to algorithm class for a specific detector channel mapping.
The class of 35t specific algorithms.
Interface to algorithm class for sorting geo::XXXGeo objects.
Channel mapping algorithms for VD ColdBox CRP.
Interface to algorithm class for standard sorting of geo::XXXGeo objects.
T get(std::string const &key) const
Definition: ParameterSet.h:271
Interface to algorithm class for a dual-phase detector channel mapping.
Access the description of detector geometry.
The class of 35t specific algorithms, optimized.
Interface to channel algorithm class for a vertical drift TPC.
Interface to algorithm class for a specific detector channel mapping.
Interface to algorithm class for a specific detector channel mapping in protoDUNE.
std::unique_ptr< geo::ChannelMapAlg > doConfigureChannelMapAlg(fhicl::ParameterSet const &sortingParameters, std::string const &detectorName) const override
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
Interface to algorithm class for a specific detector channel mapping.
#define DEFINE_ART_SERVICE_INTERFACE_IMPL(svc, iface)