Detector Sensitivity Makoto Asai SLAC Geant 4 Users

  • Slides: 19
Download presentation
Detector Sensitivity Makoto Asai (SLAC) Geant 4 Users Workshop @ SLAC Feb. 18 th,

Detector Sensitivity Makoto Asai (SLAC) Geant 4 Users Workshop @ SLAC Feb. 18 th, 2002

Detector sensitivity w A logical volume becomes sensitive if it has a pointer to

Detector sensitivity w A logical volume becomes sensitive if it has a pointer to a concrete class derived from G 4 VSensitive. Detector. w A sensitive detector either – constructs one or more hit objects or – accumulates values to existing hits using information given in a G 4 Step object. NOTE: you must get the volume information from the “Pre. Step. Point”. 2

Sensitive detector and Hit w Each “Logical Volume” can have a pointer to a

Sensitive detector and Hit w Each “Logical Volume” can have a pointer to a sensitive detector. w Hit is a snapshot of the physical interaction of a track or an accumulation of interactions of tracks in the sensitive region of your detector. w A sensitive detector creates hit(s) using the information given in G 4 Step object. The user has to provide his/her own implementation of the detector response. – User. Stepping. Action class should NOT do this. w Hit objects, which still are the user’s class objects, are collected in a G 4 Event object at the end of an event. 3

Digitization w Digit represents a detector output (e. g. ADC/TDC count, trigger signal). w

Digitization w Digit represents a detector output (e. g. ADC/TDC count, trigger signal). w Digit is created with one or more hits and/or other digits by a concrete implementation derived from G 4 VDigitizer. Module. w In contradiction to the Hit which is generated at tracking time automatically, the digitize() method of each G 4 VDigitizer. Module must be explicitly invoked by the user’s code (e. g. at Event. Action). 4

Hit class w Hit is a user-defined class derived from G 4 VHit. w

Hit class w Hit is a user-defined class derived from G 4 VHit. w You can store various types information by implementing your own concrete Hit class. w For example: – – – Position and time of the step Momentum and energy of the track Energy deposition of the step Geometrical information or any combination of above 5

Hit class w Hit objects of a concrete hit class must be stored in

Hit class w Hit objects of a concrete hit class must be stored in a dedicated collection which is instantiated from G 4 THits. Collection template class. w The collection will be associated to a G 4 Event object via G 4 HCof. This. Event. w Hits collections are accessible – through G 4 Event at the end of event, – through G 4 SDManager during processing an event. --> Used for Event filtering. 6

Implementation of Hit class #include "G 4 VHit. hh" #include "G 4 Three. Vector.

Implementation of Hit class #include "G 4 VHit. hh" #include "G 4 Three. Vector. hh" class T 01 Drift. Chamber. Hit : public G 4 VHit { public: T 01 Drift. Chamber. Hit(); T 01 Drift. Chamber. Hit(G 4 int z); virtual ~T 01 Drift. Chamber. Hit(); T 01 Drift. Chamber. Hit(const T 01 Drift. Chamber. Hit &right); const T 01 Drift. Chamber. Hit& operator=(const T 01 Drift. Chamber. Hit &right); int operator==(const T 01 Drift. Chamber. Hit &right) const; inline void *operator new(size_t); inline void operator delete(void *a. Hit); virtual void Draw(); virtual void Print(); 7

Implementation of Hit class private: G 4 int layer. ID; G 4 double time;

Implementation of Hit class private: G 4 int layer. ID; G 4 double time; G 4 Three. Vector local. Pos; G 4 Three. Vector world. Pos; public: // some set/get methods }; #include “G 4 THits. Collection. hh” typedef G 4 THits. Collection<T 01 Drift. Chamber. Hit> T 01 Drift. Chamber. Hits. Collection; 8

Implementation of Hit class #include “G 4 Allocator. hh” extern G 4 Allocator<T 01

Implementation of Hit class #include “G 4 Allocator. hh” extern G 4 Allocator<T 01 Drift. Chamber. Hit> T 01 Drift. Chamber. Hit. Allocator; inline void* T 01 Drift. Chamber. Hit: : operator new(size_t) { void* a. Hit; a. Hit = (void*)T 01 Drift. Chamber. Hit. Allocator. Malloc. Single(); return a. Hit; } inline void T 01 Drift. Chamber. Hit: : operator delete(void* a. Hit) { T 01 Drift. Chamber. Hit. Allocator. Free. Single((T 01 Drift. Chamber. Hit*) a. Hit); } 9

Sensitive Detector class w Sensitive detector is a user-defined class derived from G 4

Sensitive Detector class w Sensitive detector is a user-defined class derived from G 4 VSensitive. Detector. #include "G 4 VSensitive. Detector. hh" #include "T 01 Drift. Chamber. Hit. hh" class G 4 Step; class G 4 HCof. This. Event; class T 01 Drift. Chamber : public G 4 VSensitive. Detector { public: T 01 Drift. Chamber(G 4 String name); virtual ~T 01 Drift. Chamber(); virtual void Initialize(G 4 HCof. This. Event*HCE); virtual G 4 bool Process. Hits(G 4 Step*a. Step, G 4 Touchable. History*ROhist); virtual void End. Of. Event(G 4 HCof. This. Event*HCE); private: T 01 Drift. Chamber. Hits. Collection * hits. Collection; G 4 int HCID; }; 10

