Skip to content

Commit f769c30

Browse files
ihrivnacAxel-Naumann
authored andcommitted
Support for user defined sensitive detectors; new TVirtualMC::NIELEdep(); clean-up:
Details: - Added support for user defined sensitive detectors o TVirtualMCSensitiveDetector: the interface class for a user sensitive detector o New functions in TVirtualMC: void SetSensitiveDetector(const TString &volName, TVirtualMCSensitiveDetector *sd); TVirtualMCSensitiveDetector *GetSensitiveDetector(const TString &volName) const; void SetExclusiveSDScoring(Bool_t exclusiveSDScoring); o New function in TVirtualMCApplication: void ConstructSensitiveDetectors(); - Added new TVirtualMC::NIELEdep() function - Removed default implementation for TVirtualMC::TrackPosition/Momentum with Float_t arguments
1 parent 67c6222 commit f769c30

5 files changed

+194
-21
lines changed

montecarlo/vmc/inc/LinkDef.h

+7-11
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,12 @@
1414
#pragma link C++ enum EMCOpSurfaceType;
1515
#pragma link C++ enum EMCOpSurfaceFinish;
1616

17-
#pragma link C++ class TVirtualMC+;
18-
#pragma link C++ class TVirtualMCGeometry+;
19-
#pragma link C++ class TVirtualMCApplication+;
20-
#pragma link C++ class TVirtualMCStack+;
21-
#pragma link C++ class TMCVerbose+;
22-
#pragma link C++ class TGeoMCGeometry+;
17+
#pragma link C++ class TVirtualMC + ;
18+
#pragma link C++ class TVirtualMCGeometry + ;
19+
#pragma link C++ class TVirtualMCApplication + ;
20+
#pragma link C++ class TVirtualMCSensitiveDetector + ;
21+
#pragma link C++ class TVirtualMCStack + ;
22+
#pragma link C++ class TMCVerbose + ;
23+
#pragma link C++ class TGeoMCGeometry + ;
2324

2425
#endif
25-
26-
27-
28-
29-

montecarlo/vmc/inc/TVirtualMC.h

+57-10
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ class TLorentzVector;
3737
class TGeoHMatrix;
3838
class TArrayI;
3939
class TArrayD;
40+
class TVirtualMCSensitiveDetector;
4041

