modified: Armory/Makefile
deleted: Armory/README.md modified: Calibration.C Sudarsan pointed out that the gain match and calibration stages have the ring and wedge swapped, so I fixed that. modified: ProcessRun.sh changes for running on laptop modified: TrackRecon.C same inconsistency as in Calibration.C fixed deleted: makeplots.C not used anymore modified: mapping.h corrected teh mapping for the QQQs poptentially, need to confirm modified: mapping_old.txt
This commit is contained in:
parent
9c20c4abfe
commit
0883ebdb6e
|
|
@ -10,7 +10,7 @@ COPTS = -fPIC -DLINUX -g -O0 -Wall -std=c++17 -lpthread
|
||||||
|
|
||||||
ROOTLIBS = `root-config --cflags --glibs`
|
ROOTLIBS = `root-config --cflags --glibs`
|
||||||
|
|
||||||
ALL = Mapper AnasenMS
|
ALL = Mapper EventBuilder#AnasenMS
|
||||||
|
|
||||||
#########################################################################
|
#########################################################################
|
||||||
|
|
||||||
|
|
@ -23,6 +23,10 @@ Mapper : Mapper.cpp ../mapping.h ClassDet.h
|
||||||
@echo "--------- making Mapper"
|
@echo "--------- making Mapper"
|
||||||
$(CC) $(COPTS) -o Mapper Mapper.cpp $(ROOTLIBS)
|
$(CC) $(COPTS) -o Mapper Mapper.cpp $(ROOTLIBS)
|
||||||
|
|
||||||
AnasenMS : constant.h Isotope.h ClassTransfer.h ClassSX3.h ClassPW.h ClassAnasen.h anasenMS.cpp
|
# AnasenMS : constant.h Isotope.h ClassTransfer.h ClassSX3.h ClassPW.h ClassAnasen.h anasenMS.cpp
|
||||||
@echo "--------- making ANASEN Monte Carlo"
|
# @echo "--------- making ANASEN Monte Carlo"
|
||||||
$(CC) $(COPTS) -o AnasenMS anasenMS.cpp $(ROOTLIBS)
|
# $(CC) $(COPTS) -o AnasenMS anasenMS.cpp $(ROOTLIBS)
|
||||||
|
|
||||||
|
EventBuilder : EventBuilder.cpp ../ClassData.h fsuReader.h ../Hit.h
|
||||||
|
@echo "--------- making EventBuilder"
|
||||||
|
$(CC) $(COPTS) -o EventBuilder EventBuilder.cpp $(ROOTLIBS)
|
||||||
|
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
||||||
# HistPlotter
|
|
||||||
- Header-only class to encapsulate CERN ROOT 1D/2D Histogram plotting and application of TCuts.
|
|
||||||
- Can specify folder hierarchy while setting up fills, currently supports only one level.
|
|
||||||
- Cuts specified using a two-column text file containing cut names, and target .root files. These .root files must contain a TCutG of name "CUTG".
|
|
||||||
- Tested for use in macros, with TSelector design pattern and compiled code.
|
|
||||||
- Idea inspired from MyFill() pattern created by github user gwm17
|
|
||||||
|
|
@ -222,7 +222,7 @@ void Calibration::Terminate()
|
||||||
calibArray[det][ring][wedge] = slope_keV;
|
calibArray[det][ring][wedge] = slope_keV;
|
||||||
calibValid[det][ring][wedge] = true;
|
calibValid[det][ring][wedge] = true;
|
||||||
|
|
||||||
outFile << det << " " << ring << " " << wedge << " "
|
outFile << det << " " << wedge << " " << ring << " "
|
||||||
<< slope_keV << "\n";
|
<< slope_keV << "\n";
|
||||||
|
|
||||||
// printf("QQQ DET=%d R=%d W=%d ADCpeak=%.1f slope_keV=%.6f\n",det, ring, wedge, adcPeak, slope_keV);
|
// printf("QQQ DET=%d R=%d W=%d ADCpeak=%.1f slope_keV=%.6f\n",det, ring, wedge, adcPeak, slope_keV);
|
||||||
|
|
|
||||||
|
|
@ -12,12 +12,13 @@ timeWindow=$2
|
||||||
|
|
||||||
option=$3
|
option=$3
|
||||||
|
|
||||||
rawFolder=/home/tandem/data1/2024_09_17Fap/data
|
# rawFolder=/home/tandem/data1/2024_09_17Fap/data
|
||||||
|
rawFolder=../Raw_data
|
||||||
rootFolder=../root_data
|
rootFolder=../root_data
|
||||||
|
|
||||||
if [ $option -eq 0 ]; then
|
if [ $option -eq 0 ]; then
|
||||||
|
|
||||||
rsync -auh --info=progress2 splitpole@128.186.111.223:/media/nvmeData/2024_09_17Fap/*.fsu /home/tandem/data1/2024_09_17Fap/data
|
# rsync -auh --info=progress2 splitpole@128.186.111.223:/media/nvmeData/2024_09_17Fap/*.fsu /home/tandem/data1/2024_09_17Fap/data
|
||||||
|
|
||||||
fileList=`\ls -1 ${rawFolder}/*Run_${runID}_*.fsu`
|
fileList=`\ls -1 ${rawFolder}/*Run_${runID}_*.fsu`
|
||||||
|
|
||||||
|
|
@ -30,4 +31,4 @@ if [ $option -eq 0 ]; then
|
||||||
./Mapper ${rootFolder}/*${runID}*${timeWindow}.root
|
./Mapper ${rootFolder}/*${runID}*${timeWindow}.root
|
||||||
fi
|
fi
|
||||||
|
|
||||||
root "processRun.C(\"${rootFolder}/ProtonRun_${runID}_mapped.root\")"
|
root "processRun.C(\"${rootFolder}/Run_${runID}_mapped.root\")"
|
||||||
|
|
|
||||||
10
TrackRecon.C
10
TrackRecon.C
|
|
@ -144,7 +144,7 @@ void TrackRecon::Begin(TTree * /*tree*/)
|
||||||
{
|
{
|
||||||
int det, ring, wedge;
|
int det, ring, wedge;
|
||||||
double gainw, gainr;
|
double gainw, gainr;
|
||||||
while (infile >> det >> ring >> wedge >> gainw >> gainr)
|
while (infile >> det >> wedge >> ring >> gainw >> gainr)
|
||||||
{
|
{
|
||||||
qqqGain[det][ring][wedge] = gainw;
|
qqqGain[det][ring][wedge] = gainw;
|
||||||
qqqGainValid[det][ring][wedge] = (gainw > 0);
|
qqqGainValid[det][ring][wedge] = (gainw > 0);
|
||||||
|
|
@ -160,7 +160,7 @@ void TrackRecon::Begin(TTree * /*tree*/)
|
||||||
{
|
{
|
||||||
int det, ring, wedge;
|
int det, ring, wedge;
|
||||||
double slope;
|
double slope;
|
||||||
while (infile >> det >> ring >> wedge >> slope)
|
while (infile >> det >> wedge >> ring >> slope)
|
||||||
{
|
{
|
||||||
qqqCalib[det][ring][wedge] = slope;
|
qqqCalib[det][ring][wedge] = slope;
|
||||||
qqqCalibValid[det][ring][wedge] = (slope > 0);
|
qqqCalibValid[det][ring][wedge] = (slope > 0);
|
||||||
|
|
@ -202,11 +202,7 @@ Bool_t TrackRecon::Process(Long64_t entry)
|
||||||
int qqqAdjCh = 0;
|
int qqqAdjCh = 0;
|
||||||
for (int i = 0; i < qqq.multi; i++)
|
for (int i = 0; i < qqq.multi; i++)
|
||||||
{
|
{
|
||||||
if (qqq.id[i] == 3 && qqq.ch[i] <= 16)
|
if ((qqq.id[i] == 3 || qqq.id[i] ==1) && qqq.ch[i] <= 16)
|
||||||
{
|
|
||||||
qqq.ch[i] = 16-qqq.ch[i] ;
|
|
||||||
}
|
|
||||||
if (qqq.id[i] == 1 && qqq.ch[i] <= 16)
|
|
||||||
{
|
{
|
||||||
qqq.ch[i] = 16-qqq.ch[i] ;
|
qqq.ch[i] = 16-qqq.ch[i] ;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
87
makeplots.C
87
makeplots.C
|
|
@ -1,87 +0,0 @@
|
||||||
#include "GainMatchQQQ.h"
|
|
||||||
#include <TH2.h>
|
|
||||||
#include <TF1.h>
|
|
||||||
#include <TStyle.h>
|
|
||||||
#include <TCanvas.h>
|
|
||||||
#include <TMath.h>
|
|
||||||
#include <TCutG.h>
|
|
||||||
#include <fstream>
|
|
||||||
#include <utility>
|
|
||||||
#include <algorithm>
|
|
||||||
#include <cmath>
|
|
||||||
#include <numeric>
|
|
||||||
#include "Armory/HistPlotter.h"
|
|
||||||
#include "TVector3.h"
|
|
||||||
|
|
||||||
void makeplots()
|
|
||||||
{
|
|
||||||
TCanvas *c1 = new TCanvas("c1", "c1", 0, 0, 1024, 768);
|
|
||||||
c1->Divide(2, 2);
|
|
||||||
|
|
||||||
TH2F *h1, *h2, *h3, *h4 = nullptr;
|
|
||||||
|
|
||||||
std::string type = "Cal_cut";
|
|
||||||
TFile *inFile = TFile::Open("Cal_checkQQQ.root");
|
|
||||||
TF1 f1("x","x",0 ,80);
|
|
||||||
|
|
||||||
|
|
||||||
for (int ring = 0; ring < 16; ring++)
|
|
||||||
{
|
|
||||||
for (int wedge = 0; wedge < 16; wedge++)
|
|
||||||
{
|
|
||||||
|
|
||||||
c1->cd(1);
|
|
||||||
h1 = (TH2F *)inFile->Get(Form("E%s/h%s_qqq%d_ring%d_wedge%d", type.c_str(), type.c_str(), 0, ring, wedge));
|
|
||||||
gPad->SetGrid();
|
|
||||||
if (h1)
|
|
||||||
{
|
|
||||||
h1->SetTitle(Form("QQQ%d Ring %d Wedge %d %s E", 0, ring, wedge, type.c_str()));
|
|
||||||
h1->Draw("COLZ");
|
|
||||||
f1.DrawClone("same");
|
|
||||||
|
|
||||||
gPad->Modified();
|
|
||||||
gPad->Update();
|
|
||||||
}
|
|
||||||
|
|
||||||
c1->cd(2);
|
|
||||||
h2 = (TH2F *)inFile->Get(Form("E%s/h%s_qqq%d_ring%d_wedge%d", type.c_str(), type.c_str(), 1, ring, wedge));
|
|
||||||
gPad->SetGrid();
|
|
||||||
if (h2)
|
|
||||||
{
|
|
||||||
std::cout<<h2<<std::endl;
|
|
||||||
h2->SetTitle(Form("QQQ%d Ring %d Wedge %d %s E", 1, ring, wedge, type.c_str()));
|
|
||||||
h2->Draw("COLZ");
|
|
||||||
f1.DrawClone("same");
|
|
||||||
gPad->Modified();
|
|
||||||
gPad->Update();
|
|
||||||
}
|
|
||||||
|
|
||||||
c1->cd(3);
|
|
||||||
h3 = (TH2F *)inFile->Get(Form("E%s/h%s_qqq%d_ring%d_wedge%d", type.c_str(), type.c_str(), 2, ring, wedge));
|
|
||||||
gPad->SetGrid();
|
|
||||||
if (h3)
|
|
||||||
{
|
|
||||||
h3->SetTitle(Form("QQQ%d Ring %d Wedge %d %s E", 2, ring, wedge, type.c_str()));
|
|
||||||
h3->Draw("COLZ");
|
|
||||||
f1.DrawClone("same");
|
|
||||||
gPad->Modified();
|
|
||||||
gPad->Update();
|
|
||||||
}
|
|
||||||
|
|
||||||
c1->cd(4);
|
|
||||||
h4 = (TH2F *)inFile->Get(Form("E%s/h%s_qqq%d_ring%d_wedge%d", type.c_str(), type.c_str(), 3, ring, wedge));
|
|
||||||
gPad->SetGrid();
|
|
||||||
if (h4)
|
|
||||||
{
|
|
||||||
h4->SetTitle(Form("QQQ%d Ring %d Wedge %d %s E", 3, ring, wedge, type.c_str()));
|
|
||||||
h4->Draw("COLZ");
|
|
||||||
f1.DrawClone("same");
|
|
||||||
gPad->Modified();
|
|
||||||
gPad->Update();
|
|
||||||
}
|
|
||||||
while (gPad->WaitPrimitive());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
inFile->Close();
|
|
||||||
}
|
|
||||||
218
mapping.h
218
mapping.h
|
|
@ -23,8 +23,7 @@ const std::map<int, unsigned short> board = {
|
||||||
{7, 334},
|
{7, 334},
|
||||||
{8, 379},
|
{8, 379},
|
||||||
{9, 325},
|
{9, 325},
|
||||||
{10, 405}
|
{10, 405}};
|
||||||
};
|
|
||||||
const int nBd = board.size();
|
const int nBd = board.size();
|
||||||
|
|
||||||
const int nV1740 = 7;
|
const int nV1740 = 7;
|
||||||
|
|
@ -39,7 +38,6 @@ const int nV1725 = 4;
|
||||||
// The detID = Type * 10000 + index * 100 + channel
|
// The detID = Type * 10000 + index * 100 + channel
|
||||||
// fro example, detID(superX3-8, ch-7) = 00807
|
// fro example, detID(superX3-8, ch-7) = 00807
|
||||||
|
|
||||||
|
|
||||||
// use the GenMapping() to get that
|
// use the GenMapping() to get that
|
||||||
const std::vector<int> mapping = {
|
const std::vector<int> mapping = {
|
||||||
|
|
||||||
|
|
@ -70,8 +68,10 @@ const std::vector<int> mapping = {
|
||||||
10015, 10014, 10013, 10012, 10011, 10010, 10009, 10008, 10007, 10006, 10005, 10004, 10003, 10002, 10001, 10000,
|
10015, 10014, 10013, 10012, 10011, 10010, 10009, 10008, 10007, 10006, 10005, 10004, 10003, 10002, 10001, 10000,
|
||||||
//================== 15529
|
//================== 15529
|
||||||
10231, 10230, 10229, 10228, 10227, 10226, 10225, 10224, 10223, 10222, 10221, 10220, 10219, 10218, 10217, 10216,
|
10231, 10230, 10229, 10228, 10227, 10226, 10225, 10224, 10223, 10222, 10221, 10220, 10219, 10218, 10217, 10216,
|
||||||
10115, 10114, 10113, 10112, 10111, 10110, 10109, 10108, 10107, 10106, 10105, 10104, 10103, 10102, 10101, 10100,
|
10100, 10101, 10102, 10103, 10104, 10105, 10106, 10107, 10108, 10109, 10110, 10111, 10112, 10113, 10114, 10115,
|
||||||
10315, 10314, 10313, 10312, 10311, 10310, 10309, 10308, 10307, 10306, 10305, 10304, 10303, 10302, 10301, 10300,
|
// 10115, 10114, 10113, 10112, 10111, 10110, 10109, 10108, 10107, 10106, 10105, 10104, 10103, 10102, 10101, 10100,
|
||||||
|
10300, 10301, 10302, 10303, 10304, 10305, 10306, 10307, 10308, 10309, 10310, 10311, 10312, 10313, 10314, 10315,
|
||||||
|
// 10315, 10314, 10313, 10312, 10311, 10310, 10309, 10308, 10307, 10306, 10305, 10304, 10303, 10302, 10301, 10300,
|
||||||
10215, 10214, 10213, 10212, 10211, 10210, 10209, 10208, 10207, 10206, 10205, 10204, 10203, 10202, 10201, 10200,
|
10215, 10214, 10213, 10212, 10211, 10210, 10209, 10208, 10207, 10206, 10205, 10204, 10203, 10202, 10201, 10200,
|
||||||
//================== 15528
|
//================== 15528
|
||||||
10316, 10317, 10318, 10319, 10320, 10321, 10322, 10323, 10324, 10325, 10326, 10327, 10328, 10329, 10330, 10331,
|
10316, 10317, 10318, 10319, 10320, 10321, 10322, 10323, 10324, 10325, 10326, 10327, 10328, 10329, 10330, 10331,
|
||||||
|
|
@ -80,153 +80,187 @@ const std::vector<int> mapping = {
|
||||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||||
//================== 89
|
//================== 89
|
||||||
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
||||||
// 30004, -1, 30003, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
// 30004, -1, 30003, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||||
//================== 334
|
//================== 334
|
||||||
20116, 20117, 20118, 20119, -1, 20121, 20122, 20123, 20016, 20017, 20018, -1, 20020, 20021, 20022, 20023,
|
20116, 20117, 20118, 20119, -1, 20121, 20122, 20123, 20016, 20017, 20018, -1, 20020, 20021, 20022, 20023,
|
||||||
//================== 379
|
//================== 379
|
||||||
-1 , 20001, 20002, 20003, 20004, 20005, -1, 20007, 20008, -1, 20010, 20011, 20012, 20013, 20014, 20015,
|
-1, 20001, 20002, 20003, 20004, 20005, -1, 20007, 20008, -1, 20010, 20011, 20012, 20013, 20014, 20015,
|
||||||
//================== 325
|
//================== 325
|
||||||
20100, 20101, 20102, 20103, 20104, 20105, 20106, 20107, 20108, 20109, 20110, 20111, 20112, -1, 20114, 20115,
|
20100, 20101, 20102, 20103, 20104, 20105, 20106, 20107, 20108, 20109, 20110, 20111, 20112, -1, 20114, 20115,
|
||||||
//================== 405
|
//================== 405
|
||||||
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
||||||
20006, -1, 30005, 20009, -1, 20120, 20000, 20019, 20113, 30000, 30004, 30001, 30002, -1, 30003, -1
|
20006, -1, 30005, 20009, -1, 20120, 20000, 20019, 20113, 30000, 30004, 30001, 30002, -1, 30003, -1};
|
||||||
};
|
|
||||||
|
|
||||||
//MCP moved from channel 1 to 2 after Run number 322
|
// MCP moved from channel 1 to 2 after Run number 322
|
||||||
//MCP and Rf moved to ch 0 and 1 after Run number after Run282
|
// MCP and Rf moved to ch 0 and 1 after Run number after Run282
|
||||||
//moved back to ch
|
// moved back to ch
|
||||||
void PrintMapping(){
|
void PrintMapping()
|
||||||
|
{
|
||||||
|
|
||||||
int digiID = 0;
|
int digiID = 0;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
printf("==================== ID-MAP: \n");
|
printf("==================== ID-MAP: \n");
|
||||||
printf("%11s|", ""); for(int i = 0 ; i < 16; i++ ) printf("%7d|", i);
|
printf("%11s|", "");
|
||||||
|
for (int i = 0; i < 16; i++)
|
||||||
|
printf("%7d|", i);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
for(int i = 0 ; i < 12 + 16*8; i++ ) printf("-");
|
for (int i = 0; i < 12 + 16 * 8; i++)
|
||||||
for(size_t i = 0 ; i < mapping.size(); i ++){
|
printf("-");
|
||||||
if( (i) % 16 == 0 ) {
|
for (size_t i = 0; i < mapping.size(); i++)
|
||||||
|
{
|
||||||
|
if ((i) % 16 == 0)
|
||||||
|
{
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
if( digiID < nBd ){
|
if (digiID < nBd)
|
||||||
if( board.at(digiID) > 1000 ) {
|
{
|
||||||
if( count == 3 ) digiID ++;
|
if (board.at(digiID) > 1000)
|
||||||
if( i % 64 == 0 ) {
|
{
|
||||||
|
if (count == 3)
|
||||||
|
digiID++;
|
||||||
|
if (i % 64 == 0)
|
||||||
|
{
|
||||||
printf("%11d|", board.at(digiID));
|
printf("%11d|", board.at(digiID));
|
||||||
count = 0;
|
count = 0;
|
||||||
}
|
}
|
||||||
}else{
|
}
|
||||||
if( count == 1 ) digiID ++;
|
else
|
||||||
if( i % 16 == 0 ) {
|
{
|
||||||
|
if (count == 1)
|
||||||
|
digiID++;
|
||||||
|
if (i % 16 == 0)
|
||||||
|
{
|
||||||
printf("%11d|", board.at(digiID));
|
printf("%11d|", board.at(digiID));
|
||||||
count = 0;
|
count = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( count != 0) printf("%11s|", "");
|
if (count != 0)
|
||||||
count ++;
|
printf("%11s|", "");
|
||||||
|
count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
int typeID = mapping[i] / 10000;
|
int typeID = mapping[i] / 10000;
|
||||||
int detID = (mapping[i] - typeID*10000 )/100;
|
int detID = (mapping[i] - typeID * 10000) / 100;
|
||||||
int ch = mapping[i] - typeID*10000 - detID * 100;
|
int ch = mapping[i] - typeID * 10000 - detID * 100;
|
||||||
|
|
||||||
if( mapping[i] == -1 ) {
|
if (mapping[i] == -1)
|
||||||
|
{
|
||||||
|
|
||||||
printf("%7s|", "");
|
printf("%7s|", "");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
}else{
|
if (typeID == 0)
|
||||||
|
{ // SX3
|
||||||
if( typeID == 0){ // SX3
|
|
||||||
|
|
||||||
printf("\033[36m%3d(%2d)\033[0m|", detID, ch);
|
printf("\033[36m%3d(%2d)\033[0m|", detID, ch);
|
||||||
|
}
|
||||||
}else if( typeID == 1){ // QQQ
|
else if (typeID == 1)
|
||||||
|
{ // QQQ
|
||||||
|
|
||||||
printf("\033[91m%3d(%2d)\033[0m|", detID, ch);
|
printf("\033[91m%3d(%2d)\033[0m|", detID, ch);
|
||||||
|
}
|
||||||
}else if( typeID == 2){ // PC
|
else if (typeID == 2)
|
||||||
|
{ // PC
|
||||||
|
|
||||||
printf("\033[35m%3d(%2d)\033[0m|", detID, ch);
|
printf("\033[35m%3d(%2d)\033[0m|", detID, ch);
|
||||||
|
}
|
||||||
}else if( typeID == 3){ // MISC
|
else if (typeID == 3)
|
||||||
|
{ // MISC
|
||||||
|
|
||||||
printf("\033[33m%3d(%2d)\033[0m|", detID, ch);
|
printf("\033[33m%3d(%2d)\033[0m|", detID, ch);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
for(int i = 0 ; i < 12 + 16*8; i++ ) printf("-");
|
for (int i = 0; i < 12 + 16 * 8; i++)
|
||||||
|
printf("-");
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GenMapping(std::string mapFile)
|
||||||
void GenMapping(std::string mapFile){
|
{
|
||||||
|
|
||||||
|
|
||||||
std::vector<int> map;
|
std::vector<int> map;
|
||||||
|
|
||||||
|
|
||||||
std::ifstream inputFile(mapFile); // Replace "your_file.txt" with the actual file path
|
std::ifstream inputFile(mapFile); // Replace "your_file.txt" with the actual file path
|
||||||
|
|
||||||
if (!inputFile.is_open()) {
|
if (!inputFile.is_open())
|
||||||
|
{
|
||||||
printf("Error: Could not open the file (%s).\n", mapFile.c_str());
|
printf("Error: Could not open the file (%s).\n", mapFile.c_str());
|
||||||
return ;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string line;
|
std::string line;
|
||||||
|
|
||||||
// Read the file line by line
|
// Read the file line by line
|
||||||
while (std::getline(inputFile, line)) {
|
while (std::getline(inputFile, line))
|
||||||
|
{
|
||||||
std::vector<std::string> words;
|
std::vector<std::string> words;
|
||||||
std::istringstream iss(line);
|
std::istringstream iss(line);
|
||||||
|
|
||||||
// Extract words from the current line
|
// Extract words from the current line
|
||||||
while (true) {
|
while (true)
|
||||||
|
{
|
||||||
std::string word;
|
std::string word;
|
||||||
if (!(iss >> word)) break; // Break if there are no more words
|
if (!(iss >> word))
|
||||||
|
break; // Break if there are no more words
|
||||||
|
|
||||||
word.erase(std::remove_if(word.begin(), word.end(), ::isspace), word.end());
|
word.erase(std::remove_if(word.begin(), word.end(), ::isspace), word.end());
|
||||||
words.push_back(word);
|
words.push_back(word);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( atoi(words[0].c_str()) % 16 == 0 ) printf("=================\n");
|
if (atoi(words[0].c_str()) % 16 == 0)
|
||||||
|
printf("=================\n");
|
||||||
|
|
||||||
|
int detID = atoi(words[1].c_str()) * 100;
|
||||||
int detID = atoi(words[1].c_str())*100;
|
if (words.size() < 5)
|
||||||
if(words.size() < 5 ) printf(" hahhahha %s\n", line.c_str());
|
printf(" hahhahha %s\n", line.c_str());
|
||||||
if( words[2] == "BARREL" ) {
|
if (words[2] == "BARREL")
|
||||||
if( words[3] == "FRONTDOWN" ){
|
{
|
||||||
|
if (words[3] == "FRONTDOWN")
|
||||||
|
{
|
||||||
int chID = atoi(words[4].c_str());
|
int chID = atoi(words[4].c_str());
|
||||||
if( chID % 2 != 0 ) chID -= 1;
|
if (chID % 2 != 0)
|
||||||
|
chID -= 1;
|
||||||
detID += chID;
|
detID += chID;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( words[3] == "FRONTUP" ){
|
if (words[3] == "FRONTUP")
|
||||||
|
{
|
||||||
int chID = atoi(words[4].c_str());
|
int chID = atoi(words[4].c_str());
|
||||||
if( chID % 2 == 0 ) chID += 1;
|
if (chID % 2 == 0)
|
||||||
|
chID += 1;
|
||||||
detID += chID;
|
detID += chID;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( words[3] == "BACK") detID += atoi(words[4].c_str()) + 8;
|
if (words[3] == "BACK")
|
||||||
|
detID += atoi(words[4].c_str()) + 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( words[2] == "FQQQ" ) {
|
if (words[2] == "FQQQ")
|
||||||
|
{
|
||||||
detID += 10000;
|
detID += 10000;
|
||||||
if( words[3] == "WEDGE") detID += atoi(words[4].c_str());
|
if (words[3] == "WEDGE")
|
||||||
if( words[3] == "RING") detID += atoi(words[4].c_str()) + 16;
|
detID += atoi(words[4].c_str());
|
||||||
|
if (words[3] == "RING")
|
||||||
|
detID += atoi(words[4].c_str()) + 16;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( words[2] == "PC" ) {
|
if (words[2] == "PC")
|
||||||
|
{
|
||||||
detID += 20000;
|
detID += 20000;
|
||||||
if( words[3] == "ANODE") detID += atoi(words[4].c_str());
|
if (words[3] == "ANODE")
|
||||||
if( words[3] == "CATHODE") detID += 100 + atoi(words[4].c_str());
|
detID += atoi(words[4].c_str());
|
||||||
|
if (words[3] == "CATHODE")
|
||||||
|
detID += 100 + atoi(words[4].c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
if( words[2] == "blank") {
|
if (words[2] == "blank")
|
||||||
|
{
|
||||||
detID = -1;
|
detID = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -242,29 +276,42 @@ void GenMapping(std::string mapFile){
|
||||||
int digiID = 0;
|
int digiID = 0;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
printf("===============================\n");
|
printf("===============================\n");
|
||||||
for( size_t i = 0; i < ((map.size() +15)/16) * 16; i++){
|
for (size_t i = 0; i < ((map.size() + 15) / 16) * 16; i++)
|
||||||
if( i % 16 == 0) {
|
{
|
||||||
|
if (i % 16 == 0)
|
||||||
|
{
|
||||||
printf("\n");
|
printf("\n");
|
||||||
if( digiID < nBd ){
|
if (digiID < nBd)
|
||||||
if( board.at(digiID) > 1000 ) {
|
{
|
||||||
if( count == 3 ) digiID ++;
|
if (board.at(digiID) > 1000)
|
||||||
if( i % 64 == 0 ) {
|
{
|
||||||
|
if (count == 3)
|
||||||
|
digiID++;
|
||||||
|
if (i % 64 == 0)
|
||||||
|
{
|
||||||
printf(" //================== %d\n", board.at(digiID));
|
printf(" //================== %d\n", board.at(digiID));
|
||||||
count = 0;
|
count = 0;
|
||||||
}
|
}
|
||||||
}else{
|
}
|
||||||
if( count == 1 ) digiID ++;
|
else
|
||||||
if( i % 16 == 0 ) {
|
{
|
||||||
|
if (count == 1)
|
||||||
|
digiID++;
|
||||||
|
if (i % 16 == 0)
|
||||||
|
{
|
||||||
printf(" //================== %d\n", board.at(digiID));
|
printf(" //================== %d\n", board.at(digiID));
|
||||||
count = 0;
|
count = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
count ++;
|
count++;
|
||||||
}
|
}
|
||||||
if( i < map.size() ){
|
if (i < map.size())
|
||||||
|
{
|
||||||
printf(" %5d,", map[i]);
|
printf(" %5d,", map[i]);
|
||||||
}else{
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
printf(" %5d,", -1);
|
printf(" %5d,", -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -273,13 +320,14 @@ void GenMapping(std::string mapFile){
|
||||||
printf("sorting mapping and see if there any repeated\n");
|
printf("sorting mapping and see if there any repeated\n");
|
||||||
std::sort(map.begin(), map.end());
|
std::sort(map.begin(), map.end());
|
||||||
|
|
||||||
for( size_t i = 1; i < map.size(); i++){
|
for (size_t i = 1; i < map.size(); i++)
|
||||||
if( map[i] == -1 ) continue;
|
{
|
||||||
if( map[i] == map[i-1] ) printf("%5d \n", map[i]);
|
if (map[i] == -1)
|
||||||
|
continue;
|
||||||
|
if (map[i] == map[i - 1])
|
||||||
|
printf("%5d \n", map[i]);
|
||||||
}
|
}
|
||||||
printf("=========== Done. if nothing show, no repeat. \n");
|
printf("=========== Done. if nothing show, no repeat. \n");
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -302,22 +302,22 @@
|
||||||
301 1 FQQQ RING 13
|
301 1 FQQQ RING 13
|
||||||
302 1 FQQQ RING 14
|
302 1 FQQQ RING 14
|
||||||
303 1 FQQQ RING 15
|
303 1 FQQQ RING 15
|
||||||
304 1 FQQQ WEDGE 15
|
304 1 FQQQ WEDGE 0
|
||||||
305 1 FQQQ WEDGE 14
|
305 1 FQQQ WEDGE 1
|
||||||
306 1 FQQQ WEDGE 13
|
306 1 FQQQ WEDGE 2
|
||||||
307 1 FQQQ WEDGE 12
|
307 1 FQQQ WEDGE 3
|
||||||
308 1 FQQQ WEDGE 11
|
308 1 FQQQ WEDGE 4
|
||||||
309 1 FQQQ WEDGE 10
|
309 1 FQQQ WEDGE 5
|
||||||
310 1 FQQQ WEDGE 9
|
310 1 FQQQ WEDGE 6
|
||||||
311 1 FQQQ WEDGE 8
|
311 1 FQQQ WEDGE 7
|
||||||
312 1 FQQQ WEDGE 7
|
312 1 FQQQ WEDGE 8
|
||||||
313 1 FQQQ WEDGE 6
|
313 1 FQQQ WEDGE 9
|
||||||
314 1 FQQQ WEDGE 5
|
314 1 FQQQ WEDGE 10
|
||||||
315 1 FQQQ WEDGE 4
|
315 1 FQQQ WEDGE 11
|
||||||
316 1 FQQQ WEDGE 3
|
316 1 FQQQ WEDGE 12
|
||||||
317 1 FQQQ WEDGE 2
|
317 1 FQQQ WEDGE 13
|
||||||
318 1 FQQQ WEDGE 1
|
318 1 FQQQ WEDGE 14
|
||||||
319 1 FQQQ WEDGE 0
|
319 1 FQQQ WEDGE 15
|
||||||
320 2 FQQQ RING 15
|
320 2 FQQQ RING 15
|
||||||
321 2 FQQQ RING 14
|
321 2 FQQQ RING 14
|
||||||
322 2 FQQQ RING 13
|
322 2 FQQQ RING 13
|
||||||
|
|
@ -366,22 +366,22 @@
|
||||||
365 2 FQQQ WEDGE 2
|
365 2 FQQQ WEDGE 2
|
||||||
366 2 FQQQ WEDGE 1
|
366 2 FQQQ WEDGE 1
|
||||||
367 2 FQQQ WEDGE 0
|
367 2 FQQQ WEDGE 0
|
||||||
368 3 FQQQ WEDGE 15
|
368 3 FQQQ WEDGE 0
|
||||||
369 3 FQQQ WEDGE 14
|
369 3 FQQQ WEDGE 1
|
||||||
370 3 FQQQ WEDGE 13
|
370 3 FQQQ WEDGE 2
|
||||||
371 3 FQQQ WEDGE 12
|
371 3 FQQQ WEDGE 3
|
||||||
372 3 FQQQ WEDGE 11
|
372 3 FQQQ WEDGE 4
|
||||||
373 3 FQQQ WEDGE 10
|
373 3 FQQQ WEDGE 5
|
||||||
374 3 FQQQ WEDGE 9
|
374 3 FQQQ WEDGE 6
|
||||||
375 3 FQQQ WEDGE 8
|
375 3 FQQQ WEDGE 7
|
||||||
376 3 FQQQ WEDGE 7
|
376 3 FQQQ WEDGE 8
|
||||||
377 3 FQQQ WEDGE 6
|
377 3 FQQQ WEDGE 9
|
||||||
378 3 FQQQ WEDGE 5
|
378 3 FQQQ WEDGE 10
|
||||||
379 3 FQQQ WEDGE 4
|
379 3 FQQQ WEDGE 11
|
||||||
380 3 FQQQ WEDGE 3
|
380 3 FQQQ WEDGE 12
|
||||||
381 3 FQQQ WEDGE 2
|
381 3 FQQQ WEDGE 13
|
||||||
382 3 FQQQ WEDGE 1
|
382 3 FQQQ WEDGE 14
|
||||||
383 3 FQQQ WEDGE 0
|
383 3 FQQQ WEDGE 15
|
||||||
384 3 FQQQ RING 0
|
384 3 FQQQ RING 0
|
||||||
385 3 FQQQ RING 1
|
385 3 FQQQ RING 1
|
||||||
386 3 FQQQ RING 2
|
386 3 FQQQ RING 2
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user