Commit a0d67fc6 authored by LAVIRON Adrien's avatar LAVIRON Adrien
Browse files

Added forgotten { in NPDetectorManager l.277 (prevented compilation without...

Added forgotten { in NPDetectorManager l.277 (prevented compilation without support for multitheading)
Minor modifications to TComptonTelescopePhysics
Added clarity to ComptonTelescope project with preprocessor commands for different runs and a calibration functionnality
parent 751735bd
Pipeline #127525 passed with stages
in 7 minutes and 29 seconds
...@@ -268,7 +268,7 @@ void NPL::DetectorManager::BuildPhysicalEvent(){ ...@@ -268,7 +268,7 @@ void NPL::DetectorManager::BuildPhysicalEvent(){
(it->second->*m_ClearEventPhysicsPtr)(); (it->second->*m_ClearEventPhysicsPtr)();
(it->second->*m_BuildPhysicalPtr)(); (it->second->*m_BuildPhysicalPtr)();
(it->second->*m_FillSpectra)(); (it->second->*m_FillSpectra)();
if(m_CheckSpectra) if(m_CheckSpectra) {
(it->second->*m_CheckSpectra)(); (it->second->*m_CheckSpectra)();
} }
} }
......
...@@ -57,18 +57,18 @@ class TComptonTelescopePhysics : public TObject, public NPL::VDetector ...@@ -57,18 +57,18 @@ class TComptonTelescopePhysics : public TObject, public NPL::VDetector
// DSSD // DSSD
int EventMultiplicity; int EventMultiplicity;
vector<int> EventType; vector<int> EventType;
//vector<int> TowerNumber; vector<int> TowerNumber;//
vector<int> DetectorNumber; vector<int> DetectorNumber;
vector<int> Strip_Front; vector<int> Strip_Front;
vector<int> Strip_Back; vector<int> Strip_Back;
//vector<double> Strip_E; vector<double> Strip_E;//
vector<double> Strip_T; vector<double> Strip_T;
vector<double> Front_Energy; vector<double> Front_Energy;
vector<double> Back_Energy; vector<double> Back_Energy;
//vector<double> Half_Energy; vector<double> Half_Energy;//
vector<double> Front_Time; vector<double> Front_Time;
vector<double> Back_Time; vector<double> Back_Time;
//vector<bool> Same_FBTime; vector<bool> Same_FBTime;//
// Calorimeter // Calorimeter
vector<double> Calor_E; vector<double> Calor_E;
vector<double> Calor_T; vector<double> Calor_T;
...@@ -240,8 +240,8 @@ class TComptonTelescopePhysics : public TObject, public NPL::VDetector ...@@ -240,8 +240,8 @@ class TComptonTelescopePhysics : public TObject, public NPL::VDetector
Int_t m_CounterEvt[50]; //! Int_t m_CounterEvt[50]; //!
Int_t m_CounterHit[50]; //! Int_t m_CounterHit[50]; //!
// physical events // physical events
vector<int> TowerNumber; //vector<int> TowerNumber;
vector<double> Half_Energy; //vector<double> Half_Energy;
//vector<bool> Same_FBTime; //vector<bool> Same_FBTime;
}; };
......
...@@ -100,7 +100,7 @@ __EVENTTYPE__* DecodeD::getEvent() ...@@ -100,7 +100,7 @@ __EVENTTYPE__* DecodeD::getEvent()
void DecodeD::decodeEvent() void DecodeD::decodeEvent()
{ {
this -> Clear(); /*this -> */Clear();
switch (datatype) { switch (datatype) {
case D_ROOT: case D_ROOT:
if (cursor < length) { if (cursor < length) {
......
...@@ -16,6 +16,10 @@ ...@@ -16,6 +16,10 @@
#include "DecodeD.h" #include "DecodeD.h"
#include "DecodeT.h" #include "DecodeT.h"
#define __RUN__ 3
#define __1DET__
#define __TEST_ZONE__ #define __TEST_ZONE__
#undef __TEST_ZONE__ #undef __TEST_ZONE__
...@@ -105,15 +109,47 @@ int main(int argc, char** argv) ...@@ -105,15 +109,47 @@ int main(int argc, char** argv)
auto ccamPhys = (TComptonTelescopePhysics*) m_NPDetectorManager->GetDetector("ComptonTelescope"); auto ccamPhys = (TComptonTelescopePhysics*) m_NPDetectorManager->GetDetector("ComptonTelescope");
ccamPhys->SetRawDataPointer(ccamData); ccamPhys->SetRawDataPointer(ccamData);
#ifdef __1DET__
ifstream is;
is.open("/disk/proto-data/data/20210510_Bi207/mfm_rdd_rosmap_04_mfm_rosmap_04_2021-05-10_07_41_50.raw");
is.seekg(0, ios::end);
int len = is.tellg();
is.seekg(0, ios::beg);
char* buff = new char[len];
is.read(buff, len);
is.close();
DecodeR* DR = new DecodeR(false, buff);
while(DR -> getCursor() < len) {
DR -> decodeBlobMFM();
m_NPDetectorManager->ClearEventPhysics();
m_NPDetectorManager->ClearEventData();
ccamData -> SetCTCalorimeter(1, 4, DR->getPixelNumber(), DR->getTime(), DR->getData(), 64);
m_NPDetectorManager->BuildPhysicalEvent();
m_OutputTree->Fill();
m_NPDetectorManager->CheckSpectraServer();
}
delete DR;
delete [] buff;
m_NPDetectorManager -> WriteSpectra();
#else
// read data file/flux and fill ccamData object // read data file/flux and fill ccamData object
std::cout << "Reading data\n"; std::cout << "Reading data\n";
DecodeR* DR = new DecodeR(false); // Instantiates DecodeR object reading calorimeter data flux DecodeR* DR = new DecodeR(false); // Instantiates DecodeR object reading calorimeter data flux
DecodeT* DT = new DecodeT(false); // Instantiates DecodeT object reading trigger data flux DecodeT* DT = new DecodeT(false); // Instantiates DecodeT object reading trigger data flux
DecodeD* DD = new DecodeD(false); // Instantiates DecodeD object reading DSSSD(s) data flux DecodeD* DD = new DecodeD(false); // Instantiates DecodeD object reading DSSSD(s) data flux
// newframe_t* event; // newframe_t* event;
//DD -> setTree("/disk/proto-data/data/20210304_run2/bb7_3309-7_cs137_20210304_14h35_conv.root"); #if __RUN__ == 0
DD -> setTree("../data/20210210_run1/bb7_3309-7_cs137-20210210_11h05_coinc_run1_conv.root");
#elif __RUN__ == 1
DD -> setTree("/disk/proto-data/data/20210210_run1/bb7_3309-7_cs137-20210210_11h05_coinc_run1_conv.root");
#elif __RUN__ == 2
DD -> setTree("/disk/proto-data/data/20210304_run2/bb7_3309-7_cs137_20210304_14h35_conv.root");
#elif __RUN__ == 3
DD -> setTree("/disk/proto-data/data/20210305_run3/bb7_3309-7_cs137_20210305_14h53_conv.root"); DD -> setTree("/disk/proto-data/data/20210305_run3/bb7_3309-7_cs137_20210305_14h53_conv.root");
//DD -> setTree("../data/20210210_run1/bb7_3309-7_cs137-20210210_11h05_coinc_run1_conv.root"); #elif __RUN__ == 4
DD -> setTree("/disk/proto-data/data/20210407_run4/bb7_3309-7_cs137_20210407_14h53_conv.root");
#endif
int dlen = DD -> getLength(); int dlen = DD -> getLength();
int i = 0;// ROSMAP files loop counter int i = 0;// ROSMAP files loop counter
...@@ -126,8 +162,16 @@ int main(int argc, char** argv) ...@@ -126,8 +162,16 @@ int main(int argc, char** argv)
ifstream iros, itrig; ifstream iros, itrig;
cout << "Loading data files " << std::flush; cout << "Loading data files " << std::flush;
#if __RUN__ == 0
itrig.open("../data/20210210_run1/mfm_trigger_202102101104.raw", ios::binary);
#elif __RUN__ == 1
itrig.open("/disk/proto-data/data/20210210_run1/mfm_trigger_202102101104.raw", ios::binary);
#elif __RUN__ == 2
#elif __RUN__ == 3
itrig.open("/disk/proto-data/data/20210305_run3/mfm_trigger_20210305_run3.raw", ios::binary); itrig.open("/disk/proto-data/data/20210305_run3/mfm_trigger_20210305_run3.raw", ios::binary);
//itrig.open("../data/20210210_run1/mfm_trigger_202102101104.raw", ios::binary); #elif __RUN__ == 4
itrig.open("/disk/proto-data/data/20210407_run4/mfm_trigger_20210407_run4.raw", ios::binary);
#endif
itrig.seekg(0, ios::end); itrig.seekg(0, ios::end);
int tlen = itrig.tellg(); int tlen = itrig.tellg();
itrig.seekg(0, ios::beg); itrig.seekg(0, ios::beg);
...@@ -136,8 +180,16 @@ int main(int argc, char** argv) ...@@ -136,8 +180,16 @@ int main(int argc, char** argv)
itrig.close(); itrig.close();
cout << "... " << std::flush; cout << "... " << std::flush;
#if __RUN__ == 0
iros.open("../data/20210210_run1/mfm_rdd_rosmap_04_mfm_rosmap_04_2021-02-10_10_04_59.raw.0001", ios::binary);
#elif __RUN__ == 1
iros.open("/disk/proto-data/data/20210210_run1/mfm_rdd_rosmap_04_mfm_rosmap_04_2021-02-10_10_04_59.raw.0001", ios::binary);
#elif __RUN__ == 2
#elif __RUN__ == 3
iros.open("/disk/proto-data/data/20210305_run3/mfm_rosmap_20210305_run3.raw", ios::binary); iros.open("/disk/proto-data/data/20210305_run3/mfm_rosmap_20210305_run3.raw", ios::binary);
//iros.open("../data/20210210_run1/mfm_rdd_rosmap_04_mfm_rosmap_04_2021-02-10_10_04_59.raw.0001", ios::binary); #elif __RUN__ == 4
iros.open("/disk/proto-data/data/20210407_run4/mfm_rosmap_20210407_run4.raw", ios::binary);
#endif
iros.seekg(0, ios::end); iros.seekg(0, ios::end);
int rlen = iros.tellg(); int rlen = iros.tellg();
iros.seekg(0, ios::beg); iros.seekg(0, ios::beg);
...@@ -157,6 +209,22 @@ int main(int argc, char** argv) ...@@ -157,6 +209,22 @@ int main(int argc, char** argv)
resetCount = DT->getResetCount() - resetCount; resetCount = DT->getResetCount() - resetCount;
resetCount = -resetCount; // T B C !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! resetCount = -resetCount; // T B C !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
cout << "Found reset count: " << resetCount << endl; cout << "Found reset count: " << resetCount << endl;
if (resetCount == 0) {
string ans;
cout << "reset count is 0. Continue ? y/[n]";
cin >> ans;
if (ans != "y" and ans != "Y") {
DT -> setRaw(tbuff);
DT -> decodeBlobMFM();
resetCount = DT -> getResetCount();
while (not(DT->hasTrigged(2))) {
DT -> decodeBlobMFM();
}
resetCount = DT->getResetCount() - resetCount;
cout << "Found reset count: " << resetCount << endl;
}
}
int cr, cd, tr, td; int cr, cd, tr, td;
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
...@@ -261,7 +329,7 @@ int main(int argc, char** argv) ...@@ -261,7 +329,7 @@ int main(int argc, char** argv)
DR -> decodeBlobMFM(); DR -> decodeBlobMFM();
//#ifdef __TEST_ZONE__ //#ifdef __TEST_ZONE__
cout << "Entering test zone." << endl; // cout << "Entering test zone." << endl;
//#else //#else
DD -> rewind(); DD -> rewind();
...@@ -271,7 +339,7 @@ int main(int argc, char** argv) ...@@ -271,7 +339,7 @@ int main(int argc, char** argv)
tr = DR -> getTime(); tr = DR -> getTime();
td = DD -> getTime(); td = DD -> getTime();
while(DR -> getCursor() < rlen and DD -> getCursor() < dlen) while(DR -> getCursor() < rlen and DD -> getCursor() < dlen and c < 10000)
{ {
if (cr == cd) { if (cr == cd) {
#ifndef __TEST_ZONE__ #ifndef __TEST_ZONE__
...@@ -283,7 +351,6 @@ int main(int argc, char** argv) ...@@ -283,7 +351,6 @@ int main(int argc, char** argv)
//DR -> Dump(); //DR -> Dump();
//DD -> Dump(); //DD -> Dump();
c++; c++;
cout << cc << " " << c /*<< "(" << cr << ", " << cd << ") : " << tr << " " << td*/ << "\n";
// Clear raw and physics data // Clear raw and physics data
m_NPDetectorManager->ClearEventPhysics(); m_NPDetectorManager->ClearEventPhysics();
m_NPDetectorManager->ClearEventData(); m_NPDetectorManager->ClearEventData();
...@@ -307,6 +374,7 @@ int main(int argc, char** argv) ...@@ -307,6 +374,7 @@ int main(int argc, char** argv)
m_OutputTree->Fill(); m_OutputTree->Fill();
cc++; cc++;
#endif #endif
cout << cc << " " << c /*<< "(" << cr << ", " << cd << ") : " << tr << " " << td*/ << " |\t";
} }
// check spectra // check spectra
...@@ -353,7 +421,7 @@ int main(int argc, char** argv) ...@@ -353,7 +421,7 @@ int main(int argc, char** argv)
deltaT->Write(); deltaT->Write();
} }
fout->Close(); fout->Close();
#endif
// Essential // Essential
#if __cplusplus > 199711L && NPMULTITHREADING #if __cplusplus > 199711L && NPMULTITHREADING
m_NPDetectorManager->StopThread(); m_NPDetectorManager->StopThread();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment