56 if (plane != NULL )plane->
print();
66 Info(
"process",
" Processing Event %ld",
nEvents);
83 if(timestamp==0)
return;
96 for(
int ch = 0; ch<16; ch++) hit[ch] = 0;
97 for(imes=0;imes<esize;imes++) {
106 int nScint = (hit[1] || hit[2])
110 + (hit[9] || hit[10])
111 + (hit[11] || hit[12]);
115 bool trigger = nScint > 1;
120 for(
int ch = 0; ch<16; ch++){
121 int ch2 = ch%2 ? ch+1 : ch-1;
134 for(imes=0;imes<esize;imes++) {
139 int iadc = m[imes].getCharge();
140 int trigtype= m[imes].GetNU0();
150 Info(
"process",
"Unknown PMM2 channel %d",ch);
161 Info(
"process",
" %s",str.Data());
169 for(
int ch1 = 0; ch1<16; ch1++){
170 for(
int ch2 = 0; ch2<16; ch2++){
171 if(hit[ch1] && hit[ch2]){
183 Double_t time = timestamp/1e8;
185 Double_t ratetot = 0;
186 for(Int_t i = 0; i<16; i++){
226 Long64_t saveRate = 0;
228 Info(
"InitCfg",
"Use default fSaveRate %d",
fSaveRate);
235 Long64_t display = 0;
237 Info(
"Init",
"Use default address %d",
fDisplay);
242 Long64_t fAddress = 0x7ff3ab9f9000;
243 Long64_t address = 0;
245 Info(
"Init",
"Use default address 0x%llx",fAddress);
248 TMapFile::SetMapAddress(fAddress);
251 mfile = TMapFile::Create(
"/tmp/harpoPmm2.map",
"RECREATE", 10000000,
252 "Memory mapped file with monitoring histograms");
255 for(Int_t ch = 0; ch<16; ch++){
256 fHistSpectrum[ch] =
new TH1F(Form(
"fHistSpectrum%d",ch),
"; signal [ADC]",1024,0,1024);
262 fHistSpectrum2D =
new TH2F(
"fHistSpectrum2D",
"; channel; signal [ADC]",16,0,16,1024,0,1024);
263 fHistSize =
new TH1F(
"fHistSize",
"; Number of PM hit",16,0,16);
269 fHistInfo =
new TH1F(
"fHistInfo",
"",10,0,10);
271 fHistMissed =
new TH1F(
"fHistMissed",
"; channel; efficiency",16,0,16);
272 fHistTriggered =
new TH1F(
"fHistTriggered",
"; channel; efficiency",16,0,16);
275 fHistRatePmm2 =
new TH1F(
"fHistRatePmm2",
"; channel; rate",16,0,16);
279 for(Int_t i = 0; i<16; i++){
291 Double_t rateSample = 0;
293 Info(
"InitCfg",
"Use default fRateSample %g",
fRateSample);
321 if(
gHarpoDebug>0) Info(
"Save",
"Displaying histograms");
323 gStyle->SetOptStat(0);
325 TLegend* lCh =
new TLegend(0.75,0.4,0.9,0.9);
327 for(Int_t ch = 0; ch<16; ch++){
331 nSignal +=
fHistSize->GetBinContent(ch+1)*ch;
334 TLegend* l =
new TLegend(0.6,0.6,0.9,0.9);
360 TCanvas* ct1 =
new TCanvas(
"cPmm2_1",
"Monitor PMm2",0,0,1200,800);
364 TH1F* hThr =
new TH1F(
"hThr",
"",16,0,16);
365 TH1F* hMean =
new TH1F(
"hMean",
"",16,0,16);
366 TH1F* hTruncMax =
new TH1F(
"hTruncMax",
"",16,0,16);
367 TH1F* hTruncMin =
new TH1F(
"hTruncMin",
"",16,0,16);
368 TH1F* hSat =
new TH1F(
"hSat",
"",16,0,16);
372 Double_t meanThr = 0, normThr = 0;
373 for(Int_t ch = 0; ch<16; ch++){
389 hThr->SetBinContent(ch+1,thr);
394 ct1->GetPad(1)->SetLogy();
399 ct1->GetPad(2)->SetLogz();
400 hThr->SetLineWidth(3);
401 hThr->SetLineStyle(2);
403 TLatex* latex =
new TLatex();
404 latex->SetTextFont(132);
405 latex->SetTextAlign(12);
406 latex->SetTextSize(0.07);
407 latex->DrawLatex(1,900,Form(
"mean Thr %g",meanThr/normThr));
411 Double_t meanMean = 0, normMean = 0;
412 for(Int_t ch = 0; ch<16; ch++){
429 Double_t truncMax = 0, truncMin = 0;
431 Info(
"Save",
"mean ch %d: %g",ch,mean);
434 hMean->SetBinContent(ch+1,mean);
435 hTruncMin->SetBinContent(ch+1,truncMin);
436 hTruncMax->SetBinContent(ch+1,truncMax);
450 hSat->SetBinContent(ch+1,nEvSat/nEvTrig);
461 ct1->GetPad(3)->SetLogy();
466 ct1->GetPad(4)->SetLogz();
467 hMean->SetLineWidth(3);
469 hTruncMin->SetLineStyle(2);
470 hTruncMin->SetLineWidth(3);
471 hTruncMin->Draw(
"same");
472 hTruncMax->SetLineStyle(2);
473 hTruncMax->SetLineWidth(3);
474 hTruncMax->Draw(
"same");
475 latex->DrawLatex(1,900,Form(
"mean Mean %g",meanMean/normMean));
477 TCanvas* ct2 =
new TCanvas(
"cPmm2_2",
"Monitor time PMm2",0,0,1200,800);
483 Double_t ratetot = 0;
484 for(Int_t i = 0; i<16; i++){
494 TH1F* hDummyTime =
new TH1F(
"hDummyTime",
";time [s]; rate [Hz]",1000,0,
fTimeTot);
495 hDummyTime->SetMaximum(
gRatePmm2Tot->GetYaxis()->GetXmax());
497 hDummyTime->DrawCopy();
499 for(Int_t i = 0; i<16; i++){
501 Int_t color = 51 + i*49./17;
519 Double_t y = 0.5*
fHistSize->GetMaximum(), x = 8;
520 Double_t dy = 0.1*
fHistSize->GetMaximum();
521 latex->DrawLatex(x,y,Form(
"N_{4}/(N_{3}+N_{4}) = %.2g",N4/(N3+N4)));
523 latex->DrawLatex(x,y,Form(
"N_{3}/(N_{3}+N_{4}) = %.2g",N3/(N3+N4)));
525 latex->DrawLatex(x,y,Form(
"N_{5}/(N_{5}+N_{4}) = %.2g",N5/(N5+N4)));
527 latex->DrawLatex(x,y,Form(
"N_{trig}/N_{tot} = %.2g",
fHistSizeTrig->GetEntries()/
fHistSize->GetEntries()));
532 for(
int ch1 = 0; ch1<16; ch1++){
533 for(
int ch2 = 0; ch2<16; ch2++){
540 ct2->GetPad(4)->SetLogz();
550 fHistEfficiency->SetTitle(
"PM efficiency;Channel;Efficiency [%]");
553 fHistEfficiency->Scale(100);
554 fHistEfficiency->SetMinimum(0);
555 fHistEfficiency->SetMaximum(100);
568 TGaxis *axis =
new TGaxis(16,0,
571 axis->SetLineColor(kRed);
572 axis->SetTextColor(kRed);
573 axis->SetLabelColor(kRed);
574 axis->SetTitle(
"Rate [Hz]");
575 axis->SetTitleSize(0.07);
576 axis->SetTitleOffset(0.7);
577 axis->SetTitleFont(132);
578 axis->SetLabelFont(132);
579 axis->SetLabelSize(0.06);
583 ct2->GetPad(2)->SetRightMargin(0.12);
590 if ( hstFile == NULL ) {
592 "No Hist File name given, use default" << std::endl;
597 TFile *hf =
new TFile(hstFile->Data(),
"RECREATE");
600 for(Int_t ch = 0; ch<16; ch++){
620 printf(
"fNewFile %s closed\n", hstFile->Data() );
627 if(h->GetEntries()<10)
return 0;
629 h->GetXaxis()->SetRangeUser(150,1000);
630 Int_t maxbin = h->GetMaximumBin();
631 Double_t max = h->GetBinContent(maxbin);
632 h->GetXaxis()->SetRangeUser(0,1024);
634 Int_t nbins = h->GetXaxis()->GetNbins();
639 if(h->GetXaxis()->GetBinCenter(i)<150)
continue;
640 Double_t val = h->GetBinContent(i);
644 Double_t thr = 0, W = 0;
645 for(Int_t k = -1; k<2; k++){
646 Double_t w = h->GetBinContent(i+k) - h->GetBinContent(i+k-1);
647 thr += w*h->GetXaxis()->GetBinCenter(i+k);
650 thr = h->GetXaxis()->GetBinCenter(i);
666 Int_t nbins = h->GetXaxis()->GetNbins();
667 Int_t ntot = h->GetEntries();
668 Int_t nt = 0, norm =0;
669 Double_t truncmean = 0;
674 for(Int_t i = 1; i<=nbins; i++){
675 Double_t q = h->GetXaxis()->GetBinCenter(i);
676 Int_t n = h->GetBinContent(i);
678 if(nt>th*ntot)
break;
683 if(h->GetXaxis()->GetBinCenter(i)<150) {};
691 return truncmean/norm;
705 Int_t size = vect->GetSize();
706 Double_t truncMean = 0;
707 Int_t* index =
new Int_t[size];
708 TMath::Sort(size,vect->GetArray(),index,kFALSE);
709 Int_t t = 0, tLow, tHigh;
712 while(vect->At(index[t])<10&&t<size-1) t++;
713 tLow = TMath::FloorNint(t + (size - t)*tl);
714 tHigh = TMath::FloorNint(t + (size - t)*th);
716 for(Int_t tind = tLow; tind<tHigh; tind++) truncMean += vect->At(index[tind]);
719 return truncMean/(tHigh-tLow);
TString * GetProgramName()
Get Program Name.
TH2F * fHistSpectrumTrig2D
Long64_t GetRunNo()
Set Run Number.
Monitor Pmm2 data for online GUI.
void Save(char *mode=NULL)
Bool_t isExist(ULong_t det)
Detecror date exist //! Number of Real Detectors.
TH1F * fHistSpectrumTrig[16]
TGraphErrors * gRatePmm2[16]
void MakeNice1dHisto(TH1 *hist, TVirtualPad *c1, const char *opt, Bool_t copy)
Double_t GetTruncMean(TH1F *h, Double_t &min, Double_t &max, Double_t tl=0., Double_t th=0.6)
Double_t TruncMean(TArrayD *vect, Double_t tl=0., Double_t th=0.6)
unpacked dcc data The class contains the data map for DCC or Feminos The data is stored as a 2D TMatr...
HarpoDetEvent * GetDetEvent(Long_t plane=XDCC)
Pmm2MesVect * GetMesurements()
Return pointer to decoded data.
TGraphErrors * gTimeVsEvent
TVirtualPad * MakeNiceHisto(TH1 *hist, TVirtualPad *c1, const char *opt, Bool_t copy)
Bool_t Lookup(const char *path, Bool_t &val)
Lookup function for scalar values.
A class store HARPO raw PMM2 event buffer and header. End provide access metods to the row data...
virtual const EventHeader_t * GetHeader() const
HarpoEventHeader * GetHeader()
TString * GetHistFile()
Get Name of Histogram output file.
const ULong_t gkNDetectors
ULong_t GetTimeStamp(Long_t plane=XDCC)
A list of all mesurements in one Event for Pmm2 v2 card The class is place holder for all unpacked me...
TGraphErrors * gRatePmm2Tot
R__EXTERN HarpoDetSet * gHDetSet
Double_t GetThr(TH1F *h)
Redefine empty default.
TH2F * fHistCoincidenceNorm