Skip to content

Commit

Permalink
Merge pull request #103 from rest-for-physics/lobis-fix-pipeline
Browse files Browse the repository at this point in the history
Fix pipeline
  • Loading branch information
lobis authored Sep 8, 2023
2 parents 96bb57b + c824397 commit 401ac76
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 29 deletions.
4 changes: 1 addition & 3 deletions inc/TRestDetectorHitsEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class TRestDetectorHitsEvent : public TRestEvent {

public:
void AddHit(Double_t x, Double_t y, Double_t z, Double_t en, Double_t t = 0, REST_HitType type = XYZ);
void AddHit(TVector3 pos, Double_t en, Double_t t = 0, REST_HitType type = XYZ);
void AddHit(const TVector3& pos, Double_t en, Double_t t = 0, REST_HitType type = XYZ);

void Sort(bool(compareCondition)(const TRestHits::iterator& hit1,
const TRestHits::iterator& hit2) = nullptr);
Expand Down Expand Up @@ -122,9 +122,7 @@ class TRestDetectorHitsEvent : public TRestEvent {

inline Double_t GetEnergyX() const { return fHits->GetEnergyX(); }
inline Double_t GetEnergyY() const { return fHits->GetEnergyY(); }
inline Double_t GetTotalDepositedEnergy() const { return fHits->GetTotalDepositedEnergy(); }
inline Double_t GetTotalEnergy() const { return fHits->GetTotalEnergy(); }
inline Double_t GetEnergy() const { return fHits->GetEnergy(); }
inline Double_t GetEnergy(int n) const { return fHits->GetEnergy(n); }
inline Double_t GetTime(int n) const { return GetHits()->GetTime(n); } // return value in us

Expand Down
12 changes: 6 additions & 6 deletions src/TRestDetectorElectronDiffusionProcess.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,12 @@ TRestEvent* TRestDetectorElectronDiffusionProcess::ProcessEvent(TRestEvent* inpu

Int_t isAttached;

Int_t totalElectrons = fInputHitsEvent->GetEnergy() * REST_Units::eV / fWvalue;
Int_t totalElectrons = fInputHitsEvent->GetTotalEnergy() * REST_Units::eV / fWvalue;

Double_t wValue = fWvalue;
if (fMaxHits > 0 && totalElectrons > fMaxHits) {
// set a fake w-value if max hits are limited. this fake w-value will be larger
wValue = fInputHitsEvent->GetEnergy() * REST_Units::eV / fMaxHits;
wValue = fInputHitsEvent->GetTotalEnergy() * REST_Units::eV / fMaxHits;
}

for (int n = 0; n < nHits; n++) {
Expand Down Expand Up @@ -209,12 +209,12 @@ TRestEvent* TRestDetectorElectronDiffusionProcess::ProcessEvent(TRestEvent* inpu
}

if (this->GetVerboseLevel() >= TRestStringOutput::REST_Verbose_Level::REST_Debug) {
cout << "TRestDetectorElectronDiffusionProcess. Input hits energy : " << fInputHitsEvent->GetEnergy()
<< endl;
cout << "TRestDetectorElectronDiffusionProcess. Input hits energy : "
<< fInputHitsEvent->GetTotalEnergy() << endl;
cout << "TRestDetectorElectronDiffusionProcess. Hits added : " << fOutputHitsEvent->GetNumberOfHits()
<< endl;
cout << "TRestDetectorElectronDiffusionProcess. Hits total energy : " << fOutputHitsEvent->GetEnergy()
<< endl;
cout << "TRestDetectorElectronDiffusionProcess. Hits total energy : "
<< fOutputHitsEvent->GetTotalEnergy() << endl;
if (GetVerboseLevel() >= TRestStringOutput::REST_Verbose_Level::REST_Extreme) GetChar();
}

Expand Down
8 changes: 5 additions & 3 deletions src/TRestDetectorFiducializationProcess.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,15 @@ TRestEvent* TRestDetectorFiducializationProcess::ProcessEvent(TRestEvent* inputE
}
}

if (fOutputHitsEvent->GetNumberOfHits() == 0) return nullptr;
if (fOutputHitsEvent->GetNumberOfHits() == 0) {
return nullptr;
}

if (this->GetVerboseLevel() >= TRestStringOutput::REST_Verbose_Level::REST_Debug) {
cout << "TRestDetectorFiducializationProcess. Hits added : " << fOutputHitsEvent->GetNumberOfHits()
<< endl;
cout << "TRestDetectorFiducializationProcess. Hits total energy : " << fOutputHitsEvent->GetEnergy()
<< endl;
cout << "TRestDetectorFiducializationProcess. Hits total energy : "
<< fOutputHitsEvent->GetTotalEnergy() << endl;
}

return fOutputHitsEvent;
Expand Down
4 changes: 2 additions & 2 deletions src/TRestDetectorGarfieldDriftProcess.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -419,8 +419,8 @@ TRestEvent* TRestDetectorGarfieldDriftProcess::ProcessEvent(TRestEvent* inputEve
if (GetVerboseLevel() >= TRestStringOutput::REST_Verbose_Level::REST_Debug) {
cout << "TRestDetectorElectronDiffusionProcess. Hits added : " << fOutputHitsEvent->GetNumberOfHits()
<< endl;
cout << "TRestDetectorElectronDiffusionProcess. Hits total energy : " << fOutputHitsEvent->GetEnergy()
<< endl;
cout << "TRestDetectorElectronDiffusionProcess. Hits total energy : "
<< fOutputHitsEvent->GetTotalEnergy() << endl;
cout << " fTimedHitsEvent " << fOutputHitsEvent << " class " << fOutputHitsEvent->ClassName() << endl;
fOutputHitsEvent->PrintEvent(20);
}
Expand Down
4 changes: 2 additions & 2 deletions src/TRestDetectorHits3DReconstructionProcess.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -523,8 +523,8 @@ TRestEvent* TRestDetectorHits3DReconstructionProcess::ProcessEvent(TRestEvent* i

// scale the total energy
if (fDoEnergyScaling) {
double e1 = fInputHitsEvent->GetEnergy();
double e2 = fOutputHitsEvent->GetEnergy();
double e1 = fInputHitsEvent->GetTotalEnergy();
double e2 = fOutputHitsEvent->GetTotalEnergy();
for (auto h : *fOutputHitsEvent->GetHits()) {
h.e() = h.e() / e2 * e1;
}
Expand Down
2 changes: 1 addition & 1 deletion src/TRestDetectorHitsAnalysisProcess.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ TRestEvent* TRestDetectorHitsAnalysisProcess::ProcessEvent(TRestEvent* inputEven
fOutputHitsEvent->AddHit(x, y, z, eDep, time, type);
}

Double_t energy = fOutputHitsEvent->GetEnergy();
Double_t energy = fOutputHitsEvent->GetTotalEnergy();
TVector3 meanPosition = fOutputHitsEvent->GetMeanPosition();
Double_t sigmaX = fOutputHitsEvent->GetSigmaX();
Double_t sigmaY = fOutputHitsEvent->GetSigmaY();
Expand Down
16 changes: 8 additions & 8 deletions src/TRestDetectorHitsEvent.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,15 @@ TRestDetectorHitsEvent::~TRestDetectorHitsEvent() { delete fHits; }
/// structure. Additionaly a time delay value in `us` may be added to the hits.
void TRestDetectorHitsEvent::AddHit(Double_t x, Double_t y, Double_t z, Double_t en, Double_t t,
REST_HitType type) {
fHits->AddHit(x, y, z, en, t, type);
fHits->AddHit({x, y, z}, en, t, type);
}

///////////////////////////////////////////////
/// \brief Adds a new hit to this event
///
/// It adds a new hit with position `pos` in mm, and energy `en` in keV, to this TRestDetectorHitsEvent
/// structure. Additionaly a time delay value in `us` may be added to the hits.
void TRestDetectorHitsEvent::AddHit(TVector3 pos, Double_t en, Double_t t, REST_HitType type) {
void TRestDetectorHitsEvent::AddHit(const TVector3& pos, Double_t en, Double_t t, REST_HitType type) {
fHits->AddHit(pos, en, t, type);
}

Expand Down Expand Up @@ -172,8 +172,8 @@ TRestHits* TRestDetectorHitsEvent::GetXZHits() {

for (unsigned int i = 0; i < this->GetNumberOfHits(); i++)
if (GetType(i) == XZ)
fXZHits->AddHit(this->GetX(i), this->GetY(i), this->GetZ(i), this->GetEnergy(i), this->GetTime(i),
XZ);
fXZHits->AddHit({this->GetX(i), this->GetY(i), this->GetZ(i)}, this->GetEnergy(i),
this->GetTime(i), XZ);

return fXZHits;
}
Expand All @@ -190,8 +190,8 @@ TRestHits* TRestDetectorHitsEvent::GetYZHits() {

for (unsigned int i = 0; i < this->GetNumberOfHits(); i++)
if (GetType(i) == YZ)
fYZHits->AddHit(this->GetX(i), this->GetY(i), this->GetZ(i), this->GetEnergy(i), this->GetTime(i),
YZ);
fYZHits->AddHit({this->GetX(i), this->GetY(i), this->GetZ(i)}, this->GetEnergy(i),
this->GetTime(i), YZ);

return fYZHits;
}
Expand All @@ -208,7 +208,7 @@ TRestHits* TRestDetectorHitsEvent::GetXYZHits() {

for (unsigned int i = 0; i < this->GetNumberOfHits(); i++)
if (GetType(i) == XYZ)
fXYZHits->AddHit(this->GetX(i), this->GetY(i), this->GetZ(i), this->GetEnergy(i),
fXYZHits->AddHit({this->GetX(i), this->GetY(i), this->GetZ(i)}, this->GetEnergy(i),
this->GetTime(i), XYZ);

return fXYZHits;
Expand Down Expand Up @@ -948,7 +948,7 @@ void TRestDetectorHitsEvent::DrawHistograms(Int_t& column, const TString& histOp
void TRestDetectorHitsEvent::PrintEvent(Int_t nHits) const {
TRestEvent::PrintEvent();

cout << "Total energy : " << GetEnergy() << endl;
cout << "Total energy : " << GetTotalEnergy() << endl;
cout << "Mean position : ( " << GetMeanPositionX() << " , " << GetMeanPositionY() << " , "
<< GetMeanPositionZ() << " ) " << endl;
cout << "Number of hits : " << fHits->GetNumberOfHits() << endl;
Expand Down
4 changes: 2 additions & 2 deletions src/TRestDetectorHitsNormalizationProcess.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ TRestEvent* TRestDetectorHitsNormalizationProcess::ProcessEvent(TRestEvent* inpu
if (this->GetVerboseLevel() >= TRestStringOutput::REST_Verbose_Level::REST_Debug) {
cout << "TRestDetectorHitsNormalizationProcess. Hits added : " << fHitsOutputEvent->GetNumberOfHits()
<< endl;
cout << "TRestDetectorHitsNormalizationProcess. Hits total energy : " << fHitsOutputEvent->GetEnergy()
<< endl;
cout << "TRestDetectorHitsNormalizationProcess. Hits total energy : "
<< fHitsOutputEvent->GetTotalEnergy() << endl;
}

return fHitsOutputEvent;
Expand Down
2 changes: 1 addition & 1 deletion src/TRestDetectorPositionMappingProcess.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ TRestEvent* TRestDetectorPositionMappingProcess::ProcessEvent(TRestEvent* inputE
double y = fHitsEvent->GetMeanPositionY();
double z = fHitsEvent->GetMeanPositionZ();

double e = fHitsEvent->GetEnergy();
double e = fHitsEvent->GetTotalEnergy();
double n = fHitsEvent->GetNumberOfHits();

// cout << x << " " << y << " " << e << " " << n << endl;
Expand Down
2 changes: 1 addition & 1 deletion src/TRestDetectorSignalToHitsProcess.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ TRestEvent* TRestDetectorSignalToHitsProcess::ProcessEvent(TRestEvent* inputEven

RESTDebug << "TRestDetectorSignalToHitsProcess. Hits added : " << fHitsEvent->GetNumberOfHits()
<< RESTendl;
RESTDebug << "TRestDetectorSignalToHitsProcess. Hits total energy : " << fHitsEvent->GetEnergy()
RESTDebug << "TRestDetectorSignalToHitsProcess. Hits total energy : " << fHitsEvent->GetTotalEnergy()
<< RESTendl;

if (this->GetVerboseLevel() == TRestStringOutput::REST_Verbose_Level::REST_Debug) {
Expand Down

0 comments on commit 401ac76

Please sign in to comment.