Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
JZCaPA
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Riccardo Longo
JZCaPA
Commits
44e18626
Commit
44e18626
authored
5 years ago
by
Chad Lantz
Browse files
Options
Downloads
Patches
Plain Diff
Simplified HitCollection loop for readability
parent
f6be3e0e
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
MonteCarlo/include/EventAction.hh
+2
-2
2 additions, 2 deletions
MonteCarlo/include/EventAction.hh
MonteCarlo/src/EventAction.cc
+32
-29
32 additions, 29 deletions
MonteCarlo/src/EventAction.cc
with
34 additions
and
31 deletions
MonteCarlo/include/EventAction.hh
+
2
−
2
View file @
44e18626
...
...
@@ -56,12 +56,12 @@ class EventAction : public G4UserEventAction
private:
// Indecies are [mod#][dataSet][dataValue]
//
data set order will need to be coordinated betweeen here and Run Action
//
Vectors are created in AnalysisManager.cc
std
::
vector
<
std
::
vector
<
std
::
vector
<
double
>
>
>
*
m_RPDdblVec
,
*
m_ZDCdblVec
;
std
::
vector
<
std
::
vector
<
std
::
vector
<
int
>
>
>
*
m_RPDintVec
,
*
m_ZDCintVec
;
AnalysisManager
*
m_analysisManager
;
G4int
hitsCollID
,
fEventNo
,
fnZDCs
,
fnRPDs
;
G4int
fEventNo
,
fnZDCs
,
fnRPDs
;
G4double
gunPosX
,
gunPosY
,
gunPosZ
;
G4bool
CLUSTER
;
};
...
...
This diff is collapsed.
Click to expand it.
MonteCarlo/src/EventAction.cc
+
32
−
29
View file @
44e18626
...
...
@@ -48,7 +48,6 @@
EventAction
::
EventAction
(
)
:
G4UserEventAction
(){
hitsCollID
=
-
1
;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
...
...
@@ -63,51 +62,55 @@ void EventAction::BeginOfEventAction(const G4Event* evt)
{
fEventNo
=
evt
->
GetEventID
();
m_analysisManager
=
AnalysisManager
::
getInstance
();
hitsCollID
=
0
;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void
EventAction
::
EndOfEventAction
(
const
G4Event
*
evt
){
G4PrimaryVertex
*
pVert
=
evt
->
GetPrimaryVertex
();
m_RPDdblVec
=
m_analysisManager
->
GetRPDdoubleVectors
(
);
m_RPDintVec
=
m_analysisManager
->
GetRPDintVectors
(
);
m_ZDCdblVec
=
m_analysisManager
->
GetZDCdoubleVectors
(
);
m_ZDCintVec
=
m_analysisManager
->
GetZDCintVectors
(
);
CLUSTER
=
m_analysisManager
->
GetClusterFlag
();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void
EventAction
::
EndOfEventAction
(
const
G4Event
*
evt
){
G4cout
<<
">>> Event "
<<
evt
->
GetEventID
()
<<
G4endl
;
G4HCofThisEvent
*
HCE
=
evt
->
GetHCofThisEvent
();
FiberHitsCollection
*
HC
=
0
;
G4int
nCollections
=
HCE
->
GetNumberOfCollections
();
if
(
HCE
)
{
while
(
hitsCollID
<
nCollections
)
{
HC
=
(
FiberHitsCollection
*
)(
HCE
->
GetHC
(
hitsCollID
));
G4String
name
=
HC
->
GetSDname
();
FiberSD
*
sd
=
(
FiberSD
*
)
G4SDManager
::
GetSDMpointer
()
->
FindSensitiveDetector
(
name
);
if
(
sd
->
OpticalIsOn
()
)
ProcessOpticalHitCollection
(
HC
);
else
ProcessHitCollection
(
HC
);
hitsCollID
++
;
//Bail if there are no hit collections
if
(
!
HCE
)
return
;
}
// end while < nCollections
//Loop over the collections we do have
for
(
int
hitsCollID
=
0
;
hitsCollID
<
nCollections
;
hitsCollID
++
)
{
HC
=
(
FiberHitsCollection
*
)(
HCE
->
GetHC
(
hitsCollID
));
G4String
name
=
HC
->
GetSDname
();
//Use the base class to fill individual data points
//There's probably a better way to do this, but I just want it
//to work right now
G4AnalysisManager
*
analysisManager
=
G4AnalysisManager
::
Instance
();
// fill ntuples //
for
(
int
i
=
0
;
i
<
analysisManager
->
GetNofNtuples
();
i
++
){
analysisManager
->
FillNtupleDColumn
(
i
,
1
,
pVert
->
GetX0
()
);
analysisManager
->
FillNtupleDColumn
(
i
,
2
,
pVert
->
GetY0
()
);
analysisManager
->
FillNtupleDColumn
(
i
,
3
,
pVert
->
GetZ0
()
);
FiberSD
*
sd
=
(
FiberSD
*
)
G4SDManager
::
GetSDMpointer
()
->
FindSensitiveDetector
(
name
);
if
(
sd
->
OpticalIsOn
()
)
ProcessOpticalHitCollection
(
HC
);
else
ProcessHitCollection
(
HC
);
}
// end hit collection loop
analysisManager
->
FillNtupleIColumn
(
i
,
4
,
fEventNo
);
}
//Use our custom class to finish the job
m_analysisManager
->
FillNtuples
();
//Use the base class to fill individual data points
//There's probably a better way to do this, but I just want it
//to work right now
G4AnalysisManager
*
analysisManager
=
G4AnalysisManager
::
Instance
();
// fill ntuples //
G4PrimaryVertex
*
pVert
=
evt
->
GetPrimaryVertex
();
for
(
int
i
=
0
;
i
<
analysisManager
->
GetNofNtuples
();
i
++
){
analysisManager
->
FillNtupleDColumn
(
i
,
1
,
pVert
->
GetX0
()
);
analysisManager
->
FillNtupleDColumn
(
i
,
2
,
pVert
->
GetY0
()
);
analysisManager
->
FillNtupleDColumn
(
i
,
3
,
pVert
->
GetZ0
()
);
analysisManager
->
FillNtupleIColumn
(
i
,
4
,
fEventNo
);
}
//Use our custom class to finish the job
m_analysisManager
->
FillNtuples
();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment