diff --git a/.gitignore b/.gitignore index 35bedde16a9af093da8fb1506cdfad682e5be2ec..289881e34000382340b65de0cba8f9a26419850d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,8 @@ anaroot/ build/ +build2/ rootfiles/ figure/ *.ridf *.root +*.swp diff --git a/CMakeLists.txt b/CMakeLists.txt index 6f7d7796e348a57e3cb11cafa74eb267680ff2b5..77ecf9794b57e14a6160beff28ee3e06761eb725 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,6 +15,7 @@ else() message(FATAL_ERROT "NOT FOUND ROOT") endif() +find_package(yaml-cpp REQUIRED) # install ANAROOT @@ -57,10 +58,12 @@ target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_14) target_include_directories(${PROJECT_NAME} PUBLIC ${ROOT_INCLUDE_DIRS} ${PROJECT_SOURCE_DIR}/anaroot/include - ${PROJECT_SOURCE_DIR}/include) + ${PROJECT_SOURCE_DIR}/include + ) target_link_libraries(${PROJECT_NAME} - yaml-cpp + /usr/local/lib64/libyaml-cpp.so +# yaml-cpp ${ROOT_LIBRARIES} -L${PROJECT_SOURCE_DIR}/anaroot/lib -lanacore -pthread -lm -ldl -rdynamic diff --git a/README.md b/README.md index 69d45517fda09a1dca1b53905939497b7b348db0..b21508fd348f873b8a15edf5d8d2753c031c7919 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,13 @@ This convert .ridf to .root file * some package(wget, automake autoconf...) * (optionally python and pip pyyaml) + +MEMO +- detector id of map file + - 6: adc + - 7: tdc + - 10: mhtdc + ## Summary This is a tool to convert ridffile to rootfile using ANAROOT decoder. (https://ribf.riken.jp/RIBFDAQ/index.php?Tools%2FAnalysis%2FANAROOT) diff --git a/calibration/si26a/log/mssd_2_1_1ch_mssd.prm b/calibration/si26a/log/mssd_2_1_1ch_mssd.prm new file mode 100644 index 0000000000000000000000000000000000000000..807d3140e1d1898fabf1742c14451b0be0479caa --- /dev/null +++ b/calibration/si26a/log/mssd_2_1_1ch_mssd.prm @@ -0,0 +1,3 @@ +# Created from mssd_calibration.C +# ../rootfiles/alpha307_308_v2 +# mssd_2_1_1ch diff --git a/calibration/si26a/mpos.prm b/calibration/si26a/mpos.prm index a2f4d33bfe807c90320a73d7b35db95af8314b6b..68ce75d3451439f318100169b7c1d6342faea101 100644 --- a/calibration/si26a/mpos.prm +++ b/calibration/si26a/mpos.prm @@ -1,16 +1,14 @@ -# MUX position calibration -# channel of the 16 peaks -# for high0272 -# 1ch, 2ch, ... , 16ch ; name -386.0, 401.0, 418.0, 435.0, 455.0, 471.0, 489.0, 506.0, 527.0, 543.0, 562.0, 578.0, 599.0, 615.0, 635.0, 653.0, ; MUX1-1-p0 -100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, ; MUX1-1-p1 -100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, ; MUX1-2-p0 -100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, ; MUX1-2-p1 -100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, ; MUX2-1-p0 -100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, ; MUX2-1-p1 -100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, ; MUX2-2-p0 -100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, ; MUX2-2-p1 -100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, ; MUX3-1-p0 -100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, ; MUX3-1-p1 -100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, ; MUX3-2-p0 -100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, ; MUX3-2-p1 +# created from mpos.C +# /home/okawa/software/ridf2root/rootfiles/alpha307_308.root +393.8, 410.6, 427.4, 445.4, 464.6, 481.4, 500.6, 517.4, 539, 554.6, 572.6, 589.4, 611, 627.8, 647, 666.2, ; MUX1-1-p0 +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ; MUX1-1-p1 +711.5, 727.5, 746.5, 764.5, 785.5, 802.5, 822.5, 840.5, 863.5, 880.5, 899.5, 917.5, 939.5, 957.5, 977.5, 996.5, ; MUX1-2-p0 +736.5, 736.5, 754.5, 772.5, 794.5, 809.5, 829.5, 848.5, 870.5, 887.5, 906.5, 924.5, 946.5, 963.5, 983.5, 1001.5, ; MUX1-2-p1 +866.5, 879.5, 894.5, 907.5, 926.5, 938.5, 955.5, 970.5, 990.5, 1002.5, 1018.5, 1032.5, 1051.5, 1064.5, 1081.5, 1097.5, ; MUX2-1-p0 +878.5, 878.5, 893.5, 906.5, 925.5, 937.5, 953.5, 968.5, 989.5, 1001.5, 1017.5, 1030.5, 1043.5, 1051.5, 1063.5, 1096.5, ; MUX2-1-p1 +1310.5, 1326.5, 1345.5, 1363.5, 1385.5, 1402.5, 1422.5, 1441.5, 1464.5, 1481.5, 1501.5, 1519.5, 1542.5, 1559.5, 1580.5, 1600.5, ; MUX2-2-p0 +1345.5, 1345.5, 1364.5, 1382.5, 1404.5, 1421.5, 1441.5, 1461.5, 1483.5, 1501.5, 1520.5, 1539.5, 1561.5, 1579.5, 1600.5, 1620.5, ; MUX2-2-p1 +1428.5, 1442.5, 1457.5, 1472.5, 1491.5, 1506.5, 1522.5, 1538.5, 1559.5, 1574.5, 1590.5, 1605.5, 1625.5, 1640.5, 1658.5, 1675.5, ; MUX3-1-p0 +1445.5, 1445.5, 1460.5, 1474.5, 1495.5, 1508.5, 1525.5, 1541.5, 1575.5, 1591.5, 1598.5, 1609.5, 1628.5, 1643.5, 1663.5, 1678.5, ; MUX3-1-p1 +1615.5, 1626.5, 1642.5, 1657.5, 1676.5, 1689.5, 1706.5, 1722.5, 1744.5, 1757.5, 1771.5, 1790, 1808.5, 1822.5, 1841.5, 1855.5, ; MUX3-2-p0 +1633.5, 1633.5, 1647.5, 1678.5, 1685.5, 1696.5, 1719.5, 1748.5, 1767.5, 1779.5, 1798.5, 1809.5, 1820.5, 1831.5, 1840.5, 1882.5, ; MUX3-2-p1 diff --git a/include/CalibrationManager.hh b/include/CalibrationManager.hh deleted file mode 100644 index ccb37fce4473292b565264caadc66181e89e5d10..0000000000000000000000000000000000000000 --- a/include/CalibrationManager.hh +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef _CALIBRATIONMANAGER_HH_ -#define _CALIBRATIONMANAGER_HH_ - -#include -#include - -#include - -using namespace std; - -//these functions are used to the TCordferCalibBranch -Double_t GetCalibValue(Int_t val, vector params); - - -#endif diff --git a/include/MapReader.hh b/include/MapReader.hh index 05c476170aa6b6351467c99dd696f1521bb5e541..735fd886e1e231ffc6ac0336cc278ca05f3faaa8 100644 --- a/include/MapReader.hh +++ b/include/MapReader.hh @@ -31,9 +31,10 @@ class MapReader ~MapReader(){} Int_t size = 0; - vector< vector > segment_id; - vector< vector > channel; - vector detector_name; + vector< vector > det_id; //det_id[branch_ch][detector_id] + vector< vector > segment_id; //segment_id[branch_ch][geo] + vector< vector > channel; //channel[branch_ch][channel] + vector detector_name; //detector_name[branch_id] void SetMapFile(TString in_filename){ filename = in_filename; } diff --git a/include/TCordferBranchManager.hh b/include/TCordferBranchManager.hh index 2630a79b239386a5a38735cbba48a619506251d6..718f46fa937b428d7fa20c5a81c5040a32d8440c 100644 --- a/include/TCordferBranchManager.hh +++ b/include/TCordferBranchManager.hh @@ -3,7 +3,6 @@ #include #include -#include #include #include @@ -14,10 +13,12 @@ #include "CalibParamReader.hh" #include "TCordferRawBranch.hh" #include "TCordferMapBranch.hh" -#include "TCordferCalibBranch.hh" using namespace std; +#define MAX_SEGMENT_ID 100 + + class TCordferBranchManager { private: @@ -28,26 +29,19 @@ class TCordferBranchManager TTree *tree; TTree *mtree; - TTree *ctree; TH1I *scaler; vector branch; vector mbranch; - vector cbranch; - Int_t rmapping[100]; //segment_id(geo) -> branch index - Int_t mmapping[100][100]; // [segment_id][ch] -> branch index - Int_t cmapping[100][100]; - Int_t muxmapping[100][100]; + Int_t rmapping[MAX_SEGMENT_ID]; //segment_id(geo) -> branch index + Int_t mmapping[MAX_SEGMENT_ID][MAX_CHANNEL]; // [segment_id][ch] -> branch index - vector< vector > mpos; //for position parameter of MUX (mssd) bool rawdata = false; bool mapdata = false; - bool calibration = false; bool rmapflag = false; bool mmapflag = false; - bool cmapflag = false; public: TCordferBranchManager(){} @@ -66,12 +60,10 @@ class TCordferBranchManager void CreateTree(); void CreateRawTree(); void CreateMapTree(); - void CreateCalibTree(); void CreateBranch(); void CreateRawBranch(); void CreateMapBranch(); - void CreateCalibBranch(); Int_t MakeBranchChannelIndex(Int_t bra_id, Int_t ch_id){ return bra_id*100 + ch_id; } @@ -84,27 +76,22 @@ class TCordferBranchManager void CreateMapping(); void CreateRawMapping(); void CreateMapMapping(); - void CreateCalibMapping(); void GiveValue(Int_t geo, Int_t ch, Int_t val); void GiveRawValue(Int_t geo, Int_t ch, Int_t val); void GiveMapValue(Int_t geo, Int_t ch, Int_t val); - void GiveCalibValue(Int_t geo, Int_t ch, Int_t val); void Fill(); void RawFill(){ tree->Fill(); } void MapFill(){ mtree->Fill(); } - void CalibFill() { ctree->Fill(); } void ClearAll(); void ClearRawAll(); void ClearMapAll(); - void ClearCalibAll(); void DataWrite(); void RawDataWrite(){ tree->Write(); } void MapDataWrite(){ mtree->Write(); } - void CalibDataWrite(){ ctree->Write(); } void FileClose(); diff --git a/include/TCordferMapBranch.hh b/include/TCordferMapBranch.hh index 732417c00d1c110a10395a1c4539173929af7820..a7ed1b127cbc0e54a70b15cb9bdc718f91e72385 100644 --- a/include/TCordferMapBranch.hh +++ b/include/TCordferMapBranch.hh @@ -6,8 +6,13 @@ #include +#include "TCordferRawBranch.hh" + using namespace std; +#define MAP_CHANNEL_MAX 16 + + class TCordferMapBranch { private: @@ -19,22 +24,36 @@ class TCordferMapBranch name = bname; detector_id = det_id; size = bsize; - MemorySet(); + for(Int_t i=0; i segment_id; vector channel; + vector detector_flag; + vector nhit; TString GetBranchName(){ return name; } - void MemorySet(){ bra_val = new Int_t[size]; } - void FreeMemory(){ delete[] bra_val; } - void SetMapInfo(vector seg, vector ch); + void SetMapInfo(vector seg, vector ch, vector det); + void SetADCMapInfo(vector seg, vector ch, vector det); //except for last coulum + void SetTDCMapInfo(vector seg, vector ch, vector det); //get the last coulumm + void SetDSSDMapInfo(Int_t seg, Int_t ch, Int_t det); //set the DSSD id void Clear(); }; diff --git a/include/TCordferRawBranch.hh b/include/TCordferRawBranch.hh index a1a3db5d4eb6803324cd4f4fbf12f5e5c9ca64e4..bd14f6e0ca24c92a028e4f368ba344aefebb4f95 100644 --- a/include/TCordferRawBranch.hh +++ b/include/TCordferRawBranch.hh @@ -8,6 +8,10 @@ using namespace std; +#define MAX_CHANNEL 64 +#define MAX_NHIT 12 + + class TCordferRawBranch { private: @@ -20,37 +24,30 @@ class TCordferRawBranch geo = segment_id; size = bsize; detector_id = det_id; - MemorySet(); + max_hit = 0; } TCordferRawBranch(TString bname, Int_t segment_id, Int_t bsize, Int_t det_id, Int_t bnhit){ name = bname; geo = segment_id; size = bsize; detector_id = det_id; - nhit = bnhit; - TwoDimMemorySet(); + max_hit = bnhit; } ~TCordferRawBranch(){} Int_t size; Int_t detector_id; - Int_t nhit; + Int_t max_hit; Int_t geo; - Int_t *bra_val; - Int_t **mhtdc_val; + Int_t bra_val[MAX_CHANNEL]; + Int_t mhtdc_val[MAX_CHANNEL][MAX_NHIT]; + Int_t nhit[MAX_CHANNEL]; TString GetBranchName(){ return name; } void Setgeo(Int_t id){ geo = id; } - void MemorySet(){ bra_val = new Int_t[size]; } - void TwoDimMemorySet(); - void FreeMemory(){ delete[] bra_val; } - void FreeTwoDimMemory(); - - //bool SetValue(Int_t ch, Int_t val); //return flag of mhtdc of others void Clear(); - void FreeAll(); }; #endif diff --git a/macro/check_map_tree.C b/macro/check_map_tree.C new file mode 100644 index 0000000000000000000000000000000000000000..8a82b51951411bfc75ba362ade6495c62df0cf40 --- /dev/null +++ b/macro/check_map_tree.C @@ -0,0 +1,425 @@ +//this macro create all histograms and save as png file +//(for check the code is correct) +//CAUTION: many file will be created + +{ + gStyle->SetOptLogy(1); + + TCanvas *c1 = new TCanvas("c1", "c1"); + mtree->Draw("coin_Single[0]"); + c1->Print("../figure/map/coin_Single[0].png"); + mtree->Draw("coin_Coin[0]"); + c1->Print("../figure/map/coin_Coin[0].png"); + mtree->Draw("coin_Pileup[0]"); + c1->Print("../figure/map/coin_Pileup[0].png"); + mtree->Draw("dssd_Tel1_dE1X_1[0]"); + c1->Print("../figure/map/dssd_Tel1_dE1X_1[0].png"); + mtree->Draw("dssd_Tel1_dE1X_1[1]"); + c1->Print("../figure/map/dssd_Tel1_dE1X_1[1].png"); + mtree->Draw("dssd_Tel1_dE1X_2[0]"); + c1->Print("../figure/map/dssd_Tel1_dE1X_2[0].png"); + mtree->Draw("dssd_Tel1_dE1X_2[1]"); + c1->Print("../figure/map/dssd_Tel1_dE1X_2[1].png"); + mtree->Draw("dssd_Tel1_dE1X_3[0]"); + c1->Print("../figure/map/dssd_Tel1_dE1X_3[0].png"); + mtree->Draw("dssd_Tel1_dE1X_3[1]"); + c1->Print("../figure/map/dssd_Tel1_dE1X_3[1].png"); + mtree->Draw("dssd_Tel1_dE1X_4[0]"); + c1->Print("../figure/map/dssd_Tel1_dE1X_4[0].png"); + mtree->Draw("dssd_Tel1_dE1X_4[1]"); + c1->Print("../figure/map/dssd_Tel1_dE1X_4[1].png"); + mtree->Draw("dssd_Tel1_dE1X_5[0]"); + c1->Print("../figure/map/dssd_Tel1_dE1X_5[0].png"); + mtree->Draw("dssd_Tel1_dE1X_5[1]"); + c1->Print("../figure/map/dssd_Tel1_dE1X_5[1].png"); + mtree->Draw("dssd_Tel1_dE1X_6[0]"); + c1->Print("../figure/map/dssd_Tel1_dE1X_6[0].png"); + mtree->Draw("dssd_Tel1_dE1X_6[1]"); + c1->Print("../figure/map/dssd_Tel1_dE1X_6[1].png"); + mtree->Draw("dssd_Tel1_dE1X_7[0]"); + c1->Print("../figure/map/dssd_Tel1_dE1X_7[0].png"); + mtree->Draw("dssd_Tel1_dE1X_7[1]"); + c1->Print("../figure/map/dssd_Tel1_dE1X_7[1].png"); + mtree->Draw("dssd_Tel1_dE1X_8[0]"); + c1->Print("../figure/map/dssd_Tel1_dE1X_8[0].png"); + mtree->Draw("dssd_Tel1_dE1X_8[1]"); + c1->Print("../figure/map/dssd_Tel1_dE1X_8[1].png"); + mtree->Draw("dssd_Tel1_dE1X_9[0]"); + c1->Print("../figure/map/dssd_Tel1_dE1X_9[0].png"); + mtree->Draw("dssd_Tel1_dE1X_9[1]"); + c1->Print("../figure/map/dssd_Tel1_dE1X_9[1].png"); + mtree->Draw("dssd_Tel1_dE1X_10[0]"); + c1->Print("../figure/map/dssd_Tel1_dE1X_10[0].png"); + mtree->Draw("dssd_Tel1_dE1X_10[1]"); + c1->Print("../figure/map/dssd_Tel1_dE1X_10[1].png"); + mtree->Draw("dssd_Tel1_dE1X_11[0]"); + c1->Print("../figure/map/dssd_Tel1_dE1X_11[0].png"); + mtree->Draw("dssd_Tel1_dE1X_11[1]"); + c1->Print("../figure/map/dssd_Tel1_dE1X_11[1].png"); + mtree->Draw("dssd_Tel1_dE1X_12[0]"); + c1->Print("../figure/map/dssd_Tel1_dE1X_12[0].png"); + mtree->Draw("dssd_Tel1_dE1X_12[1]"); + c1->Print("../figure/map/dssd_Tel1_dE1X_12[1].png"); + mtree->Draw("dssd_Tel1_dE1X_13[0]"); + c1->Print("../figure/map/dssd_Tel1_dE1X_13[0].png"); + mtree->Draw("dssd_Tel1_dE1X_13[1]"); + c1->Print("../figure/map/dssd_Tel1_dE1X_13[1].png"); + mtree->Draw("dssd_Tel1_dE1X_14[0]"); + c1->Print("../figure/map/dssd_Tel1_dE1X_14[0].png"); + mtree->Draw("dssd_Tel1_dE1X_14[1]"); + c1->Print("../figure/map/dssd_Tel1_dE1X_14[1].png"); + mtree->Draw("dssd_Tel1_dE1X_15[0]"); + c1->Print("../figure/map/dssd_Tel1_dE1X_15[0].png"); + mtree->Draw("dssd_Tel1_dE1X_15[1]"); + c1->Print("../figure/map/dssd_Tel1_dE1X_15[1].png"); + mtree->Draw("dssd_Tel1_dE1X_16[0]"); + c1->Print("../figure/map/dssd_Tel1_dE1X_16[0].png"); + mtree->Draw("dssd_Tel1_dE1X_16[1]"); + c1->Print("../figure/map/dssd_Tel1_dE1X_16[1].png"); + mtree->Draw("dssd_Tel1_dE2Y_1[0]"); + c1->Print("../figure/map/dssd_Tel1_dE2Y_1[0].png"); + mtree->Draw("dssd_Tel1_dE2Y_1[1]"); + c1->Print("../figure/map/dssd_Tel1_dE2Y_1[1].png"); + mtree->Draw("dssd_Tel1_dE2Y_2[0]"); + c1->Print("../figure/map/dssd_Tel1_dE2Y_2[0].png"); + mtree->Draw("dssd_Tel1_dE2Y_2[1]"); + c1->Print("../figure/map/dssd_Tel1_dE2Y_2[1].png"); + mtree->Draw("dssd_Tel1_dE2Y_3[0]"); + c1->Print("../figure/map/dssd_Tel1_dE2Y_3[0].png"); + mtree->Draw("dssd_Tel1_dE2Y_3[1]"); + c1->Print("../figure/map/dssd_Tel1_dE2Y_3[1].png"); + mtree->Draw("dssd_Tel1_dE2Y_4[0]"); + c1->Print("../figure/map/dssd_Tel1_dE2Y_4[0].png"); + mtree->Draw("dssd_Tel1_dE2Y_4[1]"); + c1->Print("../figure/map/dssd_Tel1_dE2Y_4[1].png"); + mtree->Draw("dssd_Tel1_dE2Y_5[0]"); + c1->Print("../figure/map/dssd_Tel1_dE2Y_5[0].png"); + mtree->Draw("dssd_Tel1_dE2Y_5[1]"); + c1->Print("../figure/map/dssd_Tel1_dE2Y_5[1].png"); + mtree->Draw("dssd_Tel1_dE2Y_6[0]"); + c1->Print("../figure/map/dssd_Tel1_dE2Y_6[0].png"); + mtree->Draw("dssd_Tel1_dE2Y_6[1]"); + c1->Print("../figure/map/dssd_Tel1_dE2Y_6[1].png"); + mtree->Draw("dssd_Tel1_dE2Y_7[0]"); + c1->Print("../figure/map/dssd_Tel1_dE2Y_7[0].png"); + mtree->Draw("dssd_Tel1_dE2Y_7[1]"); + c1->Print("../figure/map/dssd_Tel1_dE2Y_7[1].png"); + mtree->Draw("dssd_Tel1_dE2Y_8[0]"); + c1->Print("../figure/map/dssd_Tel1_dE2Y_8[0].png"); + mtree->Draw("dssd_Tel1_dE2Y_8[1]"); + c1->Print("../figure/map/dssd_Tel1_dE2Y_8[1].png"); + mtree->Draw("dssd_Tel1_dE2Y_9[0]"); + c1->Print("../figure/map/dssd_Tel1_dE2Y_9[0].png"); + mtree->Draw("dssd_Tel1_dE2Y_9[1]"); + c1->Print("../figure/map/dssd_Tel1_dE2Y_9[1].png"); + mtree->Draw("dssd_Tel1_dE2Y_10[0]"); + c1->Print("../figure/map/dssd_Tel1_dE2Y_10[0].png"); + mtree->Draw("dssd_Tel1_dE2Y_10[1]"); + c1->Print("../figure/map/dssd_Tel1_dE2Y_10[1].png"); + mtree->Draw("dssd_Tel1_dE2Y_11[0]"); + c1->Print("../figure/map/dssd_Tel1_dE2Y_11[0].png"); + mtree->Draw("dssd_Tel1_dE2Y_11[1]"); + c1->Print("../figure/map/dssd_Tel1_dE2Y_11[1].png"); + mtree->Draw("dssd_Tel1_dE2Y_12[0]"); + c1->Print("../figure/map/dssd_Tel1_dE2Y_12[0].png"); + mtree->Draw("dssd_Tel1_dE2Y_12[1]"); + c1->Print("../figure/map/dssd_Tel1_dE2Y_12[1].png"); + mtree->Draw("dssd_Tel1_dE2Y_13[0]"); + c1->Print("../figure/map/dssd_Tel1_dE2Y_13[0].png"); + mtree->Draw("dssd_Tel1_dE2Y_13[1]"); + c1->Print("../figure/map/dssd_Tel1_dE2Y_13[1].png"); + mtree->Draw("dssd_Tel1_dE2Y_14[0]"); + c1->Print("../figure/map/dssd_Tel1_dE2Y_14[0].png"); + mtree->Draw("dssd_Tel1_dE2Y_14[1]"); + c1->Print("../figure/map/dssd_Tel1_dE2Y_14[1].png"); + mtree->Draw("dssd_Tel1_dE2Y_15[0]"); + c1->Print("../figure/map/dssd_Tel1_dE2Y_15[0].png"); + mtree->Draw("dssd_Tel1_dE2Y_15[1]"); + c1->Print("../figure/map/dssd_Tel1_dE2Y_15[1].png"); + mtree->Draw("dssd_Tel1_dE2Y_16[0]"); + c1->Print("../figure/map/dssd_Tel1_dE2Y_16[0].png"); + mtree->Draw("dssd_Tel1_dE2Y_16[1]"); + c1->Print("../figure/map/dssd_Tel1_dE2Y_16[1].png"); + mtree->Draw("dssd_Tel2_dE2Y_1[0]"); + c1->Print("../figure/map/dssd_Tel2_dE2Y_1[0].png"); + mtree->Draw("dssd_Tel2_dE2Y_1[1]"); + c1->Print("../figure/map/dssd_Tel2_dE2Y_1[1].png"); + mtree->Draw("dssd_Tel2_dE2Y_2[0]"); + c1->Print("../figure/map/dssd_Tel2_dE2Y_2[0].png"); + mtree->Draw("dssd_Tel2_dE2Y_2[1]"); + c1->Print("../figure/map/dssd_Tel2_dE2Y_2[1].png"); + mtree->Draw("dssd_Tel2_dE2Y_3[0]"); + c1->Print("../figure/map/dssd_Tel2_dE2Y_3[0].png"); + mtree->Draw("dssd_Tel2_dE2Y_3[1]"); + c1->Print("../figure/map/dssd_Tel2_dE2Y_3[1].png"); + mtree->Draw("dssd_Tel2_dE2Y_4[0]"); + c1->Print("../figure/map/dssd_Tel2_dE2Y_4[0].png"); + mtree->Draw("dssd_Tel2_dE2Y_4[1]"); + c1->Print("../figure/map/dssd_Tel2_dE2Y_4[1].png"); + mtree->Draw("dssd_Tel2_dE2Y_5[0]"); + c1->Print("../figure/map/dssd_Tel2_dE2Y_5[0].png"); + mtree->Draw("dssd_Tel2_dE2Y_5[1]"); + c1->Print("../figure/map/dssd_Tel2_dE2Y_5[1].png"); + mtree->Draw("dssd_Tel2_dE2Y_6[0]"); + c1->Print("../figure/map/dssd_Tel2_dE2Y_6[0].png"); + mtree->Draw("dssd_Tel2_dE2Y_6[1]"); + c1->Print("../figure/map/dssd_Tel2_dE2Y_6[1].png"); + mtree->Draw("dssd_Tel2_dE2Y_7[0]"); + c1->Print("../figure/map/dssd_Tel2_dE2Y_7[0].png"); + mtree->Draw("dssd_Tel2_dE2Y_7[1]"); + c1->Print("../figure/map/dssd_Tel2_dE2Y_7[1].png"); + mtree->Draw("dssd_Tel2_dE2Y_8[0]"); + c1->Print("../figure/map/dssd_Tel2_dE2Y_8[0].png"); + mtree->Draw("dssd_Tel2_dE2Y_8[1]"); + c1->Print("../figure/map/dssd_Tel2_dE2Y_8[1].png"); + mtree->Draw("dssd_Tel2_dE2Y_9[0]"); + c1->Print("../figure/map/dssd_Tel2_dE2Y_9[0].png"); + mtree->Draw("dssd_Tel2_dE2Y_9[1]"); + c1->Print("../figure/map/dssd_Tel2_dE2Y_9[1].png"); + mtree->Draw("dssd_Tel2_dE2Y_10[0]"); + c1->Print("../figure/map/dssd_Tel2_dE2Y_10[0].png"); + mtree->Draw("dssd_Tel2_dE2Y_10[1]"); + c1->Print("../figure/map/dssd_Tel2_dE2Y_10[1].png"); + mtree->Draw("dssd_Tel2_dE2Y_11[0]"); + c1->Print("../figure/map/dssd_Tel2_dE2Y_11[0].png"); + mtree->Draw("dssd_Tel2_dE2Y_11[1]"); + c1->Print("../figure/map/dssd_Tel2_dE2Y_11[1].png"); + mtree->Draw("dssd_Tel2_dE2Y_12[0]"); + c1->Print("../figure/map/dssd_Tel2_dE2Y_12[0].png"); + mtree->Draw("dssd_Tel2_dE2Y_12[1]"); + c1->Print("../figure/map/dssd_Tel2_dE2Y_12[1].png"); + mtree->Draw("dssd_Tel2_dE2Y_13[0]"); + c1->Print("../figure/map/dssd_Tel2_dE2Y_13[0].png"); + mtree->Draw("dssd_Tel2_dE2Y_13[1]"); + c1->Print("../figure/map/dssd_Tel2_dE2Y_13[1].png"); + mtree->Draw("dssd_Tel2_dE2Y_14[0]"); + c1->Print("../figure/map/dssd_Tel2_dE2Y_14[0].png"); + mtree->Draw("dssd_Tel2_dE2Y_14[1]"); + c1->Print("../figure/map/dssd_Tel2_dE2Y_14[1].png"); + mtree->Draw("dssd_Tel2_dE2Y_15[0]"); + c1->Print("../figure/map/dssd_Tel2_dE2Y_15[0].png"); + mtree->Draw("dssd_Tel2_dE2Y_15[1]"); + c1->Print("../figure/map/dssd_Tel2_dE2Y_15[1].png"); + mtree->Draw("dssd_Tel2_dE2Y_16[0]"); + c1->Print("../figure/map/dssd_Tel2_dE2Y_16[0].png"); + mtree->Draw("dssd_Tel2_dE2Y_16[1]"); + c1->Print("../figure/map/dssd_Tel2_dE2Y_16[1].png"); + mtree->Draw("dssd_Tel3_dE2Y_1[0]"); + c1->Print("../figure/map/dssd_Tel3_dE2Y_1[0].png"); + mtree->Draw("dssd_Tel3_dE2Y_1[1]"); + c1->Print("../figure/map/dssd_Tel3_dE2Y_1[1].png"); + mtree->Draw("dssd_Tel3_dE2Y_2[0]"); + c1->Print("../figure/map/dssd_Tel3_dE2Y_2[0].png"); + mtree->Draw("dssd_Tel3_dE2Y_2[1]"); + c1->Print("../figure/map/dssd_Tel3_dE2Y_2[1].png"); + mtree->Draw("dssd_Tel3_dE2Y_3[0]"); + c1->Print("../figure/map/dssd_Tel3_dE2Y_3[0].png"); + mtree->Draw("dssd_Tel3_dE2Y_3[1]"); + c1->Print("../figure/map/dssd_Tel3_dE2Y_3[1].png"); + mtree->Draw("dssd_Tel3_dE2Y_4[0]"); + c1->Print("../figure/map/dssd_Tel3_dE2Y_4[0].png"); + mtree->Draw("dssd_Tel3_dE2Y_4[1]"); + c1->Print("../figure/map/dssd_Tel3_dE2Y_4[1].png"); + mtree->Draw("dssd_Tel3_dE2Y_5[0]"); + c1->Print("../figure/map/dssd_Tel3_dE2Y_5[0].png"); + mtree->Draw("dssd_Tel3_dE2Y_5[1]"); + c1->Print("../figure/map/dssd_Tel3_dE2Y_5[1].png"); + mtree->Draw("dssd_Tel3_dE2Y_6[0]"); + c1->Print("../figure/map/dssd_Tel3_dE2Y_6[0].png"); + mtree->Draw("dssd_Tel3_dE2Y_6[1]"); + c1->Print("../figure/map/dssd_Tel3_dE2Y_6[1].png"); + mtree->Draw("dssd_Tel3_dE2Y_7[0]"); + c1->Print("../figure/map/dssd_Tel3_dE2Y_7[0].png"); + mtree->Draw("dssd_Tel3_dE2Y_7[1]"); + c1->Print("../figure/map/dssd_Tel3_dE2Y_7[1].png"); + mtree->Draw("dssd_Tel3_dE2Y_8[0]"); + c1->Print("../figure/map/dssd_Tel3_dE2Y_8[0].png"); + mtree->Draw("dssd_Tel3_dE2Y_8[1]"); + c1->Print("../figure/map/dssd_Tel3_dE2Y_8[1].png"); + mtree->Draw("dssd_Tel3_dE2Y_9[0]"); + c1->Print("../figure/map/dssd_Tel3_dE2Y_9[0].png"); + mtree->Draw("dssd_Tel3_dE2Y_9[1]"); + c1->Print("../figure/map/dssd_Tel3_dE2Y_9[1].png"); + mtree->Draw("dssd_Tel3_dE2Y_10[0]"); + c1->Print("../figure/map/dssd_Tel3_dE2Y_10[0].png"); + mtree->Draw("dssd_Tel3_dE2Y_10[1]"); + c1->Print("../figure/map/dssd_Tel3_dE2Y_10[1].png"); + mtree->Draw("dssd_Tel3_dE2Y_11[0]"); + c1->Print("../figure/map/dssd_Tel3_dE2Y_11[0].png"); + mtree->Draw("dssd_Tel3_dE2Y_11[1]"); + c1->Print("../figure/map/dssd_Tel3_dE2Y_11[1].png"); + mtree->Draw("dssd_Tel3_dE2Y_12[0]"); + c1->Print("../figure/map/dssd_Tel3_dE2Y_12[0].png"); + mtree->Draw("dssd_Tel3_dE2Y_12[1]"); + c1->Print("../figure/map/dssd_Tel3_dE2Y_12[1].png"); + mtree->Draw("dssd_Tel3_dE2Y_13[0]"); + c1->Print("../figure/map/dssd_Tel3_dE2Y_13[0].png"); + mtree->Draw("dssd_Tel3_dE2Y_13[1]"); + c1->Print("../figure/map/dssd_Tel3_dE2Y_13[1].png"); + mtree->Draw("dssd_Tel3_dE2Y_14[0]"); + c1->Print("../figure/map/dssd_Tel3_dE2Y_14[0].png"); + mtree->Draw("dssd_Tel3_dE2Y_14[1]"); + c1->Print("../figure/map/dssd_Tel3_dE2Y_14[1].png"); + mtree->Draw("dssd_Tel3_dE2Y_15[0]"); + c1->Print("../figure/map/dssd_Tel3_dE2Y_15[0].png"); + mtree->Draw("dssd_Tel3_dE2Y_15[1]"); + c1->Print("../figure/map/dssd_Tel3_dE2Y_15[1].png"); + mtree->Draw("dssd_Tel3_dE2Y_16[0]"); + c1->Print("../figure/map/dssd_Tel3_dE2Y_16[0].png"); + mtree->Draw("dssd_Tel3_dE2Y_16[1]"); + c1->Print("../figure/map/dssd_Tel3_dE2Y_16[1].png"); + mtree->Draw("mssd_1_1[0]"); + c1->Print("../figure/map/mssd_1_1[0].png"); + mtree->Draw("mssd_1_1[1]"); + c1->Print("../figure/map/mssd_1_1[1].png"); + mtree->Draw("mssd_1_1[2]"); + c1->Print("../figure/map/mssd_1_1[2].png"); + mtree->Draw("mssd_1_1[3]"); + c1->Print("../figure/map/mssd_1_1[3].png"); + mtree->Draw("mssd_1_1[4]"); + c1->Print("../figure/map/mssd_1_1[4].png"); + mtree->Draw("mssd_1_2[0]"); + c1->Print("../figure/map/mssd_1_2[0].png"); + mtree->Draw("mssd_1_2[1]"); + c1->Print("../figure/map/mssd_1_2[1].png"); + mtree->Draw("mssd_1_2[2]"); + c1->Print("../figure/map/mssd_1_2[2].png"); + mtree->Draw("mssd_1_2[3]"); + c1->Print("../figure/map/mssd_1_2[3].png"); + mtree->Draw("mssd_1_2[4]"); + c1->Print("../figure/map/mssd_1_2[4].png"); + mtree->Draw("mssd_2_1[0]"); + c1->Print("../figure/map/mssd_2_1[0].png"); + mtree->Draw("mssd_2_1[1]"); + c1->Print("../figure/map/mssd_2_1[1].png"); + mtree->Draw("mssd_2_1[2]"); + c1->Print("../figure/map/mssd_2_1[2].png"); + mtree->Draw("mssd_2_1[3]"); + c1->Print("../figure/map/mssd_2_1[3].png"); + mtree->Draw("mssd_2_1[4]"); + c1->Print("../figure/map/mssd_2_1[4].png"); + mtree->Draw("mssd_2_2[0]"); + c1->Print("../figure/map/mssd_2_2[0].png"); + mtree->Draw("mssd_2_2[1]"); + c1->Print("../figure/map/mssd_2_2[1].png"); + mtree->Draw("mssd_2_2[2]"); + c1->Print("../figure/map/mssd_2_2[2].png"); + mtree->Draw("mssd_2_2[3]"); + c1->Print("../figure/map/mssd_2_2[3].png"); + mtree->Draw("mssd_2_2[4]"); + c1->Print("../figure/map/mssd_2_2[4].png"); + mtree->Draw("mssd_3_1[0]"); + c1->Print("../figure/map/mssd_3_1[0].png"); + mtree->Draw("mssd_3_1[1]"); + c1->Print("../figure/map/mssd_3_1[1].png"); + mtree->Draw("mssd_3_1[2]"); + c1->Print("../figure/map/mssd_3_1[2].png"); + mtree->Draw("mssd_3_1[3]"); + c1->Print("../figure/map/mssd_3_1[3].png"); + mtree->Draw("mssd_3_1[4]"); + c1->Print("../figure/map/mssd_3_1[4].png"); + mtree->Draw("mssd_3_2[0]"); + c1->Print("../figure/map/mssd_3_2[0].png"); + mtree->Draw("mssd_3_2[1]"); + c1->Print("../figure/map/mssd_3_2[1].png"); + mtree->Draw("mssd_3_2[2]"); + c1->Print("../figure/map/mssd_3_2[2].png"); + mtree->Draw("mssd_3_2[3]"); + c1->Print("../figure/map/mssd_3_2[3].png"); + mtree->Draw("mssd_3_2[4]"); + c1->Print("../figure/map/mssd_3_2[4].png"); + mtree->Draw("ppac_F1[0]"); + c1->Print("../figure/map/ppac_F1[0].png"); + mtree->Draw("ppac_F1[1]"); + c1->Print("../figure/map/ppac_F1[1].png"); + mtree->Draw("ppac_F1[2]"); + c1->Print("../figure/map/ppac_F1[2].png"); + mtree->Draw("ppac_F1[3]"); + c1->Print("../figure/map/ppac_F1[3].png"); + mtree->Draw("ppac_F1[4]"); + c1->Print("../figure/map/ppac_F1[4].png"); + mtree->Draw("ppac_F2_F3_B[0]"); + c1->Print("../figure/map/ppac_F2_F3_B[0].png"); + mtree->Draw("ppac_F2_F3_B[1]"); + c1->Print("../figure/map/ppac_F2_F3_B[1].png"); + mtree->Draw("ppac_F2_F3_B[2]"); + c1->Print("../figure/map/ppac_F2_F3_B[2].png"); + mtree->Draw("ppac_F2_F3_B[3]"); + c1->Print("../figure/map/ppac_F2_F3_B[3].png"); + mtree->Draw("ppac_F2_F3_B[4]"); + c1->Print("../figure/map/ppac_F2_F3_B[4].png"); + mtree->Draw("ppac_F3_A[0]"); + c1->Print("../figure/map/ppac_F3_A[0].png"); + mtree->Draw("ppac_F3_A[1]"); + c1->Print("../figure/map/ppac_F3_A[1].png"); + mtree->Draw("ppac_F3_A[2]"); + c1->Print("../figure/map/ppac_F3_A[2].png"); + mtree->Draw("ppac_F3_A[3]"); + c1->Print("../figure/map/ppac_F3_A[3].png"); + mtree->Draw("ppac_F3_A[4]"); + c1->Print("../figure/map/ppac_F3_A[4].png"); + mtree->Draw("rf_RF[0]"); + c1->Print("../figure/map/rf_RF[0].png"); + mtree->Draw("rf_RF[1]"); + c1->Print("../figure/map/rf_RF[1].png"); + mtree->Draw("ssd_Tel1_E1[0]"); + c1->Print("../figure/map/ssd_Tel1_E1[0].png"); + mtree->Draw("ssd_Tel1_E1[1]"); + c1->Print("../figure/map/ssd_Tel1_E1[1].png"); + mtree->Draw("ssd_Tel1_E2[0]"); + c1->Print("../figure/map/ssd_Tel1_E2[0].png"); + mtree->Draw("ssd_Tel1_E2[1]"); + c1->Print("../figure/map/ssd_Tel1_E2[1].png"); + mtree->Draw("ssd_Tel2_E1[0]"); + c1->Print("../figure/map/ssd_Tel2_E1[0].png"); + mtree->Draw("ssd_Tel2_E1[1]"); + c1->Print("../figure/map/ssd_Tel2_E1[1].png"); + mtree->Draw("ssd_Tel2_E2[0]"); + c1->Print("../figure/map/ssd_Tel2_E2[0].png"); + mtree->Draw("ssd_Tel2_E2[1]"); + c1->Print("../figure/map/ssd_Tel2_E2[1].png"); + mtree->Draw("ssd_Tel3_E1[0]"); + c1->Print("../figure/map/ssd_Tel3_E1[0].png"); + mtree->Draw("ssd_Tel3_E1[1]"); + c1->Print("../figure/map/ssd_Tel3_E1[1].png"); + mtree->Draw("ssd_Tel3_E2[0]"); + c1->Print("../figure/map/ssd_Tel3_E2[0].png"); + mtree->Draw("ssd_Tel3_E2[1]"); + c1->Print("../figure/map/ssd_Tel3_E2[1].png"); + mtree->Draw("ssd_Tel4_E1[0]"); + c1->Print("../figure/map/ssd_Tel4_E1[0].png"); + mtree->Draw("ssd_Tel4_E1[1]"); + c1->Print("../figure/map/ssd_Tel4_E1[1].png"); + mtree->Draw("ssd_Tel4_E2[0]"); + c1->Print("../figure/map/ssd_Tel4_E2[0].png"); + mtree->Draw("ssd_Tel4_E2[1]"); + c1->Print("../figure/map/ssd_Tel4_E2[1].png"); + mtree->Draw("ssd_Tel5_E1[0]"); + c1->Print("../figure/map/ssd_Tel5_E1[0].png"); + mtree->Draw("ssd_Tel5_E1[1]"); + c1->Print("../figure/map/ssd_Tel5_E1[1].png"); + mtree->Draw("ssd_Tel5_E2[0]"); + c1->Print("../figure/map/ssd_Tel5_E2[0].png"); + mtree->Draw("ssd_Tel5_E2[1]"); + c1->Print("../figure/map/ssd_Tel5_E2[1].png"); + mtree->Draw("ssd_Lowgain_1[0]"); + c1->Print("../figure/map/ssd_Lowgain_1[0].png"); + mtree->Draw("ssd_Lowgain_1[1]"); + c1->Print("../figure/map/ssd_Lowgain_1[1].png"); + mtree->Draw("ssd_Lowgain_2[0]"); + c1->Print("../figure/map/ssd_Lowgain_2[0].png"); + mtree->Draw("ssd_Lowgain_2[1]"); + c1->Print("../figure/map/ssd_Lowgain_2[1].png"); + mtree->Draw("ssd_Lowgain_3[0]"); + c1->Print("../figure/map/ssd_Lowgain_3[0].png"); + mtree->Draw("ssd_Lowgain_3[1]"); + c1->Print("../figure/map/ssd_Lowgain_3[1].png"); + mtree->Draw("ssd_Lowgain_4[0]"); + c1->Print("../figure/map/ssd_Lowgain_4[0].png"); + mtree->Draw("ssd_Lowgain_4[1]"); + c1->Print("../figure/map/ssd_Lowgain_4[1].png"); + mtree->Draw("ssd_F2SSD[0]"); + c1->Print("../figure/map/ssd_F2SSD[0].png"); + mtree->Draw("ssd_F2SSD[1]"); + c1->Print("../figure/map/ssd_F2SSD[1].png"); +} diff --git a/macro/check_raw_tree.C b/macro/check_raw_tree.C new file mode 100644 index 0000000000000000000000000000000000000000..ad96f7a2b4df3c6291d85a09add7114925b87e39 --- /dev/null +++ b/macro/check_raw_tree.C @@ -0,0 +1,57 @@ +{ + gStyle->SetOptLogy(1); + bool wait_enter = false; + + TCanvas *c1 = new TCanvas("c1", "c1"); + + for(Int_t i=0; i<32; i++){ + TString bname; + bname.Form("adc1[%d]", i); + tree->Draw(bname.Data()); + //if(wait_enter){ getchar(); } + } + + for(Int_t i=0; i<32; i++){ + TString bname; + bname.Form("adc2[%d]", i); + tree->Draw(bname.Data()); + //if(wait_enter){ getchar(); } + } + + for(Int_t i=0; i<32; i++){ + TString bname; + bname.Form("madc1[%d]", i); + tree->Draw(bname.Data()); + //if(wait_enter){ getchar(); } + } + + for(Int_t i=0; i<32; i++){ + TString bname; + bname.Form("madc2[%d]", i); + tree->Draw(bname.Data()); + //if(wait_enter){ getchar(); } + } + + for(Int_t i=0; i<32; i++){ + TString bname; + bname.Form("tdc1[%d]", i); + tree->Draw(bname.Data()); + //if(wait_enter){ getchar(); } + } + + for(Int_t i=0; i<32; i++){ + TString bname; + bname.Form("tdc2[%d]", i); + tree->Draw(bname.Data()); + //if(wait_enter){ getchar(); } + } + + for(Int_t i=0; i<64; i++){ + for(Int_t j=0; j<12; j++){ + TString branch; + branch.Form("mhtdc[%d][%d]", i, j); + tree->Draw(branch.Data()); + //if(wait_enter){ getchar(); } + } + } +} diff --git a/macro/mpos.C b/macro/mpos.C new file mode 100644 index 0000000000000000000000000000000000000000..7c3abf032eea77cc4ad6621469705ed0ae0ca585 --- /dev/null +++ b/macro/mpos.C @@ -0,0 +1,200 @@ +#include +#include +#include +#include + +void Usage(){ + cout << "mpos calibration" << endl; + cout << "Usage:" << endl; + cout << "mpos(const Int_t np=0, TString run)" << endl; + cout << "\tnp: number of peaks. Default: 0 (this message).\n"; + cout << "\trun: Name of run file (DO NOT PUT '.root'). Default: nothing. Must be in double quotes!\n"; +} + +void mpos(const Int_t np=0, TString run=" ") +{ + if (np==0){ + Usage(); + return; + } + gStyle->SetOptLogy(1); + + cout << endl; + cout << "your input :" << endl; + cout << "number of peaks : " << np << endl; + cout << "run (filename) : " << run << ".root" <GetPathInfo(run_name.Data(), info)!=0) { + cout << "File '" << run_name.Data() << "' does not exist." << endl; + return; + } + + TFile *fin = new TFile(run_name.Data(), "read"); + TTree* tree=(TTree*)fin->Get("tree"); + TString output = "/home/okawa/software/ridf2root/calibration/si26a/mpos.prm"; + //TString output = "./test_mpos.prm"; + cout << "CREATED: --" << output << endl; + ofstream fout(output.Data(), ios::out); + //fout << setprecision(8); // good for column output data + + TH1D *h[12]; + //must be changed + Int_t ch_start[12] = {200, 200, 600, 600, 800, 800, 1200, 1200, 1350, 1350, 1550, 1550}; + Int_t ch_stop[12] = {800, 800, 1100, 1100, 1300, 1300, 1700, 1700, 1850, 1850, 2050, 2050}; + Int_t ch_interval[12] = {500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500}; + for(Int_t i=0; i<12; i++){ + TString tmp; + tmp.Form("h%d",i); + h[i] = new TH1D(tmp.Data(), ";ch;entries", ch_interval[i], ch_start[i], ch_stop[i]); + h[i]->GetXaxis()->SetRange(ch_start[i], ch_stop[i]); + h[i]->GetXaxis()->SetRangeUser(ch_start[i], ch_stop[i]); + h[i]->SetLineColor(9); + } + + Int_t nfound; + + TString name = "madc2"; + Int_t num[32]; + tree->SetBranchAddress(name.Data(), num); + Int_t nEntry = tree->GetEntries(); + for(Int_t iEntry=0; iEntryGetEntry(iEntry); + for(Int_t i=0; i<12; i++){ + if(i==4){ + h[i]->Fill(num[18]); + }else if(i==5){ + h[i]->Fill(num[19]); + }else{ + Int_t mod = i%2; + h[i]->Fill(num[2*(i-mod)+2+mod]); + } + } + } + + Double_t peaks[12][16]; + for(Int_t i=0; i<12; i++){ + for(Int_t j=0; j<16; j++){ + peaks[i][j] = 0.0; + } + } + + for(Int_t i=0; i<12; i++){ + cout << endl; + if(i%2 == 0){ + Double_t xpeaks[np]; + TSpectrum *s = new TSpectrum(np); + nfound = s->Search(h[i], 2, "", 0.001); + cout << "Found " << nfound << " candidate peaks to fit" << endl; + Double_t *xpeaksfound = s->GetPositionX(); + for(Int_t j=0; jSearch(h[i], 2, "", 0.001); + cout << "Found " << nfound << " candidate peaks to fit" << endl; + Double_t *xpeaksfound = s->GetPositionX(); + for(Int_t j=0; jSearch(h[i], 2, "", 0.001); + //cout << "Found " << nfound << " candidate peaks to fit" << endl; + //Double_t *xpeaksfound = s->GetPositionX(); + //for(Int_t j=0; jDivide(2, 3); + for(Int_t i=0; i<6; i++){ + c1->cd(i+1); + h[i]->Draw(); + } + + //c1->Print("./check.jpg"); + + TCanvas *c2 = new TCanvas("c2", "c2"); + c2->Divide(2, 3); + for(Int_t i=0; i<6; i++){ + c2->cd(i+1); + h[i+6]->Draw(); + } + + //fin->Close(); + fout.close(); + +} diff --git a/macro/mssd_calibration.C b/macro/mssd_calibration.C new file mode 100644 index 0000000000000000000000000000000000000000..e1da1d5e131b0a704c833c45707cfe11de16d092 --- /dev/null +++ b/macro/mssd_calibration.C @@ -0,0 +1,93 @@ +#include +#include +#include +#include + +void Usage(){ + cout << "mssd calibration" << endl; + cout << "Usage:" << endl; + cout << "mssd_calibration(TString run_name, TString branch_name)" << endl; + cout << "\trun_name: Name of run file (DO NOT PUT '.root'). Default: nothing. Must be in double quotes!\n"; + cout << "\tbranch_name: Name of branch. Default: nothing. Must be in double quotes!\n"; +} + +void mssd_calibration(TString run_name=" ", TString branch_name=" ") +{ + if (run_name == " "){ + Usage(); + return; + } + gStyle->SetOptFit(); + gStyle->SetOptLogy(1); + + cout << endl; + cout << "your input :" << endl; + cout << "run_name (filename) : " << run_name << ".root" << endl; + cout << "branch_name : " << branch_name << endl; + cout << endl; + + //TString run_name = "/home/okawa/work/crib/data/si26a/rootfiles/" + run + ".root"; + TString run = run_name + ".root"; + FileStat_t info; + if(gSystem->GetPathInfo(run.Data(), info)!=0) { + cout << "File '" << run.Data() << "' does not exist." << endl; + return; + } + + TFile *fin = new TFile(run.Data(), "read"); + TTree* ctree=(TTree*)fin->Get("ctree"); + TString output = "/home/okawa/software/ridf2root/calibration/si26a/log/" + branch_name + "_mssd.prm"; + //TString output = "./test_mssd.prm"; + cout << "CREATED: --" << output << endl; + ofstream fout(output.Data(), ios::out); + //fout << setprecision(8); // good for column output data + + TH1D *h = new TH1D("h", branch_name.Data(), 4000, 0., 4000.); + Double_t val; + ctree->SetBranchAddress(branch_name.Data(), &val); + Int_t nEntry = ctree->GetEntries(); + for(Int_t iEntry=0; iEntryGetEntry(iEntry); + h->Fill(val); + } + + fout << "# Created from mssd_calibration.C" << endl; + fout << "# " << run_name << endl; + fout << "# " << branch_name << endl; + + TCanvas *c1 = new TCanvas("c1", "c1"); + + TF1 *f1 = new TF1("f1", "gaus(0)+pol1(3)"); + f1->SetRange(850, 1025); + f1->SetParameters(200, 1000, 5,10,0.0001); + f1->SetParLimits(2,0,100); // for sigma + h->GetXaxis()->SetRangeUser(0, 1500); + h->Fit(f1,"r"); + h->Draw(); + f1->Draw("same"); + + TF1 *f2 = new TF1("f2", "gaus(0)+pol1(3)"); + f2->SetRange(1080, 1160); + f2->SetParameters(200, 1130, 5,10,0.0001); + f2->SetParLimits(2,0,100); // for sigma + h->GetXaxis()->SetRangeUser(0, 1500); + h->Fit(f2,"r"); + //h->Draw(); + f2->Draw("same"); + + TF1 *f3 = new TF1("f3", "gaus(0)+pol1(3)"); + f3->SetRange(1160, 1240); + f3->SetParameters(200, 1190, 5,10,0.0001); + f3->SetParLimits(2,0,100); // for sigma + h->GetXaxis()->SetRangeUser(0, 1500); + h->Fit(f3,"r"); + //h->Draw(); + f3->Draw("same"); + + //fin->Close(); + fout.close(); + +} diff --git a/macro/test/check_calib_tree.C b/macro/test/check_calib_tree.C new file mode 100644 index 0000000000000000000000000000000000000000..66a12882eaa08f9d5054c1134716feead1a631e7 --- /dev/null +++ b/macro/test/check_calib_tree.C @@ -0,0 +1,141 @@ +//this macro create all histograms and save as png file +//(for check the code is correct) +//CAUTION: many file will be created + +{ + gStyle->SetOptLogy(1); + + TCanvas *c1 = new TCanvas("c1", "c1"); + ctree->Draw("coin_Single"); + c1->Print("../figure/calib/coin_Single.png"); + ctree->Draw("coin_Coin"); + c1->Print("../figure/calib/coin_Coin.png"); + ctree->Draw("coin_Pileup"); + c1->Print("../figure/calib/coin_Pileup.png"); + + for(Int_t j=0; j<16; j++){ + TString branch, file; + branch.Form("dssd_Tel1_dE1X_%d", j+1); + file.Form("../figure/calib/dssd_Tel1_dE1X_%d.png", j+1); + ctree->Draw(branch.Data()); + c1->Print(file.Data()); + } + + for(Int_t i=0; i<3; i++){ + for(Int_t j=0; j<16; j++){ + TString branch, file; + branch.Form("dssd_Tel%d_dE2Y_%d", i+1, j+1); + file.Form("../figure/calib/dssd_Tel%d_dE2Y_%d.png", i+1, j+1); + ctree->Draw(branch.Data()); + c1->Print(file.Data()); + } + } + + for(Int_t j=0; j<16; j++){ + TString branch, file; + branch.Form("t_dssd_Tel1_dE1X_%d", j+1); + file.Form("../figure/calib/t_dssd_Tel1_dE1X_%d.png", j+1); + ctree->Draw(branch.Data()); + c1->Print(file.Data()); + } + + for(Int_t i=0; i<3; i++){ + for(Int_t j=0; j<16; j++){ + TString branch, file; + branch.Form("t_dssd_Tel%d_dE2Y_%d", i+1, j+1); + file.Form("../figure/calib/t_dssd_Tel%d_dE2Y_%d.png", i+1, j+1); + ctree->Draw(branch.Data()); + c1->Print(file.Data()); + } + } + + for(Int_t i=0; i<3; i++){ + for(Int_t j=0; j<2; j++){ + for(Int_t k=0; k<16; k++){ + TString branch, file; + branch.Form("mssd_%d_%d_%dch", i+1, j+1, k+1); + file.Form("../figure/calib/mssd_%d_%d_%dch.png", i+1, j+1, k+1); + ctree->Draw(branch.Data()); + c1->Print(file.Data()); + } + } + } + + ctree->Draw("t_mssd_1_1"); + c1->Print("../figure/calib/t_mssd_1_1.png"); + ctree->Draw("t_mssd_1_2"); + c1->Print("../figure/calib/t_mssd_1_2.png"); + ctree->Draw("t_mssd_2_1"); + c1->Print("../figure/calib/t_mssd_2_1.png"); + ctree->Draw("t_mssd_2_2"); + c1->Print("../figure/calib/t_mssd_2_2.png"); + ctree->Draw("t_mssd_3_1"); + c1->Print("../figure/calib/t_mssd_3_1.png"); + ctree->Draw("t_mssd_3_2"); + c1->Print("../figure/calib/t_mssd_3_2.png"); + ctree->Draw("RF1"); + c1->Print("../figure/calib/RF1.png"); + ctree->Draw("RF2"); + c1->Print("../figure/calib/RF2.png"); + ctree->Draw("ssd_Tel1_E1"); + c1->Print("../figure/calib/ssd_Tel1_E1.png"); + ctree->Draw("ssd_Tel1_E2"); + c1->Print("../figure/calib/ssd_Tel1_E2.png"); + ctree->Draw("ssd_Tel2_E1"); + c1->Print("../figure/calib/ssd_Tel2_E1.png"); + ctree->Draw("ssd_Tel2_E2"); + c1->Print("../figure/calib/ssd_Tel2_E2.png"); + ctree->Draw("ssd_Tel3_E1"); + c1->Print("../figure/calib/ssd_Tel3_E1.png"); + ctree->Draw("ssd_Tel3_E2"); + c1->Print("../figure/calib/ssd_Tel3_E2.png"); + ctree->Draw("ssd_Tel4_E1"); + c1->Print("../figure/calib/ssd_Tel4_E1.png"); + ctree->Draw("ssd_Tel4_E2"); + c1->Print("../figure/calib/ssd_Tel4_E2.png"); + ctree->Draw("ssd_Tel5_E1"); + c1->Print("../figure/calib/ssd_Tel5_E1.png"); + ctree->Draw("ssd_Tel5_E2"); + c1->Print("../figure/calib/ssd_Tel5_E2.png"); + ctree->Draw("ssd_Lowgain_1"); + c1->Print("../figure/calib/ssd_Lowgain_1.png"); + ctree->Draw("ssd_Lowgain_2"); + c1->Print("../figure/calib/ssd_Lowgain_2.png"); + ctree->Draw("ssd_Lowgain_3"); + c1->Print("../figure/calib/ssd_Lowgain_3.png"); + ctree->Draw("ssd_Lowgain_4"); + c1->Print("../figure/calib/ssd_Lowgain_4.png"); + ctree->Draw("ssd_F2SSD"); + c1->Print("../figure/calib/ssd_F2SSD.png"); + ctree->Draw("t_ssd_Tel1_E1"); + c1->Print("../figure/calib/t_ssd_Tel1_E1.png"); + ctree->Draw("t_ssd_Tel1_E2"); + c1->Print("../figure/calib/t_ssd_Tel1_E2.png"); + ctree->Draw("t_ssd_Tel2_E1"); + c1->Print("../figure/calib/t_ssd_Tel2_E1.png"); + ctree->Draw("t_ssd_Tel2_E2"); + c1->Print("../figure/calib/t_ssd_Tel2_E2.png"); + ctree->Draw("t_ssd_Tel3_E1"); + c1->Print("../figure/calib/t_ssd_Tel3_E1.png"); + ctree->Draw("t_ssd_Tel3_E2"); + c1->Print("../figure/calib/t_ssd_Tel3_E2.png"); + ctree->Draw("t_ssd_Tel4_E1"); + c1->Print("../figure/calib/t_ssd_Tel4_E1.png"); + ctree->Draw("t_ssd_Tel4_E2"); + c1->Print("../figure/calib/t_ssd_Tel4_E2.png"); + ctree->Draw("t_ssd_Tel5_E1"); + c1->Print("../figure/calib/t_ssd_Tel5_E1.png"); + ctree->Draw("t_ssd_Tel5_E2"); + c1->Print("../figure/calib/t_ssd_Tel5_E2.png"); + ctree->Draw("t_ssd_Lowgain_1"); + c1->Print("../figure/calib/t_ssd_Lowgain_1.png"); + ctree->Draw("t_ssd_Lowgain_2"); + c1->Print("../figure/calib/t_ssd_Lowgain_2.png"); + ctree->Draw("t_ssd_Lowgain_3"); + c1->Print("../figure/calib/t_ssd_Lowgain_3.png"); + ctree->Draw("t_ssd_Lowgain_4"); + c1->Print("../figure/calib/t_ssd_Lowgain_4.png"); + ctree->Draw("t_ssd_F2SSD"); + c1->Print("../figure/calib/t_ssd_F2SSD.png"); +} + diff --git a/macro/compare.C b/macro/test/compare.C similarity index 100% rename from macro/compare.C rename to macro/test/compare.C diff --git a/macro/mpos_2dim.C b/macro/test/mpos_2dim.C similarity index 100% rename from macro/mpos_2dim.C rename to macro/test/mpos_2dim.C diff --git a/macro/test/pos_calb_check.C b/macro/test/pos_calb_check.C new file mode 100644 index 0000000000000000000000000000000000000000..1d6ac2e09c222776eca658fbc1e4c2d68624a232 --- /dev/null +++ b/macro/test/pos_calb_check.C @@ -0,0 +1,16 @@ +{ + gStyle->SetOptLogy(1); + + //for run307 and 308 + TFile *fin = new TFile("../rootfiles/alpha307_308.root", "read"); + TTree *ctree = (TTree*)fin->Get("ctree"); + + TCanvas *c1 = new TCanvas("c1","c1"); + ctree->Draw("mssd_1_1_1ch>>(2000,0,2000)"); + TCanvas *c2 = new TCanvas("c2","c2"); + ctree->Draw("mssd_1_1_2ch>>(2000,0,2000)"); + TCanvas *c3 = new TCanvas("c3","c3"); + ctree->Draw("mssd_1_1_3ch>>(2000,0,2000)"); + TCanvas *c4 = new TCanvas("c4","c4"); + ctree->Draw("mssd_1_1_4ch>>(2000,0,2000)"); +} diff --git a/macro/raw_mpos_check.C b/macro/test/raw_mpos_check.C similarity index 59% rename from macro/raw_mpos_check.C rename to macro/test/raw_mpos_check.C index f5e19e598425bf626791abefc52e767a57098899..5761450efc72560c7c58998e9d82c6a61595a7bc 100644 --- a/macro/raw_mpos_check.C +++ b/macro/test/raw_mpos_check.C @@ -29,22 +29,23 @@ tree->SetBranchAddress("madc2", mux); - //TH1I *hist1 = new TH1I("hist1","mux1-1p1",400,350,750); - //TH1I *hist2 = new TH1I("hist2","mux1-2p1",400,650,1050); - //TH1I *hist3 = new TH1I("hist3","mux2-1p1",400,800,1200); - //TH1I *hist4 = new TH1I("hist4","mux2-2p1",400,1250,1650); - //TH1I *hist5 = new TH1I("hist5","mux3-1p1",400,1350,1750); - //TH1I *hist6 = new TH1I("hist6","mux3-2p1",400,1550,1950); - TH1I *hist1 = new TH1I("hist1","mux1-1p2",400,350,750); - TH1I *hist2 = new TH1I("hist2","mux1-2p2",400,650,1050); - TH1I *hist3 = new TH1I("hist3","mux2-1p2",400,800,1200); - TH1I *hist4 = new TH1I("hist4","mux2-2p2",400,1250,1650); - TH1I *hist5 = new TH1I("hist5","mux3-1p2",400,1350,1750); - TH1I *hist6 = new TH1I("hist6","mux3-2p2",400,1550,1950); + TH1I *hist1 = new TH1I("hist1","mux1-1p1",400,350,750); + TH1I *hist2 = new TH1I("hist2","mux1-2p1",400,650,1050); + TH1I *hist3 = new TH1I("hist3","mux2-1p1",400,800,1200); + TH1I *hist4 = new TH1I("hist4","mux2-2p1",400,1250,1650); + TH1I *hist5 = new TH1I("hist5","mux3-1p1",400,1350,1750); + TH1I *hist6 = new TH1I("hist6","mux3-2p1",400,1550,1950); + //TH1I *hist1 = new TH1I("hist1","mux1-1p2",400,350,750); + //TH1I *hist2 = new TH1I("hist2","mux1-2p2",400,650,1050); + //TH1I *hist3 = new TH1I("hist3","mux2-1p2",400,800,1200); + //TH1I *hist4 = new TH1I("hist4","mux2-2p2",400,1250,1650); + //TH1I *hist5 = new TH1I("hist5","mux3-1p2",400,1350,1750); + //TH1I *hist6 = new TH1I("hist6","mux3-2p2",400,1550,1950); const Int_t N = tree->GetEntries(); const Int_t start_ent = 0; - const Int_t end_ent = 1000000; + //const Int_t end_ent = 1000000; + const Int_t end_ent = N; if(end_ent > N){ cout << "Value Miss!" << endl; } @@ -52,12 +53,18 @@ for(Int_t ientry=start_ent; ientryGetEntry(ientry); - hist1->Fill(mux[3]); - hist2->Fill(mux[7]); - hist3->Fill(mux[19]); - hist4->Fill(mux[15]); - hist5->Fill(mux[19]); - hist6->Fill(mux[23]); + hist1->Fill(mux[2]); + hist2->Fill(mux[6]); + hist3->Fill(mux[18]); + hist4->Fill(mux[14]); + hist5->Fill(mux[18]); + hist6->Fill(mux[22]); + //hist1->Fill(mux[3]); + //hist2->Fill(mux[7]); + //hist3->Fill(mux[19]); + //hist4->Fill(mux[15]); + //hist5->Fill(mux[19]); + //hist6->Fill(mux[23]); } @@ -87,5 +94,5 @@ hist6->Draw(); //tree->Draw("madc2[22]>>MUX3_2p1(400,1550,1950)"); //MUX3-2 pos1 - c1->Print("../figure/alpha_mpos2.png"); + //c1->Print("../figure/alpha_mpos2.png"); } diff --git a/macro/test/resolution_check.C b/macro/test/resolution_check.C new file mode 100644 index 0000000000000000000000000000000000000000..c6b48a6c850897a89e9b3d21e2bb31bc7e206a0a --- /dev/null +++ b/macro/test/resolution_check.C @@ -0,0 +1,69 @@ +// ********FOR Si26a************** +// +// --RUN INFORMATION +// run307 alpha calibration Tel1-3 dE1&2, Tel4-5 dE2 +// run308 the same condition +// +// --MUX INFORMATION +// driver for MUX2-1 is missing -> use MUX3-1 +// +// --CHANNEL INFORMATION OF MUX +// madc2[0]-[3] : MUX1-1 +// madc2[4]-[7] : MUX1-2 +// madc2[8]-[11] : MUX2-1 +// madc2[12]-[15]: MUX2-2 +// madc2[16]-[19]: MUX3-1 +// madc2[20]-[23]: MUX3-2 + +{ + //gStyle->SetOptLogy(1); + + //for run307 and 308 + TFile *fin = new TFile("../rootfiles/old_rootfiles/alpha307_308.root", "read"); + TTree *tree = (TTree*)fin->Get("tree"); + //TChain *chain = new TChain("tree", "chain"); + //chain->Add("../rootfiles/old_rootfiles/calib0307.root"); + //chain->Add("../rootfiles/old_rootfiles/calib0308.root"); + + TCanvas *c1 = new TCanvas("c1", "c1", 800, 1000); + c1->Divide(2, 3); + c1->cd(1); + tree->Draw("madc2[2]:madc2[0]>>h1(2000,0,2000,500,300,800)","","colz"); + + c1->cd(2); + tree->Draw("madc2[0]>>h2(2000,0,2000)","madc2[2] > 387 && madc2[2] < 402"); + + c1->cd(3); + tree->Draw("madc2[6]:madc2[4]>>h3(2000,0,2000,600,600,1200)","","colz"); + + c1->cd(4); + tree->Draw("madc2[4]>>h4(2000,0,2000)","madc2[6] > 705 && madc2[6] < 720"); + + c1->cd(5); + tree->Draw("madc2[18]:madc2[16]>>h5(2000,0,2000,400,800,1200)","","colz"); + + c1->cd(6); + tree->Draw("madc2[16]>>h6(2000,0,2000)","madc2[18] > 853 && madc2[18] < 872"); + + TCanvas *c2 = new TCanvas("c2", "c2", 800, 1000); + c2->Divide(2, 3); + c2->cd(1); + tree->Draw("madc2[14]:madc2[12]>>h7(2000,0,2000,500,1200,1700)","","colz"); + + c2->cd(2); + tree->Draw("madc2[12]>>h8(2000,0,2000)","madc2[14] > 1302 && madc2[14] < 1318"); + + c2->cd(3); + tree->Draw("madc2[18]:madc2[16]>>h9(2000,0,2000,500,1300,1800)","","colz"); + + c2->cd(4); + tree->Draw("madc2[16]>>h10(2000,0,2000)","madc2[18] > 1405 && madc2[18] < 1435"); + + c2->cd(5); + tree->Draw("madc2[22]:madc2[20]>>h11(2000,0,2000,500,1500,2000)","","colz"); + + c2->cd(6); + tree->Draw("madc2[20]>>h12(2000,0,2000)","madc2[22] > 1590 && madc2[22] < 1640"); + + +} diff --git a/macro/test/test_mpos.prm b/macro/test/test_mpos.prm new file mode 100644 index 0000000000000000000000000000000000000000..8bcdbd83da2bfd6f4ccfcbf98ff1fd09f8a40458 --- /dev/null +++ b/macro/test/test_mpos.prm @@ -0,0 +1,14 @@ +# created from mpos.C +# /home/okawa/work/crib/data/si26a/rootfiles/high0206.root +362.6, 375.8, 392.6, 408.2, 427.4, 441.8, 458.6, 475.4, 495.8, 510.2, 527, 542.6, 561.8, 577.4, 595.4, 612.2, ; MUX1-1-p0 +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ; MUX1-1-p1 +709.5, 726.5, 744.5, 762.5, 783.5, 800.5, 820.5, 839.5, 862.5, 878.5, 898.5, 916.5, 938.5, 955.5, 975.5, 995.5, ; MUX1-2-p0 +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ; MUX1-2-p1 +882.5, 895.5, 910.5, 924.5, 943.5, 956.5, 973.5, 988.5, 1007.5, 1021.5, 1037.5, 1052.5, 1070.5, 1084.5, 1102.5, 1117.5, ; MUX2-1-p0 +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ; MUX2-1-p1 +1303.5, 1319.5, 1338.5, 1356.5, 1378.5, 1395.5, 1415.5, 1434.5, 1457.5, 1474.5, 1493.5, 1512.5, 1534.5, 1552.5, 1573.5, 1592.5, ; MUX2-2-p0 +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ; MUX2-2-p1 +1440.5, 1453.5, 1468.5, 1483.5, 1503.5, 1517.5, 1534.5, 1550.5, 1572.5, 1585.5, 1602.5, 1618.5, 1638.5, 1653.5, 1671.5, 1688.5, ; MUX3-1-p0 +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ; MUX3-1-p1 +1640.5, 1653.5, 1668.5, 1683.5, 1702.5, 1716.5, 1733.5, 1749.5, 1771.5, 1785.5, 1800.5, 1818, 1835.5, 1850.5, 1868.5, 1886.5, ; MUX3-2-p0 +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ; MUX3-2-p1 diff --git a/map/si26a/dssd.map b/map/si26a/dssd.map index 399b13cae411fbd03c88e7b0f4c41d8537950c39..b1c9109f2b944028f55af4dc47c627e9cd9b9296 100644 --- a/map/si26a/dssd.map +++ b/map/si26a/dssd.map @@ -1,37 +1,37 @@ # Map for dssd # Note: automatically produced with mapmaker.pl. Do not edit it directly -4, 1, 12 0 6 6 0, 12 0 7 16 32, ; dssd Tel1 dE1X 1 -4, 2, 12 0 6 6 1, 12 0 7 16 33, ; dssd Tel1 dE1X 2 -4, 3, 12 0 6 6 2, 12 0 7 16 34, ; dssd Tel1 dE1X 3 -4, 4, 12 0 6 6 3, 12 0 7 16 35, ; dssd Tel1 dE1X 4 -4, 5, 12 0 6 6 4, 12 0 7 16 36, ; dssd Tel1 dE1X 5 -4, 6, 12 0 6 6 5, 12 0 7 16 37, ; dssd Tel1 dE1X 6 -4, 7, 12 0 6 6 6, 12 0 7 16 38, ; dssd Tel1 dE1X 7 -4, 8, 12 0 6 6 7, 12 0 7 16 39, ; dssd Tel1 dE1X 8 -4, 9, 12 0 6 6 8, 12 0 7 16 40, ; dssd Tel1 dE1X 9 -4,10, 12 0 6 6 9, 12 0 7 16 41, ; dssd Tel1 dE1X 10 -4,11, 12 0 6 6 10, 12 0 7 16 42, ; dssd Tel1 dE1X 11 -4,12, 12 0 6 6 11, 12 0 7 16 43, ; dssd Tel1 dE1X 12 -4,13, 12 0 6 6 12, 12 0 7 16 44, ; dssd Tel1 dE1X 13 -4,14, 12 0 6 6 13, 12 0 7 16 45, ; dssd Tel1 dE1X 14 -4,15, 12 0 6 6 14, 12 0 7 16 46, ; dssd Tel1 dE1X 15 -4,16, 12 0 6 6 15, 12 0 7 16 47, ; dssd Tel1 dE1X 16 -4,17, 12 0 6 1 16, 12 0 7 16 48, ; dssd Tel1 dE2Y 1 -4,18, 12 0 6 1 17, 12 0 7 16 49, ; dssd Tel1 dE2Y 2 -4,19, 12 0 6 1 18, 12 0 7 16 50, ; dssd Tel1 dE2Y 3 -4,20, 12 0 6 1 19, 12 0 7 16 51, ; dssd Tel1 dE2Y 4 -4,21, 12 0 6 1 20, 12 0 7 16 52, ; dssd Tel1 dE2Y 5 -4,22, 12 0 6 1 21, 12 0 7 16 53, ; dssd Tel1 dE2Y 6 -4,23, 12 0 6 1 22, 12 0 7 16 54, ; dssd Tel1 dE2Y 7 -4,24, 12 0 6 1 23, 12 0 7 16 55, ; dssd Tel1 dE2Y 8 -4,25, 12 0 6 1 24, 12 0 7 16 56, ; dssd Tel1 dE2Y 9 -4,26, 12 0 6 1 25, 12 0 7 16 57, ; dssd Tel1 dE2Y 10 -4,27, 12 0 6 1 26, 12 0 7 16 58, ; dssd Tel1 dE2Y 11 -4,28, 12 0 6 1 27, 12 0 7 16 59, ; dssd Tel1 dE2Y 12 -4,29, 12 0 6 1 28, 12 0 7 16 60, ; dssd Tel1 dE2Y 13 -4,30, 12 0 6 1 29, 12 0 7 16 61, ; dssd Tel1 dE2Y 14 -4,31, 12 0 6 1 30, 12 0 7 16 62, ; dssd Tel1 dE2Y 15 -4,32, 12 0 6 1 31, 12 0 7 16 63, ; dssd Tel1 dE2Y 16 +4, 1, 12 0 6 6 0, 12 0 10 16 32, ; dssd Tel1 dE1X 1 +4, 2, 12 0 6 6 1, 12 0 10 16 33, ; dssd Tel1 dE1X 2 +4, 3, 12 0 6 6 2, 12 0 10 16 34, ; dssd Tel1 dE1X 3 +4, 4, 12 0 6 6 3, 12 0 10 16 35, ; dssd Tel1 dE1X 4 +4, 5, 12 0 6 6 4, 12 0 10 16 36, ; dssd Tel1 dE1X 5 +4, 6, 12 0 6 6 5, 12 0 10 16 37, ; dssd Tel1 dE1X 6 +4, 7, 12 0 6 6 6, 12 0 10 16 38, ; dssd Tel1 dE1X 7 +4, 8, 12 0 6 6 7, 12 0 10 16 39, ; dssd Tel1 dE1X 8 +4, 9, 12 0 6 6 8, 12 0 10 16 40, ; dssd Tel1 dE1X 9 +4,10, 12 0 6 6 9, 12 0 10 16 41, ; dssd Tel1 dE1X 10 +4,11, 12 0 6 6 10, 12 0 10 16 42, ; dssd Tel1 dE1X 11 +4,12, 12 0 6 6 11, 12 0 10 16 43, ; dssd Tel1 dE1X 12 +4,13, 12 0 6 6 12, 12 0 10 16 44, ; dssd Tel1 dE1X 13 +4,14, 12 0 6 6 13, 12 0 10 16 45, ; dssd Tel1 dE1X 14 +4,15, 12 0 6 6 14, 12 0 10 16 46, ; dssd Tel1 dE1X 15 +4,16, 12 0 6 6 15, 12 0 10 16 47, ; dssd Tel1 dE1X 16 +4,17, 12 0 6 1 16, 12 0 10 16 48, ; dssd Tel1 dE2Y 1 +4,18, 12 0 6 1 17, 12 0 10 16 49, ; dssd Tel1 dE2Y 2 +4,19, 12 0 6 1 18, 12 0 10 16 50, ; dssd Tel1 dE2Y 3 +4,20, 12 0 6 1 19, 12 0 10 16 51, ; dssd Tel1 dE2Y 4 +4,21, 12 0 6 1 20, 12 0 10 16 52, ; dssd Tel1 dE2Y 5 +4,22, 12 0 6 1 21, 12 0 10 16 53, ; dssd Tel1 dE2Y 6 +4,23, 12 0 6 1 22, 12 0 10 16 54, ; dssd Tel1 dE2Y 7 +4,24, 12 0 6 1 23, 12 0 10 16 55, ; dssd Tel1 dE2Y 8 +4,25, 12 0 6 1 24, 12 0 10 16 56, ; dssd Tel1 dE2Y 9 +4,26, 12 0 6 1 25, 12 0 10 16 57, ; dssd Tel1 dE2Y 10 +4,27, 12 0 6 1 26, 12 0 10 16 58, ; dssd Tel1 dE2Y 11 +4,28, 12 0 6 1 27, 12 0 10 16 59, ; dssd Tel1 dE2Y 12 +4,29, 12 0 6 1 28, 12 0 10 16 60, ; dssd Tel1 dE2Y 13 +4,30, 12 0 6 1 29, 12 0 10 16 61, ; dssd Tel1 dE2Y 14 +4,31, 12 0 6 1 30, 12 0 10 16 62, ; dssd Tel1 dE2Y 15 +4,32, 12 0 6 1 31, 12 0 10 16 63, ; dssd Tel1 dE2Y 16 4,33, 12 0 6 2 0, 12 0 7 11 16, ; dssd Tel2 dE2Y 1 4,34, 12 0 6 2 1, 12 0 7 11 17, ; dssd Tel2 dE2Y 2 4,35, 12 0 6 2 2, 12 0 7 11 18, ; dssd Tel2 dE2Y 3 diff --git a/map/si26a/mapmaker.pl b/map/si26a/mapmaker.pl index 84c9cde6d4c3d09c85993b4cf5740095403c867c..657c9e73858af47b021806a7b32dd3c52ee56561 100755 --- a/map/si26a/mapmaker.pl +++ b/map/si26a/mapmaker.pl @@ -18,6 +18,9 @@ $fp = 0; # everything is 0 at CRIB. $mhtdc=16; $did_t=7; $did_a=6; #detector id, TDC:7, ADC:6 for all ADC/TDC +#Add Okawa +$did_mht=10; +#End Okawa @@ -74,7 +77,10 @@ elsif ($category eq 'ppac') { @{$did[$id]}= &repeatn($did_a,$ndata); }else {#F2,F3 PPACs @{$module[$id]}= &repeatn($mhtdc,$ndata); - @{$did[$id]}= &repeatn($did_t,$ndata); + #Add okawa + @{$did[$id]}= &repeatn($did_mht,$ndata); + #End okawa + #@{$did[$id]}= &repeatn($did_t,$ndata); } } @@ -100,25 +106,31 @@ elsif ($category eq 'dssd') { foreach $id (1..$nid) { $tid=($id%16)||16; #id -> 1..16 + #Mod okawa if ($id <= 16) {#Tel1 X @{$module[$id]}[1..2]= ($madc1,$mhtdc); $ch[$id][1] = -1+$tid; #ADC ch $ch[$id][2] = 31+$tid; #TDC ch + @{$did[$id]}[1..2]= ($did_a,$did_mht); #always adc/tdc }elsif ($id <= 32) {#Tel1 Y @{$module[$id]}[1..2]= ($adc1,$mhtdc); $ch[$id][1] = 15+$tid; #ADC ch $ch[$id][2] = 47+$tid; #TDC ch + @{$did[$id]}[1..2]= ($did_a,$did_mht); #always adc/tdc }elsif ($id <= 48) {#Tel2 Y @{$module[$id]}[1..2]= ($adc2,$tdc1); $ch[$id][1] = -1+$tid; #ADC ch $ch[$id][2] = 15+$tid; #TDC ch + @{$did[$id]}[1..2]= ($did_a,$did_t); #always adc/tdc }else {#Tel3 Y @{$module[$id]}[1..2]= ($adc2,$tdc2); $ch[$id][1] = 15+$tid; #ADC ch $ch[$id][2] = -1+$tid; #TDC ch + @{$did[$id]}[1..2]= ($did_a,$did_t); #always adc/tdc } - @{$did[$id]}[1..2]= ($did_a,$did_t); #always adc/tdc + #@{$did[$id]}[1..2]= ($did_a,$did_t); #always adc/tdc + #End okawa } @@ -177,7 +189,10 @@ elsif ($category eq 'ssd') { $ch[$id][1] = $id-13; #ADC ch $ch[$id][2] = $id-13; #TDC ch } - @{$did[$id]}[1..2]= ($did_a,$did_t); #always adc/tdc + #Add okawa + @{$did[$id]}[1..2]= ($did_a,$did_mht); #always adc/tdc + #End okawa + #@{$did[$id]}[1..2]= ($did_a,$did_t); #always adc/tdc print "; $ch[$id][1] \n"; diff --git a/map/si26a/ppac.map b/map/si26a/ppac.map index 5e02f3259ae16a657cb6a6f62f8bf4f568f2d8c7..d3e60f518050b3f6f1cc7918f8206134633c2570 100644 --- a/map/si26a/ppac.map +++ b/map/si26a/ppac.map @@ -1,5 +1,5 @@ # Map for ppac # Note: automatically produced with mapmaker.pl. Do not edit it directly 2, 1, 12 0 6 1 0, 12 0 6 1 1, 12 0 6 1 2, 12 0 6 1 3, 12 0 6 1 15, ; ppac F1 -2, 2, 12 0 7 16 6, 12 0 7 16 7, 12 0 7 16 8, 12 0 7 16 9, 12 0 7 16 5, ; ppac F2/F3 B -2, 3, 12 0 7 16 1, 12 0 7 16 2, 12 0 7 16 3, 12 0 7 16 4, 12 0 7 16 0, ; ppac F3 A +2, 2, 12 0 10 16 6, 12 0 10 16 7, 12 0 10 16 8, 12 0 10 16 9, 12 0 10 16 5, ; ppac F2/F3 B +2, 3, 12 0 10 16 1, 12 0 10 16 2, 12 0 10 16 3, 12 0 10 16 4, 12 0 10 16 0, ; ppac F3 A diff --git a/map/si26a/ssd.map b/map/si26a/ssd.map index 87fed02a57d4b151fee682a573d43238c4ec2aee..9b097260d4d85cd253c0be95515a0edcdc77e491 100644 --- a/map/si26a/ssd.map +++ b/map/si26a/ssd.map @@ -1,19 +1,19 @@ # Map for ssd # Note: automatically produced with mapmaker.pl. Do not edit it directly -6, 1, 12 0 6 6 16, 12 0 7 16 16, ; ssd Tel1 E1 -6, 2, 12 0 6 6 17, 12 0 7 16 17, ; ssd Tel1 E2 -6, 3, 12 0 6 6 18, 12 0 7 16 18, ; ssd Tel2 E1 -6, 4, 12 0 6 6 19, 12 0 7 16 19, ; ssd Tel2 E2 -6, 5, 12 0 6 6 20, 12 0 7 16 20, ; ssd Tel3 E1 -6, 6, 12 0 6 6 21, 12 0 7 16 21, ; ssd Tel3 E2 -6, 7, 12 0 6 6 22, 12 0 7 16 22, ; ssd Tel4 E1 -6, 8, 12 0 6 6 23, 12 0 7 16 23, ; ssd Tel4 E2 -6, 9, 12 0 6 6 24, 12 0 7 16 24, ; ssd Tel5 E1 -6,10, 12 0 6 6 25, 12 0 7 16 25, ; ssd Tel5 E2 -6,11, 12 0 6 6 26, 12 0 7 16 26, ; ssd N/A -6,12, 12 0 6 6 27, 12 0 7 16 27, ; ssd N/A -6,13, 12 0 6 6 28, 12 0 7 16 28, ; ssd Lowgain 1 -6,14, 12 0 6 6 29, 12 0 7 16 29, ; ssd Lowgain 2 -6,15, 12 0 6 6 30, 12 0 7 16 30, ; ssd Lowgain 3 -6,16, 12 0 6 6 31, 12 0 7 16 31, ; ssd Lowgain 4 -6,17, 12 0 6 1 4, 12 0 7 17 4, ; ssd F2SSD +6, 1, 12 0 6 6 16, 12 0 10 16 16, ; ssd Tel1 E1 +6, 2, 12 0 6 6 17, 12 0 10 16 17, ; ssd Tel1 E2 +6, 3, 12 0 6 6 18, 12 0 10 16 18, ; ssd Tel2 E1 +6, 4, 12 0 6 6 19, 12 0 10 16 19, ; ssd Tel2 E2 +6, 5, 12 0 6 6 20, 12 0 10 16 20, ; ssd Tel3 E1 +6, 6, 12 0 6 6 21, 12 0 10 16 21, ; ssd Tel3 E2 +6, 7, 12 0 6 6 22, 12 0 10 16 22, ; ssd Tel4 E1 +6, 8, 12 0 6 6 23, 12 0 10 16 23, ; ssd Tel4 E2 +6, 9, 12 0 6 6 24, 12 0 10 16 24, ; ssd Tel5 E1 +6,10, 12 0 6 6 25, 12 0 10 16 25, ; ssd Tel5 E2 +6,11, 12 0 6 6 26, 12 0 10 16 26, ; ssd N/A +6,12, 12 0 6 6 27, 12 0 10 16 27, ; ssd N/A +6,13, 12 0 6 6 28, 12 0 10 16 28, ; ssd Lowgain 1 +6,14, 12 0 6 6 29, 12 0 10 16 29, ; ssd Lowgain 2 +6,15, 12 0 6 6 30, 12 0 10 16 30, ; ssd Lowgain 3 +6,16, 12 0 6 6 31, 12 0 10 16 31, ; ssd Lowgain 4 +6,17, 12 0 6 1 4, 12 0 10 17 4, ; ssd F2SSD diff --git a/old/TCordferBranchManager.cpp b/old/TCordferBranchManager.cpp new file mode 100644 index 0000000000000000000000000000000000000000..0e9adf803a4040bf471392b32cb2b757154a3cae --- /dev/null +++ b/old/TCordferBranchManager.cpp @@ -0,0 +1,562 @@ +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "TCordferBranchManager.hh" + +using namespace std; + +//#define SETTING_SI26A true + +void TCordferBranchManager::Readyaml(TString yamlfile){ + FileStat_t info; + if(gSystem->GetPathInfo(yamlfile.Data(), info) != 0){ + cerr << "EROOR: File '" << yamlfile.Data() << "' does not exist." << endl; + exit(0); + } + recipe = YAML::LoadFile(yamlfile.Data()); + cout << "-- yaml file: " << yamlfile << endl; + + if(recipe["raw_tree"]["in_use"].as() == "on"){ + rawdata=true; + cout << "\t-- raw_tree in use" << endl; + } + if(recipe["map_tree"]["in_use"].as() == "on"){ + mapdata=true; + cout << "\t-- map_tree in use" << endl; + } + //if(recipe["calib_tree"]["in_use"].as() == "on"){ + // calibration=true; + // cout << "\t-- calib_tree in use" << endl; + //} + + //if(mapdata == false && calibration == true){ + // cout << "ERROR: calibration tree require to use map tree" << endl; + // cout << "\tCHANGE recipe in yaml file" << endl; + // exit(0); + //} +} + + +void TCordferBranchManager::CreateTree(){ + if(rawdata){ CreateRawTree(); } + if(mapdata){ CreateMapTree(); } + //if(calibration){ CreateCalibTree(); } +} + + +void TCordferBranchManager::CreateRawTree(){ + TString rawname = recipe["raw_tree"]["name"].as(); + TString rawdesc = recipe["raw_tree"]["description"].as(); + + tree = new TTree(rawname, rawdesc); +} + + +void TCordferBranchManager::CreateMapTree(){ + TString mapname = recipe["map_tree"]["name"].as(); + TString mapdesc = recipe["map_tree"]["description"].as(); + + mtree = new TTree(mapname, mapdesc); +} + + +//void TCordferBranchManager::CreateCalibTree(){ +// TString calibname = recipe["calib_tree"]["name"].as(); +// TString calibdesc = recipe["calib_tree"]["description"].as(); +// +// ctree = new TTree(calibname, calibdesc); +//} + + +void TCordferBranchManager::CreateBranch(){ + if(rawdata){ CreateRawBranch(); } + if(mapdata){ CreateMapBranch(); } + //if(calibration){ CreateCalibBranch(); } +} + + +void TCordferBranchManager::CreateRawBranch(){ + YAML::Node setup = recipe["setup"].as(); + for(Int_t i=0; i(); + TString bname = setup[i]["name"].as(); + Int_t det_id = setup[i]["detector_id"].as(); + + if(det_id != 10){ + Int_t nch = setup[i]["channel"].as(); + TCordferRawBranch *raw_branch = new TCordferRawBranch(bname, seg_id, nch, det_id); + + TString brancharray; + brancharray.Form("%s[%d]/I", bname.Data(), raw_branch->size); + + tree->Branch(bname.Data(), raw_branch->bra_val, brancharray); + branch.push_back(raw_branch); + + }else{ + TString mhtdc_name = setup[i]["branches"][0]["name"].as(); + Int_t nch = setup[i]["branches"][0]["channel"].as(); + Int_t nhit = setup[i]["branches"][0]["maxhit"].as(); + + for(Int_t j=0; jsize); + + tree->Branch(bra_name.Data(), mhtdc_branch->bra_val, brancharray); + branch.push_back(mhtdc_branch); + } + + } + } +} + + +void TCordferBranchManager::CreateMapBranch(){ + YAML::Node map_setup = recipe["map_setup"].as(); + for(Int_t i=0; i(); + Int_t det_id = map_setup[i]["det_flag"].as(); + //1: coin 2: rf 3: PPAC 4: ssd 5: dssd 6: mssd + + MapReader *mfile = new MapReader(mname, det_id); + for(Int_t j=0; jdetector_name.size(); j++){ + TString bname = mfile->detector_name[j]; + TCordferMapBranch *map_branch = new TCordferMapBranch(bname, det_id, mfile->segment_id[j].size()); + map_branch->SetMapInfo(mfile->segment_id[j], mfile->channel[j]); + + TString brancharray; + brancharray.Form("%s[%d]/I", bname.Data(), map_branch->size); + + mtree->Branch(bname.Data(), map_branch->bra_val, brancharray); + mbranch.push_back(map_branch); + } + } +} + + +//void TCordferBranchManager::CreateCalibBranch(){ +// YAML::Node map_setup = recipe["map_setup"].as(); +// for(Int_t i=0; i(); +// Int_t det_id = map_setup[i]["det_flag"].as(); +// +// //************** +// if(det_id == 3){ continue; } //for PPAC +// //************** +// +// //default (except of PPAC) +// TString cname[2]; +// cname[0] = map_setup[i]["calibfile"]["energy"].as(); +// cname[1] = map_setup[i]["calibfile"]["timing"].as(); +// +// for(Int_t j=0; j<2; j++){ +// FileStat_t info; +// if(cname[j] == ""){ continue; } +// else if(gSystem->GetPathInfo(cname[j].Data(), info) != 0){ +// cerr << "WARNING: in yaml File, '" << cname[j].Data() << "' does not exist." << endl; +// cerr << " not include " << cname[j].Data() << " in ctree" << endl; +// continue; +// } +// +// CalibParamReader *cfile = new CalibParamReader(det_name, cname[j]); +// for(Int_t k=0; kbranch_name.size(); k++){ +// TString bname = cfile->branch_name[k]; +// TCordferCalibBranch *calib_branch = new TCordferCalibBranch(bname, det_id); +// calib_branch->CopyCalibInfo(cfile->dim, cfile->parameters[k]); +// +// TString brancharray; +// if(j==0){ +// brancharray.Form("%s/D", bname.Data()); +// ctree->Branch(bname.Data(), &calib_branch->cbra_val, brancharray); +// calib_branch->adc = true; +// }else{ +// brancharray.Form("%s[12]/D", bname.Data()); +// ctree->Branch(bname.Data(), calib_branch->cbra_tval, brancharray); +// calib_branch->adc = false; +// } +// cbranch.push_back(calib_branch); +// } +// } +// if(det_id == 5){ //for parameter reader of MUX position (mssd) +// TString pos_name = map_setup[i]["calibfile"]["position"].as(); +// FileStat_t info; +// if(gSystem->GetPathInfo(pos_name.Data(), info) != 0){ +// cerr << "ERROR: in yaml File, '" << pos_name.Data() << "' does not exist." << endl; +// cerr << " mssd calibration requires " << pos_name.Data() << " !" << endl; +// exit(0); +// } +// +// CalibParamReader *cfile = new CalibParamReader(); +// cfile->ReadMUXposCalib(pos_name); +// mpos = cfile->position_prms; +// } +// } +//} + + +void TCordferBranchManager::CreateMapping(){ + if(rawdata){ CreateRawMapping(); } + if(mapdata){ CreateMapMapping(); } + //if(calibration){ CreateCalibMapping(); } +} + + +void TCordferBranchManager::CreateRawMapping(){ + memset(rmapping, -1, sizeof(rmapping)); + Int_t seg_buf = -99; + for(Int_t i=0; igeo; + if(seg == seg_buf){ continue; } + seg_buf = seg; + rmapping[seg] = i; + } +} + + +void TCordferBranchManager::CreateMapMapping(){ + Int_t m = sizeof(mmapping) / sizeof(mmapping[0]); + Int_t n = sizeof(mmapping[0]) / sizeof(mmapping[0][0]); + memset(mmapping, -1, sizeof(mmapping[0][0])*m*n); + + for(Int_t i=0; isize; j++){ + mmapping[mbranch[i]->segment_id[j]][mbranch[i]->channel[j]] = MakeBranchChannelIndex(i, j); + } + } +} + + +//void TCordferBranchManager::CreateCalibMapping(){ +// Int_t m = sizeof(cmapping) / sizeof(cmapping[0]); +// Int_t n = sizeof(cmapping[0]) / sizeof(cmapping[0][0]); +// memset(cmapping, -1, sizeof(cmapping[0][0])*m*n); +// +// Int_t M = sizeof(muxmapping) / sizeof(muxmapping[0]); +// Int_t N = sizeof(muxmapping[0]) / sizeof(muxmapping[0][0]); +// memset(muxmapping, -1, sizeof(muxmapping[0][0])*M*N); +// +// Int_t coin_num = 0; +// Int_t rf_num = 0; +// Int_t ssd_num = 0; +// Int_t ssd_t_num = 0; +// Int_t mssd_num = 0; +// Int_t mux_num = 0; +// Int_t mux_t_num = 0; +// +// for(Int_t i=0; idetector_id == 1){ +// Int_t coin_tmp = coin_num; +// for(Int_t j=0; jdetector_id == 1){ +// if(coin_tmp > 0){ +// coin_tmp--; +// continue; +// }else{ +// cbranch[i]->geo = mbranch[j]->segment_id[0]; +// cbranch[i]->ch = mbranch[j]->channel[0]; +// coin_num++; +// break; +// } +// } +// } +// } +// +// //for rf data +// if(cbranch[i]->detector_id == 2){ +// Int_t rf_index; +// for(Int_t j=0; jdetector_id == 2){ rf_index = j; } +// } +// if(rf_num == 0){ +// cbranch[i]->geo = mbranch[rf_index]->segment_id[0]; +// cbranch[i]->ch = mbranch[rf_index]->channel[0]; +// rf_num++; +// }else if(rf_num == 1){ +// cbranch[i]->geo = mbranch[rf_index]->segment_id[1]; +// cbranch[i]->ch = mbranch[rf_index]->channel[1]; +// rf_num++; +// }else{ +// cout << "WARNING: format of mapfile of rf is differenet" << endl; +// } +// } +// +// //for ppac +// //if(cbranch[i]->detector_id == 3){} +// +// +// //for dssd, ssd data +// if(cbranch[i]->detector_id == 4){ +// if(cbranch[i]->adc == true){ +// Int_t ssd_tmp = ssd_num; +// for(Int_t j=0; jdetector_id == 4){ +// if(ssd_tmp > 0){ +// ssd_tmp--; +// continue; +// }else{ +// cbranch[i]->geo = mbranch[j]->segment_id[0]; +// cbranch[i]->ch = mbranch[j]->channel[0]; +// ssd_num++; +// break; +// } +// } +// } +// }else if(cbranch[i]->adc == false){ +// Int_t ssd_t_tmp = ssd_t_num; +// for(Int_t j=0; jdetector_id == 4){ +// if(ssd_t_tmp > 0){ +// ssd_t_tmp--; +// continue; +// }else{ +// cbranch[i]->geo = mbranch[j]->segment_id[1]; +// cbranch[i]->ch = mbranch[j]->channel[1]; +// ssd_t_num++; +// break; +// } +// } +// } +// } +// } +// +// +// //for mssd +// if(cbranch[i]->detector_id == 5){ +// if(cbranch[i]->adc == true){ +// mssd_num++; +// if(mssd_num%16 == 1){ +// Int_t mux_id = mssd_num/16; +// cbranch[i]->mpos1_prm = mpos[2*mux_id]; +// cbranch[i]->mpos2_prm = mpos[2*mux_id + 1]; +// +// Int_t mux_tmp = mux_num; +// for(Int_t j=0; jdetector_id == 5){ +// if(mux_tmp > 0){ +// mux_tmp--; +// continue; +// }else{ +// //cout << i << " " << cbranch[i]->GetBranchName() << " " << mbranch[j]->GetBranchName() << endl; +// for(Int_t k=0; k<4; k++){ +// //cout << " " << mbranch[j]->segment_id[k] << " " << mbranch[j]->channel[k] << endl; +// cmapping[mbranch[j]->segment_id[k]][mbranch[j]->channel[k]] = i; +// muxmapping[mbranch[j]->segment_id[k]][mbranch[j]->channel[k]] = k + 1; +// } +// mux_num++; +// break; +// } +// } +// } +// } +// }else if(cbranch[i]->adc == false){ +// Int_t mux_t_tmp = mux_t_num; +// for(Int_t j=0; jdetector_id == 5){ +// if(mux_t_tmp > 0){ +// mux_t_tmp--; +// continue; +// }else{ +// //cout << cbranch[i]->GetBranchName() << " " << mbranch[j]->GetBranchName() << endl; +// cmapping[mbranch[j]->segment_id[4]][mbranch[j]->channel[4]] = i; +// +// mux_t_num++; +// break; +// } +// } +// } +// +// } +// continue; +// } +// +// cmapping[cbranch[i]->geo][cbranch[i]->ch] = i; +// +// //cout << i << " " << cbranch_name << " " << seg << endl; +// } +//} + + +void TCordferBranchManager::GiveValue(Int_t geo, Int_t ch, Int_t val){ + if(rawdata){ GiveRawValue(geo, ch, val); } + if(mapdata){ GiveMapValue(geo, ch, val); } + //if(calibration){ GiveCalibValue(geo, ch, val); } +} + + +void TCordferBranchManager::GiveRawValue(Int_t geo, Int_t ch, Int_t val){ + Int_t index = rmapping[geo]; + + //if not register segment + if(index < 0){ + if(rmapflag == false){ + cout << "WARNING: rmapping is not completed" << endl; + } + rmapflag=true; + return; + } + + if(branch[index]->detector_id == 10){ + Int_t ht_id = branch[index+ch]->nhit; + branch[index+ch]->bra_val[ht_id] = val; + branch[index+ch]->nhit += 1; + + }else{ + branch[index]->bra_val[ch] = val; + } +} + + +void TCordferBranchManager::GiveMapValue(Int_t geo, Int_t ch, Int_t val){ + Int_t index = mmapping[geo][ch]; + if(index < 0){ + if(mmapflag == false){ + cout << "-- WARNING: mmapping is not completed" << endl; + } + mmapflag=true; + return; + } + + array index_array = GetBranchChannelIndex(index); + Int_t i = index_array[0]; + Int_t j = index_array[1]; + + mbranch[i]->bra_val[j] = val; +} + + +//void TCordferBranchManager::GiveCalibValue(Int_t geo, Int_t ch, Int_t val){ +// Int_t index = cmapping[geo][ch]; +// Int_t mux_id = muxmapping[geo][ch]; +// if(index < 0){ +// if(cmapflag == false){ +// cout << "-- WARNING: cmapping is not completed" << endl; +// } +// cmapflag=true; +// return; +// } +// +// //START user setting (si26a) +// if(SETTING_SI26A){ +// if(index == 163){ return; } //for MUX2-1 (broken) +// } +// //END +// +// //calib_status +// // 0->not mux, 1->first mux signal, other -> "val" buffer +// Int_t calib_status = cbranch[index]->GetCalibStatus(val, mux_id); +// //if(calib_status == 1){ cout << cbranch[index]->GetBranchName() << endl; } +// if(calib_status == 1){ return; } +// else if(calib_status == 0){ cbranch[index]->SetCalibValue(val); } +// else{ +// +// //START user setting (si26a) +// if(SETTING_SI26A){ +// if(index == 195){ //for MUX3-1 (chained with MUX2-1) +// Int_t pos_val = cbranch[index]->UserGetPosValue(mux_id); +// if(pos_val == -1){ +// cout << "ERROR" << endl; +// return; +// } +// //cout << cbranch[index]->GetBranchName() << " " << cbranch[index-32]->GetBranchName() << endl; +// Int_t add_ch = cbranch[index-32]->UserGetAddBranchIndex(pos_val, mux_id); //in case MUX2-1 +// if(add_ch != -1){ add_ch -= 32; } +// else if(add_ch == -1){ +// Int_t add_ch2 = cbranch[index]->UserGetAddBranchIndex(pos_val, mux_id);//in case MUX3-1 +// if(add_ch2 == -1){ return; } +// else{ add_ch = add_ch2; } +// } +// cbranch[index + add_ch]->SetCalibValue(calib_status); +// return; +// } +// } +// //END +// +// Int_t add_ch = cbranch[index]->GetAddBranchIndex(mux_id); +// if(add_ch == -1){ return; } +// //cout << "\t" << cbranch[index]->GetBranchName() << " " << index << " " << add_ch << endl; +// cbranch[index + add_ch]->SetCalibValue(calib_status); +// } +//} + + +void TCordferBranchManager::Fill(){ + if(rawdata){ RawFill(); } + if(mapdata){ MapFill(); } + //if(calibration){ CalibFill(); } +} + + +void TCordferBranchManager::ClearAll(){ + if(rawdata){ ClearRawAll(); } + if(mapdata){ ClearMapAll(); } + //if(calibration){ ClearCalibAll(); } +} + + +void TCordferBranchManager::ClearRawAll(){ + for(Int_t i=0; iClear(); + } +} + + +void TCordferBranchManager::ClearMapAll(){ + for(Int_t i=0; iClear(); + } +} + + +//void TCordferBranchManager::ClearCalibAll(){ +// for(Int_t i=0; iClear(); +// } +//} + + +void TCordferBranchManager::DataWrite(){ + if(rawdata){ RawDataWrite(); } + if(mapdata){ MapDataWrite(); } + //if(calibration){ CalibDataWrite(); } +} + + +void TCordferBranchManager::FileClose(){ + rootfile->Close(); + for(Int_t i=0; iFreeAll(); + } + + for(Int_t i=0; iFreeMemory(); + } + +} + +// for debug +void TCordferBranchManager::DEBUG_PRINT(){ + for(Int_t i=0; i< branch.size(); i++){ + cout << "\tDEBUG: " << branch[i]->GetBranchName() << endl; + cout << "\t\t" << branch[i]->size << " " << branch[i]->nhit << endl; + } +} diff --git a/old/TCordferBranchManager.hh b/old/TCordferBranchManager.hh new file mode 100644 index 0000000000000000000000000000000000000000..473a5f1740501e2cdf68b549cfec103e5668d082 --- /dev/null +++ b/old/TCordferBranchManager.hh @@ -0,0 +1,114 @@ +#ifndef _TCORDFERBRANCHMANAGER_HH_ +#define _TCORDFERBRANCHMANAGER_HH_ + +#include +#include +//#include +#include + +#include +#include +#include + +#include "MapReader.hh" +#include "CalibParamReader.hh" +#include "TCordferRawBranch.hh" +#include "TCordferMapBranch.hh" +#include "TCordferCalibBranch.hh" + +using namespace std; + +class TCordferBranchManager +{ + private: + TFile *rootfile; + TString root_name; + TString ridf_name; + YAML::Node recipe; + + TTree *tree; + TTree *mtree; + //TTree *ctree; + TH1I *scaler; + + vector branch; + vector mbranch; + //vector cbranch; + Int_t rmapping[100]; //segment_id(geo) -> branch index + Int_t mmapping[100][100]; // [segment_id][ch] -> branch index + //Int_t cmapping[100][100]; + //Int_t muxmapping[100][100]; + + //vector< vector > mpos; //for position parameter of MUX (mssd) + + bool rawdata = false; + bool mapdata = false; + //bool calibration = false; + + bool rmapflag = false; + bool mmapflag = false; + //bool cmapflag = false; + + public: + TCordferBranchManager(){} + TCordferBranchManager(TString input, TString output){ + ridf_name = input; + root_name = output; + } + ~TCordferBranchManager(){} + + TString get_ridf_name(){ return ridf_name; } + TString get_root_name(){ return root_name; } + + void Readyaml(TString yamlfile); + void CreateRootFile(){ rootfile = new TFile(root_name.Data(), "recreate"); } + + void CreateTree(); + void CreateRawTree(); + void CreateMapTree(); + //void CreateCalibTree(); + + void CreateBranch(); + void CreateRawBranch(); + void CreateMapBranch(); + //void CreateCalibBranch(); + Int_t MakeBranchChannelIndex(Int_t bra_id, Int_t ch_id){ + return bra_id*100 + ch_id; + } + array GetBranchChannelIndex(Int_t index){ + Int_t j = index % 100; + Int_t i = (index - j)/100; + return {i, j}; + } + + void CreateMapping(); + void CreateRawMapping(); + void CreateMapMapping(); + //void CreateCalibMapping(); + + void GiveValue(Int_t geo, Int_t ch, Int_t val); + void GiveRawValue(Int_t geo, Int_t ch, Int_t val); + void GiveMapValue(Int_t geo, Int_t ch, Int_t val); + // void GiveCalibValue(Int_t geo, Int_t ch, Int_t val); + + void Fill(); + void RawFill(){ tree->Fill(); } + void MapFill(){ mtree->Fill(); } + //void CalibFill() { ctree->Fill(); } + + void ClearAll(); + void ClearRawAll(); + void ClearMapAll(); + //void ClearCalibAll(); + + void DataWrite(); + void RawDataWrite(){ tree->Write(); } + void MapDataWrite(){ mtree->Write(); } + //void CalibDataWrite(){ ctree->Write(); } + + void FileClose(); + + void DEBUG_PRINT(); +}; + +#endif diff --git a/src/TCordferCalibBranch.cpp b/old/TCordferCalibBranch.cpp similarity index 71% rename from src/TCordferCalibBranch.cpp rename to old/TCordferCalibBranch.cpp index 4f4bb971d5ab6e238d66eee0d29e082e2f90fff8..c56a98f5325416047d60c82c456b54ad9e1379e7 100644 --- a/src/TCordferCalibBranch.cpp +++ b/old/TCordferCalibBranch.cpp @@ -23,43 +23,52 @@ void TCordferCalibBranch::CopyCalibInfo(Int_t dim, vector param){ Int_t TCordferCalibBranch::GetCalibStatus(Int_t val, Int_t mux_id){ if(detector_id == 5){ if(adc == true){ + + //first hit to ene1 if(mux_id == 1 && mux_pos1 == false){ mux_status1 = true; val_tmp1 = val; return 1; } - else if(mux_id == 1 && mux_pos2 == true){ + //second hit (first: pos1, second: ene1) + else if(mux_id == 1 && mux_pos1 == true){ return val; } + //first hit to ene2 else if(mux_id == 2 && mux_pos2 == false){ mux_status2 = true; val_tmp2 = val; return 1; } + //second hit (first: pos2, second: ene2) else if(mux_id == 2 && mux_pos2 == true){ return val; } + //first hit to pos1 else if(mux_id == 3 && mux_status1 == false){ pval_tmp1 = val; mux_pos1 = true; return 1; } + //second hit (first: ene1, second: pos1) else if(mux_id == 3 && mux_status1 == true){ pval_tmp1 = val; return val_tmp1; } + //first hit to pos2 else if(mux_id == 4 && mux_status2 == false){ pval_tmp2 = val; mux_pos2 = true; return 1; } + //second hit (first: ene2, second: pos2) else if(mux_id == 4 && mux_status2 == true){ pval_tmp2 = val; return val_tmp2; @@ -75,6 +84,7 @@ Int_t TCordferCalibBranch::GetCalibStatus(Int_t val, Int_t mux_id){ Int_t TCordferCalibBranch::GetAddBranchIndex(Int_t mux_id){ Int_t add_ch = -1; + if(mux_id == 1 || mux_id == 3){ for(Int_t i=0; i<16; i++){ if(mpos1_prm[i] < pval_tmp1 && mpos1_prm[i+1] > pval_tmp1){ @@ -120,6 +130,8 @@ void TCordferCalibBranch::Clear(){ mux_pos2=false; val_tmp1=-99; val_tmp2=-99; + pval_tmp1=-99; + pval_tmp2=-99; if(adc == true){ cbra_val = -500.5; }else{ @@ -129,3 +141,34 @@ void TCordferCalibBranch::Clear(){ count_hit = 0; } } + + +Int_t TCordferCalibBranch::UserGetPosValue(Int_t mux_id){ + if(mux_id == 1 || mux_id == 3){ + return pval_tmp1; + }else if(mux_id == 2 || mux_id == 4){ + return pval_tmp2; + } + return -1; +} + +Int_t TCordferCalibBranch::UserGetAddBranchIndex(Int_t pos_val, Int_t mux_id){ + Int_t add_ch = -1; + + if(mux_id == 1 || mux_id == 3){ + for(Int_t i=0; i<16; i++){ + if(mpos1_prm[i] < pos_val && mpos1_prm[i+1] > pos_val){ + add_ch = i; + } + } + } + + else if(mux_id == 2 || mux_id == 4){ + for(Int_t i=0; i<16; i++){ + if(mpos2_prm[i] < pos_val && mpos2_prm[i+1] > pos_val){ + add_ch = i; + } + } + } + return add_ch; +} diff --git a/include/TCordferCalibBranch.hh b/old/TCordferCalibBranch.hh similarity index 89% rename from include/TCordferCalibBranch.hh rename to old/TCordferCalibBranch.hh index a471ce791d0cb7e1f3227564e2aefd5874a205a8..b22a6787e8507c42338203449680e1410fe202ed 100644 --- a/include/TCordferCalibBranch.hh +++ b/old/TCordferCalibBranch.hh @@ -57,6 +57,10 @@ class TCordferCalibBranch Double_t GetCalibValue(Int_t val, vector params); void Clear(); + + //for User setting (si26a) + Int_t UserGetPosValue(Int_t mux_id); + Int_t UserGetAddBranchIndex(Int_t pos_val, Int_t mux_id); }; #endif diff --git a/old/map/coin.map b/old/map/coin.map new file mode 100644 index 0000000000000000000000000000000000000000..2d6aabf5750ab998aa4d59e7068e61fe051545e2 --- /dev/null +++ b/old/map/coin.map @@ -0,0 +1,5 @@ +# Map for coin +# Note: automatically produced with mapmaker.pl. Do not edit it directly +3, 1, 12 0 7 11 13, ; coin Single +3, 2, 12 0 7 11 14, ; coin Coin +3, 3, 12 0 7 11 15, ; coin Pileup diff --git a/old/map/dssd.map b/old/map/dssd.map new file mode 100644 index 0000000000000000000000000000000000000000..399b13cae411fbd03c88e7b0f4c41d8537950c39 --- /dev/null +++ b/old/map/dssd.map @@ -0,0 +1,66 @@ +# Map for dssd +# Note: automatically produced with mapmaker.pl. Do not edit it directly +4, 1, 12 0 6 6 0, 12 0 7 16 32, ; dssd Tel1 dE1X 1 +4, 2, 12 0 6 6 1, 12 0 7 16 33, ; dssd Tel1 dE1X 2 +4, 3, 12 0 6 6 2, 12 0 7 16 34, ; dssd Tel1 dE1X 3 +4, 4, 12 0 6 6 3, 12 0 7 16 35, ; dssd Tel1 dE1X 4 +4, 5, 12 0 6 6 4, 12 0 7 16 36, ; dssd Tel1 dE1X 5 +4, 6, 12 0 6 6 5, 12 0 7 16 37, ; dssd Tel1 dE1X 6 +4, 7, 12 0 6 6 6, 12 0 7 16 38, ; dssd Tel1 dE1X 7 +4, 8, 12 0 6 6 7, 12 0 7 16 39, ; dssd Tel1 dE1X 8 +4, 9, 12 0 6 6 8, 12 0 7 16 40, ; dssd Tel1 dE1X 9 +4,10, 12 0 6 6 9, 12 0 7 16 41, ; dssd Tel1 dE1X 10 +4,11, 12 0 6 6 10, 12 0 7 16 42, ; dssd Tel1 dE1X 11 +4,12, 12 0 6 6 11, 12 0 7 16 43, ; dssd Tel1 dE1X 12 +4,13, 12 0 6 6 12, 12 0 7 16 44, ; dssd Tel1 dE1X 13 +4,14, 12 0 6 6 13, 12 0 7 16 45, ; dssd Tel1 dE1X 14 +4,15, 12 0 6 6 14, 12 0 7 16 46, ; dssd Tel1 dE1X 15 +4,16, 12 0 6 6 15, 12 0 7 16 47, ; dssd Tel1 dE1X 16 +4,17, 12 0 6 1 16, 12 0 7 16 48, ; dssd Tel1 dE2Y 1 +4,18, 12 0 6 1 17, 12 0 7 16 49, ; dssd Tel1 dE2Y 2 +4,19, 12 0 6 1 18, 12 0 7 16 50, ; dssd Tel1 dE2Y 3 +4,20, 12 0 6 1 19, 12 0 7 16 51, ; dssd Tel1 dE2Y 4 +4,21, 12 0 6 1 20, 12 0 7 16 52, ; dssd Tel1 dE2Y 5 +4,22, 12 0 6 1 21, 12 0 7 16 53, ; dssd Tel1 dE2Y 6 +4,23, 12 0 6 1 22, 12 0 7 16 54, ; dssd Tel1 dE2Y 7 +4,24, 12 0 6 1 23, 12 0 7 16 55, ; dssd Tel1 dE2Y 8 +4,25, 12 0 6 1 24, 12 0 7 16 56, ; dssd Tel1 dE2Y 9 +4,26, 12 0 6 1 25, 12 0 7 16 57, ; dssd Tel1 dE2Y 10 +4,27, 12 0 6 1 26, 12 0 7 16 58, ; dssd Tel1 dE2Y 11 +4,28, 12 0 6 1 27, 12 0 7 16 59, ; dssd Tel1 dE2Y 12 +4,29, 12 0 6 1 28, 12 0 7 16 60, ; dssd Tel1 dE2Y 13 +4,30, 12 0 6 1 29, 12 0 7 16 61, ; dssd Tel1 dE2Y 14 +4,31, 12 0 6 1 30, 12 0 7 16 62, ; dssd Tel1 dE2Y 15 +4,32, 12 0 6 1 31, 12 0 7 16 63, ; dssd Tel1 dE2Y 16 +4,33, 12 0 6 2 0, 12 0 7 11 16, ; dssd Tel2 dE2Y 1 +4,34, 12 0 6 2 1, 12 0 7 11 17, ; dssd Tel2 dE2Y 2 +4,35, 12 0 6 2 2, 12 0 7 11 18, ; dssd Tel2 dE2Y 3 +4,36, 12 0 6 2 3, 12 0 7 11 19, ; dssd Tel2 dE2Y 4 +4,37, 12 0 6 2 4, 12 0 7 11 20, ; dssd Tel2 dE2Y 5 +4,38, 12 0 6 2 5, 12 0 7 11 21, ; dssd Tel2 dE2Y 6 +4,39, 12 0 6 2 6, 12 0 7 11 22, ; dssd Tel2 dE2Y 7 +4,40, 12 0 6 2 7, 12 0 7 11 23, ; dssd Tel2 dE2Y 8 +4,41, 12 0 6 2 8, 12 0 7 11 24, ; dssd Tel2 dE2Y 9 +4,42, 12 0 6 2 9, 12 0 7 11 25, ; dssd Tel2 dE2Y 10 +4,43, 12 0 6 2 10, 12 0 7 11 26, ; dssd Tel2 dE2Y 11 +4,44, 12 0 6 2 11, 12 0 7 11 27, ; dssd Tel2 dE2Y 12 +4,45, 12 0 6 2 12, 12 0 7 11 28, ; dssd Tel2 dE2Y 13 +4,46, 12 0 6 2 13, 12 0 7 11 29, ; dssd Tel2 dE2Y 14 +4,47, 12 0 6 2 14, 12 0 7 11 30, ; dssd Tel2 dE2Y 15 +4,48, 12 0 6 2 15, 12 0 7 11 31, ; dssd Tel2 dE2Y 16 +4,49, 12 0 6 2 16, 12 0 7 12 0, ; dssd Tel3 dE2Y 1 +4,50, 12 0 6 2 17, 12 0 7 12 1, ; dssd Tel3 dE2Y 2 +4,51, 12 0 6 2 18, 12 0 7 12 2, ; dssd Tel3 dE2Y 3 +4,52, 12 0 6 2 19, 12 0 7 12 3, ; dssd Tel3 dE2Y 4 +4,53, 12 0 6 2 20, 12 0 7 12 4, ; dssd Tel3 dE2Y 5 +4,54, 12 0 6 2 21, 12 0 7 12 5, ; dssd Tel3 dE2Y 6 +4,55, 12 0 6 2 22, 12 0 7 12 6, ; dssd Tel3 dE2Y 7 +4,56, 12 0 6 2 23, 12 0 7 12 7, ; dssd Tel3 dE2Y 8 +4,57, 12 0 6 2 24, 12 0 7 12 8, ; dssd Tel3 dE2Y 9 +4,58, 12 0 6 2 25, 12 0 7 12 9, ; dssd Tel3 dE2Y 10 +4,59, 12 0 6 2 26, 12 0 7 12 10, ; dssd Tel3 dE2Y 11 +4,60, 12 0 6 2 27, 12 0 7 12 11, ; dssd Tel3 dE2Y 12 +4,61, 12 0 6 2 28, 12 0 7 12 12, ; dssd Tel3 dE2Y 13 +4,62, 12 0 6 2 29, 12 0 7 12 13, ; dssd Tel3 dE2Y 14 +4,63, 12 0 6 2 30, 12 0 7 12 14, ; dssd Tel3 dE2Y 15 +4,64, 12 0 6 2 31, 12 0 7 12 15, ; dssd Tel3 dE2Y 16 diff --git a/old/map/mssd.map b/old/map/mssd.map new file mode 100644 index 0000000000000000000000000000000000000000..57ee4b46c0b63b38d5925e31e90e3b424c8ad77a --- /dev/null +++ b/old/map/mssd.map @@ -0,0 +1,8 @@ +# Map for mssd +# Note: automatically produced with mapmaker.pl. Do not edit it directly +5, 1, 12 0 6 7 0, 12 0 6 7 1, 12 0 6 7 2, 12 0 6 7 3, 12 0 7 11 2, ; mssd 1-1 +5, 2, 12 0 6 7 4, 12 0 6 7 5, 12 0 6 7 6, 12 0 6 7 7, 12 0 7 11 3, ; mssd 1-2 +5, 3, 12 0 6 7 8, 12 0 6 7 9, 12 0 6 7 10, 12 0 6 7 11, 12 0 7 11 4, ; mssd 2-1 +5, 4, 12 0 6 7 12, 12 0 6 7 13, 12 0 6 7 14, 12 0 6 7 15, 12 0 7 11 5, ; mssd 2-2 +5, 5, 12 0 6 7 16, 12 0 6 7 17, 12 0 6 7 18, 12 0 6 7 19, 12 0 7 11 6, ; mssd 3-1 +5, 6, 12 0 6 7 20, 12 0 6 7 21, 12 0 6 7 22, 12 0 6 7 23, 12 0 7 11 7, ; mssd 3-2 diff --git a/old/map/ppac.map b/old/map/ppac.map new file mode 100644 index 0000000000000000000000000000000000000000..5e02f3259ae16a657cb6a6f62f8bf4f568f2d8c7 --- /dev/null +++ b/old/map/ppac.map @@ -0,0 +1,5 @@ +# Map for ppac +# Note: automatically produced with mapmaker.pl. Do not edit it directly +2, 1, 12 0 6 1 0, 12 0 6 1 1, 12 0 6 1 2, 12 0 6 1 3, 12 0 6 1 15, ; ppac F1 +2, 2, 12 0 7 16 6, 12 0 7 16 7, 12 0 7 16 8, 12 0 7 16 9, 12 0 7 16 5, ; ppac F2/F3 B +2, 3, 12 0 7 16 1, 12 0 7 16 2, 12 0 7 16 3, 12 0 7 16 4, 12 0 7 16 0, ; ppac F3 A diff --git a/old/map/rf.map b/old/map/rf.map new file mode 100644 index 0000000000000000000000000000000000000000..826c888f47b3c789807deae48aa2b5e3296c2c59 --- /dev/null +++ b/old/map/rf.map @@ -0,0 +1,3 @@ +# Map for rf +# Note: automatically produced with mapmaker.pl. Do not edit it directly +1, 1, 12 0 7 11 0, 12 0 7 11 1, ; rf RF diff --git a/old/map/ssd.map b/old/map/ssd.map new file mode 100644 index 0000000000000000000000000000000000000000..87fed02a57d4b151fee682a573d43238c4ec2aee --- /dev/null +++ b/old/map/ssd.map @@ -0,0 +1,19 @@ +# Map for ssd +# Note: automatically produced with mapmaker.pl. Do not edit it directly +6, 1, 12 0 6 6 16, 12 0 7 16 16, ; ssd Tel1 E1 +6, 2, 12 0 6 6 17, 12 0 7 16 17, ; ssd Tel1 E2 +6, 3, 12 0 6 6 18, 12 0 7 16 18, ; ssd Tel2 E1 +6, 4, 12 0 6 6 19, 12 0 7 16 19, ; ssd Tel2 E2 +6, 5, 12 0 6 6 20, 12 0 7 16 20, ; ssd Tel3 E1 +6, 6, 12 0 6 6 21, 12 0 7 16 21, ; ssd Tel3 E2 +6, 7, 12 0 6 6 22, 12 0 7 16 22, ; ssd Tel4 E1 +6, 8, 12 0 6 6 23, 12 0 7 16 23, ; ssd Tel4 E2 +6, 9, 12 0 6 6 24, 12 0 7 16 24, ; ssd Tel5 E1 +6,10, 12 0 6 6 25, 12 0 7 16 25, ; ssd Tel5 E2 +6,11, 12 0 6 6 26, 12 0 7 16 26, ; ssd N/A +6,12, 12 0 6 6 27, 12 0 7 16 27, ; ssd N/A +6,13, 12 0 6 6 28, 12 0 7 16 28, ; ssd Lowgain 1 +6,14, 12 0 6 6 29, 12 0 7 16 29, ; ssd Lowgain 2 +6,15, 12 0 6 6 30, 12 0 7 16 30, ; ssd Lowgain 3 +6,16, 12 0 6 6 31, 12 0 7 16 31, ; ssd Lowgain 4 +6,17, 12 0 6 1 4, 12 0 7 17 4, ; ssd F2SSD diff --git a/recipe/recipe_si26a.yml b/recipe/recipe_si26a.yml index 14067c9af60bdbfe23ffb87a240571f4bc1ff85c..d2ae46586c18162292e74fceaba8161f2d508257 100644 --- a/recipe/recipe_si26a.yml +++ b/recipe/recipe_si26a.yml @@ -1,5 +1,4 @@ # tree information (in_use: on or off) -# in_use: "on" or "off" raw_tree: name: "tree" description: "raw data tree" @@ -8,10 +7,6 @@ map_tree: name: "mtree" description: "mapping data tree" in_use: on -calib_tree: - name: "ctree" - description: "calibrate data tree" - in_use: on # mapfile and calibration file information @@ -19,50 +14,33 @@ calib_tree: # 1: coincidence # 2: rf # 3: PPAC -# 4: ssd (dssd) -# 5: MUX (MUX) +# 4: ssd +# 5: dssd +# 6: mssd (MUX) map_setup: - name: coin mapfile: "../map/si26a/coin.map" det_flag: 1 - calibfile: - energy: "" - timing: "../calibration/si26a/coin_t.prm" - name: dssd mapfile: "../map/si26a/dssd.map" - det_flag: 4 - calibfile: - energy: "../calibration/si26a/dssd.prm" - timing: "../calibration/si26a/dssd_t.prm" + det_flag: 5 - name: mssd mapfile: "../map/si26a/mssd.map" - det_flag: 5 - calibfile: - energy: "../calibration/si26a/mssd.prm" - timing: "../calibration/si26a/mssd_t.prm" - position: "../calibration/si26a/mpos.prm" + det_flag: 6 - name: ppac mapfile: "../map/si26a/ppac.map" det_flag: 3 - calibfile: - general: "../calibration/si26a/ppac.prm" - name: rf mapfile: "../map/si26a/rf.map" det_flag: 2 - calibfile: - energy: "" - timing: "../calibration/si26a/rf_t.prm" - name: ssd mapfile: "../map/si26a/ssd.map" det_flag: 4 - calibfile: - energy: "../calibration/si26a/ssd.prm" - timing: "../calibration/si26a/ssd_t.prm" # for rawdata tree @@ -104,10 +82,6 @@ setup: - segment_no.: 16 name: mhtdc detector_id: 10 - branches: - - name: mhtdc - channel: 64 - maxhit: 12 - - name: mhtdc_nhit - channel: 64 + channel: 64 + maxhit: 12 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3f3a7f69d3ecf8fa4872ea02bbd1c8c90e338bf9..32f838e704a05be7389451f43a50e7efd4dd7927 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -2,12 +2,13 @@ add_library(sources SHARED CommandlineReader.cpp MapReader.cpp CalibParamReader.cpp - CalibrationManager.cpp TCordferRawBranch.cpp TCordferMapBranch.cpp - TCordferCalibBranch.cpp TCordferBranchManager.cpp ) +#add_library(sources SHARED +# *.cpp +# } # include the headder file (absolute path) target_include_directories(sources PUBLIC @@ -16,7 +17,8 @@ target_include_directories(sources PUBLIC ${PROJECT_SOURCE_DIR}/anaroot/include) target_link_libraries(sources - yaml-cpp +# yaml-cpp + /usr/local/lib64/libyaml-cpp.so ${ROOT_LIBRARIES} -L${PROJECT_SOURCE_DIR}/anaroot/lib -lanacore -pthread -lm -ldl -rdynamic) diff --git a/src/CalibrationManager.cpp b/src/CalibrationManager.cpp deleted file mode 100644 index f08437978c5dd9f57fda6754eb7825f69dfc16e3..0000000000000000000000000000000000000000 --- a/src/CalibrationManager.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include -#include -#include - -#include "CalibrationManager.hh" - -using namespace std; - - -Double_t GetCalibValue(Int_t val, vector params){ - Double_t tmp = 0.0; - for(Int_t i=0; i line; - vector id, ch; - + // if there are several ";" in one line, it makes error if((buf.find(';') != buf.rfind(';')) || buf.find(';') == string::npos){ cerr << "ERROR: map file is not correct" << endl; exit(0); } + + vector line; + vector det, id, ch; + string name = buf.substr(buf.find(';')+1); if(name[0] == ' '){ name.erase(0, 1); } if(name[name.length()-1] == ' '){ name.pop_back(); } @@ -49,12 +51,14 @@ void MapReader::ReadMap() { int i_val = stoi(val); line.push_back(i_val); } + det.push_back(line[2]); id.push_back(line[3]); ch.push_back(line[4]); line.clear(); buf.erase(0, pos+1); } + det_id.push_back(det); segment_id.push_back(id); channel.push_back(ch); detector_name.push_back(name); diff --git a/src/TCordferBranchManager.cpp b/src/TCordferBranchManager.cpp index d96cc9903455f8d65247d5e81b4d0f355f9849bf..4667357b7f8137ba1fd03fe3885f25e1327fd444 100644 --- a/src/TCordferBranchManager.cpp +++ b/src/TCordferBranchManager.cpp @@ -4,7 +4,6 @@ #include #include #include -#include #include #include @@ -37,23 +36,12 @@ void TCordferBranchManager::Readyaml(TString yamlfile){ mapdata=true; cout << "\t-- map_tree in use" << endl; } - if(recipe["calib_tree"]["in_use"].as() == "on"){ - calibration=true; - cout << "\t-- calib_tree in use" << endl; - } - - if(mapdata == false && calibration == true){ - cout << "ERROR: calibration tree require to use map tree" << endl; - cout << "\tCHANGE recipe in yaml file" << endl; - exit(0); - } } void TCordferBranchManager::CreateTree(){ if(rawdata){ CreateRawTree(); } if(mapdata){ CreateMapTree(); } - if(calibration){ CreateCalibTree(); } } @@ -73,18 +61,9 @@ void TCordferBranchManager::CreateMapTree(){ } -void TCordferBranchManager::CreateCalibTree(){ - TString calibname = recipe["calib_tree"]["name"].as(); - TString calibdesc = recipe["calib_tree"]["description"].as(); - - ctree = new TTree(calibname, calibdesc); -} - - void TCordferBranchManager::CreateBranch(){ if(rawdata){ CreateRawBranch(); } if(mapdata){ CreateMapBranch(); } - if(calibration){ CreateCalibBranch(); } } @@ -94,9 +73,9 @@ void TCordferBranchManager::CreateRawBranch(){ Int_t seg_id = setup[i]["segment_no."].as(); TString bname = setup[i]["name"].as(); Int_t det_id = setup[i]["detector_id"].as(); + Int_t nch = setup[i]["channel"].as(); if(det_id != 10){ - Int_t nch = setup[i]["channel"].as(); TCordferRawBranch *raw_branch = new TCordferRawBranch(bname, seg_id, nch, det_id); TString brancharray; @@ -106,28 +85,15 @@ void TCordferBranchManager::CreateRawBranch(){ branch.push_back(raw_branch); }else{ - TString mhtdc_name = setup[i]["branches"][0]["name"].as(); - Int_t nch = setup[i]["branches"][0]["channel"].as(); - Int_t nhit = setup[i]["branches"][0]["maxhit"].as(); + Int_t nhit = setup[i]["maxhit"].as(); - TCordferRawBranch *mhtdc_branch = new TCordferRawBranch(mhtdc_name, seg_id, nch, det_id, nhit); + TCordferRawBranch *mhtdc_branch = new TCordferRawBranch(bname, seg_id, nch, det_id, nhit); - TString brancharray; - brancharray.Form("%s[%d][%d]/I", mhtdc_name.Data(), mhtdc_branch->size, mhtdc_branch->nhit); + TString mhtdcarray; + mhtdcarray.Form("%s[%d][%d]/I", bname.Data(), mhtdc_branch->size, mhtdc_branch->max_hit); - tree->Branch(mhtdc_name.Data(), mhtdc_branch->mhtdc_val, brancharray); + tree->Branch(bname.Data(), mhtdc_branch->mhtdc_val, mhtdcarray); branch.push_back(mhtdc_branch); - - - TString nhit_name = setup[i]["branches"][1]["name"].as(); - Int_t nhit_nch = setup[i]["branches"][1]["channel"].as(); - TCordferRawBranch *nhit_branch = new TCordferRawBranch(nhit_name, 0, nhit_nch, 0); //geo, det_id = 0 - - TString nhitbrancharray; - nhitbrancharray.Form("%s[%d]/I", nhit_name.Data(), nhit_branch->size); - - tree->Branch(nhit_name.Data(), nhit_branch->bra_val, nhitbrancharray); - branch.push_back(nhit_branch); } } } @@ -138,87 +104,235 @@ void TCordferBranchManager::CreateMapBranch(){ for(Int_t i=0; i(); Int_t det_id = map_setup[i]["det_flag"].as(); + //1: coin 2: rf 3: PPAC 4: ssd 5: dssd 6: mssd MapReader *mfile = new MapReader(mname); - for(Int_t j=0; jdetector_name.size(); j++){ - TString bname = mfile->detector_name[j]; - TCordferMapBranch *map_branch = new TCordferMapBranch(bname, det_id, mfile->segment_id[j].size()); - map_branch->SetMapInfo(mfile->segment_id[j], mfile->channel[j]); + if(det_id == 1){ // coin + for(Int_t j=0; jdetector_name.size(); j++){ + TString bname = mfile->detector_name[j]; + TCordferMapBranch *map_branch = new TCordferMapBranch(bname, det_id, mfile->segment_id[j].size()); + map_branch->SetMapInfo(mfile->segment_id[j], mfile->channel[j], mfile->det_id[j]); + + if(map_branch->size != 1){ + cout << "-- WARNING: Coin map size is NOT 1" << endl; + } + TString brancharray; - TString brancharray; - brancharray.Form("%s[%d]/I", bname.Data(), map_branch->size); + //assume that detector_id of all channel of each branch is the same + if(map_branch->detector_flag[0] == 10){ + brancharray.Form("%s[%d]/I", bname.Data(), MAX_NHIT); + mtree->Branch(bname.Data(), map_branch->bra_val_one, brancharray); + }else{ + brancharray.Form("%s/I", bname.Data()); + mtree->Branch(bname.Data(), &map_branch->bra_val, brancharray); + } - mtree->Branch(bname.Data(), map_branch->bra_val, brancharray); - mbranch.push_back(map_branch); - } - } -} + mbranch.push_back(map_branch); + } + }else if(det_id == 2){ // rf + for(Int_t j=0; jdetector_name.size(); j++){ + TString bname = mfile->detector_name[j]; + TCordferMapBranch *map_branch = new TCordferMapBranch(bname, det_id, mfile->segment_id[j].size()); + map_branch->SetMapInfo(mfile->segment_id[j], mfile->channel[j], mfile->det_id[j]); + + if(map_branch->size != 2){ + cout << "-- WARNING: RF map size is NOT 2" << endl; + } + TString brancharray; + //assume that detector_id of all channel of each branch is the same + if(map_branch->detector_flag[0] == 10){ + brancharray.Form("%s[%d][%d]/I", bname.Data(), map_branch->size, MAX_NHIT); + mtree->Branch(bname.Data(), map_branch->bra_val_two, brancharray); + }else{ + brancharray.Form("%s[%d]/I", bname.Data(), map_branch->size); + mtree->Branch(bname.Data(), map_branch->bra_val_one, brancharray); + } -void TCordferBranchManager::CreateCalibBranch(){ - YAML::Node map_setup = recipe["map_setup"].as(); - for(Int_t i=0; i(); - Int_t det_id = map_setup[i]["det_flag"].as(); + mbranch.push_back(map_branch); + } + + + }else if(det_id == 3){ // PPAC + for(Int_t j=0; jdetector_name.size(); j++){ + TString bname = mfile->detector_name[j]; + TCordferMapBranch *map_branch = new TCordferMapBranch(bname, det_id, mfile->segment_id[j].size()); + map_branch->SetMapInfo(mfile->segment_id[j], mfile->channel[j], mfile->det_id[j]); + + if(map_branch->size != 5){ + cout << "-- WARNING: PPAC map size is NOT 5" << endl; + } - //************** - if(det_id == 3){ continue; } //for PPAC - //************** - - //default (except of PPAC) - TString cname[2]; - cname[0] = map_setup[i]["calibfile"]["energy"].as(); - cname[1] = map_setup[i]["calibfile"]["timing"].as(); - - for(Int_t j=0; j<2; j++){ - FileStat_t info; - if(cname[j] == ""){ continue; } - else if(gSystem->GetPathInfo(cname[j].Data(), info) != 0){ - cerr << "WARNING: in yaml File, '" << cname[j].Data() << "' does not exist." << endl; - cerr << " not include " << cname[j].Data() << " in ctree" << endl; - continue; + TString brancharray; + + //assume that detector_id of all channel of each branch is the same + if(map_branch->detector_flag[0] == 10){ + brancharray.Form("%s[%d][%d]/I", bname.Data(), map_branch->size, MAX_NHIT); + mtree->Branch(bname.Data(), map_branch->bra_val_two, brancharray); + }else{ + brancharray.Form("%s[%d]/I", bname.Data(), map_branch->size); + mtree->Branch(bname.Data(), map_branch->bra_val_one, brancharray); + } + + mbranch.push_back(map_branch); } + }else if(det_id == 4){ // ssd + for(Int_t j=0; jdetector_name.size(); j++){ - CalibParamReader *cfile = new CalibParamReader(det_name, cname[j]); - for(Int_t k=0; kbranch_name.size(); k++){ - TString bname = cfile->branch_name[k]; - TCordferCalibBranch *calib_branch = new TCordferCalibBranch(bname, det_id); - calib_branch->CopyCalibInfo(cfile->dim, cfile->parameters[k]); + if(mfile->segment_id[j].size() != 2){ + cout << "-- ERROR: SSD map size is NOT 2" << endl; + exit(0); + } + + TString bname = mfile->detector_name[j]; + // ADC + TCordferMapBranch *map_branch_adc = new TCordferMapBranch(bname, det_id, 1); //size is 1 + map_branch_adc->SetADCMapInfo(mfile->segment_id[j], mfile->channel[j], mfile->det_id[j]); + + if(map_branch_adc->segment_id.size() != 1){ + cout << "-- ERROR: SSD of MapReader or TCordferMapBranch have errors" << endl; + cout << " : size is not 1 but " << map_branch_adc->segment_id.size() << endl; + exit(0); + } TString brancharray; - if(j==0){ - brancharray.Form("%s/D", bname.Data()); - ctree->Branch(bname.Data(), &calib_branch->cbra_val, brancharray); - calib_branch->adc = true; + brancharray.Form("%s/I", bname.Data()); + + mtree->Branch(bname.Data(), &map_branch_adc->bra_val, brancharray); + mbranch.push_back(map_branch_adc); + + // TDC + TString tdc_bname = "t_" + bname; + TCordferMapBranch *map_branch_tdc = new TCordferMapBranch(tdc_bname, det_id, 1); //size is 1 + map_branch_tdc->SetTDCMapInfo(mfile->segment_id[j], mfile->channel[j], mfile->det_id[j]); + + if(map_branch_tdc->segment_id.size() != 1){ + cout << "-- ERROR: SSD of MapReader or TCordferMapBranch have errors" << endl; + cout << " : size is not 1 but " << map_branch_adc->segment_id.size() << endl; + exit(0); + } + + TString brancharray_tdc; + + if(map_branch_tdc->detector_flag[0] == 10){ + brancharray_tdc.Form("%s[%d]/I", tdc_bname.Data(), MAX_NHIT); + mtree->Branch(tdc_bname.Data(), map_branch_tdc->bra_val_one, brancharray_tdc); }else{ - brancharray.Form("%s[12]/D", bname.Data()); - ctree->Branch(bname.Data(), calib_branch->cbra_tval, brancharray); - calib_branch->adc = false; + brancharray_tdc.Form("%s/I", tdc_bname.Data()); + mtree->Branch(tdc_bname.Data(), &map_branch_tdc->bra_val, brancharray_tdc); } - cbranch.push_back(calib_branch); + + mbranch.push_back(map_branch_tdc); + } - } - if(det_id == 5){ //for parameter reader of MUX position (mssd) - TString pos_name = map_setup[i]["calibfile"]["position"].as(); - FileStat_t info; - if(gSystem->GetPathInfo(pos_name.Data(), info) != 0){ - cerr << "ERROR: in yaml File, '" << pos_name.Data() << "' does not exist." << endl; - cerr << " mssd calibration requires " << pos_name.Data() << " !" << endl; - exit(0); + }else if(det_id == 5){ // dssd + for(Int_t j=0; jdetector_name.size(); j++){ + if(j%16 != 0) { continue; } + + if(mfile->segment_id[j].size() != 2){ + cout << "-- ERROR: DSSD map size is NOT 2" << endl; + exit(0); + } + + TString tmp = mfile->detector_name[j]; + TString bname = tmp.ReplaceAll("_1",""); + // ADC + TCordferMapBranch *map_branch_adc = new TCordferMapBranch(bname, det_id, 16); //size is 16 + map_branch_adc->SetDSSDMapInfo(mfile->segment_id[j][0], mfile->channel[j][0], mfile->det_id[j][0]); + + if(map_branch_adc->segment_id.size() != 16){ + cout << "-- ERROR: DSSD of MapReader or TCordferMapBranch have errors" << endl; + cout << " : size is not 16 but " << map_branch_adc->segment_id.size() << endl; + exit(0); + } + + TString brancharray; + brancharray.Form("%s[16]/I", bname.Data()); + + mtree->Branch(bname.Data(), map_branch_adc->bra_val_one, brancharray); + mbranch.push_back(map_branch_adc); + + // TDC + TString tdc_bname = "t_" + bname; + TCordferMapBranch *map_branch_tdc = new TCordferMapBranch(tdc_bname, det_id, 16); //size is 16 + map_branch_tdc->SetDSSDMapInfo(mfile->segment_id[j][1], mfile->channel[j][1], mfile->det_id[j][1]); + + if(map_branch_tdc->segment_id.size() != 16){ + cout << "-- ERROR: DSSD of MapReader or TCordferMapBranch have errors" << endl; + cout << " : size is not 16 but " << map_branch_adc->segment_id.size() << endl; + exit(0); + } + + TString brancharray_tdc; + + if(map_branch_tdc->detector_flag[0] == 10){ + brancharray_tdc.Form("%s[16][%d]/I", tdc_bname.Data(), MAX_NHIT); + mtree->Branch(tdc_bname.Data(), map_branch_tdc->bra_val_two, brancharray_tdc); + }else{ + brancharray_tdc.Form("%s[16]/I", tdc_bname.Data()); + mtree->Branch(tdc_bname.Data(), map_branch_tdc->bra_val_one, brancharray_tdc); + } + + mbranch.push_back(map_branch_tdc); + } + }else if(det_id == 6){ // mssd + for(Int_t j=0; jdetector_name.size(); j++){ + + if(mfile->segment_id[j].size() != 5){ + cout << "-- ERROR: MSSD map size is NOT 5" << endl; + exit(0); + } + + TString bname = mfile->detector_name[j]; + // ADC + TCordferMapBranch *map_branch_adc = new TCordferMapBranch(bname, det_id, 4); //size is 4 + map_branch_adc->SetADCMapInfo(mfile->segment_id[j], mfile->channel[j], mfile->det_id[j]); + + if(map_branch_adc->segment_id.size() != 4){ + cout << "-- ERROR: MapReader or TCordferMapBranch have errors" << endl; + exit(0); + } + + TString brancharray; + brancharray.Form("%s[%d]/I", bname.Data(), map_branch_adc->size); + + mtree->Branch(bname.Data(), map_branch_adc->bra_val_one, brancharray); + mbranch.push_back(map_branch_adc); + + // TDC + TString tdc_bname = "t_" + bname; + TCordferMapBranch *map_branch_tdc = new TCordferMapBranch(tdc_bname, det_id, 1); //size is 1 + map_branch_tdc->SetTDCMapInfo(mfile->segment_id[j], mfile->channel[j], mfile->det_id[j]); - CalibParamReader *cfile = new CalibParamReader(); - cfile->ReadMUXposCalib(pos_name); - mpos = cfile->position_prms; + if(map_branch_tdc->segment_id.size() != 1){ + cout << "-- ERROR: MapReader or TCordferMapBranch have errors" << endl; + exit(0); + } + + TString brancharray_tdc; + + if(map_branch_tdc->detector_flag[0] == 10){ + brancharray_tdc.Form("%s[%d]/I", tdc_bname.Data(), MAX_NHIT); + mtree->Branch(tdc_bname.Data(), map_branch_tdc->bra_val_one, brancharray_tdc); + }else{ + brancharray_tdc.Form("%s/I", tdc_bname.Data()); + mtree->Branch(tdc_bname.Data(), &map_branch_tdc->bra_val, brancharray_tdc); + } + + mbranch.push_back(map_branch_tdc); + + } + } } } + void TCordferBranchManager::CreateMapping(){ if(rawdata){ CreateRawMapping(); } if(mapdata){ CreateMapMapping(); } - if(calibration){ CreateCalibMapping(); } } @@ -244,148 +358,10 @@ void TCordferBranchManager::CreateMapMapping(){ } -void TCordferBranchManager::CreateCalibMapping(){ - Int_t m = sizeof(cmapping) / sizeof(cmapping[0]); - Int_t n = sizeof(cmapping[0]) / sizeof(cmapping[0][0]); - memset(cmapping, -1, sizeof(cmapping[0][0])*m*n); - - Int_t M = sizeof(muxmapping) / sizeof(muxmapping[0]); - Int_t N = sizeof(muxmapping[0]) / sizeof(muxmapping[0][0]); - memset(muxmapping, -1, sizeof(muxmapping[0][0])*M*N); - - Int_t coin_num = 0; - Int_t rf_num = 0; - Int_t mssd_num = 0; - Int_t mux_num = 0; - Int_t mux_t_num = 0; - - for(Int_t i=0; idetector_id == 1){ - Int_t coin_tmp = coin_num; - for(Int_t j=0; jdetector_id == 1){ - if(coin_tmp > 0){ - coin_tmp--; - continue; - }else{ - cbranch[i]->geo = mbranch[j]->segment_id[0]; - cbranch[i]->ch = mbranch[j]->channel[0]; - coin_num++; - break; - } - } - } - } - - //for rf data - if(cbranch[i]->detector_id == 2){ - Int_t rf_index; - for(Int_t j=0; jdetector_id == 2){ rf_index = j; } - } - if(rf_num == 0){ - cbranch[i]->geo = mbranch[rf_index]->segment_id[0]; - cbranch[i]->ch = mbranch[rf_index]->channel[0]; - rf_num++; - }else if(rf_num == 1){ - cbranch[i]->geo = mbranch[rf_index]->segment_id[1]; - cbranch[i]->ch = mbranch[rf_index]->channel[1]; - rf_num++; - }else{ - cout << "WARNING: format of mapfile of rf is differenet" << endl; - } - } - - //for ppac - //if(cbranch[i]->detector_id == 3){} - - - //for dssd, ssd data - if(cbranch[i]->detector_id == 4){ - continue; - } - //else{ - // bool tdc_flag = false; - // if(cbranch_name.substr(0, 2) == "t_"){ - // cbranch_name.erase(0, 2); - // tdc_flag = true; - // } - // for(Int_t j=0; jGetBranchName().Data()); - // if(cbranch_name == mbranch_name){ - // if(tdc_flag){ - // cbranch[i]->geo = mbranch[j]->segment_id[1]; - // cbranch[i]->ch = mbranch[j]->channel[1]; - // }else{ - // cbranch[i]->geo = mbranch[j]->segment_id[0]; - // cbranch[i]->ch = mbranch[j]->channel[0]; - // } - // } - // } - //} - - - //for mssd - if(cbranch[i]->detector_id == 5){ - if(cbranch[i]->adc == true){ - mssd_num++; - if(mssd_num%16 == 1){ - Int_t mux_id = mssd_num/16; - cbranch[i]->mpos1_prm = mpos[2*mux_id]; - cbranch[i]->mpos2_prm = mpos[2*mux_id + 1]; - - Int_t mux_tmp = mux_num; - for(Int_t j=0; jdetector_id == 5){ - if(mux_tmp > 0){ - mux_tmp--; - continue; - }else{ - //cout << cbranch[i]->GetBranchName() << " " << mbranch[j]->GetBranchName() << endl; - for(Int_t k=0; k<4; k++){ - cmapping[mbranch[j]->segment_id[k]][mbranch[j]->channel[k]] = i; - muxmapping[mbranch[j]->segment_id[k]][mbranch[j]->channel[k]] = k + 1; - } - mux_num++; - break; - } - } - } - } - }else if(cbranch[i]->adc == false){ - Int_t mux_t_tmp = mux_t_num; - for(Int_t j=0; jdetector_id == 5){ - if(mux_t_tmp > 0){ - mux_t_tmp--; - continue; - }else{ - //cout << cbranch[i]->GetBranchName() << " " << mbranch[j]->GetBranchName() << endl; - cmapping[mbranch[j]->segment_id[4]][mbranch[j]->channel[4]] = i; - - mux_t_num++; - break; - } - } - } - - } - continue; - } - - cmapping[cbranch[i]->geo][cbranch[i]->ch] = i; - - //cout << i << " " << cbranch_name << " " << seg << endl; - } -} - void TCordferBranchManager::GiveValue(Int_t geo, Int_t ch, Int_t val){ if(rawdata){ GiveRawValue(geo, ch, val); } if(mapdata){ GiveMapValue(geo, ch, val); } - if(calibration){ GiveCalibValue(geo, ch, val); } } @@ -395,16 +371,18 @@ void TCordferBranchManager::GiveRawValue(Int_t geo, Int_t ch, Int_t val){ //if not register segment if(index < 0){ if(rmapflag == false){ - cout << "WARNING: rmapping is not completed" << endl; + cout << "-- WARNING: rmapping is not completed" << endl; + cout << "-- : unregister segment_id is " << geo << endl; } rmapflag=true; return; } if(branch[index]->detector_id == 10){ - Int_t ht_id = branch[index+1]->bra_val[ch]; + Int_t ht_id = branch[index]->nhit[ch]; branch[index]->mhtdc_val[ch][ht_id] = val; - branch[index+1]->bra_val[ch] += 1; + branch[index]->nhit[ch]++; + }else{ branch[index]->bra_val[ch] = val; } @@ -425,45 +403,73 @@ void TCordferBranchManager::GiveMapValue(Int_t geo, Int_t ch, Int_t val){ Int_t i = index_array[0]; Int_t j = index_array[1]; - mbranch[i]->bra_val[j] = val; -} + Int_t det_id = mbranch[i]->detector_id; + Int_t det_flag = mbranch[i]->detector_flag[j]; + //1: coin 2: rf 3: PPAC 4: ssd 5: dssd 6: mssd - -void TCordferBranchManager::GiveCalibValue(Int_t geo, Int_t ch, Int_t val){ - Int_t index = cmapping[geo][ch]; - Int_t mux_id = muxmapping[geo][ch]; - if(index < 0){ - if(cmapflag == false){ - cout << "-- WARNING: cmapping is not completed" << endl; + if(det_id == 1){ // coin + if(det_flag == 10){ + mbranch[i]->bra_val_one[mbranch[i]->nhit[j]] = val; + mbranch[i]->nhit[j]++; + }else{ + mbranch[i]->bra_val = val; } - cmapflag=true; - return; } - - //calib_status - // 0->not mux, 1->first mux signal, other -> "val" buffer - Int_t calib_status = cbranch[index]->GetCalibStatus(val, mux_id); - if(calib_status == 1){ return; } - else if(calib_status == 0){ cbranch[index]->SetCalibValue(val); } - else{ - Int_t add_ch = cbranch[index]->GetAddBranchIndex(mux_id); // for MUX (default = 0) - if(add_ch == -1){ return; } - cbranch[index + add_ch]->SetCalibValue(calib_status); + else if(det_id == 2){ // rf + if(det_flag == 10){ + mbranch[i]->bra_val_two[j][mbranch[i]->nhit[j]] = val; + mbranch[i]->nhit[j]++; + }else{ + mbranch[i]->bra_val_one[j] = val; + } + } + else if(det_id == 3){ // PPAC + if(det_flag == 10){ + mbranch[i]->bra_val_two[j][mbranch[i]->nhit[j]] = val; + mbranch[i]->nhit[j]++; + }else{ + mbranch[i]->bra_val_one[j] = val; + } + } + else if(det_id == 4){ // ssd + if(det_flag == 10){ + mbranch[i]->bra_val_one[mbranch[i]->nhit[j]] = val; + mbranch[i]->nhit[j]++; + }else{ + mbranch[i]->bra_val = val; + } + } + else if(det_id == 5){ // dssd + if(det_flag == 10){ + mbranch[i]->bra_val_two[j][mbranch[i]->nhit[j]] = val; + mbranch[i]->nhit[j]++; + }else{ + mbranch[i]->bra_val_one[j] = val; + } + } + else if(det_id == 6){ // mssd + if(det_flag == 10){ + mbranch[i]->bra_val_one[mbranch[i]->nhit[j]] = val; + mbranch[i]->nhit[j]++; + }else if(det_flag == 7){ + mbranch[i]->bra_val = val; + }else{ + mbranch[i]->bra_val_one[j] = val; + } } } + void TCordferBranchManager::Fill(){ if(rawdata){ RawFill(); } if(mapdata){ MapFill(); } - if(calibration){ CalibFill(); } } void TCordferBranchManager::ClearAll(){ if(rawdata){ ClearRawAll(); } if(mapdata){ ClearMapAll(); } - if(calibration){ ClearCalibAll(); } } @@ -481,31 +487,14 @@ void TCordferBranchManager::ClearMapAll(){ } -void TCordferBranchManager::ClearCalibAll(){ - for(Int_t i=0; iClear(); - } -} - - void TCordferBranchManager::DataWrite(){ if(rawdata){ RawDataWrite(); } if(mapdata){ MapDataWrite(); } - if(calibration){ CalibDataWrite(); } } void TCordferBranchManager::FileClose(){ rootfile->Close(); - for(Int_t i=0; iFreeAll(); - } - - for(Int_t i=0; iFreeMemory(); - } - - //for cbranch } // for debug diff --git a/src/TCordferMapBranch.cpp b/src/TCordferMapBranch.cpp index 321becb2185d5cb27f54ff83303aaabf3492e00d..c72515494d19286c9e0027cd95cfd24aac26c7f0 100644 --- a/src/TCordferMapBranch.cpp +++ b/src/TCordferMapBranch.cpp @@ -9,14 +9,109 @@ using namespace std; -void TCordferMapBranch::SetMapInfo(vector seg, vector ch){ +void TCordferMapBranch::SetMapInfo(vector seg, vector ch, vector det){ copy(seg.begin(), seg.end(), back_inserter(segment_id)); copy(ch.begin(), ch.end(), back_inserter(channel)); + copy(det.begin(), det.end(), back_inserter(detector_flag)); } +void TCordferMapBranch::SetADCMapInfo(vector seg, vector ch, vector det){ + copy(seg.begin(), seg.end()-1, back_inserter(segment_id)); + copy(ch.begin(), ch.end()-1, back_inserter(channel)); + copy(det.begin(), det.end()-1, back_inserter(detector_flag)); +} + +void TCordferMapBranch::SetTDCMapInfo(vector seg, vector ch, vector det){ + copy(seg.end()-1, seg.end(), back_inserter(segment_id)); + copy(ch.end()-1, ch.end(), back_inserter(channel)); + copy(det.end()-1, det.end(), back_inserter(detector_flag)); +} + + +void TCordferMapBranch::SetDSSDMapInfo(Int_t seg, Int_t ch, Int_t det){ + for(Int_t i=0; i<16; i++){ + segment_id.push_back(seg); + channel.push_back(ch + i); + detector_flag.push_back(det); + } +} + + void TCordferMapBranch::Clear(){ //memset(bra_val, -500, sizeof(bra_val)); - for(Int_t j=0; j