GeneralSort is tested in DAQ. OK for non-Parallel and Parallel

This commit is contained in:
Ryan Tang 2023-04-04 15:30:19 -04:00
parent 65f18b5c85
commit 982cda8be6
6 changed files with 7739 additions and 6 deletions

View File

@ -181,7 +181,7 @@ int main(int argc, char ** argv){
int percentage = count * 100/totNumEvent;
if( percentage > last_precentage ) {
if( percentage > last_precentage + 1.0 ) {
printf("Processed : %u, %.0f%% \n\033[A\r", count, count*100./totNumEvent);
last_precentage = percentage;
}

View File

@ -9,12 +9,17 @@
#include <TH2.h>
#include <TStyle.h>
#include <TString.h>
#include <TSystem.h>
#include <TMath.h>
Long64_t processedEntry = 0;
float lastPercentage = 0;
//^##############################################################
Bool_t GeneralSort::Process(Long64_t entry){
if( entry < 2 ) printf("%s %lld\n", __func__, entry);
if( entry < 1 ) printf("============================== start processing data\n");
///initialization
for( int i = 0; i < nDetType; i++){
@ -74,6 +79,15 @@ Bool_t GeneralSort::Process(Long64_t entry){
}
if( !isParallel){
processedEntry ++;
float percentage = processedEntry*100/NumEntries;
if( percentage > lastPercentage + 1.0) {
printf("Processed : %lld, %.0f%% \n\033[A\r", entry, percentage);
lastPercentage = percentage;
}
}
newTree->Fill();
return kTRUE;
@ -117,7 +131,8 @@ void GeneralSort::Begin(TTree * tree){
PrintMapping(mapping, detTypeName, detMaxID);
tree->GetEntriesFast();
DecodeOption();
if(!isParallel) tree->GetEntriesFast();
}
@ -128,7 +143,7 @@ void GeneralSort::SlaveBegin(TTree * /*tree*/){
void GeneralSort::SlaveTerminate(){
printf("%s\n", __func__);
printf("\n%s\n", __func__);
if( isParallel){
printf("%s::SaveTree\n", __func__);

View File

@ -116,6 +116,8 @@ public :
void DecodeOption();
bool isParallel;
unsigned long NumEntries;
TString saveFileName;
TFile * saveFile; //!
TProofOutputFile * proofFile; //!
@ -261,7 +263,7 @@ void GeneralSort::Init(TTree *tree){
fChain->SetBranchAddress("trace", trace, &b_trace);
}
unsigned long NumEntries = fChain->GetEntries();
NumEntries = fChain->GetEntries();
printf( "========== total Entry : %ld\n", NumEntries);
//########################### Get Option

View File

@ -18,7 +18,7 @@ void GeneralSortAgent(Int_t runNum, int nWorker = 1, int traceMethod = -1){
//this is the option for TSelector, the first one is traceMethod, 2nd is save fileName;
TString option;
if( nWorker == 1){
if( abs(nWorker) == 1){
option.Form("%d,../root_data/gen_run%03d.root,%d", traceMethod, runNum, 0);
chain->Process("../armory/GeneralSort.C+", option);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff