Move EventBuilder to the DAQ code. in progress of the Webbase Simulation code

This commit is contained in:
Ryan Tang 2024-03-20 18:56:49 -04:00
parent e3e9fddd2c
commit 806a7124a4
11 changed files with 300 additions and 1051 deletions

View File

@ -124,7 +124,11 @@
"script_multi.C": "cpp", "script_multi.C": "cpp",
"Isotope.C": "cpp", "Isotope.C": "cpp",
"classisotope.h": "c", "classisotope.h": "c",
"knockoutSim.C": "cpp" "knockoutSim.C": "cpp",
"test.C": "cpp",
"SimTransfer.C": "cpp",
"httpaccess.C": "cpp",
"httpcontrol.C": "cpp"
}, },
"better-comments.multilineComments": true, "better-comments.multilineComments": true,

View File

@ -1,351 +0,0 @@
#include "SolReader.h"
#include <cstdio>
#include <cstdlib>
#include "TFile.h"
#include "TTree.h"
#include "TMath.h"
#include "TString.h"
#include "TMacro.h"
//#include "TClonesArray.h" // plan to save trace as TVector with TClonesArray
//#include "TVector.h"
#define MAX_MULTI 64
#define MAX_TRACE_LEN 2500
#define tick2ns 8 // 1 tick = 8 ns
SolReader ** reader;
Hit ** hit;
std::vector<std::vector<int>> idList;
unsigned long totFileSize = 0;
unsigned long processedFileSize = 0;
std::vector<int> activeFileID;
std::vector<int> groupIndex;
std::vector<std::vector<int>> group; // group[i][j], i = group ID, j = group member)
void findEarliestTime(int &fileID, int &groupID){
unsigned long firstTime = 0;
for( int i = 0; i < (int) activeFileID.size(); i++){
int id = activeFileID[i];
if( i == 0 ) {
firstTime = hit[id]->timestamp;
fileID = id;
groupID = i;
//printf("%d | %d %lu %d | %d \n", id, reader[id]->GetBlockID(), hit[id]->timestamp, hit[id]->channel, (int) activeFileID.size());
continue;
}
if( hit[id]->timestamp <= firstTime) {
firstTime = hit[id]->timestamp;
fileID = id;
groupID = i;
//printf("%d | %d %lu %d | %d \n", id, reader[id]->GetBlockID(), hit[id]->timestamp, hit[id]->channel, (int) activeFileID.size());
}
}
}
unsigned long long evID = 0;
unsigned int multi = 0;
unsigned short bd[MAX_MULTI] = {0};
unsigned short sn[MAX_MULTI] = {0};
unsigned short ch[MAX_MULTI] = {0};
unsigned short e[MAX_MULTI] = {0};
unsigned short e2[MAX_MULTI] = {0}; //for PSD energy short
unsigned long long e_t[MAX_MULTI] = {0};
unsigned short e_f[MAX_MULTI] = {0};
unsigned short lowFlag[MAX_MULTI] = {0};
unsigned short highFlag[MAX_MULTI] = {0};
int traceLen[MAX_MULTI] = {0};
int trace[MAX_MULTI][MAX_TRACE_LEN] = {0};
void fillData(int &fileID, const bool &saveTrace){
bd[multi] = idList[fileID][1];
sn[multi] = idList[fileID][3];
ch[multi] = hit[fileID]->channel;
e[multi] = hit[fileID]->energy;
e2[multi] = hit[fileID]->energy_short;
e_t[multi] = hit[fileID]->timestamp;
e_f[multi] = hit[fileID]->fine_timestamp;
lowFlag[multi] = hit[fileID]->flags_low_priority;
highFlag[multi] = hit[fileID]->flags_high_priority;
if( saveTrace ){
traceLen[multi] = hit[fileID]->traceLenght;
for( int i = 0; i < TMath::Min(traceLen[multi], MAX_TRACE_LEN); i++){
trace[multi][i] = hit[fileID]->analog_probes[0][i];
}
}
multi++;
reader[fileID]->ReadNextBlock();
}
void printEvent(){
printf("==================== evID : %llu\n", evID);
for( int i = 0; i < multi; i++){
printf(" %2d | %d %d | %llu %d \n", i, bd[i], ch[i], e_t[i], e[i] );
}
printf("==========================================\n");
}
//^##################################################################################
int main(int argc, char ** argv){
printf("=======================================================\n");
printf("=== SOLARIS Event Builder sol --> root ===\n");
printf("=======================================================\n");
if( argc <= 3){
printf("%s [outfile] [timeWindow] [saveTrace] [sol-1] [sol-2] ... \n", argv[0]);
printf(" outfile : output root file name\n");
printf(" timeWindow : number of tick, 1 tick = %d ns.\n", tick2ns);
printf(" saveTrace : 1 = save trace, 0 = no trace\n");
printf(" sol-X : the sol file(s)\n");
return -1;
}
// for( int i = 0; i < argc; i++){
// printf("%d | %s\n", i, argv[i]);
// }
TString outFileName = argv[1];
int timeWindow = abs(atoi(argv[2]));
const bool saveTrace = atoi(argv[3]);
const int nFile = argc - 4;
TString inFileName[nFile];
for( int i = 0 ; i < nFile ; i++){
inFileName[i] = argv[i+4];
}
//*======================================== setup reader
reader = new SolReader*[nFile];
hit = new Hit *[nFile];
for( int i = 0 ; i < nFile ; i++){
reader[i] = new SolReader(inFileName[i].Data());
hit[i] = reader[i]->hit; //TODO check is file open propertly
reader[i]->ReadNextBlock(); // read the first block
}
//*======================================== group files
idList.clear();
for( int i = 0; i < nFile; i++){
TString fn = inFileName[i];
int pos = fn.Last('/'); // path
fn.Remove(0, pos+1);
pos = fn.First('_'); // expName;
fn.Remove(0, pos+1);
pos = fn.First('_'); // runNum;
fn.Remove(0, pos+1);
pos = fn.First('_'); // digiID
TString f1 = fn;
int digiID = f1.Remove(pos).Atoi();
fn.Remove(0, pos+1);
pos = fn.Last('_'); // digi serial num
f1 = fn;
int digisn = f1.Remove(pos).Atoi();
fn.Remove(0, pos+1);
pos = fn.First('.'); // get the file id;
int indexID = fn.Remove(pos).Atoi();
int fileID = i;
std::vector<int> haha = {fileID, digiID, indexID, digisn};
idList.push_back(haha);
}
// sort by digiID
std::sort(idList.begin(), idList.end(), [](const std::vector<int>& a, const std::vector<int>& b){
if (a[1] == b[1]) {
return a[2] < b[2];
}
return a[1] < b[1];
});
group.clear(); // group[i][j], i is the group Index = digiID
int last_id = 0;
std::vector<int> kaka;
for( int i = 0; i < (int) idList.size() ; i++){
if( i == 0 ) {
kaka.clear();
last_id = idList[i][1];
kaka.push_back(idList[i][0]);
continue;
}
if( idList[i][1] != last_id ) {
last_id = idList[i][1];
group.push_back(kaka);
kaka.clear();
kaka.push_back(idList[i][0]);
}else{
kaka.push_back(idList[i][0]);
}
}
group.push_back(kaka);
printf(" out file : \033[1;33m%s\033[m\n", outFileName.Data());
printf(" Event building time window : %d tics = %d nsec \n", timeWindow, timeWindow*tick2ns);
printf(" Save Trace ? %s \n", saveTrace ? "Yes" : "No");
printf(" Number of input file : %d \n", nFile);
for( int i = 0; i < nFile; i++){
printf(" %2d| %5.1f MB| %s \n", i, reader[i]->GetFileSize()/1024./1024., inFileName[i].Data());
totFileSize += reader[i]->GetFileSize();
}
printf("------------------------------------\n");
for( int i = 0; i < (int) group.size(); i++){
printf("Group %d :", i);
for( int j = 0; j < (int) group[i].size(); j ++){
printf("%d, ", group[i][j]);
}
printf("\n");
}
printf("------------------------------------\n");
//*======================================== setup tree
TFile * outRootFile = new TFile(outFileName, "recreate");
outRootFile->cd();
TTree * tree = new TTree("tree", outFileName);
tree->Branch("evID", &evID, "event_ID/l");
tree->Branch("multi", &multi, "multi/i");
tree->Branch("bd", bd, "board[multi]/s");
tree->Branch("sn", sn, "sn[multi]/s");
tree->Branch("ch", ch, "channel[multi]/s");
tree->Branch("e", e, "energy[multi]/s");
tree->Branch("e2", e2, "energy_short[multi]/s");
tree->Branch("e_t", e_t, "timestamp[multi]/l");
tree->Branch("e_f", e_f, "fine_timestamp[multi]/s");
tree->Branch("lowFlag", lowFlag, "lowFlag[multi]/s");
tree->Branch("highFlag", highFlag, "highFlag[multi]/s");
if( saveTrace){
tree->Branch("tl", traceLen, "traceLen[multi]/I");
tree->Branch("trace", trace, Form("trace[multi][%d]/I", MAX_TRACE_LEN));
}
//*=========================================== build event
//@---- using file from group[i][0] first
//--- find earlist time among the files
activeFileID.clear();
groupIndex.clear(); //the index of each group
for(int i = 0; i < (int) group.size(); i++) {
groupIndex.push_back(0);
activeFileID.push_back(group[i][0]);
}
int fileID = 0;
int groupID = 0;
findEarliestTime(fileID, groupID);
fillData(fileID, saveTrace);
unsigned long firstTimeStamp = hit[fileID]->timestamp;
unsigned long lastTimeStamp = 0;
int last_precentage = 0;
while((activeFileID.size() > 0)){
findEarliestTime(fileID, groupID);
if( reader[fileID]->IsEndOfFile() ){
groupIndex[groupID] ++;
if( groupIndex[groupID] < (int) group[groupID].size() ){
activeFileID[groupID] = group[groupID][groupIndex[groupID]];
fileID = activeFileID[groupID];
}else{
activeFileID.erase(activeFileID.begin() + groupID);
}
}
if( hit[fileID]->timestamp - e_t[0] < timeWindow ){
fillData(fileID, saveTrace);
}else{
outRootFile->cd();
tree->Fill();
evID ++;
multi = 0;
fillData(fileID, saveTrace);
}
///========= calculate progress
processedFileSize = 0;
for( int p = 0; p < (int) group.size(); p ++){
for( int q = 0; q <= groupIndex[p]; q++){
if( groupIndex[p] < (int) group[p].size() ){
int id = group[p][q];
processedFileSize += reader[id]->GetFilePos();
}
}
}
double percentage = processedFileSize * 100/ totFileSize;
if( percentage >= last_precentage ) {
printf("Processed : %llu, %.0f%% | %lu/%lu | ", evID, percentage, processedFileSize, totFileSize);
for( int i = 0; i < (int) activeFileID.size(); i++) printf("%d, ", activeFileID[i]);
printf(" \n\033[A\r");
last_precentage = percentage + 1.0;
}
}; ///====== end of event building loop
processedFileSize = 0;
for( int p = 0; p < (int) group.size(); p ++){
for( int q = 0; q < (int) group[p].size(); q++){
int id = group[p][q];
processedFileSize += reader[id]->GetFilePos();
}
}
double percentage = processedFileSize * 100/ totFileSize;
printf("Processed : %llu, %.0f%% | %lu/%lu \n", evID, percentage, processedFileSize, totFileSize);
lastTimeStamp = hit[fileID]->timestamp;
//*=========================================== save file
outRootFile->cd();
tree->Fill();
evID ++;
tree->Write();
//*=========================================== Save timestamp as TMacro
TMacro timeStamp;
TString str;
str.Form("%lu", firstTimeStamp); timeStamp.AddLine( str.Data() );
str.Form("%lu", lastTimeStamp); timeStamp.AddLine( str.Data() );
timeStamp.Write("timeStamp");
unsigned int numBlock = 0;
for( int i = 0; i < nFile; i++){
//printf("%d | %8ld | %10u/%10u\n", i, reader[i]->GetBlockID() + 1, reader[i]->GetFilePos(), reader[i]->GetFileSize());
numBlock += reader[i]->GetBlockID() + 1;
}
printf("===================================== done. \n");
printf("Number of Block Scanned : %u\n", numBlock);
printf(" Number of Event Built : %lld\n", evID);
printf(" Output Root File Size : %.2f MB\n", outRootFile->GetSize()/1024./1024.);
printf(" first timestamp : %lu \n", firstTimeStamp);
printf(" last timestamp : %lu \n", lastTimeStamp);
unsigned long duration = lastTimeStamp - firstTimeStamp;
printf(" total duration : %lu = %.2f sec \n", duration, duration * tick2ns * 1.0 / 1e9 );
printf("===================================== end of summary. \n");
//^############## delete new
for( int i = 0; i < nFile; i++) delete reader[i];
delete [] reader;
outRootFile->Close();
return 0;
}

