er  dev
ERTelescopeUnpack.h
1 #ifndef ERTelescopeUnpack_H
2 #define ERTelescopeUnpack_H
3 
4 #include <map>
5 #include <vector>
6 
7 #include "TString.h"
8 
9 #include "DetEventDetector.h"
10 
11 #include "ERUnpack.h"
12 
14  public:
15  ERTelescopeStation(TString _type, Int_t _sideCount, TString _ampStName, TString _timeStName,
16  TString _ampStName2, TString _timeStName2, TString _ampCalFile, TString _timeCalFile,
17  TString _ampCalFile2, TString _timeCalFile2, TString _XY, TString _XYside,
18  ChannelMapping* _channelsMapping1, ChannelMapping* _channelsMapping2,
19  Bool_t _skipAloneChannels);
20  TString type; //Si, CsI
21  Int_t sideCount; //1,2
22  TString ampStName;
23  TString timeStName;
24  TString ampStName2;
25  TString timeStName2;
26  TString ampCalFile;
27  TString timeCalFile;
28  TString ampCalFile2;
29  TString timeCalFile2;
30  TMatrixD* ampCalTable = nullptr;
31  TMatrixD* timeCalTable = nullptr;
32  TMatrixD* ampCalTable2 = nullptr;
33  TMatrixD* timeCalTable2 = nullptr;
34  ChannelMapping* channelsMapping1 = nullptr;
35  ChannelMapping* channelsMapping2 = nullptr;
36  TString XY; // XY, YX
37  TString XYside; //X,Y
38  TString bName;
39  TString bName2;
40  Bool_t skipAloneChannels;
41 };
42 
43 class ERTelescopeUnpack : public ERUnpack {
44  public:
45  ERTelescopeUnpack(TString detName);
46  virtual ~ERTelescopeUnpack();
47  void AddSingleSiStation(TString name, TString ampStName, TString timeStName,
48  TString ampCalFile, TString timeCalFile, TString XYside,
49  ChannelMapping* channelsMapping = nullptr,
50  Bool_t skipAloneChannels = kTRUE);
51  void AddDoubleSiStation(TString name, TString ampStName, TString timeStName,
52  TString ampStName2, TString timeStName2, TString ampCalFile, TString timeCalFile,
53  TString ampCalFile2, TString timeCalFile2, TString XY,
54  ChannelMapping* channelsMapping1 = nullptr,
55  ChannelMapping* channelsMapping2 = nullptr,
56  Bool_t skipAloneChannels = kTRUE);
57  void AddCsIStation(TString name,TString ampStName, TString timeStName, TString ampCalFile, TString timeCalFile,
58  ChannelMapping* channelsMapping = nullptr, Bool_t skipAloneChannels = kTRUE);
59  protected:
60  virtual void Register();
61  virtual std::vector<TString> InputBranchNames() const;
62  virtual void UnpackSignalFromStations();
63  void CreateDigisFromRawStations(const TString& er_station, const TString& er_branch_name,
64  const TString& amp_station, const TString& time_station,
65  TMatrixD* amp_cal_table, TMatrixD* time_cal_table,
66  const ChannelMapping* channel_mapping, bool skip_alone_channels);
67  void AddDigi(float edep, float time, ERChannel channel, TString digiBranchName);
68  TString FormBranchName(TString type, int sideCount, TString stName, TString XY, TString XYside);
69  void FormAllBranches();
70  Bool_t ReadCalFiles();
71  void DumpStationsInfo();
72  std::pair<float, float> ApplyCalibration(ERChannel channel, Signal amp, Signal time,
73  TMatrixD* ampCalTable, TMatrixD* timeCalTable);
74  Bool_t CheckSetup();
75  protected:
76  std::map<TString, ERTelescopeStation*> fStations;
77 public:
78  ClassDef(ERTelescopeUnpack, 0)
79 };
80 
81 #endif