fix GeneralSort in Mac

This commit is contained in:
Ryan Tang 2023-04-04 16:59:11 -04:00
parent 982cda8be6
commit fc3a73cd6c
4 changed files with 36 additions and 21 deletions

View File

@ -4,7 +4,7 @@
"name": "Mac",
"includePath": [
"${workspaceFolder}/**",
"/Applications/root-6.28.00/include/**"
"/Applications/root_v6.28.02/include/**"
],
"defines": [],
"macFrameworkPath": [
@ -13,7 +13,7 @@
"compilerPath": "/usr/bin/g++",
"cStandard": "c17",
"cppStandard": "c++17",
"intelliSenseMode": "macos-gcc-arm64"
"intelliSenseMode": "macos-clang-arm64"
},
{
"name": "Linux",

View File

@ -50,7 +50,6 @@ Bool_t GeneralSort::Process(Long64_t entry){
}
if( isTraceExist && traceMethod >= 0 ){
b_tl->GetEntry(entry);
@ -88,7 +87,7 @@ Bool_t GeneralSort::Process(Long64_t entry){
}
}
newTree->Fill();
newSaveTree->Fill();
return kTRUE;
}
@ -101,9 +100,9 @@ void GeneralSort::Terminate(){
DecodeOption();
if( !isParallel){
printf("%s::SaveTree %p, %p\n", __func__, saveFile, newTree);
saveFile->cd();
newTree->Write();
newSaveTree->Print();
newSaveTree->Write();
saveFile->Close();
}
@ -148,7 +147,7 @@ void GeneralSort::SlaveTerminate(){
if( isParallel){
printf("%s::SaveTree\n", __func__);
saveFile->cd();
newTree->Write();
newSaveTree->Write();
fOutput->Add(proofFile);
saveFile->Close();
}

View File

@ -3,6 +3,7 @@
#include <TROOT.h>
#include <TChain.h>
#include <TTree.h>
#include <TFile.h>
#include <TSelector.h>
#include <TObjString.h>
@ -85,6 +86,22 @@ public :
isParallel = false;
detNum.clear();
nDetType = 0;
saveFile = nullptr;
newSaveTree = nullptr;
eE = nullptr;
eT = nullptr;
arr = nullptr;
gTrace = nullptr;
arrTrapezoid = nullptr;
gTrapezoid = nullptr;
teE = nullptr;
teT = nullptr;
teR = nullptr;
}
virtual ~GeneralSort() { }
virtual Int_t Version() const { return 2; }
@ -121,7 +138,7 @@ public :
TString saveFileName;
TFile * saveFile; //!
TProofOutputFile * proofFile; //!
TTree * newTree; //!
TTree * newSaveTree; //!
Float_t ** eE; //!
ULong64_t ** eT; //!
@ -155,9 +172,9 @@ void GeneralSort::SetUpTree(){
saveFile = new TFile(saveFileName,"RECREATE");
}
newTree = new TTree("gen_tree", "Tree After GeneralSort");
newTree->SetDirectory(saveFile);
newTree->AutoSave();
newSaveTree = new TTree("gen_tree", "Tree After GeneralSort");
newSaveTree->SetDirectory(saveFile);
newSaveTree->AutoSave();
detNum = ExtractDetNum(mapping, detTypeName, detMaxID);
@ -175,8 +192,8 @@ void GeneralSort::SetUpTree(){
eT[i][j] = 0;
}
newTree->Branch( detTypeName[i].c_str(), eE[i], Form("%s[%d]/F", detTypeName[i].c_str(), detNum[i]));
newTree->Branch( (detTypeName[i]+"_t").c_str(), eT[i], Form("%s_Timestamp[%d]/l", detTypeName[i].c_str(), detNum[i]));
newSaveTree->Branch( detTypeName[i].c_str(), eE[i], Form("%s[%d]/F", detTypeName[i].c_str(), detNum[i]));
newSaveTree->Branch( (detTypeName[i]+"_t").c_str(), eT[i], Form("%s_Timestamp[%d]/l", detTypeName[i].c_str(), detNum[i]));
}
@ -184,7 +201,7 @@ void GeneralSort::SetUpTree(){
arr = new TClonesArray("TGraph");
newTree->Branch("trace", arr, 256000);
newSaveTree->Branch("trace", arr, 256000);
arr->BypassStreamer();
if( traceMethod > 0 ){
@ -204,15 +221,15 @@ void GeneralSort::SetUpTree(){
teR[i][j] = TMath::QuietNaN();
}
newTree->Branch( ("t" + detTypeName[i]).c_str(), teE[i], Form("trace_%s[%d]/F", detTypeName[i].c_str(), detNum[i]));
newTree->Branch( ("t" + detTypeName[i]+"_t").c_str(), teT[i], Form("trace_%s_time[%d]/l", detTypeName[i].c_str(), detNum[i]));
newTree->Branch( ("t" + detTypeName[i]+"_r").c_str(), teR[i], Form("trace_%s_rise[%d]/l", detTypeName[i].c_str(), detNum[i]));
newSaveTree->Branch( ("t" + detTypeName[i]).c_str(), teE[i], Form("trace_%s[%d]/F", detTypeName[i].c_str(), detNum[i]));
newSaveTree->Branch( ("t" + detTypeName[i]+"_t").c_str(), teT[i], Form("trace_%s_time[%d]/l", detTypeName[i].c_str(), detNum[i]));
newSaveTree->Branch( ("t" + detTypeName[i]+"_r").c_str(), teR[i], Form("trace_%s_rise[%d]/l", detTypeName[i].c_str(), detNum[i]));
}
}
}
newSaveTree->Print(); //very important, otherwise the mac will blow up.
}
//^##############################################################
@ -264,7 +281,7 @@ void GeneralSort::Init(TTree *tree){
}
NumEntries = fChain->GetEntries();
printf( "========== total Entry : %ld\n", NumEntries);
printf( " ========== total Entry : %ld\n", NumEntries);
//########################### Get Option
DecodeOption();
@ -298,5 +315,4 @@ void GeneralSort::PrintTraceMethod(){
printf(" Trace method ? %s \n", traceMethodStr);
}
#endif // #ifdef GeneralSort_cxx

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/bash -l
if [ -z $SOLARISANADIR ]; then
echo "###### env variable SOLARISANADIR not defined. Abort. Please run the SOLARIS.sh."