Skip to content

Commit

Permalink
More consinsent naming of the objects.
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielWielanek committed Jan 13, 2025
1 parent d1319ea commit ae732d0
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 54 deletions.
5 changes: 3 additions & 2 deletions cuts/CutContainer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <TRegexp.h>
#include <iostream>

#include "AnaFile.h"
#include "Cout.h"
#include "CutFuncs.h"
#include "EventBinningCut.h"
Expand Down Expand Up @@ -278,11 +279,11 @@ namespace Hal {
Package* CutContainer::Report() const {
Package* pack = new Package(this, kTRUE);
auto getList = [&](ECutUpdate upd) {
TString collectionNo = Hal::Cuts::GetCollectionCountName(upd);
TString collectionNo = Hal::AnaFile::GetCollectionCountName(upd);
pack->AddObject(new ParameterInt(collectionNo, GetCutContainer(upd)->GetEntriesFast()));
TList* list1 = new TList();
list1->SetOwner(kTRUE);
list1->SetName(Hal::Cuts::GetCollectionListName(upd));
list1->SetName(Hal::AnaFile::GetCollectionListName(upd));
for (int i = 0; i < GetCutContainer(upd)->GetEntriesFast(); i++) {
list1->Add(((CutCollection*) GetCutContainer(upd)->UncheckedAt(i))->Report());
}
Expand Down
23 changes: 0 additions & 23 deletions cuts/CutFuncs.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -104,28 +104,5 @@ namespace Hal {
}
return update_ratio_name;
}

TString GetCollectionListName(Hal::ECutUpdate upd) {
switch (upd) {
case ECutUpdate::kEvent: return "EventCutCollectionList"; break;
case ECutUpdate::kTrack: return "TrackCutCollectionList"; break;
case ECutUpdate::kTwoTrack: return "TwoTrackCutCollectionList"; break;
case ECutUpdate::kTwoTrackBackground: return "TwoTrackBackgroundCutCollectionList"; break;
default: Cout::PrintInfo("Unknown update ratio", EInfo::kLowWarning); break;
}
return "";
}

TString GetCollectionCountName(Hal::ECutUpdate upd) {
switch (upd) {
case ECutUpdate::kEvent: return "Event_collections_No"; break;
case ECutUpdate::kTrack: return "Track_collections_No"; break;
case ECutUpdate::kTwoTrack: return "TwoTrack_collections_No"; break;
case ECutUpdate::kTwoTrackBackground: "TwoTrack_collections_background_No"; break;
default: Cout::PrintInfo("Unknown update ratio", EInfo::kLowWarning); break;
}
return "";
}

} // namespace Cuts
} /* namespace Hal */
8 changes: 0 additions & 8 deletions cuts/CutFuncs.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,6 @@ namespace Hal {
* @return
*/
TString GetCutUpdateRatioName(Hal::ECutUpdate upd);

TString GetCollectionListName(Hal::ECutUpdate upd);
/**
*
* @param upd
* @return eg. Event_collections_No
*/
TString GetCollectionCountName(Hal::ECutUpdate upd);
} // namespace Cuts

} /* namespace Hal */
Expand Down
22 changes: 22 additions & 0 deletions features/io/AnaFile.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -444,4 +444,26 @@ namespace Hal {
Package* AnaFile::GetMainPackage() const { return static_cast<Package*>(fMainPackageArray->UncheckedAt(fCurrentPackID)); }

Package* AnaFile::GetCutContainer() const { return static_cast<Package*>(fCutContainerArray->UncheckedAt(fCurrentPackID)); }

TString AnaFile::GetCollectionListName(Hal::ECutUpdate update) {
switch (update) {
case Hal::ECutUpdate::kEvent: return "EventCutCollectionList"; break;
case Hal::ECutUpdate::kTrack: return "TrackCutCollectionList"; break;
case Hal::ECutUpdate::kTwoTrack: return "TwoTrackCutCollectionList"; break;
case Hal::ECutUpdate::kTwoTrackBackground: return "TwoTrackBackgroundCutCollectionList"; break;
default: return ""; break;
}
}

TString AnaFile::GetCollectionCountName(Hal::ECutUpdate upd) {
switch (upd) {
case ECutUpdate::kEvent: return "Event_collections_No"; break;
case ECutUpdate::kTrack: return "Track_collections_No"; break;
case ECutUpdate::kTwoTrack: return "TwoTrack_collections_No"; break;
case ECutUpdate::kTwoTrackBackground: "TwoTrack_collections_background_No"; break;
default: Cout::PrintInfo("Unknown update ratio", EInfo::kLowWarning); break;
}
return "";
}

} // namespace Hal
13 changes: 13 additions & 0 deletions features/io/AnaFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,19 @@ namespace Hal {
* @return package with report from given cut
*/
Package* GetCutPackage(Hal::ECutUpdate update, Int_t collection, Int_t cutNo, Option_t* type = "all") const;

/**
* return name of group list name in file e.g., EventCutCollectionList
* @param update
* @return
*/
static TString GetCollectionListName(Hal::ECutUpdate update);
/**
* return name of collection count name in file e.g.f Event_collections_No
* @param upd
* @return
*/
static TString GetCollectionCountName(Hal::ECutUpdate upd);
virtual ~AnaFile();
ClassDef(AnaFile, 1)
};
Expand Down
35 changes: 15 additions & 20 deletions features/io/html/Package2HTML.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*/

