diff --git a/.gitignore b/.gitignore index 3f2c5b7..f62e6ef 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,10 @@ EventBuilder* *.so *.pcm *.root +*.exe Mapper -AnasenMS \ No newline at end of file +AnasenMS + +data/ +data_proton/ diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json index 28dee82..5c4c535 100644 --- a/.vscode/c_cpp_properties.json +++ b/.vscode/c_cpp_properties.json @@ -36,6 +36,18 @@ "cStandard": "c17", "cppStandard": "gnu++17", "intelliSenseMode": "linux-gcc-x64" + }, + { + "name": "Dirac", + "includePath": [ + "${workspaceFolder}/**", + "/usr/opt/root/**" + ], + "defines": [], + "compilerPath": "/usr/bin/gcc", + "cStandard": "c17", + "cppStandard": "gnu++17", + "intelliSenseMode": "linux-gcc-x64" } ], "version": 4 diff --git a/.vscode/settings.json b/.vscode/settings.json index daae08a..147eb32 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -86,6 +86,10 @@ "regex": "cpp", "scoped_allocator": "cpp", "shared_mutex": "cpp", - "valarray": "cpp" + "valarray": "cpp", + "processRun.C": "cpp", + "TrackRecon.C": "cpp", + "processRuns.C": "cpp", + "Analysis.C": "cpp" } } \ No newline at end of file diff --git a/Analysis.C b/Analysis.C new file mode 100644 index 0000000..d646366 --- /dev/null +++ b/Analysis.C @@ -0,0 +1,20 @@ +#include "TChain.h" +#include + + + +void Analysis(int start, int end) { + // Create a TChain + TChain *chain = new TChain("tree"); + for(int i = start; i < end+1; i++) { + chain->Add(Form("data/root_data/Run_%03d_mapped.root", i)); + } + + // Process the chain using Analyzer.C+ + chain->Process("Analyzer.C+"); +} + +// Define a macro with the same name as the script +void Analysis() { + Analysis(72, 194); // Adjust the range if needed +} \ No newline at end of file diff --git a/Analyzer.C b/Analyzer.C index fcdc313..7394293 100644 --- a/Analyzer.C +++ b/Analyzer.C @@ -6,6 +6,14 @@ #include #include +#include +#include + +#include "Armory/ClassSX3.h" +#include "Armory/ClassPW.h" + +#include "TVector3.h" + TH2F * hsx3IndexVE; TH2F * hqqqIndexVE; TH2F * hpcIndexVE; @@ -16,9 +24,18 @@ TH2F * hpcCoin; TH2F * hqqqPolar; TH2F * hsx3VpcIndex; - +TH2F * hqqqVpcIndex; +TH2F * hqqqVpcE; +TH2F * hsx3VpcE; +TH2F * hanVScatsum; int padID = 0; +SX3 sx3_contr; +PW pw_contr; +TVector3 hitPos; +bool HitNonZero; + +TH1F * hZProj; void Analyzer::Begin(TTree * /*tree*/){ TString option = GetOption(); @@ -37,11 +54,37 @@ void Analyzer::Begin(TTree * /*tree*/){ hsx3VpcIndex = new TH2F("hsx3Vpcindex", "sx3 vs pc; sx3 index; pc index", 24*12, 0, 24*12, 48, 0, 48); hsx3VpcIndex->SetNdivisions( -612, "x"); hsx3VpcIndex->SetNdivisions( -12, "y"); + hqqqVpcIndex = new TH2F("hqqqVpcindex", "qqq vs pc; qqq index; pc index", 4*2*16, 0, 4*2*16, 48, 0, 48); + hqqqVpcIndex->SetNdivisions( -612, "x"); + hqqqVpcIndex->SetNdivisions( -12, "y"); + + hqqqVpcE = new TH2F("hqqqVpcEnergy", "qqq vs pc; qqq energy; pc energy", 400, 0, 5000, 400, 0, 5000); + hqqqVpcE->SetNdivisions( -612, "x"); + hqqqVpcE->SetNdivisions( -12, "y"); + + hsx3VpcE = new TH2F("hsx3VpcEnergy", "sx3 vs pc; sx3 energy; pc energy", 400, 0, 5000, 400, 0, 5000); + hsx3VpcE->SetNdivisions( -612, "x"); + hsx3VpcE->SetNdivisions( -12, "y"); + + hZProj = new TH1F("hZProj", "Z Projection", 200, -600, 600); + + hanVScatsum = new TH2F("hanVScatsum", "Anode vs Cathode Sum; Anode E; Cathode E", 400,0 , 10000, 400, 0 , 16000); + + sx3_contr.ConstructGeo(); + pw_contr.ConstructGeo(); } + + + Bool_t Analyzer::Process(Long64_t entry){ + // if ( entry > 100 ) return kTRUE; + + hitPos.Clear(); + HitNonZero = false; + // if( entry > 1) return kTRUE; // printf("################### ev : %llu \n", entry); @@ -69,7 +112,10 @@ Bool_t Analyzer::Process(Long64_t entry){ //########################################################### Raw data // //======================= SX3 + + std::vector> ID; // first = id, 2nd = index for( int i = 0; i < sx3.multi; i ++){ + ID.push_back(std::pair(sx3.id[i], i)); hsx3IndexVE->Fill( sx3.index[i], sx3.e[i] ); @@ -79,49 +125,208 @@ Bool_t Analyzer::Process(Long64_t entry){ for( int j = 0; j < pc.multi; j++){ hsx3VpcIndex->Fill( sx3.index[i], pc.index[j] ); + // if( sx3.ch[index] > 8 ){ + // hsx3VpcE->Fill( sx3.e[i], pc.e[j] ); + // } } } + + if( ID.size() > 0 ){ + std::sort(ID.begin(), ID.end(), [](const std::pair & a, const std::pair & b) { + return a.first < b.first; + } ); + // printf("##############################\n"); + // for( size_t i = 0; i < ID.size(); i++) printf("%zu | %d %d \n", i, ID[i].first, ID[i].second ); + + std::vector> sx3ID; + sx3ID.push_back(ID[0]); + bool found = false; + for( size_t i = 1; i < ID.size(); i++){ + if( ID[i].first == sx3ID.back().first) { + sx3ID.push_back(ID[i]); + if( sx3ID.size() >= 3) { + found = true; + } + }else{ + if( !found ){ + sx3ID.clear(); + sx3ID.push_back(ID[i]); + } + } + } + + // printf("---------- sx3ID Multi : %zu \n", sx3ID.size()); + + if( found ){ + int sx3ChUp, sx3ChDn, sx3ChBk; + float sx3EUp, sx3EDn; + // printf("------ sx3 ID : %d, multi: %zu\n", sx3ID[0].first, sx3ID.size()); + for( size_t i = 0; i < sx3ID.size(); i++ ){ + int index = sx3ID[i].second; + // printf(" %zu | index %d | ch : %d, energy : %d \n", i, index, sx3.ch[index], sx3.e[index]); + + + if( sx3.ch[index] < 8 ){ + if( sx3.ch[index] % 2 == 0) { + sx3ChDn = sx3.ch[index]; + sx3EDn = sx3.e[index]; + }else{ + sx3ChUp = sx3.ch[index]; + sx3EUp = sx3.e[index]; + } + }else{ + sx3ChBk = sx3.ch[index]; + } + for( int j = 0; j < pc.multi; j++){ + // hsx3VpcIndex->Fill( sx3.index[i], pc.index[j] ); + if( sx3.ch[index] > 8 ){ + hsx3VpcE->Fill( sx3.e[i], pc.e[j] ); + // hpcIndexVE->Fill( pc.index[i], pc.e[i] ); + } + } + } + + sx3_contr.CalSX3Pos(sx3ID[0].first, sx3ChUp, sx3ChDn, sx3ChBk, sx3EUp, sx3EDn); + hitPos = sx3_contr.GetHitPos(); + HitNonZero = true; + // hitPos.Print(); + } + + } + + // //======================= QQQ for( int i = 0; i < qqq.multi; i ++){ - hqqqIndexVE->Fill( qqq.index[i], qqq.e[i] ); + // for( int j = 0; j < pc.multi; j++){ + // if(pc.index[j]==4){ + hqqqIndexVE->Fill( qqq.index[i], qqq.e[i] ); + // } + // } + for( int j = 0; j < qqq.multi; j++){ + if ( j == i ) continue; + hqqqCoin->Fill( qqq.index[i], qqq.index[j]); + } + for( int j = i + 1; j < qqq.multi; j++){ - hqqqCoin->Fill( qqq.index[i], qqq.index[j]); + for( int k = 0; k < pc.multi; k++){ + if(pc.index[k]<24 && pc.e[k]>50 ){ + hqqqVpcE->Fill( qqq.e[i], pc.e[k] ); + // hpcIndexVE->Fill( pc.index[i], pc.e[i] ); + hqqqVpcIndex->Fill( qqq.index[i], pc.index[j] ); - if( qqq.used[i] == true ) continue; + } + // } + } + // if( qqq.used[i] == true ) continue; - if( qqq.id[i] == qqq.id[j] && (16 - qqq.ch[i]) * (16 - qqq.ch[j]) < 0 ){ // must be same detector and wedge and ring + //if( qqq.id[i] == qqq.id[j] && (16 - qqq.ch[i]) * (16 - qqq.ch[j]) < 0 ){ // must be same detector and wedge and ring + if( qqq.id[i] == qqq.id[j] ){ // must be same detector - int chWedge = qqq.ch[i]; - int chRing = qqq.ch[j] - 16; - if( qqq.ch[i] >= 16 ) { - chWedge = qqq.ch[j]; - chRing = qqq.ch[i] - 16; + int chWedge = -1; + int chRing = -1; + if( qqq.ch[i] < qqq.ch[j]){ + chRing = qqq.ch[j] - 16; + chWedge = qqq.ch[i]; + }else{ + chRing = qqq.ch[i]; + chWedge = qqq.ch[j] - 16; } - //printf(" ID : %d , chWedge : %d, chRing : %d \n", qqq.id[i], chWedge, chRing); + // printf(" ID : %d , chWedge : %d, chRing : %d \n", qqq.id[i], chWedge, chRing); - double theta = -TMath::Pi() + 2*TMath::Pi()/16/4.*(qqq.id[i]*16 + chWedge +0.5); + double theta = -TMath::Pi()/2 + 2*TMath::Pi()/16/4.*(qqq.id[i]*16 + chWedge +0.5); double rho = 10.+40./16.*(chRing+0.5); - + // if(qqq.e[i]>50){ hqqqPolar->Fill( theta, rho); + // } + // qqq.used[i] = true; + // qqq.used[j] = true; - qqq.used[i] = true; - qqq.used[j] = true; - + if( !HitNonZero ){ + double x = rho * TMath::Cos(theta); + double y = rho * TMath::Sin(theta); + hitPos.SetXYZ(x, y, 23 + 75 + 30); + HitNonZero = true; + } } } + + } - // //======================= PC + + ID.clear(); + int counter=0; + std::vector> E; + E.clear(); for( int i = 0; i < pc.multi; i ++){ + + if( pc.e[i] > 100 ) ID.push_back(std::pair(pc.id[i], i)); + if( pc.e[i] > 100 ) E.push_back(std::pair(pc.index[i], pc.e[i])); + hpcIndexVE->Fill( pc.index[i], pc.e[i] ); for( int j = i+1; j < pc.multi; j++){ hpcCoin->Fill( pc.index[i], pc.index[j]); + } + } + // for( size_t i = 0; i < E.size(); i++) printf("%zu | %d %d \n", i, E[i].first, E[i].second ); + + if( E.size()>=3 ){ + + int aID = 0; + int cID = 0; + + float aE = 0; + float cE = 0; + bool multi_an =false; + // if( ID[0].first < 1 ) { + // aID = pc.ch[ID[0].second]; + // cID = pc.ch[ID[1].second]; + // }else{ + // cID = pc.ch[ID[0].second]; + // aID = pc.ch[ID[1].second]; + // } + // printf("anode= %d, cathode = %d\n", aID, cID); + + // for( int k = 0; k < qqq.multi; k++){ + // if(qqq.index[k]==75 && pc.index[k]==2 && pc.e[k]>100){ + for(int l=0;lFill(aE,cE); + + if( ID[0].first < 1 ) { + aID = pc.ch[ID[0].second]; + cID = pc.ch[ID[1].second]; + }else{ + cID = pc.ch[ID[0].second]; + aID = pc.ch[ID[1].second]; + } + + if( HitNonZero){ + pw_contr.CalTrack( hitPos, aID, cID); + hZProj->Fill(pw_contr.GetZ0()); + } + + + } + + //########################################################### Track constrcution @@ -135,7 +340,7 @@ Bool_t Analyzer::Process(Long64_t entry){ void Analyzer::Terminate(){ gStyle->SetOptStat("neiou"); - TCanvas * canvas = new TCanvas("cANASEN", "ANASEN", 1000, 1000); + TCanvas * canvas = new TCanvas("cANASEN", "ANASEN", 2000, 2000); canvas->Divide(3,3); //hsx3VpcIndex->Draw("colz"); @@ -163,6 +368,8 @@ void Analyzer::Terminate(){ //=============================================== pad-5 padID ++; canvas->cd(padID); canvas->cd(padID)->SetGrid(1); + canvas->cd(padID)->SetLogz(true); + hqqqCoin->Draw("colz"); //=============================================== pad-6 @@ -173,7 +380,23 @@ void Analyzer::Terminate(){ //=============================================== pad-7 padID ++; canvas->cd(padID); canvas->cd(padID)->SetGrid(1); - hsx3VpcIndex ->Draw("colz"); + // hsx3VpcIndex ->Draw("colz"); + hsx3VpcE->Draw("colz") ; + //=============================================== pad-8 + padID ++; canvas->cd(padID); canvas->cd(padID)->SetGrid(1); + + // hqqqVpcIndex ->Draw("colz"); + + hqqqVpcE ->Draw("colz"); + //=============================================== pad-9 + padID ++; + + // canvas->cd(padID)->DrawFrame(-50, -50, 50, 50); + // hqqqPolar->Draw("same colz pol"); + + canvas->cd(padID); canvas->cd(padID)->SetGrid(1); +// hZProj->Draw(); + hanVScatsum->Draw("colz"); } diff --git a/Armory/ClassPC1An.h b/Armory/ClassPC1An.h new file mode 100644 index 0000000..8e06560 --- /dev/null +++ b/Armory/ClassPC1An.h @@ -0,0 +1,246 @@ +#ifndef ClassPC_h +#define ClassPC_h + +#include +#include +#include +#include + +struct PCHit_1An{ + std::pair nearestWire; // anode, cathode + std::pair nearestDist; // anode, cathode + + short nextNearestWire; // cathode + double nextNearestDist; // cathode + + void Clear(){ + nearestWire.first = -1; + nearestWire.second = -1; + nearestDist.first = 999999999; + nearestDist.second = 999999999; + nextNearestWire= -1; + nextNearestDist = 999999999; + } +}; + +//!######################################################## +class PC{ // proportional wire +public: + PC(){ ClearHitInfo();}; + ~PC(){}; + + PCHit_1An GetHitInfo() const {return hitInfo;} + std::pair GetNearestID() const {return hitInfo.nearestWire;} + std::pair GetNearestDistance() const {return hitInfo.nearestDist;} + short Get2ndNearestID() const {return hitInfo.nextNearestWire;} + double Get2ndNearestDistance() const {return hitInfo.nextNearestDist;} + + TVector3 GetTrackPos() const {return trackPos;} + TVector3 GetTrackVec() const {return trackVec;} + double GetTrackTheta() const {return trackVec.Theta();} + double GetTrackPhi() const {return trackVec.Phi();} + double GetZ0(); + + int GetNumWire() const {return nWire;} + double GetDeltaAngle() const {return dAngle;} + double GetAnodeLength() const {return anodeLength;} + double GetCathodeLength() const {return cathodeLength;} + TVector3 GetAnodeDn(short id) const {return An[id].first;} + TVector3 GetAnodeUp(short id) const {return An[id].second;} + TVector3 GetCathodeDn(short id) const {return Ca[id].first;} + TVector3 GetCathodeUp(short id) const {return Ca[id].second;} + + TVector3 GetAnodneMid(short id) const {return (An[id].first + An[id].second) * 0.5; } + double GetAnodeTheta(short id) const {return (An[id].first - An[id].second).Theta();} + double GetAnodePhi(short id) const {return (An[id].first - An[id].second).Phi();} + + TVector3 GetCathodneMid(short id) const {return (Ca[id].first + Ca[id].second) * 0.5; } + double GetCathodeTheta(short id) const {return (Ca[id].first - Ca[id].second).Theta();} + double GetCathodePhi(short id) const {return (Ca[id].first - Ca[id].second).Phi();} + + void ClearHitInfo(); + void ConstructGeo(); + void FindWireID(TVector3 pos, TVector3 direction, bool verbose = false); + void CalTrack3(TVector3 sx3Pos, PCHit_1An hitInfo, double sigmaA = 0, double sigmaC = 0, bool verbose = false); + + void Print(){ + printf(" The nearest | Anode: %2d(%5.2f) Cathode: %2d(%5.2f)\n", hitInfo.nearestWire.first, + hitInfo.nearestDist.first, + hitInfo.nearestWire.second, + hitInfo.nearestDist.second); + + printf(" The 2nd nearest Cathode: %2d(%5.2f)\n", hitInfo.nextNearestWire, + hitInfo.nextNearestDist); + } + +private: + + // PCHitInfo hitInfo; + PCHit_1An hitInfo; + + TVector3 trackPos; + TVector3 trackVec; + + const int nWire = 24; + const int wireShift = 3; + const float zLen = 380; //mm + const float radiusA = 37; + const float radiusC = 43; + + double dAngle; + double anodeLength; + double cathodeLength; + + std::vector> An; // the anode wire position vector in space + std::vector> Ca; // the cathode wire position vector in space + + double Distance(TVector3 a1, TVector3 a2, TVector3 b1, TVector3 b2){ + TVector3 na = a1 - a2; + TVector3 nb = b1 - b2; + TVector3 nd = (na.Cross(nb)).Unit(); + return TMath::Abs(nd.Dot(a1-b2)); + } + +}; + +inline void PC::ClearHitInfo(){ + hitInfo.Clear(); +} + +inline void PC::ConstructGeo(){ + + An.clear(); + Ca.clear(); + + std::pair p1; // anode + std::pair q1; // cathode + + //anode and cathode start at pos-Y axis and count in right-Hand + //anode wire shift is right-hand. + //cathode wire shift is left-hand. + + for(int i = 0; i < nWire; i++ ){ + // Anode rotate right-hand + p1.first.SetXYZ( radiusA * TMath::Cos( TMath::TwoPi() / nWire * (i) + TMath::PiOver2()), + radiusA * TMath::Sin( TMath::TwoPi() / nWire * (i) + TMath::PiOver2()), + zLen/2); + p1.second.SetXYZ( radiusA * TMath::Cos( TMath::TwoPi() / nWire * (i + wireShift) + TMath::PiOver2()), + radiusA * TMath::Sin( TMath::TwoPi() / nWire * (i + wireShift) + TMath::PiOver2()), + -zLen/2); + An.push_back(p1); + + // Cathod rotate left-hand + q1.first.SetXYZ( radiusC * TMath::Cos( TMath::TwoPi() / nWire * (i) + TMath::PiOver2()), + radiusC * TMath::Sin( TMath::TwoPi() / nWire * (i) + TMath::PiOver2()), + zLen/2); + q1.second.SetXYZ( radiusC * TMath::Cos( TMath::TwoPi() / nWire * (i - wireShift) + TMath::PiOver2()), + radiusC * TMath::Sin( TMath::TwoPi() / nWire * (i - wireShift) + TMath::PiOver2()), + -zLen/2); + Ca.push_back(q1); + } + + dAngle = wireShift * TMath::TwoPi() / nWire; + anodeLength = TMath::Sqrt( zLen*zLen + TMath::Power(2* radiusA * TMath::Sin(dAngle/2),2) ); + cathodeLength = TMath::Sqrt( zLen*zLen + TMath::Power(2* radiusC * TMath::Sin(dAngle/2),2) ); +} + +inline void PC::FindWireID(TVector3 pos, TVector3 direction, bool verbose ){ + + hitInfo.Clear(); + double phi = direction.Phi(); + + for( int i = 0; i < nWire; i++){ + + double disA = 99999999; + double phiS = An[i].first.Phi() - TMath::PiOver4(); + double phiL = An[i].second.Phi() + TMath::PiOver4(); + // printf("A%2d: %f %f | %f\n", i, phiS * TMath::RadToDeg(), phiL * TMath::RadToDeg(), phi * TMath::RadToDeg()); + if( phi > 0 && phiS > phiL ) phiL = phiL + TMath::TwoPi(); + if( phi < 0 && phiS > phiL ) phiS = phiS - TMath::TwoPi(); + + if( phiS < phi && phi < phiL) { + disA = Distance( pos, pos + direction, An[i].first, An[i].second); + if( disA < hitInfo.nearestDist.first ){ + hitInfo.nearestDist.first = disA; + hitInfo.nearestWire.first = i; + } + } + + double disC = 99999999; + phiS = Ca[i].second.Phi()- TMath::PiOver4(); + phiL = Ca[i].first.Phi() + TMath::PiOver4(); + // printf("C%2d: %f %f\n", i, phiS * TMath::RadToDeg(), phiL * TMath::RadToDeg()); + if( phi > 0 && phiS > phiL ) phiL = phiL + TMath::TwoPi(); + if( phi < 0 && phiS > phiL ) phiS = phiS - TMath::TwoPi(); + + if(phiS < phi && phi < phiL) { + disC = Distance( pos, pos + direction, Ca[i].first, Ca[i].second); + if( disC < hitInfo.nearestDist.second ){ + hitInfo.nearestDist.second = disC; + hitInfo.nearestWire.second = i; + } + } + + if(verbose) printf(" %2d | %8.2f, %8.2f\n", i, disA, disC); + } + + short cathode1 = hitInfo.nearestWire.second; + short ccc1 = cathode1 - 1; if( ccc1 < 0 ) ccc1 += nWire; + short ccc2 = (cathode1 + 1) % nWire; + + double haha1 = Distance( pos, pos + direction, Ca[ccc1].first, Ca[ccc1].second); + double haha2 = Distance( pos, pos + direction, Ca[ccc2].first, Ca[ccc2].second); + if( haha1 < haha2){ + hitInfo.nextNearestWire = ccc1; + hitInfo.nextNearestDist = haha1; + }else{ + hitInfo.nextNearestWire = ccc2; + hitInfo.nextNearestDist= haha2; + } + + if( verbose ) Print(); +} + + +inline void PC::CalTrack3(TVector3 sx3Pos, PCHit_1An hitInfo, double sigmaA, double sigmaC, bool verbose){ + + trackPos = sx3Pos; + + double p1 = TMath::Abs(hitInfo.nearestDist.first + gRandom->Gaus(0, sigmaA)); + short anodeID1 = hitInfo.nearestWire.first; + + double q1 = TMath::Abs(hitInfo.nearestDist.second + gRandom->Gaus(0, sigmaC)); + double q2 = TMath::Abs(hitInfo.nextNearestDist+ gRandom->Gaus(0, sigmaC)); + double fracC = q1 / (q1 + q2); + short cathodeID1 = hitInfo.nearestWire.second; + short cathodeID2 = hitInfo.nextNearestWire; + TVector3 shiftC1 = (Ca[cathodeID2].first - Ca[cathodeID1].first) * fracC; + TVector3 shiftC2 = (Ca[cathodeID2].second - Ca[cathodeID1].second) * fracC; + + TVector3 a1 = An[anodeID1].first; + + TVector3 c1 = Ca[cathodeID1].first + shiftC1; + TVector3 c2 = Ca[cathodeID1].second + shiftC2; + + TVector3 n1 = (sx3Pos - a1).Unit(); + TVector3 n2 = (c1 - c2).Cross((sx3Pos - c2)).Unit(); + + // if the handiness of anode and cathode revered, it should be n2 cross n1 + trackVec = (n2.Cross(n1)).Unit(); + + if( verbose ) printf("Theta, Phi = %f, %f \n", trackVec.Theta() *TMath::RadToDeg(), trackVec.Phi()*TMath::RadToDeg()); + +} + +inline double PC::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 \ No newline at end of file diff --git a/Armory/ClassSX3.h b/Armory/ClassSX3.h index 7354d19..3586292 100644 --- a/Armory/ClassSX3.h +++ b/Armory/ClassSX3.h @@ -4,6 +4,7 @@ #include #include #include +#include class SX3{ public: @@ -94,7 +95,7 @@ private: if( verbose ) printf(" ----h, k : %f, %f\n", h, k); - return std::pair(h,k); + return std::pair(h,k); } }; @@ -125,7 +126,7 @@ inline void SX3::ConstructGeo(){ sa.RotateZ( rot ); sb.RotateZ( rot ); - SDn.push_back(std::pair(sa,sb)); + SDn.push_back(std::pair(sa,sb)); sc.SetXYZ( radius, -width/2, gap/2 ); sc.RotateZ( rot ); @@ -138,7 +139,7 @@ inline void SX3::ConstructGeo(){ sa.RotateZ( rot ); sb.RotateZ( rot ); - SUp.push_back(std::pair(sa,sb)); + SUp.push_back(std::pair(sa,sb)); } } @@ -225,6 +226,7 @@ inline void SX3::CalSX3Pos(unsigned short ID, unsigned short chUp, unsigned shor hitPos.Clear(); + if( (chUp - chDown) != 1 || (chDown % 2) != 0) return ; int reducedID = ID % numDet; diff --git a/Armory/Mapper.cpp b/Armory/Mapper.cpp index 532f495..8030de1 100644 --- a/Armory/Mapper.cpp +++ b/Armory/Mapper.cpp @@ -7,7 +7,7 @@ #include #include -#include "../mapping_alpha.h" +#include "../mapping.h" #include "ClassDet.h" //=============================== @@ -91,6 +91,7 @@ int main(int argc, char **argv){ newTree->Branch("qqqCh", &qqq.ch, "qqqCh[qqqMulti]/s"); newTree->Branch("qqqE", &qqq.e, "qqqEnergy[qqqMulti]/s"); newTree->Branch("qqqT", &qqq.t, "qqqTime[qqqMulti]/l"); + newTree->Branch("qqqSN", &qqq.sn, "qqqSN[qqqMulti]/s"); newTree->Branch("pcMulti", &pc.multi, "pcMulti/s"); newTree->Branch("pcID", &pc.id, "pcID[pcMulti]/s"); @@ -116,7 +117,7 @@ int main(int argc, char **argv){ 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] ); //globalCh = digi-ID * nCh(digi-iD) + ch int globalCh = -1; @@ -147,6 +148,7 @@ int main(int argc, char **argv){ qqq.ch[qqq.multi] = (ID - 10000) % 100; qqq.e[qqq.multi] = e[i]; qqq.t[qqq.multi] = e_t[i]; + qqq.sn[qqq.multi] = sn[i]; qqq.multi ++; } diff --git a/ProcessRun.sh b/ProcessRun.sh index 7121e4f..6539a32 100755 --- a/ProcessRun.sh +++ b/ProcessRun.sh @@ -9,15 +9,19 @@ fi runID=$1 timeWindow=$2 -rawFolder=/media/nvmeData/ANASEN_test/analysis/data -rootFolder=/media/nvmeData/ANASEN_test/root_data +rawFolder=/home/tandem/Desktop/analysis/data +rootFolder=/home/tandem/Desktop/analysis/data/root_data -fileList=`\ls -1 ${rawFolder}/*${runID}*.fsu` +rsync -a splitpole@128.186.111.223:/media/nvmeData/ANASEN27Alap/*.fsu /home/tandem/Desktop/analysis/data -./EventBuilder ${timeWindow} 0 0 500000 ${fileList} +fileList=`\ls -1 ${rawFolder}/Run_${runID}_*.fsu` + +./EventBuilder ${timeWindow} 0 0 10000000 ${fileList} outFile=${rawFolder}/*${runID}*${timeWindow}.root mv -vf ${outFile} ${rootFolder}/. ./Mapper ${rootFolder}/*${runID}*${timeWindow}.root + +root "processRun.C(\"${rootFolder}/Run_${runID}_mapped.root\")" diff --git a/TrackRecon.C b/TrackRecon.C new file mode 100644 index 0000000..ebfe1b5 --- /dev/null +++ b/TrackRecon.C @@ -0,0 +1,303 @@ +#define Analyzer_cxx + +#include "Analyzer.h" +#include +#include +#include +#include + +#include +#include + +#include "Armory/ClassSX3.h" +#include "Armory/ClassPC1An.h" + +#include "TVector3.h" + +TH2F * hsx3IndexVE; +TH2F * hqqqIndexVE; +TH2F * hpcIndexVE; + +TH2F * hsx3Coin; +TH2F * hqqqCoin; +TH2F * hpcCoin; + +TH2F * hqqqPolar; +TH2F * hsx3VpcIndex; +TH2F * hqqqVpcIndex; +TH2F * hqqqVpcE; +TH2F * hsx3VpcE; +TH2F * hanVScatsum; +int padID = 0; + +SX3 sx3_contr; +PC pw_contr; +TVector3 hitPos; +bool HitNonZero; + +TH1F * hZProj; + +void Analyzer::Begin(TTree * /*tree*/){ + TString option = GetOption(); + + hZProj = new TH1F("hZProj", "Z Projection", 200, -600, 600); + + sx3_contr.ConstructGeo(); + pw_contr.ConstructGeo(); + +} + + + + +Bool_t Analyzer::Process(Long64_t entry){ + + // if ( entry > 100 ) return kTRUE; + + hitPos.Clear(); + HitNonZero = false; + + // if( entry > 1) return kTRUE; + // printf("################### ev : %llu \n", entry); + + b_sx3Multi->GetEntry(entry); + b_sx3ID->GetEntry(entry); + b_sx3Ch->GetEntry(entry); + b_sx3E->GetEntry(entry); + b_sx3T->GetEntry(entry); + b_qqqMulti->GetEntry(entry); + b_qqqID->GetEntry(entry); + b_qqqCh->GetEntry(entry); + b_qqqE->GetEntry(entry); + b_qqqT->GetEntry(entry); + b_pcMulti->GetEntry(entry); + b_pcID->GetEntry(entry); + b_pcCh->GetEntry(entry); + b_pcE->GetEntry(entry); + b_pcT->GetEntry(entry); + + sx3.CalIndex(); + qqq.CalIndex(); + pc.CalIndex(); + + // sx3.Print(); + + //########################################################### Raw data + // //======================= SX3 + + std::vector> ID; // first = id, 2nd = index + + if( ID.size() > 0 ){ + std::sort(ID.begin(), ID.end(), [](const std::pair & a, const std::pair & b) { + return a.first < b.first; + } ); + // printf("##############################\n"); + // for( size_t i = 0; i < ID.size(); i++) printf("%zu | %d %d \n", i, ID[i].first, ID[i].second ); + + std::vector> sx3ID; + sx3ID.push_back(ID[0]); + bool found = false; + for( size_t i = 1; i < ID.size(); i++){ + if( ID[i].first == sx3ID.back().first) { + sx3ID.push_back(ID[i]); + if( sx3ID.size() >= 3) { + found = true; + } + }else{ + if( !found ){ + sx3ID.clear(); + sx3ID.push_back(ID[i]); + } + } + } + + // printf("---------- sx3ID Multi : %zu \n", sx3ID.size()); + + if( found ){ + int sx3ChUp, sx3ChDn, sx3ChBk; + float sx3EUp, sx3EDn; + // printf("------ sx3 ID : %d, multi: %zu\n", sx3ID[0].first, sx3ID.size()); + for( size_t i = 0; i < sx3ID.size(); i++ ){ + int index = sx3ID[i].second; + // printf(" %zu | index %d | ch : %d, energy : %d \n", i, index, sx3.ch[index], sx3.e[index]); + + + if( sx3.ch[index] < 8 ){ + if( sx3.ch[index] % 2 == 0) { + sx3ChDn = sx3.ch[index]; + sx3EDn = sx3.e[index]; + }else{ + sx3ChUp = sx3.ch[index]; + sx3EUp = sx3.e[index]; + } + }else{ + sx3ChBk = sx3.ch[index]; + } + for( int j = 0; j < pc.multi; j++){ + // hsx3VpcIndex->Fill( sx3.index[i], pc.index[j] ); + if( sx3.ch[index] > 8 ){ + hsx3VpcE->Fill( sx3.e[i], pc.e[j] ); + // hpcIndexVE->Fill( pc.index[i], pc.e[i] ); + } + } + } + + sx3_contr.CalSX3Pos(sx3ID[0].first, sx3ChUp, sx3ChDn, sx3ChBk, sx3EUp, sx3EDn); + hitPos = sx3_contr.GetHitPos(); + HitNonZero = true; + // hitPos.Print(); + } + + } + + + // //======================= QQQ + for( int i = 0; i < qqq.multi; i ++){ + for( int j = i + 1; j < qqq.multi; j++){ + if( qqq.id[i] == qqq.id[j] ){ // must be same detector + int chWedge = -1; + int chRing = -1; + if( qqq.ch[i] < qqq.ch[j]){ + chRing = qqq.ch[j] - 16; + chWedge = qqq.ch[i]; + }else{ + chRing = qqq.ch[i]; + chWedge = qqq.ch[j] - 16; + } + + // printf(" ID : %d , chWedge : %d, chRing : %d \n", qqq.id[i], chWedge, chRing); + + double theta = -TMath::Pi()/2 + 2*TMath::Pi()/16/4.*(qqq.id[i]*16 + chWedge +0.5); + double rho = 10.+40./16.*(chRing+0.5); + // if(qqq.e[i]>50){ + hqqqPolar->Fill( theta, rho); + // } + // qqq.used[i] = true; + // qqq.used[j] = true; + + if( !HitNonZero ){ + double x = rho * TMath::Cos(theta); + double y = rho * TMath::Sin(theta); + hitPos.SetXYZ(x, y, 23 + 75 + 30); + HitNonZero = true; + } + } + } + + + } + // //======================= PC + PCHit_1An hitInfo; + + ID.clear(); + int counter=0; + std::vector> E; + E.clear(); + + if( E.size()==3 ){ + float aE = 0; + float cE = 0; + bool multi_an =false; + for(int l=0;lFill(aE,cE); + + if( HitNonZero){ + pw_contr.CalTrack3( hitPos, hitinfo, cID); + hZProj->Fill(pw_contr.GetZ0()); + } + + // } + } + + + + //########################################################### Track constrcution + + + //############################## DO THE KINEMATICS + + + return kTRUE; +} + +void Analyzer::Terminate(){ + + gStyle->SetOptStat("neiou"); + TCanvas * canvas = new TCanvas("cANASEN", "ANASEN", 2000, 2000); + canvas->Divide(3,3); + + //hsx3VpcIndex->Draw("colz"); + + //=============================================== pad-1 + padID ++; canvas->cd(padID); canvas->cd(padID)->SetGrid(1); + + hsx3IndexVE->Draw("colz"); + + //=============================================== pad-2 + padID ++; canvas->cd(padID); canvas->cd(padID)->SetGrid(1); + + hqqqIndexVE->Draw("colz"); + + //=============================================== pad-3 + padID ++; canvas->cd(padID); canvas->cd(padID)->SetGrid(1); + + hpcIndexVE->Draw("colz"); + + //=============================================== pad-4 + padID ++; canvas->cd(padID); canvas->cd(padID)->SetGrid(1); + + hsx3Coin->Draw("colz"); + + //=============================================== pad-5 + padID ++; canvas->cd(padID); canvas->cd(padID)->SetGrid(1); + + hqqqCoin->Draw("colz"); + + //=============================================== pad-6 + padID ++; canvas->cd(padID); canvas->cd(padID)->SetGrid(1); + + hpcCoin->Draw("colz"); + + //=============================================== pad-7 + padID ++; canvas->cd(padID); canvas->cd(padID)->SetGrid(1); + + hsx3VpcIndex ->Draw("colz"); + // hsx3VpcE->Draw("colz") ; + + //=============================================== pad-8 + padID ++; canvas->cd(padID); canvas->cd(padID)->SetGrid(1); + + hqqqVpcIndex ->Draw("colz"); + + // hqqqVpcE ->Draw("colz"); + //=============================================== pad-9 + padID ++; + + // canvas->cd(padID)->DrawFrame(-50, -50, 50, 50); + // hqqqPolar->Draw("same colz pol"); + + canvas->cd(padID); canvas->cd(padID)->SetGrid(1); + hZProj->Draw(); + // hanVScatsum->Draw("colz"); + +} diff --git a/mapping.h b/mapping.h index 68eb604..c734eeb 100644 --- a/mapping.h +++ b/mapping.h @@ -20,8 +20,9 @@ const std::map board = { {5, 15529}, {6, 15528}, {7, 334}, - {8, 409}, - {9, 405} + {8, 379}, + {9, 325}, + {10, 405} }; const int nBd = board.size(); @@ -39,6 +40,7 @@ const int nV1725 = 3; // use the GenMapping() to get that const std::vector mapping = { + //================== 17122 806, 807, 804, 805, 803, 802, 801, 800, 1006, 1007, 1004, 1005, 1003, 1002, 1001, 1000, 606, 607, 604, 605, 603, 602, 601, 600, 1106, 1107, 1104, 1105, 1103, 1102, 1101, 1100, @@ -46,40 +48,42 @@ const std::vector mapping = { 706, 707, 704, 705, 703, 702, 701, 700, 906, 907, 904, 905, 903, 902, 901, 900, //================== 17123 1406, 1407, 1404, 1405, 1403, 1402, 1401, 1400, 1606, 1607, 1604, 1605, 1603, 1602, 1601, 1600, - 1306, 1307, 1304, 1305, 1303, 1302, 1301, 1300, 1706, 1707, 1704, 1705, 1703, 1702, 1701, 1700, + 1306, 1307, 1304, 1305, 1303, 1302, 1301, 1300, 1506, 1507, 1504, 1505, 1503, 1502, 1501, 1500, 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, + 1206, 1207, 1204, 1205, 1203, 1202, 1201, 1200, 1706, 1707, 1704, 1705, 1703, 1702, 1701, 1700, //================== 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, + 111, 110, 109, 108, 311, 310, 309, 308, 411, 410, 409, 408, 211, 210, 209, 208, 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, + 2006, 2007, 2004, 2005, 2003, 2002, 2001, 2000, 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 + 1806, 1807, 1804, 1805, 1803, 1802, 1801, 1800, 2306, 2307, 2304, 2305, 2303, 2302, 2301, 2300, 10016, 10017, 10018, 10019, 10020, 10021, 10022, 10023, 10024, 10025, 10026, 10027, 10028, 10029, 10030, 10031, - 2006, 2007, 2004, 2005, 2003, 2002, 2001, 2000, 2306, 2307, 2304, 2305, 2303, 2302, 2301, 2300, 10116, 10117, 10118, 10119, 10120, 10121, 10122, 10123, 10124, 10125, 10126, 10127, 10128, 10129, 10130, 10131, - 10115, 10114, 10113, 10112, 10111, 10110, 10109, 10108, 10107, 10106, 10105, 10104, 10103, 10102, 10101, 10100, - //================== 15529 - 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, + //================== 15529 + 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, 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, + 10316, 10317, 10318, 10319, 10320, 10321, 10322, 10323, 10324, 10325, 10326, 10327, 10328, 10329, 10330, 10331, -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, //================== 334 20116, 20117, 20118, 20119, 20120, 20121, 20122, 20123, 20016, 20017, 20018, 20019, 20020, 20021, 20022, 20023, - //================== 409 - 20000, 20001, 20002, 20003, 20004, 20005, 20006, 20007, 20008, 20009, 20010, 20011, 20012, 20013, 20014, 20015, + //================== 379 + 20000, 20001, 20002, 20003, 20004, 20005, -1, 20007, 20008, -1, 20010, 20011, 20012, 20013, 20014, 20015, + //================== 325 + 20100, 20101, 20102, 20103, 20104, 20105, 20106, 20107, 20108, 20109, 20110, 20111, 20112, 20113, 20114, 20115, //================== 405 - 20100, 20101, 20102, 20103, 20104, 20105, 20106, 20107, 20108, 20109, 20110, 20111, 20112, 20113, 20114, 20115 + 20006, -1, -1, 20009, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }; @@ -270,4 +274,4 @@ void GenMapping(std::string mapFile){ } -#endif \ No newline at end of file +#endif diff --git a/mapping_alpha.h b/mapping_alpha.h new file mode 100644 index 0000000..288531b --- /dev/null +++ b/mapping_alpha.h @@ -0,0 +1,274 @@ +#ifndef Mapping_h +#define Mapping_h + +#include +#include +#include +#include +#include +#include +#include + +#include + +const std::map board = { + {0, 17122}, // id, sn + {1, 17123}, + {2, 22320}, + {3, 22130}, + {4, 22129}, + {5, 15529}, + {6, 15528}, + {7, 334}, + {8, 409}, + {9, 405} +}; +const int nBd = board.size(); + +const int nV1740 = 7; +const int nV1725 = 3; + +//+++++++++++++++++++ detID; +// The detectors are seperated into 2 type: SuperX3, QQQ, and PC +// the SuperX3 has 24 detectors for each kind, wach detector has 12 channels +// the QQQ has 4 detectors for each kind, each detector has 32 channels +// the PC has 2 types, anode and cathode, each has 24 channels +// The detID = Type * 10000 + index * 100 + channel +// fro example, detID(superX3-8, ch-7) = 00807 + + +// use the GenMapping() to get that +const std::vector mapping = { + + //================== 17122 + 806, 807, 804, 805, 803, 802, 801, 800, 1006, 1007, 1004, 1005, 1003, 1002, 1001, 1000, + 606, 607, 604, 605, 603, 602, 601, 600, 1106, 1107, 1104, 1105, 1103, 1102, 1101, 1100, + 711, 710, 709, 708, 911, 910, 909, 908, 811, 810, 809, 808, 1011, 1010, 1009, 1008, + 706, 707, 704, 705, 703, 702, 701, 700, 906, 907, 904, 905, 903, 902, 901, 900, + //================== 17123 + 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, + 1311, 1310, 1309, 1308, 1511, 1510, 1509, 1508, 1411, 1410, 1409, 1408, 1611, 1610, 1609, 1608, + 1206, 1207, 1204, 1205, 1203, 1202, 1201, 1200, 1706, 1707, 1704, 1705, 1703, 1702, 1701, 1700, + //================== 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, + 2006, 2007, 2004, 2005, 2003, 2002, 2001, 2000, 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 + 10016, 10017, 10018, 10019, 10020, 10021, 10022, 10023, 10024, 10025, 10026, 10027, 10028, 10029, 10030, 10031, + 1806, 1807, 1804, 1805, 1803, 1802, 1801, 1800, 2306, 2307, 2304, 2305, 2303, 2302, 2301, 2300, + 10116, 10117, 10118, 10119, 10120, 10121, 10122, 10123, 10124, 10125, 10126, 10127, 10128, 10129, 10130, 10131, + 10115, 10114, 10113, 10112, 10111, 10110, 10109, 10108, 10107, 10106, 10105, 10104, 10103, 10102, 10101, 10100, + //================== 15529 + 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, + //================== 334 + 20116, 20117, 20118, 20119, 20120, 20121, 20122, 20123, 20016, 20017, 20018, 20019, 20020, 20021, 20022, 20023, + //================== 409 + 20000, 20001, 20002, 20003, 20004, 20005, 20006, 20007, 20008, 20009, 20010, 20011, 20012, 20013, 20014, 20015, + //================== 405 + 20100, 20101, 20102, 20103, 20104, 20105, 20106, 20107, 20108, 20109, 20110, 20111, 20112, 20113, 20114, 20115 + +}; + +void PrintMapping(){ + + int digiID = 0; + int count = 0; + printf("==================== ID-MAP: \n"); + printf("%11s|", ""); for(int i = 0 ; i < 16; i++ ) printf("%7d|", i); + printf("\n"); + for(int i = 0 ; i < 12 + 16*8; i++ ) printf("-"); + for(size_t i = 0 ; i < mapping.size(); i ++){ + if( (i) % 16 == 0 ) { + printf("\n"); + + if( digiID < nBd ){ + if( board.at(digiID) > 1000 ) { + if( count == 3 ) digiID ++; + if( i % 64 == 0 ) { + printf("%11d|", board.at(digiID)); + count = 0; + } + }else{ + if( count == 1 ) digiID ++; + if( i % 16 == 0 ) { + printf("%11d|", board.at(digiID)); + count = 0; + } + } + } + + if( count != 0) printf("%11s|", ""); + count ++; + } + + int typeID = mapping[i] / 10000; + int detID = (mapping[i] - typeID*10000 )/100; + int ch = mapping[i] - typeID*10000 - detID * 100; + + if( mapping[i] == -1 ) { + + printf("%7s|", ""); + + }else{ + + if( typeID == 0){ // SX3 + + printf("\033[36m%3d(%2d)\033[0m|", detID, ch); + + }else if( typeID == 1){ // QQQ + + printf("\033[91m%3d(%2d)\033[0m|", detID, ch); + + }else if( typeID == 2){ // PC + + printf("\033[35m%3d(%2d)\033[0m|", detID, ch); + + }else{ + + + } + } + } + printf("\n"); + for(int i = 0 ; i < 12 + 16*8; i++ ) printf("-"); + printf("\n"); + +} + + +void GenMapping(std::string mapFile){ + + + std::vector map; + + + std::ifstream inputFile(mapFile); // Replace "your_file.txt" with the actual file path + + if (!inputFile.is_open()) { + printf("Error: Could not open the file (%s).\n", mapFile.c_str()); + return ; + } + + std::string line; + + // Read the file line by line + while (std::getline(inputFile, line)) { + std::vector words; + std::istringstream iss(line); + + // Extract words from the current line + while (true) { + std::string word; + if (!(iss >> word)) break; // Break if there are no more words + + word.erase(std::remove_if(word.begin(), word.end(), ::isspace), word.end()); + words.push_back(word); + + } + + if( atoi(words[0].c_str()) % 16 == 0 ) printf("=================\n"); + + + 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[3] == "FRONTDOWN" ){ + int chID = atoi(words[4].c_str()); + if( chID % 2 != 0 ) chID -= 1; + detID += chID; + } + + if( words[3] == "FRONTUP" ){ + int chID = atoi(words[4].c_str()); + if( chID % 2 == 0 ) chID += 1; + detID += chID; + } + + if( words[3] == "BACK") detID += atoi(words[4].c_str()) + 8; + } + + if( words[2] == "FQQQ" ) { + detID += 10000; + if( words[3] == "WEDGE") detID += atoi(words[4].c_str()); + if( words[3] == "RING") detID += atoi(words[4].c_str()) + 16; + } + + if( words[2] == "PC" ) { + detID += 20000; + if( words[3] == "ANODE") detID += atoi(words[4].c_str()); + if( words[3] == "CATHODE") detID += 100 + atoi(words[4].c_str()); + + } + + if( words[2] == "blank") { + detID = -1; + } + + map.push_back(detID); + + printf("| %5d", detID); + printf("|\n"); + } + + // Close the file + inputFile.close(); + + int digiID = 0; + int count = 0; + printf("===============================\n"); + for( size_t i = 0; i < ((map.size() +15)/16) * 16; i++){ + if( i % 16 == 0) { + printf("\n"); + if( digiID < nBd ){ + if( board.at(digiID) > 1000 ) { + if( count == 3 ) digiID ++; + if( i % 64 == 0 ) { + printf(" //================== %d\n", board.at(digiID)); + count = 0; + } + }else{ + if( count == 1 ) digiID ++; + if( i % 16 == 0 ) { + printf(" //================== %d\n", board.at(digiID)); + count = 0; + } + } + } + count ++; + } + if( i < map.size() ){ + printf(" %5d,", map[i]); + }else{ + printf(" %5d,", -1); + } + } + printf("\n\n===============================\n"); + + printf("sorting mapping and see if there any repeated\n"); + std::sort(map.begin(), map.end()); + + 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]); + } + printf("=========== Done. if nothing show, no repeat. \n"); + + +} + +#endif \ No newline at end of file diff --git a/mapping_old.txt b/mapping_old.txt index 7148494..9fdc738 100644 --- a/mapping_old.txt +++ b/mapping_old.txt @@ -1,496 +1,496 @@ - 0 2 BARREL FRONTDOWN 7 - 1 2 BARREL FRONTUP 6 - 2 2 BARREL FRONTDOWN 5 - 3 2 BARREL FRONTUP 4 - 4 2 BARREL FRONTUP 3 - 5 2 BARREL FRONTDOWN 2 - 6 2 BARREL FRONTUP 1 - 7 2 BARREL FRONTDOWN 0 - 8 4 BARREL FRONTDOWN 7 - 9 4 BARREL FRONTUP 6 - 10 4 BARREL FRONTDOWN 5 - 11 4 BARREL FRONTUP 4 - 12 4 BARREL FRONTUP 3 - 13 4 BARREL FRONTDOWN 2 - 14 4 BARREL FRONTUP 1 - 15 4 BARREL FRONTDOWN 0 - 16 0 BARREL FRONTDOWN 7 - 17 0 BARREL FRONTUP 6 - 18 0 BARREL FRONTDOWN 5 - 19 0 BARREL FRONTUP 4 - 20 0 BARREL FRONTUP 3 - 21 0 BARREL FRONTDOWN 2 - 22 0 BARREL FRONTUP 1 - 23 0 BARREL FRONTDOWN 0 - 24 5 BARREL FRONTDOWN 7 - 25 5 BARREL FRONTUP 6 - 26 5 BARREL FRONTDOWN 5 - 27 5 BARREL FRONTUP 4 - 28 5 BARREL FRONTUP 3 - 29 5 BARREL FRONTDOWN 2 - 30 5 BARREL FRONTUP 1 - 31 5 BARREL FRONTDOWN 0 - 32 1 BARREL BACK 3 - 33 1 BARREL BACK 2 - 34 1 BARREL BACK 1 - 35 1 BARREL BACK 0 - 36 2 BARREL BACK 3 - 37 2 BARREL BACK 2 - 38 2 BARREL BACK 1 - 39 2 BARREL BACK 0 - 40 3 BARREL BACK 3 - 41 3 BARREL BACK 2 - 42 3 BARREL BACK 1 - 43 3 BARREL BACK 0 - 44 4 BARREL BACK 3 - 45 4 BARREL BACK 2 - 46 4 BARREL BACK 1 - 47 4 BARREL BACK 0 - 48 1 BARREL FRONTDOWN 7 - 49 1 BARREL FRONTUP 6 - 50 1 BARREL FRONTDOWN 5 - 51 1 BARREL FRONTUP 4 - 52 1 BARREL FRONTUP 3 - 53 1 BARREL FRONTDOWN 2 - 54 1 BARREL FRONTUP 1 - 55 1 BARREL FRONTDOWN 0 - 56 3 BARREL FRONTDOWN 7 - 57 3 BARREL FRONTUP 6 - 58 3 BARREL FRONTDOWN 5 - 59 3 BARREL FRONTUP 4 - 60 3 BARREL FRONTUP 3 - 61 3 BARREL FRONTDOWN 2 - 62 3 BARREL FRONTUP 1 - 63 3 BARREL FRONTDOWN 0 - 64 6 BARREL FRONTDOWN 7 - 65 6 BARREL FRONTUP 6 - 66 6 BARREL FRONTDOWN 5 - 67 6 BARREL FRONTUP 4 - 68 6 BARREL FRONTUP 3 - 69 6 BARREL FRONTDOWN 2 - 70 6 BARREL FRONTUP 1 - 71 6 BARREL FRONTDOWN 0 - 72 11 BARREL FRONTDOWN 7 - 73 11 BARREL FRONTUP 6 - 74 11 BARREL FRONTDOWN 5 - 75 11 BARREL FRONTUP 4 - 76 11 BARREL FRONTUP 3 - 77 11 BARREL FRONTDOWN 2 - 78 11 BARREL FRONTUP 1 - 79 11 BARREL FRONTDOWN 0 - 80 7 BARREL BACK 3 - 81 7 BARREL BACK 2 - 82 7 BARREL BACK 1 - 83 7 BARREL BACK 0 - 84 8 BARREL BACK 3 - 85 8 BARREL BACK 2 - 86 8 BARREL BACK 1 - 87 8 BARREL BACK 0 - 88 9 BARREL BACK 3 - 89 9 BARREL BACK 2 - 90 9 BARREL BACK 1 - 91 9 BARREL BACK 0 - 92 10 BARREL BACK 3 - 93 10 BARREL BACK 2 - 94 10 BARREL BACK 1 - 95 10 BARREL BACK 0 - 96 7 BARREL FRONTDOWN 7 - 97 7 BARREL FRONTUP 6 - 98 7 BARREL FRONTDOWN 5 - 99 7 BARREL FRONTUP 4 -100 7 BARREL FRONTUP 3 -101 7 BARREL FRONTDOWN 2 -102 7 BARREL FRONTUP 1 -103 7 BARREL FRONTDOWN 0 -104 9 BARREL FRONTDOWN 7 -105 9 BARREL FRONTUP 6 -106 9 BARREL FRONTDOWN 5 -107 9 BARREL FRONTUP 4 -108 9 BARREL FRONTUP 3 -109 9 BARREL FRONTDOWN 2 -110 9 BARREL FRONTUP 1 -111 9 BARREL FRONTDOWN 0 -112 8 BARREL FRONTDOWN 7 -113 8 BARREL FRONTUP 6 -114 8 BARREL FRONTDOWN 5 -115 8 BARREL FRONTUP 4 -116 8 BARREL FRONTUP 3 -117 8 BARREL FRONTDOWN 2 -118 8 BARREL FRONTUP 1 -119 8 BARREL FRONTDOWN 0 -120 10 BARREL FRONTDOWN 7 -121 10 BARREL FRONTUP 6 -122 10 BARREL FRONTDOWN 5 -123 10 BARREL FRONTUP 4 -124 10 BARREL FRONTUP 3 -125 10 BARREL FRONTDOWN 2 -126 10 BARREL FRONTUP 1 -127 10 BARREL FRONTDOWN 0 -128 19 BARREL BACK 3 -129 19 BARREL BACK 2 -130 19 BARREL BACK 1 -131 19 BARREL BACK 0 -132 20 BARREL BACK 3 -133 20 BARREL BACK 2 -134 20 BARREL BACK 1 -135 20 BARREL BACK 0 -136 21 BARREL BACK 3 -137 21 BARREL BACK 2 -138 21 BARREL BACK 1 -139 21 BARREL BACK 0 -140 22 BARREL BACK 3 -141 22 BARREL BACK 2 -142 22 BARREL BACK 1 -143 22 BARREL BACK 0 -144 19 BARREL FRONTDOWN 7 -145 19 BARREL FRONTUP 6 -146 19 BARREL FRONTDOWN 5 -147 19 BARREL FRONTUP 4 -148 19 BARREL FRONTUP 3 -149 19 BARREL FRONTDOWN 2 -150 19 BARREL FRONTUP 1 -151 19 BARREL FRONTDOWN 0 -152 21 BARREL FRONTDOWN 7 -153 21 BARREL FRONTUP 6 -154 21 BARREL FRONTDOWN 5 -155 21 BARREL FRONTUP 4 -156 21 BARREL FRONTUP 3 -157 21 BARREL FRONTDOWN 2 -158 21 BARREL FRONTUP 1 -159 21 BARREL FRONTDOWN 0 -160 18 BARREL FRONTDOWN 7 -161 18 BARREL FRONTUP 6 -162 18 BARREL FRONTDOWN 5 -163 18 BARREL FRONTUP 4 -164 18 BARREL FRONTUP 3 -165 18 BARREL FRONTDOWN 2 -166 18 BARREL FRONTUP 1 -167 18 BARREL FRONTDOWN 0 -168 23 BARREL FRONTDOWN 7 -169 23 BARREL FRONTUP 6 -170 23 BARREL FRONTDOWN 5 -171 23 BARREL FRONTUP 4 -172 23 BARREL FRONTUP 3 -173 23 BARREL FRONTDOWN 2 -174 23 BARREL FRONTUP 1 -175 23 BARREL FRONTDOWN 0 -176 20 BARREL FRONTDOWN 7 -177 20 BARREL FRONTUP 6 -178 20 BARREL FRONTDOWN 5 -179 20 BARREL FRONTUP 4 -180 20 BARREL FRONTUP 3 -181 20 BARREL FRONTDOWN 2 -182 20 BARREL FRONTUP 1 -183 20 BARREL FRONTDOWN 0 -184 22 BARREL FRONTDOWN 7 -185 22 BARREL FRONTUP 6 -186 22 BARREL FRONTDOWN 5 -187 22 BARREL FRONTUP 4 -188 22 BARREL FRONTUP 3 -189 22 BARREL FRONTDOWN 2 -190 22 BARREL FRONTUP 1 -191 22 BARREL FRONTDOWN 0 -192 13 BARREL BACK 3 -193 13 BARREL BACK 2 -194 13 BARREL BACK 1 -195 13 BARREL BACK 0 -196 14 BARREL BACK 3 -197 14 BARREL BACK 2 -198 14 BARREL BACK 1 -199 14 BARREL BACK 0 -200 15 BARREL BACK 3 -201 15 BARREL BACK 2 -202 15 BARREL BACK 1 -203 15 BARREL BACK 0 -204 16 BARREL BACK 3 -205 16 BARREL BACK 2 -206 16 BARREL BACK 1 -207 16 BARREL BACK 0 -208 0 BARREL BACK 3 -209 0 BARREL BACK 2 -210 0 BARREL BACK 1 -211 0 BARREL BACK 0 -212 5 BARREL BACK 3 -213 5 BARREL BACK 2 -214 5 BARREL BACK 1 -215 5 BARREL BACK 0 -216 6 BARREL BACK 3 -217 6 BARREL BACK 2 -218 6 BARREL BACK 1 -219 6 BARREL BACK 0 +0 8 BARREL FRONTDOWN 7 +1 8 BARREL FRONTUP 6 +2 8 BARREL FRONTDOWN 5 +3 8 BARREL FRONTUP 4 +4 8 BARREL FRONTUP 3 +5 8 BARREL FRONTDOWN 2 +6 8 BARREL FRONTUP 1 +7 8 BARREL FRONTDOWN 0 +8 10 BARREL FRONTDOWN 7 +9 10 BARREL FRONTUP 6 +10 10 BARREL FRONTDOWN 5 +11 10 BARREL FRONTUP 4 +12 10 BARREL FRONTUP 3 +13 10 BARREL FRONTDOWN 2 +14 10 BARREL FRONTUP 1 +15 10 BARREL FRONTDOWN 0 +16 6 BARREL FRONTDOWN 7 +17 6 BARREL FRONTUP 6 +18 6 BARREL FRONTDOWN 5 +19 6 BARREL FRONTUP 4 +20 6 BARREL FRONTUP 3 +21 6 BARREL FRONTDOWN 2 +22 6 BARREL FRONTUP 1 +23 6 BARREL FRONTDOWN 0 +24 11 BARREL FRONTDOWN 7 +25 11 BARREL FRONTUP 6 +26 11 BARREL FRONTDOWN 5 +27 11 BARREL FRONTUP 4 +28 11 BARREL FRONTUP 3 +29 11 BARREL FRONTDOWN 2 +30 11 BARREL FRONTUP 1 +31 11 BARREL FRONTDOWN 0 +32 7 BARREL BACK 3 +33 7 BARREL BACK 2 +34 7 BARREL BACK 1 +35 7 BARREL BACK 0 +36 9 BARREL BACK 3 +37 9 BARREL BACK 2 +38 9 BARREL BACK 1 +39 9 BARREL BACK 0 +40 10 BARREL BACK 3 +41 10 BARREL BACK 2 +42 10 BARREL BACK 1 +43 10 BARREL BACK 0 +44 8 BARREL BACK 3 +45 8 BARREL BACK 2 +46 8 BARREL BACK 1 +47 8 BARREL BACK 0 +48 7 BARREL FRONTDOWN 7 +49 7 BARREL FRONTUP 6 +50 7 BARREL FRONTDOWN 5 +51 7 BARREL FRONTUP 4 +52 7 BARREL FRONTUP 3 +53 7 BARREL FRONTDOWN 2 +54 7 BARREL FRONTUP 1 +55 7 BARREL FRONTDOWN 0 +56 9 BARREL FRONTDOWN 7 +57 9 BARREL FRONTUP 6 +58 9 BARREL FRONTDOWN 5 +59 9 BARREL FRONTUP 4 +60 9 BARREL FRONTUP 3 +61 9 BARREL FRONTDOWN 2 +62 9 BARREL FRONTUP 1 +63 9 BARREL FRONTDOWN 0 +64 14 BARREL FRONTDOWN 7 +65 14 BARREL FRONTUP 6 +66 14 BARREL FRONTDOWN 5 +67 14 BARREL FRONTUP 4 +68 14 BARREL FRONTUP 3 +69 14 BARREL FRONTDOWN 2 +70 14 BARREL FRONTUP 1 +71 14 BARREL FRONTDOWN 0 +72 16 BARREL FRONTDOWN 7 +73 16 BARREL FRONTUP 6 +74 16 BARREL FRONTDOWN 5 +75 16 BARREL FRONTUP 4 +76 16 BARREL FRONTUP 3 +77 16 BARREL FRONTDOWN 2 +78 16 BARREL FRONTUP 1 +79 16 BARREL FRONTDOWN 0 +80 13 BARREL FRONTDOWN 7 +81 13 BARREL FRONTUP 6 +82 13 BARREL FRONTDOWN 5 +83 13 BARREL FRONTUP 4 +84 13 BARREL FRONTUP 3 +85 13 BARREL FRONTDOWN 2 +86 13 BARREL FRONTUP 1 +87 13 BARREL FRONTDOWN 0 +88 15 BARREL FRONTDOWN 7 +89 15 BARREL FRONTUP 6 +90 15 BARREL FRONTDOWN 5 +91 15 BARREL FRONTUP 4 +92 15 BARREL FRONTUP 3 +93 15 BARREL FRONTDOWN 2 +94 15 BARREL FRONTUP 1 +95 15 BARREL FRONTDOWN 0 +96 13 BARREL BACK 3 +97 13 BARREL BACK 2 +98 13 BARREL BACK 1 +99 13 BARREL BACK 0 +100 17 BARREL BACK 3 +101 17 BARREL BACK 2 +102 17 BARREL BACK 1 +103 17 BARREL BACK 0 +104 16 BARREL BACK 3 +105 16 BARREL BACK 2 +106 16 BARREL BACK 1 +107 16 BARREL BACK 0 +108 14 BARREL BACK 3 +109 14 BARREL BACK 2 +110 14 BARREL BACK 1 +111 14 BARREL BACK 0 +112 12 BARREL FRONTDOWN 7 +113 12 BARREL FRONTUP 6 +114 12 BARREL FRONTDOWN 5 +115 12 BARREL FRONTUP 4 +116 12 BARREL FRONTUP 3 +117 12 BARREL FRONTDOWN 2 +118 12 BARREL FRONTUP 1 +119 12 BARREL FRONTDOWN 0 +120 17 BARREL FRONTDOWN 7 +121 17 BARREL FRONTUP 6 +122 17 BARREL FRONTDOWN 5 +123 17 BARREL FRONTUP 4 +124 17 BARREL FRONTUP 3 +125 17 BARREL FRONTDOWN 2 +126 17 BARREL FRONTUP 1 +127 17 BARREL FRONTDOWN 0 +128 0 BARREL FRONTDOWN 7 +129 0 BARREL FRONTUP 6 +130 0 BARREL FRONTDOWN 5 +131 0 BARREL FRONTUP 4 +132 0 BARREL FRONTUP 3 +133 0 BARREL FRONTDOWN 2 +134 0 BARREL FRONTUP 1 +135 0 BARREL FRONTDOWN 0 +136 5 BARREL FRONTDOWN 7 +137 5 BARREL FRONTUP 6 +138 5 BARREL FRONTDOWN 5 +139 5 BARREL FRONTUP 4 +140 5 BARREL FRONTUP 3 +141 5 BARREL FRONTDOWN 2 +142 5 BARREL FRONTUP 1 +143 5 BARREL FRONTDOWN 0 +144 1 BARREL BACK 3 +145 1 BARREL BACK 2 +146 1 BARREL BACK 1 +147 1 BARREL BACK 0 +148 3 BARREL BACK 3 +149 3 BARREL BACK 2 +150 3 BARREL BACK 1 +151 3 BARREL BACK 0 +152 4 BARREL BACK 3 +153 4 BARREL BACK 2 +154 4 BARREL BACK 1 +155 4 BARREL BACK 0 +156 2 BARREL BACK 3 +157 2 BARREL BACK 2 +158 2 BARREL BACK 1 +159 2 BARREL BACK 0 +160 2 BARREL FRONTDOWN 7 +161 2 BARREL FRONTUP 6 +162 2 BARREL FRONTDOWN 5 +163 2 BARREL FRONTUP 4 +164 2 BARREL FRONTUP 3 +165 2 BARREL FRONTDOWN 2 +166 2 BARREL FRONTUP 1 +167 2 BARREL FRONTDOWN 0 +168 4 BARREL FRONTDOWN 7 +169 4 BARREL FRONTUP 6 +170 4 BARREL FRONTDOWN 5 +171 4 BARREL FRONTUP 4 +172 4 BARREL FRONTUP 3 +173 4 BARREL FRONTDOWN 2 +174 4 BARREL FRONTUP 1 +175 4 BARREL FRONTDOWN 0 +176 1 BARREL FRONTDOWN 7 +177 1 BARREL FRONTUP 6 +178 1 BARREL FRONTDOWN 5 +179 1 BARREL FRONTUP 4 +180 1 BARREL FRONTUP 3 +181 1 BARREL FRONTDOWN 2 +182 1 BARREL FRONTUP 1 +183 1 BARREL FRONTDOWN 0 +184 3 BARREL FRONTDOWN 7 +185 3 BARREL FRONTUP 6 +186 3 BARREL FRONTDOWN 5 +187 3 BARREL FRONTUP 4 +188 3 BARREL FRONTUP 3 +189 3 BARREL FRONTDOWN 2 +190 3 BARREL FRONTUP 1 +191 3 BARREL FRONTDOWN 0 +192 19 BARREL BACK 3 +193 19 BARREL BACK 2 +194 19 BARREL BACK 1 +195 19 BARREL BACK 0 +196 21 BARREL BACK 3 +197 21 BARREL BACK 2 +198 21 BARREL BACK 1 +199 21 BARREL BACK 0 +200 22 BARREL BACK 3 +201 22 BARREL BACK 2 +202 22 BARREL BACK 1 +203 22 BARREL BACK 0 +204 20 BARREL BACK 3 +205 20 BARREL BACK 2 +206 20 BARREL BACK 1 +207 20 BARREL BACK 0 +208 0 BARREL BACK 3 +209 0 BARREL BACK 2 +210 0 BARREL BACK 1 +211 0 BARREL BACK 0 +212 5 BARREL BACK 3 +213 5 BARREL BACK 2 +214 5 BARREL BACK 1 +215 5 BARREL BACK 0 +216 6 BARREL BACK 3 +217 6 BARREL BACK 2 +218 6 BARREL BACK 1 +219 6 BARREL BACK 0 220 11 BARREL BACK 3 221 11 BARREL BACK 2 222 11 BARREL BACK 1 223 11 BARREL BACK 0 -224 14 BARREL FRONTDOWN 7 -225 14 BARREL FRONTUP 6 -226 14 BARREL FRONTDOWN 5 -227 14 BARREL FRONTUP 4 -228 14 BARREL FRONTUP 3 -229 14 BARREL FRONTDOWN 2 -230 14 BARREL FRONTUP 1 -231 14 BARREL FRONTDOWN 0 -232 16 BARREL FRONTDOWN 7 -233 16 BARREL FRONTUP 6 -234 16 BARREL FRONTDOWN 5 -235 16 BARREL FRONTUP 4 -236 16 BARREL FRONTUP 3 -237 16 BARREL FRONTDOWN 2 -238 16 BARREL FRONTUP 1 -239 16 BARREL FRONTDOWN 0 -240 13 BARREL FRONTDOWN 7 -241 13 BARREL FRONTUP 6 -242 13 BARREL FRONTDOWN 5 -243 13 BARREL FRONTUP 4 -244 13 BARREL FRONTUP 3 -245 13 BARREL FRONTDOWN 2 -246 13 BARREL FRONTUP 1 -247 13 BARREL FRONTDOWN 0 -248 15 BARREL FRONTDOWN 7 -249 15 BARREL FRONTUP 6 -250 15 BARREL FRONTDOWN 5 -251 15 BARREL FRONTUP 4 -252 15 BARREL FRONTUP 3 -253 15 BARREL FRONTDOWN 2 -254 15 BARREL FRONTUP 1 -255 15 BARREL FRONTDOWN 0 -256 0 FQQQ WEDGE 15 -257 0 FQQQ WEDGE 14 -258 0 FQQQ WEDGE 13 -259 0 FQQQ WEDGE 12 -260 0 FQQQ WEDGE 11 -261 0 FQQQ WEDGE 10 -262 0 FQQQ WEDGE 9 -263 0 FQQQ WEDGE 8 -264 0 FQQQ WEDGE 7 -265 0 FQQQ WEDGE 6 -266 0 FQQQ WEDGE 5 -267 0 FQQQ WEDGE 4 -268 0 FQQQ WEDGE 3 -269 0 FQQQ WEDGE 2 -270 0 FQQQ WEDGE 1 -271 0 FQQQ WEDGE 0 -272 12 BARREL FRONTDOWN 7 -273 12 BARREL FRONTUP 6 -274 12 BARREL FRONTDOWN 5 -275 12 BARREL FRONTUP 4 -276 12 BARREL FRONTUP 3 -277 12 BARREL FRONTDOWN 2 -278 12 BARREL FRONTUP 1 -279 12 BARREL FRONTDOWN 0 -280 17 BARREL FRONTDOWN 7 -281 17 BARREL FRONTUP 6 -282 17 BARREL FRONTDOWN 5 -283 17 BARREL FRONTUP 4 -284 17 BARREL FRONTUP 3 -285 17 BARREL FRONTDOWN 2 -286 17 BARREL FRONTUP 1 -287 17 BARREL FRONTDOWN 0 -288 1 FQQQ WEDGE 15 -289 1 FQQQ WEDGE 14 -290 1 FQQQ WEDGE 13 -291 1 FQQQ WEDGE 12 -292 1 FQQQ WEDGE 11 -293 1 FQQQ WEDGE 10 -294 1 FQQQ WEDGE 9 -295 1 FQQQ WEDGE 8 -296 1 FQQQ WEDGE 7 -297 1 FQQQ WEDGE 6 -298 1 FQQQ WEDGE 5 -299 1 FQQQ WEDGE 4 -300 1 FQQQ WEDGE 3 -301 1 FQQQ WEDGE 2 -302 1 FQQQ WEDGE 1 -303 1 FQQQ WEDGE 0 -304 1 FQQQ RING 0 -305 1 FQQQ RING 1 -306 1 FQQQ RING 2 -307 1 FQQQ RING 3 -308 1 FQQQ RING 4 -309 1 FQQQ RING 5 -310 1 FQQQ RING 6 -311 1 FQQQ RING 7 -312 1 FQQQ RING 8 -313 1 FQQQ RING 9 -314 1 FQQQ RING 10 -315 1 FQQQ RING 11 -316 1 FQQQ RING 12 -317 1 FQQQ RING 13 -318 1 FQQQ RING 14 -319 1 FQQQ RING 15 -320 0 FQQQ RING 0 -321 0 FQQQ RING 1 -322 0 FQQQ RING 2 -323 0 FQQQ RING 3 -324 0 FQQQ RING 4 -325 0 FQQQ RING 5 -326 0 FQQQ RING 6 -327 0 FQQQ RING 7 -328 0 FQQQ RING 8 -329 0 FQQQ RING 9 -330 0 FQQQ RING 10 -331 0 FQQQ RING 11 -332 0 FQQQ RING 12 -333 0 FQQQ RING 13 -334 0 FQQQ RING 14 -335 0 FQQQ RING 15 -336 2 FQQQ WEDGE 15 -337 2 FQQQ WEDGE 14 -338 2 FQQQ WEDGE 13 -339 2 FQQQ WEDGE 12 -340 2 FQQQ WEDGE 11 -341 2 FQQQ WEDGE 10 -342 2 FQQQ WEDGE 9 -343 2 FQQQ WEDGE 8 -344 2 FQQQ WEDGE 7 -345 2 FQQQ WEDGE 6 -346 2 FQQQ WEDGE 5 -347 2 FQQQ WEDGE 4 -348 2 FQQQ WEDGE 3 -349 2 FQQQ WEDGE 2 -350 2 FQQQ WEDGE 1 -351 2 FQQQ WEDGE 0 -352 2 FQQQ RING 0 -353 2 FQQQ RING 1 -354 2 FQQQ RING 2 -355 2 FQQQ RING 3 -356 2 FQQQ RING 4 -357 2 FQQQ RING 5 -358 2 FQQQ RING 6 -359 2 FQQQ RING 7 -360 2 FQQQ RING 8 -361 2 FQQQ RING 9 -362 2 FQQQ RING 10 -363 2 FQQQ RING 11 -364 2 FQQQ RING 12 -365 2 FQQQ RING 13 -366 2 FQQQ RING 14 -367 2 FQQQ RING 15 -368 3 FQQQ WEDGE 15 -369 3 FQQQ WEDGE 14 -370 3 FQQQ WEDGE 13 -371 3 FQQQ WEDGE 12 -372 3 FQQQ WEDGE 11 -373 3 FQQQ WEDGE 10 -374 3 FQQQ WEDGE 9 -375 3 FQQQ WEDGE 8 -376 3 FQQQ WEDGE 7 -377 3 FQQQ WEDGE 6 -378 3 FQQQ WEDGE 5 -379 3 FQQQ WEDGE 4 -380 3 FQQQ WEDGE 3 -381 3 FQQQ WEDGE 2 -382 3 FQQQ WEDGE 1 -383 3 FQQQ WEDGE 0 -384 0 blank blank 0 -385 0 blank blank 1 -386 0 blank blank 2 -387 0 blank blank 3 -388 0 blank blank 4 -389 0 blank blank 5 -390 0 blank blank 6 -391 0 blank blank 7 -392 0 blank blank 8 -393 0 blank blank 9 -394 0 blank blank 10 -395 0 blank blank 11 -396 0 blank blank 12 -397 0 blank blank 13 -398 0 blank blank 14 -399 0 blank blank 15 -400 3 FQQQ RING 0 -401 3 FQQQ RING 1 -402 3 FQQQ RING 2 -403 3 FQQQ RING 3 -404 3 FQQQ RING 4 -405 3 FQQQ RING 5 -406 3 FQQQ RING 6 -407 3 FQQQ RING 7 -408 3 FQQQ RING 8 -409 3 FQQQ RING 9 -410 3 FQQQ RING 10 -411 3 FQQQ RING 11 -412 3 FQQQ RING 12 -413 3 FQQQ RING 13 -414 3 FQQQ RING 14 -415 3 FQQQ RING 15 -416 0 blank blank 0 -417 0 blank blank 1 -418 0 blank blank 2 -419 0 blank blank 3 -420 0 blank blank 4 -421 0 blank blank 5 -422 0 blank blank 6 -423 0 blank blank 7 -424 0 blank blank 8 -425 0 blank blank 9 -426 0 blank blank 10 -427 0 blank blank 11 -428 0 blank blank 12 -429 0 blank blank 13 -430 0 blank blank 14 -431 0 blank blank 15 -432 0 blank blank 0 -433 0 blank blank 1 -434 0 blank blank 2 -435 0 blank blank 3 -436 0 blank blank 4 -437 0 blank blank 5 -438 0 blank blank 6 -439 0 blank blank 7 -440 0 blank blank 8 -441 0 blank blank 9 -442 0 blank blank 10 -443 0 blank blank 11 -444 0 blank blank 12 -445 0 blank blank 13 -446 0 blank blank 14 -447 0 blank blank 15 -448 0 PC CATHODE 16 -449 0 PC CATHODE 17 -450 0 PC CATHODE 18 -451 0 PC CATHODE 19 -452 0 PC CATHODE 20 -453 0 PC CATHODE 21 -454 0 PC CATHODE 22 -455 0 PC CATHODE 23 -457 0 PC ANODE 16 -458 0 PC ANODE 17 -459 0 PC ANODE 18 -460 0 PC ANODE 19 -461 0 PC ANODE 20 -462 0 PC ANODE 21 -463 0 PC ANODE 22 -464 0 PC ANODE 23 -465 0 PC ANODE 0 -466 0 PC ANODE 1 -467 0 PC ANODE 2 -468 0 PC ANODE 3 -469 0 PC ANODE 4 -470 0 PC ANODE 5 -471 0 PC ANODE 6 -472 0 PC ANODE 7 -473 0 PC ANODE 8 -474 0 PC ANODE 9 -475 0 PC ANODE 10 -476 0 PC ANODE 11 -477 0 PC ANODE 12 -478 0 PC ANODE 13 -479 0 PC ANODE 14 -480 0 PC ANODE 15 -481 0 PC CATHODE 0 -482 0 PC CATHODE 1 -483 0 PC CATHODE 2 -484 0 PC CATHODE 3 -485 0 PC CATHODE 4 -486 0 PC CATHODE 5 -487 0 PC CATHODE 6 -488 0 PC CATHODE 7 -489 0 PC CATHODE 8 -490 0 PC CATHODE 9 -491 0 PC CATHODE 10 -492 0 PC CATHODE 11 -493 0 PC CATHODE 12 -494 0 PC CATHODE 13 -495 0 PC CATHODE 14 -496 0 PC CATHODE 15 \ No newline at end of file +224 20 BARREL FRONTDOWN 7 +225 20 BARREL FRONTUP 6 +226 20 BARREL FRONTDOWN 5 +227 20 BARREL FRONTUP 4 +228 20 BARREL FRONTUP 3 +229 20 BARREL FRONTDOWN 2 +230 20 BARREL FRONTUP 1 +231 20 BARREL FRONTDOWN 0 +232 22 BARREL FRONTDOWN 7 +233 22 BARREL FRONTUP 6 +234 22 BARREL FRONTDOWN 5 +235 22 BARREL FRONTUP 4 +236 22 BARREL FRONTUP 3 +237 22 BARREL FRONTDOWN 2 +238 22 BARREL FRONTUP 1 +239 22 BARREL FRONTDOWN 0 +240 19 BARREL FRONTDOWN 7 +241 19 BARREL FRONTUP 6 +242 19 BARREL FRONTDOWN 5 +243 19 BARREL FRONTUP 4 +244 19 BARREL FRONTUP 3 +245 19 BARREL FRONTDOWN 2 +246 19 BARREL FRONTUP 1 +247 19 BARREL FRONTDOWN 0 +248 21 BARREL FRONTDOWN 7 +249 21 BARREL FRONTUP 6 +250 21 BARREL FRONTDOWN 5 +251 21 BARREL FRONTUP 4 +252 21 BARREL FRONTUP 3 +253 21 BARREL FRONTDOWN 2 +254 21 BARREL FRONTUP 1 +255 21 BARREL FRONTDOWN 0 +256 18 BARREL FRONTDOWN 7 +257 18 BARREL FRONTUP 6 +258 18 BARREL FRONTDOWN 5 +259 18 BARREL FRONTUP 4 +260 18 BARREL FRONTUP 3 +261 18 BARREL FRONTDOWN 2 +262 18 BARREL FRONTUP 1 +263 18 BARREL FRONTDOWN 0 +264 23 BARREL FRONTDOWN 7 +265 23 BARREL FRONTUP 6 +266 23 BARREL FRONTDOWN 5 +267 23 BARREL FRONTUP 4 +268 23 BARREL FRONTUP 3 +269 23 BARREL FRONTDOWN 2 +270 23 BARREL FRONTUP 1 +271 23 BARREL FRONTDOWN 0 +272 0 FQQQ RING 0 +273 0 FQQQ RING 1 +274 0 FQQQ RING 2 +275 0 FQQQ RING 3 +276 0 FQQQ RING 4 +277 0 FQQQ RING 5 +278 0 FQQQ RING 6 +279 0 FQQQ RING 7 +280 0 FQQQ RING 8 +281 0 FQQQ RING 9 +282 0 FQQQ RING 10 +283 0 FQQQ RING 11 +284 0 FQQQ RING 12 +285 0 FQQQ RING 13 +286 0 FQQQ RING 14 +287 0 FQQQ RING 15 +288 1 FQQQ RING 0 +289 1 FQQQ RING 1 +290 1 FQQQ RING 2 +291 1 FQQQ RING 3 +292 1 FQQQ RING 4 +293 1 FQQQ RING 5 +294 1 FQQQ RING 6 +295 1 FQQQ RING 7 +296 1 FQQQ RING 8 +297 1 FQQQ RING 9 +298 1 FQQQ RING 10 +299 1 FQQQ RING 11 +300 1 FQQQ RING 12 +301 1 FQQQ RING 13 +302 1 FQQQ RING 14 +303 1 FQQQ RING 15 +304 1 FQQQ WEDGE 15 +305 1 FQQQ WEDGE 14 +306 1 FQQQ WEDGE 13 +307 1 FQQQ WEDGE 12 +308 1 FQQQ WEDGE 11 +309 1 FQQQ WEDGE 10 +310 1 FQQQ WEDGE 9 +311 1 FQQQ WEDGE 8 +312 1 FQQQ WEDGE 7 +313 1 FQQQ WEDGE 6 +314 1 FQQQ WEDGE 5 +315 1 FQQQ WEDGE 4 +316 1 FQQQ WEDGE 3 +317 1 FQQQ WEDGE 2 +318 1 FQQQ WEDGE 1 +319 1 FQQQ WEDGE 0 +320 2 FQQQ RING 15 +321 2 FQQQ RING 14 +322 2 FQQQ RING 13 +323 2 FQQQ RING 12 +324 2 FQQQ RING 11 +325 2 FQQQ RING 10 +326 2 FQQQ RING 9 +327 2 FQQQ RING 8 +328 2 FQQQ RING 7 +329 2 FQQQ RING 6 +330 2 FQQQ RING 5 +331 2 FQQQ RING 4 +332 2 FQQQ RING 3 +333 2 FQQQ RING 2 +334 2 FQQQ RING 1 +335 2 FQQQ RING 0 +336 0 FQQQ WEDGE 15 +337 0 FQQQ WEDGE 14 +338 0 FQQQ WEDGE 13 +339 0 FQQQ WEDGE 12 +340 0 FQQQ WEDGE 11 +341 0 FQQQ WEDGE 10 +342 0 FQQQ WEDGE 9 +343 0 FQQQ WEDGE 8 +344 0 FQQQ WEDGE 7 +345 0 FQQQ WEDGE 6 +346 0 FQQQ WEDGE 5 +347 0 FQQQ WEDGE 4 +348 0 FQQQ WEDGE 3 +349 0 FQQQ WEDGE 2 +350 0 FQQQ WEDGE 1 +351 0 FQQQ WEDGE 0 +352 2 FQQQ WEDGE 15 +353 2 FQQQ WEDGE 14 +354 2 FQQQ WEDGE 13 +355 2 FQQQ WEDGE 12 +356 2 FQQQ WEDGE 11 +357 2 FQQQ WEDGE 10 +358 2 FQQQ WEDGE 9 +359 2 FQQQ WEDGE 8 +360 2 FQQQ WEDGE 7 +361 2 FQQQ WEDGE 6 +362 2 FQQQ WEDGE 5 +363 2 FQQQ WEDGE 4 +364 2 FQQQ WEDGE 3 +365 2 FQQQ WEDGE 2 +366 2 FQQQ WEDGE 1 +367 2 FQQQ WEDGE 0 +368 3 FQQQ WEDGE 15 +369 3 FQQQ WEDGE 14 +370 3 FQQQ WEDGE 13 +371 3 FQQQ WEDGE 12 +372 3 FQQQ WEDGE 11 +373 3 FQQQ WEDGE 10 +374 3 FQQQ WEDGE 9 +375 3 FQQQ WEDGE 8 +376 3 FQQQ WEDGE 7 +377 3 FQQQ WEDGE 6 +378 3 FQQQ WEDGE 5 +379 3 FQQQ WEDGE 4 +380 3 FQQQ WEDGE 3 +381 3 FQQQ WEDGE 2 +382 3 FQQQ WEDGE 1 +383 3 FQQQ WEDGE 0 +384 3 FQQQ RING 0 +385 3 FQQQ RING 1 +386 3 FQQQ RING 2 +387 3 FQQQ RING 3 +388 3 FQQQ RING 4 +389 3 FQQQ RING 5 +390 3 FQQQ RING 6 +391 3 FQQQ RING 7 +392 3 FQQQ RING 8 +393 3 FQQQ RING 9 +394 3 FQQQ RING 10 +395 3 FQQQ RING 11 +396 3 FQQQ RING 12 +397 3 FQQQ RING 13 +398 3 FQQQ RING 14 +399 3 FQQQ RING 15 +400 0 blank blank 0 +401 0 blank blank 1 +402 0 blank blank 2 +403 0 blank blank 3 +404 0 blank blank 4 +405 0 blank blank 5 +406 0 blank blank 6 +407 0 blank blank 7 +408 0 blank blank 8 +409 0 blank blank 9 +410 0 blank blank 10 +411 0 blank blank 11 +412 0 blank blank 12 +413 0 blank blank 13 +414 0 blank blank 14 +415 0 blank blank 15 +416 0 blank blank 1 +417 0 blank blank 2 +418 0 blank blank 3 +419 0 blank blank 4 +420 0 blank blank 5 +421 0 blank blank 6 +422 0 blank blank 7 +423 0 blank blank 8 +424 0 blank blank 9 +425 0 blank blank 10 +426 0 blank blank 11 +427 0 blank blank 12 +428 0 blank blank 13 +429 0 blank blank 14 +430 0 blank blank 15 +431 0 blank blank 0 +432 0 blank blank 1 +433 0 blank blank 2 +434 0 blank blank 3 +435 0 blank blank 4 +436 0 blank blank 5 +437 0 blank blank 6 +438 0 blank blank 7 +439 0 blank blank 8 +440 0 blank blank 9 +441 0 blank blank 10 +442 0 blank blank 11 +443 0 blank blank 12 +444 0 blank blank 13 +445 0 blank blank 14 +446 0 blank blank 15 +447 0 blank blank 15 +448 0 PC CATHODE 16 +449 0 PC CATHODE 17 +450 0 PC CATHODE 18 +451 0 PC CATHODE 19 +452 0 PC CATHODE 20 +453 0 PC CATHODE 21 +454 0 PC CATHODE 22 +455 0 PC CATHODE 23 +456 0 PC ANODE 16 +457 0 PC ANODE 17 +458 0 PC ANODE 18 +459 0 PC ANODE 19 +460 0 PC ANODE 20 +461 0 PC ANODE 21 +462 0 PC ANODE 22 +463 0 PC ANODE 23 +464 0 PC ANODE 0 +465 0 PC ANODE 1 +466 0 PC ANODE 2 +467 0 PC ANODE 3 +468 0 PC ANODE 4 +469 0 PC ANODE 5 +470 0 PC ANODE 6 +471 0 PC ANODE 7 +472 0 PC ANODE 8 +473 0 PC ANODE 9 +474 0 PC ANODE 10 +475 0 PC ANODE 11 +476 0 PC ANODE 12 +477 0 PC ANODE 13 +478 0 PC ANODE 14 +479 0 PC ANODE 15 +480 0 PC CATHODE 0 +481 0 PC CATHODE 1 +482 0 PC CATHODE 2 +483 0 PC CATHODE 3 +484 0 PC CATHODE 4 +485 0 PC CATHODE 5 +486 0 PC CATHODE 6 +487 0 PC CATHODE 7 +488 0 PC CATHODE 8 +489 0 PC CATHODE 9 +490 0 PC CATHODE 10 +491 0 PC CATHODE 11 +492 0 PC CATHODE 12 +493 0 PC CATHODE 13 +494 0 PC CATHODE 14 +495 0 PC CATHODE 15 diff --git a/processRun.C b/processRun.C new file mode 100644 index 0000000..a2b96cb --- /dev/null +++ b/processRun.C @@ -0,0 +1,15 @@ +#include "TFile.h" +#include "TString.h" +#include "TROOT.h" +#include "TTree.h" + + +void processRun(TString runFile){ + + TFile * file = new TFile(runFile); + + TTree * tree = (TTree *) file->Get("tree"); + + tree->Process("Analyzer.C+"); + +} \ No newline at end of file diff --git a/script.C b/script.C index 6abf857..8ffb031 100644 --- a/script.C +++ b/script.C @@ -289,4 +289,4 @@ void script(TString fileName = "", int maxEvent = -1){ //haha->DrawDeducedTrack(sx3.hitPos, wireID.first, wireID.second); -} \ No newline at end of file +}