BmnRoot
Loading...
Searching...
No Matches
BmnProfRaw2Digit.h
Go to the documentation of this file.
1#ifndef BMNPROFRAW2DIGIT_H
2#define BMNPROFRAW2DIGIT_H
3
4// Auxillary
5#include <boost/circular_buffer.hpp>
6#include <boost/exception/all.hpp>
7#include <boost/property_tree/json_parser.hpp>
8#include <boost/property_tree/ptree.hpp>
9// Root
10#include "TClonesArray.h"
11#include "TH1F.h"
12#include "TMath.h"
13#include "TString.h"
14#include "TTree.h"
15// BmnRoot
16#include "BmnADCDigit.h"
17#include "BmnAdcProcessor.h"
18#include "BmnEnums.h"
19#include "BmnMath.h"
20#include "BmnProfRawTools.h"
21#include "BmnSiProfDigit.h"
22
23#include <BmnSiBTStationSet.h>
24
25using std::map;
26using std::vector;
27using namespace TMath;
28namespace pt = boost::property_tree;
29
31{
32 char ChannelName = 0;
33 char LayerType = 0;
34 uint16_t LayerId = 0;
36};
37
38typedef map<uint16_t, ProfiLocal> LayerIdProfiMap; // layerId -> layer local map
39typedef map<uint16_t, LayerIdProfiMap> Mod2LocalProfiMap; // module -> local maps
40
42{
43 uint16_t StationId = 0;
44 uint16_t ModuleId = 0;
45 ProfiLocal* Layer = nullptr;
46};
47typedef map<PlMapKey, ProfiInfo> GlobalProfiMap; // {serial, channel} -> info
48
50{
51 public:
52 BmnProfRaw2Digit(Int_t period, Int_t run);
54
55 GlobalProfiMap& GetGlobalMap() { return fGlobalMap; }
56
57 BmnStatus FillEvent(TClonesArray* adc, TClonesArray* csc);
58 BmnStatus FillProfiles(TClonesArray* adc);
60
61 static unique_ptr<BmnSiProfStationSet> GetProfStationSet(Int_t period);
62
63 int FillExtractedBits(TClonesArray* fInAdcArray, TClonesArray* fWorkAdcArray)
64 {
65 for (Int_t idigit = 0; idigit < fInAdcArray->GetEntriesFast(); idigit++) {
66 BmnADCDigit* digit = (BmnADCDigit*)fInAdcArray->At(idigit);
67 uint16_t* arr = digit->GetUShortValue();
68 for (auto& m : fChannelMaps)
69 for (auto& vecEl : m.second) {
70 int16_t arr_out[BmnProfRawTools::ChannelCnt()] = {};
71 for (size_t j = 0; j < BmnProfRawTools::ChannelCnt(); j++) {
72 arr_out[j] = BmnProfRawTools::adc_ch(arr, j * 6, vecEl.second.ChannelName)
73 * 16; // x16 because ADC processor works also with ADC64 shifted values
74 // printf("arr[%c][%2ld] = %hd\n", vecEl.second.ChannelName, j,
75 // arr_out[j]);
76 }
77 /*BmnADCDigit* wd = */ new ((*fWorkAdcArray)[fWorkAdcArray->GetEntriesFast()])
78 BmnADCDigit(digit->GetSerial(),
79 vecEl.second.LayerId, // for simplicity: layerId == ChannelId
81 // int16_t * arr_out = wd->GetShortValue();
82 }
83 }
84 return 0;
85 }
86
87 private:
88 string fLocalMapFileName;
89 string fGlobalMapFileName;
90
91 GlobalProfiMap fGlobalMap;
92 Mod2LocalProfiMap fChannelMaps;
93
94 unique_ptr<BmnSiBTStationSet> fSiBTStationSet;
95
96 void MapStrip(ProfiInfo& info,
97 uint16_t ch,
98 Int_t iSmpl,
99 uint16_t& station,
100 uint16_t& mod,
101 uint16_t& lay,
102 int16_t& strip);
103 void ProcessAdc(TClonesArray* adc, TClonesArray* csc, Bool_t doFill);
104 BmnStatus ReadGlobalMapFile(string name);
105 BmnStatus ReadLocalMapFile(string name);
106
107 ClassDef(BmnProfRaw2Digit, 1);
108};
109
110#endif /* BMNPROFRAW2DIGIT_H */
map< PlMapKey, ProfiInfo > GlobalProfiMap
map< uint16_t, ProfiLocal > LayerIdProfiMap
map< uint16_t, LayerIdProfiMap > Mod2LocalProfiMap
__m128 m
Definition P4_F32vec4.h:27
BmnStatus
Definition BmnEnums.h:24
UInt_t GetSerial() const
Definition BmnADCDigit.h:31
UShort_t * GetUShortValue() const
Definition BmnADCDigit.h:37
BmnStatus FillNoisyChannels()
GlobalProfiMap & GetGlobalMap()
static unique_ptr< BmnSiProfStationSet > GetProfStationSet(Int_t period)
BmnStatus FillProfiles(TClonesArray *adc)
int FillExtractedBits(TClonesArray *fInAdcArray, TClonesArray *fWorkAdcArray)
BmnStatus FillEvent(TClonesArray *adc, TClonesArray *csc)
static int adc_ch(vector< bitset< 32 > > &adc_word, char channel_name)
static constexpr const size_t ChannelCnt()
vector< Int_t > StripMap
-clang-format
ProfiLocal * Layer
uint16_t StationId
uint16_t ModuleId
uint16_t LayerId