27 : fFile(nullptr), fTree(nullptr), fSegmentList(nullptr), fModuleList(nullptr),
28 fSegmentedData(nullptr) {
29 RegisterProcessorParameter(
"FileName",
"The name of output file",
fFileName, TString(
"tmp.root"));
30 RegisterProcessorParameter(
"TreeName",
"The name of output tree",
fTreeName, TString(
"tree"));
32 StringVec_t defaultignore;
33 defaultignore.push_back(
"");
34 RegisterInputCollection(
"SegmentedDataName",
"name of the segmented data",
38 RegisterInputInfo(
"SegmentList",
"name of the segment list",
40 RegisterInputInfo(
"ModuleList",
"name of the module list",
42 RegisterProcessorParameter(
"Ignore",
"ignore segment list",
fIgnore, defaultignore);
70 SetStateError(TString::Format(
"Cannot create file: %s",
fFileName.Data()));
74 Info(
"init",
"Created %s",
fFileName.Data());
76 Int_t nSeg = (*fSegmentList)->GetEntriesFast();
77 for (Int_t iSeg = 0; iSeg != nSeg; iSeg++) {
78 TSegmentInfo *seg = (TSegmentInfo *)(*fSegmentList)->At(iSeg);
79 Int_t nMod = seg->GetNumModules();
87 std::pair<int, std::vector<TModuleData *>> segment;
88 segment.first = seg->GetSegID();
89 std::vector<TModuleData *> &modules =
fSegments.insert(segment).first->second;
91 for (Int_t iMod = 0; iMod != nMod; iMod++) {
92 TModuleInfo *mod_info = seg->GetModule(iMod);
94 Int_t
id = mod->GetID();
95 if (modules.size() < (
unsigned int)
id + 1)
96 modules.resize(
id + 1);
98 TModuleType *type = (TModuleType *)(*fModuleList)->FindObject(seg->GetModuleType());
99 Int_t nCh = type->GetNch();
102 Int_t mod_id = type->GetDecoderID();
106 if (mod_id == 24 || mod_id == 25) {
107 Info(
"Init",
"Set %s_%d branch", seg->GetName(),
id);
108 fTree->Branch(Form(
"%s_%d", seg->GetName(),
id), &(mod->
fData2D));
110 Info(
"Init",
"Set %s_%d branch", seg->GetName(),
id);
111 fTree->Branch(Form(
"%s_%d", seg->GetName(),
id), &(mod->
fData1D));
116 for (std::vector<TString>::iterator it =
fIgnore.begin(); it !=
fIgnore.end(); it++) {
120 printf(
"%s will be ignored\n", (*it).Data());
125 std::map<Int_t, std::vector<TModuleData *>>::iterator it;
128 std::vector<TModuleData *> &modules = it->second;
129 for (Size_t i = 0; i < modules.size(); i++) {
130 Int_t mod = modules[i]->GetMod();
133 }
else if (mod == 24 || mod == 25) {
134 std::vector<Int_t> v;
135 v.emplace_back(kInvalidI);
136 modules[i]->fData2D.assign(modules[i]->GetNCh(), v);
138 modules[i]->fData1D.assign(modules[i]->GetNCh(), kInvalidI);
144 Int_t segid = it->first;
145 TObjArray *arr = (*fSegmentedData)->FindSegmentByID(segid);
147 Warning(
"Process",
"No segment having segid = %d", segid);
148 Warning(
"Process",
" Add this segid to Ignore if this semgment is not valid temporarily");
152 Int_t nHit = arr->GetEntriesFast();
153 std::vector<TModuleData *> &modules = it->second;
154 for (Int_t iHit = 0; iHit != nHit; iHit++) {
155 TRawDataObject *data = (TRawDataObject *)arr->UncheckedAt(iHit);
156 Int_t geo = data->GetGeo();
157 Int_t ch = data->GetCh();
161 Int_t nVal = data->GetNumValues();
163 for (Int_t iVal = 0; iVal < nVal; iVal++) {
164 if (modules.size() > geo && modules[geo] !=
nullptr) {
166 tmp = data->GetValue(iVal);
168 if (tmp != data->GetValue(iVal)) {
169 std::cout << tmp << std::endl;
170 std::cout << data->GetValue(iVal) << std::endl;
178 if ((Int_t)modules.size() > geo && modules[geo] !=
nullptr) {
179 Int_t mod = modules[geo]->GetMod();
180 if (mod == 24 || mod == 25) {
181 if (modules[geo]->fData2D[ch][0] == kInvalidI) {
182 modules[geo]->fData2D[ch][0] = data->GetValue(0);
184 modules[geo]->fData2D[ch].emplace_back(data->GetValue(0));
187 modules[geo]->fData1D[ch] = data->GetValue(0);