4142
class TVirtualMC : public TNamed {
4243

@@ -435,6 +436,26 @@ class TVirtualMC : public TNamed {
435436
/// Return the copyNo of i-th daughter of the volume specified by volName
436437
virtual Int_t VolDaughterCopyNo(const char* volName, Int_t i) const = 0;
437438

439+
//
440+
// ------------------------------------------------
441+
// methods for sensitive detectors
442+
// ------------------------------------------------
443+
//
444+
445+
/// Set a sensitive detector to a volume
446+
/// - volName - the volume name
447+
/// - sd - the user sensitive detector
448+
virtual void SetSensitiveDetector(const TString &volName, TVirtualMCSensitiveDetector *sd);
449+
450+
/// Get a sensitive detector of a volume
451+
/// - volName - the volume name
452+
virtual TVirtualMCSensitiveDetector *GetSensitiveDetector(const TString &volName) const;
453+
454+
/// The scoring option:
455+
/// if true, scoring is performed only via user defined sensitive detectors and
456+
/// MCApplication::Stepping is not called
457+
virtual void SetExclusiveSDScoring(Bool_t exclusiveSDScoring);
458+
438459
//
439460
// ------------------------------------------------
440461
// methods for physics management
@@ -695,7 +716,7 @@ class TVirtualMC : public TNamed {
695716

696717
/// Return the current position in the master reference frame of the
697718
/// track being transported (as float)
698-
virtual void TrackPosition(Float_t &x, Float_t &y, Float_t &z) const;
719+
virtual void TrackPosition(Float_t &x, Float_t &y, Float_t &z) const =0;
699720

700721
/// Return the direction and the momentum (GeV/c) of the track
701722
/// currently being transported
@@ -707,7 +728,7 @@ class TVirtualMC : public TNamed {
707728

708729
/// Return the direction and the momentum (GeV/c) of the track
709730
/// currently being transported (as float)
710-
virtual void TrackMomentum(Float_t &px, Float_t &py, Float_t &pz, Float_t &etot) const;
731+
virtual void TrackMomentum(Float_t &px, Float_t &py, Float_t &pz, Float_t &etot) const =0;
711732

712733
/// Return the length in centimeters of the current step (in cm)
713734
virtual Double_t TrackStep() const =0;
@@ -721,6 +742,9 @@ class TVirtualMC : public TNamed {
721742
/// Return the energy lost in the current step
722743
virtual Double_t Edep() const =0;
723744

745+
/// Return the non-ionising energy lost (NIEL) in the current step
746+
virtual Double_t NIELEdep() const;
747+
724748
//
725749
// get methods
726750
// tracking particle
@@ -888,18 +912,41 @@ class TVirtualMC : public TNamed {
888912

889913
// inline functions (with temorary implementation)
890914

891-
inline void TVirtualMC::TrackPosition(Float_t & /*x*/, Float_t & /*y*/, Float_t & /*z*/) const
915+
inline void TVirtualMC::SetSensitiveDetector(const TString &/*volName*/, TVirtualMCSensitiveDetector */*sd*/)
892916
{
893-
/// Return the current position in the master reference frame of the
894-
/// track being transported (as float)
895-
Warning("TrackPosition(Float_t& ...)", "New function - not yet implemented.");
917+
/// Set a sensitive detector to a volume
918+
/// - volName - the volume name
919+
/// - sd - the user sensitive detector
920+
921+
Warning("SetSensitiveDetector(...)", "New function - not yet implemented.");
896922
}
897923

898-
inline void TVirtualMC::TrackMomentum(Float_t & /*px*/, Float_t & /*py*/, Float_t & /*pz*/, Float_t & /*etot*/) const
924+
inline TVirtualMCSensitiveDetector *TVirtualMC::GetSensitiveDetector(const TString &/*volName*/) const
899925
{
900-
/// Return the direction and the momentum (GeV/c) of the track
901-
/// currently being transported (as float)
902-
Warning("TrackPosition(Float_t& ...)", "New function - not yet implemented.");
926+
/// Get a sensitive detector of a volume
927+
/// - volName - the volume name
928+
929+
Warning("GetSensitiveDetector()", "New function - not yet implemented.");
930+
931+
return 0;
932+
}
933+
934+
inline void TVirtualMC::SetExclusiveSDScoring(Bool_t /*exclusiveSDScoring*/)
935+
{
936+
/// The scoring option:
937+
/// if true, scoring is performed only via user defined sensitive detectors and
938+
/// MCApplication::Stepping is not called
939+
940+
Warning("SetExclusiveSDScoring(...)", "New function - not yet implemented.");
941+
}
942+
943+
inline Double_t TVirtualMC::NIELEdep() const
944+
{
945+
/// Return the non-ionising energy lost (NIEL) in the current step
946+
947+
Warning("NIELEdep()", "New function - not yet implemented.");
948+
949+
return 0.;
903950
}
904951

905952
#define gMC (TVirtualMC::GetMC())

montecarlo/vmc/inc/TVirtualMCApplication.h

+3
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ class TVirtualMCApplication : public TNamed {
5151
/// Define parameters for optical processes (optional)
5252
virtual void ConstructOpGeometry() {}
5353

54+
/// Define sensitive detectors (optional)
55+
virtual void ConstructSensitiveDetectors() {}
56+
5457
/// Initialize geometry
5558
/// (Usually used to define sensitive volumes IDs)
5659
virtual void InitGeometry() = 0;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
// @(#)root/vmc:$Id$
2+
// Authors: Ivana Hrivnacova 19/04/2018
3+
4+
/*************************************************************************
5+
* Copyright (C) 2006, Rene Brun and Fons Rademakers. *
6+
* Copyright (C) 2018 ALICE Experiment at CERN. *
7+
* All rights reserved. *
8+
* *
9+
* For the licensing terms see $ROOTSYS/LICENSE. *
10+
* For the list of contributors see $ROOTSYS/README/CREDITS. *
11+
*************************************************************************/
12+
13+
#ifndef ROOT_TVirtualMCSensitiveDetector
14+
#define ROOT_TVirtualMCSensitiveDetector
15+
16+
// Class TVirtualMCSensitiveDetector
17+
// ---------------------------------
18+
// Interface to a user defined particles stack.
19+
//
20+
21+
#include "TNamed.h"
22+
23+
class TParticle;
24+
25+
class TVirtualMCSensitiveDetector : public TNamed {
26+
27+
public:
28+
// Constructor
29+
TVirtualMCSensitiveDetector(const char *name, const char *title = "");
30+
TVirtualMCSensitiveDetector(const TString &name, const TString &title = "");
31+
32+
// Destructor
33+
virtual ~TVirtualMCSensitiveDetector();
34+
35+
/// Initialize detector.
36+
/// Called at initialization of geometry before MCApplication::InitGeometry().
37+
virtual void Initialize() = 0;
38+
39+
/// Process hits.
40+
/// Called at each step when track pass through the associated volume
41+
virtual void ProcessHits() = 0;
42+
43+
/// End of event.
44+
/// Called at end of event before MCApplication::FinishEvent().
45+
virtual void EndOfEvent() = 0;
46+
47+
protected:
48+
// Default constructor
49+
TVirtualMCSensitiveDetector();
50+
// Copy constructor
51+
TVirtualMCSensitiveDetector(const TVirtualMCSensitiveDetector &rhs);
52+
// Assignment constructor
53+
TVirtualMCSensitiveDetector &operator=(const TVirtualMCSensitiveDetector &rhs);
54+
55+
ClassDef(TVirtualMCSensitiveDetector, 1) // Interface to a user sensitive detector
56+
};
57+
58+
#endif // ROOT_TVirtualMCSensitiveDetector
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
// @(#)root/vmc:$Id$
2+
// Authors: Ivana Hrivnacova 19/04/2018
3+
4+
/*************************************************************************
5+
* Copyright (C) 2006, Rene Brun and Fons Rademakers. *
6+
* Copyright (C) 2018, ALICE Experiment at CERN. *
7+
* All rights reserved. *
8+
* *
9+
* For the licensing terms see $ROOTSYS/LICENSE. *
10+
* For the list of contributors see $ROOTSYS/README/CREDITS. *
11+
*************************************************************************/
12+
13+
#include "TVirtualMCSensitiveDetector.h"
14+
15+
/** \class TVirtualMCSensitiveDetector
16+
\ingroup vmc
17+
18+
Interface to a user defined sensitive detector.
19+
*/
20+
21+
ClassImp(TVirtualMCSensitiveDetector);
22+
23+
////////////////////////////////////////////////////////////////////////////////
24+
/// Standard constructor
25+
26+
TVirtualMCSensitiveDetector::TVirtualMCSensitiveDetector(const char *name, const char *title) : TNamed(name, title) {}
27+
28+
////////////////////////////////////////////////////////////////////////////////
29+
/// Standard constructor
30+
31+
TVirtualMCSensitiveDetector::TVirtualMCSensitiveDetector(const TString &name, const TString &title)
32+
: TNamed(name, title)
33+
{
34+
}
35+
36+
////////////////////////////////////////////////////////////////////////////////
37+
/// Default constructor
38+
39+
TVirtualMCSensitiveDetector::TVirtualMCSensitiveDetector() : TNamed() {}
40+
41+
////////////////////////////////////////////////////////////////////////////////
42+
/// Copy constructor
43+
44+
TVirtualMCSensitiveDetector::TVirtualMCSensitiveDetector(const TVirtualMCSensitiveDetector &rhs) : TNamed(rhs)
45+
{
46+
/// Copy constructor
47+
48+
*this = rhs;
49+
}
50+
51+
////////////////////////////////////////////////////////////////////////////////
52+
/// Destructor
53+
54+
TVirtualMCSensitiveDetector::~TVirtualMCSensitiveDetector() {}
55+
56+
////////////////////////////////////////////////////////////////////////////////
57+
/// Assignment operator
58+
59+
TVirtualMCSensitiveDetector &TVirtualMCSensitiveDetector::operator=(const TVirtualMCSensitiveDetector &rhs)
60+
{
61+
// check assignment to self
62+
if (this == &rhs)
63+
return *this;
64+
65+
// base class assignment
66+
TNamed::operator=(rhs);
67+
68+
return *this;
69+
}

0 commit comments

Comments
 (0)