/[PAMELA software]/PamVMC/include/PamVMCDigMgr.h
ViewVC logotype

Annotation of /PamVMC/include/PamVMCDigMgr.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (hide annotations) (download)
Fri Jun 12 18:39:17 2009 UTC (15 years, 6 months ago) by pam-rm2
Branch: MAIN
CVS Tags: v1r0
Changes since 1.1: +9 -7 lines
File MIME type: text/plain
- Introduced user-defined names of output files and random seeds number.
Users can do it use options of PamVMCApplication constructor:
PamVMCApplication(const char* name,  const char *title, const char*
filename="pamtest", Int_t seed=0).
The Random object that I use is TRandom3 object which has astronomical
large period (in case of default initialization 0). All random generators
in the code use this object by calling of gRandom singleton which keeps
it.

- Corrected TOF digitization routine. No problems with TDC hits due to
hadronic interactions anymore.

- Some small changes was done to compile code under Root 5.23. +
geant4_vmc v. 2.6 without any warnings

- Some classes of PamG4RunConfiguartion was changed for geant4_vmc v.
2.6.Some obsolete classes was deleted as soon as developers implemented
regions.

- Navigation was changed from "geomRootToGeant4" to "geomRoot", because on
VMC web page written that as soon as Geant4 has no option ONLY/MANY
translation of overlapped geometry to Geant4 through VGM could be wrong.
I'd like to stay with Root navigation:
http://root.cern.ch/root/vmc/Geant4VMC.html. This should be default
option.

- New Tracker digitization routine written by Sergio was implemented

- PamVMC again became compatible with geant4_vmc v.2.5 and ROOT 5.20.
 The problem was that ROOT developers introduced in TVirtualMC class a new
method SetMagField and new base class:TVirtualMagField from which
user-defined classes shoukd be derived

1 nikolas 1.1 #ifndef PAMVMCDIGMGR_H
2     #define PAMVMCDIGMGR_H
3     #include <iostream>
4    
5     #include <TSystem.h>
6     #include <TMap.h>
7     #include <TObjString.h>
8     #include "PamVMCDigitizer.h"
9     #include "PamVMCTrkDig.h"
10     #include "PamVMCDigRunHeader.h"
11     #include "PamVMCDigRunTrailer.h"
12     #include "PamVMCTofDig.h"
13     #include "PamVMCAcDig.h"
14     #include "PamVMCCaloDig.h"
15     #include "PamVMCS4Dig.h"
16     #include "PamVMCNDDig.h"
17    
18     class PamVMCDigMgr: public TObject {
19    
20     private:
21    
22     static PamVMCDigMgr * fdig;
23     TMap fdigmap;
24    
25     /* This method calls only from manager. It is owner of all
26     digitizer objects */
27     void SetDIG(const char *name, PamVMCDigitizer *detDIG){
28     fdigmap.Add(new TObjString(name),detDIG);
29     fdigmap.Print();
30     }
31    
32    
33     protected:
34     PamVMCDigMgr(){
35     //detectors should be ordered.. First calibrations
36     SetDIG("Tof", new PamVMCTofDig());
37     SetDIG("AC", new PamVMCAcDig());
38     SetDIG("CAST",new PamVMCCaloDig());
39     SetDIG("TSPA", new PamVMCTrkDig());
40     SetDIG("S4",new PamVMCS4Dig());
41     SetDIG("NDTI",new PamVMCNDDig());
42 pam-rm2 1.5 //SetDIG("RunHeader", new PamVMCDigRunHeader());
43     //SetDIG("RunTrailer", new PamVMCDigRunTrailer());
44 nikolas 1.1 }
45    
46     public:
47    
48     ~PamVMCDigMgr(){ fdigmap.DeleteAll(); }
49    
50     static PamVMCDigMgr * Instance();
51    
52     PamVMCDigitizer * GetDIG(const char *name){
53     return (PamVMCDigitizer*)fdigmap(name);
54     }
55    
56 pam-rm2 1.5 /* Setting pointer to random objects for all Digitizers */
57 nikolas 1.1 /* All digitizers load calibrations and calibrate */
58 pam-rm2 1.5 void Initialize(TRandom* random){
59 nikolas 1.1 TMapIter *n= (TMapIter *)fdigmap.MakeIterator();
60 pam-rm2 1.5 TObject *o; while( (o=(TObject *) n->Next())) {
61 nikolas 1.1 ((PamVMCDigitizer *)fdigmap.GetValue(o))->LoadCalib();
62 pam-rm2 1.5 ((PamVMCDigitizer *)fdigmap.GetValue(o))->SetRandom(random);
63 nikolas 1.1 }
64     }
65    
66     /* This calls digitization for all detector */
67     void Digitize(Int_t EventNo, Int_t PrimaryPDG){
68     TMapIter *n= (TMapIter *)fdigmap.MakeIterator();
69 pam-rm2 1.5 TObject *o; while( (o=(TObject *) n->Next())) {
70 nikolas 1.1 ((PamVMCDigitizer *)fdigmap.GetValue(o))->Digitize();
71     }
72    
73     TObject* ob1 = fdigmap.FindObject("Tof");
74     if(ob1) ((PamVMCTofDig*)((TPair*)ob1)->Value())->DigitizeTOF(EventNo, PrimaryPDG);
75    
76     TObject* ob2 = fdigmap.FindObject("AC");
77     if(ob2) ((PamVMCAcDig*)((TPair*)ob2)->Value())->DigitizeAC(EventNo);
78    
79     /* +++From this moment all detctors a filled their buffers an we will form packet+++ */
80    
81     TObject* b1 = fdigmap.FindObject("Tof");
82     if(b1) ((PamVMCTofDig*)((TPair*)b1)->Value())->WriteToBuff();
83    
84     cout<<"TOF Written.."<<endl;
85    
86     TObject* b2 = fdigmap.FindObject("AC");
87     if(b2) ((PamVMCAcDig*)((TPair*)b2)->Value())->WriteToBuff();
88    
89     cout<<"AC Written.."<<endl;
90    
91     TObject* b3 = fdigmap.FindObject("CAST");
92     if(b3) ((PamVMCCaloDig*)((TPair*)b3)->Value())->WriteToBuff();
93    
94     cout<<"CALO Written.."<<endl;
95    
96     TObject* b4 = fdigmap.FindObject("TSPA");
97     if(b4) ((PamVMCTrkDig*)((TPair*)b4)->Value())->WriteToBuff();
98    
99     cout<<"TRK Written.."<<endl;
100    
101     TObject* b5 = fdigmap.FindObject("S4");
102     if(b5) ((PamVMCS4Dig*)((TPair*)b5)->Value())->WriteToBuff();
103    
104     cout<<"S4 Written.."<<endl;
105    
106     TObject* b6 = fdigmap.FindObject("NDTI");
107     if(b6) ((PamVMCNDDig*)((TPair*)b6)->Value())->WriteToBuff();
108    
109     cout<<"ND Written.."<<endl;
110    
111     }
112    
113     /* This written for RunTrailer. It should put his data
114     to raw-file only once, when run is over */
115     void FinishRun(){
116     TMapIter *n= (TMapIter *)fdigmap.MakeIterator();
117 pam-rm2 1.5 TObject *o; while( (o=(TObject *) n->Next())) {
118 nikolas 1.1 ((PamVMCDigitizer *)fdigmap.GetValue(o))->FinishRun();
119     }
120     }
121    
122     virtual void Print(const Option_t* = "") const { fdigmap.Print(); }
123    
124     void PrintCollections(){
125     TMapIter *n= (TMapIter *)fdigmap.MakeIterator();
126 pam-rm2 1.5 TObject *o; while( (o=(TObject *) n->Next())) {
127 nikolas 1.1 ((PamVMCDigitizer *)fdigmap.GetValue(o))->PrintCollections();
128     }
129     }
130    
131     };
132    
133     #endif

  ViewVC Help
Powered by ViewVC 1.1.23