SND@LHC Software
Loading...
Searching...
No Matches
ConvRawData.h
Go to the documentation of this file.
1#ifndef CONVRAWDATA_H_
2#define CONVRAWDATA_H_
3
4#include <TClonesArray.h>
5#include <TFile.h>
6#include <TMap.h>
7#include <TTree.h>
8#include "FairTask.h" // for FairTask, InitStatus
9#include "FairEventHeader.h" // for FairEventHeader
10#include "SNDLHCEventHeader.h" // for EventHeader
11#include "Scifi.h" // for Scifi detector
12#include "sndScifiHit.h" // for SciFi Hit
13#include "MuFilterHit.h" // for Muon Filter Hit
14
15#include <iostream>
16#include <tuple>
17#include <map>
18#include <vector>
19
20class ConvRawData : public FairTask
21{
22 public:
25
28
30 virtual InitStatus Init();
31
33 virtual void Exec(Option_t* opt);
34
36 void UpdateInput(int n);
37
38 private:
40 void StartTimeofRun(std::string path);
42 void DetMapping(std::string path);
43 void checkBoardMapping(std::string path);
44 void debugMapping(std::string board, int tofpetID, int tofpetChannel);
46 double qdc_calibration( int board_id, int tofpet_id, int channel, int tac,
47 uint16_t v_coarse, uint16_t v_fine, uint16_t tf);
48 double qdc_chi2( int board_id, int tofpet_id, int channel, int tac, int TDC);
49 double qdc_sat( int board_id, int tofpet_id, int channel, int tac, uint16_t v_fine);
50 double time_calibration( int board_id, int tofpet_id, int channel, int tac,
51 int64_t t_coarse, uint16_t t_fine, int TDC);
52 std::tuple<double, double, double, double> comb_calibration( int board_id, int tofpet_id,
53 int channel, int tac,
54 uint16_t v_coarse, uint16_t v_fine,
55 int64_t t_coarse, uint16_t t_fine,
56 double GQDC , int TDC);
57 // max gain QDC = 3.6
58 std::map<double, std::pair<double, double> > calibrationReport();
59
61 int channel_func( int tofpet_id, int tofpet_channel, int position);
63 void read_csv(std::string path);
65 void Process0();
66 void Process1();
67
69 std::map<int, MuFilterHit* > digiMuFilterStore{};
70 std::map<int, sndScifiHit* > digiSciFiStore{};
71 std::map<std::vector<int>, std::map<std::string, double> > X_qdc{};
72 std::map<std::vector<int>, std::map<std::string, double> > X_tdc{};
73 std::map<std::string, std::map<std::string, std::map<std::string, int>> > boardMaps{};
74 std::map<int, std::map<int, int> > MufiSystem{}; // <board_id_mu, <slot(tofpetID), s>
75 std::map<int, std::string > slots = { {0,"A"}, {1,"A"}, {2,"B"}, {3,"B"},
76 {4,"C"}, {5,"C"}, {6,"D"}, {7,"D"} };
77 std::map<int, std::map<int, int> > TofpetMap{};
78 std::map<std::string, std::map<std::string, std::map<std::string, std::string>> > boardMapsMu{};
79 std::map<std::string, std::vector<int> > offMap{};// name is key, vector is first bar, number of sipm channels / bar and direction
80 // For time monitoring
81 std::map<std::string, double> counters = { {"N",0}, {"event",0}, {"qdc",0}, {"tdc",0}, {"chi2",0},
82 {"make",0}, {"storage",0}, {"createScifi",0}, {"createMufi",0} };
83
85 TFile* fOut;
87 TTree* fEventTree;
88 // Board_x data
89 std::map<std::string, TTree*> boards{};
95 std::string fpathCalib, fpathJSON;
100 TMap* FSmap;
101
104 FairEventHeader* fEventHeader;
105 TClonesArray* fDigiSciFi;
106 TClonesArray* fDigiMuFilter;
107
110
112};
113#endif /* CONVRAWDATA_H_ */
map< string, map< string, map< string, int > > > boardMaps
map< string, map< string, map< string, string > > > boardMapsMu
double qdc_chi2(int board_id, int tofpet_id, int channel, int tac, int TDC)
FairEventHeader * fEventHeader
void debugMapping(std::string board, int tofpetID, int tofpetChannel)
double qdc_calibration(int board_id, int tofpet_id, int channel, int tac, uint16_t v_coarse, uint16_t v_fine, uint16_t tf)
TFile * fOut
Definition ConvRawData.h:85
double time_calibration(int board_id, int tofpet_id, int channel, int tac, int64_t t_coarse, uint16_t t_fine, int TDC)
std::map< std::string, double > counters
Definition ConvRawData.h:81
virtual void Exec(Option_t *opt)
TClonesArray * fDigiMuFilter
std::map< std::string, std::vector< int > > offMap
Definition ConvRawData.h:79
void DetMapping(std::string path)
virtual InitStatus Init()
Scifi * ScifiDet
Definition ConvRawData.h:84
std::string fpathCalib
Definition ConvRawData.h:95
double saturationLimit
Definition ConvRawData.h:97
void StartTimeofRun(std::string path)
std::tuple< double, double, double, double > comb_calibration(int board_id, int tofpet_id, int channel, int tac, uint16_t v_coarse, uint16_t v_fine, int64_t t_coarse, uint16_t t_fine, double GQDC, int TDC)
std::map< int, MuFilterHit * > digiMuFilterStore
Definition ConvRawData.h:69
std::map< int, std::string > slots
Definition ConvRawData.h:75
void UpdateInput(int n)
double chi2Max
Definition ConvRawData.h:97
ConvRawData(const ConvRawData &)
TClonesArray * fDigiSciFi
void checkBoardMapping(std::string path)
std::map< int, std::map< int, int > > MufiSystem
Definition ConvRawData.h:74
double qdc_sat(int board_id, int tofpet_id, int channel, int tac, uint16_t v_fine)
std::map< std::vector< int >, std::map< std::string, double > > X_qdc
Definition ConvRawData.h:71
ClassDef(ConvRawData, 3)
std::string fpathJSON
Definition ConvRawData.h:95
SNDLHCEventHeader * fSNDLHCEventHeader
TTree * fEventTree
Definition ConvRawData.h:87
double runStartUTC
Definition ConvRawData.h:98
ConvRawData & operator=(const ConvRawData &)
std::map< std::string, TTree * > boards
Definition ConvRawData.h:89
std::map< std::vector< int >, std::map< std::string, double > > X_tdc
Definition ConvRawData.h:72
std::map< int, sndScifiHit * > digiSciFiStore
Definition ConvRawData.h:70
int channel_func(int tofpet_id, int tofpet_channel, int position)
std::map< int, std::map< int, int > > TofpetMap
Definition ConvRawData.h:77
void read_csv(std::string path)
int makeCalibration
Definition ConvRawData.h:94
std::map< double, std::pair< double, double > > calibrationReport()
Definition Scifi.h:20