#include "Package2HTML.h"
#include "AnaFile.h"
#include "Cout.h"
#include "HtmlCore.h"
#include "HtmlDiv.h"
Expand Down Expand Up @@ -542,7 +543,7 @@ namespace Hal {

void Package2HTML::CreateCutHTML(HtmlObject& table, Hal::ECutUpdate cut_update, Int_t collection_no) {
TString group_name, desc, names;
group_name = GetGroupListName(cut_update);
group_name = Hal::AnaFile::GetCollectionListName(cut_update);
switch (cut_update) {
case Hal::ECutUpdate::kEvent:
desc = "EventCollection";
Expand Down Expand Up @@ -866,7 +867,7 @@ namespace Hal {
Int_t& counter,
TString path) {
TString group_name, desc, names;
group_name = GetGroupListName(cut_upd);
group_name = Hal::AnaFile::GetCollectionListName(cut_upd);
switch (cut_upd) {
case Hal::ECutUpdate::kEvent:
desc = "EventCollection";
Expand Down Expand Up @@ -958,10 +959,11 @@ namespace Hal {
void Package2HTML::ExportCollections(HtmlObject& object, TString path) {
if (fCurrentCutContainer == NULL) return;

TList* listE = (TList*) fCurrentCutContainer->GetObjectByName(GetGroupListName(Hal::ECutUpdate::kEvent));
TList* listT = (TList*) fCurrentCutContainer->GetObjectByName(GetGroupListName(Hal::ECutUpdate::kTrack));
TList* listT2 = (TList*) fCurrentCutContainer->GetObjectByName(GetGroupListName(Hal::ECutUpdate::kTwoTrack));
TList* listT2B = (TList*) fCurrentCutContainer->GetObjectByName(GetGroupListName(Hal::ECutUpdate::kTwoTrackBackground));
TList* listE = (TList*) fCurrentCutContainer->GetObjectByName(AnaFile::GetCollectionListName(ECutUpdate::kEvent));
TList* listT = (TList*) fCurrentCutContainer->GetObjectByName(AnaFile::GetCollectionListName(ECutUpdate::kTrack));
TList* listT2 = (TList*) fCurrentCutContainer->GetObjectByName(AnaFile::GetCollectionListName(ECutUpdate::kTwoTrack));
TList* listT2B =
(TList*) fCurrentCutContainer->GetObjectByName(AnaFile::GetCollectionListName(ECutUpdate::kTwoTrackBackground));
Int_t eventCol = 0;
Int_t trackCol = 0;
Int_t ttrackCol = 0;
Expand Down Expand Up @@ -1109,7 +1111,7 @@ namespace Hal {
}

TString Package2HTML::GetLinkToCut(Hal::ECutUpdate update, Int_t collection_no, Int_t cut_no, Bool_t fast) const {
TString list_name = GetGroupListName(update);
TString list_name = Hal::AnaFile::GetCollectionListName(update);
TList* list = (TList*) fCurrentCutContainer->GetObjectByName(list_name);
Package* cut_sub_container = (Package*) list->At(collection_no);
Int_t list_pos = 0;
Expand All @@ -1130,7 +1132,7 @@ namespace Hal {
}

TString Package2HTML::GetLinkToCutMonitor(Hal::ECutUpdate update, Int_t collection_no, Int_t no) const {
TString list_name = GetGroupListName(update);
TString list_name = Hal::AnaFile::GetCollectionListName(update);
TList* list = (TList*) fCurrentCutContainer->GetObjectByName(list_name);
Package* cut_sub_container = (Package*) list->At(collection_no);
Int_t list_pos = 0;
Expand All @@ -1149,16 +1151,6 @@ namespace Hal {
no);
}

TString Package2HTML::GetGroupListName(Hal::ECutUpdate update) const {
switch (update) {
case Hal::ECutUpdate::kEvent: return "EventCutCollectionList"; break;
case Hal::ECutUpdate::kTrack: return "TrackCutCollectionList"; break;
case Hal::ECutUpdate::kTwoTrack: return "TwoTrackCutCollectionList"; break;
case Hal::ECutUpdate::kTwoTrackBackground: return "TwoTrackBackgroundCutCollectionList"; break;
default: return ""; break;
}
}

Package2HTML::~Package2HTML() {
if (fHTML) delete fHTML;
if (fFile) {
Expand All @@ -1168,8 +1160,11 @@ namespace Hal {
}

void Package2HTML::GetCollectionsNumbers() {
TString collection_name[4] = {
"Event_collections_No", "Track_collections_No", "TwoTrack_collections_No", "TwoTrack_collections_background_No"};
TString collection_name[4] = {AnaFile::GetCollectionCountName(ECutUpdate::kEvent),
AnaFile::GetCollectionCountName(ECutUpdate::kTrack),
AnaFile::GetCollectionCountName(ECutUpdate::kTwoTrack),
AnaFile::GetCollectionCountName(ECutUpdate::kTwoTrackBackground)};

ParameterInt* event_collections_no = (ParameterInt*) fCurrentCutContainer->GetObjectByName(collection_name[0], 0);
ParameterInt* track_collections_no = (ParameterInt*) fCurrentCutContainer->GetObjectByName(collection_name[1], 0);
ParameterInt* twotrack_collections_no = (ParameterInt*) fCurrentCutContainer->GetObjectByName(collection_name[2], 0);
Expand Down
1 change: 0 additions & 1 deletion features/io/html/Package2HTML.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ namespace Hal {
void CreateCutMonitorHTML(HtmlObject& table, Hal::ECutUpdate cut_upd, Int_t collection_no, Int_t& counter, TString path);
void CreateListTable(HtmlObject& table, TList* list, Int_t no, TString path_data, TString path_url, TString drawClass);
containerInfo GetContainerInfo(Package* Pack, Bool_t rev = kFALSE) const;
TString GetGroupListName(Hal::ECutUpdate update) const;
HtmlFile* fHTML;
TFile* fFile;
TString fDir;
Expand Down

0 comments on commit ae732d0

Please sign in to comment.