View File

@ -1,287 +0,0 @@
#ifndef HIT_H
#define HIT_H
#include <stdio.h>
#include <cstdlib>
#include <stdint.h>
#include <string>
#define MaxTraceLenght 8100
enum DataFormat{
ALL = 0x00,
OneTrace = 0x01,
NoTrace = 0x02,
Minimum = 0x03,
MiniWithFineTime = 0x04,
Raw = 0x0A,
};
namespace DPPType{
const std::string PHA = "DPP_PHA";
const std::string PSD = "DPP_PSD";
};
class Hit {
public:
unsigned short dataType;
std::string DPPType;
///============= for dpp-pha
uint8_t channel; // 6 bit
uint16_t energy; // 16 bit
uint16_t energy_short; // 16 bit, only for PSD
uint64_t timestamp; // 48 bit
uint16_t fine_timestamp; // 10 bit
uint16_t flags_low_priority; // 12 bit
uint16_t flags_high_priority; // 8 bit
size_t traceLenght; // 64 bit
uint8_t downSampling; // 8 bit
bool board_fail;
bool flush;
uint8_t analog_probes_type[2]; // 3 bit for PHA, 4 bit for PSD
uint8_t digital_probes_type[4]; // 4 bit for PHA, 5 bit for PSD
int32_t * analog_probes[2]; // 18 bit
uint8_t * digital_probes[4]; // 1 bit
uint16_t trigger_threashold; // 16 bit
size_t event_size; // 64 bit
uint32_t aggCounter; // 32 bit
///============= for raw
uint8_t * data;
size_t dataSize; /// number of byte of the data, size/8 = word [64 bits]
uint32_t n_events;
bool isTraceAllZero;
Hit(){
Init();
}
~Hit(){
ClearMemory();
}
void Init(){
DPPType = DPPType::PHA;
dataType = DataFormat::ALL;
channel = 0;
energy = 0;
energy_short = 0;
timestamp = 0;
fine_timestamp = 0;
downSampling = 0;
board_fail = false;
flush = false;
flags_low_priority = 0;
flags_high_priority = 0;
trigger_threashold = 0;
event_size = 0;
aggCounter = 0;
analog_probes[0] = NULL;
analog_probes[1] = NULL;
digital_probes[0] = NULL;
digital_probes[1] = NULL;
digital_probes[2] = NULL;
digital_probes[3] = NULL;
analog_probes_type[0] = 0xFF;
analog_probes_type[1] = 0xFF;
digital_probes_type[0] = 0xFF;
digital_probes_type[1] = 0xFF;
digital_probes_type[2] = 0xFF;
digital_probes_type[3] = 0xFF;
data = NULL;
isTraceAllZero = true; // indicate trace are all zero
}
void ClearMemory(){
if( data != NULL ) delete data;
if( analog_probes[0] != NULL) delete analog_probes[0];
if( analog_probes[1] != NULL) delete analog_probes[1];
if( digital_probes[0] != NULL) delete digital_probes[0];
if( digital_probes[1] != NULL) delete digital_probes[1];
if( digital_probes[2] != NULL) delete digital_probes[2];
if( digital_probes[3] != NULL) delete digital_probes[3];
isTraceAllZero = true;
}
void SetDataType(unsigned int type, std::string dppType){
dataType = type;
DPPType = dppType;
ClearMemory();
if( dataType == DataFormat::Raw){
data = new uint8_t[20*1024*1024];
}else{
analog_probes[0] = new int32_t[MaxTraceLenght];
analog_probes[1] = new int32_t[MaxTraceLenght];
digital_probes[0] = new uint8_t[MaxTraceLenght];
digital_probes[1] = new uint8_t[MaxTraceLenght];
digital_probes[2] = new uint8_t[MaxTraceLenght];
digital_probes[3] = new uint8_t[MaxTraceLenght];
isTraceAllZero = true;
}
}
void ClearTrace(){
if( isTraceAllZero ) return; // no need to clear again
for( int i = 0; i < MaxTraceLenght; i++){
analog_probes[0][i] = 0;
analog_probes[1][i] = 0;
digital_probes[0][i] = 0;
digital_probes[1][i] = 0;
digital_probes[2][i] = 0;
digital_probes[3][i] = 0;
}
isTraceAllZero = true;
}
void PrintEnergyTimeStamp(){
printf("ch: %2d, energy: %u, timestamp: %lu ch, traceLenght: %lu\n", channel, energy, timestamp, traceLenght);
}
std::string AnaProbeType(uint8_t probeType){
if( DPPType == DPPType::PHA){
switch(probeType){
case 0: return "ADC";
case 1: return "Time filter";
case 2: return "Energy filter";
default : return "none";
}
}else if (DPPType == DPPType::PSD){
switch(probeType){
case 0: return "ADC";
case 9: return "Baseline";
case 10: return "CFD";
default : return "none";
}
}else{
return "none";
}
}
std::string DigiProbeType(uint8_t probeType){
if( DPPType == DPPType::PHA){
switch(probeType){
case 0: return "Trigger";
case 1: return "Time filter armed";
case 2: return "Re-trigger guard";
case 3: return "Energy filter baseline freeze";
case 4: return "Energy filter peaking";
case 5: return "Energy filter peaking ready";
case 6: return "Energy filter pile-up guard";
case 7: return "Event pile-up";
case 8: return "ADC saturation";
case 9: return "ADC saturation protection";
case 10: return "Post-saturation event";
case 11: return "Energy filter saturation";
case 12: return "Signal inhibit";
default : return "none";
}
}else if (DPPType == DPPType::PSD){
switch(probeType){
case 0: return "Trigger";
case 1: return "CFD Filter Armed";
case 2: return "Re-trigger guard";
case 3: return "ADC Input Baseline freeze";
case 20: return "ADC Input OverThreshold";
case 21: return "Charge Ready";
case 22: return "Long Gate";
case 7: return "Pile-Up Trig.";
case 24: return "Short Gate";
case 25: return "Energy Saturation";
case 26: return "Charge over-range";
case 27: return "ADC Input Neg. OverThreshold";
default : return "none";
}
}else{
return "none";
}
}
std::string HighPriority(uint16_t prio){
std::string output;
bool pileup = prio & 0x1;
//bool pileupGuard = (prio >> 1) & 0x1;
//bool eventSaturated = (prio >> 2) & 0x1;
//bool postSatEvent = (prio >> 3) & 0x1;
//bool trapSatEvent = (prio >> 4) & 0x1;
//bool SCA_Event = (prio >> 5) & 0x1;
output = std::string("Pile-up: ") + (pileup ? "Yes" : "No");
return output;
}
//TODO LowPriority
void PrintAll(){
switch(dataType){
case DataFormat::ALL : printf("============= Type : ALL\n"); break;
case DataFormat::OneTrace : printf("============= Type : OneTrace\n"); break;
case DataFormat::NoTrace : printf("============= Type : NoTrace\n"); break;
case DataFormat::MiniWithFineTime : printf("============= Type : Min with FineTimestamp\n"); break;
case DataFormat::Minimum : printf("============= Type : Minimum\n"); break;
case DataFormat::Raw : printf("============= Type : Raw\n"); return; break;
default : return;
}
printf("ch : %2d (0x%02X), fail: %d, flush: %d\n", channel, channel, board_fail, flush);
if( DPPType == DPPType::PHA ) printf("energy: %u, timestamp: %lu, fine_timestamp: %u \n", energy, timestamp, fine_timestamp);
if( DPPType == DPPType::PSD ) printf("energy: %u, energy_S : %u, timestamp: %lu, fine_timestamp: %u \n", energy, energy_short, timestamp, fine_timestamp);
printf("flag (high): 0x%02X, (low): 0x%03X, traceLength: %lu\n", flags_high_priority, flags_low_priority, traceLenght);
printf("Agg counter : %u, trigger Thr.: %u, downSampling: %u \n", aggCounter, trigger_threashold, downSampling);
printf("AnaProbe Type: %s(%u), %s(%u)\n", AnaProbeType(analog_probes_type[0]).c_str(), analog_probes_type[0],
AnaProbeType(analog_probes_type[1]).c_str(), analog_probes_type[1]);
printf("DigProbe Type: %s(%u), %s(%u), %s(%u), %s(%u)\n", DigiProbeType(digital_probes_type[0]).c_str(), digital_probes_type[0],
DigiProbeType(digital_probes_type[1]).c_str(), digital_probes_type[1],
DigiProbeType(digital_probes_type[2]).c_str(), digital_probes_type[2],
DigiProbeType(digital_probes_type[3]).c_str(), digital_probes_type[3]);
}
void PrintTrace(unsigned short ID){
for(unsigned short i = 0; i < (unsigned short)traceLenght; i++){
if( ID == 0 ) printf("%4d| %6d\n", i, analog_probes[0][i]);
if( ID == 1 ) printf("%4d| %6d\n", i, analog_probes[1][i]);
if( ID == 2 ) printf("%4d| %u\n", i, digital_probes[0][i]);
if( ID == 3 ) printf("%4d| %u\n", i, digital_probes[1][i]);
if( ID == 4 ) printf("%4d| %u\n", i, digital_probes[2][i]);
if( ID == 5 ) printf("%4d| %u\n", i, digital_probes[3][i]);
}
}
void PrintAllTrace(){
for(unsigned short i = 0; i < (unsigned short)traceLenght; i++){
printf("%4d| %6d %6d %1d %1d %1d %1d\n", i, analog_probes[0][i],
analog_probes[1][i],
digital_probes[0][i],
digital_probes[1][i],
digital_probes[2][i],
digital_probes[3][i]);
}
}
};
#endif

