EventBuilder, trace stored as fixed size array of array
This commit is contained in:
parent
1b3c1733ce
commit
02305314ba
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
|
@ -161,6 +161,7 @@
|
||||||
"Analyzer.C": "cpp",
|
"Analyzer.C": "cpp",
|
||||||
"process_Run.C": "cpp",
|
"process_Run.C": "cpp",
|
||||||
"EncoreAnalyzer.C": "cpp",
|
"EncoreAnalyzer.C": "cpp",
|
||||||
"qfiledialog": "cpp"
|
"qfiledialog": "cpp",
|
||||||
|
"script.C": "cpp"
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -7,9 +7,10 @@
|
||||||
#include "TFile.h"
|
#include "TFile.h"
|
||||||
#include "TTree.h"
|
#include "TTree.h"
|
||||||
#include "TMacro.h"
|
#include "TMacro.h"
|
||||||
|
#include "TMath.h"
|
||||||
|
|
||||||
|
#define MAX_TRACE_LENGTH 2000
|
||||||
#define MAX_MULTI 2000
|
#define MAX_MULTI 100
|
||||||
|
|
||||||
struct FileInfo{
|
struct FileInfo{
|
||||||
|
|
||||||
|
@ -143,15 +144,20 @@ int main(int argc, char **argv) {
|
||||||
tree->Branch("e_f", e_f, "e_fineTime[multi]/s");
|
tree->Branch("e_f", e_f, "e_fineTime[multi]/s");
|
||||||
tree->Branch("traceLength", traceLength, "traceLength[multi]/s");
|
tree->Branch("traceLength", traceLength, "traceLength[multi]/s");
|
||||||
|
|
||||||
TClonesArray * arrayTrace = nullptr;
|
// TClonesArray * arrayTrace = nullptr;
|
||||||
TGraph * trace = nullptr;
|
// TGraph * trace = nullptr;
|
||||||
|
|
||||||
|
short trace[MAX_MULTI][1024];
|
||||||
if( traceOn ) {
|
if( traceOn ) {
|
||||||
arrayTrace = new TClonesArray("TGraph");
|
// arrayTrace = new TClonesArray("TGraph");
|
||||||
tree->Branch("trace", arrayTrace, 2560000);
|
// tree->Branch("trace", arrayTrace, 2560000);
|
||||||
arrayTrace->BypassStreamer();
|
// arrayTrace->BypassStreamer();
|
||||||
|
|
||||||
|
tree->Branch("trace", trace,"trace[multi][1024]/S");
|
||||||
|
tree->GetBranch("trace")->SetCompressionSettings(205);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//*======================================= Open files
|
//*======================================= Open files
|
||||||
printf("========================================= Open files & Build Events.\n");
|
printf("========================================= Open files & Build Events.\n");
|
||||||
|
|
||||||
|
@ -260,15 +266,15 @@ int main(int argc, char **argv) {
|
||||||
tEnd = events.back().timestamp;
|
tEnd = events.back().timestamp;
|
||||||
|
|
||||||
hitProcessed += events.size();
|
hitProcessed += events.size();
|
||||||
if( hitProcessed % 10000 == 0 ) printf("hit Porcessed %llu/%llu hit....%.2f%%\n\033[A\r", hitProcessed, totalHitCount, hitProcessed*100./totalHitCount);
|
if( hitProcessed % (traceOn ? 100 : 10000) == 0 ) printf("hit Porcessed %llu/%llu hit....%.2f%%\n\033[A\r", hitProcessed, totalHitCount, hitProcessed*100./totalHitCount);
|
||||||
|
|
||||||
|
|
||||||
multi = events.size() ;
|
multi = events.size() ;
|
||||||
if( events.size() >= MAX_MULTI ) {
|
if( events.size() >= MAX_MULTI ) {
|
||||||
printf("event %lld has size = %d > MAX_MULTI = %d\n", evID, multi, MAX_MULTI);
|
printf("\033[31m event %lld has size = %d > MAX_MULTI = %d \033[0m\n", evID, multi, MAX_MULTI);
|
||||||
multi = MAX_MULTI;
|
multi = MAX_MULTI;
|
||||||
}
|
}
|
||||||
if( debug ) printf("=================================== filling data | %u \n", multi);
|
if( debug ) printf("=================================== filling data | %u \n", multi);
|
||||||
|
|
||||||
for( size_t p = 0; p < multi ; p ++ ) {
|
for( size_t p = 0; p < multi ; p ++ ) {
|
||||||
if( debug ) {printf("%4zu | ", p); events[p].Print();}
|
if( debug ) {printf("%4zu | ", p); events[p].Print();}
|
||||||
|
|
||||||
|
@ -281,11 +287,22 @@ int main(int argc, char **argv) {
|
||||||
|
|
||||||
traceLength[p] = events[p].traceLength;
|
traceLength[p] = events[p].traceLength;
|
||||||
if( traceOn ){
|
if( traceOn ){
|
||||||
trace = (TGraph *) arrayTrace->ConstructedAt(multi, "C");
|
// trace = (TGraph *) arrayTrace->ConstructedAt(p, "C");
|
||||||
trace->Clear();
|
// trace->Clear();
|
||||||
for( int hh = 0; hh < traceLength[multi]; hh++){
|
// for( int hh = 0; hh < traceLength[multi]; hh++){
|
||||||
trace->SetPoint(hh, hh, events[p].trace[hh]);
|
// trace->SetPoint(hh, hh, events[p].trace[hh]);
|
||||||
|
// }
|
||||||
|
|
||||||
|
if( traceLength[p] > MAX_TRACE_LENGTH ) {
|
||||||
|
printf("\033[31m event %lld has trace length = %d > MAX_TRACE_LENGTH = %d \033[0m\n", evID, traceLength[p], MAX_TRACE_LENGTH);
|
||||||
|
traceLength[p] = MAX_TRACE_LENGTH;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for( int hh = 0; hh < traceLength[p]; hh++){
|
||||||
|
trace[p][hh] = events[p].trace[hh];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user