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

Annotation of /PamVMC/include/PamVMCDigitizer.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (hide annotations) (download)
Fri Jun 12 18:39:18 2009 UTC (15 years, 6 months ago) by pam-rm2
Branch: MAIN
CVS Tags: v1r0, HEAD
Changes since 1.1: +9 -1 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 PAMVMC_DIGITIZER_H
2     #define PAMVMC_DIGITIZER_H
3     #include <iostream>
4     #include <fstream>
5     #include <TObject.h>
6     #include <TString.h>
7     #include <TFile.h>
8     #include <TTree.h>
9     #include <TMap.h>
10     #include <TObjString.h>
11     #include <TClonesArray.h>
12     #include <TDatabasePDG.h>
13     #include <TParticlePDG.h>
14 pam-rm2 1.5 #include <TRandom3.h>
15 nikolas 1.1 #include "PamVMCSQLMgr.h"
16     #include "PamVMCRawMgr.h"
17     #include "PamVMCDetectorHit.h"
18    
19    
20     using namespace std;
21    
22     class PamVMCDigitizer : public TObject {
23    
24     TString fdname;
25    
26     protected:
27    
28     PamVMCSQLMgr * fsql; //pointer to SQL Mgr
29     PamVMCRawMgr * fraw; //pointer to RAW Mgr
30    
31     ifstream fcfile; //binary file with calib data if any
32     stringstream fquery; //query ty mysql
33     Int_t fdberr; //error index (check db)
34     TString fpath; //path to default calibration datafiles;
35     TFile * fcrfile; //pointer to file with calibration
36    
37     TMap fhitscolmap; //vector of hit collections (TClonesArray), given by SD to digitize
38    
39    
40     USBuffer fData; //detector's data vector
41     UCBuffer fDataPSCU; //detector's PSCU data
42    
43     UInt_t fPadding; //data padding
44     UCBuffer fDataPadding; //detector's Padding data
45    
46 pam-rm2 1.5 TRandom * frandom; //pointer to random object. Warning, Class is not owner of this object
47    
48 nikolas 1.1 public:
49    
50    
51 pam-rm2 1.5 PamVMCDigitizer(const char *dname="dummy"): fdname(dname)
52 nikolas 1.1 {
53     fsql = PamVMCSQLMgr::Instance();
54     fraw = PamVMCRawMgr::Instance();
55     fdberr = fPadding = 0;
56     fpath = fsql->GetDataPath();
57     fquery.str("");
58     }
59    
60    
61     virtual ~PamVMCDigitizer() {
62     delete fcrfile;
63     delete fraw;
64     delete fsql;
65     fhitscolmap.Clear("C");
66     }
67    
68     /*This method calls from SD to pass pointers to it's collection(s)*/
69     void RegisterCollections(const char* name, TClonesArray * hitcoll){
70     fhitscolmap.Add(new TObjString(name), hitcoll);
71     }
72    
73     virtual void PrintCollections(){
74     cout<<"HitCollections Map for: "<<fdname<<endl;
75     fhitscolmap.Print();
76     }
77    
78 pam-rm2 1.5 /*Setting a pointer to random number if needed */
79     virtual void SetRandom(TRandom* random){
80     frandom = random;
81     }
82    
83 nikolas 1.1 /*This method calls from application*/
84     virtual void LoadCalib(){; };
85    
86     /*This method looks into SD map and take the pointer to
87     hit collection of specific detector... For TOF it overriden
88     (we have here 6 hits collections */
89     virtual void Digitize()=0;
90    
91     /*This method calls by DigManager from it's digitize procedure.
92     Method was created to force detectors push their data to main buffer
93     according sequense of packet 0x10 organization*/
94     virtual void WriteToBuff() { fraw->CopyUShortToBuff(&fData); }
95    
96     /*This method calls from application after all evens. Designed for RunTrailer*/
97     virtual void FinishRun(){; };
98    
99     void DigitizePSCU(UInt_t len, UChar_t type)
100     { fraw->DigitizePSCU(len, type, &fDataPSCU); }
101    
102     void AddPadding(){ fraw->AddPadding(fPadding,&fDataPadding); }
103    
104     void SetPadding(UInt_t pad){ fPadding = pad; }
105    
106    
107     void ThrowCalFileUsage(const char* detname, const char* filename){
108     cout<<"Use calibrations for "<<detname<<" from file: "<<filename<<endl;
109     }
110    
111     void ThrowCalFileWarning(const char* detname){
112     cout<<"!!!WARNING: No calibration for "<<detname<<" found... "
113     <<" Calibration IMPOSSIBLE!!!"<<endl;
114     }
115    
116     ClassDef(PamVMCDigitizer,1)
117     };
118    
119    
120     #endif //PAMVMC_DIGITIZER_H

  ViewVC Help
Powered by ViewVC 1.1.23