changed MutliBuilder and EVentBuilder independ of CAEN Library
This commit is contained in:
parent
8cf46f6c5f
commit
59af8a4c6d
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -12,7 +12,7 @@ DataReaderScript
|
||||||
DataReader
|
DataReader
|
||||||
pid.dat
|
pid.dat
|
||||||
DAQLock.dat
|
DAQLock.dat
|
||||||
FSU2ROOT
|
DumpFSU2ROOT
|
||||||
|
|
||||||
data
|
data
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ void DataReader(std::string fileName, int DPPType){
|
||||||
|
|
||||||
fseek(haha, 0, SEEK_SET);
|
fseek(haha, 0, SEEK_SET);
|
||||||
|
|
||||||
MultiBuilder * mb = new MultiBuilder(data, DPPType);
|
MultiBuilder * mb = new MultiBuilder(data, DPPType, 0);
|
||||||
mb->SetTimeWindow(0);
|
mb->SetTimeWindow(0);
|
||||||
|
|
||||||
char * buffer = nullptr;
|
char * buffer = nullptr;
|
||||||
|
|
|
@ -47,20 +47,22 @@ int main(int argc, char **argv){
|
||||||
///============= sorting file by the serial number & order
|
///============= sorting file by the serial number & order
|
||||||
int ID[nFile]; /// serial+ order*1000;
|
int ID[nFile]; /// serial+ order*1000;
|
||||||
int type[nFile];
|
int type[nFile];
|
||||||
|
int sn[nFile];
|
||||||
unsigned int fileSize[nFile];
|
unsigned int fileSize[nFile];
|
||||||
for( int i = 0; i < nFile; i++){
|
for( int i = 0; i < nFile; i++){
|
||||||
int pos = inFileName[i].Last('/');
|
int pos = inFileName[i].Last('/');
|
||||||
int snPos = inFileName[i].Index("_", pos); // first "_"
|
int snPos = inFileName[i].Index("_", pos); // first "_"
|
||||||
//snPos = inFileName[i].Index("_", snPos + 1);
|
//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];
|
TString typeStr = &inFileName[i][snPos+9];
|
||||||
typeStr.Resize(3);
|
typeStr.Resize(3);
|
||||||
|
|
||||||
if( typeStr == "PHA" ) type[i] = V1730_DPP_PHA_CODE;
|
if( typeStr == "PHA" ) type[i] = DPPType::DPP_PHA_CODE;
|
||||||
if( typeStr == "PSD" ) type[i] = V1730_DPP_PSD_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]);
|
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");
|
FILE * temp = fopen(inFileName[i].Data(), "rb");
|
||||||
if( temp == NULL ) {
|
if( temp == NULL ) {
|
||||||
|
@ -114,7 +116,7 @@ int main(int argc, char **argv){
|
||||||
for( int i = 0; i < nFile; i++){
|
for( int i = 0; i < nFile; i++){
|
||||||
if( inFile[i] == nullptr ) continue;
|
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);
|
mb->SetTimeWindow(0);
|
||||||
int countBdAgg = 0;
|
int countBdAgg = 0;
|
||||||
|
|
12
Makefile_Aux
12
Makefile_Aux
|
@ -14,7 +14,7 @@ ROOTLIBS = `root-config --cflags --glibs`
|
||||||
|
|
||||||
OBJS = ClassDigitizer.o MultiBuilder.o
|
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
|
DataReader : DataReaderScript.cpp ClassData.h MultiBuilder.o
|
||||||
@echo "--------- making DataReader"
|
@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
|
EventBuilder : EventBuilder.cpp ClassData.h MultiBuilder.o
|
||||||
@echo "--------- making EventBuilder"
|
@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
|
DumpFSU2ROOT : DumpFSU2ROOT.cpp ClassData.h MultiBuilder.o
|
||||||
@echo "--------- making FSU2ROOT"
|
@echo "--------- making DumpFSU2ROOT"
|
||||||
$(CC) $(COPTS) -o FSU2ROOT FSU2ROOT.cpp ClassData.h MultiBuilder.o $(CAENLIBS) $(ROOTLIBS)
|
$(CC) $(COPTS) -o DumpFSU2ROOT DumpFSU2ROOT.cpp ClassData.h MultiBuilder.o $(ROOTLIBS)
|
||||||
|
|
|
@ -2,33 +2,6 @@
|
||||||
|
|
||||||
#include <algorithm>
|
#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()){
|
MultiBuilder::MultiBuilder(Data ** multiData, std::vector<int> type, std::vector<int> sn) : nData(type.size()){
|
||||||
data = multiData;
|
data = multiData;
|
||||||
typeList = type;
|
typeList = type;
|
||||||
|
@ -38,38 +11,17 @@ MultiBuilder::MultiBuilder(Data ** multiData, std::vector<int> type, std::vector
|
||||||
ClearEvents();
|
ClearEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
MultiBuilder::MultiBuilder(Digitizer ** digi, int digiID) : nData(1){
|
MultiBuilder::MultiBuilder(Data * singleData, int type, int sn): 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){
|
|
||||||
data = new Data *[1];
|
data = new Data *[1];
|
||||||
data[0] = singleData;
|
data[0] = singleData;
|
||||||
typeList.push_back(type);
|
typeList.push_back(type);
|
||||||
snList.push_back(0);
|
snList.push_back(sn);
|
||||||
idList.push_back(0);
|
idList.push_back(0);
|
||||||
timeWindow = 100;
|
timeWindow = 100;
|
||||||
ClearEvents();
|
ClearEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
MultiBuilder::~MultiBuilder(){
|
MultiBuilder::~MultiBuilder(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MultiBuilder::ClearEvents(){
|
void MultiBuilder::ClearEvents(){
|
||||||
|
|
|
@ -42,14 +42,8 @@ public:
|
||||||
class MultiBuilder {
|
class MultiBuilder {
|
||||||
|
|
||||||
public:
|
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);
|
MultiBuilder(Data ** multiData, std::vector<int> type, std::vector<int> sn);
|
||||||
|
MultiBuilder(Data * singleData, int type, int sn);
|
||||||
//for signal digitizer
|
|
||||||
MultiBuilder(Digitizer ** digi, int digiID);
|
|
||||||
MultiBuilder(Digitizer * digi);
|
|
||||||
MultiBuilder(Data * singleData, int type);
|
|
||||||
~MultiBuilder();
|
~MultiBuilder();
|
||||||
|
|
||||||
void SetTimeWindow(int ticks) {timeWindow = ticks;}
|
void SetTimeWindow(int ticks) {timeWindow = ticks;}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#include <QRandomGenerator>
|
#include <QRandomGenerator>
|
||||||
#include <random>
|
#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->digi = digi;
|
||||||
this->nDigi = nDigi;
|
this->nDigi = nDigi;
|
||||||
|
@ -15,7 +15,17 @@ Analyzer::Analyzer(Digitizer ** digi, unsigned int nDigi, QMainWindow * parent )
|
||||||
influx = nullptr;
|
influx = nullptr;
|
||||||
dataBaseName = "";
|
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 = new TimingThread(this);
|
||||||
buildTimerThread->SetWaitTimeinSec(1.0); //^Set event build interval
|
buildTimerThread->SetWaitTimeinSec(1.0); //^Set event build interval
|
||||||
|
@ -34,11 +44,23 @@ Analyzer::Analyzer(Digitizer ** digi, unsigned int nDigi, QMainWindow * parent )
|
||||||
Analyzer::~Analyzer(){
|
Analyzer::~Analyzer(){
|
||||||
delete influx;
|
delete influx;
|
||||||
delete mb;
|
delete mb;
|
||||||
|
delete [] dataList;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Analyzer::RedefineEventBuilder(std::vector<int> idList){
|
void Analyzer::RedefineEventBuilder(std::vector<int> idList){
|
||||||
delete mb;
|
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(){
|
void Analyzer::StartThread(){
|
||||||
|
|
|
@ -68,6 +68,10 @@ private:
|
||||||
Digitizer ** digi;
|
Digitizer ** digi;
|
||||||
unsigned short nDigi;
|
unsigned short nDigi;
|
||||||
|
|
||||||
|
Data ** dataList;
|
||||||
|
std::vector<int> typeList;
|
||||||
|
std::vector<int> snList;
|
||||||
|
|
||||||
double waitTimeinSec;
|
double waitTimeinSec;
|
||||||
|
|
||||||
MultiBuilder * mb;
|
MultiBuilder * mb;
|
||||||
|
|
|
@ -135,6 +135,10 @@ inline void Encore::UpdateHistograms(){
|
||||||
hRight->Fill(ID-100, eC );
|
hRight->Fill(ID-100, eC );
|
||||||
sum[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++){
|
for( int ch = 0; ch < 17; ch++){
|
||||||
|
|
Loading…
Reference in New Issue
Block a user