Skip to content

Commit

Permalink
Apply clang-format
Browse files Browse the repository at this point in the history
Apply clang-format to emprofile.C, HGCALTBCEEHit.hh and
HGCALTBCHEHit.hh.
  • Loading branch information
lopezzot committed Jan 30, 2024
1 parent e50e17b commit 7e6ba25
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 24 deletions.
51 changes: 31 additions & 20 deletions analysis/emprofile.C
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
// Simple macro card to reconstruct longitdunal profiles of em-showers

void emprofile(const string inFileName = "HGCALTBout_Run0.root", const string Energy = "", const string PhysList = "")
void emprofile(const string inFileName = "HGCALTBout_Run0.root", const string Energy = "",
const string PhysList = "")
{
const string filename = inFileName;
cout << "Analysis of " << filename << endl;
TFile* file = TFile::Open(filename.c_str(), "READ");
TTree* tree = (TTree*)file->Get("HGCALTBout");

TFile* outputfile(TFile::Open(("EmProf"+Energy+"_"+PhysList+".root").c_str(), "RECREATE"));
TFile* outputfile(
TFile::Open(("EmProf" + Energy + "_" + PhysList + ".root").c_str(), "RECREATE"));

double CEETot{0.};
tree->SetBranchAddress("CEETot", &CEETot);
Expand All @@ -27,33 +29,43 @@ void emprofile(const string inFileName = "HGCALTBout_Run0.root", const string En
tree->SetBranchAddress("AHCALSignals", &AHCALSignals);

const int layersNo = 28;
std::array<double, layersNo/2> emprofile{0.};
std::array<double, layersNo / 2> emprofile{0.};
std::array<double, layersNo> fullemprofile{0.};

for (std::size_t evtNo = 0; evtNo < tree->GetEntries(); evtNo++) {
tree->GetEntry(evtNo);

for(std::size_t i = 0; i < layersNo; i = i+2){
emprofile.at(i/2) += CEESignals->at(i)+CEESignals->at(i+1);
for (std::size_t i = 0; i < layersNo; i = i + 2) {
emprofile.at(i / 2) += CEESignals->at(i) + CEESignals->at(i + 1);
}
for(std::size_t i = 0; i < layersNo; i++){
fullemprofile.at(i) += CEESignals->at(i);
for (std::size_t i = 0; i < layersNo; i++) {
fullemprofile.at(i) += CEESignals->at(i);
}
}

for(const auto& a : emprofile) cout<<a<<endl;
cout<<"-----------------------"<<endl;
for(auto& a : emprofile) { a = a / tree->GetEntries(); }
for(const auto& a : emprofile) cout<<a<<endl;

for(auto& a : fullemprofile) { a = a / tree->GetEntries(); }
for (const auto& a : emprofile)
cout << a << endl;
cout << "-----------------------" << endl;
for (auto& a : emprofile) {
a = a / tree->GetEntries();
}
for (const auto& a : emprofile)
cout << a << endl;

for (auto& a : fullemprofile) {
a = a / tree->GetEntries();
}

std::array<double, layersNo/2> layers{};
for (std::size_t i=0; i<layersNo/2; i++) { layers.at(i) = i; }
std::array<double, layersNo / 2> layers{};
for (std::size_t i = 0; i < layersNo / 2; i++) {
layers.at(i) = i;
}
std::array<double, layersNo> fulllayers{};
for (std::size_t i=0; i<layersNo; i++) { fulllayers.at(i) = i; }

TGraph grEmProfile(layersNo/2, layers.data(), emprofile.data());
for (std::size_t i = 0; i < layersNo; i++) {
fulllayers.at(i) = i;
}

TGraph grEmProfile(layersNo / 2, layers.data(), emprofile.data());
grEmProfile.SetTitle("EmProfile");
grEmProfile.SetName("EmProfile");

Expand All @@ -62,10 +74,9 @@ void emprofile(const string inFileName = "HGCALTBout_Run0.root", const string En
grFullEmProfile.SetName("FullEmProfile");
grFullEmProfile.GetXaxis()->SetTitle("Layer");
grFullEmProfile.GetYaxis()->SetTitle("Measured energy [MIP]");

outputfile->cd();
grEmProfile.Write();
grFullEmProfile.Write();
outputfile->Close();

}
7 changes: 5 additions & 2 deletions include/HGCALTBCEEHit.hh
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,13 @@ class HGCALTBCEEHit : public G4VHit

// return a copy of the fCEESignals array
//
std::array<G4double, HGCALTBConstants::CEECells+1> GetCEESignals() const { return fCEESignals; }
std::array<G4double, HGCALTBConstants::CEECells + 1> GetCEESignals() const
{
return fCEESignals;
}

private:
std::array<G4double, HGCALTBConstants::CEECells+1> fCEESignals;
std::array<G4double, HGCALTBConstants::CEECells + 1> fCEESignals;
};

using HGCALTBCEEHitsCollection = G4THitsCollection<HGCALTBCEEHit>;
Expand Down
7 changes: 5 additions & 2 deletions include/HGCALTBCHEHit.hh
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,13 @@ class HGCALTBCHEHit : public G4VHit

// return a copy of the fCHESignals array
//
std::array<G4double, HGCALTBConstants::CHECells+1> GetCHESignals() const { return fCHESignals; }
std::array<G4double, HGCALTBConstants::CHECells + 1> GetCHESignals() const
{
return fCHESignals;
}

private:
std::array<G4double, HGCALTBConstants::CHECells+1> fCHESignals;
std::array<G4double, HGCALTBConstants::CHECells + 1> fCHESignals;
};

using HGCALTBCHEHitsCollection = G4THitsCollection<HGCALTBCHEHit>;
Expand Down

0 comments on commit 7e6ba25

Please sign in to comment.