Skip to content

Commit

Permalink
Merge pull request #37473 from bsunanda/Run3-sim116X
Browse files Browse the repository at this point in the history
Run3-sim116X Clean up the codes in SimG4Core/GFlash/TB as suggested by Andrea
  • Loading branch information
cmsbuild authored Apr 7, 2022
2 parents 69b06fc + b8e04bc commit e7347a0
Show file tree
Hide file tree
Showing 4 changed files with 165 additions and 235 deletions.
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

0 comments on commit e7347a0

Please sign in to comment.