View File

@ -1,12 +0,0 @@
CC=g++
CFLAG= -g
ROOTFLAG=`root-config --cflags --glibs`
all: EventBuilder
EventBuilder: EventBuilder.cpp SolReader.h Hit.h
$(CC) $(CFLAG) EventBuilder.cpp -o EventBuilder ${ROOTFLAG}
clean:
-rm EventBuilder

View File

@ -1,258 +0,0 @@
#ifndef SOLREADER_H
#define SOLREADER_H
#include <stdio.h> /// for FILE
#include <cstdlib>
#include <string>
#include <vector>
#include <unistd.h>
#include <time.h> // time in nano-sec
#include "Hit.h"
class SolReader {
private:
FILE * inFile;
unsigned int inFileSize;
unsigned int filePos;
unsigned int totNumBlock;
unsigned short blockStartIdentifier;
unsigned int numBlock;
bool isScanned;
void init();
std::vector<unsigned int> blockPos;
public:
SolReader();
SolReader(std::string fileName, unsigned short dataType);
~SolReader();
void OpenFile(std::string fileName);
int ReadNextBlock(int isSkip = 0); // opt = 0, noraml, 1, fast
int ReadBlock(unsigned int index, bool verbose = false);
void ScanNumBlock();
bool IsEndOfFile() const {return (filePos >= inFileSize ? true : false);}
unsigned int GetBlockID() const {return numBlock - 1;}
unsigned int GetNumBlock() const {return numBlock;}
unsigned int GetTotalNumBlock() const {return totNumBlock;}
unsigned int GetFilePos() const {return filePos;}
unsigned int GetFileSize() const {return inFileSize;}
void RewindFile();
Hit * hit;
};
void SolReader::init(){
inFileSize = 0;
numBlock = 0;
filePos = 0;
totNumBlock = 0;
hit = new Hit();
isScanned = false;
blockPos.clear();
}
SolReader::SolReader(){
init();
}
SolReader::SolReader(std::string fileName, unsigned short dataType = 0){
init();
OpenFile(fileName);
hit->SetDataType(dataType, DPPType::PHA);
}
SolReader::~SolReader(){
if( !inFile ) fclose(inFile);
delete hit;
}
inline void SolReader::OpenFile(std::string fileName){
inFile = fopen(fileName.c_str(), "r");
if( inFile == NULL ){
printf("Cannot open file : %s \n", fileName.c_str());
}else{
fseek(inFile, 0L, SEEK_END);
inFileSize = ftell(inFile);
rewind(inFile);
}
}
inline int SolReader::ReadBlock(unsigned int index, bool verbose){
if( isScanned == false) return -1;
if( index >= totNumBlock )return -1;
fseek(inFile, 0L, SEEK_SET);
if( verbose ) printf("Block index: %u, File Pos: %u byte\n", index, blockPos[index]);
fseek(inFile, blockPos[index], SEEK_CUR);
filePos = blockPos[index];
numBlock = index;
return ReadNextBlock();
}
inline int SolReader::ReadNextBlock(int isSkip){
if( inFile == NULL ) return -1;
if( feof(inFile) ) return -1;
if( filePos >= inFileSize) return -1;
fread(&blockStartIdentifier, 2, 1, inFile);
if( (blockStartIdentifier & 0xAA00) != 0xAA00 ) {
printf("header fail.\n");
return -2 ;
}
if( ( blockStartIdentifier & 0xF ) == DataFormat::Raw ){
hit->SetDataType(DataFormat::Raw, ((blockStartIdentifier >> 1) & 0xF) == 0 ? DPPType::PHA : DPPType::PSD);
}
hit->dataType = blockStartIdentifier & 0xF;
hit->DPPType = ((blockStartIdentifier >> 4) & 0xF) == 0 ? DPPType::PHA : DPPType::PSD;
if( hit->dataType == DataFormat::ALL){
if( isSkip == 0 ){
fread(&hit->channel, 1, 1, inFile);
fread(&hit->energy, 2, 1, inFile);
if( hit->DPPType == DPPType::PSD ) fread(&hit->energy_short, 2, 1, inFile);
fread(&hit->timestamp, 6, 1, inFile);
fread(&hit->fine_timestamp, 2, 1, inFile);
fread(&hit->flags_high_priority, 1, 1, inFile);
fread(&hit->flags_low_priority, 2, 1, inFile);
fread(&hit->downSampling, 1, 1, inFile);
fread(&hit->board_fail, 1, 1, inFile);
fread(&hit->flush, 1, 1, inFile);
fread(&hit->trigger_threashold, 2, 1, inFile);
fread(&hit->event_size, 8, 1, inFile);
fread(&hit->aggCounter, 4, 1, inFile);
}else{
fseek(inFile, hit->DPPType == DPPType::PHA ? 31 : 33, SEEK_CUR);
}
fread(&hit->traceLenght, 8, 1, inFile);
if( isSkip == 0){
fread(hit->analog_probes_type, 2, 1, inFile);
fread(hit->digital_probes_type, 4, 1, inFile);
fread(hit->analog_probes[0], hit->traceLenght*4, 1, inFile);
fread(hit->analog_probes[1], hit->traceLenght*4, 1, inFile);
fread(hit->digital_probes[0], hit->traceLenght, 1, inFile);
fread(hit->digital_probes[1], hit->traceLenght, 1, inFile);
fread(hit->digital_probes[2], hit->traceLenght, 1, inFile);
fread(hit->digital_probes[3], hit->traceLenght, 1, inFile);
}else{
fseek(inFile, 6 + hit->traceLenght*(12), SEEK_CUR);
}
}else if( hit->dataType == DataFormat::OneTrace){
if( isSkip == 0 ){
fread(&hit->channel, 1, 1, inFile);
fread(&hit->energy, 2, 1, inFile);
if( hit->DPPType == DPPType::PSD ) fread(&hit->energy_short, 2, 1, inFile);
fread(&hit->timestamp, 6, 1, inFile);
fread(&hit->fine_timestamp, 2, 1, inFile);
fread(&hit->flags_high_priority, 1, 1, inFile);
fread(&hit->flags_low_priority, 2, 1, inFile);
}else{
fseek(inFile, hit->DPPType == DPPType::PHA ? 14 : 16, SEEK_CUR);
}
fread(&hit->traceLenght, 8, 1, inFile);
if( isSkip == 0){
fread(&hit->analog_probes_type[0], 1, 1, inFile);
fread(hit->analog_probes[0], hit->traceLenght*4, 1, inFile);
}else{
fseek(inFile, 1 + hit->traceLenght*4, SEEK_CUR);
}
}else if( hit->dataType == DataFormat::NoTrace){
if( isSkip == 0 ){
fread(&hit->channel, 1, 1, inFile);
fread(&hit->energy, 2, 1, inFile);
if( hit->DPPType == DPPType::PSD ) fread(&hit->energy_short, 2, 1, inFile);
fread(&hit->timestamp, 6, 1, inFile);
fread(&hit->fine_timestamp, 2, 1, inFile);
fread(&hit->flags_high_priority, 1, 1, inFile);
fread(&hit->flags_low_priority, 2, 1, inFile);
}else{
fseek(inFile, hit->DPPType == DPPType::PHA ? 14 : 16, SEEK_CUR);
}
}else if( hit->dataType == DataFormat::MiniWithFineTime){
if( isSkip == 0 ){
fread(&hit->channel, 1, 1, inFile);
fread(&hit->energy, 2, 1, inFile);
if( hit->DPPType == DPPType::PSD ) fread(&hit->energy_short, 2, 1, inFile);
fread(&hit->timestamp, 6, 1, inFile);
fread(&hit->fine_timestamp, 2, 1, inFile);
}else{
fseek(inFile, hit->DPPType == DPPType::PHA ? 11 : 13, SEEK_CUR);
}
}else if( hit->dataType == DataFormat::Minimum){
if( isSkip == 0 ){
fread(&hit->channel, 1, 1, inFile);
fread(&hit->energy, 2, 1, inFile);
if( hit->DPPType == DPPType::PSD ) fread(&hit->energy_short, 2, 1, inFile);
fread(&hit->timestamp, 6, 1, inFile);
}else{
fseek(inFile, hit->DPPType == DPPType::PHA ? 9 : 11, SEEK_CUR);
}
}else if( hit->dataType == DataFormat::Raw){
fread(&hit->dataSize, 8, 1, inFile);
if( isSkip == 0){
fread(hit->data, hit->dataSize, 1, inFile);
}else{
fseek(inFile, hit->dataSize, SEEK_CUR);
}
}
numBlock ++;
filePos = ftell(inFile);
return 0;
}
void SolReader::RewindFile(){
rewind(inFile);
filePos = 0;
numBlock = 0;
}
void SolReader::ScanNumBlock(){
if( inFile == NULL ) return;
if( feof(inFile) ) return;
numBlock = 0;
blockPos.clear();
blockPos.push_back(0);
while( ReadNextBlock(1) == 0){
blockPos.push_back(filePos);
printf("%u, %.2f%% %u/%u\n\033[A\r", numBlock, filePos*100./inFileSize, filePos, inFileSize);
}
totNumBlock = numBlock;
numBlock = 0;
isScanned = true;
printf("\nScan complete: number of data Block : %u\n", totNumBlock);
rewind(inFile);
filePos = 0;
//for( int i = 0; i < totNumBlock; i++){
// printf("%7d | %u \n", i, blockPos[i]);
//}
}
#endif

