FairShip
Loading...
Searching...
No Matches
BaseDetector.BaseDetector Class Reference
Inheritance diagram for BaseDetector.BaseDetector:
Collaboration diagram for BaseDetector.BaseDetector:

Public Member Functions

None __init__ (self, name, intree, branchName=None, mcBranchType=None, mcBranchName=None, int splitLevel=99, outtree=None)
 
None delete (self)
 
None fill (self)
 
None digitize (self)
 
None process (self)
 

Public Attributes

 name
 
 intree
 
 outtree
 
 det
 
 MCdet
 
 mcBranch
 
 branch
 

Detailed Description

Abstract base class for detector digitization using template method pattern.

Definition at line 11 of file BaseDetector.py.

Constructor & Destructor Documentation

◆ __init__()

None BaseDetector.BaseDetector.__init__ (   self,
  name,
  intree,
  branchName = None,
  mcBranchType = None,
  mcBranchName = None,
int   splitLevel = 99,
  outtree = None 
)
Initialize the detector digitizer.

Reimplemented in SBTDetector.SBTDetector, MTCDetector.MTCDetector, splitcalDetector.splitcalDetector, strawtubesDetector.strawtubesDetector, timeDetector.timeDetector, and UpstreamTaggerDetector.UpstreamTaggerDetector.

Definition at line 14 of file BaseDetector.py.

23 ) -> None:
24 """Initialize the detector digitizer."""
25 self.name = name
26 self.intree = intree
27 # If outtree provided, use it for output; else intree for compatibility
28 self.outtree = outtree if outtree is not None else intree
29 self.det = ROOT.std.vector(f"{name}Hit")()
30 self.MCdet = None
31 self.mcBranch = None
32 if mcBranchName:
33 self.MCdet = ROOT.std.vector("std::vector< int >")()
34 self.mcBranch = self.outtree.Branch(mcBranchName, self.MCdet, 32000, splitLevel)
35
36 if branchName:
37 self.branch = self.outtree.Branch(f"Digi_{branchName}Hits", self.det, 32000, splitLevel)
38 else:
39 self.branch = self.outtree.Branch(f"Digi_{name}Hits", self.det, 32000, splitLevel)
40

Member Function Documentation

◆ delete()

None BaseDetector.BaseDetector.delete (   self)
Clear detector hit containers.

Reimplemented in splitcalDetector.splitcalDetector.

Definition at line 41 of file BaseDetector.py.

41 def delete(self) -> None:
42 """Clear detector hit containers."""
43 self.det.clear()
44 if self.MCdet:
45 self.MCdet.clear()
46

◆ digitize()

None BaseDetector.BaseDetector.digitize (   self)
Digitize detector hits.

This method must be implemented by all detector subclasses to convert
MC hits into digitized detector responses.

Reimplemented in MTCDetector.MTCDetector, SBTDetector.SBTDetector, splitcalDetector.splitcalDetector, strawtubesDetector.strawtubesDetector, timeDetector.timeDetector, and UpstreamTaggerDetector.UpstreamTaggerDetector.

Definition at line 56 of file BaseDetector.py.

56 def digitize(self) -> None:
57 """Digitize detector hits.
58
59 This method must be implemented by all detector subclasses to convert
60 MC hits into digitized detector responses.
61 """
62 pass
63

◆ fill()

None BaseDetector.BaseDetector.fill (   self)
Fill detector hit branches.

Note: This method is now a no-op to prevent double-filling.
All branches are filled synchronously by recoTree.Fill() in the main loop.

Reimplemented in splitcalDetector.splitcalDetector.

Definition at line 47 of file BaseDetector.py.

47 def fill(self) -> None: # noqa: B027
48 """Fill detector hit branches.
49
50 Note: This method is now a no-op to prevent double-filling.
51 All branches are filled synchronously by recoTree.Fill() in the main loop.
52 """
53 pass
54

◆ process()

None BaseDetector.BaseDetector.process (   self)
Process one event: delete, digitize, and fill.

Definition at line 64 of file BaseDetector.py.

64 def process(self) -> None:
65 """Process one event: delete, digitize, and fill."""
66 self.delete()
67 self.digitize()
68 self.fill()

Member Data Documentation

◆ branch

BaseDetector.BaseDetector.branch

Definition at line 37 of file BaseDetector.py.

◆ det

BaseDetector.BaseDetector.det

Definition at line 29 of file BaseDetector.py.

◆ intree

BaseDetector.BaseDetector.intree

Definition at line 26 of file BaseDetector.py.

◆ mcBranch

BaseDetector.BaseDetector.mcBranch

Definition at line 31 of file BaseDetector.py.

◆ MCdet

BaseDetector.BaseDetector.MCdet

Definition at line 30 of file BaseDetector.py.

◆ name

BaseDetector.BaseDetector.name

Definition at line 25 of file BaseDetector.py.

◆ outtree

BaseDetector.BaseDetector.outtree

Definition at line 28 of file BaseDetector.py.


The documentation for this class was generated from the following file: