From e6c662042691180df25805578b906b3a44b130d5 Mon Sep 17 00:00:00 2001 From: "Ryan@SOLARIS-MAC" Date: Fri, 7 Apr 2023 16:22:37 -0400 Subject: [PATCH] ChainMonitor.C find the time and canvas title --- armory/AnalysisLib.h | 9 +- armory/GeneralSortAgent.C | 2 + armory/Monitor_Util.C | 350 +++++++++++++------------------------- armory/Process_Download | 71 +++++--- armory/Process_Run | 48 ++++-- working/ChainMonitors.C | 60 ++++--- working/Monitor.C | 96 ++++++----- working/Monitor.h | 55 +++--- 8 files changed, 312 insertions(+), 379 deletions(-) diff --git a/armory/AnalysisLib.h b/armory/AnalysisLib.h index cad3c56..557f4b5 100644 --- a/armory/AnalysisLib.h +++ b/armory/AnalysisLib.h @@ -316,7 +316,7 @@ DetGeo detGeo; ReactionConfig reactionConfig; void LoadDetGeoAndReactionConfigFile(std::string detGeoFileName = "detectorGeo.txt", std::string reactionConfigFileName = "reactionConfig.txt"){ - printf("=======================\n"); + printf("=====================================================\n"); printf(" loading detector geometery : %s.", detGeoFileName.c_str()); TMacro * haha = new TMacro(); if( haha->ReadFile(detGeoFileName.c_str()) > 0 ) { @@ -327,7 +327,7 @@ void LoadDetGeoAndReactionConfigFile(std::string detGeoFileName = "detectorGeo.t printf("... fail\n"); } - printf("=======================\n"); + printf("=====================================================\n"); printf(" loading reaction config : %s.", reactionConfigFileName.c_str()); TMacro * kaka = new TMacro(); if( kaka->ReadFile(reactionConfigFileName.c_str()) > 0 ) { @@ -495,7 +495,7 @@ void LoadReactionParas(bool verbose = false){ printf("\tslope : %f MeV/mm \n", alpha * betRel); printf("\tdet radius: %f mm \n", detGeo.detPerpDist); printf("\tG-coeff : %f MeV \n", G); - printf("=================================\n"); + printf("=====================================================\n"); } }else{ @@ -554,6 +554,8 @@ std::vector CalExTheta(double e, double z){ TObjArray * LoadListOfTCut(TString fileName, TString cutName = "cutList"){ + if( fileName == "" ) return nullptr; + TObjArray * cutList = nullptr; TFile * fCut = new TFile(fileName); @@ -583,6 +585,7 @@ TObjArray * LoadListOfTCut(TString fileName, TString cutName = "cutList"){ TCutG * LoadSingleTCut( TString fileName, TString cutName = "cutEZ"){ + if( fileName == "" ) return nullptr; TCutG * cut = nullptr; TFile * fCut = new TFile(fileName); diff --git a/armory/GeneralSortAgent.C b/armory/GeneralSortAgent.C index 16c8e10..63db067 100644 --- a/armory/GeneralSortAgent.C +++ b/armory/GeneralSortAgent.C @@ -17,6 +17,8 @@ void GeneralSortAgent(Int_t runNum, int nWorker = 1, int traceMethod = -1){ printf("\033[1;33m---------------------total number of Events %llu\033[0m\n", chain->GetEntries()); + if( chain->GetEntries() == 0 ) return; + //this is the option for TSelector, the first one is traceMethod, 2nd is save fileName; TString option; diff --git a/armory/Monitor_Util.C b/armory/Monitor_Util.C index c1437e0..fa817a7 100644 --- a/armory/Monitor_Util.C +++ b/armory/Monitor_Util.C @@ -3,7 +3,6 @@ #include #include -#include "../working/Mapping.h" //This file runs after on Monitor.C //This file is parasite on Monitor.C @@ -15,43 +14,39 @@ void listDraws(void) { printf(" newCanvas() - Create a new Canvas\n"); printf("-----------------------------------------------------\n"); printf(" rawID() - Raw \033[0;31me\033[0m, \033[0;31mring\033[0m, \033[0;31mxf\033[0m, \033[0;31mxn\033[0m vs detID\n"); - printf(" rawe() - Raw \033[0;31me\033[0m for all %d detectors\n", mapping::NARRAY); - printf(" rawxf() - Raw \033[0;31mxf\033[0m for all %d detectors\n", mapping::NARRAY); - printf(" rawxn() - Raw \033[0;31mxn\033[0m for all %d detectors\n", mapping::NARRAY); - printf(" xfVxn() - Raw \033[0;31mxf\033[0m vs. \033[0;31mxn\033[0m for all %d detectors\n", mapping::NARRAY); - printf(" eVxs() - Raw \033[0;31me\033[0m vs. Raw \033[0;31mxs = xf + xn\033[0m for all %d detectors\n", mapping::NARRAY); - printf(" eVx() - Raw \033[0;31me\033[0m vs. RAW \033[0;31mx\033[0m for all %d detectors\n", mapping::NARRAY); + printf(" rawe() - Raw \033[0;31me\033[0m for all %d detectors\n", numDet); + printf(" rawxf() - Raw \033[0;31mxf\033[0m for all %d detectors\n", numDet); + printf(" rawxn() - Raw \033[0;31mxn\033[0m for all %d detectors\n", numDet); + printf(" rawxfVxn() - Raw \033[0;31mxf\033[0m vs. \033[0;31mxn\033[0m for all %d detectors\n", numDet); + printf(" raweVxs() - Raw \033[0;31me\033[0m vs. Raw \033[0;31mxs = xf + xn\033[0m for all %d detectors\n", numDet); + printf(" raweVx() - Raw \033[0;31me\033[0m vs. RAW \033[0;31mx\033[0m for all %d detectors\n", numDet); printf("-----------------------------------------------------\n"); - printf(" eVxsCal() - Raw \033[0;31me\033[0m vs. Corrected \033[0;31mxs\033[0m for all %d detectors\n", mapping::NARRAY); - printf(" ecal() - Calibrated \033[0;31me\033[0m for all %d detectors\n", mapping::NARRAY); - printf(" ecal2() - Calibrated \033[0;31me\033[0m for all %d detectors (same row or same col)\n", mapping::NARRAY); - printf("xfCalVxnCal() - Calibrated \033[0;31mxf\033[0m vs. \033[0;31mxn\033[0m for all %d detectors\n", mapping::NARRAY); - printf("-----------------------------------------------------\n"); - printf(" eCalVxCal() - Cal \033[0;31me\033[0m vs. \033[0;31mx\033[0m for all %d detectors\n", mapping::NARRAY); + printf(" eVxsCal() - Raw \033[0;31me\033[0m vs. Corrected \033[0;31mxs\033[0m for all %d detectors\n", numDet); + printf(" ecal() - Calibrated \033[0;31me\033[0m for all %d detectors\n", numDet); + printf("xfCalVxnCal() - Calibrated \033[0;31mxf\033[0m vs. \033[0;31mxn\033[0m for all %d detectors\n", numDet); + printf(" eCalVxCal() - Cal \033[0;31me\033[0m vs. \033[0;31mx\033[0m for all %d detectors\n", numDet); printf("-----------------------------------------------------\n"); printf(" recoils() - Raw DE vs. E Recoil spectra\n"); -// printf(" elum() - Luminosity Energy Spectra\n"); -// printf(" ic() - Ionization Chamber Spectra\n"); + //printf(" elum() - Luminosity Energy Spectra\n"); + //printf(" ic() - Ionization Chamber Spectra\n"); printf("-----------------------------------------------------\n"); printf(" eCalVz() - Energy vs. Z\n"); printf(" eCalVzRow() - Energy vs. Z for each row\n"); printf(" excite() - Excitation Energy\n"); printf(" ExThetaCM() - Ex vs ThetaCM\n"); - printf(" ExVxCal() - Ex vs X for all %d detectors\n", mapping::NARRAY); - //printf(" eSVeRaw() - e(Ex,z) vs eRaw for all %d detectors\n", mapping::NARRAY); + printf(" ExVxCal() - Ex vs X for all %d detectors\n", numDet); printf("-----------------------------------------------------\n"); printf(" ShowFitMethod() - Shows various fitting methods \n"); printf(" RDTCutCreator() - Create RDT Cuts [May need to edit]\n"); printf(" Check_rdtGate() - Check RDT Cuts. \n"); printf(" readTrace() - read trace from gen_runXXX.root \n"); printf(" readRawTrace() - read trace from runXXX.root \n"); -// printf(" Check1D() - Count Integral within a range\n"); + printf(" Check1D() - Count Integral within a range\n"); printf("-----------------------------------------------------\n"); printf(" %s\n", canvasTitle.Data()); printf("-----------------------------------------------------\n"); } - int xD, yD; void FindBesCanvasDivision(int nPad){ for( int i = TMath::Sqrt(nPad); i >= 2 ; i--){ @@ -71,10 +66,6 @@ void newCanvas(int sizeX = 800, int sizeY = 600, int posX = 0, int posY = 0){ cNewCanvas->cd(); } - -//TODO set histogram y-axis all the same heigh - - void rawID(){ TCanvas * cRawID = (TCanvas *) gROOT->FindObjectAny("cRawID"); if( cRawID == NULL ) cRawID = new TCanvas("cRawID", Form("Raw e, Ring, xf, xn vs ID | %s", canvasTitle.Data()), canvasSize[0], canvasSize[1]); @@ -89,7 +80,7 @@ void rawe(Bool_t isLogy = false) { TCanvas *cRawE = (TCanvas *) gROOT->FindObjectAny("cRawE"); if( cRawE == NULL ) cRawE = new TCanvas("cRawE",Form("E raw | %s", canvasTitle.Data()),canvasSize[0], canvasSize[1]); cRawE->Clear();cRawE->Divide(numCol,numRow); - for (Int_t i=0; i < mapping::NARRAY; i++) { + for (Int_t i=0; i < numDet; i++) { cRawE->cd(i+1); cRawE->cd(i+1)->SetGrid(); if( isLogy ) cRawE->cd(i+1)->SetLogy(); @@ -101,7 +92,7 @@ void rawxf(Bool_t isLogy = false) { TCanvas *cRawXf = (TCanvas *) gROOT->FindObjectAny("cRawXf"); if( cRawXf == NULL ) cRawXf = new TCanvas("cRawXf",Form("Xf raw | %s", canvasTitle.Data()),canvasSize[0], canvasSize[1]); cRawXf->Clear();cRawXf->Divide(numCol,numRow); - for (Int_t i=0; icd(i+1); cRawXf->cd(i+1)->SetGrid(); if( isLogy ) cRawXf->cd(i+1)->SetLogy(); @@ -113,7 +104,7 @@ void rawxn(Bool_t isLogy = false) { TCanvas *cRawXn = (TCanvas *) gROOT->FindObjectAny("cRawXn"); if( cRawXn == NULL ) cRawXn = new TCanvas("cRawXn",Form("Xn raw | %s", canvasTitle.Data()),canvasSize[0], canvasSize[1]); cRawXn->Clear();cRawXn->Divide(numCol,numRow); - for (Int_t i=0; icd(i+1); cRawXn->cd(i+1)->SetGrid(); if( isLogy ) cRawXn->cd(i+1)->SetLogy(); @@ -121,23 +112,23 @@ void rawxn(Bool_t isLogy = false) { } } -void xfVxn(void) { +void rawxfVxn(void) { TCanvas *cxfxn = (TCanvas *) gROOT->FindObjectAny("cxfxn"); if( cxfxn == NULL ) cxfxn = new TCanvas("cxfxn",Form("XF vs. XN | %s", canvasTitle.Data()),canvasSize[0], canvasSize[1]); cxfxn->Clear(); cxfxn->Divide(numCol,numRow); - for (Int_t i=0;icd(i+1); cxfxn->cd(i+1)->SetGrid(); hxfVxn[i]->Draw("col"); } } -void eVxs(void) { +void raweVxs(void) { TCanvas *cxfxne = (TCanvas *) gROOT->FindObjectAny("cxfxne"); if( cxfxne == NULL ) cxfxne = new TCanvas("cxfxne",Form("E - XF+XN | %s", canvasTitle.Data()),canvasSize[0], canvasSize[1]); cxfxne->Clear(); cxfxne->Divide(numCol,numRow); TLine line(0,0, 4000, 4000); line.SetLineColor(2); - for (Int_t i=0;icd(i+1); cxfxne->cd(i+1)->SetGrid(); heVxs[i]->Draw("col"); @@ -145,11 +136,33 @@ void eVxs(void) { } } +void raweVx(void) { + TCanvas *ceVx = (TCanvas *) gROOT->FindObjectAny("ceVx"); + if(ceVx == NULL) ceVx = new TCanvas("ceVx",Form("E vs. X = (xf-xn)/e | %s", canvasTitle.Data()),canvasSize[0], canvasSize[1]); + ceVx->Clear(); ceVx->Divide(numCol,numRow); + for (Int_t i=0;icd(i+1); heVx[i]->Draw("col"); + } +} + +void eVxsCal(void) { + TCanvas *cxfxneC = (TCanvas *) gROOT->FindObjectAny("cxfxneC"); + if(cxfxneC == NULL)cxfxneC = new TCanvas("cxfxneC",Form("Raw E - Corrected XF+XN | %s", canvasTitle.Data()),canvasSize[0], canvasSize[1]); + cxfxneC->Clear(); cxfxneC->Divide(numCol,numRow); + TLine line(0,0, 4000, 4000); line.SetLineColor(2); + for (Int_t i=0;icd(i+1); + cxfxneC->cd(i+1)->SetGrid(); + heVxsCal[i]->Draw("col"); + line.Draw("same"); + } +} + void ecal(void) { TCanvas *cEC = (TCanvas *) gROOT->FindObjectAny("cEC"); if(cEC == NULL) cEC = new TCanvas("cEC",Form("E corrected | %s", canvasTitle.Data()),canvasSize[0], canvasSize[1]); cEC->Clear();cEC->Divide(numCol,numRow); - for (Int_t i=0; icd(i+1); cEC->cd(i+1)->SetGrid(); heCal[i]->Draw(""); @@ -161,91 +174,52 @@ void ecal(void) { heCalID->Draw("colz"); } -void ecal2(void) { - TCanvas *cECall = (TCanvas *) gROOT->FindObjectAny("cECall"); - if(cECall == NULL) cECall = new TCanvas("cECall",Form("E corrected | %s", canvasTitle.Data()),canvasSize[0], canvasSize[1]); - - int maxRC = TMath::Max(numRow, numCol); - cECall->Clear();cECall->Divide(maxRC,2); - //plot same position - for(int i = 0; i < numCol ; i++){ - cECall->cd(i+1); - cECall->cd(i+1)->SetGrid(); - heCal[i]->SetLineColor(1); heCal[i]->Draw(""); - for(int j = 1 ; j < numRow; j++){ - heCal[numCol*j + i]->SetLineColor(j+1); - heCal[numCol*j + i]->Draw("same"); - } - } - //plot same side - TH1F * heC2[mapping::NARRAY]; - for (Int_t i = 0; i< numRow; i++) { - cECall->cd(i+maxRC+1); - cECall->cd(i+maxRC+1)->SetGrid(); - heC2[numCol*i] = (TH1F* )heCal[numCol*i]->Clone(); - heC2[numCol*i]->SetLineColor(1); heC2[numCol*i]->Draw(""); - for( int j = 1; j < numCol; j++){ - heC2[numCol*i+j] = (TH1F* )heCal[numCol*i+j]->Clone(); - heC2[numCol*i+j]->SetLineColor(j+1); - heC2[numCol*i+j]->Draw("same"); - } - } -} - - void xfCalVxnCal(void) { TCanvas *cxfxnC = (TCanvas *) gROOT->FindObjectAny("cxfxnC"); if(cxfxnC == NULL) cxfxnC = new TCanvas("cxfxnC",Form("XF vs XN corrected | %s", canvasTitle.Data()),canvasSize[0], canvasSize[1]); cxfxnC->Clear(); cxfxnC->Divide(numCol,numRow); - for (Int_t i=0;icd(i+1); cxfxnC->cd(i+1)->SetGrid(); hxfCalVxnCal[i]->Draw("col"); } } -void eVxsCal(void) { - TCanvas *cxfxneC = (TCanvas *) gROOT->FindObjectAny("cxfxneC"); - if(cxfxneC == NULL)cxfxneC = new TCanvas("cxfxneC",Form("Raw E - Corrected XF+XN | %s", canvasTitle.Data()),canvasSize[0], canvasSize[1]); - cxfxneC->Clear(); cxfxneC->Divide(numCol,numRow); - TLine line(0,0, 4000, 4000); line.SetLineColor(2); - for (Int_t i=0;icd(i+1); - cxfxneC->cd(i+1)->SetGrid(); - heVxsCal[i]->Draw("col"); - line.Draw("same"); - } -} - -void eVx(void) { - TCanvas *ceVx = (TCanvas *) gROOT->FindObjectAny("ceVx"); - if(ceVx == NULL) ceVx = new TCanvas("ceVx",Form("E vs. X = (xf-xn)/e | %s", canvasTitle.Data()),canvasSize[0], canvasSize[1]); - ceVx->Clear(); ceVx->Divide(numCol,numRow); - for (Int_t i=0;icd(i+1); heVx[i]->Draw("col"); - } -} - void eCalVxCal(void) { TCanvas *cecalVxcal = (TCanvas *) gROOT->FindObjectAny("cecalVxcal"); if( cecalVxcal == NULL ) cecalVxcal = new TCanvas("cecalVxcal",Form("ECALVXCAL | %s",canvasTitle.Data()),canvasSize[0], canvasSize[1]); cecalVxcal->Clear(); cecalVxcal->Divide(numCol,numRow); - for (Int_t i=0;icd(i+1); heCalVxCal[i]->SetMarkerStyle(7); heCalVxCal[i]->Draw(""); } } -void eCalVxCalG(void) { - TCanvas *cecalVxcalG = (TCanvas *) gROOT->FindObjectAny("cecalVxcalG"); - if( cecalVxcalG == NULL ) cecalVxcalG = new TCanvas("cecalVxcalG",Form("ECALVXCAL | %s",canvasTitle.Data()),canvasSize[0], canvasSize[1]); - cecalVxcalG->Clear(); cecalVxcalG->Divide(numCol,numRow); - for (Int_t i=0;icd(i+1); - heCalVxCalG[i]->SetMarkerStyle(7); - heCalVxCalG[i]->Draw(""); - } +void recoils(bool isLogz = false) { + TCanvas *crdt = (TCanvas *) gROOT->FindObjectAny("crdt"); + if( crdt == NULL ) crdt = new TCanvas("crdt",Form("raw RDT | %s", canvasTitle.Data()),1700, 0, 1000,1000); + crdt->Clear();crdt->Divide(2,2); + + if( isLogz ) crdt->cd(1)->SetLogz(); crdt->cd(1); hrdt2D[0]->Draw("col"); + if( isLogz ) crdt->cd(2)->SetLogz(); crdt->cd(2); hrdt2D[1]->Draw("col"); + if( isLogz ) crdt->cd(3)->SetLogz(); crdt->cd(3); hrdt2D[3]->Draw("col"); + if( isLogz ) crdt->cd(4)->SetLogz(); crdt->cd(4); hrdt2D[2]->Draw("col"); + + TCanvas *crdtID = (TCanvas *) gROOT->FindObjectAny("crdtID"); + if( crdtID == NULL ) crdtID = new TCanvas("crdtID",Form("raw RDT ID | %s", canvasTitle.Data()),0,0, 500, 500); + crdtID->Clear(); + if( isLogz ) crdtID->SetLogz(); + hrdtID->Draw("colz"); + + TCanvas *crdtS = (TCanvas *) gROOT->FindObjectAny("crdtS"); + if( crdtS == NULL ) crdtS = new TCanvas("crdtS",Form("raw RDT | %s", canvasTitle.Data()),600, 0, 1000, 1000); + crdtS->Clear(); crdtS->Divide(2,4); + for( int i = 0; i < 8; i ++){ + crdtS->cd(i+1); + if( isLogz ) crdtS->cd(i+1)->SetLogy(); + hrdt[i]->Draw(""); + } } // void elum(void) { @@ -264,65 +238,21 @@ void eCalVxCalG(void) { // } -// void apollo(void) { -// TCanvas *capollo = (TCanvas *) gROOT->FindObjectAny("capollo"); -// if( capollo == NULL ) capollo = new TCanvas("capollo",Form("APOLLO | %s", canvasTitle.Data()),1000,1000); -// capollo->Clear(); capollo->Divide(5,4); -// for( int i = 0 ; i < 20 ; i++){ -// capollo->cd(i+1); -// hApollo[i]->Draw(""); -// } + +// void ic(){ +// TCanvas *cic = (TCanvas *) gROOT->FindObjectAny("cic"); +// if( cic == NULL ) cic = new TCanvas("cic",Form("Ionization Chamber | %s", canvasTitle.Data() ),1200,800); + +// cic->Clear(); cic->SetGrid(0); cic->Divide(3,2); +// gStyle->SetOptStat("neiou"); + +// cic->cd(1); hic0->Draw(); +// cic->cd(2); hic1->Draw(); +// cic->cd(3); hic2->Draw(); +// cic->cd(4); hic01->Draw("colz"); +// cic->cd(5); hic02->Draw("colz"); +// cic->cd(6); hic12->Draw("colz"); // } - - -void recoils(bool isLogz = false) { - TCanvas *crdt = (TCanvas *) gROOT->FindObjectAny("crdt"); - if( crdt == NULL ) crdt = new TCanvas("crdt",Form("raw RDT | %s", canvasTitle.Data()),1700, 0, 1000,1000); - crdt->Clear();crdt->Divide(2,2); - - if( isLogz ) crdt->cd(1)->SetLogz(); crdt->cd(1); hrdt2D[0]->Draw("col"); - if( isLogz ) crdt->cd(2)->SetLogz(); crdt->cd(2); hrdt2D[1]->Draw("col"); - if( isLogz ) crdt->cd(3)->SetLogz(); crdt->cd(3); hrdt2D[3]->Draw("col"); - if( isLogz ) crdt->cd(4)->SetLogz(); crdt->cd(4); hrdt2D[2]->Draw("col"); - - - //TCanvas *crdtSum = (TCanvas *) gROOT->FindObjectAny("crdtSum"); - //if( crdtSum == NULL ) crdtSum = new TCanvas("crdtSum",Form("raw RDT dE-Esum | %s", canvasTitle.Data()),100, 0, 1000,1000); - //crdtSum->Clear();crdtSum->Divide(2,2); - // - //if( isLogz ) crdtSum->cd(1)->SetLogz(); crdtSum->cd(1); hrdt2Dsum[0]->Draw("col"); - //if( isLogz ) crdtSum->cd(2)->SetLogz(); crdtSum->cd(2); hrdt2Dsum[1]->Draw("col"); - //if( isLogz ) crdtSum->cd(3)->SetLogz(); crdtSum->cd(3); hrdt2Dsum[3]->Draw("col"); - //if( isLogz ) crdtSum->cd(4)->SetLogz(); crdtSum->cd(4); hrdt2Dsum[2]->Draw("col"); - - TCanvas *crdtID = (TCanvas *) gROOT->FindObjectAny("crdtID"); - if( crdtID == NULL ) crdtID = new TCanvas("crdtID",Form("raw RDT ID | %s", canvasTitle.Data()),0,0, 500, 500); - crdtID->Clear(); - if( isLogz ) crdtID->SetLogz(); - hrdtID->Draw("colz"); - - TCanvas *crdtS = (TCanvas *) gROOT->FindObjectAny("crdtS"); - if( crdtS == NULL ) crdtS = new TCanvas("crdtS",Form("raw RDT | %s", canvasTitle.Data()),600, 0, 1000, 1000); - crdtS->Clear(); crdtS->Divide(2,4); - for( int i = 0; i < 8; i ++){ - crdtS->cd(i+1); - if( isLogz ) crdtS->cd(i+1)->SetLogy(); - hrdt[i]->Draw(""); - } - - //TCanvas *crdtTAC = (TCanvas *) gROOT->FindObjectAny("crdtTAC"); - //if( crdtTAC == NULL ) crdtTAC = new TCanvas("crdtTAC",Form("raw RDTtac | %s", canvasTitle.Data()),0,0, 1600, 1600); - //crdtTAC->Clear(); crdtTAC->Divide(2,4); - //for( int i = 0; i < 8; i ++){ - // crdtTAC->cd(i+1); - // htacRecoil[i]->Draw("colz"); - //} - //for( int i = 0; i < 4; i ++){ - // crdtTAC->cd(i+1+8); - // htacRecoilsum[i]->Draw("colz"); - //} - -} void eCalVz(void) { TCanvas *cecalVz = (TCanvas *) gROOT->FindObjectAny("cecalVz"); @@ -345,7 +275,6 @@ void eCalVzRow() { cecalVzRow->cd(row+1)->SetGrid(); hecalVzRow[row]->Draw("colz"); } - } void excite(void) { @@ -360,14 +289,12 @@ void excite(void) { if( cexI == NULL ) cexI = new TCanvas("cexI",Form("EX : %s", canvasTitle.Data()),500, 0, 1600,1000); cexI->Clear();cexI->Divide(numCol,numRow); gStyle->SetOptStat("neiou"); - for( int i = 0; i < mapping::NARRAY; i++){ + for( int i = 0; i < numDet; i++){ cexI->cd(i+1); hExi[i]->Draw(""); } - } - void ExThetaCM(void) { TCanvas *cExThetaCM = (TCanvas *) gROOT->FindObjectAny("cExThetaCM"); if( cExThetaCM == NULL ) cExThetaCM = new TCanvas("cExThetaCM",Form("EX - ThetaCM | %s", canvasTitle.Data()),650,650); @@ -383,98 +310,49 @@ void ExVxCal(TString drawOpt = "") { gStyle->SetOptStat("neiou"); cExVxCal->Divide(numCol,numRow); - for( int i = 0; i < mapping::NARRAY; i++){ + for( int i = 0; i < numDet; i++){ cExVxCal->cd(i+1); if( drawOpt == "" )hExVxCal[i]->SetMarkerStyle(7); hExVxCal[i]->Draw(drawOpt); } - } - -//void eSVeRaw(void) { -// TCanvas *ceSVeRaw = (TCanvas *) gROOT->FindObjectAny("ceSVeRaw"); -// if( ceSVeRaw == NULL ) ceSVeRaw = new TCanvas("ceSVeRaw",Form("e(Ex,z) vs eRaw | %s", canvasTitle.Data()),1000,650); -// ceSVeRaw->Clear(); -// gStyle->SetOptStat("neiou"); -// -// ceSVeRaw->Divide(numCol,numRow); -// for( int i = 0; i < mapping::NARRAY; i++){ -// ceSVeRaw->cd(i+1); -// heSVeRaw[i]->SetMarkerStyle(7); -// heSVeRaw[i]->Draw(""); -// } -// -//} - -// void tac(void) { -// TCanvas *ctac = (TCanvas *) gROOT->FindObjectAny("ctac"); -// if( ctac == NULL ) ctac = new TCanvas("ctac",Form("ARRAY-RDT | %s", canvasTitle.Data() ),1000,650); -// ctac->Clear();ctac->SetGrid(0);ctac->Divide(numCol,numRow); -// gStyle->SetOptStat("neiou"); -// for (Int_t i=0;icd(i+1); htacArray[i]->Draw(""); -// // cutG = (TCutG *)cutList->At(i); -// // cutG->Draw("same"); -// } -// } - - -// void ic(){ - -// TCanvas *cic = (TCanvas *) gROOT->FindObjectAny("cic"); -// if( cic == NULL ) cic = new TCanvas("cic",Form("Ionization Chamber | %s", canvasTitle.Data() ),1200,800); - -// cic->Clear(); cic->SetGrid(0); cic->Divide(3,2); -// gStyle->SetOptStat("neiou"); - -// cic->cd(1); hic0->Draw(); -// cic->cd(2); hic1->Draw(); -// cic->cd(3); hic2->Draw(); -// cic->cd(4); hic01->Draw("colz"); -// cic->cd(5); hic02->Draw("colz"); -// cic->cd(6); hic12->Draw("colz"); - -// } - - - -// void Count1DH(TString name, TH1F * hist, TCanvas * canvas, int padID, double x1, double x2, Color_t color){ +void Count1DH(TString name, TH1F * hist, TCanvas * canvas, int padID, double x1, double x2, Color_t color){ -// int k1 = hist->FindBin(x1); -// int k2 = hist->FindBin(x2); + int k1 = hist->FindBin(x1); + int k2 = hist->FindBin(x2); -// int hight = 0 ; -// for( int i = k1; i < k2 ; i ++){ -// int temp = hist->GetBinContent(i); -// if( temp > hight ) hight = temp; -// } -// hight = hight * 1.2; -// int max = hist->GetMaximum(); + int hight = 0 ; + for( int i = k1; i < k2 ; i ++){ + int temp = hist->GetBinContent(i); + if( temp > hight ) hight = temp; + } + hight = hight * 1.2; + int max = hist->GetMaximum(); -// canvas->cd(padID); + canvas->cd(padID); -// if( color != 0 ){ -// TBox box; -// box.SetFillColorAlpha(color, 0.1); -// box.DrawBox(x1, 0, x2, hight); -// } + if( color != 0 ){ + TBox box; + box.SetFillColorAlpha(color, 0.1); + box.DrawBox(x1, 0, x2, hight); + } -// int count = hist->Integral(k1, k2); + int count = hist->Integral(k1, k2); -// TLatex text; -// text.SetTextFont(82); -// text.SetTextSize(0.06); -// if( color != 0 ){ -// text.SetTextColor(color); -// text.DrawLatex(x1, hight, Form("%d", count)); -// }else{ -// text.DrawLatex((x1+x2)/2., max, Form("%d", count)); -// } + TLatex text; + text.SetTextFont(82); + text.SetTextSize(0.06); + if( color != 0 ){ + text.SetTextColor(color); + text.DrawLatex(x1, hight, Form("%d", count)); + }else{ + text.DrawLatex((x1+x2)/2., max, Form("%d", count)); + } -// printf(" %s : %d \n", name.Data(), count); + printf(" %s : %d \n", name.Data(), count); -// } +} diff --git a/armory/Process_Download b/armory/Process_Download index 91c8127..042be0c 100755 --- a/armory/Process_Download +++ b/armory/Process_Download @@ -21,21 +21,29 @@ USR=solaris if [ ${RUN} == "all" ]; then if [ ${PCID} -eq 2 ]; then - #============ Get the raw data - rsync -avuht --progress $USR@$IP:$rawDataPath/$expName_* $MacRawDataPath/data/. - - echo -e "$YELLOW======== rsync RunTimeStamp.dat $NC" - rsync -avuht --progress $USR@$IP:$rawDataPath/$RunTimeStamp* $MacRawDataPath/data/. - - echo -e "$YELLOW======== rsync expName.sh $NC" - rsync -avuht --progress $USR@$IP:Analysis/working/expName.sh $SOLARISANADIR/working/. - echo -e "$YELLOW=============================================$NC" - tail -10 $MacRawDataPath/data/RunTimeStamp.dat - echo -e "$YELLOW=============================================$NC" + #=========== Ping to check the connectivity + echo "Checking $IP connetivity, max wait for 3 sec...." + ping -c 3 -W 3 $IP #> /dev/null + if [ $? -ne 0 ]; then + echo -e "$RED !!!!!!! $IP is not alive $NC" + else + #============ Get the raw data + rsync -avuht --progress $USR@$IP:$rawDataPath/$expName_* $MacRawDataPath/data/. + + echo -e "$YELLOW======== rsync RunTimeStamp.dat $NC" + rsync -avuht --progress $USR@$IP:$rawDataPath/$RunTimeStamp* $MacRawDataPath/data/. + + echo -e "$YELLOW======== rsync expName.sh $NC" + rsync -avuht --progress $USR@$IP:Analysis/working/expName.sh $SOLARISANADIR/working/. + fi else echo -e "$RED############### Only in SOLARIS MAC can donwload data. skip.$NC" fi + + echo -e "$YELLOW=============================================$NC" + tail -10 $MacRawDataPath/data/RunTimeStamp.dat + echo -e "$YELLOW=============================================$NC" exit 1 fi @@ -50,31 +58,36 @@ else fi RUN=$(printf '%03d' ${RUN}) -echo $RUN - ####################################### #################### Download raw data echo -e "${RED}######################### Download raw data: run ${RUN}${NC}" if [ ${PCID} -eq 2 ]; then - #============ Get the raw data - echo -e "================= RUN $RUN: Get the raw data `date`" - - rsync -avuht --progress $USR@$IP:$rawDataPath/$expName_$RUN* $MacRawDataPath/data/. - - echo -e "$YELLOW======== rsync RunTimeStamp.dat $NC" - rsync -avuht --progress $USR@$IP:$rawDataPath/$RunTimeStamp* $MacRawDataPath/data/. - - echo -e "$YELLOW======== rsync expName.sh $NC" - rsync -avuht --progress $USR@$IP:Analysis/working/expName.sh $SOLARISANADIR/working/. - echo -e "$YELLOW=============================================$NC" - tail -10 $MacRawDataPath/data/RunTimeStamp.dat - echo -e "$YELLOW=============================================$NC" - + #=========== Ping to check the connectivity + echo "Checking $IP connetivity, max wait for 3 sec...." + ping -c 3 $IP -W 3 #> /dev/null + if [ $? -ne 0 ]; then + echo -e "$RED !!!!!!! $IP is not alive $NC" + else + #============ Get the raw data + echo -e "================= RUN $RUN: Get the raw data `date`" + + rsync -avuht --progress $USR@$IP:$rawDataPath/$expName_$RUN* $MacRawDataPath/data/. + + echo -e "$YELLOW======== rsync RunTimeStamp.dat $NC" + rsync -avuht --progress $USR@$IP:$rawDataPath/$RunTimeStamp* $MacRawDataPath/data/. + + echo -e "$YELLOW======== rsync expName.sh $NC" + rsync -avuht --progress $USR@$IP:Analysis/working/expName.sh $SOLARISANADIR/working/. + fi else echo -e "$RED############### Only in SOLARIS MAC can donwload data. skip.$NC" fi +echo -e "$YELLOW=============================================$NC" +tail -10 $MacRawDataPath/data/RunTimeStamp.dat +echo -e "$YELLOW=============================================$NC" + count=`ls -1 $SOLARISANADIR/data_raw/${expName}_${RUN}_*.sol 2>/dev/null | wc -l` echo -e "========== Number of Files : ${count}${NC}" if [ ${count} -eq 0 ]; then @@ -82,9 +95,11 @@ if [ ${count} -eq 0 ]; then echo "==== RAW Files of RUN-${RUN} not found! " echo "============================================" + isRunDataExist=false + exit 1 else echo -e "${YELLOW}" du -hc $SOLARISANADIR/data_raw/${expName}_${RUN}_*.sol echo -e "$NC=============================================" - + isRunDataExist=true fi diff --git a/armory/Process_Run b/armory/Process_Run index 77a252b..9cbf036 100755 --- a/armory/Process_Run +++ b/armory/Process_Run @@ -11,13 +11,12 @@ fi if [ $# -eq 0 ] || [ $1 == "-help" ]; then - echo "$ Process_Run [RunNum] [EventBuild] [GeneralSort] [TraceMethod] [DataHoSei]" + echo "$ Process_Run [RunNum] [EventBuild] [GeneralSort] [TraceMethod] [Monitor]" echo " RunNum = run number / \"lastRun\" " echo " EventBld = 2/1/0/-1/-2 || 2 = with Trace" echo " GeneralSort = n/0/-n || n = number of worker" echo " TraceMethod = -1/0/1/2 || -1 no trace, 0 save trace, 1 fit, 2 trapezoid(not implemented)" - echo " DataHoSei = 2/1/0 || 1 = single run, 2 = using the list in ChainMonitors.C" - echo " 10 = single run and post to websrv, 20 = list runs and post to websrv" + echo " Monitor = 2/1/0 || 1 = single run, 2 = using the list in ChainMonitors.C" echo "" echo " * negative option = force (except for TraceMethod)." echo " * Defult timeWindow for Event builder is 100 tick = 800 ns." @@ -28,9 +27,9 @@ fi; RUN=$1 runNum=$1 -EventBld=0 +EventBld=2 nWorker=1 -TraceMethod=0 +TraceMethod=-1 isMonitor=0 if [ $# -ge 2 ]; then EventBld=$2; fi @@ -38,9 +37,6 @@ if [ $# -ge 3 ]; then nWorker=$3; fi if [ $# -ge 4 ]; then TraceMethod=$4; fi if [ $# -ge 5 ]; then isMonitor=$5; fi -source ${SOLARISANADIR}/armory/Process_BasicConfig -source ${SOLARISANADIR}/working/expName.sh - if [ "$RUN" == "lastRun" ]; then RUN=$runID fi @@ -48,21 +44,41 @@ fi RUN=${RUN%0} #remove zero RUN=$(printf '%03d' $RUN) ##add back the zero -#################################### -if [ ${PCID} -eq 1 ]; then - source Process_EventBuilder $RUN $EventBld $timeWin +################################### Setting display +echo "#################################################" +echo "### Process_Run #####" +echo "#################################################" +echo "### RunID : ${RUN}" +echo "### Event Builder : $EventBld" +echo "### General Sort : $nWorker worker(s)" +echo "### Trace Method : $TraceMethod" +echo "### Monitor : $isMonitor" +echo "#################################################" -else - source Process_Download $RUN +source ${SOLARISANADIR}/armory/Process_BasicConfig +source ${SOLARISANADIR}/working/expName.sh + +if [ "$PWD" != "${SOLARISANADIR}/working" ]; then + echo "============= go to the Working directory" + cd "${SOLARISANADIR}/working" +fi + + +#################################### CHECK IS RUN DATA EXIST +isRunDataExist=true + +#################################### EVENT BUILDER +source Process_Download $RUN +if [ $isRunDataExist ]; then source Process_EventBuilder $RUN $EventBld $timeWin - fi #################################### GeneralSort -source Process_Sort $RUN $nWorker $TraceMethod - +if [ $isRunDataExist ]; then + source Process_Sort $RUN $nWorker $TraceMethod +fi #################################### Monitor diff --git a/working/ChainMonitors.C b/working/ChainMonitors.C index 936f13e..004c2f1 100644 --- a/working/ChainMonitors.C +++ b/working/ChainMonitors.C @@ -2,45 +2,19 @@ #include "TObjArray.h" #include "TFile.h" #include "TMacro.h" - - -std::string create_range_string(const std::vector& nums) { - char range_str[100]; // buffer to hold the range string - int pos = 0; // current position in the buffer - int start = 0; // start of the current range - int end = 0; // end of the current range - for (int i = 1; i <= nums.size(); i++) { - if (i == nums.size() || nums[i] != nums[i-1]+1) { - end = i-1; - if (start == end) { - pos += std::sprintf(range_str+pos, "%d", nums[start]); - } else if (end == start+1) { - pos += std::sprintf(range_str+pos, "%d_%d", nums[start], nums[end]); - } else { - pos += std::sprintf(range_str+pos, "%d-%d", nums[start], nums[end]); - } - if (i < nums.size()) { - pos += std::sprintf(range_str+pos, "_"); - } - start = i; - } - } - return std::string(range_str, pos); -} +std::string create_range_string(const std::vector& nums); void ChainMonitors(int RUNNUM = -1, int RUNNUM2 = -1) { - - ///default saveCanvas = false, no save Cavas /// = true, save Canvas TChain * chain = new TChain("gen_tree"); - if( RUNNUM == -1){ /// this list only for manual Chain sort ///********** start Marker for AutoCalibration. chain->Add("../root_data/gen_run005.root"); + chain->Add("../root_data/gen_run003.root"); ///chain->Add("../root_data/trace_run135.root"); ///********** end Marker for AutoCalibration. @@ -101,6 +75,36 @@ void ChainMonitors(int RUNNUM = -1, int RUNNUM2 = -1) { //Some input to TSelector Monitor * selector = new Monitor(); selector->SetCanvasTitle(title); + selector->SetStartStopTimes(startTime, stopTime); chain->Process(selector, ""); + + delete chain; + delete selector; +} + + +std::string create_range_string(const std::vector& nums) { + std::string range_str; + int lastNum = nums[0]; + int rangeStart = lastNum; + for (int i = 1; i < nums.size(); i++) { + if (nums[i] == lastNum + 1) { + lastNum = nums[i]; + } else { + if (rangeStart == lastNum) { + range_str += std::to_string(rangeStart) + "_"; + } else { + range_str += std::to_string(rangeStart) + "-" + std::to_string(lastNum) + "_"; + } + rangeStart = lastNum = nums[i]; + } + } + // Add the last range + if (rangeStart == lastNum) { + range_str += std::to_string(rangeStart); + } else { + range_str += std::to_string(rangeStart) + "-" + std::to_string(lastNum); + } + return range_str; } \ No newline at end of file diff --git a/working/Monitor.C b/working/Monitor.C index be0b51b..c61fe49 100644 --- a/working/Monitor.C +++ b/working/Monitor.C @@ -24,6 +24,9 @@ #include "../Cleopatra/Isotope.h" #include "Mapping.h" +#define tick2ns 8. // 1clock tick = 8 ns +#define tick2min tick2ns / 1e9/60. + using namespace std; //############################################ User setting @@ -119,7 +122,6 @@ TH1F ** hrdtg; TH2F ** hrdt2D; TH2F ** hrdt2Dg; -TH2F ** hrdt2Dsum; TH1F * hrdtRate1; TH1F * hrdtRate2; @@ -139,7 +141,7 @@ TH1I * htdiffg; double zRange[2] = {-1000, 0}; // zMin, zMax TLatex text; -int numCol, numRow; +int numCol, numRow, numDet; ULong64_t NumEntries = 0; ULong64_t ProcessedEntries = 0; Float_t Frac = 0.1; ///Progress bar @@ -175,8 +177,6 @@ void Monitor::Begin(TTree *tree){ printf("###########################################################\n"); //===================================================== loading parameter - printf("################## loading parameter files\n"); - AnalysisLib::LoadDetGeoAndReactionConfigFile(); AnalysisLib::LoadXNCorr(); AnalysisLib::LoadXFXN2ECorr(); @@ -193,6 +193,15 @@ void Monitor::Begin(TTree *tree){ numRow = AnalysisLib::detGeo.nDet; numCol = mapping::NARRAY/numRow; + numDet = mapping::NARRAY; + + zRange[0] = AnalysisLib::detGeo.zMax - 50; + zRange[1] = AnalysisLib::detGeo.zMax + 50; + + printf("=====================================================\n"); + printf(" z Range : %5.0f - %5.0f mm\n", zRange[0], zRange[1]); + printf(" time Range : %5.0f - %5.0f min\n", timeRangeInMin[0], timeRangeInMin[1]); + printf("=====================================================\n"); //================ Get Recoil cuts; cutG = new TCutG(); @@ -205,7 +214,7 @@ void Monitor::Begin(TTree *tree){ //========================= Generate all of the histograms needed for drawing later on - printf("======================================== Histograms declaration\n"); + printf("============================================ Histograms declaration\n"); gROOT->cd(); @@ -263,7 +272,6 @@ void Monitor::Begin(TTree *tree){ hrdt2D = new TH2F * [mapping::NRDT/2]; hrdt2Dg = new TH2F * [mapping::NRDT/2]; - hrdt2Dsum = new TH2F * [mapping::NRDT/2]; for (Int_t i = 0; i < mapping::NRDT ; i++) { if( i % 2 == 0 ) hrdt[i] = new TH1F(Form("hrdt%d",i), Form("Raw Recoil E(ch=%d); E (channel)",i), 500, rdtERange[0], rdtERange[1]); @@ -276,12 +284,11 @@ void Monitor::Begin(TTree *tree){ int tempID = i / 2; hrdt2D[tempID] = new TH2F(Form("hrdt2D%d",tempID), Form("Raw Recoil DE vs Eres (dE=%d, E=%d); Eres (channel); DE (channel)", i+1, i), 500, rdtERange[0], rdtERange[1],500,rdtDERange[0],rdtDERange[1]); hrdt2Dg[tempID] = new TH2F(Form("hrdt2Dg%d",tempID), Form("Gated Raw Recoil DE vs Eres (dE=%d, E=%d); Eres (channel); DE (channel)",i+1, i), 500, rdtERange[0], rdtERange[1],500,rdtDERange[0], rdtDERange[1]); - hrdt2Dsum[tempID] = new TH2F(Form("hrdt2Dsum%d",tempID), Form("Raw Recoil DE vs Eres+DE (dE=%d, E=%d); Eres+DE (channel); DE (channel)", i+1, i), 500, rdtERange[0], rdtERange[1]+rdtDERange[1], 500, rdtDERange[0], rdtDERange[1]); } } - hrdtRate1 = new TH1F("hrdtRate1", "recoil rate 1 / min; min; count / 1 min", timeRange[1] - timeRange[0], timeRange[0], timeRange[1]); - hrdtRate2 = new TH1F("hrdtRate2", "recoil rate 2 / min; min; count / 1 min", timeRange[1] - timeRange[0], timeRange[0], timeRange[1]); + hrdtRate1 = new TH1F("hrdtRate1", "recoil rate 1 / min; min; count / 1 min", timeRangeInMin[1] - timeRangeInMin[0], timeRangeInMin[0], timeRangeInMin[1]); + hrdtRate2 = new TH1F("hrdtRate2", "recoil rate 2 / min; min; count / 1 min", timeRangeInMin[1] - timeRangeInMin[0], timeRangeInMin[0], timeRangeInMin[1]); hrdtRate1->SetLineColor(2); hrdtRate2->SetLineColor(4); @@ -295,7 +302,7 @@ void Monitor::Begin(TTree *tree){ htdiff = new TH1I("htdiff" ,"Coincident time (recoil-dE - array); time [ch = 10ns]; count", coinTimeRange[1] - coinTimeRange[0], coinTimeRange[0], coinTimeRange[1]); htdiffg = new TH1I("htdiffg","Coincident time (recoil-dE - array) w/ recoil gated; time [ch = 10ns]; count", coinTimeRange[1] - coinTimeRange[0], coinTimeRange[0], coinTimeRange[1]); - printf("======================================== End of histograms Declaration\n"); + printf("============================================ End of histograms Declaration\n"); StpWatch.Start(); } @@ -305,19 +312,23 @@ void Monitor::Begin(TTree *tree){ //^########################################################### Bool_t Monitor::Process(Long64_t entry){ - if( entry == 0 ) printf("========== %s \n", __func__); + if( entry == 0 ) { + treeID ++; + baseTimeStamp = (treeID == 0 ? 0 : endTime[treeID-1]); + printf("============================================ %s , treeID : %d\n", __func__, treeID); + } if( ProcessedEntries > maxNumberEvent ) return kTRUE; ProcessedEntries++; //@*********** Progress Bar ******************************************/ - if (ProcessedEntries>NumEntries*Frac-1) { + if (ProcessedEntries >= NumEntries*Frac - 1 ) { TString msg; msg.Form("%llu", NumEntries/1000); int len = msg.Sizeof(); printf(" %3.0f%% (%*llu/%llu k) processed in %6.1f sec | expect %6.1f sec\n", Frac*100, len, ProcessedEntries/1000,NumEntries/1000,StpWatch.RealTime(), StpWatch.RealTime()/Frac); StpWatch.Start(kFALSE); - Frac+=0.1; + Frac += 0.1; } //@********** Get Branch *********************************************/ @@ -533,12 +544,13 @@ Bool_t Monitor::Process(Long64_t entry){ hrdtID->Fill(i, rdt[i]); hrdt[i]->Fill(rdt[i]); - if( i % 2 == 0 ){ - - recoilMulti++; // when both dE and E are hit - hrdt2D[i/2]->Fill(rdt[i],rdt[i+1]); //E-dE + if( i % 2 == 0 ){ + recoilMulti++; // when both dE and E are hit + hrdt2D[i/2]->Fill(rdt[i],rdt[i+1]); //E-dE } } + + hrdtRate1->Fill( (e_t[1] + baseTimeStamp) * tick2min ); //@******************* Multi-hit *************************************/ hmultEZ->Fill(multiEZ); @@ -597,7 +609,7 @@ Bool_t Monitor::Process(Long64_t entry){ //^ * Terminate //^########################################################### void Monitor::Terminate(){ - printf("============================== finishing.\n"); + printf("============================================ Drawing Canvas.\n"); gROOT->cd(); @@ -700,7 +712,7 @@ void Monitor::Terminate(){ ///----------------------------------- Canvas - 10 //PlotRDT(3,0); - //TH1F * helumDBIC = new TH1F("helumDBIC", "elum(d)/BIC; time [min]; count/min", timeRange[1]-timeRange[0], timeRange[0], timeRange[1]); + //TH1F * helumDBIC = new TH1F("helumDBIC", "elum(d)/BIC; time [min]; count/min", timeRangeInMin[1]-timeRangeInMin[0], timeRangeInMin[0], timeRangeInMin[1]); //helumDBIC = (TH1F*) helum4D->Clone(); //helumDBIC->SetTitle("elum(d)/BIC; time [min]; count/min"); //helumDBIC->SetName("helumDBIC"); @@ -726,10 +738,8 @@ void Monitor::Terminate(){ //padID++; cCanvas->cd(padID); //htac->Draw(); - - /* ///----------------------------------- Canvas - 13 - padID++; cCanvas->cd(padID); + //padID++; cCanvas->cd(padID); ///hicT14N->Draw(""); ///hicT14C->Draw("same"); @@ -741,35 +751,27 @@ void Monitor::Terminate(){ ///----------------------------------- Canvas - 14 padID++; cCanvas->cd(padID); - ///hrdtRate1->Draw(""); - ///hrdtRate2->Draw("same"); + hrdtRate1->Draw(""); + hrdtRate2->Draw("same"); ///----------------------------------- Canvas - 15 - padID++; cCanvas->cd(padID); + //padID++; cCanvas->cd(padID); ///----------------------------------- Canvas - 16 - padID++; cCanvas->cd(padID); - - + //padID++; cCanvas->cd(padID); ///----------------------------------- Canvas - 17 - padID++; cCanvas->cd(padID); - + //padID++; cCanvas->cd(padID); ///----------------------------------- Canvas - 18 - padID++; cCanvas->cd(padID); - + //padID++; cCanvas->cd(padID); ///----------------------------------- Canvas - 19 - padID++; cCanvas->cd(padID); - - + //padID++; cCanvas->cd(padID); ///----------------------------------- Canvas - 20 - padID++; cCanvas->cd(padID); + //padID++; cCanvas->cd(padID); - htac->Draw(); - */ /************************************/ gStyle->GetAttDate()->SetTextSize(0.02); @@ -780,19 +782,19 @@ void Monitor::Terminate(){ /************************************/ StpWatch.Start(kFALSE); - //gROOT->ProcessLine(".L ../armory/Monitor_Util.C"); //TODO some pointer is empty - //printf("=============== loaded Monitor_Utils.C\n"); - gROOT->ProcessLine(".L ../armory/AutoFit.C"); - printf("=============== loaded armory/AutoFit.C\n"); + gROOT->ProcessLine(".L ../armory/Monitor_Util.C"); //TODO some pointer is empty + printf("============================================ loaded Monitor_Utils.C\n"); + //gROOT->ProcessLine(".L ../armory/AutoFit.C"); + //printf("============================================ loaded armory/AutoFit.C\n"); // gROOT->ProcessLine(".L ../armory/RDTCutCreator.C"); - // printf("=============== loaded armory/RDTCutCreator.C\n"); + // printf("============================================ loaded armory/RDTCutCreator.C\n"); // gROOT->ProcessLine(".L ../armory/Check_rdtGate.C"); - // printf("=============== loaded armory/Check_rdtGate.C\n"); + // printf("============================================ loaded armory/Check_rdtGate.C\n"); // gROOT->ProcessLine(".L ../armory/readTrace.C"); - // printf("=============== loaded Armory/readTrace.C\n"); + // printf("============================================ loaded Armory/readTrace.C\n"); // gROOT->ProcessLine(".L ../armory/readRawTrace.C"); - // printf("=============== loaded Armory/readRawTrace.C\n"); - // gROOT->ProcessLine("listDraws()"); + // printf("============================================ loaded Armory/readRawTrace.C\n"); + gROOT->ProcessLine("listDraws()"); /************************* Save histograms to root file*/ diff --git a/working/Monitor.h b/working/Monitor.h index d746751..409234c 100644 --- a/working/Monitor.h +++ b/working/Monitor.h @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include @@ -67,15 +68,17 @@ public : float * x, * z; float * xCal, * xfCal, * xnCal, * eCal; - ULong64_t startTime ; - ULong64_t endTime ; + std::vector startTime ; + std::vector endTime ; + + double timeRangeInMin[2]; + ULong64_t baseTimeStamp; + int treeID; int padID; Monitor(TTree * /*tree*/ =0) : fChain(0) { - printf("------ %s\n", __func__); - e = new Float_t [mapping::NARRAY]; xf = new Float_t [mapping::NARRAY]; xn = new Float_t [mapping::NARRAY]; @@ -100,14 +103,18 @@ public : padID = 0; - timeRange[0] = 0; - timeRange[1] = 100; + timeRangeInMin[0] = 0; + timeRangeInMin[1] = 100; + + startTime.clear(); + endTime.clear(); + + baseTimeStamp = 0; + treeID = -1; } virtual ~Monitor() { - printf("------ %s\n", __func__); - delete e ; delete xf ; delete xn ; @@ -124,8 +131,6 @@ public : delete xnCal; delete eCal; - printf("------end of %s\n", __func__); - } virtual Int_t Version() const { return 2; } virtual void Begin(TTree *tree); @@ -145,9 +150,20 @@ public : void SetCanvasTitle(TString title) {fCanvasTitle = title;} TString GetCanvasTitle() const {return fCanvasTitle;} - int timeRange[2]; - void SetTimeRange0(int minute){ timeRange[0] = minute;} - void SetTimeRange1(int minute){ timeRange[1] = minute;} + void SetStartStopTimes(std::vector t1, std::vector t2) { + startTime = t1; + endTime = t2; + + timeRangeInMin[0] = startTime[0] * tick2min; + timeRangeInMin[1] = endTime[0] * tick2min; + for( int i = 1; i < (int) endTime.size(); i++) timeRangeInMin[1] += ((endTime[i] - startTime[i]) * tick2min); + + double duration = timeRangeInMin[1] - timeRangeInMin[0]; + + timeRangeInMin[0] = TMath::Floor( timeRangeInMin[0] - duration * 0.1); + timeRangeInMin[1] = TMath::Ceil( timeRangeInMin[1] + duration * 0.1); + + } void Draw2DHist(TH2F * hist); @@ -168,7 +184,7 @@ public : #ifdef Monitor_cxx void Monitor::Init(TTree *tree){ - printf("========== %s \n", __func__); + printf("============================================ Branch Pointer Inititization. \n"); // Set branch addresses and branch pointers if (!tree) return; @@ -184,10 +200,10 @@ void Monitor::Init(TTree *tree){ TBranch * br = (TBranch *) fChain->GetListOfBranches()->FindObject("rdt"); if( br == NULL ){ - printf(" ++++++++ no Recoil.\n"); + printf(" ++++++++ no Recoil Branch.\n"); isRDTExist = false; }else{ - printf(" ++++++++ FOund Recoil.\n"); + printf(" ++++++++ Found Recoil Branch.\n"); isRDTExist = true; fChain->SetBranchAddress("rdt" , rdt, &b_RDT); fChain->SetBranchAddress("rdt_t", rdt_t, &b_RDTTimestamp); @@ -225,15 +241,12 @@ void Monitor::Init(TTree *tree){ fChain->SetBranchAddress("trdt_r", trdt_r, &b_Trace_RDT_RiseTime); } */ - - - startTime = 0; - endTime = 0; - printf("=================================== End of Branch Pointer Inititization. \n"); + printf("============================================ End of Branch Pointer Inititization. \n"); } Bool_t Monitor::Notify(){ + return kTRUE; }