Implementation of Sensitive Detector T 01 Drift. Chamber: : T 01 Drift. Chamber(G 4

Implementation of Sensitive Detector T 01 Drift. Chamber: : T 01 Drift. Chamber(G 4 String name) : G 4 VSensitive. Detector(name) { G 4 String HCname; collection. Name. insert(HCname="drift. Chamber. Coll"); HCID = -1; } void T 01 Drift. Chamber: : Initialize(G 4 HCof. This. Event*HCE) { hits. Collection = new T 01 Drift. Chamber. Hits. Collection (Sensitive. Detector. Name, collection. Name[0]); if(HCID<0) { HCID = G 4 SDManager: : Get. SDMpointer() ->Get. Collection. ID(hits. Collection); } HCE->Add. Hits. Collection(HCID, hits. Collection); } 11

Implementation of Sensitive Detector G 4 bool T 01 Drift. Chamber: : Process. Hits

Implementation of Sensitive Detector G 4 bool T 01 Drift. Chamber: : Process. Hits (G 4 Step*a. Step, G 4 Touchable. History*ROhist) { T 01 Drift. Chamber. Hit* a. Hit = new T 01 Drift. Chamber. Hit(); // some set methods hits. Collection->insert(a. Hit); return true; } void T 01 Drift. Chamber: : End. Of. Event(G 4 HCof. This. Event*HCE) {; } 12

Touchable w As mentioned already, G 4 Step has two G 4 Step. Point

Touchable w As mentioned already, G 4 Step has two G 4 Step. Point objects as its starting and ending points. All the geometrical information of the particular step should be got from “Pre. Step. Point”. – Geometrical information associated with G 4 Track is basically same as “Post. Step. Point”. w Each G 4 Step. Point object has – – Position in world coordinate system Global and local time Material G 4 Touchable. History for geometrical information 13

Touchable w G 4 Touchable. History has information of geometrical hierarchy of the point.

Touchable w G 4 Touchable. History has information of geometrical hierarchy of the point. G 4 Step* a. Step; G 4 Step. Point* pre. Step. Point = a. Step->Get. Pre. Step. Point(); G 4 Touchable. History* the. Touchable = (G 4 Touchable. History*)(pre. Step. Point->Get. Touchable()); G 4 int copy. No = the. Touchable->Get. Volume()->Get. Copy. No(); G 4 int mother. Copy. No = the. Touchable->Get. Volume(1)->Get. Copy. No(); G 4 Three. Vector world. Pos = pre. Step. Point->Get. Position(); G 4 Three. Vector local. Pos = the. Touchable->Get. History()-> Get. Top. Transform(). Transform. Point(world. Pos); 14

Readout geometry w Readout geometry is a virtual and artificial geometry which can be

Readout geometry w Readout geometry is a virtual and artificial geometry which can be defined in parallel to the real detector geometry. w Readout geometry is optional. May have more than one. – Each one should be associated to a sensitive detector. 15

Defining a sensitive detector w Basic strategy G 4 Logical. Volume* my. Log. Calor

Defining a sensitive detector w Basic strategy G 4 Logical. Volume* my. Log. Calor = ……; G 4 VSensetive. Detector* p. Sensetive. Part = new My. Calorimeter. SD(“/mydet/calorimeter”); G 4 SDManager* SDMan = G 4 SDManager: : Get. SDMpointer(); SDMan->Add. New. Detector(p. Sensitive. Part); my. Log. Calor->Set. Sensitive. Detector(p. Sensetive. Part); w Each detector object must have a unique name. – Some logical volumes can share one detector object – More than one detector objects can be made from one detector class – One logical volume cannot have more than one detector objects. But, one detector object can generate more than one kinds of hits. 16

G 4 HCof. This. Event w A G 4 Event object has a G

G 4 HCof. This. Event w A G 4 Event object has a G 4 HCof. This. Event object at the end of (successful) event processing. G 4 HCof. This. Event object stores all hits collections made within the event. – Pointer(s) may be NULL if collection(s) are not created in the particular event. – Hits collections are stored by pointers of G 4 VHits. Collection base class. Thus, you have to cast them to types of individual concrete classes. 17

Useage of G 4 HCof. This. Event G 4 SDManager* SDman = G 4

Useage of G 4 HCof. This. Event G 4 SDManager* SDman = G 4 SDManager: : Get. SDMpointer(); DHC 1 ID = Sdman ->Get. Collection. ID(col. Name="chamber 1/drift. Chamber. Coll"); DHC 2 ID = Sdman ->Get. Collection. ID(col. Name="chamber 2/drift. Chamber. Coll"); G 4 HCof. This. Event * HCE = evt->Get. HCof. This. Event(); T 01 Drift. Chamber. Hits. Collection* DHC 1 = 0; T 01 Drift. Chamber. Hits. Collection* DHC 2 = 0; if(HCE) { DHC 1 = (T 01 Drift. Chamber. Hits. Collection*)(HCE->Get. HC(DHC 1 ID)); DHC 2 = (T 01 Drift. Chamber. Hits. Collection*)(HCE->Get. HC(DHC 2 ID)); } 18

Useage of G 4 HCof. This. Event if(DHC 1) { int n_hit = DHC

Useage of G 4 HCof. This. Event if(DHC 1) { int n_hit = DHC 1 ->entries(); G 4 cout << "Drift Chamber 1 has ” << n_hit << " hits. " << G 4 endl; for(int i 1=0; i 1<n_hit; i 1++) { T 01 Drift. Chamber. Hit* a. Hit = (*DHC 1)[i 1]; a. Hit->Print(); } } w This scheme can also be utilized for Digitization. 19