bug fix on Mapper

This commit is contained in:
splitPoleDAQ 2024-03-22 18:45:13 -04:00
parent 4627125105
commit 88baa6a7dc
8 changed files with 87 additions and 54 deletions

View File

@ -23,8 +23,8 @@ int padID = 0;
void Analyzer::Begin(TTree * /*tree*/){ void Analyzer::Begin(TTree * /*tree*/){
TString option = GetOption(); TString option = GetOption();
hsx3IndexVE = new TH2F("hsx3IndexVE", "SX3 index vs Energy; sx3 index ; Energy", 24*12, 0, 24*12, 400, 0, 500); hsx3IndexVE->SetNdivisions( -612, "x"); hsx3IndexVE = new TH2F("hsx3IndexVE", "SX3 index vs Energy; sx3 index ; Energy", 24*12, 0, 24*12, 400, 0, 5000); hsx3IndexVE->SetNdivisions( -612, "x");
hqqqIndexVE = new TH2F("hqqqIndexVE", "QQQ index vs Energy; QQQ index ; Energy", 4*2*16, 0, 4*2*16, 400, 0, 500); hqqqIndexVE->SetNdivisions( -1204, "x"); hqqqIndexVE = new TH2F("hqqqIndexVE", "QQQ index vs Energy; QQQ index ; Energy", 4*2*16, 0, 4*2*16, 400, 0, 5000); hqqqIndexVE->SetNdivisions( -1204, "x");
hpcIndexVE = new TH2F("hpcIndexVE", "PC index vs Energy; PC index ; Energy", 2*24, 0, 2*24, 400, 0, 4000); hpcIndexVE->SetNdivisions( -1204, "x"); hpcIndexVE = new TH2F("hpcIndexVE", "PC index vs Energy; PC index ; Energy", 2*24, 0, 2*24, 400, 0, 4000); hpcIndexVE->SetNdivisions( -1204, "x");
@ -173,7 +173,7 @@ void Analyzer::Terminate(){
//=============================================== pad-7 //=============================================== pad-7
padID ++; canvas->cd(padID); canvas->cd(padID)->SetGrid(1); padID ++; canvas->cd(padID); canvas->cd(padID)->SetGrid(1);
canvas->cd(padID)->DrawFrame(-50, -50, 50, 50); hsx3VpcIndex ->Draw("colz");
hqqqPolar->Draw("same colz pol");
} }

View File

@ -15,6 +15,9 @@ public:
unsigned short e[MAXMULTI]; unsigned short e[MAXMULTI];
unsigned long long t[MAXMULTI]; unsigned long long t[MAXMULTI];
unsigned short sn[MAXMULTI];
unsigned short digiCh[MAXMULTI];
unsigned short index[MAXMULTI]; // id * nCh + ch; unsigned short index[MAXMULTI]; // id * nCh + ch;
bool used[MAXMULTI]; bool used[MAXMULTI];
@ -26,6 +29,8 @@ public:
e[i] = 0; e[i] = 0;
t[i] = 0; t[i] = 0;
index[i] = 0; index[i] = 0;
sn[i] = 0;
digiCh[i] = 0;
used[i] = false; used[i] = false;
} }
} }

View File

@ -40,6 +40,7 @@ public:
TVector3 GetTrackVec() const {return trackVec;} TVector3 GetTrackVec() const {return trackVec;}
double GetTrackTheta() const {return trackVec.Theta();} double GetTrackTheta() const {return trackVec.Theta();}
double GetTrackPhi() const {return trackVec.Phi();} double GetTrackPhi() const {return trackVec.Phi();}
double GetZ0();
int GetNumWire() const {return nWire;} int GetNumWire() const {return nWire;}
double GetDeltaAngle() const {return dAngle;} double GetDeltaAngle() const {return dAngle;}
@ -117,7 +118,7 @@ inline void PW::ConstructGeo(){
std::pair<TVector3, TVector3> p1; // anode std::pair<TVector3, TVector3> p1; // anode
std::pair<TVector3, TVector3> q1; // cathode std::pair<TVector3, TVector3> q1; // cathode
//anode and cathode start at pos-Y axis and count in left-Hand //anode and cathode start at pos-Y axis and count in right-Hand
//anode wire shift is right-hand. //anode wire shift is right-hand.
//cathode wire shift is left-hand. //cathode wire shift is left-hand.
@ -267,4 +268,16 @@ inline void PW::CalTrack2(TVector3 sx3Pos, PWHitInfo hitInfo, double sigmaA, dou
if( verbose ) printf("Theta, Phi = %f, %f \n", trackVec.Theta() *TMath::RadToDeg(), trackVec.Phi()*TMath::RadToDeg()); if( verbose ) printf("Theta, Phi = %f, %f \n", trackVec.Theta() *TMath::RadToDeg(), trackVec.Phi()*TMath::RadToDeg());
} }
inline double PW::GetZ0(){
double x = trackPos.X();
double y = trackPos.Y();
double rho = TMath::Sqrt(x*x + y*y);
double theta = trackVec.Theta();
return trackPos.Z() - rho / TMath::Tan(theta);
}
#endif #endif

