/Users/proj/cdc/soft/yoka/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 2024-03-12 17:39:43 @@ -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 2024-03-12 17:39:43 @@ -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 2024-03-12 21:56:58 @@ -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 2024-03-12 17:45:14 +++ yokaRawMonNeo/run/display/HitMonitor3D.C 2024-03-12 17:55:11 @@ -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/PadMonitor1.C yokaRawMonNeo/run/display/PadMonitor1.C --- yokaRawMonNeo.ORIG/run/display/PadMonitor1.C 2020-03-26 00:54:45 +++ yokaRawMonNeo/run/display/PadMonitor1.C 2024-03-12 21:00:35 @@ -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 2024-03-12 18:35:15 @@ -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/PadMonitor6.C yokaRawMonNeo/run/display/PadMonitor6.C --- yokaRawMonNeo.ORIG/run/display/PadMonitor6.C 2020-03-26 00:55:14 +++ yokaRawMonNeo/run/display/PadMonitor6.C 2024-03-12 17:59:48 @@ -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 2024-03-12 17:57:27 @@ -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 2024-03-12 21:20:02 @@ -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/reco.C yokaRawMonNeo/run/reco/reco.C --- yokaRawMonNeo.ORIG/run/reco/reco.C 2020-03-26 23:38:47 +++ yokaRawMonNeo/run/reco/reco.C 2022-03-02 23:48:10 @@ -106,7 +106,7 @@ } #endif cerr << "distortion correction file = " << delxfile << endl; - (void *) JHitCorrector::GetInstancePtr(delxfile); + (void) JHitCorrector::GetInstancePtr(delxfile); JHitMaker hitmaker; TKalDetCradle lp1; EXTPCKalDetector tpcdet; @@ -141,10 +141,13 @@ // -------------------- // Now loop over events // -------------------- - const Int_t kMaxEvt = 20000; - //const Int_t kMaxEvt = 2000; + //const Int_t kMaxEvt = 20000; + const Int_t kMaxEvt = 2000; //const Int_t kMaxEvt = 1000; + //const Int_t kMaxEvt = 100; + std::map pulsemap; + for (Int_t ev=0; evGetEntry(ev); if (!(ev%100)) { @@ -157,13 +160,56 @@ //hitmaker.DebugPrint("detail"); trackmaker.MakeTracks(&hitmaker); trackmaker.DebugPrint("detail"); + TIter next(&trackmaker); + JTrack *tp = nullptr; + while ((tp = static_cast(next()))) { // loop over tracks + TIter nexthit(tp); + JHit *hp = nullptr; + while ((hp = static_cast(nexthit()))) { // loop ver hits + TIter nextcluster(hp); + double chgmax = -1; + JCluster *pkcp = nullptr; + JCluster *cp = nullptr; + while ((cp = static_cast(nextcluster()))) { // loop over pulses + double chg = cp->GetCharge(); + if (chg > chgmax) { + chgmax = chg; + pkcp = cp; + } + } + double time0 = pkcp->GetStartTime(); + double time = pkcp->GetTime(); + int module = pkcp->GetModuleID(); + int row = pkcp->GetLayerID(); + int pad = pkcp->GetPadID(); + std::stringstream hname; + hname << "hPulse" << module << "_" << row << ends; // histogram name + if (!pulsemap[hname.str()]) { + pulsemap[hname.str()] = new TH2D(hname.str().data(),"",300,-10.,20.,1200,0.,1.2); + } + auto hpp = pulsemap[hname.str()]; + for (Int_t i=0; iGetLength(); i++) { + hpp->Fill(i+time0-time, pkcp->operator[](i)/chgmax); + } +#if 0 + int ipk = time - time0; + double fpk = pkcp->operator[](ipk)/chgmax; + cerr << "ghost=" << (fpk>0.2 ? 1 : 0) << " module=" << module << " row=" << row << " pad=" << pad << " "; + cerr << "time0=" << time0 << " time=" << time << " adc="; + for (Int_t i=0; iGetLength(); i++) { + cerr << pkcp->operator[](i) << " "; + } + cerr << endl; +#endif + } + } } // ----------------------- // Now output tree headers // ----------------------- - TNtupleD *hTracks = static_cast(gROOT->FindObject("hTracks")); - TNtupleD *hResXin = static_cast(gROOT->FindObject("hResXin")); - TNtupleD *hResZin = static_cast(gROOT->FindObject("hResZin")); + auto hTracks = static_cast(gROOT->FindObject("hTracks")); + auto hResXin = static_cast(gROOT->FindObject("hResXin")); + auto hResZin = static_cast(gROOT->FindObject("hResZin")); const Int_t kNmodules = 3; const Int_t kNlayers = 28; @@ -181,5 +227,10 @@ for (Int_t i=0; iWrite(); } + + for (const auto& [key, hpp]: pulsemap) { + if (hpp) hpp->Write(); + } + hfp->Write(); } diff -uNr yokaRawMonNeo.ORIG/run/reco/trackhitmon.C yokaRawMonNeo/run/reco/trackhitmon.C --- yokaRawMonNeo.ORIG/run/reco/trackhitmon.C 2023-08-09 23:31:48 +++ yokaRawMonNeo/run/reco/trackhitmon.C 2023-08-10 00:20:08 @@ -122,13 +122,17 @@ //hitmaker.DebugPrint("detail"); trackmaker.MakeTracks(&hitmaker); trackmaker.DebugPrint("detail"); +#if 1 + auto ntrks = trackmaker.GetEntries(); + if (ntrks != 1) continue; +#endif TIter next(&trackmaker); JTrack *tp = nullptr; + auto nhits = 0; + auto chgsum = 0.; while ((tp = static_cast(next()))) { // loop over tracks TIter nexthit(tp); JHit *hp = nullptr; - auto nhits = 0; - auto chgsum = 0.; while ((hp = static_cast(nexthit()))) { // loop ver hits auto xv = hp->GetPosition(); auto module = hp->GetModuleID(); @@ -144,8 +148,8 @@ auto hpp = hitmap[hname.str()]; hpp->Fill(ev+0.1, charge); } - if (nhits) hqavp->Fill(ev+0.1, chgsum/nhits); } + if (nhits) hqavp->Fill(ev+0.1, chgsum/nhits); } // ----------------------- // Now output tree headers diff -uNr yokaRawMonNeo.ORIG/unpacker/JPadGeom.cxx yokaRawMonNeo/unpacker/JPadGeom.cxx --- yokaRawMonNeo.ORIG/unpacker/JPadGeom.cxx 2016-11-26 16:06:59 +++ yokaRawMonNeo/unpacker/JPadGeom.cxx 2020-12-11 11:29:40 @@ -79,6 +79,8 @@ Double_t JPadGeom::fgLength = 650.00; #endif +ClassImp(JPadGeom) + JPadGeom::JPadGeom() { } diff -uNr yokaRawMonNeo.ORIG/unpacker/JPadGeom.h yokaRawMonNeo/unpacker/JPadGeom.h --- yokaRawMonNeo.ORIG/unpacker/JPadGeom.h 2009-06-04 22:21:59 +++ yokaRawMonNeo/unpacker/JPadGeom.h 2020-12-11 11:29:03 @@ -41,5 +41,7 @@ static Double_t fgRmin; // Radius of the innermost pad row static Double_t fgGap; // pad to pad gap static Double_t fgLength; // maximum drift length + + ClassDef(JPadGeom, 1) // Module Geometry class }; #endif diff -uNr yokaRawMonNeo.ORIG/unpacker/LinkDef.h yokaRawMonNeo/unpacker/LinkDef.h --- yokaRawMonNeo.ORIG/unpacker/LinkDef.h 2009-03-09 17:18:02 +++ yokaRawMonNeo/unpacker/LinkDef.h 2020-12-11 11:29:57 @@ -6,5 +6,6 @@ #pragma link C++ class JREvent+; #pragma link C++ class JCluster+; +#pragma link C++ class JPadGeom+; #endif