Skip to content

Commit 1a157c0

Browse files
committed
clang-format
1 parent 7eb52b5 commit 1a157c0

File tree

16 files changed

+268
-240
lines changed

16 files changed

+268
-240
lines changed

examples/MQ/pixelDetector/src/Pixel.cxx

Lines changed: 50 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -75,61 +75,65 @@ Pixel::~Pixel()
7575

7676
void Pixel::Initialize() { FairDetector::Initialize(); }
7777

78-
void Pixel::ProcessHits()
78+
void Pixel::ProcessHits()
7979
{
8080

81-
/** This method is called from the MC stepping */
82-
//Set parameters at entrance of volume. Reset ELoss.
83-
if ( TVirtualMC::GetMC()->IsTrackEntering() ) {
84-
fELoss = 0.;
85-
fTime = TVirtualMC::GetMC()->TrackTime() * 1.0e09;
86-
fLength = TVirtualMC::GetMC()->TrackLength();
87-
TVirtualMC::GetMC()->TrackPosition(fPos);
88-
TVirtualMC::GetMC()->TrackMomentum(fMom);
89-
}
90-
91-
// Sum energy loss for all steps in the active volume
92-
fELoss += TVirtualMC::GetMC()->Edep();
93-
94-
// Create PixelPoint at exit of active volume
95-
if ( TVirtualMC::GetMC()->IsTrackExiting() ||
96-
TVirtualMC::GetMC()->IsTrackStop() ||
97-
TVirtualMC::GetMC()->IsTrackDisappeared() ) {
98-
fTrackID = TVirtualMC::GetMC()->GetStack()->GetCurrentTrackNumber();
99-
Int_t copyNo = 0;
100-
fVolumeID = TVirtualMC::GetMC()->CurrentVolID(copyNo);
101-
102-
103-
if (fELoss == 0. ) { return; }
104-
105-
// Taking stationNr and sectorNr from string is almost effortless.
106-
// Simulation of 100k events with 5 pions without magnetic field takes:
107-
// - Real time 142.366 s, CPU time 140.32s WITH USING VolPath TO GET fVolumeID
108-
// - Real time 142.407 s, CPU time 140.64s WITHOUT THE FOLLOWING TString OPERATIONS
109-
{
110-
TString detPath = TVirtualMC::GetMC()->CurrentVolPath();
111-
detPath.Remove (0,detPath.Last('/')+1);
112-
detPath.Remove (0,detPath.First("Pixel")+5);
113-
Int_t stationNr = detPath.Atoi();
114-
detPath.Remove (0,detPath.First("_")+1);
115-
Int_t sectorNr = detPath.Atoi();
116-
fVolumeID = stationNr*256+sectorNr;
81+
/** This method is called from the MC stepping */
82+
// Set parameters at entrance of volume. Reset ELoss.
83+
if (TVirtualMC::GetMC()->IsTrackEntering()) {
84+
fELoss = 0.;
85+
fTime = TVirtualMC::GetMC()->TrackTime() * 1.0e09;
86+
fLength = TVirtualMC::GetMC()->TrackLength();
87+
TVirtualMC::GetMC()->TrackPosition(fPos);
88+
TVirtualMC::GetMC()->TrackMomentum(fMom);
11789
}
11890

119-
AddHit(fTrackID, fVolumeID, TVector3(fPos.X(), fPos.Y(), fPos.Z()),
120-
TVector3(fMom.Px(), fMom.Py(), fMom.Pz()), fTime, fLength,
121-
fELoss);
122-
123-
// Increment number of Pixel det points in TParticle
124-
FairStack* stack = static_cast<FairStack*>(TVirtualMC::GetMC()->GetStack());
125-
stack->AddPoint(kPixel);
126-
}
91+
// Sum energy loss for all steps in the active volume
92+
fELoss += TVirtualMC::GetMC()->Edep();
93+
94+
// Create PixelPoint at exit of active volume
95+
if (TVirtualMC::GetMC()->IsTrackExiting() || TVirtualMC::GetMC()->IsTrackStop()
96+
|| TVirtualMC::GetMC()->IsTrackDisappeared()) {
97+
fTrackID = TVirtualMC::GetMC()->GetStack()->GetCurrentTrackNumber();
98+
Int_t copyNo = 0;
99+
fVolumeID = TVirtualMC::GetMC()->CurrentVolID(copyNo);
100+
101+
if (fELoss == 0.) {
102+
return;
103+
}
104+
105+
// Taking stationNr and sectorNr from string is almost effortless.
106+
// Simulation of 100k events with 5 pions without magnetic field takes:
107+
// - Real time 142.366 s, CPU time 140.32s WITH USING VolPath TO GET fVolumeID
108+
// - Real time 142.407 s, CPU time 140.64s WITHOUT THE FOLLOWING TString OPERATIONS
109+
{
110+
TString detPath = TVirtualMC::GetMC()->CurrentVolPath();
111+
detPath.Remove(0, detPath.Last('/') + 1);
112+
detPath.Remove(0, detPath.First("Pixel") + 5);
113+
Int_t stationNr = detPath.Atoi();
114+
detPath.Remove(0, detPath.First("_") + 1);
115+
Int_t sectorNr = detPath.Atoi();
116+
fVolumeID = stationNr * 256 + sectorNr;
117+
}
118+
119+
AddHit(fTrackID,
120+
fVolumeID,
121+
TVector3(fPos.X(), fPos.Y(), fPos.Z()),
122+
TVector3(fMom.Px(), fMom.Py(), fMom.Pz()),
123+
fTime,
124+
fLength,
125+
fELoss);
126+
127+
// Increment number of Pixel det points in TParticle
128+
FairStack* stack = static_cast<FairStack*>(TVirtualMC::GetMC()->GetStack());
129+
stack->AddPoint(kPixel);
130+
}
127131
}
128132

129133
void Pixel::EndOfEvent()
130134
{
131135

132-
fPixelPointCollection->Clear();
136+
fPixelPointCollection->Clear();
133137

134138
return kTRUE;
135139
}

examples/MQ/pixelDetector/src/Pixel.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class Pixel : public FairDetector
3838

3939
/** this method is called for each step during simulation
4040
* (see FairMCApplication::Stepping())
41-
*/
41+
*/
4242
virtual void ProcessHits();
4343

4444
/** Registers the produced collections in FAIRRootManager. */

examples/advanced/Tutorial3/simulation/FairTestDetector.cxx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,7 @@ void FairTestDetector::ProcessHits()
9191
fVolumeID = TVirtualMC::GetMC()->CurrentVolID(copyNo);
9292
TVirtualMC::GetMC()->TrackPosition(fPosOut);
9393
TVirtualMC::GetMC()->TrackMomentum(fMomOut);
94-
if (fELoss == 0.)
95-
{
94+
if (fELoss == 0.) {
9695
return;
9796
}
9897
AddHit(fTrackID,

examples/advanced/Tutorial3/simulation/FairTestDetector.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class FairTestDetector : public FairDetector
3838

3939
/** this method is called for each step during simulation
4040
* (see FairMCApplication::Stepping())
41-
*/
41+
*/
4242
virtual void ProcessHits();
4343

4444
/** Registers the produced collections in FAIRRootManager. */

examples/simulation/Tutorial1/src/FairTutorialDet1.cxx

Lines changed: 49 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,18 @@
77
********************************************************************************/
88
#include "FairTutorialDet1.h"
99

10-
#include "FairDetectorList.h" // for DetectorId::kTutDet
10+
#include "FairDetectorList.h" // for DetectorId::kTutDet
1111
#include "FairLogger.h"
12-
#include "FairRootManager.h" // for FairRootManager
13-
#include "FairStack.h" // for FairStack
14-
#include "FairTutorialDet1Geo.h" // for FairTutorialDet1Geo
15-
#include "FairTutorialDet1GeoPar.h" // for FairTutorialDet1GeoPar
16-
#include "FairTutorialDet1Point.h" // for FairTutorialDet1Point
17-
#include "FairVolume.h" // for FairVolume
12+
#include "FairRootManager.h" // for FairRootManager
13+
#include "FairStack.h" // for FairStack
14+
#include "FairTutorialDet1Geo.h" // for FairTutorialDet1Geo
15+
#include "FairTutorialDet1GeoPar.h" // for FairTutorialDet1GeoPar
16+
#include "FairTutorialDet1Point.h" // for FairTutorialDet1Point
17+
#include "FairVolume.h" // for FairVolume
1818

19-
#include <TClonesArray.h> // for TClonesArray
20-
#include <TVirtualMC.h> // for TVirtualMC
21-
#include <TVirtualMCStack.h> // for TVirtualMCStack
19+
#include <TClonesArray.h> // for TClonesArray
20+
#include <TVirtualMC.h> // for TVirtualMC
21+
#include <TVirtualMCStack.h> // for TVirtualMCStack
2222

2323
FairTutorialDet1Geo* FairTutorialDet1::fgGeo = nullptr;
2424

@@ -75,49 +75,52 @@ void FairTutorialDet1::Initialize()
7575
*/
7676
}
7777

78-
void FairTutorialDet1::ProcessHits()
78+
void FairTutorialDet1::ProcessHits()
7979
{
80-
/** This method is called from the MC stepping */
81-
82-
LOG(debug) << "In FairTutorialDet1::ProcessHits";
83-
//Set parameters at entrance of volume. Reset ELoss.
84-
if ( TVirtualMC::GetMC()->IsTrackEntering() ) {
85-
fELoss = 0.;
86-
fTime = TVirtualMC::GetMC()->TrackTime() * 1.0e09;
87-
fLength = TVirtualMC::GetMC()->TrackLength();
88-
TVirtualMC::GetMC()->TrackPosition(fPos);
89-
TVirtualMC::GetMC()->TrackMomentum(fMom);
90-
}
91-
92-
// Sum energy loss for all steps in the active volume
93-
fELoss += TVirtualMC::GetMC()->Edep();
94-
95-
// Create FairTutorialDet1Point at exit of active volume
96-
if ( TVirtualMC::GetMC()->IsTrackExiting() ||
97-
TVirtualMC::GetMC()->IsTrackStop() ||
98-
TVirtualMC::GetMC()->IsTrackDisappeared() ) {
99-
fTrackID = TVirtualMC::GetMC()->GetStack()->GetCurrentTrackNumber();
100-
Int_t copyNo = 0;
101-
fVolumeID = TVirtualMC::GetMC()->CurrentVolID(copyNo);
102-
if (fELoss == 0. ) { return; }
103-
AddHit(fTrackID, fVolumeID, TVector3(fPos.X(), fPos.Y(), fPos.Z()),
104-
TVector3(fMom.Px(), fMom.Py(), fMom.Pz()), fTime, fLength,
105-
fELoss);
106-
107-
// Increment number of tutorial det points in TParticle
108-
FairStack* stack = static_cast<FairStack*>(TVirtualMC::GetMC()->GetStack());
109-
stack->AddPoint(kTutDet);
110-
}
80+
/** This method is called from the MC stepping */
81+
82+
LOG(debug) << "In FairTutorialDet1::ProcessHits";
83+
// Set parameters at entrance of volume. Reset ELoss.
84+
if (TVirtualMC::GetMC()->IsTrackEntering()) {
85+
fELoss = 0.;
86+
fTime = TVirtualMC::GetMC()->TrackTime() * 1.0e09;
87+
fLength = TVirtualMC::GetMC()->TrackLength();
88+
TVirtualMC::GetMC()->TrackPosition(fPos);
89+
TVirtualMC::GetMC()->TrackMomentum(fMom);
90+
}
91+
92+
// Sum energy loss for all steps in the active volume
93+
fELoss += TVirtualMC::GetMC()->Edep();
94+
95+
// Create FairTutorialDet1Point at exit of active volume
96+
if (TVirtualMC::GetMC()->IsTrackExiting() || TVirtualMC::GetMC()->IsTrackStop()
97+
|| TVirtualMC::GetMC()->IsTrackDisappeared()) {
98+
fTrackID = TVirtualMC::GetMC()->GetStack()->GetCurrentTrackNumber();
99+
Int_t copyNo = 0;
100+
fVolumeID = TVirtualMC::GetMC()->CurrentVolID(copyNo);
101+
if (fELoss == 0.) {
102+
return;
103+
}
104+
AddHit(fTrackID,
105+
fVolumeID,
106+
TVector3(fPos.X(), fPos.Y(), fPos.Z()),
107+
TVector3(fMom.Px(), fMom.Py(), fMom.Pz()),
108+
fTime,
109+
fLength,
110+
fELoss);
111+
112+
// Increment number of tutorial det points in TParticle
113+
FairStack* stack = static_cast<FairStack*>(TVirtualMC::GetMC()->GetStack());
114+
stack->AddPoint(kTutDet);
115+
}
111116
}
112117

113118
void FairTutorialDet1::EndOfEvent()
114119
{
115-
116-
LOG(info) << "FairTutorialDet1 : " << fFairTutorialDet1PointCollection->GetEntriesFast()
117-
<< " points registered.";
118120

119-
fFairTutorialDet1PointCollection->Clear();
121+
LOG(info) << "FairTutorialDet1 : " << fFairTutorialDet1PointCollection->GetEntriesFast() << " points registered.";
120122

123+
fFairTutorialDet1PointCollection->Clear();
121124
}
122125

123126
void FairTutorialDet1::Register()

examples/simulation/Tutorial1/src/FairTutorialDet1.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class FairTutorialDet1 : public FairDetector
4141

4242
/** this method is called for each step during simulation
4343
* (see FairMCApplication::Stepping())
44-
*/
44+
*/
4545
virtual void ProcessHits();
4646

4747
/** Registers the produced collections in FAIRRootManager. */

examples/simulation/Tutorial2/src/FairTutorialDet2.cxx

Lines changed: 36 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -81,38 +81,43 @@ void FairTutorialDet2::Initialize()
8181
*/
8282
}
8383

84-
void FairTutorialDet2::ProcessHits()
84+
void FairTutorialDet2::ProcessHits()
8585
{
86-
/** This method is called from the MC stepping */
87-
88-
//Set parameters at entrance of volume. Reset ELoss.
89-
if ( TVirtualMC::GetMC()->IsTrackEntering() ) {
90-
fELoss = 0.;
91-
fTime = TVirtualMC::GetMC()->TrackTime() * 1.0e09;
92-
fLength = TVirtualMC::GetMC()->TrackLength();
93-
TVirtualMC::GetMC()->TrackPosition(fPos);
94-
TVirtualMC::GetMC()->TrackMomentum(fMom);
95-
}
96-
97-
// Sum energy loss for all steps in the active volume
98-
fELoss += TVirtualMC::GetMC()->Edep();
99-
100-
// Create FairTutorialDet2Point at exit of active volume
101-
if ( TVirtualMC::GetMC()->IsTrackExiting() ||
102-
TVirtualMC::GetMC()->IsTrackStop() ||
103-
TVirtualMC::GetMC()->IsTrackDisappeared() ) {
104-
fTrackID = TVirtualMC::GetMC()->GetStack()->GetCurrentTrackNumber();
105-
Int_t copyNo = 0;
106-
fVolumeID = TVirtualMC::GetMC()->CurrentVolID(copyNo);
107-
if (fELoss == 0. ) { return; }
108-
AddHit(fTrackID, fVolumeID, TVector3(fPos.X(), fPos.Y(), fPos.Z()),
109-
TVector3(fMom.Px(), fMom.Py(), fMom.Pz()), fTime, fLength,
110-
fELoss);
111-
112-
// Increment number of tutorial det points in TParticle
113-
FairStack* stack = static_cast<FairStack*>(TVirtualMC::GetMC()->GetStack());
114-
stack->AddPoint(kTutDet);
115-
}
86+
/** This method is called from the MC stepping */
87+
88+
// Set parameters at entrance of volume. Reset ELoss.
89+
if (TVirtualMC::GetMC()->IsTrackEntering()) {
90+
fELoss = 0.;
91+
fTime = TVirtualMC::GetMC()->TrackTime() * 1.0e09;
92+
fLength = TVirtualMC::GetMC()->TrackLength();
93+
TVirtualMC::GetMC()->TrackPosition(fPos);
94+
TVirtualMC::GetMC()->TrackMomentum(fMom);
95+
}
96+
97+
// Sum energy loss for all steps in the active volume
98+
fELoss += TVirtualMC::GetMC()->Edep();
99+
100+
// Create FairTutorialDet2Point at exit of active volume
101+
if (TVirtualMC::GetMC()->IsTrackExiting() || TVirtualMC::GetMC()->IsTrackStop()
102+
|| TVirtualMC::GetMC()->IsTrackDisappeared()) {
103+
fTrackID = TVirtualMC::GetMC()->GetStack()->GetCurrentTrackNumber();
104+
Int_t copyNo = 0;
105+
fVolumeID = TVirtualMC::GetMC()->CurrentVolID(copyNo);
106+
if (fELoss == 0.) {
107+
return;
108+
}
109+
AddHit(fTrackID,
110+
fVolumeID,
111+
TVector3(fPos.X(), fPos.Y(), fPos.Z()),
112+
TVector3(fMom.Px(), fMom.Py(), fMom.Pz()),
113+
fTime,
114+
fLength,
115+
fELoss);
116+
117+
// Increment number of tutorial det points in TParticle
118+
FairStack* stack = static_cast<FairStack*>(TVirtualMC::GetMC()->GetStack());
119+
stack->AddPoint(kTutDet);
120+
}
116121
}
117122

118123
void FairTutorialDet2::EndOfEvent() { Reset(); }

examples/simulation/Tutorial2/src/FairTutorialDet2.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class FairTutorialDet2 : public FairDetector
4141

4242
/** this method is called for each step during simulation
4343
* (see FairMCApplication::Stepping())
44-
*/
44+
*/
4545
virtual void ProcessHits();
4646

4747
/** Registers the produced collections in FAIRRootManager. */

0 commit comments

Comments
 (0)