Detector sensitivity Makoto Asai SLAC Computing Services Geant

  • Slides: 16
Download presentation
Detector sensitivity Makoto Asai (SLAC Computing Services) Geant 4 Tutorial Course @ DESY September

Detector sensitivity Makoto Asai (SLAC Computing Services) Geant 4 Tutorial Course @ DESY September 30 th, 2003 Detector Sensitivity - M. Asai (SLAC) - Sept. 30, 2003 @ DESY

Contents 4 Sensitive detector and hit 4 Digitizer module and digit 4 Hit class

Contents 4 Sensitive detector and hit 4 Digitizer module and digit 4 Hit class 4 Sensitive detector class 4 Touchable 4 Readout geometry 4 G 4 HCof. This. Event class and its use Detector Sensitivity - M. Asai (SLAC) - Sept. 30, 2003 @ DESY 2

Sensitive detector and Hit 4 Each Logical Volume can have a pointer to a

Sensitive detector and Hit 4 Each Logical Volume can have a pointer to a sensitive detector. 4 4 Then this volume becomes sensitive. 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. 4 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. 4 4 User. Stepping. Action class should NOT do this. Hit objects, which are still the user’s class objects, are collected in a G 4 Event object at the end of an event. Detector Sensitivity - M. Asai (SLAC) - Sept. 30, 2003 @ DESY 3

Detector sensitivity 4 A sensitive detector either 4 constructs one or more hit objects

Detector sensitivity 4 A sensitive detector either 4 constructs one or more hit objects or 4 accumulates values to existing hits using information given in a G 4 Step object. 4 Note that you must get the volume information from the “ Pre. Step. Point”. Boundary Step End of step point Begin of step point Detector Sensitivity - M. Asai (SLAC) - Sept. 30, 2003 @ DESY 4

Digitizer module and digit 4 Digit represents a detector output (e. g. ADC/TDC count,

Digitizer module and digit 4 Digit represents a detector output (e. g. ADC/TDC count, trigger signal, etc. ). 4 Digit is created with one or more hits and/or other digits by a user's concrete implementation derived from G 4 VDigitizer. Module. 4 In contradiction to the sensitive detector which is accessed 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). Detector Sensitivity - M. Asai (SLAC) - Sept. 30, 2003 @ DESY 5

Hit class 4 4 4 Hit is a user-defined class derived from G 4

Hit class 4 4 4 Hit is a user-defined class derived from G 4 VHit. You can store various types of information by implementing your own concrete Hit class. For example: 4 Position and time of the step 4 Momentum and energy of the track 4 Energy deposition of the step 4 Geometrical information 4 or any combination of above Hit objects of a concrete hit class must be stored in a dedicated collection which is instantiated from G 4 THits. Collection template class. The collection will be associated to a G 4 Event object via G 4 HCof. This. Event. Hits collections are accessible 4 through G 4 Event at the end of event 4 to be used for analyzing an event 4 through G 4 SDManager during processing an event 4 to be used for event filtering in user's stacking action Detector Sensitivity - M. Asai (SLAC) - Sept. 30, 2003 @ DESY 6

Implementation of Hit class #include "G 4 VHit. hh" class My. Drift. Chamber. Hit

Implementation of Hit class #include "G 4 VHit. hh" class My. Drift. Chamber. Hit : public G 4 VHit { public: My. Drift. Chamber. Hit(); virtual ~My. Drift. Chamber. Hit(); virtual void Draw(); virtual void Print(); private: // some data members public: // some set/get methods }; #include “G 4 THits. Collection. hh” typedef G 4 THits. Collection<My. Drift. Chamber. Hit> My. Drift. Chamber. Hits. Collection; Detector Sensitivity - M. Asai (SLAC) - Sept. 30, 2003 @ DESY 7

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

Sensitive Detector class 4 Sensitive detector is a user-defined class derived from G 4 VSensitive. Detector. #include "G 4 VSensitive. Detector. hh" #include "My. Drift. Chamber. Hit. hh" class G 4 Step; class G 4 HCof. This. Event; class My. Drift. Chamber : public G 4 VSensitive. Detector { public: My. Drift. Chamber(G 4 String name); virtual ~My. 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: My. Drift. Chamber. Hits. Collection * hits. Collection; G 4 int collection. ID; }; Detector Sensitivity - M. Asai (SLAC) - Sept. 30, 2003 @ DESY 8

Implementation of Sensitive Detector My. Drift. Chamber: : My. Drift. Chamber(G 4 String name)

Implementation of Sensitive Detector My. Drift. Chamber: : My. Drift. Chamber(G 4 String name) : G 4 VSensitive. Detector(name) { collection. Name. insert("drift. Chamber. Collection"); collection. ID = -1; } void My. Drift. Chamber: : Initialize(G 4 HCof. This. Event*HCE) { hits. Collection = new My. Drift. Chamber. Hits. Collection (Sensitive. Detector. Name, collection. Name[0]); if(collection. ID<0) { collection. ID = G 4 SDManager: : Get. SDMpointer() ->Get. Collection. ID(hits. Collection); } HCE->Add. Hits. Collection(collection. ID, hits. Collection); } G 4 bool My. Drift. Chamber: : Process. Hits (G 4 Step*a. Step, G 4 Touchable. History*ROhist) { My. Drift. Chamber. Hit* a. Hit = new My. Drift. Chamber. Hit(); // some set methods. . . hits. Collection->insert(a. Hit); return true; } void My. Drift. Chamber: : End. Of. Event(G 4 HCof. This. Event*HCE) {; } Detector Sensitivity - M. Asai (SLAC) - Sept. 30, 2003 @ DESY 9

Touchable 4 4 4 As mentioned already, G 4 Step has two G 4

Touchable 4 4 4 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 taken from “Pre. Step. Point”. 4 Geometrical information associated with G 4 Track is basically same as “Post. Step. Point”. Each G 4 Step. Point object has 4 Position in world coordinate system 4 Global and local time 4 Material 4 G 4 Touchable. History for geometrical information G 4 Touchable. History object is a vector of information for each geometrical hierarchy. 4 copy number 4 transformation / rotation to its mother Detector Sensitivity - M. Asai (SLAC) - Sept. 30, 2003 @ DESY 10

Copy number 4 4 Suppose a calorimeter is made of 4 x 5 cells.

Copy number 4 4 Suppose a calorimeter is made of 4 x 5 cells. 0 1 Copy. No 2 =0 3 4 4 and it is implemented by two levels of replica. In reality, there is only one 0 1 Copy. No 2 =1 3 4 physical volume object for each level. Its position is parameterized by its copy 0 1 Copy. No 2 =2 3 4 number. To get the copy number of each 0 1 Copy. No 2 =3 3 4 level, suppose what happens if a step belongs to two cells. 4 Remember geometrical information in G 4 Track is identical to "Post. Step. Point". 4 You cannot get the collect copy number for "Pre. Step. Point" if you directly access to the physical volume. Use touchable to get the proper copy number, transform matrix, etc. Detector Sensitivity - M. Asai (SLAC) - Sept. 30, 2003 @ DESY 11

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

Touchable 4 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); Detector Sensitivity - M. Asai (SLAC) - Sept. 30, 2003 @ DESY 12

Readout geometry 4 4 In some cases of most complicated geometries, it is not

Readout geometry 4 4 In some cases of most complicated geometries, it is not easy to define volume boundaries corresponding to the readout segmentation. Readout geometry is a virtual and artificial geometry which can be defined in parallel to the real detector geometry. Readout geometry is optional. May have more than one. 4 Each one should be associated to a sensitive detector. Note that a step is not limited by the boundary of readout geometry. Detector Sensitivity - M. Asai (SLAC) - Sept. 30, 2003 @ DESY 13

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

Defining a sensitive detector 4 Basic strategy G 4 Logical. Volume* my. Log. Calor = ……; G 4 VSensetive. Detector* p. Sensetive. Part = new My. Calorimeter(“/mydet/calorimeter 1”); 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); 4 Each detector object must have a unique name. 4 Some logical volumes can share one detector object 4 More than one detector objects can be made from one detector class with different detector name. 4 One logical volume cannot have more than one detector objects. But, one detector object can generate more than one kinds of hits. 4 e. g. a drift chamber class may generate anode and cathode hits separately. Detector Sensitivity - M. Asai (SLAC) - Sept. 30, 2003 @ DESY 14

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

G 4 HCof. This. Event 4 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. 4 4 Pointer(s) may be NULL if collection(s) are not created in the particular event. Individual collection should be accessed by collection index (integer). Index is constant at least for the run 4 It is constant whole through program execution unless you explicitly delete your sensitive detector 4 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. Detector Sensitivity - M. Asai (SLAC) - Sept. 30, 2003 @ DESY 15

Usage of G 4 HCof. This. Event // CHCID shuold be a data member

Usage of G 4 HCof. This. Event // CHCID shuold be a data member initialized to -1 if(CHCID<0) { CHCID = G 4 SDManager: : Get. SDMpointer() ->Get. Collection. ID("my. Det/calorimeter 1/collection 1"); } if(CHCID<0) G 4 cerr … G 4 HCof. This. Event* HCE = evt->Get. HCof. This. Event(); My. Calorimeter. Hits. Collection* CHC = 0; if(HCE) // HCE can be zero if the event is aborted {CHC = (My. Calorimeter. Hits. Collection*)(HCE->Get. HC(CHCID)); } if(CHC) // CHC can be zero if no hit is generated { int n_hit = CHC->entries(); G 4 cout<<"Calorimeter has ”<<n_hit<<" hits. "<<G 4 endl; for(int i 1=0; i 1<n_hit; i 1++) { My. Calorimeter. Hit* a. Hit = (*CHC)[i 1]; a. Hit->Print(); } } 4 This scheme can be utilized also for Digitization. Detector Sensitivity - M. Asai (SLAC) - Sept. 30, 2003 @ DESY 16