/Users/proj/cdc/soft/yoka/src/tmp/tmp diff -uNr yokaRawMonNeo.ORIG/gui/GEMHist.cxx yokaRawMonNeo/gui/GEMHist.cxx --- yokaRawMonNeo.ORIG/gui/GEMHist.cxx 2011-01-31 03:09:35 +++ yokaRawMonNeo/gui/GEMHist.cxx 2025-01-02 23:10:16 @@ -1,4 +1,3 @@ -#define SEP_2010 #include "GEMHist.h" #include "TDirectory.h" #include "JREvent.h" @@ -10,25 +9,7 @@ #include #include -static const int kMaxHist = 100000; static const int kNtbin = 1024; -#ifdef SEP_2010 -//-- 2010/09/13 DESY Beam Test ---------------------------------------- -static const int kNmodules = 3; -static const int kModuleNo[] = {0, 3, 5}; // (0, 3, 5) for the moment -static const int kOffset [] = {0, 128, 48}; // (0, 3, 5) for the moment -static const int kNMaxLayer = 28; // (0-27) -static const int kNMaxPad = 48; // (0-47) -//--------------------------------------------------------------------- -#else -//-- 2009/03/03 DESY Beam Test ---------------------------------------- -static const int kNmodules = 3; -static const int kModuleNo[] = {1, 3, 6}; // (1, 3, 6) for the moment -static const int kOffset [] = {0, 128, 48}; // (1, 3, 6) for the moment -static const int kNMaxLayer = 28; // (0-27) -static const int kNMaxPad = 48; // (0-47) -//--------------------------------------------------------------------- -#endif GEMHist *GEMHist::fgInstancePtr = 0; @@ -36,34 +17,13 @@ GEMHist::GEMHist() { - htime = new TH1F*[kMaxHist]; - for (int h=0; h= kMaxHist) { - cerr << " hid = " << hid << " > " << kMaxHist << endl - << " abort!" << endl; - ::abort(); - } - htime[hid] = new TH1F(hname.str().data(),"",kNtbin, -0.5, kNtbin-0.5); - Add(htime[hid]); - } - } - } } GEMHist::~GEMHist() { - delete [] htime; + for (auto [id, hp] : htimePtr) { + delete hp; + } } GEMHist *GEMHist::GetInstance() @@ -90,22 +50,18 @@ if (module < 0) continue; int layer = cp->GetLayerID(); int pad = cp->GetPadID(); - int hid = kNMaxLayer*kNMaxPad*module + kNMaxPad*layer + pad; - if (hid >= kMaxHist) { - cerr << " hid = " << hid << " > " << kMaxHist << endl - << " abort!" << endl; - ::abort(); - } else if (!htime[hid]) { + DetID did = {module, layer, pad}; + if (!htimePtr[did]) { stringstream hname; hname << "HTIME_" << module << "_" << layer << "_" << pad << ends; - htime[hid] = new TH1F(hname.str().data(),"",kNtbin, -0.5, kNtbin-0.5); - Add(htime[hid]); + htimePtr[did] = new TH1F(hname.str().data(),"",kNtbin, -0.5, kNtbin-0.5); + Add(htimePtr[did]); } int length = cp->GetLength(); int adtime = cp->GetStartTime(); for (int t=0; tFill(adtime+t,adc); + htimePtr[did]->Fill(adtime+t,adc); } } } diff -uNr yokaRawMonNeo.ORIG/gui/GEMHist.h yokaRawMonNeo/gui/GEMHist.h --- yokaRawMonNeo.ORIG/gui/GEMHist.h 2009-03-08 10:15:50 +++ yokaRawMonNeo/gui/GEMHist.h 2025-01-02 23:10:16 @@ -1,10 +1,16 @@ #ifndef GEMHIST_H #define GEMHIST_H #include "TObjArray.h" +#include +#include class TH1F; class JREvent; +using DetID = std::tuple; // Pad ID + class GEMHist : public TObjArray { private: GEMHist(); @@ -16,9 +22,9 @@ static GEMHist *GetInstance(); private: - static GEMHist *fgInstancePtr; //! singleton ptr - TH1F **htime; // timedist - JREvent *fREvent; //! event + static GEMHist *fgInstancePtr; //! singleton ptr + std::map htimePtr; // timedist + JREvent *fREvent; //! event ClassDef(GEMHist, 1) // histogram container }; diff -uNr yokaRawMonNeo.ORIG/include/GEMHist.h yokaRawMonNeo/include/GEMHist.h --- yokaRawMonNeo.ORIG/include/GEMHist.h 2009-03-08 10:15:50 +++ yokaRawMonNeo/include/GEMHist.h 2025-01-02 23:10:16 @@ -1,10 +1,16 @@ #ifndef GEMHIST_H #define GEMHIST_H #include "TObjArray.h" +#include +#include class TH1F; class JREvent; +using DetID = std::tuple; // Pad ID + class GEMHist : public TObjArray { private: GEMHist(); @@ -16,9 +22,9 @@ static GEMHist *GetInstance(); private: - static GEMHist *fgInstancePtr; //! singleton ptr - TH1F **htime; // timedist - JREvent *fREvent; //! event + static GEMHist *fgInstancePtr; //! singleton ptr + std::map htimePtr; // timedist + JREvent *fREvent; //! event ClassDef(GEMHist, 1) // histogram container }; diff -uNr yokaRawMonNeo.ORIG/run/display/HitMonitor.C yokaRawMonNeo/run/display/HitMonitor.C --- yokaRawMonNeo.ORIG/run/display/HitMonitor.C 2020-03-26 00:54:06 +++ yokaRawMonNeo/run/display/HitMonitor.C 2025-01-02 23:10:16 @@ -27,7 +27,7 @@ void HitMonitor(Int_t /* event = 1 */, Int_t /* run = 68 */, Int_t /* part = 0 */, Bool_t reset = true) { if (reset) { - gROOT->LoadMacro("SetGlobalStyle.C"); + //gROOT->LoadMacro("SetGlobalStyle.C"); gROOT->ProcessLine("SetGlobalStyle()"); gStyle->SetOptStat(0); gStyle->SetOptTitle(0); @@ -41,7 +41,11 @@ } Int_t kNRow = 28*3; +#if 0 Int_t kNPad = 48; +#else + Int_t kNPad = 110; +#endif GEMDisplay *gemdisplay = GEMDisplay::GetInstance(); gemdisplay->GetCurFile()->cd(); @@ -63,14 +67,19 @@ Int_t layer = cp->GetLayerID(); Int_t pad = cp->GetPadID(); Int_t row = module == 1 ? layer : (module == 3 ? layer+28 : layer + 56); +#if 0 Int_t col = module == 1 ? pad : (module == 3 ? pad - 128 : pad - 48); +#else + Int_t col = module == 0 ? pad - 80 : (module == 3 ? pad - 16 : pad - 80); + if (col < 0 || col > kNPad - 1) continue; +#endif #if 0 GEMDisplay::GetInstance()->GetCanvas()->cd((col+1)+(row*kNPad)); #else GEMDisplay::GetInstance()->GetCanvas()->cd((col+1)+((kNRow-row-1)*kNPad)); #endif Int_t charge = cp->GetCharge(); - Int_t color = TColor::GetColor((float)(charge/2000.),(float)(charge/2000.),(float)0.); + Int_t color = TColor::GetColor((float)(charge/200.),(float)(charge/200.),(float)0.); //Int_t color = TColor::GetColor(charge*255/1024.,0,0); //Int_t color = TColor::GetColor((ULong_t)(charge*16770000./1000000.)); gPad->SetFillColor(color); diff -uNr yokaRawMonNeo.ORIG/run/display/HitMonitor3D.C yokaRawMonNeo/run/display/HitMonitor3D.C --- yokaRawMonNeo.ORIG/run/display/HitMonitor3D.C 2020-03-26 00:54:27 +++ yokaRawMonNeo/run/display/HitMonitor3D.C 2025-01-02 23:10:16 @@ -47,7 +47,7 @@ void HitMonitor3D(Int_t /* event = 1 */, Int_t /* run = 68 */, Int_t /* part = 0*/, Bool_t reset = true) { if (reset) { - gROOT->LoadMacro("SetGlobalStyle.C"); + //gROOT->LoadMacro("SetGlobalStyle.C"); gROOT->ProcessLine("SetGlobalStyle()"); } diff -uNr yokaRawMonNeo.ORIG/run/display/PadMonitor0.C yokaRawMonNeo/run/display/PadMonitor0.C --- yokaRawMonNeo.ORIG/run/display/PadMonitor0.C 2025-01-02 23:10:16 +++ yokaRawMonNeo/run/display/PadMonitor0.C 2025-01-02 23:10:16 @@ -0,0 +1,108 @@ +// +// A very primitive pad monitor for ALTRO raw data +// +// by Katsumasa Ikematsu (KEK) +// +// $Id: PadMonitor0.C,v 1.3 2009/06/04 14:02:10 fujiik Exp $ +// +#ifndef __CINT__ +#include "TROOT.h" +#include "TSystem.h" +#include "TStyle.h" +#include "TFile.h" +#include "TH1.h" +#include "TText.h" +#include "TCanvas.h" +#include "GEMDisplay.h" +#include "GEMHist.h" +#include "JREvent.h" +#include "JCluster.h" +#include +#endif + +const Int_t kP0MinXHisto = 0; +const Int_t kP0MaxXHisto = 512; +const Int_t kP0MinYHisto = -20; +const Int_t kP0MaxYHisto = 200; + +const Int_t kP0ThresholdPH = 20; + +void PadMonitor0(Int_t /* event = 1 */, Int_t /* run = 68 */, Int_t /* part = 0 */, Bool_t reset = true) { + if (reset) { + //gROOT->LoadMacro("SetGlobalStyle.C"); + gROOT->ProcessLine("SetGlobalStyle()"); + gStyle->SetOptStat(0); + gStyle->SetOptTitle(0); + gStyle->SetPadBottomMargin(0.); + gStyle->SetPadTopMargin(0.); + gStyle->SetPadLeftMargin(0.); + gStyle->SetPadRightMargin(0.); + gStyle->SetPalette(1); + } +#if 1 + Int_t kNRow = 28; + Int_t kNPad = 80; + + ///////////////////////// + Int_t kModule = 0; + Int_t kOffset = 80; + ///////////////////////// +#endif + GEMDisplay *gemdisplay = GEMDisplay::GetInstance(); + gemdisplay->GetCurFile()->cd(); + gemdisplay->GetCanvas()->Clear(); + gemdisplay->GetCanvas()->Divide(kNPad, kNRow, 0, 0); + + JREvent *ep = gemdisplay->GetCurEvent(); + JCluster::SetSortBy(JCluster::kDet); + ep->Sort(); + GEMHist *gemhist = GEMHist::GetInstance(); + gemhist->ClearAll(); + gemhist->FillEvent(ep); + + for (Int_t iRow = 0; iRow < kNRow; iRow++) { + for (Int_t iPad = 0; iPad < kNPad; iPad++) { +#if 0 + GEMDisplay::GetInstance()->GetCanvas()->cd((iPad+1)+(iRow*kNPad)); +#else + GEMDisplay::GetInstance()->GetCanvas()->cd((iPad+1)+((kNRow-iRow-1)*kNPad)); +#endif + stringstream ostr; + ostr << "HTIME_" << kModule << "_" << iRow << "_" << iPad + kOffset << ends; + TH1F *hPulse = static_cast(gROOT->FindObject(ostr.str().data())); + if (!hPulse) continue; + if (!hPulse->GetEntries()) continue; + hPulse->SetAxisRange(kP0MinXHisto, kP0MaxXHisto); + hPulse->SetMinimum(kP0MinYHisto); + hPulse->SetMaximum(kP0MaxYHisto); + hPulse->UseCurrentStyle(); + hPulse->Draw(); + Int_t peaktime = hPulse->GetMaximumBin(); + Double_t peakph = hPulse->GetBinContent(peaktime); + + TText t0(0, 0, ""); + t0.SetTextFont(132); + t0.SetTextSize(0.4); + t0.SetTextColor(4); + + ostr.str(""); + ostr.clear(); + ostr << peaktime << ends; + if (peakph > kP0ThresholdPH) t0.DrawText(peaktime, 0.5 * kP0MaxYHisto, ostr.str().data()); + + TText t2(0, 0, ""); + t2.SetTextFont(132); + t2.SetTextSize(0.3); + Double_t xt2 = kP0MinXHisto + 0.05 * kP0MaxXHisto; + ostr.str(""); + ostr.clear(); + ostr << iPad + 1 << ends; + if (iRow == kNRow -1) t2.DrawText(xt2 + 0.1 * kP0MaxXHisto, 0.1 * kP0MaxYHisto, ostr.str().data()); + ostr.str(""); + ostr.clear(); + ostr << iRow + 1 << ends; + if (!iPad) t2.DrawText(xt2, 0.7 * kP0MaxYHisto, ostr.str().data()); + } + } + gemdisplay->GetCanvas()->Update(); +} diff -uNr yokaRawMonNeo.ORIG/run/display/PadMonitor1.C yokaRawMonNeo/run/display/PadMonitor1.C --- yokaRawMonNeo.ORIG/run/display/PadMonitor1.C 2020-03-26 00:54:45 +++ yokaRawMonNeo/run/display/PadMonitor1.C 2025-01-02 23:10:16 @@ -29,7 +29,7 @@ void PadMonitor1(Int_t /* event = 1 */, Int_t /* run = 68 */, Int_t /* part = 0 */, Bool_t reset = true) { if (reset) { - gROOT->LoadMacro("SetGlobalStyle.C"); + //gROOT->LoadMacro("SetGlobalStyle.C"); gROOT->ProcessLine("SetGlobalStyle()"); gStyle->SetOptStat(0); gStyle->SetOptTitle(0); @@ -70,6 +70,8 @@ stringstream ostr; ostr << "HTIME_" << kModule << "_" << iRow << "_" << iPad + kOffset << ends; TH1F *hPulse = static_cast(gROOT->FindObject(ostr.str().data())); + if (!hPulse) continue; + if (!hPulse->GetEntries()) continue; hPulse->SetAxisRange(kP1MinXHisto, kP1MaxXHisto); hPulse->SetMinimum(kP1MinYHisto); hPulse->SetMaximum(kP1MaxYHisto); diff -uNr yokaRawMonNeo.ORIG/run/display/PadMonitor3.C yokaRawMonNeo/run/display/PadMonitor3.C --- yokaRawMonNeo.ORIG/run/display/PadMonitor3.C 2020-03-26 00:55:00 +++ yokaRawMonNeo/run/display/PadMonitor3.C 2025-01-02 23:10:16 @@ -29,7 +29,7 @@ void PadMonitor3(Int_t /* event = 1 */, Int_t /* run = 68 */, Int_t /* part = 0 */, Bool_t reset = true) { if (reset) { - gROOT->LoadMacro("SetGlobalStyle.C"); + //gROOT->LoadMacro("SetGlobalStyle.C"); gROOT->ProcessLine("SetGlobalStyle()"); gStyle->SetOptStat(0); gStyle->SetOptTitle(0); @@ -41,11 +41,13 @@ } #if 1 Int_t kNRow = 28; - Int_t kNPad = 48; + //Int_t kNPad = 48; + Int_t kNPad = 100; ///////////////////////// Int_t kModule = 3; - Int_t kOffset = 128; + //Int_t kOffset = 128; + Int_t kOffset = 16; ///////////////////////// #endif GEMDisplay *gemdisplay = GEMDisplay::GetInstance(); @@ -70,6 +72,8 @@ stringstream ostr; ostr << "HTIME_" << kModule << "_" << iRow << "_" << iPad + kOffset << ends; TH1F *hPulse = static_cast(gROOT->FindObject(ostr.str().data())); + if (!hPulse) continue; + if (!hPulse->GetEntries()) continue; hPulse->SetAxisRange(kP3MinXHisto, kP3MaxXHisto); hPulse->SetMinimum(kP3MinYHisto); hPulse->SetMaximum(kP3MaxYHisto); diff -uNr yokaRawMonNeo.ORIG/run/display/PadMonitor5.C yokaRawMonNeo/run/display/PadMonitor5.C --- yokaRawMonNeo.ORIG/run/display/PadMonitor5.C 2025-01-02 23:10:16 +++ yokaRawMonNeo/run/display/PadMonitor5.C 2025-01-02 23:10:16 @@ -0,0 +1,108 @@ +// +// A very primitive pad monitor for ALTRO raw data +// +// by Katsumasa Ikematsu (KEK) +// +// $Id: PadMonitor6.C,v 1.3 2009/06/04 14:02:10 fujiik Exp $ +// +#ifndef __CINT__ +#include "TROOT.h" +#include "TSystem.h" +#include "TStyle.h" +#include "TFile.h" +#include "TH1.h" +#include "TText.h" +#include "TCanvas.h" +#include "GEMDisplay.h" +#include "GEMHist.h" +#include "JREvent.h" +#include "JCluster.h" +#include +#endif + +const Int_t kP5MinXHisto = 0; +const Int_t kP5MaxXHisto = 512; +const Int_t kP5MinYHisto = -20; +const Int_t kP5MaxYHisto = 200; + +const Int_t kP5ThresholdPH = 20; + +void PadMonitor5(Int_t /* event = 1 */, Int_t /* run = 68 */, Int_t /* part = 0 */, Bool_t reset = true) { + if (reset) { + //gROOT->LoadMacro("SetGlobalStyle.C"); + gROOT->ProcessLine("SetGlobalStyle()"); + gStyle->SetOptStat(0); + gStyle->SetOptTitle(0); + gStyle->SetPadBottomMargin(0.); + gStyle->SetPadTopMargin(0.); + gStyle->SetPadLeftMargin(0.); + gStyle->SetPadRightMargin(0.); + gStyle->SetPalette(1); + } +#if 1 + Int_t kNRow = 28; + Int_t kNPad = 110; + + ///////////////////////// + Int_t kModule = 5; + Int_t kOffset = 80; + ///////////////////////// +#endif + GEMDisplay *gemdisplay = GEMDisplay::GetInstance(); + gemdisplay->GetCurFile()->cd(); + gemdisplay->GetCanvas()->Clear(); + gemdisplay->GetCanvas()->Divide(kNPad, kNRow, 0, 0); + + JREvent *ep = gemdisplay->GetCurEvent(); + JCluster::SetSortBy(JCluster::kDet); + ep->Sort(); + GEMHist *gemhist = GEMHist::GetInstance(); + gemhist->ClearAll(); + gemhist->FillEvent(ep); + + for (Int_t iRow = 0; iRow < kNRow; iRow++) { + for (Int_t iPad = 0; iPad < kNPad; iPad++) { +#if 0 + GEMDisplay::GetInstance()->GetCanvas()->cd((iPad+1)+(iRow*kNPad)); +#else + GEMDisplay::GetInstance()->GetCanvas()->cd((iPad+1)+((kNRow-iRow-1)*kNPad)); +#endif + stringstream ostr; + ostr << "HTIME_" << kModule << "_" << iRow << "_" << iPad + kOffset << ends; + TH1F *hPulse = static_cast(gROOT->FindObject(ostr.str().data())); + if (!hPulse) continue; + if (!hPulse->GetEntries()) continue; + hPulse->SetAxisRange(kP5MinXHisto, kP5MaxXHisto); + hPulse->SetMinimum(kP5MinYHisto); + hPulse->SetMaximum(kP5MaxYHisto); + hPulse->UseCurrentStyle(); + hPulse->Draw(); + Int_t peaktime = hPulse->GetMaximumBin(); + Double_t peakph = hPulse->GetBinContent(peaktime); + + TText t1(0, 0, ""); + t1.SetTextFont(132); + t1.SetTextSize(0.4); + t1.SetTextColor(4); + + ostr.str(""); + ostr.clear(); + ostr << peaktime << ends; + if (peakph > kP5ThresholdPH) t1.DrawText(peaktime, 0.5 * kP5MaxYHisto, ostr.str().data()); + + TText t2(0, 0, ""); + t2.SetTextFont(132); + t2.SetTextSize(0.3); + Double_t xt2 = kP5MinXHisto + 0.05 * kP5MaxXHisto; + ostr.str(""); + ostr.clear(); + ostr << iPad + 1 << ends; + if (iRow == kNRow -1) t2.DrawText(xt2 + 0.1 * kP5MaxXHisto, 0.1 * kP5MaxYHisto, ostr.str().data()); + ostr.str(""); + ostr.clear(); + ostr << iRow + 1 << ends; + if (!iPad) t2.DrawText(xt2, 0.7 * kP5MaxYHisto, ostr.str().data()); + } + } + gemdisplay->GetCanvas()->Update(); +} diff -uNr yokaRawMonNeo.ORIG/run/display/PadMonitor6.C yokaRawMonNeo/run/display/PadMonitor6.C --- yokaRawMonNeo.ORIG/run/display/PadMonitor6.C 2020-03-26 00:55:14 +++ yokaRawMonNeo/run/display/PadMonitor6.C 2025-01-02 23:10:16 @@ -29,7 +29,7 @@ void PadMonitor6(Int_t /* event = 1 */, Int_t /* run = 68 */, Int_t /* part = 0 */, Bool_t reset = true) { if (reset) { - gROOT->LoadMacro("SetGlobalStyle.C"); + //gROOT->LoadMacro("SetGlobalStyle.C"); gROOT->ProcessLine("SetGlobalStyle()"); gStyle->SetOptStat(0); gStyle->SetOptTitle(0); @@ -70,6 +70,7 @@ stringstream ostr; ostr << "HTIME_" << kModule << "_" << iRow << "_" << iPad + kOffset << ends; TH1F *hPulse = static_cast(gROOT->FindObject(ostr.str().data())); + if (!hPulse) continue; hPulse->SetAxisRange(kP6MinXHisto, kP6MaxXHisto); hPulse->SetMinimum(kP6MinYHisto); hPulse->SetMaximum(kP6MaxYHisto); diff -uNr yokaRawMonNeo.ORIG/run/display/PulseMonitor.C yokaRawMonNeo/run/display/PulseMonitor.C --- yokaRawMonNeo.ORIG/run/display/PulseMonitor.C 2020-12-23 20:57:58 +++ yokaRawMonNeo/run/display/PulseMonitor.C 2025-01-02 23:10:16 @@ -70,7 +70,7 @@ void PulseMonitor(Int_t event = 1, Int_t run = 68, Int_t part = 0, Bool_t reset = true) { #endif if (reset) { - gROOT->LoadMacro("SetGlobalStyle.C"); + //gROOT->LoadMacro("SetGlobalStyle.C"); gROOT->ProcessLine("SetGlobalStyle()"); gStyle->SetOptStat(1); gStyle->SetOptTitle(0); diff -uNr yokaRawMonNeo.ORIG/run/display/yokaRawMon.C yokaRawMonNeo/run/display/yokaRawMon.C --- yokaRawMonNeo.ORIG/run/display/yokaRawMon.C 2020-12-23 12:54:48 +++ yokaRawMonNeo/run/display/yokaRawMon.C 2025-01-02 23:10:16 @@ -12,9 +12,9 @@ GEMDisplay *gemdisplay = GEMDisplay::GetInstance(); gemdisplay->Add("TrackMonitor3D"); gemdisplay->Add("HitMonitor3D"); - gemdisplay->Add("PadMonitor1"); + gemdisplay->Add("PadMonitor0"); gemdisplay->Add("PadMonitor3"); - gemdisplay->Add("PadMonitor6"); + gemdisplay->Add("PadMonitor5"); gemdisplay->Add("HitMonitor"); gemdisplay->Add("PulseMonitor"); #ifdef __CINT diff -uNr yokaRawMonNeo.ORIG/run/reco/manyrun.sh yokaRawMonNeo/run/reco/manyrun.sh --- yokaRawMonNeo.ORIG/run/reco/manyrun.sh 2023-11-20 17:14:11 +++ yokaRawMonNeo/run/reco/manyrun.sh 2025-01-02 23:10:16 @@ -14,8 +14,8 @@ #for run in 19895 19894 19893 19892 19891 19890 19889 19888 19887 19886 19885 19884 19883 19882 19881; do # w/gate phi=-20deg for run in 19987 19985 19984 19983 19982 19981 19980 19979 19978 19977 19976 19975 19974 19973 19972 \ 20042 20041 20043 20044 20045 20046 20047 20048 20049 20050 20051 20052 20053 20054 20055; do # w/ fs - #root -l -q -b reco.C\(${run},$delxfile\) >& reco-${run}.log & - root -l -q -b hitmon.C\(${run}\) >& reco-${run}.log & + root -l -q -b reco.C\(${run},$delxfile\) >& reco-${run}.log & + #root -l -q -b hitmon.C\(${run}\) >& reco-${run}.log & #root -l -q -b trackhitmon.C\(${run},$delxfile\) >& reco-${run}.log & done wait