Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
367 changes: 309 additions & 58 deletions UpstreamTagger/UpstreamTagger.cxx

Large diffs are not rendered by default.

61 changes: 42 additions & 19 deletions UpstreamTagger/UpstreamTagger.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,18 @@ class UpstreamTagger : public FairDetector, public ISTLPointContainer {
* kFALSE for inactive detectors
*/
UpstreamTagger(const char* Name, Bool_t Active);

UpstreamTagger& operator=(const UpstreamTagger&);
/** default constructor */
UpstreamTagger();

/** Name : Detector Name
* Active: kTRUE for active detectors (ProcessHits() will be called)
* kFALSE for inactive detectors
*/
// UpstreamTagger(const char* Name, Bool_t Active);
UpstreamTagger(std::string medium);
/** destructor */
virtual ~UpstreamTagger();

/** Initialization of the detector is done here */
virtual void Initialize();

Expand All @@ -78,19 +83,25 @@ class UpstreamTagger : public FairDetector, public ISTLPointContainer {

/** Sets detector position and sizes */
void SetZposition(Double_t z) { det_zPos = z; }
void SetBoxDimensions(Double_t x, Double_t y, Double_t z) {
xbox_fulldet = x;
ybox_fulldet = y;
zbox_fulldet = z;
}

void SetzPositions(Double_t z1);
void SetApertureArea(Double_t width, Double_t height, Double_t length);
void SetStrawDiameter(Double_t outer_straw_diameter, Double_t wall_thickness);
void SetStrawPitch(Double_t straw_pitch, Double_t layer_offset);
void SetDeltazLayer(Double_t delta_z_layer);
void SetStereoAngle(Double_t stereo_angle);
void SetWireThickness(Double_t wire_thickness);
void SetFrameMaterial(TString frame_material);
void SetDeltazView(Double_t delta_z_view);
static std::tuple<Int_t, Int_t, Int_t, Int_t> StrawDecode(Int_t detID);
static void StrawEndPoints(Int_t detID, TVector3& top, TVector3& bot);
/** Create the detector geometry */
void ConstructGeometry();

/** This method is an example of how to add your own point
* of type TimeRpcPoint to the clones array
*/
UpstreamTaggerPoint* AddHit(Int_t trackID, Int_t detID, TVector3 pos,
UpstreamTaggerPoint* AddHit(Int_t trackID, Int_t detID, Int_t subDetID, TVector3 pos,
TVector3 mom, Double_t time, Double_t length,
Double_t eLoss, Int_t pdgCode, TVector3 Lpos,
TVector3 Lmom);
Expand All @@ -117,24 +128,36 @@ class UpstreamTagger : public FairDetector, public ISTLPointContainer {

/** Detector parameters.*/

Double_t det_zPos; //! z-position of detector (set via SetZposition)
// Detector box dimensions (set via SetBoxDimensions, defaults provided below)
Double_t xbox_fulldet = 4.4 * m; //! X dimension (default: 4.4 m)
Double_t ybox_fulldet = 6.4 * m; //! Y dimension (default: 6.4 m)
Double_t zbox_fulldet =
16.0 * cm; //! Z dimension/thickness (default: 16 cm)
Double_t f_aperture_width;
Double_t f_aperture_height;
Double_t f_station_length;
Double_t f_straw_pitch;
Double_t f_view_angle;
Double_t f_offset_layer;
Double_t f_inner_straw_diameter;
Double_t f_outer_straw_diameter;
Double_t f_wire_thickness;
Double_t f_T1_z;
Double_t f_delta_z_view;
Double_t f_delta_z_layer;
TString f_frame_material;
std::string fMedium;
/** Detector parameters.*/

Double_t det_zPos; //! z-position of detector (set via SetZposition)

private:
TGeoVolume* UpstreamTagger_fulldet; // Timing_detector_1 object
TGeoVolume* scoringPlaneUBText; // new scoring plane
/** container for data points */
std::vector<UpstreamTaggerPoint>* fUpstreamTaggerPoints;

UpstreamTagger(const UpstreamTagger&);
UpstreamTagger& operator=(const UpstreamTagger&);
Int_t InitMedium(const char* name);

ClassDef(UpstreamTagger, 1)
TGeoVolume* UpstreamTagger_plastic;

/** container for data points */
TClonesArray* fUpstreamTaggerPointCollection;

ClassDef(UpstreamTagger,1)
};

#endif // UPSTREAMTAGGER_UPSTREAMTAGGER_H_
2 changes: 2 additions & 0 deletions UpstreamTagger/UpstreamTaggerHit.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ UpstreamTaggerHit::UpstreamTaggerHit(UpstreamTaggerPoint* p, Double_t t0,

// Smear time with Gaussian resolution
fTime = gRandom->Gaus(p->GetTime() + t0, time_res);

fSubDetID = p->GetLayerID();
}

// ----- Destructor -------------------------
Expand Down
1 change: 1 addition & 0 deletions UpstreamTagger/UpstreamTaggerHit.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class UpstreamTaggerHit : public ShipHit {
Double_t fY; ///< Smeared y position (cm)
Double_t fZ; ///< Smeared z position (cm)
Double_t fTime; ///< Smeared time (ns)
Int_t fSubDetID; ///< Which layer of the UBT is this

ClassDef(UpstreamTaggerHit, 2);
};
Expand Down
2 changes: 2 additions & 0 deletions UpstreamTagger/UpstreamTaggerPoint.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@ UpstreamTaggerPoint::UpstreamTaggerPoint() : FairMCPoint() {}

// ----- Standard constructor ------------------------------------------
UpstreamTaggerPoint::UpstreamTaggerPoint(Int_t trackID, Int_t detID,
Int_t subDetID,
TVector3 pos, TVector3 mom,
Double_t tof, Double_t length,
Double_t eLoss, Int_t pdgcode,
TVector3 Lpos, TVector3 Lmom)
: FairMCPoint(trackID, detID, pos, mom, tof, length, eLoss),
fPdgCode(pdgcode),
fSubDetID(subDetID),
fLpos{Lpos.X(), Lpos.Y(), Lpos.Z()},
fLmom{Lmom.X(), Lmom.Y(), Lmom.Z()} {}
// -------------------------------------------------------------------------
Expand Down
5 changes: 4 additions & 1 deletion UpstreamTagger/UpstreamTaggerPoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class UpstreamTaggerPoint : public FairMCPoint {
*@param length Track length since creation [cm]
*@param eLoss Energy deposit [GeV]
**/
UpstreamTaggerPoint(Int_t trackID, Int_t detID, TVector3 pos, TVector3 mom,
UpstreamTaggerPoint(Int_t trackID, Int_t detID, Int_t subDetID, TVector3 pos, TVector3 mom,
Double_t tof, Double_t length, Double_t eLoss,
Int_t pdgCode, TVector3 Lpos, TVector3 Lmom);

Expand All @@ -44,9 +44,12 @@ class UpstreamTaggerPoint : public FairMCPoint {
Int_t PdgCode() const { return fPdgCode; }
TVector3 LastPoint() const { return TVector3(fLpos[0], fLpos[1], fLpos[2]); }
TVector3 LastMom() const { return TVector3(fLmom[0], fLmom[1], fLmom[2]); }
Int_t GetLayerID() const { return fSubDetID; };


private:
Int_t fPdgCode;
Int_t fSubDetID;
std::array<Double_t, 3> fLpos, fLmom;

ClassDef(UpstreamTaggerPoint, 3)
Expand Down
14 changes: 14 additions & 0 deletions geometry/ubt_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Geometry configuration of UBT (veto) in FairShip

UBT:
width: 150 # Aperture width (x) in cm (half length)
height: 150 # Aperture height (y) in cm (half length)
wire_thickness: 0.003 # Sense wire thickness in cm
wall_thickness: 0.0036 # Straw wall thickness in cm
outer_straw_diameter: 2 # in cm
straw_pitch: 2 # Distance (y) between straws in a layer in cm
y_layer_offset: 1 # Offset (y) of straws between layers in cm
delta_z_layer: 1.732 # Distance (z) between layers in cm
delta_z_view: 12 # Distance (z) between stereo views in cm
view_angle: 4.57 # Stereo angle in degree
station_length: 40 # (z) in cm (half length)
67 changes: 67 additions & 0 deletions python/ShipGeo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# SPDX-License-Identifier: LGPL-3.0-or-later
# SPDX-FileCopyrightText: Copyright CERN for the benefit of the SHiP Collaboration

import shipunit as u
import ROOT
fDesign = 2
class ShipGeo():
def __init__(self,z=0):
self.z = z

def zPositions():
main = sys.modules['__main__']
if hasattr(main,'ShipGeo'):
for x in ShipGeo:
if hasattr(eval('ShipGeo.'+x),'z'): print(x,'z=',eval('ShipGeo.'+x+'.z'))

#vetoStation = ShipGeo(-2390.*u.cm)
TrackStation1 = ShipGeo(1510.*u.cm)
TrackStation2 = ShipGeo(1710.*u.cm)
TrackStation3 = ShipGeo(2150.*u.cm)
TrackStation4 = ShipGeo(2370.*u.cm)

UBTStation1 = ShipGeo(2390.*u.cm)
UBTStation2 = ShipGeo(2395.*u.cm)
UBTStation3 = ShipGeo(2400.*u.cm)
UBTStation4 = ShipGeo(2405.*u.cm)


z = TrackStation2.z + 0.5 * (TrackStation3.z - TrackStation2.z)
Bfield = ShipGeo(z)
Bfield.max = 1.5*u.kilogauss # was 1.15 in EOI

# target absorber muon shield setup
decayVolume = ShipGeo(0*u.cm)
decayVolume.length = 50*u.m

muShield = ShipGeo(0*u.cm)
muShield.dZ1 = 2.5*u.m
muShield.dZ2 = 3.5*u.m
muShield.dZ3 = 3.0*u.m
muShield.dZ4 = 3.0*u.m
muShield.dZ5 = 2.5*u.m
muShield.dZ6 = 2.5*u.m
muShield.LE = 5*u.m
# for passive design, fDesign==1
if fDesign == 1: muShield.length = 70*u.m
# for active design, fDesign==2
if fDesign == 2: muShield.length = 2*(muShield.dZ1+muShield.dZ2+muShield.dZ3+muShield.dZ4+muShield.dZ5+muShield.dZ6) + muShield.LE # leave some space for nu-tau detector
muShield.z = -decayVolume.length/2.-muShield.length/2.

hadronAbsorber = ShipGeo(0*u.cm)
hadronAbsorber.length= 3.0*u.m
hadronAbsorber.z = muShield.z - muShield.length/2. - hadronAbsorber.length/2.

target = ShipGeo(0*u.cm)
target.length = 50*u.cm
target.z = hadronAbsorber.z - hadronAbsorber.length/2. - target.length/2.

# interaction point, start of target
target.z0 = target.z - target.length/2.

# straws of tracking stations
straw = ShipGeo(0*u.cm)
straw.length = 250.*u.cm
straw.resol = 0.01*u.cm
straw.pitch = 1.*u.cm
straw.stereoAngle = 5./180.*ROOT.TMath.Pi()
4 changes: 3 additions & 1 deletion python/geometry_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,8 @@ def create_config(
c.Chamber1 = AttrDict(z=z4 - 4666.0 * u.cm - magnetIncrease - extraVesselLength)
c.Chamber6 = AttrDict(z=z4 + 30.0 * u.cm + windowBulge / 2.0)

c.UBTStation1 = AttrDict(z = c.decayVolume.z0 - 50*u.cm)

c.Bfield = AttrDict()
c.Bfield.z = c.z
c.Bfield.max = 0 # 1.4361*u.kilogauss # was 1.15 in EOI
Expand Down Expand Up @@ -537,7 +539,7 @@ def create_config(
c.UpstreamTagger = AttrDict()
c.UpstreamTagger.BoxX = 4.4 * u.m # X dimension (width)
c.UpstreamTagger.BoxY = 6.4 * u.m # Y dimension (height)
c.UpstreamTagger.BoxZ = 16.0 * u.cm # Z dimension (thickness)
c.UpstreamTagger.BoxZ = 2.0 * u.cm # Z dimension (thickness)
c.UpstreamTagger.Z_Position = (
-25.400 * u.m + c.decayVolume.z
) # Relative position of UBT to decay vessel centre
Expand Down
53 changes: 46 additions & 7 deletions python/shipDet_conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,49 @@ def configure_strawtubes(yaml_file, ship_geo):

detectorList.append(strawtubes)

def configure_upstreamTagger(yaml_file, ship_geo):
with open(yaml_file) as file:
config = yaml.safe_load(file)

ship_geo.ubt_geo = AttrDict(config['UBT'])

# Straw tubes in decay vessel if vacuum, otherwise outside in air
ship_geo.ubt_geo.medium = "vacuums" if ship_geo.DecayVolumeMedium == "vacuums" else "air"

ship_geo.ubt_geo.frame_material = "DIRCcarbonFiber"

ubt = ROOT.UpstreamTagger(ship_geo.ubt_geo.medium)
ubt.SetzPositions(
ship_geo.UBTStation1.z,
)
ubt.SetApertureArea(
ship_geo.ubt_geo.width,
ship_geo.ubt_geo.height,
ship_geo.ubt_geo.station_length
)
ubt.SetStrawDiameter(
ship_geo.ubt_geo.outer_straw_diameter,
ship_geo.ubt_geo.wall_thickness,
)
ubt.SetStrawPitch(
ship_geo.ubt_geo.straw_pitch,
ship_geo.ubt_geo.y_layer_offset,
)
ubt.SetDeltazLayer(ship_geo.ubt_geo.delta_z_layer)
ubt.SetStereoAngle(ship_geo.ubt_geo.view_angle)
ubt.SetWireThickness(ship_geo.ubt_geo.wire_thickness)
ubt.SetDeltazView(ship_geo.ubt_geo.delta_z_view)
ubt.SetFrameMaterial(ship_geo.ubt_geo.frame_material)


#For digitization
# strawtubes.SetStrawResolution(
# ship_geo.strawtubesDigi.v_drift,
# ship_geo.strawtubesDigi.sigma_spatial,
# )

detectorList.append(ubt)


def configure(run, ship_geo):
# ---- for backward compatibility ----
Expand Down Expand Up @@ -428,14 +471,10 @@ def configure(run, ship_geo):
SplitCal.SetStripSize(x.StripHalfWidth, x.StripHalfLength)
detectorList.append(SplitCal)

upstreamTagger = ROOT.UpstreamTagger("UpstreamTagger", ROOT.kTRUE)
upstreamTagger.SetZposition(ship_geo.UpstreamTagger.Z_Position)
upstreamTagger.SetBoxDimensions(
ship_geo.UpstreamTagger.BoxX,
ship_geo.UpstreamTagger.BoxY,
ship_geo.UpstreamTagger.BoxZ
configure_upstreamTagger(
os.path.join(os.environ["FAIRSHIP"], "geometry", "ubt_config.yaml"),
ship_geo,
)
detectorList.append(upstreamTagger)

timeDet = ROOT.TimeDet("TimeDet", ROOT.kTRUE)
timeDet.SetZposition(ship_geo.TimeDet.z)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_rntuple_io.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -349,9 +349,9 @@ int main(int argc, char** argv) {
TVector3 mom(0.1, 0.2, 0.3);
TVector3 lpos(1.1, 2.1, 3.1);
TVector3 lmom(0.11, 0.21, 0.31);
objects.emplace_back(1, 1001, pos, mom, 123.45, 234.56, 0.001, 2212, lpos,
objects.emplace_back(1, 1001, 1, pos, mom, 123.45, 234.56, 0.001, 2212, lpos,
lmom);
objects.emplace_back(2, 2002, pos, mom, 345.67, 456.78, 0.002, 211, lpos,
objects.emplace_back(2, 2002, 1, pos, mom, 345.67, 456.78, 0.002, 211, lpos,
lmom);
total++;
if (test_rntuple_io("UpstreamTaggerPoint", objects)) passed++;
Expand Down
Loading