changed MutliBuilder and EVentBuilder independ of CAEN Library

This commit is contained in:
carina@hades 2023-10-05 13:13:15 -04:00
parent 8cf46f6c5f
commit 59af8a4c6d
9 changed files with 51 additions and 73 deletions

2
.gitignore vendored
View File

@ -12,7 +12,7 @@ DataReaderScript
DataReader
pid.dat
DAQLock.dat
FSU2ROOT
DumpFSU2ROOT
data

View File

@ -20,7 +20,7 @@ void DataReader(std::string fileName, int DPPType){
fseek(haha, 0, SEEK_SET);
MultiBuilder * mb = new MultiBuilder(data, DPPType);
MultiBuilder * mb = new MultiBuilder(data, DPPType, 0);
mb->SetTimeWindow(0);
char * buffer = nullptr;

View File

@ -47,20 +47,22 @@ int main(int argc, char **argv){
///============= sorting file by the serial number & order
int ID[nFile]; /// serial+ order*1000;
int type[nFile];
int sn[nFile];
unsigned int fileSize[nFile];
for( int i = 0; i < nFile; i++){
int pos = inFileName[i].Last('/');
int snPos = inFileName[i].Index("_", pos); // first "_"
//snPos = inFileName[i].Index("_", snPos + 1);
int sn = atoi(&inFileName[i][snPos+5]);
sn[i] = atoi(&inFileName[i][snPos+5]);
TString typeStr = &inFileName[i][snPos+9];
typeStr.Resize(3);
if( typeStr == "PHA" ) type[i] = V1730_DPP_PHA_CODE;
if( typeStr == "PSD" ) type[i] = V1730_DPP_PSD_CODE;
if( typeStr == "PHA" ) type[i] = DPPType::DPP_PHA_CODE;
if( typeStr == "PSD" ) type[i] = DPPType::DPP_PSD_CODE;
if( typeStr == "QDC" ) type[i] = DPPType::DPP_QDC_CODE;
int order = atoi(&inFileName[i][snPos+13]);
ID[i] = sn + order * 1000;
ID[i] = sn[i] + order * 1000;
FILE * temp = fopen(inFileName[i].Data(), "rb");
if( temp == NULL ) {
@ -114,7 +116,7 @@ int main(int argc, char **argv){
for( int i = 0; i < nFile; i++){
if( inFile[i] == nullptr ) continue;
MultiBuilder * mb = new MultiBuilder(data[i], type[i]);
MultiBuilder * mb = new MultiBuilder(data[i], type[i], sn[i]);
mb->SetTimeWindow(0);
int countBdAgg = 0;

View File

@ -14,7 +14,7 @@ ROOTLIBS = `root-config --cflags --glibs`
OBJS = ClassDigitizer.o MultiBuilder.o
ALL = test test_indep DataGenerator EventBuilder DataReader FSU2ROOT
ALL = test test_indep DataGenerator EventBuilder DataReader DumpFSU2ROOT
#########################################################################
@ -43,12 +43,12 @@ DataGenerator : DataGenerator.cpp ClassDigitizer.o
DataReader : DataReaderScript.cpp ClassData.h MultiBuilder.o
@echo "--------- making DataReader"
$(CC) $(COPTS) -o DataReader DataReaderScript.cpp ClassData.h MultiBuilder.o $(CAENLIBS)
$(CC) $(COPTS) -o DataReader DataReaderScript.cpp ClassData.h MultiBuilder.o
EventBuilder : EventBuilder.cpp ClassData.h MultiBuilder.o
@echo "--------- making EventBuilder"
$(CC) $(COPTS) -o EventBuilder EventBuilder.cpp MultiBuilder.o $(CAENLIBS) $(ROOTLIBS)
$(CC) $(COPTS) -o EventBuilder EventBuilder.cpp MultiBuilder.o $(ROOTLIBS)
FSU2ROOT : FSU2ROOT.cpp ClassData.h MultiBuilder.o
@echo "--------- making FSU2ROOT"
$(CC) $(COPTS) -o FSU2ROOT FSU2ROOT.cpp ClassData.h MultiBuilder.o $(CAENLIBS) $(ROOTLIBS)
DumpFSU2ROOT : DumpFSU2ROOT.cpp ClassData.h MultiBuilder.o
@echo "--------- making DumpFSU2ROOT"
$(CC) $(COPTS) -o DumpFSU2ROOT DumpFSU2ROOT.cpp ClassData.h MultiBuilder.o $(ROOTLIBS)

View File

@ -2,33 +2,6 @@
#include <algorithm>
MultiBuilder::MultiBuilder(Digitizer ** digi, unsigned int nDigi) : nData(nDigi){
data = new Data *[nData];
for( unsigned int i = 0; i < nData; i++){
data[i] = digi[i]->GetData();
typeList.push_back(digi[i]->GetDPPType());
snList.push_back(digi[i]->GetSerialNumber());
idList.push_back(i);
timeWindow = 100;
ClearEvents();
}
}
MultiBuilder::MultiBuilder(Digitizer ** digi, std::vector<int> id) : nData(id.size()){
data = new Data *[nData];
idList = id;
for( unsigned int i = 0; i < nData; i++){
int k = idList[i];
data[i] = digi[k]->GetData();
//TODO type and sn should be inside data[i]
typeList.push_back(digi[k]->GetDPPType());
snList.push_back(digi[k]->GetSerialNumber());
timeWindow = 100;
ClearEvents();
}
}
MultiBuilder::MultiBuilder(Data ** multiData, std::vector<int> type, std::vector<int> sn) : nData(type.size()){
data = multiData;
typeList = type;
@ -38,38 +11,17 @@ MultiBuilder::MultiBuilder(Data ** multiData, std::vector<int> type, std::vector
ClearEvents();
}
MultiBuilder::MultiBuilder(Digitizer ** digi, int digiID) : nData(1){
data = new Data *[nData];
data[0] = digi[digiID]->GetData();
typeList.push_back(digi[digiID]->GetDPPType());
snList.push_back(digi[digiID]->GetSerialNumber());
idList.push_back(digiID);
timeWindow = 100;
ClearEvents();
}
MultiBuilder::MultiBuilder(Digitizer * digi) : nData(1){
data = new Data *[1];
data[0] = digi->GetData();
typeList.push_back(digi->GetDPPType());
snList.push_back(digi->GetSerialNumber());
idList.push_back(0);
timeWindow = 100;
ClearEvents();
}
MultiBuilder::MultiBuilder(Data * singleData, int type): nData(1){
MultiBuilder::MultiBuilder(Data * singleData, int type, int sn): nData(1){
data = new Data *[1];
data[0] = singleData;
typeList.push_back(type);
snList.push_back(0);
snList.push_back(sn);
idList.push_back(0);
timeWindow = 100;
ClearEvents();
}
MultiBuilder::~MultiBuilder(){
}
void MultiBuilder::ClearEvents(){

View File

@ -42,14 +42,8 @@ public:
class MultiBuilder {
public:
MultiBuilder(Digitizer ** digi, unsigned int nDigi);
MultiBuilder(Digitizer ** digi, std::vector<int> id);
MultiBuilder(Data ** multiData, std::vector<int> type, std::vector<int> sn);
//for signal digitizer
MultiBuilder(Digitizer ** digi, int digiID);
MultiBuilder(Digitizer * digi);
MultiBuilder(Data * singleData, int type);
MultiBuilder(Data * singleData, int type, int sn);
~MultiBuilder();
void SetTimeWindow(int ticks) {timeWindow = ticks;}

View File

@ -4,7 +4,7 @@
#include <QRandomGenerator>
#include <random>
Analyzer::Analyzer(Digitizer ** digi, unsigned int nDigi, QMainWindow * parent ): QMainWindow(parent){
Analyzer::Analyzer(Digitizer ** digi, unsigned int nDigi, QMainWindow * parent ): QMainWindow(parent), dataList(NULL){
this->digi = digi;
this->nDigi = nDigi;
@ -15,7 +15,17 @@ Analyzer::Analyzer(Digitizer ** digi, unsigned int nDigi, QMainWindow * parent )
influx = nullptr;
dataBaseName = "";
mb = new MultiBuilder(digi, nDigi);
dataList = new Data*[nDigi];
typeList.clear();
snList.clear();
for( unsigned int k = 0; k < nDigi; k ++) {
dataList[k] = digi[k]->GetData();
typeList.push_back(digi[k]->GetDPPType());
snList.push_back(digi[k]->GetSerialNumber());
}
mb = new MultiBuilder(dataList, typeList, snList);
buildTimerThread = new TimingThread(this);
buildTimerThread->SetWaitTimeinSec(1.0); //^Set event build interval
@ -34,11 +44,23 @@ Analyzer::Analyzer(Digitizer ** digi, unsigned int nDigi, QMainWindow * parent )
Analyzer::~Analyzer(){
delete influx;
delete mb;
delete [] dataList;
}
void Analyzer::RedefineEventBuilder(std::vector<int> idList){
delete mb;
mb = new MultiBuilder(digi, idList);
delete [] dataList;
typeList.clear();
snList.clear();
dataList = new Data*[idList.size()];
for( size_t k = 0; k < idList.size(); k ++) {
dataList[k] = digi[idList[k]]->GetData();
typeList.push_back(digi[idList[k]]->GetDPPType());
snList.push_back(digi[idList[k]]->GetSerialNumber());
}
mb = new MultiBuilder(dataList, typeList, snList);
}
void Analyzer::StartThread(){

View File

@ -68,6 +68,10 @@ private:
Digitizer ** digi;
unsigned short nDigi;
Data ** dataList;
std::vector<int> typeList;
std::vector<int> snList;
double waitTimeinSec;
MultiBuilder * mb;

View File

@ -135,6 +135,10 @@ inline void Encore::UpdateHistograms(){
hRight->Fill(ID-100, eC );
sum[ID-100] += eC ;
}
if( 200 <= ID && ID < 300 ) {
hRight->Fill(ID-200, eC );
sum[ID-200] += eC ;
}
}
for( int ch = 0; ch < 17; ch++){