0
WebSimHelper/files/.gitkeep Executable file
View File

View File

@ -289,8 +289,130 @@
<p id="n2"></p> <p id="n2"></p>
<p id="n3"></p> <p id="n3"></p>
<hr> <!-- ===================================================== -->
<h2> DWBA & Monte Carlo Simultion </h2>
<h3>DWBA and E<sub>x</sub> List:</h3>
<b style="color:red;">For 2-nucleon transfer</b>, <b>Orbital</b> take the form NL=X, where N is number of node, X is momentum number. n and L are related by &Sigma;<sub>i</sub> (2n<sub>i</sub>+l<sub>i</sub>) = 2N + X + 2n + l, where n<sub>i</sub> and l<sub>i</sub> are the principle number and orbital angular momentum of the each transfered nucleon, and n and l are the internal quanta of the 2-nucleon. e.g. (t,p) reaction to 0f orbtial, the left-hand side would be n<sub>i</sub> = 0 and l<sub>i</sub> = 3 and the sum is 3+3 = 6 = 2N + X + 2n+l. Assume n = l = 0, we have 6 = 2N+L. Thus, 3L=0, 2L=2,1L=4, 0L=6. </p>
Beam J<sup>&pi;</sup>: <input type="text" id="neam_jpi" size="5" value=""/>
<BR>TODO: guess the orbital for Beam J<sup>&pi;</sup>=0
<br>
<input type="checkbox" id="pos" onclick="checkParity()" checked/>Positive parity</td>
<input type="checkbox" id="neg" onclick="checkParity()" checked/>Negative parity</td>
<input type="checkbox" id="unk" onclick="checkParity()" checked/>Unknown parity</td>
<br>
<button type="button" onclick="addStates()">Add known states</button>
Max Ex: <input type="text" id="maxEx" size="5" value="5"/>MeV
<p id='waiting'></p>
<table id="ExTable2">
<tr>
<td><b> E<sub>x</sub> [MeV] </b></td>
<td><b> &nbsp;&nbsp;&nbsp;J<sup>&#960;</sup></b></td>
<td><b> Orbital </b></td>
</tr>
</tr>
<td><input type="text" name="Ex" size="5" value="0"/></td>
<td><input type="text" name="Jpi" size="5" value="3/2+"/></td>
<td><input type="text" name="Orb" size="6" value="0d3/2"/></td>
<td><button type="button" onclick="addRow2(this)">Insert Ex</button></td>
<td><button type="button" onclick="deleteRow2(this)">Remove Ex</button></td>
</tr>
<!-- <tr>
<td></td>
<td></td>
<td></td>
<td><button type="button" onclick="copyEx()">Copy Ex</button></td>
<td><button type="button" onclick="pasteEx()">&nbsp; Paste Ex &nbsp;</button></td>
</tr> -->
</table>
<p></p>
<input type="checkbox" name="DWBA" value="On"/>Cal. DWBA
<table>
<tr>
<td>Incoming Channel</td>
<td>
<select name="op1">
<option value="A" selected>D | An & Cai (2006) E < 183, 12 < A < 238</option>
<option value="H">D | Han, Shi, & Shen (2006) E < 200, 12 < A < 209</option>
<option value="B">D | Bojowald et al. (1988) 50 < E < 80, 27 < A < 208</option>
<option value="D">D | Daehnick, Childs, Vrcelj (1980) 11.8 < E < 80, 27 < A < 238 (REL) </option>
<option value="C">D | Daehnick, Childs, Vrcelj (1980) 11.8 < E < 80, 27 < A < 238 (NON-REL) </option>
<option value="L">D | Lohr and Haeberli (1974) 9 < E < 13, 40 < A </option>
<option value="Q">D | Perey and Perey (1963) 12 < E < 25, 40 < A </option>
<option value="Z">D | Zhang, Pang, Lou (2016) 5 < E < 170, A < 18, spe 6-7Li </option>
<option value="K">P | Koning & Delaroche (2009) E < 200, 24 < A < 209 | Iso.Dep.</option>
<option value="V">P | Varner et al. (1991) 16 < E < 65, 4 < A < 209</option>
<option value="M">P | Menet et al. (1971) 30 < E < 60, 40 < A </option>
<option value="G">P | Becchetti and Greenlees (1969) E < 50, 40 < A </option>
<option value="P">P | Perey (1963) E < 20, 30 < A < 100 </option>
<option value="x">A=3 | Xu, Guo, Han, & Shen (2011) E < 250, 20 < A < 209 </option>
<option value="l">A=3 | Liang, Li, & Cai (2009) E < 270, All masses </option>
<option value="p">A=3 | Pang et al. (2009) all E, all masses, Iso. Dep. </option>
<option value="c">A=3 | Li, Liang, Cai (2007), E < 40, 48 < A < 232, Tritons </option>
<option value="t">A=3 | Trost et al. (1987) 10 < E < 220, 10 < A < 208 </option>
<option value="h">A=3 | Hyakutake et al. (1980) 90 < E < 120, About 58 < A < 92 </option>
<option value="b">A=3 | Becchetti and Greenlees (1971), E < 40, 40 < A, Iso. Dep. </option>
<option value="s">A=4 | Su & Han (2015) E < 398, 20 < A < 209 </option>
<option value="a">A=4 | Avrigeanu et al. (2009) </option>
<option value="f">A=4 | Bassani and Picard (1969) 24 < E < 31, A = 90 </option>
</select>
<td>
</tr>
<tr>
<td>Outgoing Channel</td>
<td>
<select name="op2">
<option value="A">D | An & Cai (2006) E < 183, 12 < A < 238</option>
<option value="H">D | Han, Shi, & Shen (2006) E < 200, 12 < A < 209</option>
<option value="B">D | Bojowald et al. (1988) 50 < E < 80, 27 < A < 208</option>
<option value="D">D | Daehnick, Childs, Vrcelj (1980) 11.8 < E < 80, 27 < A < 238 (REL) </option>
<option value="C">D | Daehnick, Childs, Vrcelj (1980) 11.8 < E < 80, 27 < A < 238 (NON-REL) </option>
<option value="L">D | Lohr and Haeberli (1974) 9 < E < 13, 40 < A </option>
<option value="Q">D | Perey and Perey (1963) 12 < E < 25, 40 < A </option>
<option value="Z">D | Zhang, Pang, Lou (2016) 5 < E < 170, A < 18, spe 6-7Li </option>
<option value="K" selected>P | Koning & Delaroche (2009) E < 200, 24 < A < 209, Iso.Dep.</option>
<option value="V">P | Varner et al. (1991) 16 < E < 65, 4 < A < 209</option>
<option value="M">P | Menet et al. (1971) 30 < E < 60, 40 < A </option>
<option value="G">P | Becchetti and Greenlees (1969) E < 50, 40 < A </option>
<option value="P">P | Perey (1963) E < 20, 30 < A < 100 </option>
<option value="x">A=3 | Xu, Guo, Han, & Shen (2011) E < 250, 20 < A < 209 </option>
<option value="l">A=3 | Liang, Li, & Cai (2009) E < 270, All masses </option>
<option value="p">A=3 | Pang et al. (2009) all E | all masses, Iso. Dep. </option>
<option value="c">A=3 | Li, Liang, Cai (2007), E < 40, 48 < A < 232, Tritons </option>
<option value="t">A=3 | Trost et al. (1987) 10 < E < 220, 10 < A < 208 </option>
<option value="h">A=3 | Hyakutake et al. (1980) 90 < E < 120, About 58 < A < 92 </option>
<option value="b">A=3 | Becchetti and Greenlees (1971), E < 40, 40 < A, Iso. Dep. </option>
<option value="s">A=4 | Su & Han (2015) E < 398, 20 < A < 209 </option>
<option value="a">A=4 | Avrigeanu et al. (2009) </option>
<option value="f">A=4 | Bassani and Picard (1969) 24 < E < 31, A = 90 </option>
</select>
<td>
</tr>
</table>
<table>
<tr>
<input type="checkbox" name="onlyDWBA" value="On"/>Only DWBA and Don't Sim. Angle range (for only DWBA)
</tr>
<tr>
<td>Min [deg]: </td>
<td><input type = "text" name = "minAng" size="6" value="0" /></td>
<td>Max [deg]: </td>
<td><input type = "text" name = "maxAng" size="6" value="90"/></td>
</tr>
</table>
<button type="button" onclick="DWBA_Sim()" style="width:200px;height:60px;">Run DWBA and Simulation</button>
<!-- ===================================================== -->
<hr>
<h1>&theta;<sub>CM</sub> Calculator</h1> <h1>&theta;<sub>CM</sub> Calculator</h1>
The calculation only give &theta;<sub>CM</sub> after the bending. The calculation only give &theta;<sub>CM</sub> after the bending.
@ -323,94 +445,6 @@ The calculation only give &theta;<sub>CM</sub> after the bending.
<!-- ===================================================== --> <!-- ===================================================== -->
<!--
<hr>
<h1> DWBA and Monte Carlo Simulation (under construction...)</h1>
<table id='DWBATable' style="border:1px solid; text-align:center;">
<tr>
<td> E<sub>x</sub> [MeV]</td>
<td> J<sup>&#960;</sup></td>
<td> Orbital </td>
</tr>
</tr>
<td id='dwba1'>0</td>
<td><input type="text" name="Jpi" size="5" value="3/2+" enterkeyhint="done"/></td>
<td><input type="text" name="Orb" size="5" value="0d3/2" enterkeyhint="done"/></td>
</tr>
</tr>
<td id='dwba2'>0</td>
<td><input type="text" name="Jpi" size="5" value="1/2+" enterkeyhint="done"/></td>
<td><input type="text" name="Orb" size="5" value="1s1/2" enterkeyhint="done"/></td>
</tr>
</table>
<p></p>
<input type="checkbox" name="DWBA" value="On"/>Cal. DWBA
<table>
<tr>
<td>Incoming Channel</td>
<td>
<select name="op1">
<option value="A" selected>D | An & Cai (2006), E < 183, 12 < A < 238</option>
<option value="H">D | Han, Shi, & Shen, (2006), E < 200 | 12 < A < 209</option>
<option value="B">D | Bojowald et al., (1988), 50 < E < 80 | 27 < A < 208</option>
<option value="K">P | Koning & Delaroche, (2009), E < 200 | 24 < A < 209 | Iso.Dep.</option>
<option value="V">P | Varner et al., (1991), 16 < E < 65 | 4 < A < 209</option>
<option value="M">P | Menet et al., (1971), 30 < E < 60 | 40 < A </option>
<option value="x">A=3 | Xu, Guo, Han, & Shen, (2011), E < 250 | 20 < A < 209 </option>
<option value="l">A=3 | Liang, Li, & Cai, (2009), E < 270 | All masses </option>
<option value="x">A=4 | Su & Han, (2015), E < 398 | 20 < A < 209 </option>
</select>
<td>
</tr>
<tr>
<td>Outgoing Channel</td>
<td>
<select name="op2">
<option value="A">D | An & Cai (2006), E < 183, 12 < A < 238</option>
<option value="H">D | Han, Shi, & Shen, (2006), E < 200 | 12 < A < 209</option>
<option value="B">D | Bojowald et al., (1988), 50 < E < 80 | 27 < A < 208</option>
<option value="K" selected>P | Koning & Delaroche, (2009), E < 200 | 24 < A < 209 | Iso.Dep.</option>
<option value="V">P | Varner et al., (1991), 16 < E < 65 | 4 < A < 209</option>
<option value="M">P | Menet et al., (1971), 30 < E < 60 | 40 < A </option>
<option value="x">A=3 | Xu, Guo, Han, & Shen, (2011), E < 250 | 20 < A < 209 </option>
<option value="l">A=3 | Liang, Li, & Cai, (2009), E < 270 | All masses </option>
<option value="x">A=4 | Su & Han, (2015), E < 398 | 20 < A < 209 </option>
</select>
<td>
</tr>
</table>
<h3> Plot config (still working on):</h3>
<input type="checkbox" name="plot" value="pEZ" checked/>E vs Z<br>
<input type="checkbox" name="plot" value="pExCal" checked/>Ex (cal.)<br>
<input type="checkbox" name="plot" value="pThetaCM" checked/>ThetaCM<br>
<input type="checkbox" name="plot" value="pThetaCM_Z" checked/>ThetaCM vs Z<br>
<input type="checkbox" name="plot" value="pRecoilXY" checked/>Recoil X vs Y<br>
<input type="checkbox" name="plot" value="pRecoilRThetaCM"/>Recoil-R vs ThetaCM<br>
<input type="checkbox" name="plot" value="pRecoilRZ"/>Recoil R vs Z<br>
<input type="checkbox" name="plot" value="pArrayXY"/>Array X vs Y<br>
<p></p>
<input type="checkbox" name="gate" value="hit==1" checked/>Array Hit<br>
<input type="checkbox" name="gate" value="loop<=1" checked/>Loop = 1<br>
<input type="checkbox" name="gate" value="thetaCM>10" checked/> ThetaCM > 10 deg<br>
<p></p>
<input type = "submit" value = "Run Simulation" style="width:200px;height:60px;font-size:20px" />
<p></p>
<iframe style="border:none;"></iframe>
-->
<!-- ===================================================== -->
<hr> <hr>
<p></p> <p></p>
HELIOSmatics was first built by Ben P. Kay in MS Excel around 2010. It was modified by Ryan Tang later. And now it migrated to the web on Dec, 2022. HELIOSmatics was first built by Ben P. Kay in MS Excel around 2010. It was modified by Ryan Tang later. And now it migrated to the web on Dec, 2022.
@ -419,52 +453,11 @@ The calculation can be found in the source code (heliosmatics.js or press F12)
<p></p> <p></p>
<!--
<hr>
Experimental 3D model
<div id="Plot_3D" class="plotStyle"></div>
-->
</body> </body>
<!-- ######################################################################################### --> <!-- ######################################################################################### -->
<script src="heliosmatics.js"></script> <script src="heliosmatics.js"></script>
<script src="montecarlo.js"></script>
<script>
function CopyInputs(){
let inputs = document.getElementsByTagName("input");
let copyText = "====HELIOSMATICS|";
for(let i = 0; i < inputs.length; i++){
if( inputs[i].type == 'text'){
//console.log(inputs[i].id.substring(0,2));
if( inputs[i].id.substring(0,2) == 'Ex' || inputs[i].id.substring(0,5) == 'theta' ) {
continue;
}
if( inputs[i].id == 'innerRecoil'){
break;
}
copyText += inputs[i].value + ", ";
}
}
copyText += document.getElementById('heavyName').innerHTML;
//console.log(copyText);
navigator.clipboard.writeText(copyText).then(
() => {
alert('Setting copied to clipboard.\nCan paste it in Monte Carlo simulation.\n' + copyText);
}).catch(
() =>{
alert('Cannot copy.');
});
//window.open('simpleSim.html');
}
</script>
</html> </html>

