|
| 1 | + |
| 2 | +// The following are special comments used by RootSpy to know |
| 3 | +// which histograms to fetch for the macro. |
| 4 | +// |
| 5 | +// hnamepath: /FMWPC/h1_ctof_dE |
| 6 | +// hnamepath: /FMWPC/h2_ctof_t |
| 7 | +// hnamepath: /FMWPC/h2_ctof_t_adc |
| 8 | +// |
| 9 | +// |
| 10 | + |
| 11 | +{ |
| 12 | + TDirectory *savedir = gDirectory; |
| 13 | + TDirectory *dir = (TDirectory*)gDirectory->FindObjectAny("FMWPC"); |
| 14 | + if(dir) dir->cd(); |
| 15 | + |
| 16 | + TH1I *hr_u = (TH1I*)gDirectory->FindObjectAny("h1_ctof_occ_up"); |
| 17 | + TH1I *hr_d = (TH1I*)gDirectory->FindObjectAny("h1_ctof_occ_down"); |
| 18 | + |
| 19 | + TH2F *h_de = (TH2F*)gDirectory->FindObjectAny("h1_ctof_dE"); |
| 20 | + TH2D *h_t = (TH2D*)gDirectory->FindObjectAny("h2_ctof_t"); |
| 21 | + TH2D *h_t_adc = (TH2D*)gDirectory->FindObjectAny("h2_ctof_t_adc"); |
| 22 | + TH2D *h_adc_tdc = (TH2D*)gDirectory->FindObjectAny("h2_ctof_t_adc_tdc"); |
| 23 | + |
| 24 | + TLegend *legend_ru = new TLegend(0.5,0.85,0.7,0.9); |
| 25 | + TLegend *legend_rd = new TLegend(0.7,0.85,0.9,0.9); |
| 26 | + |
| 27 | + if(hr_u){ |
| 28 | + hr_u->SetBarWidth(0.5); |
| 29 | + hr_u->SetBarOffset(0); |
| 30 | + hr_u->SetFillColor(2); |
| 31 | + hr_u->SetStats(0); |
| 32 | + hr_u->SetXTitle("Bar Number"); |
| 33 | + hr_u->SetYTitle("Occupancy"); |
| 34 | + hr_u->SetTitleSize(0.05,"X"); |
| 35 | + hr_u->GetXaxis()->CenterTitle(); |
| 36 | + hr_u->SetTitleSize(0.05,"Y"); |
| 37 | + hr_u->GetYaxis()->CenterTitle(); |
| 38 | + hr_u->GetYaxis()->SetRangeUser(0,1.1*hr_u->GetMaximum()); |
| 39 | + } |
| 40 | + if(hr_d){ |
| 41 | + hr_d->SetBarWidth(0.5); |
| 42 | + hr_d->SetBarOffset(0.5); |
| 43 | + hr_d->SetFillColor(3); |
| 44 | + hr_d->SetStats(0); |
| 45 | + } |
| 46 | + |
| 47 | + if(h_de){ |
| 48 | + h_de->SetXTitle("Bar Number"); |
| 49 | + h_de->SetYTitle("Energy GeV"); |
| 50 | + h_de->SetStats(0); |
| 51 | + h_de->SetTitleSize(0.05,"X"); |
| 52 | + h_de->GetXaxis()->CenterTitle(); |
| 53 | + h_de->SetTitleSize(0.05,"Y"); |
| 54 | + h_de->GetYaxis()->CenterTitle(); |
| 55 | + } |
| 56 | + |
| 57 | + if(h_t){ |
| 58 | + h_t->SetXTitle("Bar Number"); |
| 59 | + h_t->SetYTitle("Calibrated Time"); |
| 60 | + h_t->SetStats(0); |
| 61 | + h_t->SetTitleSize(0.05,"X"); |
| 62 | + h_t->GetXaxis()->CenterTitle(); |
| 63 | + h_t->SetTitleSize(0.05,"Y"); |
| 64 | + h_t->GetYaxis()->CenterTitle(); |
| 65 | + } |
| 66 | + |
| 67 | + if(h_t_adc){ |
| 68 | + h_t_adc->SetXTitle("Bar Number"); |
| 69 | + h_t_adc->SetYTitle("Calibrated ADC Time"); |
| 70 | + h_t_adc->SetStats(0); |
| 71 | + h_t_adc->SetTitleSize(0.05,"X"); |
| 72 | + h_t_adc->GetXaxis()->CenterTitle(); |
| 73 | + h_t_adc->SetTitleSize(0.05,"Y"); |
| 74 | + h_t_adc->GetYaxis()->CenterTitle(); |
| 75 | + } |
| 76 | + |
| 77 | + if(h_adc_tdc){ |
| 78 | + h_adc_tdc->SetXTitle("Bar Number"); |
| 79 | + h_adc_tdc->SetYTitle("ADC - TDC Time"); |
| 80 | + h_adc_tdc->SetTitleSize(0.05,"X"); |
| 81 | + h_adc_tdc->GetXaxis()->CenterTitle(); |
| 82 | + h_adc_tdc->SetTitleSize(0.05,"Y"); |
| 83 | + h_adc_tdc->GetYaxis()->CenterTitle(); |
| 84 | + } |
| 85 | + |
| 86 | + legend_ru->AddEntry(hr_u,"Up","f"); |
| 87 | + legend_rd->AddEntry(hr_d,"Down","f"); |
| 88 | + |
| 89 | + if(gPad == NULL){ |
| 90 | + TCanvas *c1 = new TCanvas("c1"); |
| 91 | + c1->cd(0); |
| 92 | + c1->Draw(); |
| 93 | + c1->Update(); |
| 94 | + } |
| 95 | + if(!gPad) {savedir->cd(); return;} |
| 96 | + |
| 97 | + TCanvas *c1 = gPad->GetCanvas(); |
| 98 | + c1->cd(0); |
| 99 | + c1->Clear(); |
| 100 | + |
| 101 | + c1->Divide(3,1); |
| 102 | + |
| 103 | + //TVirtualPad *pad1 = c1->cd(1); |
| 104 | + //pad1->SetTicks(); |
| 105 | + //pad1->SetGridy(); |
| 106 | + //if(hr_u) hr_u->Draw("BAR"); |
| 107 | + //if(hr_d) hr_d->Draw("BAR sames"); |
| 108 | + |
| 109 | + //legend_ru->Draw(); |
| 110 | + //legend_rd->Draw(); |
| 111 | + |
| 112 | + TVirtualPad *pad1 = c1->cd(1); |
| 113 | + pad1->SetTicks(); |
| 114 | + pad1->SetGridy(); |
| 115 | + if(h_de) h_de->Draw("BAR colz0"); |
| 116 | + |
| 117 | + TVirtualPad *pad2 = c1->cd(2); |
| 118 | + pad2->SetTicks(); |
| 119 | + pad2->SetGridy(); |
| 120 | + if(h_t) h_t->Draw("BAR colz0"); |
| 121 | + |
| 122 | + //TVirtualPad *pad4 = c1->cd(4); |
| 123 | + //pad4->SetTicks(); |
| 124 | + //pad4->SetGridy(); |
| 125 | + //if(h_t_adc) h_t_adc->Draw("BAR colz0"); |
| 126 | + |
| 127 | + TVirtualPad *pad3 = c1->cd(3); |
| 128 | + pad3->SetTicks(); |
| 129 | + pad3->SetGridy(); |
| 130 | + if(h_adc_tdc) h_adc_tdc->Draw("BAR colz0"); |
| 131 | + |
| 132 | +#ifdef ROOTSPY_MACROS |
| 133 | + // ------ The following is used by RSAI -------- |
| 134 | + if( rs_GetFlag("Is_RSAI")==1 ){ |
| 135 | + auto min_events = 5*rs_GetFlag("MIN_EVENTS_RSAI"); |
| 136 | + if( min_events < 1 ) min_events = 5E5; |
| 137 | + if( adc_events >= min_events ) { |
| 138 | + cout << "CTOF Flagging AI check after " << adc_events << " events (>=" << min_events << ")" << endl; |
| 139 | + rs_SavePad("CTOF_occupancy", 0); |
| 140 | + rs_ResetAllMacroHistos("//CTOF_occupancy"); |
| 141 | + } |
| 142 | + } |
| 143 | +#endif |
| 144 | + |
| 145 | +} |
0 commit comments