All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
icaruscode/icaruscode/CRT/CRTUtils/CRTCommonUtils.h
Go to the documentation of this file.
1 #ifndef IC_CRTCOMMONUTILS_H
2 #define IC_CRTCOMMONUTILS_H
3 
4 #include "messagefacility/MessageLogger/MessageLogger.h"
5 #include "canvas/Persistency/Common/Ptr.h"
6 #include "canvas/Persistency/Common/PtrVector.h"
7 
13 
14 
15 // icaruscode includes
17 
18 #include "TGeoManager.h"
19 //#include "Math/GenVector/XYZTVector.h"
20 //#include "Math/GenVector/LorentzVector.h"
21 #include "TLorentzVector.h"
22 // ROOT
23 #include "TVector3.h"
24 
25 
26 #include <map>
27 #include <vector>
28 #include <string>
29 #include <utility>
30 
31 using std::string;
32 using std::map;
33 using std::vector;
34 using std::pair;
35 
36 namespace icarus{
37  namespace crt {
38  class CRTCommonUtils;
39  }
40 }
41 
43 
44  public:
46 
47  int GetAuxDetTypeCode(size_t adid);
48  char GetAuxDetType(size_t adid);
49  string GetAuxDetRegion(size_t adid);
50  int AuxDetRegionNameToNum(string reg);
51  string GetRegionNameFromNum(int num);
52  char GetRegTypeFromRegName(string name);
53  int GetTypeCodeFromRegion(string name);
54  pair<uint8_t,uint8_t> ADToMac(size_t adid);
55  int ADToChanGroup(size_t adid);
56  int NFeb(size_t adid);
57  string MacToRegion(uint8_t mac);
58  char MacToType(uint8_t mac);
59  int MacToTypeCode(uint8_t mac);
60  int ChannelToAuxDetSensitiveID(uint8_t mac, int chan);
61  size_t MacToAuxDetID(uint8_t mac, int chan);
62  TLorentzVector AvgIDEPoint(sim::AuxDetIDE ide);
63  double LengthIDE(sim::AuxDetIDE ide);
64  int GetLayerID(sim::AuxDetSimChannel const& adsc);
65  int GetLayerID(const art::Ptr<sim::AuxDetSimChannel> adsc);
66  int GetMINOSLayerID(size_t adid);
67  TVector3 ChanToLocalCoords(const uint8_t mac, const int chan);
68  TVector3 ChanToWorldCoords(const uint8_t mac, const int chan);
69  TVector3 WorldToModuleCoords(TVector3 point, size_t adid);
70  // Simple distance of closest approach between infinite track and centre of hit
71  double SimpleDCA(sbn::crt::CRTHit hit, TVector3 start, TVector3 direction);
72 
73  // Minimum distance from infinite track to CRT hit assuming that hit is a 2D square
74  double DistToCrtHit(sbn::crt::CRTHit hit, TVector3 start, TVector3 end);
75 
76  // Distance between infinite line (2) and segment (1)
77  // http://geomalgorithms.com/a07-_distance.html
78  double LineSegmentDistance(TVector3 start1, TVector3 end1, TVector3 start2, TVector3 end2);
79 
80  // Intersection between axis-aligned cube and infinite line
81  // (https://www.scratchapixel.com/lessons/3d-basic-rendering/minimal-ray-tracer-rendering-simple-shapes/ray-box-intersection)
82  std::pair<TVector3, TVector3> CubeIntersection(TVector3 min, TVector3 max, TVector3 start, TVector3 end);
83 
84 
85  private:
86  //geo::AuxDetGeometryCore const* fGeoService;
88  map<size_t,vector<pair<uint8_t,int>>> fAuxDetIdToFeb;
89  map<uint8_t,vector<size_t>> fFebToAuxDetId;
90  map<size_t,char> fAuxDetIdToType;
91  map<size_t,string> fAuxDetIdToRegion;
92  map<string,size_t> fNameToAuxDetId;
93  map<size_t,int> fAuxDetIdToChanGroup;
94 
95  void FillFebMap();
96  void FillAuxDetMaps();
97  string AuxDetNameToRegion(string name);
98 
99 };//CRTCommonUtils
100 // }//namespace crt
101 //}//namespace icarus
102 
103 
104 
105 
106 
107 
108 
109 #endif
std::pair< TVector3, TVector3 > CubeIntersection(TVector3 min, TVector3 max, TVector3 start, TVector3 end)
process_name hit
Definition: cheaterreco.fcl:51
double SimpleDCA(sbn::crt::CRTHit hit, TVector3 start, TVector3 direction)
Access the description of auxiliary detector geometry.
Collection of particles crossing one auxiliary detector cell.
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:265
object containing MC truth information necessary for making RawDigits and doing back tracking ...
art framework interface to geometry description for auxiliary detectors
auto end(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:585
TVector3 ChanToLocalCoords(const uint8_t mac, const int chan)
Description of geometry of one entire detector.
Encapsulate the geometry of an auxiliary detector.
double LineSegmentDistance(TVector3 start1, TVector3 end1, TVector3 start2, TVector3 end2)
TVector3 ChanToWorldCoords(const uint8_t mac, const int chan)
MC truth information to make RawDigits and do back tracking.
then echo fcl name
double DistToCrtHit(sbn::crt::CRTHit hit, TVector3 start, TVector3 end)
process_name crt
map< size_t, vector< pair< uint8_t, int > > > fAuxDetIdToFeb
art framework interface to geometry description