From ee7d63bca1f741b67dbe155930bcc8358f469d7c Mon Sep 17 00:00:00 2001 From: Adrien Matta <matta@lpccaen.in2p3.fr> Date: Thu, 21 Feb 2019 17:16:15 +0100 Subject: [PATCH] *Progress on Mugast detector implementation --- NPLib/Core/NPDetectorManager.cxx | 4 +- NPLib/Detectors/Mugast/MugastMap.h | 813 ++++++++++++++++++++++ NPLib/Detectors/Mugast/TMugastData.cxx | 104 +-- NPLib/Detectors/Mugast/TMugastData.h | 88 ++- NPLib/Detectors/Mugast/TMugastPhysics.cxx | 156 ++++- NPLib/Detectors/Mugast/TMugastPhysics.h | 11 +- NPLib/Detectors/Mugast/TMugastSpectra.cxx | 4 +- NPLib/Detectors/Mugast/test.cxx | 50 ++ 8 files changed, 1156 insertions(+), 74 deletions(-) create mode 100644 NPLib/Detectors/Mugast/MugastMap.h create mode 100644 NPLib/Detectors/Mugast/test.cxx diff --git a/NPLib/Core/NPDetectorManager.cxx b/NPLib/Core/NPDetectorManager.cxx index 29c2fbc2a..6f6bbe9e5 100644 --- a/NPLib/Core/NPDetectorManager.cxx +++ b/NPLib/Core/NPDetectorManager.cxx @@ -472,8 +472,8 @@ void NPL::DetectorManager::SetSpectraServer(){ } // Avoid warning on gcc - int r; - r=system("nponline localhost 9092 & "); + // int r; + //r=system("nponline localhost 9092 & "); m_SpectraServer->CheckRequest(); } //////////////////////////////////////////////////////////////////////////////// diff --git a/NPLib/Detectors/Mugast/MugastMap.h b/NPLib/Detectors/Mugast/MugastMap.h new file mode 100644 index 000000000..e7bfc3798 --- /dev/null +++ b/NPLib/Detectors/Mugast/MugastMap.h @@ -0,0 +1,813 @@ +#ifndef MUGASTMAP +#define MUGASTMAP + + +namespace MUGAST_MAP{ + + const int TrapezeX[128] ={ + 55, + 50, + 57, + 52, + 61, + 54, + 59, + 56, + 53, + 58, + 51, + 60, + 49, + 62, + 63, + 48, + 45, + 46, + 43, + 44, + 41, + 42, + 39, + 40, + 37, + 38, + 35, + 36, + 33, + 34, + 64, + 47, + 31, + 32, + 29, + 30, + 27, + 28, + 25, + 26, + 23, + 24, + 21, + 22, + 19, + 20, + 17, + 18, + 10, + 15, + 8, + 13, + 6, + 11, + 4, + 9, + 2, + 7, + 12, + 5, + 14, + 3, + 16, + 1, + 125, + 126, + 123, + 124, + 121, + 122, + 119, + 120, + 117, + 118, + 115, + 116, + 113, + 114, + 111, + 112, + 109, + 110, + 107, + 108, + 105, + 106, + 103, + 104, + 101, + 102, + 99, + 100, + 97, + 98, + 128, + 127, + 95, + 96, + 93, + 94, + 91, + 92, + 89, + 90, + 87, + 88, + 85, + 86, + 83, + 84, + 81, + 82, + 79, + 80, + 77, + 78, + 75, + 76, + 73, + 74, + 71, + 72, + 69, + 70, + 67, + 68, + 65, + 66}; + + const int TrapezeY[128] ={ + 119, //1 + 121, //2 + 123, //3 + 117, //4 + 125, //5 + 115, //6 + 127, //7 + 113, //8 + 94, //9 + 111, //10 + 101, //11 + 109, //12 + 99, //13 + 107, //14 + 103, //15 + 105, //16 + 89, //17 + 93, //18 + 81, //19 + 85, //20 + 73, //21 + 77, //22 + 97, //23 + 71, //24 + 91, //25 + 95, //26 + 69, //27 + 87, //28 + 75, //29 + 83, //30 + 67, //31 + 65, //32 + 72, //33 + 79, //34 + 70, //35 + 68, //36 + 76, //37 + 66, //38 + 74, //39 + 82, //40 + 78, //41 + 80, //42 + 84, //43 + 96, //44 + 90, //45 + 86, //46 + 98, //47 + 88, //48 + 104, //49 + 92, //50 + 128, //51 + 100, //52 + 126, //53 + 102, //54 + 124, //55 + 106, //56 + 122, //57 + 108, //58 + 120, //59 + 110, //60 + 118, //61 + 112, //62 + 114, //63 + 116, //64 + 31, //65 + 41, //66 + 39, //67 + 29, //68 + 37, //69 + 27, //70 + 35, //71 + 25, //72 + 33, //73 + 23, //74 + 47, //75 + 21, //76 + 45, //77 + 19, //78 + 43, //79 + 15, //80 + 49, //81 + 13, //82 + 51, //83 + 11, //84 + 53, //85 + 9, //86 + 55, //87 + 7, //88 + 57, //89 + 5, //90 + 59, //91 + 3, //92 + 61, //93 + 1, //94 + 17, //95 + 63, //96 + 2, //97 + 34, //98 + 36, //99 + 4, //100 + 38, //101 + 6, //102 + 40, //103 + 8, //104 + 64, //105 + 10, //106 + 62, //107 + 12, //108 + 60, //109 + 14, //110 + 58, //111 + 16, //112 + 56, //113 + 18, //114 + 54, //115 + 20, //116 + 52, //117 + 22, //118 + 50, //119 + 24, //120 + 48, //121 + 26, //122 + 46, //123 + 28, //124 + 44, //125 + 30, //126 + 32, //127 + 42 //128 + }; + + const int SquareX[128] ={ + 18, //1 + 65, //2 + 19, //3 + 1, //4 + 20, //5 + 3, //6 + 21, //7 + 4, //8 + 22, //9 + 5, //10 + 23, //11 + 6, //12 + 24, //13 + 7, //14 + 25, //15 + 8, //16 + 26, //17 + 9, //18 + 27, //19 + 10, //20 + 28, //21 + 11, //22 + 29, //23 + 12, //24 + 30, //25 + 13, //26 + 31, //27 + 14, //28 + 32, //29 + 15, //30 + 33, //31 + 16, //32 + 34, //33 + 17, //34 + 35, //35 + 36, //36 + 51, //37 + 37, //38 + 52, //39 + 38, //40 + 53, //41 + 39, //42 + 54, //43 + 40, //44 + 55, //45 + 41, //46 + 56, //47 + 42, //48 + 57, //49 + 43, //50 + 58, //51 + 44, //52 + 59, //53 + 45, //54 + 60, //55 + 46, //56 + 61, //57 + 47, //58 + 62, //59 + 48, //60 + 63, //61 + 49, //62 + 64, //63 + 50, //64 + 66, //65 + 98, //66 + 67, //67 + 99, //68 + 68, //69 + 100, //70 + 69, //71 + 101, //72 + 70, //73 + 102, //74 + 71, //75 + 103, //76 + 72, //77 + 104, //78 + 73, //79 + 105, //80 + 74, //81 + 106, //82 + 75, //83 + 107, //84 + 76, //85 + 108, //86 + 77, //87 + 109, //88 + 78, //89 + 110, //90 + 79, //91 + 111, //92 + 80, //93 + 112, //94 + 81, //95 + 113, //96 + 82, //97 + 114, //98 + 83, //99 + 115, //100 + 84, //101 + 116, //102 + 85, //103 + 117, //104 + 86, //105 + 118, //106 + 87, //107 + 119, //108 + 88, //109 + 120, //110 + 89, //111 + 121, //112 + 90, //113 + 122, //114 + 91, //115 + 123, //116 + 92, //117 + 124, //118 + 93, //119 + 125, //120 + 94, //121 + 126, //122 + 95, //123 + 127, //124 + 96, //125 + 128, //126 + 97, //127 + 2 //128 not connected, strip 4 connected to 1 and 2 + }; + + const int SquareY[128] ={ + 97, //1 + 128, //2 + 127, //3 + 96, //4 + 126, //5 + 95, //6 + 125, //7 + 94, //8 + 124, //9 + 93, //10 + 123, //11 + 92, //12 + 122, //13 + 91, //14 + 121, //15 + 90, //16 + 120, //17 + 89, //18 + 2, //19 not connected strip 125 connected to 1 and 2 + 88, //20 + 119, //21 + 87, //22 + 118, //23 + 86, //24 + 117, //25 + 85, //26 + 116, //27 + 84, //28 + 115, //29 + 83, //30 + 82, //31 + 114, //32 + 81, //33 + 113, //34 + 112, //35 + 80, //36 + 111, //37 + 79, //38 + 110, //39 + 78, //40 + 109, //41 + 77, //42 + 108, //43 + 76, //44 + 107, //45 + 75, //46 + 106, //47 + 74, //48 + 105, //49 + 73, //50 + 104, //51 + 72, //52 + 103, //53 + 71, //54 + 102, //55 + 70, //56 + 101, //57 + 69, //58 + 100, //59 + 68, //60 + 99, //61 + 67, //62 + 66, //63 + 98, //64 + 65, //65 + 50, //66 + 49, //67 + 64, //68 + 48, //69 + 63, //70 + 47, //71 + 62, //72 + 46, //73 + 61, //74 + 45, //75 + 60, //76 + 44, //77 + 59, //78 + 43, //79 + 58, //80 + 42, //81 + 57, //82 + 41, //83 + 56, //84 + 40, //85 + 55, //86 + 39, //87 + 54, //88 + 38, //89 + 53, //90 + 37, //91 + 52, //92 + 36, //93 + 51, //94 + 35, //95 + 17, //96 + 34, //97 + 16, //98 + 15, //99 + 33, //100 + 14, //101 + 32, //102 + 13, //103 + 31, //104 + 12, //105 + 30, //106 + 11, //107 + 29, //108 + 10, //109 + 28, //110 + 9, //111 + 27, //112 + 8, //113 + 26, //114 + 7, //115 + 25, //116 + 6, //117 + 24, //118 + 5, //119 + 23, //120 + 4, //121 + 22, //122 + 3, //123 + 21, //124 + 1, //125 + 20, //126 + 19, //127 + 18 //128 + }; + + // internal mapping for S1 + /////////// + // THETA // + /////////// + // we still want to record any data coming from unconnected mates + // for (int i = 0; i < 64; i++) { + // real_channelTh[i+1] = 64 + i+1; + // } + + + const int AnnularX[128]{ + // unconnected strip // + 65,//1 + 66,//2 + 67,//3 + 68,//4 + 69,//5 + 70,//6 + 71,//7 + 72,//8 + 73,//9 + 74,//10 + 75,//11 + 76,//12 + 77,//13 + 78,//14 + 79,//15 + 80,//16 + 81,//17 + 82,//18 + 83,//19 + 84,//20 + 85,//21 + 86,//22 + 87,//23 + 88,//24 + 89,//25 + 90,//26 + 91,//27 + 92,//28 + 93,//29 + 94,//30 + 95,//31 + 96,//32 + 97,//33 + 98,//34 + 99,//35 + 100,//36 + 101,//37 + 102,//38 + 103,//39 + 104,//40 + 105,//41 + 106,//42 + 107,//43 + 108,//44 + 109,//45 + 110,//46 + 111,//47 + 112,//48 + 113,//49 + 114,//50 + 115,//51 + 116,//52 + 117,//53 + 118,//54 + 119,//55 + 120,//56 + 121,//57 + 122,//58 + 123,//59 + 124,//60 + 125,//61 + 126,//62 + 127,//63 + 128,//64 + // Connected strip + 1, // 65 + 2, // 66 + 4, // 67 + 3, // 68 + 6, // 69 + 5, // 70 + 8, // 71 + 7, // 72 + 10, // 73 + 9, // 74 + 12, // 75 + 11, // 76 + 14, // 77 + 13, // 78 + 16, // 79 + 15, // 80 + 18, // 81 + 17, // 82 + 20, // 83 + 19, // 84 + 22, // 85 + 21, // 86 + 24, // 87 + 23, // 88 + 26, // 89 + 25, // 90 + 28, // 91 + 27, // 92 + 30, // 93 + 29, // 94 + 31, // 95 + 32, // 96 + 64, // 97 + 63, // 98 + 62, // 99 + 61, // 100 + 60, // 101 + 59, // 102 + 58, // 103 + 57, // 104 + 56, // 105 + 55, // 106 + 54, // 107 + 53, // 108 + 52, // 109 + 51, // 110 + 49, // 112 + 50, // 111 + 48, // 113 + 47, // 114 + 46, // 115 + 45, // 116 + 44, // 117 + 43, // 118 + 42, // 119 + 41, // 120 + 40, // 121 + 39, // 122 + 38, // 123 + 37, // 124 + 36, // 125 + 35, // 126 + 34, // 127 + 33 // 128 + }; + + /////// + // PHI // + /////// + // we still want to record any data coming from unconnected mates + //16 wedges phi + const int AnnularY[128]={ + // only strip connected values // + 43,// 1 + 41,// 2 + 42,// 3 + 44,// 4 + 46,// 5 + 48,// 6 + 50,// 7 + 52,// 8 + 54,// 9 + 56,// 10 + 55,// 11 + 53,// 12 + 51,// 13 + 49,// 14 + 47,// 15 + 45,// 16 + // end of connected strip // + 81,//17 + 82,//18 + 83,//19 + 84,//20 + 85,//21 + 86,//22 + 87,//23 + 88,//24 + 89,//25 + 90,//26 + 91,//27 + 92,//28 + 93,//29 + 94,//30 + 95,//31 + 96,//32 + 97,//33 + 98,//34 + 99,//35 + 100,//36 + 101,//37 + 102,//38 + 103,//39 + 104,//40 + 105,//41 + 106,//42 + 107,//43 + 108,//44 + 109,//45 + 110,//46 + 111,//47 + 112,//48 + 113,//49 + 114,//50 + 115,//51 + 116,//52 + 117,//53 + 118,//54 + 119,//55 + 120,//56 + 121,//57 + 122,//58 + 123,//59 + 124,//60 + 125,//61 + 126,//62 + 127,//63 + 128,//64 + 1,//65 + 2,//66 + 3,//67 + 4,//68 + 5,//69 + 6,//70 + 7,//71 + 8,//72 + 9,//73 + 10,//74 + 11,//75 + 12,//76 + 13,//77 + 14,//78 + 15,//79 + 16,//80 + 17,//81 + 18,//82 + 19,//83 + 20,//84 + 21,//85 + 22,//86 + 23,//87 + 24,//88 + 25,//89 + 26,//90 + 27,//91 + 28,//92 + 29,//93 + 30,//94 + 31,//95 + 32,//96 + 33,//97 + 34,//98 + 35,//99 + 36,//100 + 37,//101 + 38,//102 + 39,//103 + 40,//104 + 57, //105 + 58, //106 + 59, //107 + 60, //108 + 61, //109 + 62, //110 + 63, //111 + 64, //112 + 65, //113 + 66, //114 + 67, //115 + 68, //116 + 69, //117 + 70, //118 + 71, //119 + 72, //120 + 73, //121 + 74, //122 + 75, //123 + 76, //124 + 77, //125 + 78, //126 + 79, //127 + 80//128 + }; + +} +#endif + diff --git a/NPLib/Detectors/Mugast/TMugastData.cxx b/NPLib/Detectors/Mugast/TMugastData.cxx index ac590ee5d..5ad743a5a 100644 --- a/NPLib/Detectors/Mugast/TMugastData.cxx +++ b/NPLib/Detectors/Mugast/TMugastData.cxx @@ -23,66 +23,76 @@ using namespace std; #include "TMugastData.h" - +#include "MugastMap.h" ClassImp(TMugastData) //////////////////////////////////////////////////////////////////////////////// TMugastData::TMugastData(){ + // Init the correspondace table + for(unsigned int i = 0 ; i < 128 ; i++){ + fMG_MapTrapezeX[i+1] = MUGAST_MAP::TrapezeX[i]; + fMG_MapTrapezeY[i+1] = MUGAST_MAP::TrapezeY[i]; + fMG_MapSquareX[i+1] = MUGAST_MAP::SquareX[i]; + fMG_MapSquareY[i+1] = MUGAST_MAP::SquareY[i]; + fMG_MapAnnularX[i+1] = MUGAST_MAP::AnnularX[i]; + fMG_MapAnnularY[i+1] = MUGAST_MAP::AnnularY[i]; + + } } //////////////////////////////////////////////////////////////////////////////// TMugastData::~TMugastData(){} //////////////////////////////////////////////////////////////////////////////// void TMugastData::Clear(){ - fMG_DSSDXE_DetectorNbr.clear(); - fMG_DSSDXE_StripNbr.clear(); - fMG_DSSDXE_Energy.clear(); - fMG_DSSDXT_DetectorNbr.clear(); - fMG_DSSDXT_StripNbr.clear(); - fMG_DSSDXT_Time.clear(); - fMG_DSSDYE_DetectorNbr.clear(); - fMG_DSSDYE_StripNbr.clear(); - fMG_DSSDYE_Energy.clear(); - fMG_DSSDYT_DetectorNbr.clear(); - fMG_DSSDYT_StripNbr.clear(); - fMG_DSSDYT_Time.clear(); - fMG_SecondLayerE_DetectorNbr.clear(); - fMG_SecondLayerE_StripNbr.clear(); - fMG_SecondLayerE_Energy.clear(); - fMG_SecondLayerT_DetectorNbr.clear(); - fMG_SecondLayerT_StripNbr.clear(); - fMG_SecondLayerT_Time.clear(); + fMG_DSSDXE_DetectorNbr.clear(); + fMG_DSSDXE_StripNbr.clear(); + fMG_DSSDXE_Energy.clear(); + fMG_DSSDXT_DetectorNbr.clear(); + fMG_DSSDXT_StripNbr.clear(); + fMG_DSSDXT_Time.clear(); + fMG_DSSDYE_DetectorNbr.clear(); + fMG_DSSDYE_StripNbr.clear(); + fMG_DSSDYE_Energy.clear(); + fMG_DSSDYT_DetectorNbr.clear(); + fMG_DSSDYT_StripNbr.clear(); + fMG_DSSDYT_Time.clear(); + fMG_SecondLayerE_DetectorNbr.clear(); + fMG_SecondLayerE_StripNbr.clear(); + fMG_SecondLayerE_Energy.clear(); + fMG_SecondLayerT_DetectorNbr.clear(); + fMG_SecondLayerT_StripNbr.clear(); + fMG_SecondLayerT_Time.clear(); } //////////////////////////////////////////////////////////////////////////////// void TMugastData::Dump() const { - cout << "XXXXXXXXXXXXXXXXXXXXXXXX Mugast Event XXXXXXXXXXXXXXXXX" << endl; + cout << "XXXXXXXXXXXXXXXXXXXXXXXX Mugast Event XXXXXXXXXXXXXXXXX" << endl; - cout << "// First Layer " << endl; - // (X,E) - cout << " DSSDXE_Mult = " << fMG_DSSDXE_DetectorNbr.size() << endl; - for (UShort_t i = 0; i < fMG_DSSDXE_DetectorNbr.size(); i++) - cout << " DetNbr: " << fMG_DSSDXE_DetectorNbr[i] << " DSSD: " << fMG_DSSDXE_StripNbr[i] << " Energy: " << fMG_DSSDXE_Energy[i] << endl; - // (X,T) - cout << " DSSDXT_Mult = " << fMG_DSSDXT_DetectorNbr.size() << endl; - for (UShort_t i = 0; i < fMG_DSSDXT_DetectorNbr.size(); i++) - cout << " DetNbr: " << fMG_DSSDXT_DetectorNbr[i] << " DSSD: " << fMG_DSSDXT_StripNbr[i] << " Time: " << fMG_DSSDXT_Time[i] << endl; - // (Y,E) - cout << " DSSDYE_Mult = " << fMG_DSSDYE_DetectorNbr.size() << endl; - for (UShort_t i = 0; i < fMG_DSSDYE_DetectorNbr.size(); i++) - cout << " DetNbr: " << fMG_DSSDYE_DetectorNbr[i] << " DSSD: " << fMG_DSSDYE_StripNbr[i] << " Energy: " << fMG_DSSDYE_Energy[i] << endl; - // (Y,T) - cout << " DSSDYT_Mult = " << fMG_DSSDYT_DetectorNbr.size() << endl; - for (UShort_t i = 0; i < fMG_DSSDYT_DetectorNbr.size(); i++) - cout << " DetNbr: " << fMG_DSSDYT_DetectorNbr[i] << " DSSD: " << fMG_DSSDYT_StripNbr[i] << " Time: " << fMG_DSSDYT_Time[i] << endl; + cout << "// First Layer " << endl; + // (X,E) + cout << " DSSDXE_Mult = " << fMG_DSSDXE_DetectorNbr.size() << endl; + for (UShort_t i = 0; i < fMG_DSSDXE_DetectorNbr.size(); i++) + cout << " DetNbr: " << fMG_DSSDXE_DetectorNbr[i] << " DSSD: " << fMG_DSSDXE_StripNbr[i] << " Energy: " << fMG_DSSDXE_Energy[i] << endl; + // (X,T) + cout << " DSSDXT_Mult = " << fMG_DSSDXT_DetectorNbr.size() << endl; + for (UShort_t i = 0; i < fMG_DSSDXT_DetectorNbr.size(); i++) + cout << " DetNbr: " << fMG_DSSDXT_DetectorNbr[i] << " DSSD: " << fMG_DSSDXT_StripNbr[i] << " Time: " << fMG_DSSDXT_Time[i] << endl; + // (Y,E) + cout << " DSSDYE_Mult = " << fMG_DSSDYE_DetectorNbr.size() << endl; + for (UShort_t i = 0; i < fMG_DSSDYE_DetectorNbr.size(); i++) + cout << " DetNbr: " << fMG_DSSDYE_DetectorNbr[i] << " DSSD: " << fMG_DSSDYE_StripNbr[i] << " Energy: " << fMG_DSSDYE_Energy[i] << endl; + // (Y,T) + cout << " DSSDYT_Mult = " << fMG_DSSDYT_DetectorNbr.size() << endl; + for (UShort_t i = 0; i < fMG_DSSDYT_DetectorNbr.size(); i++) + cout << " DetNbr: " << fMG_DSSDYT_DetectorNbr[i] << " DSSD: " << fMG_DSSDYT_StripNbr[i] << " Time: " << fMG_DSSDYT_Time[i] << endl; - // SecondLayer - // Energy - cout << "// Second Layer " << endl; - cout << " SecondLayerE_Mult = " << fMG_SecondLayerE_DetectorNbr.size() << endl; - for (UShort_t i = 0; i < fMG_SecondLayerE_DetectorNbr.size(); i++) - cout << " Det: " << fMG_SecondLayerE_DetectorNbr[i] << " DSSD: " << fMG_SecondLayerE_StripNbr[i] << " Energy: " << fMG_SecondLayerE_Energy[i] << endl; - // Time - cout << " SecondLayerT_Mult = " << fMG_SecondLayerT_DetectorNbr.size() << endl; - for (UShort_t i = 0; i < fMG_SecondLayerT_DetectorNbr.size(); i++) - cout << " Det: " << fMG_SecondLayerT_DetectorNbr[i] << " DSSD: " << fMG_SecondLayerT_StripNbr[i] << " Time: " << fMG_SecondLayerT_Time[i] << endl; + // SecondLayer + // Energy + cout << "// Second Layer " << endl; + cout << " SecondLayerE_Mult = " << fMG_SecondLayerE_DetectorNbr.size() << endl; + for (UShort_t i = 0; i < fMG_SecondLayerE_DetectorNbr.size(); i++) + cout << " Det: " << fMG_SecondLayerE_DetectorNbr[i] << " DSSD: " << fMG_SecondLayerE_StripNbr[i] << " Energy: " << fMG_SecondLayerE_Energy[i] << endl; + // Time + cout << " SecondLayerT_Mult = " << fMG_SecondLayerT_DetectorNbr.size() << endl; + for (UShort_t i = 0; i < fMG_SecondLayerT_DetectorNbr.size(); i++) + cout << " Det: " << fMG_SecondLayerT_DetectorNbr[i] << " DSSD: " << fMG_SecondLayerT_StripNbr[i] << " Time: " << fMG_SecondLayerT_Time[i] << endl; } diff --git a/NPLib/Detectors/Mugast/TMugastData.h b/NPLib/Detectors/Mugast/TMugastData.h index 05d1e2ebe..39aea243b 100644 --- a/NPLib/Detectors/Mugast/TMugastData.h +++ b/NPLib/Detectors/Mugast/TMugastData.h @@ -22,8 +22,19 @@ * * *****************************************************************************/ #include <vector> +#include <map> +#include <iostream> #include "TObject.h" + +// Type of detector to index the correct strip map +enum MG_DetectorType{ + MG_SQUARE, + MG_TRAPEZE, + MG_ANNULAR, + MG_NOCHANGE + }; + using namespace std ; class TMugastData : public TObject { private: @@ -58,6 +69,15 @@ class TMugastData : public TObject { vector<unsigned short> fMG_SecondLayerT_StripNbr; vector<double> fMG_SecondLayerT_Time; + private: + std::map<unsigned int, unsigned int> fMG_MapTrapezeX;//! + std::map<unsigned int, unsigned int> fMG_MapSquareX;//! + std::map<unsigned int, unsigned int> fMG_MapAnnularX;//! + std::map<unsigned int, unsigned int> fMG_MapTrapezeY;//! + std::map<unsigned int, unsigned int> fMG_MapSquareY;//! + std::map<unsigned int, unsigned int> fMG_MapAnnularY;//! + + public: TMugastData(); virtual ~TMugastData(); @@ -69,6 +89,21 @@ class TMugastData : public TObject { ///////////////////// SETTERS //////////////////////// // FirstLayer // (X,E) + public: + inline void SetDSSDXE(MG_DetectorType type,const unsigned short& DetNbr, const unsigned short& StripNbr, const double& Energy){ + static unsigned int newStrip; + newStrip = StripNbr; + if(type==MG_SQUARE) + newStrip=fMG_MapSquareX[StripNbr]; + else if(type==MG_TRAPEZE) + newStrip=fMG_MapTrapezeX[StripNbr]; + else if(type==MG_ANNULAR) + newStrip=fMG_MapAnnularX[StripNbr]; + + SetDSSDXE(DetNbr,newStrip,Energy); + + } + private: inline void SetDSSDXE(const unsigned short& DetNbr, const unsigned short& StripNbr, const double& Energy){ fMG_DSSDXE_DetectorNbr.push_back(DetNbr); fMG_DSSDXE_StripNbr.push_back(StripNbr); @@ -76,12 +111,44 @@ class TMugastData : public TObject { } // (X,T) + public: + inline void SetDSSDXT(MG_DetectorType type,const unsigned short& DetNbr, const unsigned short& StripNbr, const double& Time){ + static unsigned int newStrip; + + newStrip = StripNbr; + if(type==MG_SQUARE) + newStrip=fMG_MapSquareX[StripNbr]; + else if(type==MG_TRAPEZE) + newStrip=fMG_MapTrapezeX[StripNbr]; + else if(type==MG_ANNULAR) + newStrip=fMG_MapAnnularX[StripNbr]; + + SetDSSDXT(DetNbr,newStrip,Time); + } + + private: inline void SetDSSDXT(const unsigned short& DetNbr, const unsigned short& StripNbr, const double& Time){ fMG_DSSDXT_DetectorNbr.push_back(DetNbr); fMG_DSSDXT_StripNbr.push_back(StripNbr); fMG_DSSDXT_Time.push_back(Time); } // (Y,E) + public: + inline void SetDSSDYE(MG_DetectorType type,const unsigned short& DetNbr, const unsigned short& StripNbr, const double& Energy){ + static unsigned int newStrip; + + newStrip = StripNbr; + if(type==MG_SQUARE) + newStrip=fMG_MapSquareY[StripNbr]; + else if(type==MG_TRAPEZE) + newStrip=fMG_MapTrapezeY[StripNbr]; + else if(type==MG_ANNULAR) + newStrip=fMG_MapAnnularY[StripNbr]; + + SetDSSDYE(DetNbr,newStrip,Energy); + } + + private: inline void SetDSSDYE(const unsigned short& DetNbr, const unsigned short& StripNbr, const double& Energy){ fMG_DSSDYE_DetectorNbr.push_back(DetNbr); fMG_DSSDYE_StripNbr.push_back(StripNbr); @@ -89,12 +156,29 @@ class TMugastData : public TObject { } // (Y,T) + public: + inline void SetDSSDYT(MG_DetectorType type,const unsigned short& DetNbr, const unsigned short& StripNbr, const double& Time){ + static unsigned int newStrip; + + newStrip = StripNbr; + if(type==MG_SQUARE) + newStrip=fMG_MapSquareY[StripNbr]; + else if(type==MG_TRAPEZE) + newStrip=fMG_MapTrapezeY[StripNbr]; + else if(type==MG_ANNULAR) + newStrip=fMG_MapAnnularY[StripNbr]; + + SetDSSDYT(DetNbr,newStrip,Time); + } + + + private: inline void SetDSSDYT(const unsigned short& DetNbr, const unsigned short& StripNbr, const double& Time){ fMG_DSSDYT_DetectorNbr.push_back(DetNbr); fMG_DSSDYT_StripNbr.push_back(StripNbr); fMG_DSSDYT_Time.push_back(Time); } - + public: // Second Layer // E inline void SetSecondLayerE(const unsigned short& DetNbr, const unsigned short& StripNbr, const double& Energy){ @@ -110,7 +194,7 @@ class TMugastData : public TObject { fMG_SecondLayerT_Time.push_back(Time); } - +public: ///////////////////// GETTERS //////////////////////// // DSSD // (X,E) diff --git a/NPLib/Detectors/Mugast/TMugastPhysics.cxx b/NPLib/Detectors/Mugast/TMugastPhysics.cxx index e8da42af6..9eff408b8 100644 --- a/NPLib/Detectors/Mugast/TMugastPhysics.cxx +++ b/NPLib/Detectors/Mugast/TMugastPhysics.cxx @@ -19,7 +19,7 @@ * * *****************************************************************************/ #include "TMugastPhysics.h" -using namespace MUST2_LOCAL; +using namespace MUGAST_LOCAL; // STL #include <cmath> @@ -90,15 +90,17 @@ void TMugastPhysics::PreTreat() { m_EventData->GetDSSDXEStripNbr(i))) { double EX = fDSSD_X_E(m_EventData, i); if (EX > m_DSSD_X_E_Threshold) - m_PreTreatedData->SetDSSDXE(m_EventData->GetDSSDXEDetectorNbr(i), - m_EventData->GetDSSDXEStripNbr(i), EX); + m_PreTreatedData->SetDSSDXE(MG_NOCHANGE, + m_EventData->GetDSSDXEDetectorNbr(i), + m_EventData->GetDSSDXEStripNbr(i), EX); } } // T for (unsigned int i = 0; i < DSSDX_TMult; ++i) { if (IsValidChannel(0, m_EventData->GetDSSDXTDetectorNbr(i), m_EventData->GetDSSDXTStripNbr(i))) - m_PreTreatedData->SetDSSDXT(m_EventData->GetDSSDXTDetectorNbr(i), + m_PreTreatedData->SetDSSDXT(MG_NOCHANGE, +m_EventData->GetDSSDXTDetectorNbr(i), m_EventData->GetDSSDXTStripNbr(i), fDSSD_X_T(m_EventData, i)); } @@ -111,7 +113,8 @@ void TMugastPhysics::PreTreat() { m_EventData->GetDSSDYEStripNbr(i))) { double EY = fDSSD_Y_E(m_EventData, i); if (EY > m_DSSD_Y_E_Threshold) - m_PreTreatedData->SetDSSDYE(m_EventData->GetDSSDYEDetectorNbr(i), + m_PreTreatedData->SetDSSDYE(MG_NOCHANGE, +m_EventData->GetDSSDYEDetectorNbr(i), m_EventData->GetDSSDYEStripNbr(i), EY); } } @@ -120,7 +123,8 @@ void TMugastPhysics::PreTreat() { for (unsigned int i = 0; i < DSSDY_TMult; ++i) { if (IsValidChannel(1, m_EventData->GetDSSDYTDetectorNbr(i), m_EventData->GetDSSDYTStripNbr(i))) - m_PreTreatedData->SetDSSDYT(m_EventData->GetDSSDYTDetectorNbr(i), + m_PreTreatedData->SetDSSDYT(MG_NOCHANGE, +m_EventData->GetDSSDYTDetectorNbr(i), m_EventData->GetDSSDYTStripNbr(i), fDSSD_Y_T(m_EventData, i)); } @@ -459,12 +463,23 @@ void TMugastPhysics::ReadConfiguration(NPL::InputParser parser) { = {"DetectorNumber","X1_Y1", "X1_Y128", "X128_Y1", "X128_Y128"}; // Spherical Case vector<string> sphe = {"DetectorNumber","R", "THETA", "PHI", "BETA"}; + // Annular Case + vector<string> annular = {"DetectorNumber","Center"}; + string Type; for (unsigned int i = 0; i < blocks.size(); i++) { + if (blocks[i]->HasTokenList(cart)) { if (NPOptionManager::getInstance()->GetVerboseLevel()) - cout << endl << "//// Mugast Telescope " << i + 1 << endl; + + Type = blocks[i]->GetMainValue(); + cout << endl << "//// Mugast Telescope " << Type << " " << i + 1 << endl; + int detectorNbr = blocks[i]->GetInt("DetectorNumber"); + if(Type=="Square") DetectorType[detectorNbr]=MG_SQUARE; + else if(Type=="Trapezoid") DetectorType[detectorNbr]=MG_TRAPEZE; + else if(Type=="Annular") DetectorType[detectorNbr]=MG_ANNULAR; + det = i+1; m_DetectorNumberIndex[detectorNbr]=det; TVector3 A = blocks[i]->GetTVector3("X1_Y1", "mm"); @@ -473,11 +488,36 @@ void TMugastPhysics::ReadConfiguration(NPL::InputParser parser) { TVector3 D = blocks[i]->GetTVector3("X128_Y128", "mm"); AddTelescope(A, B, C, D); } + + else if (blocks[i]->HasTokenList(annular)) { + if (NPOptionManager::getInstance()->GetVerboseLevel()) + Type = blocks[i]->GetMainValue(); + cout << endl << "//// Mugast Telescope " << Type << " " << i + 1 << endl; + int detectorNbr = blocks[i]->GetInt("DetectorNumber"); + if(Type=="Square") DetectorType[detectorNbr]=MG_SQUARE; + else if(Type=="Trapezoid") DetectorType[detectorNbr]=MG_TRAPEZE; + else if(Type=="Annular") DetectorType[detectorNbr]=MG_ANNULAR; + if(Type!="Annular"){ + cout << "ERROR: Using Mugast Annular Token for Square or Trapezoid detector " << endl; + exit(1); + } + + det = i+1; + m_DetectorNumberIndex[detectorNbr]=det; + TVector3 Center = blocks[i]->GetTVector3("Center", "mm"); + AddTelescope(Center); + } + else if (blocks[i]->HasTokenList(sphe)) { if (NPOptionManager::getInstance()->GetVerboseLevel()) - cout << endl << "//// Mugast Telescope " << i + 1 << endl; + Type = blocks[i]->GetMainValue(); + cout << endl << "//// Mugast Telescope " << Type << " " << i + 1 << endl; int detectorNbr = blocks[i]->GetInt("DetectorNumber"); + if(Type=="Square") DetectorType[detectorNbr]=MG_SQUARE; + else if(Type=="Trapezoid") DetectorType[detectorNbr]=MG_TRAPEZE; + else if(Type=="Annular") DetectorType[detectorNbr]=MG_ANNULAR; + det = i+1; m_DetectorNumberIndex[detectorNbr]=det; double Theta = blocks[i]->GetDouble("THETA", "deg"); @@ -496,6 +536,13 @@ void TMugastPhysics::ReadConfiguration(NPL::InputParser parser) { } InitializeStandardParameter(); + // Create a file to be read by Ganil2Root telling which detector + // is which shape + std::ofstream shapeFile(".MugastShape"); + for(auto& it:DetectorType){ + shapeFile << it.first << " " << it.second << endl; + } + shapeFile.close(); //ReadAnalysisConfig(); } ////////////////////////////////////////////////////////////////////////// @@ -701,6 +748,85 @@ void TMugastPhysics::InitializeStandardParameter() { return; } + +void TMugastPhysics::AddTelescope(TVector3 C_Center) { + // To avoid warning + m_NumberOfTelescope++; + double Z = C_Center.Z(); + + double R_Min = 24; + double R_Max = 48; + + double Phi_Min = 0 ; + double Phi_Max = 360; + + int NumberOfQuadrant = 4 ; + int NumberofRing = 16 ; //Per Quadrant + int NumberofSector = 16 ; //Per detector, ( 4 in each Quad) + + double StripPitchSector = (Phi_Max-Phi_Min)/(NumberofSector) ; //radial strip spacing in rad + double StripPitchRing = (R_Max-R_Min)/NumberofRing ; // ring strip spacing in mm + + double Phi_0 = (8)*StripPitchSector; //Phi Offset: 1st sector starts at 180 degrees and ends at 180-22.5 degrees in the lab frame, numbering goes clockwise + TVector3 Strip_1_1=TVector3(0,0,Z); + TVector3 StripCenter = Strip_1_1; + + // Buffer object to fill Position Array + vector<double> lineX ; vector<double> lineY ; vector<double> lineZ ; + vector< vector< double > > OneStripPositionX ; + vector< vector< double > > OneStripPositionY ; + vector< vector< double > > OneStripPositionZ ; + + /* The logic behind the strip numbering of S1 in NPTOOL: + The number of rings goes from 1->64, the number of sectors goes from 1->16 + (4 per quadrant). There's a redundancy in the fact that 1->64 already contain + the information about the quadrant and the majority of these positions are + indeed not physical. Example: + A hit combining Ring 17 (first ring in Quadrant 2) and + Sector 4 (last sector in Quadrant 1) is not possible due to physical mismatch + of the detector frontside-backside layout. + The possible (allowed hits) are R(1-16)S(1-4), R(17-32)S(5-8), R(33-49)S(9-12), + R(50-64)S(13-16). + The three loops however takes all the possible combintation that an analysis + can produce. This works perfectly for cases where the detector does not have + "Quadrants", e.g. S3 type. For the S1 an extra condition is added to flag the + non physical hit combinations. + */ + for(int iQuad = 0 ; iQuad < NumberOfQuadrant ; iQuad++){ + for(int iRing = 0 ; iRing < NumberofRing; iRing++){ + lineX.clear() ; + lineY.clear() ; + lineZ.clear() ; + for(int iSector = 0 ; iSector < NumberofSector ; iSector++){ + //Build vector + StripCenter = Strip_1_1; + StripCenter = TVector3(R_Min+(iRing+0.5)*StripPitchRing,0, Z); + StripCenter.RotateZ( ( Phi_0 - (iSector+0.5)*StripPitchSector ) *M_PI/180.); + + // if the hit is not "allowed" (see comment above) use a default value + if ( (iRing+(iQuad*NumberofRing))/NumberofSector != (iSector/NumberOfQuadrant) ) + StripCenter.SetXYZ(-100,-100, Z-100); + + lineX.push_back( StripCenter.X() );// these vectors will contain 16x4 = 64 elements + lineY.push_back( StripCenter.Y() ); + lineZ.push_back( StripCenter.Z() ); + } + + OneStripPositionX.push_back(lineX); + OneStripPositionY.push_back(lineY); + OneStripPositionZ.push_back(lineZ); + + } + } + m_StripPositionX.push_back( OneStripPositionX ) ; + m_StripPositionY.push_back( OneStripPositionY ) ; + m_StripPositionZ.push_back( OneStripPositionZ ) ; + + return; + +} + + void TMugastPhysics::AddTelescope(double theta, double phi, double distance, double beta_u, double beta_v, double beta_w) { @@ -820,12 +946,12 @@ TVector3 TMugastPhysics::GetTelescopeNormal(const int i) { } /////////////////////////////////////////////////////////////////////////// -namespace MUST2_LOCAL { +namespace MUGAST_LOCAL { // DSSD // X double fDSSD_X_E(const TMugastData* m_EventData, const int& i) { static string name; - name = "MUST2/T"; + name = "Mugast/T"; name += NPL::itoa(m_EventData->GetDSSDXEDetectorNbr(i)); name += "_DSSD_X"; name += NPL::itoa(m_EventData->GetDSSDXEStripNbr(i)); @@ -836,7 +962,7 @@ namespace MUST2_LOCAL { double fDSSD_X_T(const TMugastData* m_EventData, const int& i) { static string name; - name = "MUST2/T"; + name = "Mugast/T"; name += NPL::itoa(m_EventData->GetDSSDXTDetectorNbr(i)); name += "_DSSD_X"; name += NPL::itoa(m_EventData->GetDSSDXTStripNbr(i)); @@ -848,7 +974,7 @@ namespace MUST2_LOCAL { // Y double fDSSD_Y_E(const TMugastData* m_EventData, const int& i) { static string name; - name = "MUST2/T"; + name = "Mugast/T"; name += NPL::itoa(m_EventData->GetDSSDYEDetectorNbr(i)); name += "_DSSD_Y"; name += NPL::itoa(m_EventData->GetDSSDYEStripNbr(i)); @@ -859,7 +985,7 @@ namespace MUST2_LOCAL { double fDSSD_Y_T(const TMugastData* m_EventData, const int& i) { static string name; - name = "MUST2/T"; + name = "Mugast/T"; name += NPL::itoa(m_EventData->GetDSSDYTDetectorNbr(i)); name += "_DSSD_Y"; name += NPL::itoa(m_EventData->GetDSSDYTStripNbr(i)); @@ -871,7 +997,7 @@ namespace MUST2_LOCAL { // SecondLayer double fSecondLayer_E(const TMugastData* m_EventData, const int& i) { static string name; - name = "MUST2/T"; + name = "Mugast/T"; name += NPL::itoa(m_EventData->GetSecondLayerEDetectorNbr(i)); name += "_SecondLayer"; name += NPL::itoa(m_EventData->GetSecondLayerEStripNbr(i)); @@ -882,7 +1008,7 @@ namespace MUST2_LOCAL { double fSecondLayer_T(const TMugastData* m_EventData, const int& i) { static string name; - name = "MUST2/T"; + name = "Mugast/T"; name += NPL::itoa(m_EventData->GetSecondLayerTDetectorNbr(i)); name += "_SecondLayer"; name += NPL::itoa(m_EventData->GetSecondLayerTStripNbr(i)); diff --git a/NPLib/Detectors/Mugast/TMugastPhysics.h b/NPLib/Detectors/Mugast/TMugastPhysics.h index 7204d0aed..4b13bc25d 100644 --- a/NPLib/Detectors/Mugast/TMugastPhysics.h +++ b/NPLib/Detectors/Mugast/TMugastPhysics.h @@ -66,7 +66,7 @@ class TMugastPhysics : public TObject, public NPL::VDetector { // Telescope vector<int> TelescopeNumber; - + map<int,MG_DetectorType> DetectorType; // DSSD vector<double> DSSD_E; vector<double> DSSD_T; @@ -135,7 +135,7 @@ class TMugastPhysics : public TObject, public NPL::VDetector { // Used for Online only, clear all the spectra hold by the Spectra class void ClearSpectra(); - public: // Specific to MUST2 Array + public: // Specific to MUGAST Array // Clear The PreTeated object void ClearPreTreatedData() { m_PreTreatedData->Clear(); } @@ -163,9 +163,8 @@ class TMugastPhysics : public TObject, public NPL::VDetector { void AddTelescope(double theta, double phi, double distance, double beta_u, double beta_v, double beta_w); - // Use for reading Calibration Run, very simple methods; only apply - // calibration, no condition - void ReadCalibrationRun(); + // Special Method for Annular S1 + void AddTelescope(TVector3 C_Center); // Give and external TMustData object to TMugastPhysics. Needed for online // analysis for example. @@ -256,7 +255,7 @@ class TMugastPhysics : public TObject, public NPL::VDetector { ClassDef(TMugastPhysics, 1) // MugastPhysics structure }; -namespace MUST2_LOCAL { +namespace MUGAST_LOCAL { // DSSD // X double fDSSD_X_E(const TMugastData* Data, const int& i); diff --git a/NPLib/Detectors/Mugast/TMugastSpectra.cxx b/NPLib/Detectors/Mugast/TMugastSpectra.cxx index 78ea38e40..eb06f82ad 100644 --- a/NPLib/Detectors/Mugast/TMugastSpectra.cxx +++ b/NPLib/Detectors/Mugast/TMugastSpectra.cxx @@ -116,11 +116,11 @@ void TMugastSpectra::InitPreTreatedSpectra() for (unsigned int i = 0; i < fNumberOfTelescope; i++) { // loop on number of detectors // STRX_E_CAL name = "MG"+NPL::itoa(fTelescopeToIndex[i])+"_STRX_E_CAL"; - AddHisto2D(name, name, fStripX, 1, fStripX+1, 500, 0, 50, "Mugast/CAL/STRXE"); + AddHisto2D(name, name, fStripX, 1, fStripX+1, 10000, 0, 50, "Mugast/CAL/STRXE"); // STRY_E_CAL name = "MG"+NPL::itoa(fTelescopeToIndex[i])+"_STRY_E_CAL"; - AddHisto2D(name, name, fStripY, 1, fStripY+1, 500, 0, 50, "Mugast/CAL/STRYE"); + AddHisto2D(name, name, fStripY, 1, fStripY+1, 10000, 0, 50, "Mugast/CAL/STRYE"); // STRX_T_CAL name = "MG"+NPL::itoa(fTelescopeToIndex[i])+"_STRX_T_CAL"; diff --git a/NPLib/Detectors/Mugast/test.cxx b/NPLib/Detectors/Mugast/test.cxx new file mode 100644 index 000000000..0f317fb0e --- /dev/null +++ b/NPLib/Detectors/Mugast/test.cxx @@ -0,0 +1,50 @@ +#include "MugastMap.h" + + + +//////////////////////////////////////////////////////////////////////////////// +void Check(const int* array){ + // Test Trap X + set<unsigned int> Strip; + unsigned int count=0; + bool checkStrip = true; + for(unsigned int i = 0 ; i < 128 ; i++){ + // Check that the value does not exist + if(Strip.find(array[i])==Strip.end()) + Strip.insert(array[i]); + else{ + cout << "Strip duplicate value : " << array[i] << " count:" << count++ << endl; + checkStrip=false; + } + if(array[i]>128 || array[i]<1){ + cout << "Strip value " << array[i] << " out of bound" << endl; + checkStrip=false; + } + } + if(checkStrip&&Strip.size()==128) + cout << "Strip : No error found " << endl; + else + cout << "Strip : Error, size: " << Strip.size() << endl; +} +//////////////////////////////////////////////////////////////////////////////// +void test(){ + + cout << "// Test TrapX //" << endl; + Check(MUGAST_MAP::TrapezeX); + cout << "// Test TrapY //" << endl; + Check(MUGAST_MAP::TrapezeY); + cout << "// Test SquareX //" << endl; + Check(MUGAST_MAP::SquareX); + cout << "// Test SquareY //" << endl; + Check(MUGAST_MAP::SquareY); + cout << "// Test AnnularX //" << endl; + Check(MUGAST_MAP::AnnularX); + cout << "// Test AnnularY //" << endl; + Check(MUGAST_MAP::AnnularY); + + + + + } + + -- GitLab