Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run3-sim116X Clean up the codes in SimG4Core/GFlash/TB as suggested by Andrea #37473

Merged
merged 3 commits into from
Apr 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 24 additions & 34 deletions SimG4Core/GFlash/TB/TreeMatrixCalib.cc
Original file line number Diff line number Diff line change
@@ -1,44 +1,34 @@
#include "SimG4Core/GFlash/TB/TreeMatrixCalib.h"

TreeMatrixCalib::TreeMatrixCalib(const char* /*filename */) {
TreeMatrixCalib::TreeMatrixCalib(const char*) {
edm::Service<TFileService> fs;
//myFile = new TFile(filename,"RECREATE");
myTree = fs->make<TTree>("T1", "my tree");
myTree_ = fs->make<TTree>("T1", "my tree");

// Amplitude / hodoscopes / tdc infos
myTree->Branch("run", &myRun, "run/I");
myTree->Branch("event", &myEvent, "event/I");
myTree->Branch("xtalSM", &myXtalSM, "xtalSM/I");
myTree->Branch("maxEneXtal", &myMaxEneXtal, "maxEneXtal/I");
myTree->Branch("nominalXtalSM", &myNominalXtalSM, "nominalXtalSM/I");
myTree->Branch("nextXtalSM", &myNextXtalSM, "nextXtalSM/I");
myTree->Branch("xtalEta", &myXtalEta, "xtalEta/I");
myTree->Branch("xtalPhi", &myXtalPhi, "xtalPhi/I");
myTree->Branch("tbMoving", &myTbMoving, "tbMoving/I");
myTree->Branch("hodoX", &myHodoX, "hodoX/D");
myTree->Branch("hodoY", &myHodoY, "hodoY/D");
myTree->Branch("caloX", &myCaloX, "caloX/D");
myTree->Branch("caloY", &myCaloY, "caloY/D");
myTree->Branch("hodoSlopeX", &myHodoSlopeX, "hodoSlopeX/D");
myTree->Branch("hodoSlopeY", &myHodoSlopeY, "hodoSlopeY/D");
myTree->Branch("hodoQualityX", &myHodoQualityX, "hodoQualityX/D");
myTree->Branch("hodoQualityY", &myHodoQualityY, "hodoQualityY/D");
myTree->Branch("tdcOffset", &myTdcOffset, "tdcOffset/D");
myTree->Branch("allMatrix", &myAllMatrix, "allMatrix/I");
myTree->Branch("amplit", &myAmplit, "amplit[49]/D");
myTree->Branch("crystal", &myCrystal, "crystal[49]/I");
myTree_->Branch("run", &myRun, "run/I");
myTree_->Branch("event", &myEvent, "event/I");
myTree_->Branch("xtalSM", &myXtalSM, "xtalSM/I");
myTree_->Branch("maxEneXtal", &myMaxEneXtal, "maxEneXtal/I");
myTree_->Branch("nominalXtalSM", &myNominalXtalSM, "nominalXtalSM/I");
myTree_->Branch("nextXtalSM", &myNextXtalSM, "nextXtalSM/I");
myTree_->Branch("xtalEta", &myXtalEta, "xtalEta/I");
myTree_->Branch("xtalPhi", &myXtalPhi, "xtalPhi/I");
myTree_->Branch("tbMoving", &myTbMoving, "tbMoving/I");
myTree_->Branch("hodoX", &myHodoX, "hodoX/D");
myTree_->Branch("hodoY", &myHodoY, "hodoY/D");
myTree_->Branch("caloX", &myCaloX, "caloX/D");
myTree_->Branch("caloY", &myCaloY, "caloY/D");
myTree_->Branch("hodoSlopeX", &myHodoSlopeX, "hodoSlopeX/D");
myTree_->Branch("hodoSlopeY", &myHodoSlopeY, "hodoSlopeY/D");
myTree_->Branch("hodoQualityX", &myHodoQualityX, "hodoQualityX/D");
myTree_->Branch("hodoQualityY", &myHodoQualityY, "hodoQualityY/D");
myTree_->Branch("tdcOffset", &myTdcOffset, "tdcOffset/D");
myTree_->Branch("allMatrix", &myAllMatrix, "allMatrix/I");
myTree_->Branch("amplit", &myAmplit, "amplit[49]/D");
myTree_->Branch("crystal", &myCrystal, "crystal[49]/I");
}

TreeMatrixCalib::~TreeMatrixCalib() {
/*
myFile->cd();
myTree->Write();
myFile->Close();
delete myFile;
*/
}

void TreeMatrixCalib::store() { myTree->Fill(); }
void TreeMatrixCalib::store() { myTree_->Fill(); }

void TreeMatrixCalib::fillInfo(int run,
int eve,
Expand Down
5 changes: 2 additions & 3 deletions SimG4Core/GFlash/TB/TreeMatrixCalib.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class G3EventProxy;
class TreeMatrixCalib {
public:
TreeMatrixCalib(const char* filename = "tb.root");
~TreeMatrixCalib();
~TreeMatrixCalib() = default;

void fillInfo(int run,
int eve,
Expand All @@ -44,8 +44,7 @@ class TreeMatrixCalib {
void store();

private:
TFile* myFile;
TTree* myTree;
TTree* myTree_;

// general info
int myEvent, myRun;
Expand Down
Loading