diff --git a/NPLib/CMakeLists.txt b/NPLib/CMakeLists.txt index abf40c026f82693a0c048da91c2dfac2868f46a4..faad18de0b36de48b2a8340247e56070f796f2bc 100644 --- a/NPLib/CMakeLists.txt +++ b/NPLib/CMakeLists.txt @@ -79,6 +79,7 @@ ENDMACRO() subdirlist(SUB_DIRECTORY ${CMAKE_BINARY_DIR}) set(SUB_DIRECTORY ${SUB_DIRECTORY} Core Physics InitialConditions InteractionCoordinates Utility) include_directories("Core/") +include_directories("Online/") # Add each sub folder to the project set(TARGET_LIST "") diff --git a/NPLib/ComptonTelescope/TComptonTelescopeSpectra.cxx b/NPLib/ComptonTelescope/TComptonTelescopeSpectra.cxx index 67fafea08e586d7a723bd7d2d41a7c997c342c01..b3847c4883336a8f85022aadbae7f887d1f6d871 100644 --- a/NPLib/ComptonTelescope/TComptonTelescopeSpectra.cxx +++ b/NPLib/ComptonTelescope/TComptonTelescopeSpectra.cxx @@ -40,6 +40,7 @@ using namespace std; //////////////////////////////////////////////////////////////////////////////// TComptonTelescopeSpectra::TComptonTelescopeSpectra(){ + SetName("ComptonTelescope"); fNumberOfTelescope = 0; fStripX=32; fStripY=32; @@ -57,6 +58,7 @@ TComptonTelescopeSpectra::TComptonTelescopeSpectra(unsigned int NumberOfTelescop << NumberOfTelescope << " Telescopes" << endl << "************************************************" << endl ; + SetName("ComptonTelescope"); fNumberOfTelescope = NumberOfTelescope; fStripX=32; fStripY=32; diff --git a/NPLib/Core/CMakeLists.txt b/NPLib/Core/CMakeLists.txt index 0bd691207bc2114aee7bea79c8b20d76ed807809..ceb2b3c6e5cda54aa013a48713700f6a701fb23c 100644 --- a/NPLib/Core/CMakeLists.txt +++ b/NPLib/Core/CMakeLists.txt @@ -1,5 +1,6 @@ add_custom_command(OUTPUT TAsciiFileDict.cxx TAsciiFileDict_rdict.pcm TAsciiFile.rootmap COMMAND ../scripts/build_dict.sh TAsciiFile.h TAsciiFileDict.cxx TAsciiFile.rootmap libNPCore.so) add_custom_command(OUTPUT NPVDetectorDict.cxx NPVDetectorDict_rdict.pcm NPVDetector.rootmap COMMAND ../scripts/build_dict.sh NPVDetector.h NPVDetectorDict.cxx NPVDetector.rootmap libNPCore.so NPCoreLinkdef.h) -add_library(NPCore SHARED NPVAnalysis.cxx NPAnalysisFactory.cxx NPCalibrationManager.cxx NPOptionManager.cxx RootOutput.cxx RootInput.cxx TAsciiFile.cxx TAsciiFileDict.cxx NPDetectorManager.cxx NPVDetector.cxx NPVDetectorDict.cxx NPVSpectra.cxx NPDetectorFactory.cxx) +add_custom_command(OUTPUT NPOnlineDict.cxx NPOnlineDict_rdict.pcm NPOnline.rootmap COMMAND ../scripts/build_dict.sh NPOnline.h NPOnlineDict.cxx NPOnline.rootmap libNPOnline.dylib NPOnlineLinkDef.h DEPENDS NPOnline.h) +add_library(NPCore SHARED NPVAnalysis.cxx NPAnalysisFactory.cxx NPCalibrationManager.cxx NPOptionManager.cxx RootOutput.cxx RootInput.cxx TAsciiFile.cxx TAsciiFileDict.cxx NPDetectorManager.cxx NPVDetector.cxx NPVDetectorDict.cxx NPVSpectra.cxx NPDetectorFactory.cxx NPOnline.cxx NPOnlineDict.cxx NPSpectraServer) target_link_libraries(NPCore ${ROOT_LIBRARIES}) -install(FILES NPVAnalysis.h NPAnalysisFactory.h NPCalibrationManager.h NPOptionManager.h RootInput.h RootOutput.h TAsciiFile.h NPDetectorManager.h NPVDetector.h NPGlobalSystemOfUnits.h NPPhysicalConstants.h NPSystemOfUnits.h NPVSpectra.h NPDetectorFactory.h DESTINATION ${CMAKE_INCLUDE_OUTPUT_DIRECTORY}) +install(FILES NPVAnalysis.h NPAnalysisFactory.h NPCalibrationManager.h NPOptionManager.h RootInput.h RootOutput.h TAsciiFile.h NPDetectorManager.h NPVDetector.h NPGlobalSystemOfUnits.h NPPhysicalConstants.h NPSystemOfUnits.h NPVSpectra.h NPDetectorFactory.h NPOnline.h NPSpectraServer.h DESTINATION ${CMAKE_INCLUDE_OUTPUT_DIRECTORY}) diff --git a/NPLib/Core/NPCalibrationManager.h b/NPLib/Core/NPCalibrationManager.h index 7f7bdee96d9e00e23b89bd1e546b9fdee6240fe0..2fe2e02935032238b3d37ffdec20e0f70927fe8f 100644 --- a/NPLib/Core/NPCalibrationManager.h +++ b/NPLib/Core/NPCalibrationManager.h @@ -64,7 +64,7 @@ class CalibrationManager double ApplyResistivePositionCalibration(const string& ParameterPath , const double& RawValue); bool ApplyThreshold(const string& ParameterPath, const double& RawValue); double GetPedestal(const string& ParameterPath); - + public: // To be called after initialisation // Loop over the file list and catch the file used for calibration void LoadParameterFromFile(); diff --git a/NPLib/Core/NPDetectorManager.cxx b/NPLib/Core/NPDetectorManager.cxx index a89011e79479d177cbc1fc570c203b942d212f8d..8d2a2d5f9d75e7f2321a0229d41dae396ce7fd3e 100644 --- a/NPLib/Core/NPDetectorManager.cxx +++ b/NPLib/Core/NPDetectorManager.cxx @@ -33,7 +33,9 @@ #include "RootInput.h" #include "NPOptionManager.h" #include "NPCalibrationManager.h" - +#include "NPSpectraServer.h" +//Root +#include"TCanvas.h" ///////////////////////////////////////////////////////////////////////////////////////////////// // Default Constructor @@ -43,7 +45,7 @@ NPL::DetectorManager::DetectorManager(){ m_ClearEventDataPtr = &NPL::VDetector::ClearEventData ; m_FillSpectra = NULL; m_CheckSpectra = NULL; - + if(NPOptionManager::getInstance()->GetGenerateHistoOption()){ m_FillSpectra = &NPL::VDetector::FillSpectra ; if(NPOptionManager::getInstance()->GetCheckHistoOption()) @@ -66,7 +68,7 @@ NPL::DetectorManager::~DetectorManager(){ void NPL::DetectorManager::ReadConfigurationFile(string Path) { cout << "\033[1;36m" ; - // Instantiate the Calibration Manager + // Instantiate the Calibration Manager // All The detector will then add to it their parameter (see AddDetector) CalibrationManager::getInstance(NPOptionManager::getInstance()->GetCalibrationFile()); @@ -96,7 +98,7 @@ void NPL::DetectorManager::ReadConfigurationFile(string Path) { //////////// Search for Target ///////////// //////////////////////////////////////////// - else if (LineBuffer.compare(0, 13, "GeneralTarget") == 0 && cGeneralTarget == false) { + else if (LineBuffer.compare(0, 13, "GeneralTarget") == 0 && cGeneralTarget == false) { cGeneralTarget = true ; cout << "////////// Target ///////////" << endl; @@ -208,7 +210,7 @@ void NPL::DetectorManager::ReadConfigurationFile(string Path) { delete detector; } } - cout << "\033[0m" ; + cout << "\033[0m" ; ConfigFile.close(); @@ -226,19 +228,19 @@ void NPL::DetectorManager::ReadConfigurationFile(string Path) { // The calibration Manager got all the parameter added, so it can load them from the calibration file CalibrationManager::getInstance()->LoadParameterFromFile(); - + // Start the thread if multithreading supported - #if __cplusplus > 199711L +#if __cplusplus > 199711L InitThreadPool(); - #endif - +#endif + return; } ///////////////////////////////////////////////////////////////////////////////////////////////// void NPL::DetectorManager::BuildPhysicalEvent(){ #if __cplusplus > 199711L - // add new job + // add new job map<string,VDetector*>::iterator it; unsigned int i = 0; for (it = m_Detector.begin(); it != m_Detector.end(); ++it) { @@ -246,18 +248,18 @@ void NPL::DetectorManager::BuildPhysicalEvent(){ } // Wait for all job to be done while(!IsDone()){ - // this_thread::yield(); + // this_thread::yield(); } #else map<string,VDetector*>::iterator it; - for (it = m_Detector.begin(); it != m_Detector.end(); ++it) { - (it->second->*m_ClearEventPhysicsPtr)(); - (it->second->*m_BuildPhysicalPtr)(); - if(m_FillSpectra){ - (it->second->*m_FillSpectra)(); - if(m_CheckSpectra) - (it->second->*m_CheckSpectra)(); - } + for (it = m_Detector.begin(); it != m_Detector.end(); ++it) { + (it->second->*m_ClearEventPhysicsPtr)(); + (it->second->*m_BuildPhysicalPtr)(); + if(m_FillSpectra){ + (it->second->*m_FillSpectra)(); + if(m_CheckSpectra) + (it->second->*m_CheckSpectra)(); + } } #endif } @@ -266,11 +268,11 @@ void NPL::DetectorManager::BuildPhysicalEvent(){ void NPL::DetectorManager::BuildSimplePhysicalEvent(){ ClearEventPhysics(); map<string,VDetector*>::iterator it; - + for (it = m_Detector.begin(); it != m_Detector.end(); ++it) { it->second->BuildSimplePhysicalEvent(); if(NPOptionManager::getInstance()->GetGenerateHistoOption()){ - it->second->FillSpectra(); + it->second->FillSpectra(); if(NPOptionManager::getInstance()->GetCheckHistoOption()) it->second->CheckSpectra(); } @@ -355,14 +357,14 @@ void NPL::DetectorManager::WriteSpectra(){ ///////////////////////////////////////////////////////////////////////////////////////////////// vector< map< vector<string>, TH1* > > NPL::DetectorManager::GetSpectra(){ - vector< map< vector<string>, TH1* > > myVector; - map<string,VDetector*>::iterator it; - // loop on detectors - for (it = m_Detector.begin(); it != m_Detector.end(); ++it) { - myVector.push_back(it->second->GetSpectra()); - } - - return myVector; + vector< map< vector<string>, TH1* > > myVector; + map<string,VDetector*>::iterator it; + // loop on detectors + for (it = m_Detector.begin(); it != m_Detector.end(); ++it) { + myVector.push_back(it->second->GetSpectra()); + } + + return myVector; } ///////////////////////////////////////////////////////////////////////////////////////////////// @@ -397,10 +399,10 @@ void NPL::DetectorManager::InitThreadPool(){ //////////////////////////////////////////////////////////////////////////////// void NPL::DetectorManager::StartThread(NPL::VDetector* det,unsigned int id){ -this_thread::sleep_for(chrono::milliseconds(1)); -vector<bool>::iterator it = m_Ready.begin()+id; + this_thread::sleep_for(chrono::milliseconds(1)); + vector<bool>::iterator it = m_Ready.begin()+id; -while(!m_stop){ + while(!m_stop){ if(*it){ (det->*m_ClearEventPhysicsPtr)(); (det->*m_BuildPhysicalPtr)(); @@ -411,8 +413,8 @@ while(!m_stop){ } m_Ready[id]=false; } - else - this_thread::yield(); + else + this_thread::yield(); } } //////////////////////////////////////////////////////////////////////////////// @@ -427,5 +429,23 @@ bool NPL::DetectorManager::IsDone(){ } return true; } +//////////////////////////////////////////////////////////////////////////////// +void NPL::DetectorManager::SetSpectraServer(){ + NPL::SpectraServer* s = NPL::SpectraServer::getInstance(); + + map<string,VDetector*>::iterator it; + for (it = m_Detector.begin(); it != m_Detector.end(); ++it){ + vector<TCanvas*> canvas = it->second->GetCanvas(); + size_t mysize = canvas.size(); + for (size_t i = 0 ; i < mysize ; i++) + s->AddCanvas(canvas[i]); + } + + thread t( &NPL::SpectraServer::Start,s); + t.detach(); + + system("nponline localhost 9090 &"); + +} #endif diff --git a/NPLib/Core/NPDetectorManager.h b/NPLib/Core/NPDetectorManager.h index a4cbd03d85629c3cd413e21a3e6c8ce7a50e4e3d..db45a600f71d30457468b54132a6222caa165594 100644 --- a/NPLib/Core/NPDetectorManager.h +++ b/NPLib/Core/NPDetectorManager.h @@ -83,6 +83,9 @@ namespace NPL{ void StartThread(NPL::VDetector*,unsigned int); void InitThreadPool(); bool IsDone(); + + public: // for online spectra server + void SetSpectraServer(); #endif private: @@ -106,7 +109,7 @@ namespace NPL{ double GetTargetX() {return m_TargetX;} double GetTargetY() {return m_TargetY;} double GetTargetZ() {return m_TargetZ;} - }; + }; } #endif diff --git a/NPLib/Core/NPOnline.cxx b/NPLib/Core/NPOnline.cxx new file mode 100644 index 0000000000000000000000000000000000000000..54dc15d8bb4f3c0b68bda31969dfe9dd1213e642 --- /dev/null +++ b/NPLib/Core/NPOnline.cxx @@ -0,0 +1,392 @@ +// NPL +#include "NPOnline.h" + +// STL +#include <iostream> +#include <dirent.h> + +// Root +#include "TRoot.h" +#include "TColor.h" +#include "TSystem.h" +#include "TString.h" +#include "TF1.h" +#include "TCanvas.h" +#include "TFile.h" +#include "TASImage.h" +#include "TMessage.h" +#include "TGSplitter.h" +ClassImp(NPL::NPOnline); +//////////////////////////////////////////////////////////////////////////////// +void NPL::ExecuteMacro(string name){ + static DIR *dir; + static struct dirent *ent; + static string path; + path = "./online_macros/"; + name += ".C"; + if ((dir = opendir (path.c_str())) != NULL) { + while ((ent = readdir (dir)) != NULL) { + if(ent->d_name==name) + gROOT->ProcessLine(Form(".x online_macros/%s",name.c_str())); + } + closedir (dir); + } +} +//////////////////////////////////////////////////////////////////////////////// +NPL::NPOnline::NPOnline(string address,int port){ + m_Sock = 0; + TString NPLPath = gSystem->Getenv("NPTOOL"); + gROOT->ProcessLine(Form(".x %s/NPLib/scripts/NPToolLogon.C+", NPLPath.Data())); + gROOT->SetStyle("nponline"); + + // Build the interface + MakeGui(address,port); + + // Link the button slot to the function + m_Quit->SetCommand("gApplication->Terminate()"); + m_Connect->Connect("Clicked()", "NPL::NPOnline", this, "Connect()"); + m_Update->Connect("Clicked()", "NPL::NPOnline", this, "Update()"); + m_Clock->Connect("Clicked()","NPL::NPOnline",this,"AutoUpdate()"); + + Connect(); +} + +//////////////////////////////////////////////////////////////////////////////// +void NPL::NPOnline::MakeGui(string address,int port){ + m_BgColor = gROOT->GetColor(kGray+3)->GetPixel(); + m_FgColor = gROOT->GetColor(kAzure+7)->GetPixel(); + m_TabBgColor = gROOT->GetColor(kGray+3)->GetPixel(); + m_TabFgColor = gROOT->GetColor(kAzure+7)->GetPixel(); + m_Timer = 0; + + // main frame + m_Main = new TGMainFrame(gClient->GetRoot(),10,10,kMainFrame | kVerticalFrame); + m_Main->SetName("nponline"); + m_Main->SetBackgroundColor(m_BgColor); + m_Main->SetForegroundColor(m_FgColor); + // m_Main->SetLayoutBroken(kTRUE); + + // Button bar to hold the button + m_ButtonBar= new TGVerticalFrame(m_Main,10000,42,kFixedSize); + m_ButtonBar->SetBackgroundColor(m_BgColor); + m_ButtonBar->SetForegroundColor(m_BgColor); + m_ButtonBar->SetLayoutBroken(kTRUE); + m_Main->AddFrame(m_ButtonBar,new TGLayoutHints(kLHintsLeft|kLHintsTop)); + + string NPLPath = gSystem->Getenv("NPTOOL"); + string path_quit = NPLPath+"/NPLib/Core/icons/power.xpm"; + m_Quit = new TGPictureButton(m_ButtonBar,gClient->GetPicture(path_quit.c_str()),-1,TGPictureButton::GetDefaultGC()(),kChildFrame); + m_Quit->SetBackgroundColor(m_BgColor); + m_Quit->SetToolTipText("Quit"); + + m_ButtonBar->AddFrame(m_Quit, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2)); + m_Quit->MoveResize(10,5,32,32); + + string path_connect = NPLPath+"/NPLib/Core/icons/plugin.xpm"; + m_Connect = new TGPictureButton(m_ButtonBar,gClient->GetPicture(path_connect.c_str()),-1,TGPictureButton::GetDefaultGC()(),kChildFrame); + string path_connected = NPLPath+"/NPLib/Core/icons/brightness.xpm"; + m_Connect->SetDisabledPicture(gClient->GetPicture(path_connected.c_str())); + m_Connect->SetBackgroundColor(m_BgColor); + m_Connect->SetBackgroundColor(m_BgColor); + + m_Connect->SetToolTipText("Connect to server"); + m_ButtonBar->AddFrame(m_Connect, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2)); + m_Connect->MoveResize(52,5,32,32); + + string path_update = NPLPath+"/NPLib/Core/icons/download.xpm"; + m_Update = new TGPictureButton(m_ButtonBar,gClient->GetPicture(path_update.c_str()),-1,TGPictureButton::GetDefaultGC()(),kChildFrame); + m_Update->SetBackgroundColor(m_BgColor); + m_Update->SetForegroundColor(m_BgColor); + m_Update->SetToolTipText("Update spectra"); + m_ButtonBar->AddFrame(m_Update, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2)); + m_Update->MoveResize(400,5,32,32); + + string path_clock= NPLPath+"/NPLib/Core/icons/clock.xpm"; + m_Clock = new TGPictureButton(m_ButtonBar,gClient->GetPicture(path_clock.c_str()),-1,TGPictureButton::GetDefaultGC()(),kChildFrame); + m_Clock->SetBackgroundColor(m_BgColor); + m_Clock->SetForegroundColor(m_BgColor); + + m_Clock->SetToolTipText("AutoUpdate"); + m_ButtonBar->AddFrame(m_Clock, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2)); + m_Clock->MoveResize(442,5,32,32); + + TGFont* ufont; // will reflect user font changes + ufont = gClient->GetFont("-*-helvetica-medium-r-*-*-12-*-*-*-*-*-iso8859-1"); + + TGGC * uGC; // will reflect user GC changes + // graphics context changes + GCValues_t valress; + valress.fMask = kGCForeground | kGCBackground | kGCFillStyle | kGCFont | kGCGraphicsExposures; + gClient->GetColorByName("#000000",valress.fForeground); + gClient->GetColorByName("#e7e7e7",valress.fBackground); + valress.fFillStyle = kFillSolid; + valress.fFont = ufont->GetFontHandle(); + valress.fGraphicsExposures = kFALSE; + uGC = gClient->GetGC(&valress, kTRUE); + m_Address = new TGTextEntry(m_ButtonBar, new TGTextBuffer(14),-1,uGC->GetGC(),ufont->GetFontStruct(),kChildFrame | kOwnBackground); + m_Address->SetMaxLength(4096); + m_Address->SetAlignment(kTextLeft); + m_Address->SetText(address.c_str()); + m_Address->Resize(200,m_Address->GetDefaultHeight()); + m_ButtonBar->AddFrame(m_Address, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2)); + m_Address->MoveResize(90,10,200,20); + + m_Port = new TGNumberEntry(m_ButtonBar, (Double_t) port,9,-1,(TGNumberFormat::EStyle) 5); + m_Port->SetName("m_Port"); + m_Port->GetButtonUp()->SetStyle(1); + m_Port->GetButtonDown()->SetStyle(1); + m_ButtonBar->AddFrame(m_Port, new TGLayoutHints(kLHintsLeft)); + m_Port->MoveResize(300,10,80,20); + + m_TimerEntry = new TGNumberEntry(m_ButtonBar, (Double_t) 1,9,-1,(TGNumberFormat::EStyle) 5); + m_TimerEntry->SetName("m_TimerEntry"); + m_TimerEntry->GetButtonUp()->SetStyle(1); + m_TimerEntry->GetButtonDown()->SetStyle(1); + m_ButtonBar->AddFrame(m_TimerEntry, new TGLayoutHints(kLHintsLeft)); + m_TimerEntry->MoveResize(484,10,40,20); + + + // Create the splitted frame + m_Split = new TGHorizontalFrame(m_Main, 50, 50); + TGVerticalFrame* fV1 = new TGVerticalFrame(m_Split, 10, 10, kFixedWidth); + TGVerticalFrame* fV2 = new TGVerticalFrame(m_Split, 10, 10); + m_Left = new TGCompositeFrame(fV1, 10, 10, kChildFrame); + m_Right = new TGCompositeFrame(fV2, 10, 10, kChildFrame); + fV1->AddFrame(m_Left, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY,0, 0, 5, 10)); + fV2->AddFrame(m_Right, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY,0, 0, 5, 10)); + + fV1->Resize(m_Left->GetDefaultWidth()+200, fV1->GetDefaultHeight()); + fV2->Resize(m_Right->GetDefaultWidth(), fV1->GetDefaultHeight()); + m_Split->AddFrame(fV1, new TGLayoutHints(kLHintsLeft | kLHintsExpandY )); + + TGVSplitter* splitter = new TGVSplitter(m_Split,5,5); + splitter->SetFrame(fV1, kTRUE); + m_Split->AddFrame(splitter, new TGLayoutHints(kLHintsLeft| kLHintsTop | kLHintsExpandY)); + m_Split->SetBackgroundColor(m_BgColor); + splitter->SetBackgroundColor(m_BgColor); + m_Split->SetForegroundColor(m_BgColor); + splitter->SetForegroundColor(m_BgColor); + m_Left->SetBackgroundColor(m_BgColor); + m_Right->SetBackgroundColor(m_BgColor); + m_Left->SetForegroundColor(m_BgColor); + m_Right->SetForegroundColor(m_BgColor); + fV1->SetBackgroundColor(m_BgColor); + fV2->SetBackgroundColor(m_BgColor); + fV1 ->SetForegroundColor(m_BgColor); + fV2->SetForegroundColor(m_BgColor); + + m_Split->AddFrame(fV2, new TGLayoutHints(kLHintsRight | kLHintsExpandX | kLHintsExpandY)); + m_Main->AddFrame(m_Split, new TGLayoutHints(kLHintsRight | kLHintsExpandX |kLHintsExpandY)); + + // canvas widget + TGCanvas* m_ListCanvas = new TGCanvas(m_Left,120,500); + m_ListCanvas->SetName("m_ListCanvas"); + + m_ListCanvas ->SetForegroundColor(m_BgColor); + m_ListCanvas->SetForegroundColor(m_BgColor); + + + // canvas viewport + TGViewPort* fViewPort669 = m_ListCanvas->GetViewPort(); + + // list tree + m_CanvasListTree = new CanvasList(m_Main,m_ListCanvas); + m_ListTree = m_CanvasListTree->GetListTree(); + + fViewPort669->AddFrame(m_ListTree,new TGLayoutHints(kLHintsRight | kLHintsBottom | kLHintsExpandY | kLHintsExpandX)); + m_ListTree->SetLayoutManager(new TGHorizontalLayout(m_ListTree)); + m_ListTree->MapSubwindows(); + + m_ListCanvas->SetContainer(m_ListTree); + m_ListCanvas->MapSubwindows(); + m_Left->AddFrame(m_ListCanvas, new TGLayoutHints(kLHintsLeft | kLHintsBottom | kLHintsExpandY | kLHintsExpandX)); + m_ListCanvas->MoveResize(10,50,120,500); + + // tab widget + m_Tab = new TGTab(m_Right,700,500); + + m_Tab->Resize(m_Tab->GetDefaultSize()); + m_Tab->SetBackgroundColor(m_TabBgColor); + m_Tab->SetForegroundColor(m_TabFgColor); + m_Tab->ChangeSubframesBackground(m_BgColor); + + m_Right->AddFrame(m_Tab,new TGLayoutHints(kLHintsRight | kLHintsBottom | kLHintsExpandX | kLHintsExpandY)); + m_CanvasListTree->SetTab(m_Tab); + + m_Main->SetMWMHints(kMWMDecorAll,kMWMFuncAll,kMWMInputModeless); + m_Main->MapSubwindows(); + + m_Main->Resize(m_Main->GetDefaultSize()); + m_Main->MapWindow(); + m_Main->MoveResize(0,0,2000,1000); + + m_Main->SetLayoutBroken(kFALSE); +} + +//////////////////////////////////////////////////////////////////////////////// +NPL::NPOnline::~NPOnline(){ + delete m_Main; + delete m_ListCanvas; + delete m_ListTree; + delete m_Tab; + delete m_Quit; + delete m_Connect; + delete m_Update; + delete m_Sock; + delete m_Port; + delete m_Address; +} + +//////////////////////////////////////////////////////////////////////////////// +void NPL::NPOnline::Connect(){ + // Connect to SpectraServer + m_Sock = new TSocket(m_Address->GetDisplayText(),(Int_t) m_Port->GetNumber()); + if(m_Sock->IsValid()){ + m_Connect->SetState(kButtonDisabled); + Update(); + } + else{ + cout << "Connection to " << m_Address->GetDisplayText() << " " <<(Int_t) m_Port->GetNumber() << " Failed" << endl; + } +} + +//////////////////////////////////////////////////////////////////////////////// +void NPL::NPOnline::Update(){ + if(!m_Sock || !(m_Sock->IsValid())){ + cout << "Spectra server not connected" << endl; + m_Connect->SetState(kButtonUp); + return; + } + + TMessage* message; + m_Sock->Send("RequestSpectra"); + + if(m_Sock->Recv(message)<=0){ + cout << "Spectra request failed " << endl; + return; + } + + m_CanvasListTree->Clear(); + m_CanvasList = (TList*) message->ReadObject(message->GetClass()); + + TGCompositeFrame* tf; + TRootEmbeddedCanvas* canvas; + for(TCanvas* c = (TCanvas*) m_CanvasList->First() ; c !=0 ; c = (TCanvas*) m_CanvasList->After(c)){ + m_CanvasListTree->AddItem(c); + + TGCompositeFrame* tab = m_Tab->GetTabContainer(c->GetName()); + if(tab){ + tab->RemoveAll(); + TRootEmbeddedCanvas* canvas = new TRootEmbeddedCanvas("Canvas",tab,700,490,!kSunkenFrame); + + c->UseCurrentStyle(); + c->SetMargin(0,0,0,0); + canvas->AdoptCanvas(c); + tab->AddFrame(canvas,new TGLayoutHints(kLHintsLeft | kLHintsBottom | kLHintsExpandX | kLHintsExpandY)); + tab->SetLayoutManager(new TGVerticalLayout(tab)); + ExecuteMacro(c->GetName()); + } + } + + m_Main->MapSubwindows(); + m_Main->Layout(); +} + +//////////////////////////////////////////////////////////////////////////////// +void NPL::NPOnline::AutoUpdate(){ + + if(m_Timer){ + delete m_Timer; + m_Timer = 0 ; + return; + } + + else if(m_TimerEntry->GetNumber()>0){ + m_Timer = new TTimer(m_TimerEntry->GetNumber()*1000); + m_Timer->Connect("Timeout()", "NPL::NPOnline", this, "Update()"); + m_Timer->TurnOn(); + } +} +//////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////// + +/* CanvasList Class */ + +//////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////// + +NPL::CanvasList::CanvasList(TGMainFrame* main, TGCanvas* parent){ + string NPLPath = gSystem->Getenv("NPTOOL"); + string path_icon = NPLPath+"/NPLib/Core/icons/polaroid.xpm"; + + m_popen = gClient->GetPicture(path_icon.c_str()); + m_pclose = gClient->GetPicture(path_icon.c_str()); + + m_BgColor = gROOT->GetColor(kGray+3)->GetPixel(); + m_FgColor = gROOT->GetColor(kWhite)->GetPixel(); + + m_ListTree = new TGListTree(parent,kHorizontalFrame); + m_ListTree->Connect("DoubleClicked(TGListTreeItem*,Int_t)","NPL::CanvasList",this,"OnDoubleClick(TGListTreeItem*,Int_t)"); + m_Main = main; +} +//////////////////////////////////////////////////////////////////////////////// +NPL::CanvasList::~CanvasList(){ +} +//////////////////////////////////////////////////////////////////////////////// +void NPL::CanvasList::OnDoubleClick(TGListTreeItem* item, Int_t btn){ + AddTab(item->GetText(),m_Canvas[item->GetText()]); +} +//////////////////////////////////////////////////////////////////////////////// +void NPL::CanvasList::AddItem(TCanvas* c){ + TGListTreeItem* item = m_ListTree->AddItem(NULL,c->GetName()); + item->SetPictures(m_popen, m_pclose); + m_Canvas[c->GetName()]=c; +} +//////////////////////////////////////////////////////////////////////////////// +void NPL::CanvasList::Clear(){ + m_Canvas.clear(); + TGListTreeItem* item = m_ListTree->GetFirstItem() ; + while(item){ + m_ListTree->DeleteItem(item); + item = m_ListTree->GetFirstItem() ; + } +} +//////////////////////////////////////////////////////////////////////////////// +TGListTree* NPL::CanvasList::GetListTree(){ + return m_ListTree; +} +//////////////////////////////////////////////////////////////////////////////// +void NPL::CanvasList::AddTab(std::string name,TCanvas* c){ + // If the tab exist, activate + if(m_Tab->GetTabTab(name.c_str())){ + m_Tab->SetTab(name.c_str()); + return; + } + + TGCompositeFrame* tf = m_Tab->AddTab(name.c_str()); + TRootEmbeddedCanvas* canvas = new TRootEmbeddedCanvas("Canvas",tf,700,490,!kSunkenFrame); + + if(c){ + c->UseCurrentStyle(); + c->SetMargin(0,0,0,0); + canvas->AdoptCanvas(c); + ExecuteMacro(c->GetName()); + } + + tf->SetBackgroundColor(m_BgColor); + tf->SetForegroundColor(m_FgColor); + + tf->AddFrame(canvas,new TGLayoutHints(kLHintsTop | kLHintsLeft |kLHintsExpandX | kLHintsExpandY)); + tf->SetLayoutManager(new TGVerticalLayout(tf)); + m_Tab->Resize(m_Tab->GetDefaultSize()); + m_Tab->MoveResize(144,50,700,500); + m_Tab->SetTab(name.c_str()); + m_Main->MapSubwindows(); + m_Main->MapWindow(); + m_Main->Layout(); +} +//////////////////////////////////////////////////////////////////////////////// +void NPL::CanvasList::SetTab(TGTab* tab){ + m_Tab=tab; +} + diff --git a/NPLib/Core/NPOnline.h b/NPLib/Core/NPOnline.h new file mode 100644 index 0000000000000000000000000000000000000000..ddb108cb2162f3d718be1831fbcf6da69dfc49b1 --- /dev/null +++ b/NPLib/Core/NPOnline.h @@ -0,0 +1,107 @@ +#ifndef NPONLINE_H +#define NPONLINE_H +#include "TGLayout.h" +#include "TGButton.h" +#include "TGTab.h" +#include "TRootEmbeddedCanvas.h" +#include "TH1.h" +#include "TSocket.h" +#include "TGListTree.h" +#include "TGTextEntry.h" +#include "TGNumberEntry.h" +#include "TTimer.h" +//#include "TGCanvasContainer.h" +#include "RQ_OBJECT.h" +#include<map> +using namespace std; + +namespace NPL{ + void ExecuteMacro(string name); + + class CanvasList { + RQ_OBJECT("CanvasList") + protected: + TGMainFrame* m_Main; + TGListTree* m_ListTree; + TGTab* m_Tab; + map<string,TCanvas*> m_Canvas; + const TGPicture* m_popen; + const TGPicture* m_pclose; + Pixel_t m_BgColor; + Pixel_t m_FgColor; + + + public: + CanvasList(TGMainFrame* main, TGCanvas* parent); + virtual ~CanvasList(); + + // slots + void OnDoubleClick(TGListTreeItem* item, Int_t btn); + + // Interface with NPOnline + void SetTab(TGTab* tab); + void AddItem(TCanvas* c); + void Clear(); + TGListTree* GetListTree(); + // Add a new Tab to the interface + void AddTab(std::string name="default",TCanvas* c=0); + }; + + class NPOnline{ + RQ_OBJECT("NPOnline") + + public: + NPOnline(string address="localhost", int port=9090); + ~NPOnline(); + + void MakeGui(string address="localhost", int port=9090); + void Connect(); + void Update(); + void AutoUpdate(); + + private: // Server client + TSocket* m_Sock; + TList* m_CanvasList; + + private: // GUI stuff + // Main window + TGMainFrame* m_Main; + // Menu bar + TGVerticalFrame* m_ButtonBar; + // Splitted frame for Tree (l) and Tab (r) + TGHorizontalFrame* m_Split; + + // left view port + TGCompositeFrame* m_Left; + // right view port + TGCompositeFrame* m_Right; + + TGTab* m_Tab; + TGPictureButton* m_Quit; + TGPictureButton* m_Connect; + TGPictureButton* m_Update; + TGPictureButton* m_Clock; + TGNumberEntry* m_TimerEntry; + TTimer* m_Timer; + + + TGTextEntry* m_Address; + TGNumberEntry* m_Port; + TGListTree* m_ListTree; + CanvasList* m_CanvasListTree; + + TGCanvas* m_ListCanvas; + + private: // Style + Pixel_t m_BgColor; + Pixel_t m_FgColor; + Pixel_t m_TabBgColor; + Pixel_t m_TabFgColor; + + TH1* m_hist; + + ClassDef(NPOnline,1); + }; + +} +#endif diff --git a/NPLib/Core/NPOnlineLinkDef.h b/NPLib/Core/NPOnlineLinkDef.h new file mode 100644 index 0000000000000000000000000000000000000000..aa1093aae8c8c792b9cb807e9826c1486f00b9c9 --- /dev/null +++ b/NPLib/Core/NPOnlineLinkDef.h @@ -0,0 +1,3 @@ +#ifdef __CINT__ +#pragma link C++ defined_in "./NPOnline.h"; +#endif diff --git a/NPLib/Core/NPOptionManager.cxx b/NPLib/Core/NPOptionManager.cxx index 1b41946d4efe91e7232a20d3a296d886b39f3c98..cfdd9b14c4ce927c7d3e8da76d75e096520e8f0c 100644 --- a/NPLib/Core/NPOptionManager.cxx +++ b/NPLib/Core/NPOptionManager.cxx @@ -65,6 +65,7 @@ void NPOptionManager::ReadTheInputArgument(int argc, char** argv){ fInputPhysicalTreeOption = false; fGenerateHistoOption = false ; fPROOFMode = false; + fOnline = false; for (int i = 0; i < argc; i++) { string argument = argv[i]; @@ -121,6 +122,9 @@ void NPOptionManager::ReadTheInputArgument(int argc, char** argv){ else if (argument == "--last-res") fLastResFile = true ; else if (argument == "--last-any") fLastAnyFile = true ; + + else if (argument == "--online") {fOnline = true ;fGenerateHistoOption=true;} + //else ; } @@ -281,7 +285,7 @@ void NPOptionManager::SendErrorAndExit(const char* type) const{ else if (stype == "DetectorConfiguration") { cout << endl; cout << "*********************************** Error ***********************************" << endl; - cout << "* No detector geometry file found in $NPTool/Inputs/EventGenerator or local directories *" << endl; + cout << "* No detector geometry file found in $NPTool/Inputs/DetectorConfiguration or local directories *" << endl; cout << "*****************************************************************************************" << endl; cout << endl; exit(1); @@ -319,6 +323,7 @@ void NPOptionManager::DisplayHelp(){ cout << "\t --last-phy\t \t \t \tIgnore the list of Run to treat if any and analysed the last Physics file" << endl ; cout << "\t --last-res\t \t \t \tIgnore the list of Run to treat if any and analysed the last Result file" << endl ; cout << "\t --last-any\t \t \t \tIgnore the list of Run to treat if any and analysed the last root file with a non standard Tree name" << endl ; + cout << "\t --online \t \t \t \tStart the spectra server" << endl ; cout << endl << endl ; // exit current program diff --git a/NPLib/Core/NPOptionManager.h b/NPLib/Core/NPOptionManager.h index 599fae3e2d53045c9adead830db51332dad95dd3..dea38d73be9aee41e83d113fbd1b334116c24440 100644 --- a/NPLib/Core/NPOptionManager.h +++ b/NPLib/Core/NPOptionManager.h @@ -95,6 +95,7 @@ class NPOptionManager{ bool GetInputPhysicalTreeOption() {return fInputPhysicalTreeOption;} bool GetGenerateHistoOption() {return fGenerateHistoOption;} bool GetCheckHistoOption() {return fCheckHistoOption;} + bool GetOnline() {return fOnline;} bool GetPROOF() {return fPROOFMode;} int GetVerboseLevel() {return fVerboseLevel;} int GetNumberOfEntryToAnalyse() {return fNumberOfEntryToAnalyse;} @@ -125,6 +126,7 @@ class NPOptionManager{ bool fInputPhysicalTreeOption; bool fGenerateHistoOption; bool fCheckHistoOption; + bool fOnline; // true if spectra server is started bool fPROOFMode; // if true, the system run in a pROOF environment bool fLastSimFile; bool fLastPhyFile; diff --git a/NPLib/Core/NPSpectraServer.cxx b/NPLib/Core/NPSpectraServer.cxx new file mode 100644 index 0000000000000000000000000000000000000000..bcfd35da596f43c5889ffb47f5c75cbce6584246 --- /dev/null +++ b/NPLib/Core/NPSpectraServer.cxx @@ -0,0 +1,99 @@ +#include "NPSpectraServer.h" +#include <unistd.h> +#include<iostream> +NPL::SpectraServer* NPL::SpectraServer::instance = 0 ; +//////////////////////////////////////////////////////////////////////////////// +NPL::SpectraServer* NPL::SpectraServer::getInstance(){ + if(!instance) + instance = new NPL::SpectraServer(); + + return instance; +} + +//////////////////////////////////////////////////////////////////////////////// +NPL::SpectraServer::SpectraServer(){ + m_Server= new TServerSocket(9090,true); + if(!m_Server->IsValid()) + exit(1); + + + m_stop = false; + // Add server socket to monitor so we are notified when a client needs to be + // accepted + m_Monitor = new TMonitor; + m_Monitor->Add(m_Server); + + // Create a list to contain all client connections + m_Sockets = new TList; + + // Create the list of Canvas + m_Canvas = new TList; +} +//////////////////////////////////////////////////////////////////////////////// +void NPL::SpectraServer::AddCanvas(TCanvas* c){ + m_Canvas->Add(c); +} + +//////////////////////////////////////////////////////////////////////////////// +void NPL::SpectraServer::Start(){ + if(m_Server){ + while(!m_stop){ + if(!m_Server) + return; + + TSocket* s ; + if((s=m_Monitor->Select(20))!=(TSocket*)-1) + HandleSocket(s); + } + } +} + +//////////////////////////////////////////////////////////////////////////////// +NPL::SpectraServer::~SpectraServer(){ + std::cout << 1 << std::endl; + // tell the socket to stop + m_stop = true; + // wait for it to be stopped + sleep(100); + std::cout << 2 << std::endl; + + m_Server->Close("force"); + + std::cout << 3 << std::endl; + + delete m_Server; + std::cout << 4 << std::endl; + + m_Server=0; + delete m_Monitor; + std::cout << 5 << std::endl; + + m_Monitor = 0; + instance = 0 ; +} +//////////////////////////////////////////////////////////////////////////////// +void NPL::SpectraServer::HandleSocket(TSocket* s){ + if (s->IsA() == TServerSocket::Class()) { + // accept new connection from spy + TSocket* socket = ((TServerSocket*)s)->Accept(); + m_Monitor->Add(socket); + m_Sockets->Add(socket); + } + else { + // we only get string based requests from the spy + char request[64]; + if (s->Recv(request, sizeof(request)) <= 0) { + m_Monitor->Remove(s); + m_Sockets->Remove(s); + delete s; + return; + } + + // send requested object back + TMessage answer(kMESS_OBJECT); + if (!strcmp(request, "RequestSpectra")) + answer.WriteObject(m_Canvas); + + s->Send(answer); + } +} diff --git a/NPLib/Core/NPSpectraServer.h b/NPLib/Core/NPSpectraServer.h new file mode 100644 index 0000000000000000000000000000000000000000..bc175fd8ce5ed96003a1460a703b5eb76211b598 --- /dev/null +++ b/NPLib/Core/NPSpectraServer.h @@ -0,0 +1,34 @@ +#ifndef NPSPECTRASERVER_H +#define NPSPECTRASERVER_H + +#include "TSocket.h" +#include "TServerSocket.h" +#include "TMonitor.h" +#include "TMessage.h" +#include "TList.h" +#include "TCanvas.h" +namespace NPL{ + class SpectraServer{ + public: + static SpectraServer* getInstance(); + + private: + SpectraServer(); + ~SpectraServer(); + + private: + static SpectraServer* instance; + + public: + void HandleSocket(TSocket* s); + void AddCanvas(TCanvas* c); + void Start(); + private: + bool m_stop; + TServerSocket* m_Server; + TMonitor* m_Monitor; + TList* m_Sockets; + TList* m_Canvas; + }; +} +#endif diff --git a/NPLib/Core/NPVDetector.h b/NPLib/Core/NPVDetector.h index a8b806bf652911d07be473bafbf9754b3a02a65a..b163d6bbdd3897524f707fba00ddaeffacf8573e 100644 --- a/NPLib/Core/NPVDetector.h +++ b/NPLib/Core/NPVDetector.h @@ -28,7 +28,7 @@ // ROOT headers #include "TH1.h" - +#include "TCanvas.h" // STL header #include <string> #include <vector> @@ -87,6 +87,8 @@ namespace NPL { virtual void ClearSpectra() {}; // Used for Online only, get all the spectra hold by the Spectra class virtual map< vector<string> , TH1*> GetSpectra() {map< vector<string>, TH1* > x; return x;}; + // Used for Online only, get all the canvases + virtual vector<TCanvas*> GetCanvas(){vector<TCanvas*> x ; return x;}; private: // The list below is here to help you building your own detector /* diff --git a/NPLib/Core/NPVSpectra.cxx b/NPLib/Core/NPVSpectra.cxx index d03f73dac29a37bbbc267285fc3b351b89aed686..7819243a1589594426632b5d92939cb528f28413 100644 --- a/NPLib/Core/NPVSpectra.cxx +++ b/NPLib/Core/NPVSpectra.cxx @@ -75,6 +75,15 @@ TH1* VSpectra::AddHisto2D(string name, string title, Int_t nbinsx, Double_t xlow return hist; } +//////////////////////////////////////////////////////////////////////////////// +void VSpectra::AddCanvas(TCanvas* c){ + m_Canvas.push_back(c); +} + +//////////////////////////////////////////////////////////////////////////////// +vector<TCanvas*> VSpectra::GetCanvas(){ + return m_Canvas; +} //////////////////////////////////////////////////////////////////////////////// TH1* VSpectra::GetHisto(string& family, string& name){ vector<string> index; diff --git a/NPLib/Core/NPVSpectra.h b/NPLib/Core/NPVSpectra.h index 6830f2c13e3d1fb5bcc7eb63e395ddeed5a6aeaa..36fadc9dabc99a8de03cc3a0f52f22cc5c9d7083 100644 --- a/NPLib/Core/NPVSpectra.h +++ b/NPLib/Core/NPVSpectra.h @@ -25,7 +25,7 @@ // ROOT headers #include "TObject.h" #include "TH1.h" - +#include "TCanvas.h" // C++ STL headers #include <map> #include <vector> @@ -38,12 +38,13 @@ class VSpectra { VSpectra(); virtual ~VSpectra(); -// private: public: // Instantiate and register histo to maps TH1* AddHisto1D(string name, string title, Int_t nbinsx, Double_t xlow, Double_t xup, string family); TH1* AddHisto2D(string name, string title, Int_t nbinsx, Double_t xlow, Double_t xup, Int_t nbinsy, Double_t ylow, Double_t yup, string family); + // Add a Canvas to the online + void AddCanvas(TCanvas* c ); public: // Initialization methods @@ -63,11 +64,14 @@ class VSpectra { map< vector<string>, TH1* > GetMapHisto() const {return fMapHisto;} TH1* GetHisto(string& family, string& name); void WriteSpectra(string filename = "VOID"); - + // Return the canvases created for online display + vector<TCanvas*> GetCanvas(); + private: // map holding histo pointers and their family names map< vector<string>, TH1* > fMapHisto; - + vector<TCanvas*> m_Canvas; + private: // Name of the Detector string m_name; diff --git a/NPLib/Core/icons/brightness.xpm b/NPLib/Core/icons/brightness.xpm new file mode 100644 index 0000000000000000000000000000000000000000..31ff3031836d25a24b12c9ac28894097132ad656 --- /dev/null +++ b/NPLib/Core/icons/brightness.xpm @@ -0,0 +1,126 @@ +/* XPM */ +static char *brightness[] = { +/* columns rows colors chars-per-pixel */ +"32 32 88 1 ", +" c #353636", +". c #353737", +"X c #373737", +"o c #393838", +"O c #3A3838", +"+ c #493C3C", +"@ c #533E3E", +"# c #5A4040", +"$ c #5B4040", +"% c #614242", +"& c #7A4848", +"* c #8B4D4D", +"= c #914E4E", +"- c #9E5151", +"; c #A95454", +": c #B05656", +"> c #BB5656", +", c #B15958", +"< c #B05A5A", +"1 c #B65858", +"2 c #B65E5D", +"3 c #B85858", +"4 c #BC5858", +"5 c #BE5A5A", +"6 c #BB5F5F", +"7 c #B26361", +"8 c #B66363", +"9 c #B86261", +"0 c #BF7A76", +"q c #BF7C77", +"w c #C15858", +"e c #C75C5C", +"r c #C85C5C", +"t c #C85F5F", +"y c #C76160", +"u c #C76362", +"i c #C86160", +"p c #C66866", +"a c #C06D6A", +"s c #CC6C6C", +"d c #C07A76", +"f c #CE7878", +"g c #D17979", +"h c #BB837E", +"j c #CE817D", +"k c #CE827D", +"l c #BD8B85", +"z c #C78580", +"x c #CC8383", +"c c #CF8984", +"v c #D68787", +"b c #CD958E", +"n c #CE9595", +"m c #D39790", +"M c #D19A93", +"N c #D99999", +"B c #DC9A9A", +"V c #CBA89F", +"C c #CCABA8", +"Z c #CCABA9", +"A c #D6AAA1", +"S c #CDB2A8", +"D c #CEB8AD", +"F c #CFB9AE", +"G c #D7BBB0", +"H c #DABDB2", +"J c #DEBFBF", +"K c #C1C2B7", +"L c #C6C6BD", +"P c #CCCCBE", +"I c #CCCBC3", +"U c #D7CDC0", +"Y c #DDCFC2", +"T c #D1D0C3", +"R c #DDD0C3", +"E c #DADCCD", +"W c #DFDCCE", +"Q c #EAC3C3", +"! c #EAD2D2", +"~ c #F1D5D5", +"^ c #E1E2D3", +"/ c #EDEEEB", +"( c #F8F0F0", +") c #FAF1F1", +"_ c #F9F9F8", +"` c #FDFAFA", +"' c #FDFDFD", +"] c white", +/* pixels */ +"XXXXXXXXoo@&-;eeee:-&@oXXoXXXXXX", +"XXXXXXXo@=eerreeeeeee3=$XXXXXXXX", +"XXXXXX+*5reereeeeeeeerr5*+XXXXXX", +"XXXXX#;reeeeeeeeeeeeeeeee;$XXXXX", +"XXXX#1rreeeeeeerueeeeeeerr3%XXoX", +"XXX#1rrreeeeeeeAAeeeeeeerrr:@XXX", +"XX+;rereeeMceeeHHeeecneerree;+XX", +"XX*rreeeeuGRseeddeesRGueeeeee*XX", +"X#5reeeeee0VurgkxguuV0eeeeeer5@o", +"X=reeeeiee51N!]_](~B:>eeyreeer=o", +"@1rreeMGkesQ]]]]]]]]QsekHMrerr3@", +"&eeeeezUAiQ]]]]]]]]]]QiAPcrrrrr&", +"-reeee>77B]]]]]]]]]]]_B97>eerer-", +"1reeeeeei~]]]]]]]]]]]]~teeeeeer:", +"eeeeeeeeg(]]]]]]]]]]]](feeeeeerr", +"eeeeuAHkv]]]]]]]]]]]]]]vkHAueerr", +"eeeetCFfv_]]]]]]]]]]]]]v0DVrreee", +"eeeee:;4g(]]]]]]]]]]]](f>::eeeee", +"3eeeeeeee!]]]]]]]]]]]]~ieeeeere:", +"-eeeeeespn_]]]]]]]]]]]n8seeeerr-", +"&eeeeexYA1I]]]]]]]]]]J5ARceeeee&", +"+3eeeenD0eeP]]]]]]]]J7e0Dbeeer:@", +"o=eeee434ew3C/_]]]/C;>e>11eeee=o", +"X#5reeeereewlKLILLDleeeeeeeeee#X", +"Xo*rreeeeeeeMETIPUEMeeeeeeeer*oX", +"Xo+;rreeeeee7SEE^EDaeeeeeeer;+Xo", +"XXX@3eeeeeeer3hPP015eeeeeer1#XXX", +"XXXX#3reeeeerr51::eeeeeeee1%XXXX", +"XXXXX#;errreeeeerrrreeeee;@XXXXX", +"XXXXoo+*rreeeeeerrrrere5*+XXXXXX", +"XXXXXXXo@=:eeeeerrrrr5*#oXXXXXXX", +"XXXXXXXXXo+&;:rrrr:-&@oXXXXXXXXX" +}; diff --git a/NPLib/Core/icons/clock.xpm b/NPLib/Core/icons/clock.xpm new file mode 100644 index 0000000000000000000000000000000000000000..921d2fc46ccaa5730776a1a1d54a65944de45cf6 --- /dev/null +++ b/NPLib/Core/icons/clock.xpm @@ -0,0 +1,138 @@ +/* XPM */ +static char *clock[] = { +/* columns rows colors chars-per-pixel */ +"32 32 100 2 ", +" c #353535", +". c #373737", +"X c #3D3D3D", +"o c #3E3E3E", +"O c #525250", +"+ c #5D5D59", +"@ c #4B5A71", +"# c #576478", +"$ c #5D6A7C", +"% c #676763", +"& c #686863", +"* c #6B6B66", +"= c #6E6E69", +"- c #70706B", +"; c #C65959", +": c #C75A5A", +"> c #C75B5B", +", c #C66060", +"< c #C66261", +"1 c #C86262", +"2 c #C96564", +"3 c #C56867", +"4 c #C46C6A", +"5 c #CA6968", +"6 c #CB6E6C", +"7 c #C57572", +"8 c #CB7370", +"9 c #C87B77", +"0 c #CD7B78", +"q c #CD7E7A", +"w c #C1817D", +"e c #CE817D", +"r c #677280", +"t c #687483", +"y c #6A7583", +"u c #77818D", +"i c #8A8A83", +"p c #808993", +"a c #9F9F96", +"s c #A6A69C", +"d c #BFA99F", +"f c #A7AAA6", +"g c #A9ACA8", +"h c #B2B2A7", +"j c #BCBCB2", +"k c #B9BDB8", +"l c #C08984", +"z c #C08A84", +"x c #C08E88", +"c c #CB948E", +"v c #D1928C", +"b c #C09790", +"n c #C59D95", +"m c #CA9891", +"M c #D39D96", +"N c #C0A299", +"B c #D4A29A", +"V c #D4A39B", +"C c #C0A9A0", +"Z c #C3AEA5", +"A c #D7AEA5", +"S c #D7AFA5", +"D c #C6B1A7", +"F c #C3B2A8", +"G c #CCBAAF", +"H c #D1B5AB", +"J c #D0B8AE", +"K c #D7BAAF", +"L c #C5BFB4", +"P c #D9BAB0", +"I c #D9BCB1", +"U c #BEC1BB", +"Y c #C1C1B5", +"T c #C3C3B8", +"R c #CAC7BA", +"E c #CDCCBF", +"W c #D6C0B5", +"Q c #DBC5B9", +"! c #DCCBBE", +"~ c #CDCCC0", +"^ c #CDCDC0", +"/ c #CECEC1", +"( c #CECFC2", +") c #D0D0C2", +"_ c #D0D2C7", +"` c #DDD0C3", +"' c #DDD3C5", +"] c #DED3C5", +"[ c #D5D7C8", +"{ c #D6D7CA", +"} c #D9DACB", +"| c #DFD9CB", +" . c #DADBCD", +".. c #DBDBCE", +"X. c #DEDED0", +"o. c #DEDFD0", +"O. c #DFE0D1", +"+. c #E1E0D1", +"@. c #E1E1D1", +"#. c #E0E2D3", +/* pixels */ +". . . . . . . . . X + i h ^ X.+.+.X.^ h i + X . . . . . . . . . ", +". . . . . . . X = g ^ X.+.X.X.+.+.+.+.+.X._ g % X . . . . . . . ", +". . . . . . O a ] +.@.@.+.+.X.+.+.+.+.+.+.+.+.[ a O . . . . . . ", +". . . . . % Y +.+.X.@.@.@.+.+.+.+.+.+.+.+.+.+.+.+.L % . . . . . ", +". . . . = ^ +.+.@.@.X.@.@.| ] ] ] ] ] X.+.+.O.+.+.+.^ = . . . . ", +". . . & E +.+.+.@.@.@.P M l 5 3 5 5 q M Q X.+.+.+.+.+.^ % . . . ", +". . O Y +.+.+.+.@.` v 2 : : > , < , > ; 5 v ` +.+.+.+.+.j O . . ", +". X a +.+.+.O.+.P 8 : , 8 x d d Z d x 7 < > 5 P +.+.+.X.X.a X . ", +". & [ +.+.+.+.P 5 > 3 b T ^ [ X.| [ E Y b 4 > 5 P +.+.O.+.| = . ", +"X s +.+.+.+.] 8 > 7 D ^ O.O.+.+.+.+.+.X.E D 7 > 8 ] +.O.+.+.f X ", +"+ ) +.+.O.X.v > 5 h | O.O.O.O.X.[ X.O.O.+.| D 5 > v ] +.O.O.^ + ", +"i X.+.+.O.Q 5 > m | O.O.O.O.[ r u [ O.+.X.+.| N > 5 Q O.O.O.X.i ", +"h +.O.+.O.M > 7 _ +.+.+.O.O.[ # $ ) +.O.+.O.+.E 7 > M +.O.+.+.h ", +"^ +.+.+.| e > m O.+.+.+.+.+.) r $ [ O.O.+.O.+.X.m > e | O.O.X._ ", +"+.+.X.+.] 5 < H O.+.+.O.+.+.[ # r [ +.O.O.+.+.O.H < 5 ] +.+.+.O.", +"+.+.+.+.] 5 < W +.+.+.+.+.+.^ r # k +.+.+.+.O.+.W < 5 ] +.O.+.O.", +"+.+.X.+.] 5 5 W +.+.X.+.X.O.[ r @ r k X.| O.O.#.W 3 < ] O.O.+.+.", +"X.+.+.+.] 5 , P +.+.+.+.+.X.X.h r @ t U O.O.O.#.I 2 8 ] O.O.O.O.", +"E +.+.X.] 0 ; M O.+.X.+.+.+.+.[ f r @ t ^ O.+.+.V > 9 ] +.+.+._ ", +"h +.X.+.+.c > 0 | +.+.+.+.X.+.+.) f r @ u O.+.] e > c | +.O.O.h ", +"i +.+.+.O.G 4 < H +.+.+.+.+.+.+.O.[ g r u +.| S , < G +.+.+.O.i ", +"+ ) +.X.O.] l > 8 W +.+.+.X.X.+.O.O.] j T O.] 8 > z ] +.X.+._ + ", +"X h +.+.O.X.W 4 > e ! +.+.+.+.+.O.O.+.O.O.Q e > 3 G O.O.X.O.f X ", +" & | +.O.X.| N < > 8 S | +.+.+.O.O.O.O.H 8 > < Z O.+.+.+.] & ", +". X a O.O.+.+._ d 4 ; < 0 B P Q Q K V 0 < > 4 d ) +.+.+.+.s X . ", +". . O j O.O.+.O.| D w < ; ; < 1 < < > ; < w D | +.+.+.+.Y O . . ", +". . . & E X.+.+.+.| R h l 4 4 < 4 4 9 l d T | O.+.+.+.E % . . . ", +". . . . - _ +.+.+.+.| X.E Y U Z j D Y E | X.O.+.+.+._ = . . . . ", +". . . . & Y +.X.X.O.+.O.O.| X.| | X.X.+.+.+.X.| j % . . . . . ", +". . . . X O a | X.+.+.O.O.+.X.X.X.+.X.+.X.+.| s O . . . . . . ", +". . . . X X % s E X.+.+.+.+.+.+.+.+.] E f % X . . . . . . . ", +". . . . . X X X + i h _ X.+.+.+.E h i + X . . . . . . . . . " +}; diff --git a/NPLib/Core/icons/download.png b/NPLib/Core/icons/download.png new file mode 100644 index 0000000000000000000000000000000000000000..8a467867e011c0a07f8f25d1954409a7f520212e Binary files /dev/null and b/NPLib/Core/icons/download.png differ diff --git a/NPLib/Core/icons/download.xpm b/NPLib/Core/icons/download.xpm new file mode 100644 index 0000000000000000000000000000000000000000..e1fa315419eae97f7ac3bf7f40af3775d632d988 --- /dev/null +++ b/NPLib/Core/icons/download.xpm @@ -0,0 +1,110 @@ +/* XPM */ +static char *download[] = { +/* columns rows colors chars-per-pixel */ +"32 32 72 1 ", +" c #373635", +". c #373737", +"X c #37383A", +"o c #37393B", +"O c #354350", +"+ c #33495D", +"@ c #324E68", +"# c #315271", +"$ c #2E6293", +"% c #2E6294", +"& c #2C6EAB", +"* c #2B72B4", +"= c #297AC6", +"- c #2882D5", +"; c #1786EE", +": c #1C8AF2", +"> c #1E8EF7", +", c #2689E5", +"< c #2689E6", +"1 c #268AE7", +"2 c #258AE9", +"3 c #268BEA", +"4 c #268DEE", +"5 c #338FE6", +"6 c #3590E6", +"7 c #258FF2", +"8 c #208FF8", +"9 c #2892F5", +"0 c #2592F9", +"q c #2193FF", +"w c #2496FF", +"e c #2596FF", +"r c #2B98FF", +"t c #2E9AFF", +"y c #329CFF", +"u c #399FFF", +"i c #3EA2FF", +"p c #53A1EB", +"a c #45A5FF", +"s c #55A6F1", +"d c #52ABFF", +"f c #57AEFF", +"g c #5FB1FF", +"h c #71B0EB", +"j c #77B5EF", +"k c #61ABF1", +"l c #60B2FF", +"z c #64B4FF", +"x c #73B6F4", +"c c #74BCFF", +"v c #78BEFF", +"b c #8BBEEE", +"n c #9CC8F2", +"m c #97CCFF", +"M c #AACFF2", +"N c #A0D1FF", +"B c #A9D5FF", +"V c #ABD6FF", +"C c #ADD7FF", +"Z c #B7D7F4", +"A c #B8DAF9", +"S c #B8DDFF", +"D c #C3DDF6", +"F c #C6E3FF", +"G c #DBEDFF", +"H c #E1EEFA", +"J c #E4F0FA", +"K c #E6F3FF", +"L c #E8F4FF", +"P c #F6FAFE", +"I c #F6FBFF", +"U c #F9FCFE", +/* pixels */ +"........ X+%=18w881=%@X X XX ", +".......X@*3wwwwwrwwr82*@X X X", +"......O&2wwwwwrwwww8www2&OXX XX ", +".....@-wwwwww8wwwrwwwwwww=@X X ", +"..XX#,wwwwwrwwwwww8wrwwrww<# X ", +".X.@,wwwww8www8ww8wwwwwwwww<@ X", +"X.O=wwwwwwrw8wwwwrwww8r8wwww=O X", +"..&wwwwwwwwwffww8wllwwwwwwwwr&X ", +".@7wwww8wwyCUHawwiKUCiwwwwrww2@.", +".*www>wwwaDUUKuwwiKUUDuwww8rww*.", +"+2wwwwwwrCUUUKu7wuKUUUCr8wwwww2@", +"%w7wwwwwlUUUUKuwwiHUUUUlwww87ww$", +"=www7wwyCUUUUKuwwiKUUUUCwrwwwww=", +",wwwwtvFUUUMnjwwwwjbMUUGy8w8www1", +"wwwwtNUUUUUk;>wwww:;kUUKdwwrw8w8", +"www>vUUUUUUGiwwwwwwaGUUUKDfwwwwr", +"wwwyFUUUUUUUSywww8rSUUUUUUKlrwww", +"7wwuKUUUUUUUUmrwwrmUUUUUUUUSrwww", +"<wwuKUUUUUUUUUcwwvUUUUUUUUUKy7w<", +"=wwyFUUUUUUUUUKllKUUUUUUUUUKuww=", +"%ww8xUUUUUUUUUUUUUUUUUUUUUUAwww$", +"+2ww7nUUUUUUUUUUUUUUUUUUUUHswr<+", +"X*www2hDKHHKKKHHKKHKKKKJKZp>ww*.", +" @7www415665666555556656527ww2@ ", +" X&wwww88888w88888888888wwwww&XX", +"X +=wwwwww8rwwrwwwwwwwwwwwww=+ ", +" @1wwwww8wwwwwwwwwwrwwwww1@XX ", +"X X #1wwwrwwwww8rwwwwwwwww1@ X", +" X @=wwwwwr8wwwwwwww8ww=@ X ", +" XX O&2rwwwwwwww8wwww7&OX X X", +"X X XXX@*18wwrwwrwww<*@X XX X ", +"X X X X@%=18w881=%+X XX X X " +}; diff --git a/NPLib/Core/icons/plugin.png b/NPLib/Core/icons/plugin.png new file mode 100644 index 0000000000000000000000000000000000000000..cf0f9b077a7f68da6aece12f6a5f58c21a72eb68 Binary files /dev/null and b/NPLib/Core/icons/plugin.png differ diff --git a/NPLib/Core/icons/plugin.xpm b/NPLib/Core/icons/plugin.xpm new file mode 100644 index 0000000000000000000000000000000000000000..4b9037ba156ed5e7ea161ac19de9865cc108e4ce --- /dev/null +++ b/NPLib/Core/icons/plugin.xpm @@ -0,0 +1,102 @@ +/* XPM */ +static char *plugin[] = { +/* columns rows colors chars-per-pixel */ +"32 32 64 1 ", +" c #373737", +". c #383939", +"X c #3F4846", +"o c #43524E", +"O c #465954", +"+ c #475A55", +"@ c #49605A", +"# c #4A5669", +"$ c #4E5B72", +"% c #505F74", +"& c #54776F", +"* c #516175", +"= c #516875", +"- c #546F78", +"; c #556F7C", +": c #57747E", +"> c #577A7C", +", c #5C887D", +"< c #597982", +"1 c #5B7D86", +"2 c #5B8183", +"3 c #5F8E82", +"4 c #5E858B", +"5 c #60898D", +"6 c #70838D", +"7 c #61928D", +"8 c #649A8D", +"9 c #7C8690", +"0 c #639192", +"q c #659D93", +"w c #659994", +"e c #66A095", +"r c #69A596", +"t c #6BA59E", +"y c #6BAA9D", +"u c #6EAFA1", +"i c #6EB1A0", +"p c #6FB3A2", +"a c #73B2A1", +"s c #70B6A4", +"d c #72B9A7", +"f c #72B6A8", +"g c #72B7A8", +"h c #72BAA8", +"j c #75BFAD", +"k c #79BAAB", +"l c #76C2AF", +"z c #76C3B0", +"x c #7AC3B0", +"c c #90B3A8", +"v c #97BCAD", +"b c #98C3B5", +"n c #93CAB8", +"m c #9ECDBC", +"M c #A1CEBD", +"N c #B0C8B9", +"B c #B6D4C3", +"V c #C4D8C8", +"C c #D0D2C7", +"Z c #D0D3C7", +"A c #D9DCCD", +"S c #DBE0D0", +"D c #E0E0D1", +"F c #E2E1D2", +/* pixels */ +" ..o&wpdllhp8&o.. ", +" .+3pzllllzzzzhp7O ", +" X,fzzjllllllzzzzzp,X ", +" OrzzzzzlllllzzzzzzzlrO ", +" Opzlzzzzzzhzllxlllllzzp+ ", +" OpzllzjjzhzxzllxMnllllzzpO ", +" XrzlllzzzzzzzzlxBFVxzlllllrX ", +" ,zzlllzzhzfuhzxBFAvzzzlllll, ", +" Ohzlllllllz0$1kBSAvpllllllllhO ", +" 3zllllllllzw$$6ZSvplllllllllz3.", +"opzzllllzzzh1#$$9cazzllllxlllzpo", +"&lzlllllzxh1$##$$1fzllllmVnllll&", +"8zllllllzf1$%$$#$$1dllzmAFmlllz8", +"pllllllzh4$%$%$$#$$1dxmFFNpllllp", +"hzlllllzu%$$%$%$$#$$1bSFNdlllllh", +"zzllllll5$$%$%$%$##$%9ZNadzllzzz", +"zzjzzzzz1$$$*$*$$*##$$6ylzzllzhz", +"hzzzzzzh2$*$$*$$*$$$#$$1hlzzllzh", +"pzzzzzzz0$*$$$$$$$$$##$$wlzzzzza", +"wzjzzzzzp*$$*$*$$*$*$-32plzzzzzw", +"&hxzzzzzh4$$*$**$*$$:yhphlllzzz&", +"opzzzzhzp:#$$$$$*$$:ylzzzlllzzpo", +".3zzzzhp<$->=$$$$$>yllllzzllzz3.", +".Ohzzzz0$-wpw2::17plllllzzllzhO ", +". 3zzzzr2rfzlhpudhllllllzzzzz,. ", +" XrzzzhphzzllllllllllllllzzrX ", +" opzzzlllllllllllllllllzzpo ", +" +pzzlllllllllllllllllzpO. ", +" .orzllllllllllllllllzrO ", +" ..X2hlzllllllllllllh,X ", +" . O3plllllzzlllp7o. ", +" o&8plllhp8&o. " +}; diff --git a/NPLib/Core/icons/polaroid.xpm b/NPLib/Core/icons/polaroid.xpm new file mode 100644 index 0000000000000000000000000000000000000000..db6e3070bf65b7f2197adf4249c46dac7018d65a --- /dev/null +++ b/NPLib/Core/icons/polaroid.xpm @@ -0,0 +1,71 @@ +/* XPM */ +static char *polaroid[] = { +/* columns rows colors chars-per-pixel */ +"20 20 45 1 ", +" c #4B5970", +". c #4C5A70", +"X c #4D5B72", +"o c #4E5C72", +"O c #4F5D73", +"+ c #58667A", +"@ c #59667B", +"# c #5C697D", +"$ c #5E6B7F", +"% c #5F6B7F", +"& c #687487", +"* c #71AAC9", +"= c #72ABCB", +"- c #76B2D3", +"; c #76B2D4", +": c #76B3D4", +"> c #77B3D4", +", c #77B4D5", +"< c #7EB6D5", +"1 c #7FB7D6", +"2 c #7FB8D7", +"3 c #8C94A2", +"4 c #8C95A3", +"5 c #979EAB", +"6 c #87BCD9", +"7 c #88BDDA", +"8 c #89BDDA", +"9 c #B7D0DE", +"0 c #BCDAEA", +"q c #BDDAEA", +"w c #C4D6E1", +"e c #C5D7E1", +"r c #D4DDE4", +"t c #D4DEE5", +"y c #D5DEE5", +"u c #D6DFE6", +"i c #C9E1EE", +"p c #CAE1EE", +"a c #DDE0E4", +"s c #DEE6EC", +"d c #E1E3E7", +"f c #EAF1F6", +"g c #EFF6FA", +"h c white", +"j c None", +/* pixels */ +"jjjjjjj>>>>>>jjjjjjj", +"jjjjj>>>>>>>>>>jjjjj", +"jjj>>>>>>>>>>>>>>jjj", +"jj>>>>>>>>>>>>>>>>jj", +"jj>>10iipppeii01>>jj", +"j>>>6s53344335s6>>>j", +"j>>>7t#OOOO O#t7>>>j", +">>>>7t#OOOOOO#t7>>>>", +">>1=8u$oOOOOO+r6>>>>", +">>>18u$oOOOOO&r6>>>>", +">>--8u$oOOOOO+r6>>>>", +">>--8r$oOOOO &t6>>>>", +">>>>7u&@@@@@+&t7>>>>", +"j>>>8fduauduudf6>>>j", +"j>>>6fhhhhhhhhg6>>>j", +"jj>>19wwwwwwww91>>jj", +"jj>>>======*=*=>>>jj", +"jjj>>>>>>>>>>>>>>jjj", +"jjjjj>>>>>>>>>>jjjjj", +"jjjjjjj>>>>>>jjjjjjj" +}; diff --git a/NPLib/Core/icons/power.png b/NPLib/Core/icons/power.png new file mode 100644 index 0000000000000000000000000000000000000000..ad5101afd834f41db3c2a491d4b794fd100e6e35 Binary files /dev/null and b/NPLib/Core/icons/power.png differ diff --git a/NPLib/Core/icons/power.xbm b/NPLib/Core/icons/power.xbm new file mode 100644 index 0000000000000000000000000000000000000000..2fd52e56f9e2ad912f069b3ea684b133d39f4a5e --- /dev/null +++ b/NPLib/Core/icons/power.xbm @@ -0,0 +1,117 @@ +#define power_width 128 +#define power_height 128 +static unsigned short power_bits[] = { + 0x0000, 0x0000, 0x0000, 0xffc0, 0x03ff, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0xfffe, 0x7fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xc000, 0xffff, 0xffff, 0x0003, 0x0000, 0x0000, 0x0000, 0x0000, 0xf800, + 0xffff, 0xffff, 0x001f, 0x0000, 0x0000, 0x0000, 0x0000, 0xff00, 0xffff, + 0xffff, 0x00ff, 0x0000, 0x0000, 0x0000, 0x0000, 0xffc0, 0xffff, 0xffff, + 0x03ff, 0x0000, 0x0000, 0x0000, 0x0000, 0xfff8, 0xffff, 0xffff, 0x1fff, + 0x0000, 0x0000, 0x0000, 0x0000, 0xfffe, 0xffff, 0xffff, 0x7fff, 0x0000, + 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, + 0x0000, 0xc000, 0xffff, 0xffff, 0xffff, 0xffff, 0x0003, 0x0000, 0x0000, + 0xf000, 0xffff, 0xffff, 0xffff, 0xffff, 0x000f, 0x0000, 0x0000, 0xf800, + 0xffff, 0xffff, 0xffff, 0xffff, 0x001f, 0x0000, 0x0000, 0xfc00, 0xffff, + 0xffff, 0xffff, 0xffff, 0x003f, 0x0000, 0x0000, 0xff00, 0xffff, 0xffff, + 0xffff, 0xffff, 0x00ff, 0x0000, 0x0000, 0xff80, 0xffff, 0xffff, 0xffff, + 0xffff, 0x01ff, 0x0000, 0x0000, 0xffc0, 0xffff, 0xffff, 0xffff, 0xffff, + 0x03ff, 0x0000, 0x0000, 0xffe0, 0xffff, 0xffff, 0xffff, 0xffff, 0x07ff, + 0x0000, 0x0000, 0xfff0, 0xffff, 0xffff, 0xffff, 0xffff, 0x0fff, 0x0000, + 0x0000, 0xfff8, 0xffff, 0xffff, 0xffff, 0xffff, 0x1fff, 0x0000, 0x0000, + 0xfffc, 0xffff, 0xffff, 0xffff, 0xffff, 0x3fff, 0x0000, 0x0000, 0xfffe, + 0xffff, 0x3fff, 0xfffc, 0xffff, 0x7fff, 0x0000, 0x0000, 0xffff, 0xffff, + 0x1fff, 0xfff8, 0xffff, 0xffff, 0x0000, 0x8000, 0xffff, 0xffff, 0x0fff, + 0xfff0, 0xffff, 0xffff, 0x0001, 0xc000, 0xffff, 0xffff, 0x0fff, 0xfff0, + 0xffff, 0xffff, 0x0003, 0xe000, 0xffff, 0xffff, 0x0fff, 0xfff0, 0xffff, + 0xffff, 0x0007, 0xe000, 0xffff, 0xffff, 0x0fff, 0xfff0, 0xffff, 0xffff, + 0x0007, 0xf000, 0xffff, 0xffff, 0x0fff, 0xfff0, 0xffff, 0xffff, 0x000f, + 0xf800, 0xffff, 0xffff, 0x0fff, 0xfff0, 0xffff, 0xffff, 0x001f, 0xfc00, + 0xffff, 0xffff, 0x0fff, 0xfff0, 0xffff, 0xffff, 0x003f, 0xfc00, 0xffff, + 0xffff, 0x0fff, 0xfff0, 0xffff, 0xffff, 0x003f, 0xfe00, 0xffff, 0xffff, + 0x0fff, 0xfff0, 0xffff, 0xffff, 0x007f, 0xfe00, 0xffff, 0xffff, 0x0fff, + 0xfff0, 0xffff, 0xffff, 0x007f, 0xff00, 0xffff, 0x3fff, 0x0ffd, 0x1ff0, + 0xfffc, 0xffff, 0x00ff, 0xff80, 0xffff, 0x1fff, 0x0ff8, 0x1ff0, 0xfff8, + 0xffff, 0x01ff, 0xff80, 0xffff, 0x07ff, 0x0ff8, 0x0ff0, 0xffe0, 0xffff, + 0x01ff, 0xffc0, 0xffff, 0x03ff, 0x0ff0, 0x0ff0, 0xffc0, 0xffff, 0x03ff, + 0xffc0, 0xffff, 0x00ff, 0x0ff0, 0x07f0, 0xff00, 0xffff, 0x03ff, 0xffc0, + 0xffff, 0x00ff, 0x0ff0, 0x0ff0, 0xff00, 0xffff, 0x03ff, 0xffe0, 0xffff, + 0x003f, 0x0ff8, 0x0ff0, 0xfc00, 0xffff, 0x07ff, 0xffe0, 0xffff, 0x003f, + 0x0ffc, 0x3ff0, 0xfc00, 0xffff, 0x07ff, 0xfff0, 0xffff, 0x000f, 0x0ffe, + 0x7ff0, 0xf000, 0xffff, 0x0fff, 0xfff0, 0xffff, 0x800f, 0x0fff, 0xfff0, + 0xf001, 0xffff, 0x0fff, 0xfff0, 0xffff, 0xc007, 0x0fff, 0xfff0, 0xe003, + 0xffff, 0x0fff, 0xfff8, 0xffff, 0xe003, 0x0fff, 0xfff0, 0xc007, 0xffff, + 0x1fff, 0xfff8, 0xffff, 0xf003, 0x0fff, 0xfff0, 0xc00f, 0xffff, 0x1fff, + 0xfff8, 0xffff, 0xf801, 0x0fff, 0xfff0, 0x801f, 0xffff, 0x1fff, 0xfffc, + 0xffff, 0xfc00, 0x0fff, 0xfff0, 0x003f, 0xffff, 0x3fff, 0xfffc, 0xffff, + 0xfc00, 0x0fff, 0xfff0, 0x007f, 0xffff, 0x3fff, 0xfffc, 0x7fff, 0xfe00, + 0x0fff, 0xfff0, 0x007f, 0xfffe, 0x3fff, 0xfffe, 0x7fff, 0xff00, 0x0fff, + 0xfff0, 0x00ff, 0xfffe, 0x7fff, 0xfffe, 0x7fff, 0xff80, 0x0fff, 0xfff0, + 0x00ff, 0xfffe, 0x7fff, 0xfffe, 0x3fff, 0xff80, 0x0fff, 0xfff0, 0x01ff, + 0xfffc, 0x7fff, 0xfffe, 0x3fff, 0xffc0, 0x0fff, 0xfff0, 0x03ff, 0xfffc, + 0x7fff, 0xfffe, 0x3fff, 0xffc0, 0x0fff, 0xfff0, 0x03ff, 0xfff8, 0x7fff, + 0xffff, 0x1fff, 0xffc0, 0x0fff, 0xfff0, 0x03ff, 0xfff8, 0xffff, 0xffff, + 0x1fff, 0xffe0, 0x0fff, 0xfff0, 0x07ff, 0xfff8, 0xffff, 0xffff, 0x1fff, + 0xffe0, 0x0fff, 0xfff0, 0x07ff, 0xfff8, 0xffff, 0xffff, 0x0fff, 0xffe0, + 0x0fff, 0xfff0, 0x07ff, 0xfff0, 0xffff, 0xffff, 0x1fff, 0xfff0, 0x0fff, + 0xfff0, 0x07ff, 0xfff8, 0xffff, 0xffff, 0x0fff, 0xffe0, 0x0fff, 0xfff0, + 0x0fff, 0xfff0, 0xffff, 0xffff, 0x0fff, 0xfff0, 0x0fff, 0xfff0, 0x0fff, + 0xfff0, 0xffff, 0xffff, 0x0fff, 0xfff0, 0x0fff, 0xfff0, 0x0fff, 0xfff0, + 0xffff, 0xffff, 0x0fff, 0xfff0, 0x0fff, 0xfff0, 0x0fff, 0xfff0, 0xffff, + 0xffff, 0x0fff, 0xfff0, 0x0fff, 0xfff0, 0x0fff, 0xfff0, 0xffff, 0xffff, + 0x0fff, 0xfff0, 0x0fff, 0xfff0, 0x0fff, 0xfff0, 0xffff, 0xffff, 0x0fff, + 0xfff0, 0x0fff, 0xfff0, 0x0fff, 0xfff0, 0xffff, 0xffff, 0x0fff, 0xfff0, + 0x1fff, 0xfff8, 0x0fff, 0xfff0, 0xffff, 0xffff, 0x0fff, 0xfff0, 0x3fff, + 0xfffc, 0x0fff, 0xfff0, 0xffff, 0xffff, 0x0fff, 0xfff0, 0xffff, 0xffff, + 0x07ff, 0xfff0, 0xffff, 0xffff, 0x1fff, 0xffe0, 0xffff, 0xffff, 0x0fff, + 0xfff0, 0xffff, 0xffff, 0x0fff, 0xffe0, 0xffff, 0xffff, 0x07ff, 0xfff8, + 0xffff, 0xffff, 0x1fff, 0xffe0, 0xffff, 0xffff, 0x07ff, 0xfff8, 0xffff, + 0xffff, 0x1fff, 0xffe0, 0xffff, 0xffff, 0x07ff, 0xfff8, 0xffff, 0xffff, + 0x1fff, 0xffc0, 0xffff, 0xffff, 0x03ff, 0xfff8, 0xffff, 0xfffe, 0x3fff, + 0xffc0, 0xffff, 0xffff, 0x03ff, 0xfffc, 0x7fff, 0xfffe, 0x3fff, 0xff80, + 0xffff, 0xffff, 0x01ff, 0xfffc, 0x7fff, 0xfffe, 0x3fff, 0xff80, 0xffff, + 0xffff, 0x01ff, 0xfffc, 0x7fff, 0xfffe, 0x7fff, 0xff00, 0xffff, 0xffff, + 0x01ff, 0xfffc, 0x7fff, 0xfffe, 0x7fff, 0xff00, 0xffff, 0xffff, 0x00ff, + 0xfffe, 0x7fff, 0xfffc, 0x7fff, 0xfe00, 0xffff, 0xffff, 0x007f, 0xffff, + 0x3fff, 0xfffc, 0xffff, 0xfc00, 0xffff, 0xffff, 0x003f, 0xffff, 0x3fff, + 0xfffc, 0xffff, 0xfc01, 0xffff, 0xffff, 0x003f, 0xffff, 0x3fff, 0xfff8, + 0xffff, 0xf801, 0xffff, 0xffff, 0x801f, 0xffff, 0x1fff, 0xfff8, 0xffff, + 0xf003, 0xffff, 0xffff, 0xc00f, 0xffff, 0x1fff, 0xfff8, 0xffff, 0xe003, + 0xffff, 0xffff, 0xc007, 0xffff, 0x1fff, 0xfff0, 0xffff, 0xc007, 0xffff, + 0xffff, 0xe003, 0xffff, 0x0fff, 0xfff0, 0xffff, 0x000f, 0xffff, 0xffff, + 0xf000, 0xffff, 0x0fff, 0xfff0, 0xffff, 0x001f, 0xfffe, 0x7fff, 0xf800, + 0xffff, 0x0fff, 0xffe0, 0xffff, 0x001f, 0xfff8, 0x1fff, 0xfc00, 0xffff, + 0x07ff, 0xffe0, 0xffff, 0x007f, 0xffe0, 0x07ff, 0xfc00, 0xffff, 0x07ff, + 0xffc0, 0xffff, 0x007f, 0xff80, 0x00ff, 0xff00, 0xffff, 0x03ff, 0xffc0, + 0xffff, 0x01ff, 0xe800, 0x0017, 0xff80, 0xffff, 0x03ff, 0xffc0, 0xffff, + 0x03ff, 0x0000, 0x0000, 0xffc0, 0xffff, 0x03ff, 0xff80, 0xffff, 0x07ff, + 0x0000, 0x0000, 0xffe0, 0xffff, 0x01ff, 0xff80, 0xffff, 0x1fff, 0x0000, + 0x0000, 0xfff8, 0xffff, 0x01ff, 0xff00, 0xffff, 0x7fff, 0x0000, 0x0000, + 0xfffc, 0xffff, 0x00ff, 0xfe00, 0xffff, 0xffff, 0x0000, 0x8000, 0xffff, + 0xffff, 0x007f, 0xfe00, 0xffff, 0xffff, 0x0007, 0xc000, 0xffff, 0xffff, + 0x007f, 0xfc00, 0xffff, 0xffff, 0x003f, 0xfc00, 0xffff, 0xffff, 0x003f, + 0xfc00, 0xffff, 0xffff, 0x05ff, 0xffa0, 0xffff, 0xffff, 0x003f, 0xf800, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x001f, 0xf000, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x000f, 0xe000, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0x0007, 0xe000, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0x0007, 0xc000, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0x0003, 0x8000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0x0001, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0x0000, 0x0000, 0xfffe, 0xffff, 0xffff, 0xffff, 0xffff, 0x7fff, 0x0000, + 0x0000, 0xfffc, 0xffff, 0xffff, 0xffff, 0xffff, 0x3fff, 0x0000, 0x0000, + 0xfff8, 0xffff, 0xffff, 0xffff, 0xffff, 0x1fff, 0x0000, 0x0000, 0xfff0, + 0xffff, 0xffff, 0xffff, 0xffff, 0x0fff, 0x0000, 0x0000, 0xffe0, 0xffff, + 0xffff, 0xffff, 0xffff, 0x07ff, 0x0000, 0x0000, 0xffc0, 0xffff, 0xffff, + 0xffff, 0xffff, 0x03ff, 0x0000, 0x0000, 0xff80, 0xffff, 0xffff, 0xffff, + 0xffff, 0x01ff, 0x0000, 0x0000, 0xff00, 0xffff, 0xffff, 0xffff, 0xffff, + 0x00ff, 0x0000, 0x0000, 0xfc00, 0xffff, 0xffff, 0xffff, 0xffff, 0x003f, + 0x0000, 0x0000, 0xf800, 0xffff, 0xffff, 0xffff, 0xffff, 0x001f, 0x0000, + 0x0000, 0xf000, 0xffff, 0xffff, 0xffff, 0xffff, 0x000f, 0x0000, 0x0000, + 0xc000, 0xffff, 0xffff, 0xffff, 0xffff, 0x0003, 0x0000, 0x0000, 0x0000, + 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0xfffe, + 0xffff, 0xffff, 0x7fff, 0x0000, 0x0000, 0x0000, 0x0000, 0xfff8, 0xffff, + 0xffff, 0x1fff, 0x0000, 0x0000, 0x0000, 0x0000, 0xffc0, 0xffff, 0xffff, + 0x03ff, 0x0000, 0x0000, 0x0000, 0x0000, 0xff00, 0xffff, 0xffff, 0x00ff, + 0x0000, 0x0000, 0x0000, 0x0000, 0xf800, 0xffff, 0xffff, 0x001f, 0x0000, + 0x0000, 0x0000, 0x0000, 0xc000, 0xffff, 0xffff, 0x0003, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0xfffe, 0x7fff, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0xffc0, 0x03ff, 0x0000, 0x0000, 0x0000 }; diff --git a/NPLib/Core/icons/power.xpm b/NPLib/Core/icons/power.xpm new file mode 100644 index 0000000000000000000000000000000000000000..cb98d663ca2ffdf5f661b1860f888459137ebe4a --- /dev/null +++ b/NPLib/Core/icons/power.xpm @@ -0,0 +1,93 @@ +/* XPM */ +static char *power[] = { +/* columns rows colors chars-per-pixel */ +"32 32 55 1 ", +" c #373737", +". c #393838", +"X c #493C3C", +"o c #533E3E", +"O c #5A4040", +"+ c #614242", +"@ c #7A4848", +"# c #8B4D4D", +"$ c #914E4E", +"% c #9E5151", +"& c #A95454", +"* c #B55757", +"= c #BE5757", +"- c #B65858", +"; c #B25E5E", +": c #BE5A5A", +"> c #B46565", +", c #B86969", +"< c #BD6B6B", +"1 c #BE7B7B", +"2 c #C15858", +"3 c #C75C5C", +"4 c #C85C5C", +"5 c #C95D5D", +"6 c #C86363", +"7 c #C86565", +"8 c #CD6E6E", +"9 c #CE6F6F", +"0 c #CE7171", +"q c #C47D7D", +"w c #C58888", +"e c #CE8D8D", +"r c #D48383", +"t c #D98F8F", +"y c #D99191", +"u c #D6A7A7", +"i c #DDBDBD", +"p c #E2ABAB", +"a c #E3BFBF", +"s c #E8BCBC", +"d c #E5C7C7", +"f c #EAC1C1", +"g c #E6CFCF", +"h c #E7CFCF", +"j c #EDCACA", +"k c #ECD7D7", +"l c #EDDCDC", +"z c #F0D3D3", +"x c #F4DEDE", +"c c #F0E1E1", +"v c #F4EAEA", +"b c #F8EBEB", +"n c #F9EFEF", +"m c #FDF9F9", +"M c white", +/* pixels */ +" o@%*3333*%@X. ", +" .o$:4443333333=$O. ", +" X#:44343333333344=#X ", +" O&433334333333333444&O ", +" O-44333344477333333334-+ ", +" O-4443333447jf7333333334-O ", +" X&43433334448bb04333333334&X ", +" #443333334730bb047733333333# ", +" O:4333333rjs78bb88kzr4433334:O ", +" $4333333tbMj78bb87kMbt4333334$ ", +"o-443333rbMi,20bb8=,aMbq333333:o", +"@3333337zMi-340bb033-iMk7333333@", +"%433333yMc,3330bb044=,xMt333333%", +"-433333fMu34338bb04433uMa333333-", +"3333337xMq43338vb84333qMx7333333", +"3333338bv843338vb833440bb8333333", +"3333438cv833336hd733448bb8333333", +"3333436xMr=3333**43342rmx7333333", +"-33344=aMp333333333343pMa333333*", +"%333333tMc833333333340cMe333333%", +"@333333,jMf7333333436dMh7333333@", +"o-333333qvMf83333340sMvq333333=X", +" $443333=wvMcpr08rpcMvw:333333$ ", +" O:433333:1hMMMbvMMMh1=3333343o ", +" #4333333:-wilvvliw*=3333334# ", +" X&43333333:&->>-**33333333&X ", +" O-3333333333:3:333333333=o ", +" +-43333333333333333333*o ", +" O&433333333333333334&o ", +" X#333333333333333:#X. ", +" X$-33333333343$o.. ", +" O@%-3333-%@o. " +}; diff --git a/NPLib/Core/icons/upload.png b/NPLib/Core/icons/upload.png new file mode 100644 index 0000000000000000000000000000000000000000..3ce606b0c1aecd8435021cac323b25f0fc5ef3fb Binary files /dev/null and b/NPLib/Core/icons/upload.png differ diff --git a/NPLib/Sharc/CMakeLists.txt b/NPLib/Sharc/CMakeLists.txt index 9a0962973444e1d83cfc49bba7e74624b641a4eb..5a10a9122d63b7af77974143e13ddd9ae6beb677 100644 --- a/NPLib/Sharc/CMakeLists.txt +++ b/NPLib/Sharc/CMakeLists.txt @@ -1,6 +1,6 @@ add_custom_command(OUTPUT TSharcPhysicsDict.cxx TSharcPhysicsDict_rdict.pcm TSharcPhysics.rootmap COMMAND ../scripts/build_dict.sh TSharcPhysics.h TSharcPhysicsDict.cxx TSharcPhysics.rootmap libNPSharc.dylib DEPENDS TSharcPhysics.h) add_custom_command(OUTPUT TSharcDataDict.cxx TSharcDataDict_rdict.pcm TSharcData.rootmap COMMAND ../scripts/build_dict.sh TSharcData.h TSharcDataDict.cxx TSharcData.rootmap libNPSharc.dylib DEPENDS TSharcData.h) -add_library(NPSharc SHARED TSharcData.cxx TSharcPhysics.cxx TSharcDataDict.cxx TSharcPhysicsDict.cxx ) +add_library(NPSharc SHARED TSharcSpectra.cxx TSharcData.cxx TSharcPhysics.cxx TSharcDataDict.cxx TSharcPhysicsDict.cxx ) target_link_libraries(NPSharc ${ROOT_LIBRARIES} NPCore) -install(FILES TSharcData.h TSharcPhysics.h DESTINATION ${CMAKE_INCLUDE_OUTPUT_DIRECTORY}) +install(FILES TSharcData.h TSharcPhysics.h TSharcSpectra.h DESTINATION ${CMAKE_INCLUDE_OUTPUT_DIRECTORY}) diff --git a/NPLib/Sharc/TSharcPhysics.cxx b/NPLib/Sharc/TSharcPhysics.cxx index 5239f4848e3c7c855ab7521134463a69a1d31a87..331ea832854737ed2cbd1280ef433aff05edb3c6 100644 --- a/NPLib/Sharc/TSharcPhysics.cxx +++ b/NPLib/Sharc/TSharcPhysics.cxx @@ -45,6 +45,7 @@ TSharcPhysics::TSharcPhysics(){ m_EventData = new TSharcData ; m_PreTreatedData = new TSharcData ; m_EventPhysics = this ; + m_Spectra = NULL; m_NumberOfDetector = 0 ; m_MaximumStripMultiplicityAllowed = 10; m_StripEnergyMatchingSigma = 0.060 ; @@ -604,7 +605,48 @@ void TSharcPhysics::ReadConfiguration(string Path){ InitializeStandardParameter(); ReadAnalysisConfig(); } +/////////////////////////////////////////////////////////////////////////// +void TSharcPhysics::InitSpectra(){ + m_Spectra = new TSharcSpectra(m_NumberOfDetector); +} + +/////////////////////////////////////////////////////////////////////////// +void TSharcPhysics::FillSpectra(){ + m_Spectra -> FillRawSpectra(m_EventData); + m_Spectra -> FillPreTreatedSpectra(m_PreTreatedData); + m_Spectra -> FillPhysicsSpectra(m_EventPhysics); +} +/////////////////////////////////////////////////////////////////////////// +void TSharcPhysics::CheckSpectra(){ + m_Spectra->CheckSpectra(); +} +/////////////////////////////////////////////////////////////////////////// +void TSharcPhysics::ClearSpectra(){ + // To be done +} +/////////////////////////////////////////////////////////////////////////// +map< vector<string> , TH1*> TSharcPhysics::GetSpectra() { + if(m_Spectra) + return m_Spectra->GetMapHisto(); + else{ + map< vector<string> , TH1*> empty; + return empty; + } +} +//////////////////////////////////////////////////////////////////////////////// +vector<TCanvas*> TSharcPhysics::GetCanvas() { + if(m_Spectra) + return m_Spectra->GetCanvas(); + else{ + vector<TCanvas*> empty; + return empty; + } +} +/////////////////////////////////////////////////////////////////////////// +void TSharcPhysics::WriteSpectra(){ + m_Spectra->WriteSpectra(); +} /////////////////////////////////////////////////////////////////////////// void TSharcPhysics::AddParameterToCalibrationManager(){ CalibrationManager* Cal = CalibrationManager::getInstance(); @@ -670,15 +712,14 @@ void TSharcPhysics::InitializeRootOutput(){ outputTree->Branch( "Sharc" , "TSharcPhysics" , &m_EventPhysics ); } - +//////////////////////////////////////////////////////////////////////////////// ///// Specific to SharcArray //// - void TSharcPhysics::AddBoxDetector(double Z){ double BOX_Wafer_Width = 52.20; // double BOX_Wafer_Length = 76.20; - double BOX_ActiveArea_Length = 72; - double BOX_ActiveArea_Width = 42; + double BOX_ActiveArea_Length = 76.2; + double BOX_ActiveArea_Width = 52.2; int BOX_Wafer_Back_NumberOfStrip = 48 ; int BOX_Wafer_Front_NumberOfStrip = 24 ; @@ -703,8 +744,6 @@ void TSharcPhysics::AddBoxDetector(double Z){ else if(i==3) {U=TVector3(0,1,0);V=TVector3(0,0,-1); Strip_1_1=TVector3(40.5,-36,Z+BOX_Wafer_Width/2.) ;} } -cout << Z-BOX_Wafer_Width/2. << endl; - // Buffer object to fill Position Array vector<double> lineX ; vector<double> lineY ; vector<double> lineZ ; @@ -735,7 +774,7 @@ cout << Z-BOX_Wafer_Width/2. << endl; m_StripPositionZ.push_back( OneBoxStripPositionZ ) ; } } - +//////////////////////////////////////////////////////////////////////////////// void TSharcPhysics::AddQQQDetector( double R,double Phi,double Z){ double QQQ_R_Min = 9.+R; diff --git a/NPLib/Sharc/TSharcPhysics.h b/NPLib/Sharc/TSharcPhysics.h index ce39f0b62409537475d650dce2c1fcbb802fee1f..107f734ef5c26fa82008d530a77e9198cd73bf60 100644 --- a/NPLib/Sharc/TSharcPhysics.h +++ b/NPLib/Sharc/TSharcPhysics.h @@ -27,195 +27,219 @@ // NPL #include "TSharcData.h" +#include "TSharcSpectra.h" #include "NPCalibrationManager.h" #include "NPVDetector.h" // ROOT #include "TVector2.h" #include "TVector3.h" #include "TObject.h" +#include "TCanvas.h" +// Forward declaration +class TSharcSpectra; + using namespace std ; class TSharcPhysics : public TObject, public NPL::VDetector { - public: - TSharcPhysics(); - ~TSharcPhysics() {}; - - public: - void Clear(); - void Clear(const Option_t*) {}; - - public: - vector < TVector2 > Match_Front_Back() ; - int CheckEvent(); - - public: - - // Provide Physical Multiplicity - Int_t EventMultiplicity; - - // Provide a Classification of Event - vector<int> EventType ; - - // Detector - vector<int> DetectorNumber ; - - // DSSD - vector<double> Strip_E ; - vector<double> Strip_T ; - vector<double> StripFront_E ; - vector<double> StripFront_T ; - vector<double> StripBack_E ; - vector<double> StripBack_T ; - vector<int> Strip_Front ; - vector<int> Strip_Back ; - - vector<double> PAD_E ; - vector<double> PAD_T ; - - public: // Innherited from VDetector Class - - // Read stream at ConfigFile to pick-up parameters of detector (Position,...) using Token - void ReadConfiguration(string) ; - - - // Add Parameter to the CalibrationManger - void AddParameterToCalibrationManager() ; - - // Activated associated Branches and link it to the private member DetectorData address - // In this method mother Branches (Detector) AND daughter leaf (fDetector_parameter) have to be activated - void InitializeRootInputRaw() ; - - // Activated associated Branches and link it to the private member DetectorPhysics address - // In this method mother Branches (Detector) AND daughter leaf (parameter) have to be activated - void InitializeRootInputPhysics() ; - - // Create associated branches and associated private member DetectorPhysics address - void InitializeRootOutput() ; - - // This method is called at each event read from the Input Tree. Aime is to build treat Raw dat in order to extract physical parameter. - void BuildPhysicalEvent() ; - - // Same as above, but only the simplest event and/or simple method are used (low multiplicity, faster algorythm but less efficient ...). - // This method aimed to be used for analysis performed during experiment, when speed is requiered. - // NB: This method can eventually be the same as BuildPhysicalEvent. - void BuildSimplePhysicalEvent() ; - - // Same as above but for online analysis - void BuildOnlinePhysicalEvent() {BuildPhysicalEvent();}; - - // Those two method all to clear the Event Physics or Data - void ClearEventPhysics() {Clear();} - void ClearEventData() {m_EventData->Clear();} - - public: // Specific to Sharc Array - - // Clear The PreTeated object - void ClearPreTreatedData() {m_PreTreatedData->Clear();} - - // Remove bad channel, calibrate the data and apply threshold - void PreTreat(); - - // Return false if the channel is disabled by user - // Frist argument is either "X","Y","SiLi","CsI" - bool IsValidChannel(const string DetectorType, const int telescope , const int channel); - - // Initialize the standard parameter for analysis - // ie: all channel enable, maximum multiplicity for strip = number of telescope - void InitializeStandardParameter(); - - // Read the user configuration file; if no file found, load standard one - void ReadAnalysisConfig(); - - // Add a Detector - void AddBoxDetector( double Z); - void AddQQQDetector( double R,double Phi,double Z); - - // Give and external TMustData object to TSharcPhysics. Needed for online analysis for example. - void SetRawDataPointer(TSharcData* rawDataPointer) {m_EventData = rawDataPointer;} - // Retrieve raw and pre-treated data - TSharcData* GetRawData() const {return m_EventData;} - TSharcData* GetPreTreatedData() const {return m_PreTreatedData;} - - // Use to access the strip position - double GetStripPositionX( const int N , const int Front , const int Back ) const{ return m_StripPositionX[N-1][Front-1][Back-1] ; } ; - double GetStripPositionY( const int N , const int Front , const int Back ) const{ return m_StripPositionY[N-1][Front-1][Back-1] ; } ; - double GetStripPositionZ( const int N , const int Front , const int Back ) const{ return m_StripPositionZ[N-1][Front-1][Back-1] ; } ; - - double GetNumberOfDetector() const { return m_NumberOfDetector; }; - - // To be called after a build Physical Event - int GetEventMultiplicity() const { return EventMultiplicity; }; - - TVector3 GetPositionOfInteraction(const int i) const; - TVector3 GetDetectorNormal(const int i) const; - - private: // Parameter used in the analysis - - // By default take EX and TY. - bool m_Take_E_Front;//! - bool m_Take_T_Back;//! - - - // Event over this value after pre-treatment are not treated / avoid long treatment time on spurious event - unsigned int m_MaximumStripMultiplicityAllowed ;//! - // Give the allowance in percent of the difference in energy between X and Y - double m_StripEnergyMatchingSigma ; //! - double m_StripEnergyMatchingNumberOfSigma ; //! - - // Threshold - double m_StripFront_E_RAW_Threshold ;//! - double m_StripFront_E_Threshold ;//! - double m_StripBack_E_RAW_Threshold ;//! - double m_StripBack_E_Threshold ;//! - double m_PAD_E_RAW_Threshold ;//! - double m_PAD_E_Threshold ;//! - - - - private: // Root Input and Output tree classes - - TSharcData* m_EventData;//! - TSharcData* m_PreTreatedData;//! - TSharcPhysics* m_EventPhysics;//! - - - private: // Map of activated channel - map< int, vector<bool> > m_FrontChannelStatus;//! - map< int, vector<bool> > m_BackChannelStatus;//! - map< int, vector<bool> > m_PADChannelStatus;//! - - private: // Spatial Position of Strip Calculated on bases of detector position - - int m_NumberOfDetector;//! - vector< vector < vector < double > > > m_StripPositionX;//! - vector< vector < vector < double > > > m_StripPositionY;//! - vector< vector < vector < double > > > m_StripPositionZ;//! - - public: // Static constructor to be passed to the Detector Factory - static NPL::VDetector* Construct(); - ClassDef(TSharcPhysics,1) // SharcPhysics structure + public: + TSharcPhysics(); + ~TSharcPhysics() {}; + + public: + void Clear(); + void Clear(const Option_t*) {}; + + public: + vector < TVector2 > Match_Front_Back() ; + int CheckEvent(); + + public: + + // Provide Physical Multiplicity + Int_t EventMultiplicity; + + // Provide a Classification of Event + vector<int> EventType ; + + // Detector + vector<int> DetectorNumber ; + + // DSSD + vector<double> Strip_E ; + vector<double> Strip_T ; + vector<double> StripFront_E ; + vector<double> StripFront_T ; + vector<double> StripBack_E ; + vector<double> StripBack_T ; + vector<int> Strip_Front ; + vector<int> Strip_Back ; + + vector<double> PAD_E ; + vector<double> PAD_T ; + + public: // Innherited from VDetector Class + + // Read stream at ConfigFile to pick-up parameters of detector (Position,...) using Token + void ReadConfiguration(string) ; + + + // Add Parameter to the CalibrationManger + void AddParameterToCalibrationManager() ; + + // Activated associated Branches and link it to the private member DetectorData address + // In this method mother Branches (Detector) AND daughter leaf (fDetector_parameter) have to be activated + void InitializeRootInputRaw() ; + + // Activated associated Branches and link it to the private member DetectorPhysics address + // In this method mother Branches (Detector) AND daughter leaf (parameter) have to be activated + void InitializeRootInputPhysics() ; + + // Create associated branches and associated private member DetectorPhysics address + void InitializeRootOutput() ; + + // This method is called at each event read from the Input Tree. Aime is to build treat Raw dat in order to extract physical parameter. + void BuildPhysicalEvent() ; + + // Same as above, but only the simplest event and/or simple method are used (low multiplicity, faster algorythm but less efficient ...). + // This method aimed to be used for analysis performed during experiment, when speed is requiered. + // NB: This method can eventually be the same as BuildPhysicalEvent. + void BuildSimplePhysicalEvent() ; + + // Same as above but for online analysis + void BuildOnlinePhysicalEvent() {BuildPhysicalEvent();}; + + // Those two method all to clear the Event Physics or Data + void ClearEventPhysics() {Clear();} + void ClearEventData() {m_EventData->Clear();} + + // Method related to the TSpectra classes, aimed at providing a framework for online applications + // Instantiate the Spectra class and the histogramm throught it + void InitSpectra(); + // Fill the spectra hold by the spectra class + void FillSpectra(); + // Used for Online mainly, perform check on the histo and for example change their color if issues are found + void CheckSpectra(); + // Used for Online only, clear all the spectra hold by the Spectra class + void ClearSpectra(); + // Write Spectra to file + void WriteSpectra(); + + public: // Specific to Sharc Array + + // Clear The PreTeated object + void ClearPreTreatedData() {m_PreTreatedData->Clear();} + + // Remove bad channel, calibrate the data and apply threshold + void PreTreat(); + + // Return false if the channel is disabled by user + // Frist argument is either "X","Y","SiLi","CsI" + bool IsValidChannel(const string DetectorType, const int telescope , const int channel); + + // Initialize the standard parameter for analysis + // ie: all channel enable, maximum multiplicity for strip = number of telescope + void InitializeStandardParameter(); + + // Read the user configuration file; if no file found, load standard one + void ReadAnalysisConfig(); + + // Add a Detector + void AddBoxDetector( double Z); + void AddQQQDetector( double R,double Phi,double Z); + + // Give and external TMustData object to TSharcPhysics. Needed for online analysis for example. + void SetRawDataPointer(TSharcData* rawDataPointer) {m_EventData = rawDataPointer;} + // Retrieve raw and pre-treated data + TSharcData* GetRawData() const {return m_EventData;} + TSharcData* GetPreTreatedData() const {return m_PreTreatedData;} + + // Use to access the strip position + double GetStripPositionX( const int N , const int Front , const int Back ) const{ return m_StripPositionX[N-1][Front-1][Back-1] ; } ; + double GetStripPositionY( const int N , const int Front , const int Back ) const{ return m_StripPositionY[N-1][Front-1][Back-1] ; } ; + double GetStripPositionZ( const int N , const int Front , const int Back ) const{ return m_StripPositionZ[N-1][Front-1][Back-1] ; } ; + + double GetNumberOfDetector() const { return m_NumberOfDetector; }; + + // To be called after a build Physical Event + int GetEventMultiplicity() const { return EventMultiplicity; }; + + TVector3 GetPositionOfInteraction(const int i) const; + TVector3 GetDetectorNormal(const int i) const; + + private: // Parameter used in the analysis + + // By default take EX and TY. + bool m_Take_E_Front;//! + bool m_Take_T_Back;//! + + + // Event over this value after pre-treatment are not treated / avoid long treatment time on spurious event + unsigned int m_MaximumStripMultiplicityAllowed ;//! + // Give the allowance in percent of the difference in energy between X and Y + double m_StripEnergyMatchingSigma ; //! + double m_StripEnergyMatchingNumberOfSigma ; //! + + // Threshold + double m_StripFront_E_RAW_Threshold ;//! + double m_StripFront_E_Threshold ;//! + double m_StripBack_E_RAW_Threshold ;//! + double m_StripBack_E_Threshold ;//! + double m_PAD_E_RAW_Threshold ;//! + double m_PAD_E_Threshold ;//! + + + + private: // Root Input and Output tree classes + + TSharcData* m_EventData;//! + TSharcData* m_PreTreatedData;//! + TSharcPhysics* m_EventPhysics;//! + + + private: // Map of activated channel + map< int, vector<bool> > m_FrontChannelStatus;//! + map< int, vector<bool> > m_BackChannelStatus;//! + map< int, vector<bool> > m_PADChannelStatus;//! + + private: // Spatial Position of Strip Calculated on bases of detector position + + int m_NumberOfDetector;//! + vector< vector < vector < double > > > m_StripPositionX;//! + vector< vector < vector < double > > > m_StripPositionY;//! + vector< vector < vector < double > > > m_StripPositionZ;//! + + private: // Spectra Class + TSharcSpectra* m_Spectra; // ! + + public: // Spectra Getter + map< vector<string> , TH1*> GetSpectra(); + vector<TCanvas*> GetCanvas(); + + public: // Static constructor to be passed to the Detector Factory + static NPL::VDetector* Construct(); + ClassDef(TSharcPhysics,1) // SharcPhysics structure }; namespace Sharc_LOCAL - { - // tranform an integer to a string - string itoa(unsigned int value); - // DSSD - // Front - double fStrip_Front_E(const TSharcData* Data, const int i); - double fStrip_Front_T(const TSharcData* Data, const int i); - - // Back - double fStrip_Back_E(const TSharcData* Data, const int i); - double fStrip_Back_T(const TSharcData* Data, const int i); - - // PAD - double fPAD_E(const TSharcData* Data, const int i); - double fPAD_T(const TSharcData* Data, const int i); - - } +{ + // tranform an integer to a string + string itoa(unsigned int value); + // DSSD + // Front + double fStrip_Front_E(const TSharcData* Data, const int i); + double fStrip_Front_T(const TSharcData* Data, const int i); + + // Back + double fStrip_Back_E(const TSharcData* Data, const int i); + double fStrip_Back_T(const TSharcData* Data, const int i); + + // PAD + double fPAD_E(const TSharcData* Data, const int i); + double fPAD_T(const TSharcData* Data, const int i); + +} #endif diff --git a/NPLib/Sharc/TSharcSpectra.cxx b/NPLib/Sharc/TSharcSpectra.cxx index 021084013ffc621c69a2bc1a3cc4f5391af51c76..a0177b8e16a622466f157e8b36baef3559427c19 100644 --- a/NPLib/Sharc/TSharcSpectra.cxx +++ b/NPLib/Sharc/TSharcSpectra.cxx @@ -67,31 +67,47 @@ TSharcSpectra::~TSharcSpectra(){ //////////////////////////////////////////////////////////////////////////////// void TSharcSpectra::InitRawSpectra(){ + string name; for (unsigned int i = 0; i < fNumberOfDetector; i++) { // loop on number of detectors + name = "SharcRaw"+NPL::itoa(i+1); + TCanvas* c1 = new TCanvas(name.c_str(),name.c_str()); + c1->Divide(3,2); + int i1 = 0; // STR_FRONT_E_RAW + c1->cd(++i1); name = "SHARC"+NPL::itoa(i+1)+"_STR_FRONT_E_RAW"; - AddHisto2D(name, name, fStripFront, 1, fStripFront+1, 512, 0, 8192, "SHARC/RAW/STR_FRONT_E"); + AddHisto2D(name, name, fStripFront, 1, fStripFront+1, 512, 0, 8192, "SHARC/RAW/STR_FRONT_E")->Draw("colz"); // STR_BACK_E_RAW + c1->cd(++i1); name = "SHARC"+NPL::itoa(i+1)+"_STR_BACK_E_RAW"; - AddHisto2D(name, name, fStripBack, 1, fStripBack+1, 512, 0, 8192, "SHARC/RAW/STR_BACK_E"); + AddHisto2D(name, name, fStripBack, 1, fStripBack+1, 512, 0, 8192, "SHARC/RAW/STR_BACK_E")->Draw("colz"); // PAD_E_RAW + c1->cd(++i1); name = "SHARC"+NPL::itoa(i+1)+"_PAD_E_RAW"; - AddHisto1D(name, name, 512, 0, 16384, "SHARC/RAW/PAD_E"); + AddHisto1D(name, name, 512, 0, 16384, "SHARC/RAW/PAD_E")->Draw(""); // STR_FRONT_RAW_MULT + c1->cd(++i1); name = "SHARC"+NPL::itoa(i+1)+"_STR_FRONT_RAW_MULT"; - AddHisto1D(name, name, fStripFront, 1, fStripFront+1, "SHARC/RAW/MULT"); - + AddHisto1D(name, name, fStripFront, 1, fStripFront+1, "SHARC/RAW/MULT")->Draw(""); + gPad->SetLogy(); + // STR_BACK_RAW_MULT + c1->cd(++i1); name = "SHARC"+NPL::itoa(i+1)+"_STR_BACK_RAW_MULT"; - AddHisto1D(name, name, fStripFront, 1, fStripFront+1, "SHARC/RAW/MULT"); + AddHisto1D(name, name, fStripFront, 1, fStripFront+1, "SHARC/RAW/MULT")->Draw(""); + gPad->SetLogy(); // PAD_RAW_MULT + c1->cd(++i1); name = "SHARC"+NPL::itoa(i+1)+"_PAD_RAW_MULT"; - AddHisto1D(name, name, fNumberOfDetector, 1, fNumberOfDetector+1, "SHARC/RAW/MULT"); + AddHisto1D(name, name, fNumberOfDetector, 1, fNumberOfDetector+1, "SHARC/RAW/MULT")->Draw(""); + gPad->SetLogy(); + + AddCanvas(c1); } // end loop on number of detectors } diff --git a/NPLib/Utility/CMakeLists.txt b/NPLib/Utility/CMakeLists.txt index 1fcab31d014f5dac2874796afc8a71a45b3a5f32..2263ce4d87154df849aad832a2e8939f720cdcb4 100644 --- a/NPLib/Utility/CMakeLists.txt +++ b/NPLib/Utility/CMakeLists.txt @@ -2,4 +2,6 @@ add_executable(nptool-installer nptool-installer.cxx) target_link_libraries(nptool-installer ${ROOT_LIBRARIES} NPCore) add_executable(npanalysis npanalysis.cxx) target_link_libraries(npanalysis ${ROOT_LIBRARIES} NPCore NPInitialConditions NPInteractionCoordinates) -install(PROGRAMS nptool-installer npanalysis DESTINATION ${CMAKE_BINARY_OUTPUT_DIRECTORY}) +add_executable(nponline nponline.cxx) +target_link_libraries(nponline ${ROOT_LIBRARIES} NPCore) +install(PROGRAMS nptool-installer npanalysis nponline DESTINATION ${CMAKE_BINARY_OUTPUT_DIRECTORY}) diff --git a/NPLib/Utility/npanalysis.cxx b/NPLib/Utility/npanalysis.cxx index 9b115d43e87eeeaf4c0f892385758f8e2949f286..afb4f98d20c3b46d77ed4984379a1678830091b7 100644 --- a/NPLib/Utility/npanalysis.cxx +++ b/NPLib/Utility/npanalysis.cxx @@ -99,6 +99,12 @@ int main(int argc , char** argv){ } } + if(myOptionManager->GetOnline()){ + // Request Detector manager to give the Spectra to the server + myDetector->SetSpectraServer(); + + } + std::cout << std::endl << "///////// Starting Analysis ///////// "<< std::endl; TChain* Chain = RootInput:: getInstance()->GetChain(); myOptionManager->GetNumberOfEntryToAnalyse(); diff --git a/NPLib/Utility/nponline.cxx b/NPLib/Utility/nponline.cxx new file mode 100644 index 0000000000000000000000000000000000000000..5451e11d08e981e453b4ccc01eb63a6ed8492ed2 --- /dev/null +++ b/NPLib/Utility/nponline.cxx @@ -0,0 +1,15 @@ +#include"TApplication.h" +#include"NPOnline.h" + +int main(int argc , char** argv){ + TApplication* app = new TApplication("NPOnline",0,0); + if(argc==3){ + NPL::NPOnline* instance = new NPL::NPOnline(argv[1],atoi(argv[2])); + } + else{ + NPL::NPOnline* instance = new NPL::NPOnline(); + } + app->Run(); + return 0; +} + diff --git a/NPLib/scripts/NPToolLogon.C b/NPLib/scripts/NPToolLogon.C index 2cc2fbe20d9e533f42098d82bead8501dd31d7d0..fbec3b59098a47d96c15f1a091b475a6ca34a5a3 100644 --- a/NPLib/scripts/NPToolLogon.C +++ b/NPLib/scripts/NPToolLogon.C @@ -55,6 +55,8 @@ void NPToolLogon(){ // Create the NPTool Stype TString NPLPath = gSystem->Getenv("NPTOOL"); gROOT->ProcessLine(Form(".x %s/NPLib/scripts/Style_nptool.C",NPLPath.Data())); + gROOT->ProcessLine(Form(".x %s/NPLib/scripts/Style_nponline.C",NPLPath.Data())); + // Change the standard random generator to TRandom2