diff --git a/.gitignore b/.gitignore index bcc88b9..4267451 100644 --- a/.gitignore +++ b/.gitignore @@ -12,7 +12,7 @@ DataReaderScript DataReader pid.dat DAQLock.dat -FSU2ROOT +DumpFSU2ROOT data diff --git a/DataReaderScript.cpp b/DataReaderScript.cpp index 9f0efe0..9e72ca2 100644 --- a/DataReaderScript.cpp +++ b/DataReaderScript.cpp @@ -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; diff --git a/FSU2ROOT.cpp b/DumpFSU2ROOT.cpp similarity index 93% rename from FSU2ROOT.cpp rename to DumpFSU2ROOT.cpp index a6d28a5..ac04288 100644 --- a/FSU2ROOT.cpp +++ b/DumpFSU2ROOT.cpp @@ -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; diff --git a/Makefile_Aux b/Makefile_Aux index 07348cd..cd7b0e9 100644 --- a/Makefile_Aux +++ b/Makefile_Aux @@ -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) diff --git a/MultiBuilder.cpp b/MultiBuilder.cpp index da57e69..14da1fe 100644 --- a/MultiBuilder.cpp +++ b/MultiBuilder.cpp @@ -2,33 +2,6 @@ #include - -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 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 type, std::vector sn) : nData(type.size()){ data = multiData; typeList = type; @@ -38,38 +11,17 @@ MultiBuilder::MultiBuilder(Data ** multiData, std::vector 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(){ diff --git a/MultiBuilder.h b/MultiBuilder.h index 8c565b3..08a70d5 100644 --- a/MultiBuilder.h +++ b/MultiBuilder.h @@ -42,14 +42,8 @@ public: class MultiBuilder { public: - MultiBuilder(Digitizer ** digi, unsigned int nDigi); - MultiBuilder(Digitizer ** digi, std::vector id); MultiBuilder(Data ** multiData, std::vector type, std::vector 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;} diff --git a/analyzers/Analyser.cpp b/analyzers/Analyser.cpp index f0a17de..5b28500 100644 --- a/analyzers/Analyser.cpp +++ b/analyzers/Analyser.cpp @@ -4,7 +4,7 @@ #include #include -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 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(){ diff --git a/analyzers/Analyser.h b/analyzers/Analyser.h index f6fb2c5..17cf24d 100644 --- a/analyzers/Analyser.h +++ b/analyzers/Analyser.h @@ -68,6 +68,10 @@ private: Digitizer ** digi; unsigned short nDigi; + Data ** dataList; + std::vector typeList; + std::vector snList; + double waitTimeinSec; MultiBuilder * mb; diff --git a/analyzers/EncoreAnalyzer.h b/analyzers/EncoreAnalyzer.h index bb0b299..24d0de4 100644 --- a/analyzers/EncoreAnalyzer.h +++ b/analyzers/EncoreAnalyzer.h @@ -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++){