View File

@ -2,15 +2,13 @@
<html> <html>
<body> <body>
<style> <style>
body{ body{
//color : #767A4C; font-family: Arial, Helvetica, sans-serif;
font-family: Arial, Helvetica, sans-serif; }
} a {
a { color : #1363A7;
//color : #F7CF3C; }
color : #1363A7; hr {
}
hr {
height:4px; height:4px;
background-color:#F7CF3C; background-color:#F7CF3C;
border-style:none; border-style:none;

113
WebSimHelper/montecarlo.js Normal file
View File

@ -0,0 +1,113 @@
function addRow2(ele) {
let iRow = ele.closest('tr').sectionRowIndex;
let table = document.getElementById("ExTable2");
let row = table.insertRow(iRow+1);
row.innerHTML = '<td><input type="text" name="Ex" size="5" /></td> \
<td><input type="text" name="Jpi" size="5"/></td> \
<td><input type="text" name="Orb" size="6"/></td> \
<td><button type="button" onclick="addRow(this)">Insert Ex</button></td> \
<td><button type="button" onclick="deleteRow(this)">Remove Ex</button></td>';
}
function deleteRow2(ele){
let table = document.getElementById("ExTable2");
let nRow = table.rows.length;
let iRow = ele.closest('tr').sectionRowIndex;
if ( nRow > 2){
table.deleteRow(iRow);
}
}
let parity;
function checkParity(){
parity = 0;
if( document.getElementById('pos').checked == true ) parity += 1;
if( document.getElementById('neg').checked == true ) parity += 2;
if( document.getElementById('unk').checked == true ) parity += 4;
//console.log(parity);
}
checkParity();
function addStates(){
let AZ = document.getElementById('heavyName').value;
let maxEx = document.getElementById('maxEx').value;
let beamJpi = document.getElementById('beam_Jpi').value;
let str = 'get_nuclear_data.py?isotopes_name=' + AZ + '&maxEx='+maxEx;
let table = document.getElementById("ExTable");
const client = new XMLHttpRequest();
client.addEventListener('loadstart',
function(e){
document.getElementById('waiting').innerHTML = "wait....retrieving data from IAEA..";
}
);
client.addEventListener('error',
function(e){
document.getElementById('waiting').innerHTML = "Error.";
}
);
client.addEventListener('loadend',
function(e){
let result = client.responseText.split(/\r?\n/);
//clear table
let nRow = table.rows.length;
for( let j = nRow; j > 2; j--){
table.deleteRow(j - 2);
}
document.getElementById('waiting').innerHTML = "";
let count = 0;
for( let i = 0; i < result.length; i++){
if( i < 17 ) continue;
if( result[i] == "</table>" ) break;
let kaka = result[i].split(' ').filter(n => n);
let ex = parseFloat(kaka[3])/1000.;
let jpi = kaka[7]?.replace('(', '')?.replace(')', '');
console.log(ex + ", " + jpi);
//check parity
if( (((parity >> 2) & 1) != 1) && kaka[7].slice(-1) == ")" ) continue;
if( (((parity >> 2) & 1) != 1) && jpi == "," ) continue;
if( (((parity) & 1) != 1) && jpi.slice(-1) == "+" ) continue;
if( (((parity >> 1) & 1) != 1) && jpi.slice(-1) == "-" ) continue;
count ++;
nRow = table.rows.length;
let row = table.insertRow(nRow-1);
row.innerHTML = '<td><input type="text" name="Ex" size="5" value="' + ex.toFixed(3) + '"/></td> \
<td><input type="text" name="Jpi" size="5" value="' + jpi + '"/></td> \
<td><input type="text" name="Orb" size="6" /></td> \
<td><button type="button" onclick="addRow(this)">Insert Ex</button></td> \
<td><button type="button" onclick="deleteRow(this)">Remove Ex</button></td> \
<td>'+ kaka[7] +'</td>';
}
if( count == 0 ){
document.getElementById('waiting').innerHTML = "no states found.";
nRow = table.rows.length;
let row = table.insertRow(nRow-1);
row.innerHTML = '<td><input type="text" name="Ex" size="5" value="0"/></td> \
<td><input type="text" name="Jpi" size="5" value="1/2+"/></td> \
<td><input type="text" name="Orb" size="6" value="1s1/2"/></td> \
<td><button type="button" onclick="addRow(this)">Insert Ex</button></td> \
<td><button type="button" onclick="deleteRow(this)">Remove Ex</button></td>';
}
}
);
client.open('GET', str);
client.send();
}

View File

@ -17,11 +17,11 @@
///// pElum1RThetaCM, /// 16 ///// pElum1RThetaCM, /// 16
///// pEmpty }; /// 17 ///// pEmpty }; /// 17
/////=============================================== User Config /////=============================================== User Config
{pEZ, pExCal, pThetaCM, pRecoilRZ, break, pThetaCM_Z, pRecoilXY, pInfo, pRecoilRThetaCM} //Canvas config {pEZ, pExCal, pThetaCM, pRecoilRZ, break, pThetaCM_Z, pRecoilXY, pInfo, pArrayXY} //Canvas config
hit == 1 && loop <= 1 && thetaCM > 10 hit == 1 && loop <= 1 && thetaCM > 10
60 //elum range 60 //elum range
{0,50} //thetaCM range {0,50} //thetaCM range
false //shownKELines true //shownKELines
false //isOverRideEx false //isOverRideEx
{-0.5, 4.0} // over-rdied Ex range {-0.5, 4.0} // over-rdied Ex range
///============================== example of gate ///============================== example of gate

49
working/test.C Normal file
View File

@ -0,0 +1,49 @@
#include "../Armory/ClassDetGeo.h"
#include "../Armory/ClassReactionConfig.h"
#include "../Cleopatra/ClassHelios.h"
#include "../Cleopatra/ClassTransfer.h"
void test(){
// DetGeo haha("detectorGeo.txt");
// haha.Print(true);
// ReactionConfig config("reactionConfig.txt");
// config.Print();
TransferReaction * transfer = new TransferReaction();
// transfer->SetReactionSimple(32, 14, 2, 1, 1, 1, 8.8);
int ID = 0;
transfer->SetReactionFromFile("reactionConfig.txt", ID);
transfer->PrintReaction();
transfer->Event(25 * TMath::DegToRad(), 0 * TMath::DegToRad());
transfer->PrintFourVectors();
// ReactionConfig config2 = transfer->GetRectionConfig();
// HELIOS * helios = new HELIOS();
// helios->SetDetectorGeometry("detectorGeo.txt", 1);
// helios->PrintGeometry();
// TLorentzVector Pb = transfer->GetPb();
// printf("Charge : %d\n", Pb.GetUniqueID());
// int hit = helios->CalArrayHit(Pb, false);
// helios->CheckDetAcceptance();
// // //helios->CalTrajectoryPara(Pb, config.recoilLightZ, true);
// printf("\n hit = %d | %s | %s\n", hit, helios->GetHitMessage().Data(), helios->GetAcceptanceMessage().Data());
// trajectory orb = helios->GetTrajectory_b();
// orb.PrintTrajectory();
// delete helios;
delete transfer;
}