View File

@ -7,7 +7,7 @@
#include <TMath.h> #include <TMath.h>
#include <TBenchmark.h> #include <TBenchmark.h>
#include "../mapping.h" #include "../mapping_alpha.h"
#include "ClassDet.h" #include "ClassDet.h"
//=============================== //===============================
@ -112,15 +112,24 @@ int main(int argc, char **argv){
qqq.multi = 0; qqq.multi = 0;
pc.multi = 0; pc.multi = 0;
qqq.Clear();
for( unsigned int i = 0; i < multi; i++){ for( unsigned int i = 0; i < multi; i++){
//printf("%10u/%10u| %5d, %2u, %6u, %14llu\n", i, multi, sn[i], ch[i], e[i], e_t[i] ); //printf("%10u/%10u| %5d, %2u, %6u, %14llu\n", i, multi, sn[i], ch[i], e[i], e_t[i] );
int globalCh = ch[i];
//globalCh = digi-ID * nCh(digi-iD) + ch
int globalCh = -1;
for( int j = 0; j < nBd; j++){ for( int j = 0; j < nBd; j++){
if( board.at(j) == sn[i]){ if( board.at(j) == sn[i]){
globalCh += sn[i] > 1000 ? j * 64 : 7*64 + (j-7) * 16; globalCh = (sn[i] > 1000 ? j * 64 : 7*64 + (j-7) * 16) + ch[i]; //& = number V1740
break;
} }
} }
if( globalCh == -1) printf("ev %llu\n", ev);
unsigned short ID = mapping[globalCh]; unsigned short ID = mapping[globalCh];
//=================================== sx3 //=================================== sx3

View File

@ -28,21 +28,22 @@ int main(int argc, char **argv){
transfer.SetA(24,12, 0); transfer.SetA(24,12, 0);
transfer.SetIncidentEnergyAngle(10, 0, 0); transfer.SetIncidentEnergyAngle(10, 0, 0);
transfer.Seta( 4, 2); transfer.Seta( 4, 2);
transfer.Setb( 1, 1); transfer.Setb( 1, 1);
//TODO add alpha source
std::vector<float> ExAList = {0}; std::vector<float> ExAList = {0};
std::vector<float> ExList = {0, 1, 2}; std::vector<float> ExList = {0, 1, 2};
double vertexXRange[2] = { -5,5}; // mm double vertexXRange[2] = { -5, 5}; // mm
double vertexYRange[2] = { -5,5}; double vertexYRange[2] = { -5, 5};
double vertexZRange[2] = {-100,100}; double vertexZRange[2] = { -100, 100};
double sigmaSX3_W = -1; // mm, < 0 use mid-point double sigmaSX3_W = -1; // mm, < 0 use mid-point
double sigmaSX3_L = 5; // mm, < 0 use mid-point double sigmaSX3_L = 3; // mm, < 0 use mid-point
double sigmaPW_A = 3; // from 0 to 1. double sigmaPW_A = 0; // from 0 to 1.
double sigmaPW_C = 3; // from 0 to 1. double sigmaPW_C = 0; // from 0 to 1.
//################################################### //###################################################
@ -55,7 +56,7 @@ int main(int argc, char **argv){
printf(" SX3 vertical : %.1f\n", sigmaSX3_L); printf(" SX3 vertical : %.1f\n", sigmaSX3_L);
printf(" Anode : %.1f mm\n", sigmaPW_A); printf(" Anode : %.1f mm\n", sigmaPW_A);
printf(" Cathode : %.1f mm\n", sigmaPW_C); printf(" Cathode : %.1f mm\n", sigmaPW_C);
printf(" num_eve : %.1d ",numEvent); printf(" num_eve : %d \n",numEvent);
transfer.CalReactionConstant(); transfer.CalReactionConstant();
int nExA = ExAList.size(); int nExA = ExAList.size();
@ -130,6 +131,9 @@ int main(int argc, char **argv){
tree->Branch("reTheta1", &reTheta1, "reconstucted_theta1/D"); tree->Branch("reTheta1", &reTheta1, "reconstucted_theta1/D");
tree->Branch("rePhi1", &rePhi1, "reconstucted_phi1/D"); tree->Branch("rePhi1", &rePhi1, "reconstucted_phi1/D");
double z0;
tree->Branch("z0", &z0, "reconstucted_Z/D");
//========timer //========timer
TBenchmark clock; TBenchmark clock;
@ -217,6 +221,8 @@ int main(int argc, char **argv){
reTheta1 = pw->GetTrackTheta() * TMath::RadToDeg(); reTheta1 = pw->GetTrackTheta() * TMath::RadToDeg();
rePhi1 = pw->GetTrackPhi() * TMath::RadToDeg(); rePhi1 = pw->GetTrackPhi() * TMath::RadToDeg();
z0 = pw->GetZ0();
}else{ }else{
sx3Up = -1; sx3Up = -1;
sx3Dn = -1; sx3Dn = -1;
@ -237,6 +243,8 @@ int main(int argc, char **argv){
reTheta1 = TMath::QuietNaN(); reTheta1 = TMath::QuietNaN();
rePhi1 = TMath::QuietNaN(); rePhi1 = TMath::QuietNaN();
z0 = TMath::QuietNaN();
} }
tree->Fill(); tree->Fill();

View File

@ -24,7 +24,7 @@ void PreAnalysis::Begin(TTree * /*tree*/){
for( int i = 0; i < nBd; i++){ for( int i = 0; i < nBd; i++){
if( board.at(i) > 1000) { if( board.at(i) > 1000) {
hRate[i] = new TH2F(Form("hRate%d", board.at(i)), Form("Digi-%d; ch; sec", board.at(i)), 64, 0, 64, 100, 0, 100); hRate[i] = new TH2F(Form("hRate%d", board.at(i)), Form("Digi-%d; ch; sec", board.at(i)), 64, 0, 64, 100, 0, 100);
hEnergy[i] = new TH2F(Form("hEnergy%d", board.at(i)), Form("Digi-%d; ch; raw E", board.at(i)), 64, 0, 64, 400, 0, 500); hEnergy[i] = new TH2F(Form("hEnergy%d", board.at(i)), Form("Digi-%d; ch; raw E", board.at(i)), 64, 0, 64, 400, 0, 5000);
}else{ }else{
hRate[i] = new TH2F(Form("hRate%d", board.at(i)), Form("Digi-%d; ch; sec", board.at(i)), 16, 0, 16, 100, 0, 100); hRate[i] = new TH2F(Form("hRate%d", board.at(i)), Form("Digi-%d; ch; sec", board.at(i)), 16, 0, 16, 100, 0, 100);
hEnergy[i] = new TH2F(Form("hEnergy%d", board.at(i)), Form("Digi-%d; ch; raw E", board.at(i)), 16, 0, 16, 400, 0, 5000); hEnergy[i] = new TH2F(Form("hEnergy%d", board.at(i)), Form("Digi-%d; ch; raw E", board.at(i)), 16, 0, 16, 400, 0, 5000);

View File

@ -9,15 +9,15 @@ fi
runID=$1 runID=$1
timeWindow=$2 timeWindow=$2
rawFolder=/media/nvmeData/ANASEN_test rawFolder=/media/nvmeData/ANASEN_test/analysis/data
rootFolder=/media/nvmeData/ANASEN_test/root_data rootFolder=/media/nvmeData/ANASEN_test/root_data
fileList=`\ls -1 ${rawFolder}/*${runID}*.fsu` fileList=`\ls -1 ${rawFolder}/*${runID}*.fsu`
./EventBuilderNoTrace ${timeWindow} 0 ${fileList} ./EventBuilder ${timeWindow} 0 0 500000 ${fileList}
outFile=${rawFolder}/*${runID}*${timeWindow}_noTrace.root outFile=${rawFolder}/*${runID}*${timeWindow}.root
mv -vf ${outFile} ${rootFolder}/. mv -vf ${outFile} ${rootFolder}/.
./Mapper ${rootFolder}/*${runID}*${timeWindow}_noTrace.root ./Mapper ${rootFolder}/*${runID}*${timeWindow}.root

View File

@ -39,48 +39,47 @@ const int nV1725 = 3;
// use the GenMapping() to get that // use the GenMapping() to get that
const std::vector<int> mapping = { const std::vector<int> mapping = {
//================== 17122 //================== 17122
206, 207, 204, 205, 203, 202, 201, 200, 406, 407, 404, 405, 403, 402, 401, 400,
6, 7, 4, 5, 3, 2, 1, 0, 506, 507, 504, 505, 503, 502, 501, 500,
111, 110, 109, 108, 211, 210, 209, 208, 311, 310, 309, 308, 411, 410, 409, 408,
106, 107, 104, 105, 103, 102, 101, 100, 306, 307, 304, 305, 303, 302, 301, 300,
//================== 17123
606, 607, 604, 605, 603, 602, 601, 600, 1106, 1107, 1104, 1105, 1103, 1102, 1101, 1100,
711, 710, 709, 708, 811, 810, 809, 808, 911, 910, 909, 908, 1011, 1010, 1009, 1008,
706, 707, 704, 705, 703, 702, 701, 700, 906, 907, 904, 905, 903, 902, 901, 900,
806, 807, 804, 805, 803, 802, 801, 800, 1006, 1007, 1004, 1005, 1003, 1002, 1001, 1000, 806, 807, 804, 805, 803, 802, 801, 800, 1006, 1007, 1004, 1005, 1003, 1002, 1001, 1000,
//================== 22320 606, 607, 604, 605, 603, 602, 601, 600, 1106, 1107, 1104, 1105, 1103, 1102, 1101, 1100,
1911, 1910, 1909, 1908, 2011, 2010, 2009, 2008, 2111, 2110, 2109, 2108, 2211, 2210, 2209, 2208, 711, 710, 709, 708, 911, 910, 909, 908, 1011, 1010, 1009, 1008, 811, 810, 809, 808,
1906, 1907, 1904, 1905, 1903, 1902, 1901, 1900, 2106, 2107, 2104, 2105, 2103, 2102, 2101, 2100, 706, 707, 704, 705, 703, 702, 701, 700, 906, 907, 904, 905, 903, 902, 901, 900,
1806, 1807, 1804, 1805, 1803, 1802, 1801, 1800, 2306, 2307, 2304, 2305, 2303, 2302, 2301, 2300, //================== 17123
2006, 2007, 2004, 2005, 2003, 2002, 2001, 2000, 2206, 2207, 2204, 2205, 2203, 2202, 2201, 2200,
//================== 22130
1311, 1310, 1309, 1308, 1411, 1410, 1409, 1408, 1511, 1510, 1509, 1508, 1611, 1610, 1609, 1608,
11, 10, 9, 8, 511, 510, 509, 508, 611, 610, 609, 608, 1111, 1110, 1109, 1108,
1406, 1407, 1404, 1405, 1403, 1402, 1401, 1400, 1606, 1607, 1604, 1605, 1603, 1602, 1601, 1600, 1406, 1407, 1404, 1405, 1403, 1402, 1401, 1400, 1606, 1607, 1604, 1605, 1603, 1602, 1601, 1600,
1306, 1307, 1304, 1305, 1303, 1302, 1301, 1300, 1506, 1507, 1504, 1505, 1503, 1502, 1501, 1500, 1306, 1307, 1304, 1305, 1303, 1302, 1301, 1300, 1706, 1707, 1704, 1705, 1703, 1702, 1701, 1700,
1311, 1310, 1309, 1308, 1711, 1710, 1709, 1708, 1611, 1610, 1609, 1608, 1411, 1410, 1409, 1408,
1206, 1207, 1204, 1205, 1203, 1202, 1201, 1200, 1506, 1507, 1504, 1505, 1503, 1502, 1501, 1500,
//================== 22320
111, 110, 109, 108, 311, 310, 309, 308, 411, 410, 409, 408, 211, 210, 209, 208,
6, 7, 4, 5, 3, 2, 1, 0, 506, 507, 504, 505, 503, 502, 501, 500,
206, 207, 204, 205, 203, 202, 201, 200, 406, 407, 404, 405, 403, 402, 401, 400,
106, 107, 104, 105, 103, 102, 101, 100, 306, 307, 304, 305, 303, 302, 301, 300,
//================== 22130
1911, 1910, 1909, 1908, 2111, 2110, 2109, 2108, 2211, 2210, 2209, 2208, 2011, 2010, 2009, 2008,
11, 10, 9, 8, 511, 510, 509, 508, 611, 610, 609, 608, 1111, 1110, 1109, 1108,
1806, 1807, 1804, 1805, 1803, 1802, 1801, 1800, 2206, 2207, 2204, 2205, 2203, 2202, 2201, 2200,
1906, 1907, 1904, 1905, 1903, 1902, 1901, 1900, 2106, 2107, 2104, 2105, 2103, 2102, 2101, 2100,
//================== 22129 //================== 22129
10015, 10014, 10013, 10012, 10011, 10010, 10009, 10008, 10007, 10006, 10005, 10004, 10003, 10002, 10001, 10000,
1206, 1207, 1204, 1205, 1203, 1202, 1201, 1200, 1706, 1707, 1704, 1705, 1703, 1702, 1701, 1700,
10115, 10114, 10113, 10112, 10111, 10110, 10109, 10108, 10107, 10106, 10105, 10104, 10103, 10102, 10101, 10100,
10116, 10117, 10118, 10119, 10120, 10121, 10122, 10123, 10124, 10125, 10126, 10127, 10128, 10129, 10130, 10131,
//================== 15529
10016, 10017, 10018, 10019, 10020, 10021, 10022, 10023, 10024, 10025, 10026, 10027, 10028, 10029, 10030, 10031, 10016, 10017, 10018, 10019, 10020, 10021, 10022, 10023, 10024, 10025, 10026, 10027, 10028, 10029, 10030, 10031,
10215, 10214, 10213, 10212, 10211, 10210, 10209, 10208, 10207, 10206, 10205, 10204, 10203, 10202, 10201, 10200, 2006, 2007, 2004, 2005, 2003, 2002, 2001, 2000, 2306, 2307, 2304, 2305, 2303, 2302, 2301, 2300,
10216, 10217, 10218, 10219, 10220, 10221, 10222, 10223, 10224, 10225, 10226, 10227, 10228, 10229, 10230, 10231, 10116, 10117, 10118, 10119, 10120, 10121, 10122, 10123, 10124, 10125, 10126, 10127, 10128, 10129, 10130, 10131,
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,
//================== 15528 //================== 15529
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
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,
10015, 10014, 10013, 10012, 10011, 10010, 10009, 10008, 10007, 10006, 10005, 10004, 10003, 10002, 10001, 10000,
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,
//================== 15528
10216, 10217, 10218, 10219, 10220, 10221, 10222, 10223, 10224, 10225, 10226, 10227, 10228, 10229, 10230, 10231,
-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,
-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,
//================== 379 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
//================== 334
20116, 20117, 20118, 20119, 20120, 20121, 20122, 20123, 20016, 20017, 20018, 20019, 20020, 20021, 20022, 20023, 20116, 20117, 20118, 20119, 20120, 20121, 20122, 20123, 20016, 20017, 20018, 20019, 20020, 20021, 20022, 20023,
//================== 409 //================== 409
20000, 20001, 20002, 20003, 20004, 20005, 20006, 20007, 20008, 20009, 20010, 20011, 20012, 20013, 20014, 20015, 20000, 20001, 20002, 20003, 20004, 20005, 20006, 20007, 20008, 20009, 20010, 20011, 20012, 20013, 20014, 20015,
//================== 405 //================== 405
20100, 20101, 20102, 20103, 20104, 20105, 20106, 20107, 20108, 20109, 20110, 20111, 20112, 20113, 20114, 20115, 20100, 20101, 20102, 20103, 20104, 20105, 20106, 20107, 20108, 20109, 20110, 20111, 20112, 20113, 20114, 20115
}; };
@ -183,10 +182,9 @@ void GenMapping(std::string mapFile){
if( atoi(words[0].c_str()) % 16 == 0 ) printf("=================\n"); if( atoi(words[0].c_str()) % 16 == 0 ) printf("=================\n");
for( size_t i = 0; i < words.size(); i++) printf("|%9s", words[i].c_str());
int detID = atoi(words[1].c_str())*100; int detID = atoi(words[1].c_str())*100;
if(words.size() < 5 ) 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());