good state, don't understand why the baseline is so high
This commit is contained in:
parent
9b03a78cec
commit
e5af22d30c
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -7,3 +7,5 @@
|
||||||
test
|
test
|
||||||
example
|
example
|
||||||
read-set
|
read-set
|
||||||
|
|
||||||
|
*.root
|
||||||
|
|
48
DataBlock.h
48
DataBlock.h
|
@ -8,29 +8,38 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "TSystem.h"
|
||||||
|
#include "TObject.h"
|
||||||
|
#include "TFile.h"
|
||||||
|
#include "TTree.h"
|
||||||
|
#include "TString.h"
|
||||||
|
|
||||||
|
#define MAX_TRACE_LENGHT 16000
|
||||||
|
|
||||||
class DataBlock{
|
class DataBlock{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
unsigned short ch;
|
UShort_t ch;
|
||||||
unsigned short slot;
|
UShort_t slot;
|
||||||
unsigned short crate;
|
UShort_t crate;
|
||||||
unsigned short headerLength; /// headerLength > 4, more data except tarce.
|
UShort_t headerLength; /// headerLength > 4, more data except tarce.
|
||||||
unsigned short eventLength; /// eventLength = headerLength + trace
|
UShort_t eventLength; /// eventLength = headerLength + trace
|
||||||
bool pileup;
|
Bool_t pileup;
|
||||||
unsigned long long time;
|
ULong64_t time;
|
||||||
unsigned short cfd;
|
UShort_t cfd;
|
||||||
unsigned short energy;
|
UShort_t energy;
|
||||||
unsigned short trace_length;
|
UShort_t trace_length;
|
||||||
bool trace_out_of_range;
|
Bool_t trace_out_of_range;
|
||||||
|
|
||||||
int trailing;
|
Int_t trailing;
|
||||||
int leading;
|
Int_t leading;
|
||||||
int gap;
|
Int_t gap;
|
||||||
int baseline;
|
Int_t baseline;
|
||||||
int QDCsum[8];
|
Int_t QDCsum[8];
|
||||||
|
|
||||||
unsigned long long eventID;
|
ULong64_t eventID;
|
||||||
unsigned short trace[4000];
|
|
||||||
|
UShort_t trace[MAX_TRACE_LENGHT];
|
||||||
|
|
||||||
DataBlock(){
|
DataBlock(){
|
||||||
Clear();
|
Clear();
|
||||||
|
@ -50,7 +59,6 @@ public:
|
||||||
energy = 0;
|
energy = 0;
|
||||||
trace_length = 0;
|
trace_length = 0;
|
||||||
trace_out_of_range = 0;
|
trace_out_of_range = 0;
|
||||||
|
|
||||||
eventID = 0;
|
eventID = 0;
|
||||||
ClearQDC();
|
ClearQDC();
|
||||||
ClearTrace();
|
ClearTrace();
|
||||||
|
@ -65,7 +73,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClearTrace(){
|
void ClearTrace(){
|
||||||
for( int i = 0; i < 1024; i++) trace[i] = 0;
|
for( int i = 0 ; i < MAX_TRACE_LENGHT; i++) trace[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
4
Makefile
4
Makefile
|
@ -29,8 +29,8 @@ LIBS = $(APIBASE)libPixie16Api.so $(APIBASE)libPixieSDK.a $(PLXBASE)PlxApi.a
|
||||||
|
|
||||||
all: test example
|
all: test example
|
||||||
|
|
||||||
example : example.o Pixie16Class.o
|
example : example.o
|
||||||
$(CC) $(INCFLAGS) example.o Pixie16Class.o $(LIBS) -o example
|
$(CC) $(INCFLAGS) example.o $(LIBS) -o example
|
||||||
|
|
||||||
example.o : example.cpp
|
example.o : example.cpp
|
||||||
$(CC) $(CFLAGS) $(INCFLAGS) example.cpp
|
$(CC) $(CFLAGS) $(INCFLAGS) example.cpp
|
||||||
|
|
|
@ -230,6 +230,25 @@ void Pixie16::AdjustOffset(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Pixie16::CaptureBaseLine(unsigned short modID, unsigned short ch){
|
||||||
|
retval = Pixie16AcquireBaselines(modID);
|
||||||
|
if( CheckError("Pixie16AcquireBaselines::MOD::"+std::to_string(modID)) < 0 ) return;
|
||||||
|
|
||||||
|
retval = Pixie16ReadSglChanBaselines(Baselines, TimeStamps, 3640, modID, ch);
|
||||||
|
if( CheckError("Pixie16ReadSglChanBaselines::MOD::"+std::to_string(modID) + "CH::"+std::to_string(ch)) < 0 ) return;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void Pixie16::CaptureADCTrace(unsigned short modID, unsigned short ch){
|
||||||
|
|
||||||
|
retval = Pixie16AcquireADCTrace (modID);
|
||||||
|
if( CheckError("Pixie16AcquireADCTrace") < 0 ) return;
|
||||||
|
|
||||||
|
retval = Pixie16ReadSglChanADCTrace (ADCTrace, 8192, modID, ch);
|
||||||
|
if( CheckError("Pixie16ReadSglChanADCTrace") < 0 ) return;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void Pixie16::StartRun(bool listMode){
|
void Pixie16::StartRun(bool listMode){
|
||||||
|
|
||||||
unsigned short mode = NEW_RUN; //RESUME_RUN
|
unsigned short mode = NEW_RUN; //RESUME_RUN
|
||||||
|
@ -270,27 +289,26 @@ void Pixie16::StopRun(){
|
||||||
void Pixie16::ReadData(unsigned short modID){
|
void Pixie16::ReadData(unsigned short modID){
|
||||||
|
|
||||||
if( Pixie16CheckRunStatus(modID) == 1){
|
if( Pixie16CheckRunStatus(modID) == 1){
|
||||||
unsigned int oldnFIFOWords = nFIFOWords;
|
|
||||||
retval = Pixie16CheckExternalFIFOStatus (&nFIFOWords, modID);
|
retval = Pixie16CheckExternalFIFOStatus (&nFIFOWords, modID);
|
||||||
if( CheckError("Pixie16CheckExternalFIFOStatus") < 0 ) return;
|
if( CheckError("Pixie16CheckExternalFIFOStatus") < 0 ) return;
|
||||||
if(nFIFOWords *1.0 / EXTERNAL_FIFO_LENGTH > 0.2) {
|
///if(nFIFOWords *1.0 / EXTERNAL_FIFO_LENGTH > 0.2) {
|
||||||
//if(nFIFOWords > 0) {
|
if(nFIFOWords > 0) {
|
||||||
printf("\033[1;31m####### READ DATA \033[m: number of word in module-%d FIFO : %d \n", modID, nFIFOWords);
|
printf("\033[1;31m####### READ DATA \033[m: number of word in module-%d FIFO : %d \n", modID, nFIFOWords);
|
||||||
if( ExtFIFO_Data != NULL ) delete ExtFIFO_Data;
|
if( ExtFIFO_Data != NULL ) delete ExtFIFO_Data;
|
||||||
ExtFIFO_Data = new unsigned int [nFIFOWords];
|
ExtFIFO_Data = new unsigned int [nFIFOWords];
|
||||||
retval = Pixie16ReadDataFromExternalFIFO(ExtFIFO_Data, nFIFOWords, modID);
|
retval = Pixie16ReadDataFromExternalFIFO(ExtFIFO_Data, nFIFOWords, modID);
|
||||||
CheckError("Pixie16ReadDataFromExternalFIFO");
|
CheckError("Pixie16ReadDataFromExternalFIFO");
|
||||||
nextWord = nextWord - oldnFIFOWords;
|
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
printf("Pixie16 is not running.\n");
|
printf("Pixie16 is not running.\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Pixie16::ProcessSingleData(){
|
bool Pixie16::ProcessSingleData(){
|
||||||
|
|
||||||
|
bool breakProcessLoopFlag = false;
|
||||||
|
|
||||||
if( nextWord < nFIFOWords ){
|
if( nextWord < nFIFOWords ){
|
||||||
|
|
||||||
data->ch = ExtFIFO_Data[nextWord] & 0xF ;
|
data->ch = ExtFIFO_Data[nextWord] & 0xF ;
|
||||||
data->slot = (ExtFIFO_Data[nextWord] >> 4) & 0xF;
|
data->slot = (ExtFIFO_Data[nextWord] >> 4) & 0xF;
|
||||||
data->crate = (ExtFIFO_Data[nextWord] >> 8) & 0xF;
|
data->crate = (ExtFIFO_Data[nextWord] >> 8) & 0xF;
|
||||||
|
@ -299,7 +317,7 @@ void Pixie16::ProcessSingleData(){
|
||||||
data->pileup = ExtFIFO_Data[nextWord] >> 31 ;
|
data->pileup = ExtFIFO_Data[nextWord] >> 31 ;
|
||||||
data->eventID ++;
|
data->eventID ++;
|
||||||
|
|
||||||
if( nextWord + data->eventLength < nFIFOWords ){
|
if( nextWord + data->eventLength <= nFIFOWords ){
|
||||||
|
|
||||||
data->time = ((unsigned long long)(ExtFIFO_Data[nextWord+2] & 0xFFFF) << 32) + ExtFIFO_Data[nextWord+1];
|
data->time = ((unsigned long long)(ExtFIFO_Data[nextWord+2] & 0xFFFF) << 32) + ExtFIFO_Data[nextWord+1];
|
||||||
data->cfd = ExtFIFO_Data[nextWord + 2] >> 16 ;
|
data->cfd = ExtFIFO_Data[nextWord + 2] >> 16 ;
|
||||||
|
@ -312,8 +330,6 @@ void Pixie16::ProcessSingleData(){
|
||||||
data->trace[2*i+0] = ExtFIFO_Data[nextWord + data->headerLength + i] & 0xFFFF ;
|
data->trace[2*i+0] = ExtFIFO_Data[nextWord + data->headerLength + i] & 0xFFFF ;
|
||||||
data->trace[2*i+1] = (ExtFIFO_Data[nextWord + data->headerLength + i] >> 16 ) & 0xFFFF ;
|
data->trace[2*i+1] = (ExtFIFO_Data[nextWord + data->headerLength + i] >> 16 ) & 0xFFFF ;
|
||||||
}
|
}
|
||||||
}else{
|
|
||||||
data->ClearTrace();
|
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
data->time = 0;
|
data->time = 0;
|
||||||
|
@ -324,51 +340,13 @@ void Pixie16::ProcessSingleData(){
|
||||||
}
|
}
|
||||||
|
|
||||||
nextWord += data->eventLength ;
|
nextWord += data->eventLength ;
|
||||||
|
|
||||||
|
if( nextWord == nFIFOWords ) {nextWord = 0; breakProcessLoopFlag = true;}
|
||||||
|
if( nextWord > nFIFOWords ) {nextWord = nextWord - nFIFOWords; breakProcessLoopFlag = true;}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
return breakProcessLoopFlag ;
|
||||||
|
|
||||||
void Pixie16::ProcessData(int verbose){
|
|
||||||
|
|
||||||
if( verbose >= 2 ) for( unsigned int i = 0; i < nFIFOWords; i++) printf("%5d|%X|\n", i, ExtFIFO_Data[nextWord+i]);
|
|
||||||
|
|
||||||
while( nextWord < nFIFOWords ){
|
|
||||||
ProcessSingleData();
|
|
||||||
if( verbose >= 1 ) data->Print(0);
|
|
||||||
if( verbose >= 3 ) data->Print(1); /// print trace
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void Pixie16::GetTrace(unsigned short modID, unsigned short ch){
|
|
||||||
|
|
||||||
unsigned short ADCTrace[8192];
|
|
||||||
retval = Pixie16AcquireADCTrace (modID);
|
|
||||||
if( CheckError("Pixie16AcquireADCTrace") < 0 ) return;
|
|
||||||
|
|
||||||
retval = Pixie16ReadSglChanADCTrace (ADCTrace, 8192, modID, ch);
|
|
||||||
if( CheckError("Pixie16ReadSglChanADCTrace") < 0 ) return;
|
|
||||||
|
|
||||||
for( int i = 0; i < 8192 ; i++){
|
|
||||||
printf("%4d, %d \n", i, ADCTrace[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Pixie16::GetBaseLines(unsigned short modID, unsigned short ch){
|
|
||||||
|
|
||||||
retval = Pixie16AcquireBaselines(modID);
|
|
||||||
if( CheckError("Pixie16AcquireBaselines") < 0 ) return;
|
|
||||||
|
|
||||||
|
|
||||||
double Baselines[3640], TimeStamps[3640];
|
|
||||||
|
|
||||||
retval = Pixie16ReadSglChanBaselines(Baselines, TimeStamps, 3640, modID, ch);
|
|
||||||
if( CheckError("Pixie16ReadSglChanBaselines") < 0 ) return;
|
|
||||||
|
|
||||||
for( int i = 0; i < 3640; i++){
|
|
||||||
printf("%4d, %.4f, %.4f \n", i, Baselines[i], TimeStamps[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -68,28 +68,14 @@ private:
|
||||||
unsigned int * ExtFIFO_Data;
|
unsigned int * ExtFIFO_Data;
|
||||||
unsigned int * Statistics;
|
unsigned int * Statistics;
|
||||||
|
|
||||||
|
double Baselines[3640], TimeStamps[3640]; ///for baseline
|
||||||
|
unsigned short ADCTrace[8192];
|
||||||
|
|
||||||
DataBlock * data;
|
DataBlock * data;
|
||||||
unsigned int nextWord;
|
unsigned int nextWord;
|
||||||
|
|
||||||
std::ofstream outFile;
|
std::ofstream outFile;
|
||||||
|
|
||||||
/***
|
|
||||||
struct channelSetting{
|
|
||||||
double trigger_risetime;
|
|
||||||
double trigger_flattop;
|
|
||||||
double trigger_threshold;
|
|
||||||
double energy_risetime;
|
|
||||||
double energy_flattop;
|
|
||||||
double tau;
|
|
||||||
double trace_length;
|
|
||||||
double trace_delay;
|
|
||||||
double V_offset;
|
|
||||||
double XDT;
|
|
||||||
double baseline_percent;
|
|
||||||
double energy_minumum; //EMIN
|
|
||||||
double baseline_cut; //BLCUT
|
|
||||||
};**/
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Pixie16();
|
Pixie16();
|
||||||
|
@ -108,6 +94,14 @@ public:
|
||||||
void BootDigitizers();
|
void BootDigitizers();
|
||||||
|
|
||||||
void AdjustOffset();
|
void AdjustOffset();
|
||||||
|
void CaptureBaseLine(unsigned short modID, unsigned short ch);
|
||||||
|
int GetBaslineLength() {return 3640;}
|
||||||
|
double * GetBasline() {return Baselines;}
|
||||||
|
double * GetBaselineTimestamp() {return TimeStamps;}
|
||||||
|
|
||||||
|
void CaptureADCTrace(unsigned short modID, unsigned short ch);
|
||||||
|
int GetADCTraceLength() {return 8192;}
|
||||||
|
unsigned short * GetADCTrace() {return ADCTrace;}
|
||||||
|
|
||||||
///========================= Setting
|
///========================= Setting
|
||||||
|
|
||||||
|
@ -174,26 +168,19 @@ public:
|
||||||
double GetRealTime(unsigned short modID);
|
double GetRealTime(unsigned short modID);
|
||||||
void PrintStatistics(unsigned short modID);
|
void PrintStatistics(unsigned short modID);
|
||||||
|
|
||||||
void GetTrace(unsigned short modID, unsigned short ch);
|
|
||||||
void GetBaseLines(unsigned short modID, unsigned short ch);
|
|
||||||
|
|
||||||
void ReadData(unsigned short modID);
|
void ReadData(unsigned short modID);
|
||||||
|
|
||||||
void PrintExtFIFOData(int a) { printf("%5d-%5d | %08X %08X %08X %08X \n", a, a+3, ExtFIFO_Data[a], ExtFIFO_Data[a+1], ExtFIFO_Data[a+2], ExtFIFO_Data[a+3]);}
|
|
||||||
unsigned int GetnFIFOWords() {return nFIFOWords;}
|
unsigned int GetnFIFOWords() {return nFIFOWords;}
|
||||||
unsigned int GetNextWord() {return nextWord;}
|
unsigned int GetNextWord() {return nextWord;}
|
||||||
DataBlock * GetData() {return data;}
|
DataBlock * GetData() {return data;}
|
||||||
void ProcessSingleData();
|
bool ProcessSingleData();
|
||||||
void ProcessData(int verbose = 0);
|
|
||||||
|
|
||||||
void OpenFile(std::string fileName, bool append);
|
void OpenFile(std::string fileName, bool append);
|
||||||
void SaveData();
|
void SaveData();
|
||||||
void CloseFile();
|
void CloseFile();
|
||||||
|
|
||||||
|
|
||||||
//void SaveData(char * fileName, unsigned short isEndOfRun);
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
15
evtReader.h
15
evtReader.h
|
@ -14,7 +14,7 @@
|
||||||
#include "TString.h"
|
#include "TString.h"
|
||||||
#include "TBenchmark.h"
|
#include "TBenchmark.h"
|
||||||
|
|
||||||
#include "DataBlock.h"
|
#include "../armory/DataBlock.h"
|
||||||
|
|
||||||
#define MAX_CRATES 2
|
#define MAX_CRATES 2
|
||||||
#define MAX_BOARDS_PER_CRATE 13
|
#define MAX_BOARDS_PER_CRATE 13
|
||||||
|
@ -37,7 +37,7 @@ class evtReader{
|
||||||
long int nBlock;
|
long int nBlock;
|
||||||
|
|
||||||
unsigned int extraHeader[14];
|
unsigned int extraHeader[14];
|
||||||
unsigned int traceBlock[4000];
|
unsigned int traceBlock[MAX_TRACE_LENGHT/2];
|
||||||
|
|
||||||
TBenchmark gClock;
|
TBenchmark gClock;
|
||||||
|
|
||||||
|
@ -119,6 +119,8 @@ void evtReader::OpenFile(TString inFileName){
|
||||||
|
|
||||||
gClock.Reset();
|
gClock.Reset();
|
||||||
gClock.Start("timer");
|
gClock.Start("timer");
|
||||||
|
|
||||||
|
isOpened = true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -135,7 +137,7 @@ bool evtReader::IsEndOfFile() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int evtReader::ReadBlock(int opt = 0){
|
int evtReader::ReadBlock(int opt){
|
||||||
|
|
||||||
if( feof(inFile) ) return -1;
|
if( feof(inFile) ) return -1;
|
||||||
if( endOfFile ) return -1;
|
if( endOfFile ) return -1;
|
||||||
|
@ -164,10 +166,8 @@ int evtReader::ReadBlock(int opt = 0){
|
||||||
data->trace_length = (header[3] >> 16) & 0x7FFF;
|
data->trace_length = (header[3] >> 16) & 0x7FFF;
|
||||||
data->trace_out_of_range = header[3] >> 31;
|
data->trace_out_of_range = header[3] >> 31;
|
||||||
|
|
||||||
//data->id = data->crate*MAX_BOARDS_PER_CRATE*MAX_CHANNELS_PER_BOARD + (data->slot-BOARD_START)*MAX_CHANNELS_PER_BOARD + data->ch;
|
|
||||||
//data->detID = mapping[data->id];
|
|
||||||
|
|
||||||
data->ClearQDC();
|
data->ClearQDC();
|
||||||
|
data->ClearTrace();
|
||||||
|
|
||||||
///======== read QDCsum
|
///======== read QDCsum
|
||||||
if( data->headerLength >= 4 ){
|
if( data->headerLength >= 4 ){
|
||||||
|
@ -202,6 +202,7 @@ int evtReader::ReadBlock(int opt = 0){
|
||||||
}
|
}
|
||||||
|
|
||||||
///make QDC by trace
|
///make QDC by trace
|
||||||
|
/**
|
||||||
if( data->headerLength == 4 || data->headerLength == 8 ) {
|
if( data->headerLength == 4 || data->headerLength == 8 ) {
|
||||||
for( int i = 0; i < 8; i++){ data->QDCsum[i] = 0;}
|
for( int i = 0; i < 8; i++){ data->QDCsum[i] = 0;}
|
||||||
for( int i = 0; i < data->trace_length; i++){
|
for( int i = 0; i < data->trace_length; i++){
|
||||||
|
@ -214,7 +215,7 @@ int evtReader::ReadBlock(int opt = 0){
|
||||||
if( 160 <= i && i < 175 ) data->QDCsum[6] += data->trace[i];
|
if( 160 <= i && i < 175 ) data->QDCsum[6] += data->trace[i];
|
||||||
if( 175 <= i && i < 200 ) data->QDCsum[7] += data->trace[i];
|
if( 175 <= i && i < 200 ) data->QDCsum[7] += data->trace[i];
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -308,7 +308,7 @@ bool execute_list_mode_run(const configuration& cfg, const double& runtime_in_se
|
||||||
|
|
||||||
std::vector<std::ofstream*> output_streams(cfg.num_modules());
|
std::vector<std::ofstream*> output_streams(cfg.num_modules());
|
||||||
for (unsigned short i = 0; i < cfg.num_modules(); i++) {
|
for (unsigned short i = 0; i < cfg.num_modules(); i++) {
|
||||||
output_streams[i] = new std::ofstream(generate_filename(i, "list-mode", "bin"),
|
output_streams[i] = new std::ofstream(generate_filename(i, "list-mode", "evt"),
|
||||||
std::ios::out | std::ios::binary);
|
std::ios::out | std::ios::binary);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
50
test.cpp
50
test.cpp
|
@ -77,7 +77,8 @@ int main(int argc, char *argv[]){
|
||||||
TH1F * hch = new TH1F("hch", "channel", 16, 0, 16);
|
TH1F * hch = new TH1F("hch", "channel", 16, 0, 16);
|
||||||
TH1F * hE = new TH1F("hE", "energy", 400, 0, 30000);
|
TH1F * hE = new TH1F("hE", "energy", 400, 0, 30000);
|
||||||
TGraph * gTrace = new TGraph();
|
TGraph * gTrace = new TGraph();
|
||||||
gTrace->GetXaxis()->SetTitle("time [ch, 1 ch = 4 ns]");
|
gTrace->GetXaxis()->SetTitle("time [ch]");
|
||||||
|
|
||||||
|
|
||||||
//pixie->SetDigitizerPresetRunTime(100000, 0);
|
//pixie->SetDigitizerPresetRunTime(100000, 0);
|
||||||
//pixie->SetDigitizerSynchWait(0, 0); // not simultaneously
|
//pixie->SetDigitizerSynchWait(0, 0); // not simultaneously
|
||||||
|
@ -94,7 +95,7 @@ int main(int argc, char *argv[]){
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int ch = 6;
|
int ch = 6;
|
||||||
double time = 0.5; ///sec
|
double time = 2.0; ///sec
|
||||||
|
|
||||||
/*
|
/*
|
||||||
for( int i = 0; i < 16; i++){
|
for( int i = 0; i < 16; i++){
|
||||||
|
@ -104,26 +105,47 @@ int main(int argc, char *argv[]){
|
||||||
pixie->SetChannelVOffset(0, 0, i);
|
pixie->SetChannelVOffset(0, 0, i);
|
||||||
}
|
}
|
||||||
* */
|
* */
|
||||||
|
//pixie->AdjustOffset();
|
||||||
|
|
||||||
|
|
||||||
//pixie->SetChannelEnergyRiseTime(2, 0, ch);
|
//pixie->SetChannelEnergyRiseTime(2, 0, ch);
|
||||||
pixie->SetChannelTriggerThreshold(300, 0, ch);
|
//pixie->SetChannelTriggerThreshold(300, 0, ch);
|
||||||
//pixie->SetChannelEnergyTau(50, 0, ch);
|
//pixie->SetChannelEnergyTau(50, 0, ch);
|
||||||
//pixie->SetChannelOnOff(true, 0, ch);
|
//pixie->SetChannelOnOff(true, 0, ch);
|
||||||
//pixie->SetChannelPositivePolarity(true, 0, ch);
|
//pixie->SetChannelPositivePolarity(true, 0, ch);
|
||||||
//pixie->SetChannelTraceOnOff(true, 0, ch);
|
//pixie->SetChannelTraceOnOff(true, 0, ch);
|
||||||
pixie->SetChannelVOffset(-1.0, 0, ch);
|
//pixie->SetChannelBaseLinePrecent(10, 0, ch);
|
||||||
pixie->SetChannelTraceLenght(10, 0, ch);
|
//pixie->SetChannelVOffset(0.0, 0, ch);
|
||||||
pixie->SetChannelTraceDelay(2, 0, ch);
|
//pixie->SetChannelTraceLenght(10, 0, ch);
|
||||||
pixie->SaveSettings("test_ryan.set");
|
//pixie->SetChannelTraceDelay(2, 0, ch);
|
||||||
|
//pixie->SaveSettings("test_ryan.set");
|
||||||
|
|
||||||
|
|
||||||
pixie->PrintChannelAllSettings(0, ch);
|
pixie->PrintChannelAllSettings(0, ch);
|
||||||
|
|
||||||
pixie->PrintChannelsMainSettings(0);
|
pixie->PrintChannelsMainSettings(0);
|
||||||
|
|
||||||
printf("start run for %f sec\n", time);
|
|
||||||
|
|
||||||
//pixie->AdjustOffset();
|
//pixie->CaptureADCTrace(0, ch);
|
||||||
|
//unsigned short * haha = pixie->GetADCTrace();
|
||||||
|
//for( int i = 0 ; i < pixie->GetADCTraceLength(); i++){
|
||||||
|
// gTrace->SetPoint(i, i, haha[i]);
|
||||||
|
//}
|
||||||
|
//canvas->cd(3); gTrace->Draw("APL");
|
||||||
|
|
||||||
|
|
||||||
|
//pixie->CaptureBaseLine(0, ch);
|
||||||
|
//double * baseline = pixie->GetBasline();
|
||||||
|
//double * baselineTime = pixie->GetBaselineTimestamp();
|
||||||
|
//for( int i = 0 ; i < pixie->GetBaslineLength(); i++){
|
||||||
|
// gTrace->SetPoint(i, baselineTime[i]*1000, baseline[i]);
|
||||||
|
// //printf("%5d | %f, %f \n", i, baselineTime[i]*1000, baseline[i]);
|
||||||
|
//}
|
||||||
|
//canvas->cd(3); gTrace->Draw("APL");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
printf("start run for %f sec\n", time);
|
||||||
|
|
||||||
uint32_t StartTime = get_time(), CurrentTime = get_time();
|
uint32_t StartTime = get_time(), CurrentTime = get_time();
|
||||||
pixie->StartRun(1);
|
pixie->StartRun(1);
|
||||||
|
@ -136,19 +158,18 @@ int main(int argc, char *argv[]){
|
||||||
|
|
||||||
while( pixie->GetNextWord() < pixie->GetnFIFOWords() ){
|
while( pixie->GetNextWord() < pixie->GetnFIFOWords() ){
|
||||||
|
|
||||||
//for( int i = pixie->GetNextWord(); i < pixie->GetNextWord() + 314 ; i++) pixie->PrintExtFIFOData(i);
|
bool breakFlag = pixie->ProcessSingleData();
|
||||||
pixie->ProcessSingleData();
|
|
||||||
//data->Print(0);
|
|
||||||
//printf("--------------next word : %d (%d) | event lenght : %d \n", pixie->GetNextWord(), pixie->GetnFIFOWords(), data->eventLength);
|
|
||||||
|
|
||||||
|
data->Print(0);
|
||||||
|
printf("--------------next word : %d (%d) | event lenght : %d \n", pixie->GetNextWord(), pixie->GetnFIFOWords(), data->eventLength);
|
||||||
|
|
||||||
hch->Fill( data->ch);
|
hch->Fill( data->ch);
|
||||||
hE->Fill( data->energy );
|
hE->Fill( data->energy );
|
||||||
if( data->trace_length > 0 ) {
|
if( data->trace_length > 0 ) {
|
||||||
for( int i = 0 ; i < data->trace_length; i++){
|
for( int i = 0 ; i < data->trace_length; i++){
|
||||||
gTrace->SetPoint(i, i, data->trace[i]);
|
gTrace->SetPoint(i, i, data->trace[i]);
|
||||||
//if( i % 200 == 0 ) printf("%i, %d \n", i, data->trace[i]);
|
|
||||||
}
|
}
|
||||||
|
gTrace->GetYaxis()->SetRangeUser(0, 5000);
|
||||||
canvas->cd(3); gTrace->Draw("APL");
|
canvas->cd(3); gTrace->Draw("APL");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,6 +179,7 @@ int main(int argc, char *argv[]){
|
||||||
canvas->Update();
|
canvas->Update();
|
||||||
gSystem->ProcessEvents();
|
gSystem->ProcessEvents();
|
||||||
|
|
||||||
|
if( breakFlag ) break;
|
||||||
}
|
}
|
||||||
|
|
||||||
CurrentTime = get_time();
|
CurrentTime = get_time();
|
||||||
|
|
|
@ -98,7 +98,7 @@
|
||||||
16544,
|
16544,
|
||||||
16544,
|
16544,
|
||||||
16544,
|
16544,
|
||||||
16544,
|
16548,
|
||||||
16804,
|
16804,
|
||||||
16544,
|
16544,
|
||||||
16544,
|
16544,
|
||||||
|
@ -423,7 +423,7 @@
|
||||||
32768,
|
32768,
|
||||||
32768,
|
32768,
|
||||||
32768,
|
32768,
|
||||||
10922,
|
32768,
|
||||||
32768,
|
32768,
|
||||||
32768,
|
32768,
|
||||||
32768,
|
32768,
|
||||||
|
@ -1016,7 +1016,7 @@
|
||||||
"ChanNum": 0,
|
"ChanNum": 0,
|
||||||
"CoincPattern": 0,
|
"CoincPattern": 0,
|
||||||
"CoincWait": 0,
|
"CoincWait": 0,
|
||||||
"ControlTask": 5,
|
"ControlTask": 0,
|
||||||
"CrateID": 0,
|
"CrateID": 0,
|
||||||
"FIFOLength": 8188,
|
"FIFOLength": 8188,
|
||||||
"FastFilterRange": 0,
|
"FastFilterRange": 0,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user