bug fix on EncoreChMap

This commit is contained in:
Ryan Tang 2024-03-04 12:22:23 -05:00
parent cc79c7ea3c
commit 8cb3908043
5 changed files with 27 additions and 16 deletions

View File

@ -427,7 +427,7 @@ int main(int argc, char **argv) {
for( int i = 0; i < nGroup; i++){
delete tsReader[i];
}
delete tsReader;
delete [] tsReader;
return 0;
}

View File

@ -51,6 +51,8 @@ class FSUReader{
}
}
//void SaveAsCAENCoMPASSFormat();
private:
FILE * inFile;
@ -218,6 +220,7 @@ inline int FSUReader::ReadNextBlock(bool traceON, int verbose, uShort saveData){
}
data->DecodeBuffer(buffer, aggSize, !traceON, verbose); // data will own the buffer
printf(" word Index = %u | filePos : %u | ", data->GetWordIndex(), filePos);
}else if( (header & 0xF ) == 0x8 ) { /// dual channel header
@ -234,10 +237,13 @@ inline int FSUReader::ReadNextBlock(bool traceON, int verbose, uShort saveData){
return -20;
}
unsigned int eventCout = 0;
for( int ch = 0; ch < data->GetNChannel(); ch++){
if( data->NumEventsDecoded[ch] == 0 ) continue;
hitCount += data->NumEventsDecoded[ch];
eventCout += data->NumEventsDecoded[ch];
if( saveData ){
int start = data->GetDataIndex(ch) - data->NumEventsDecoded[ch] + 1;
@ -272,10 +278,14 @@ inline int FSUReader::ReadNextBlock(bool traceON, int verbose, uShort saveData){
}
}
printf(" event cout : %u\n", eventCout);
data->ClearTriggerRate();
data->ClearNumEventsDecoded();
data->ClearBuffer(); // this will clear the buffer.
//
return 0;
}
@ -430,3 +440,5 @@ inline std::string FSUReader::SaveHit2NewFile(std::string saveFolder){
return outFileName;
}

View File

@ -124,7 +124,7 @@ int Digitizer::OpenDigitizer(int boardID, int portID, bool program, bool verbose
regChannelMask = pow(2, NumInputCh)-1;
switch(BoardInfo.Model){
case CAEN_DGTZ_DT5730: tick2ns = 2.0; NCoupledCh = NumInputCh/2; ModelType = ModelTypeCode::DT; break; ///ns -> 500 MSamples/s
case CAEN_DGTZ_DT5720: tick2ns = 4.0; NCoupledCh = NumInputCh/2; ModelType = ModelTypeCode::DT; break; ///ns -> 250 MSamples/s
case CAEN_DGTZ_DT5725: tick2ns = 4.0; NCoupledCh = NumInputCh/2; ModelType = ModelTypeCode::DT; break; ///ns -> 250 MSamples/s
case CAEN_DGTZ_V1730: tick2ns = 2.0; NCoupledCh = NumInputCh/2; ModelType = ModelTypeCode::VME; break; ///ns -> 500 MSamples/s
case CAEN_DGTZ_V1725: tick2ns = 4.0; NCoupledCh = NumInputCh/2; ModelType = ModelTypeCode::VME; break; ///ns -> 250 MSamples/s
case CAEN_DGTZ_V1740: {

2
Hit.h
View File

@ -42,7 +42,7 @@ public:
}
}
// Define operator< for sorting
// Define operator< for sorting
bool operator<(const Hit& other) const {
return timestamp < other.timestamp;
}

View File

@ -4,16 +4,15 @@
#include "Analyser.h"
#include "Isotope.h"
int SN2Bd(int sn){
switch (sn) {
case 278 : return 0; break;
case 45 : return 1; break;
case 370 : return 2; break;
};
return 0;
};
#include <map>
namespace ChMap{
namespace EncoreChMap{
const std::map<unsigned short, int> SN2Bd = {
{278, 0},
{45, 1},
{370, 2}
};
const int mapping[3][16] = {
// 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
@ -126,22 +125,22 @@ inline void Encore::UpdateHistograms(){
double sum[17] = {0};
for( int k = 0; k < (int) event.size(); k++ ){
int bd = SN2Bd(event[k].sn);
int bd = EncoreChMap::SN2Bd.at(event[k].sn);
int ch = event[k].ch;
int ID = ChMap::mapping[bd][ch];
int ID = EncoreChMap::mapping[bd][ch];
if( ID < 0 ) continue;
double eC = event[k].energy;
if( 0 <= ID && ID < 100 ) {
eC *= ChMap::corr[ch][bd];
eC *= EncoreChMap::corr[ch][bd];
hLeft->Fill(ID, eC);
sum[ID] += eC;
}
if( 100 <= ID && ID < 200 ) {
eC *= ChMap::corr[ch][bd];
eC *= EncoreChMap::corr[ch][bd];
hRight->Fill(ID-100, eC );
sum[ID-100] += eC ;
}