66 |
//which should present in the same directory then application library |
//which should present in the same directory then application library |
67 |
|
|
68 |
void Init(){ |
void Init(){ |
69 |
TString G4WORKDIR=gSystem->Getenv("G4WORKDIR"); |
TString PAM_VMC=gSystem->Getenv("PAM_VMC"); |
70 |
TString PLATFORM=gSystem->Getenv("PLATFORM"); |
TString PLATFORM=gSystem->Getenv("PLATFORM"); |
71 |
TFile * resspe = |
TFile * resspe = |
72 |
new TFile(G4WORKDIR+"/lib/tgt_"+PLATFORM+"/resxy_new.root"); |
new TFile(PAM_VMC+"/lib/tgt_"+PLATFORM+"/resxy_new.root"); |
73 |
if(resspe->IsOpen()){ |
if(resspe->IsOpen()){ |
74 |
TH1F * hsx; |
TH1F * hsx; |
75 |
TH1F * hsy; |
TH1F * hsy; |
98 |
delete hsx; |
delete hsx; |
99 |
delete hsy; |
delete hsy; |
100 |
} else cout<<"!!!WARNING: SPE hit resolution data file resxy_new.root" |
} else cout<<"!!!WARNING: SPE hit resolution data file resxy_new.root" |
101 |
<<" is not present in: " <<G4WORKDIR+"/lib/tgt_"+PLATFORM |
<<" is not present in: " <<PAM_VMC+"/lib/tgt_"+PLATFORM |
102 |
<<" or corrupted!!!"<<endl; |
<<" or corrupted!!!"<<endl; |
103 |
|
|
104 |
delete resspe; |
delete resspe; |
148 |
return hit; |
return hit; |
149 |
} |
} |
150 |
|
|
151 |
void FillHit(fin f,TVirtualMC *g){ |
void FillHit(fin f,TVirtualMC *g, Bool_t is_prim){ |
152 |
ffi=f; |
ffi=f; |
153 |
//g->SetMaxStep(0.001); // 10 um |
//g->SetMaxStep(0.001); // 10 um |
154 |
switch(f) { |
switch(f) { |
158 |
InitHit(); |
InitHit(); |
159 |
//cout<<">>>ENTERING in PLANE: "<<GetPlaneID()<<endl; |
//cout<<">>>ENTERING in PLANE: "<<GetPlaneID()<<endl; |
160 |
default: |
default: |
161 |
UpdateHit(g); |
UpdateHit(g, is_prim); |
162 |
//TParticlePDG* particlePDG = TDatabasePDG::Instance()->GetParticle(gMC->TrackPid()); |
//TParticlePDG* particlePDG = TDatabasePDG::Instance()->GetParticle(gMC->TrackPid()); |
163 |
//Double_t mass = particlePDG->Mass(); |
//Double_t mass = particlePDG->Mass(); |
164 |
//Double_t x,y,z,e; |
//Double_t x[3]; |
165 |
|
//Double_t B[3]; |
166 |
|
//Double_t * xp = &x[0]; |
167 |
|
//Double_t *Bp = &B[0]; |
168 |
|
//g->TrackPosition(x[0],x[1],x[2]); |
169 |
//g->TrackMomentum(x,y,z,e); |
//g->TrackMomentum(x,y,z,e); |
170 |
//Double_t P0 = TMath::Sqrt(x*x+y*y+z*z); |
//Double_t P0 = TMath::Sqrt(x*x+y*y+z*z); |
171 |
//Double_t energy = TMath::Sqrt(P0*P0+mass*mass)-mass; |
//Double_t energy = TMath::Sqrt(P0*P0+mass*mass)-mass; |
172 |
//cout<<"stepping... Stepsize"<<gMC->TrackStep()*10000<<"um "<<" particle PDG is:"<<gMC->TrackPid()<<" Kin.energy:"<<energy*1000000<<" keV"<<endl; |
//cout<<"stepping... Stepsize"<<gMC->TrackStep()*10000<<"um "<<" particle PDG is:"<<gMC->TrackPid()<<" Kin.energy:"<<energy*1000000<<" keV"<<endl; |
173 |
|
//PamVMCFieldMgr::Instance()->Field(xp,Bp); |
174 |
|
//cout<<"X,Y,Z: "<<x[0]<<" "<<x[1]<<" "<<x[2]<<" "<<"Bx, By, Bz: "<<B[0]<<" "<<B[1]<<" "<<B[2]<<endl; |
175 |
|
//fhit->Print(); |
176 |
|
//cout<<"Edep"<<g->Edep()*1e6<<" kev"<<endl; |
177 |
if (g->Edep()) PreDigit(); |
if (g->Edep()) PreDigit(); |
178 |
|
|
179 |
break; |
break; |
183 |
case EXITING: |
case EXITING: |
184 |
//cout<<"<<<EXITING out"<<gMC->TrackPid()<<endl; |
//cout<<"<<<EXITING out"<<gMC->TrackPid()<<endl; |
185 |
// Save hit if energy release is greater than zero |
// Save hit if energy release is greater than zero |
186 |
if(fhit->GetEREL()){ |
//cout<<"PDG:"<<fhit->GetPDG()<<"TOF="<<fhit->GetTOF()<<endl; |
187 |
|
|
188 |
|
if(fhit->GetEREL() ){ |
189 |
|
//cout<<"Saving.."<<endl; |
190 |
SaveTrkHit(fdname.Data()); |
SaveTrkHit(fdname.Data()); |
191 |
} |
} |
192 |
break; |
break; |
296 |
|
|
297 |
}; |
}; |
298 |
|
|
299 |
|
#endif // PAMVMCTRKSD_H |
300 |
|
|
301 |
|
|
302 |
#endif // PAMVMCTRKSD_H |
|
303 |
|
#ifndef PAMVMCTPANSD_H |
304 |
|
#define PAMVMCTPANSD_H |
305 |
|
|
306 |
|
class PamVMCTPANSD: public PamVMCDetectorSD{ |
307 |
|
|
308 |
|
public: |
309 |
|
PamVMCTPANSD():PamVMCDetectorSD("PamVMCDetectorHit","TPAN",1000) |
310 |
|
{ |
311 |
|
}; |
312 |
|
virtual void FillHit(fin f,TVirtualMC *g, Bool_t is_prim){ |
313 |
|
ffi=f; |
314 |
|
switch(f) { |
315 |
|
case ENTERING: |
316 |
|
CleanHit(); |
317 |
|
FillVolID(); |
318 |
|
InitHit(); |
319 |
|
default: |
320 |
|
UpdateHit(g, is_prim); |
321 |
|
break; |
322 |
|
} |
323 |
|
|
324 |
|
switch(f){ |
325 |
|
case EXITING: |
326 |
|
// Save hit if PATH, not energy release is greater than zero |
327 |
|
if(fhit->GetPATH()){ |
328 |
|
SaveHit(fdname.Data()); |
329 |
|
} |
330 |
|
break; |
331 |
|
default: |
332 |
|
break; |
333 |
|
} |
334 |
|
} |
335 |
|
ClassDef(PamVMCTPANSD,1) |
336 |
|
|
337 |
|
}; |
338 |
|
|
339 |
|
#endif // PAMVMCTPAN_H |
340 |
|
|
341 |
|
|
342 |
|
#ifndef PAMVMCTRCNSD_H |
343 |
|
#define PAMVMCTRCNSD_H |
344 |
|
|
345 |
|
class PamVMCTRCNSD: public PamVMCDetectorSD{ |
346 |
|
|
347 |
|
public: |
348 |
|
PamVMCTRCNSD():PamVMCDetectorSD("PamVMCDetectorHit","TRCN",1000) |
349 |
|
{ |
350 |
|
|
351 |
|
}; |
352 |
|
ClassDef(PamVMCTRCNSD,1) |
353 |
|
|
354 |
|
}; |
355 |
|
|
356 |
|
#endif // PAMVMCTRCN_H |
357 |
|
|
358 |
|
|
359 |
|
#ifndef PAMVMCTRSLSD_H |
360 |
|
#define PAMVMCTRSLSD_H |
361 |
|
|
362 |
|
class PamVMCTRSLSD: public PamVMCDetectorSD{ |
363 |
|
|
364 |
|
public: |
365 |
|
PamVMCTRSLSD():PamVMCDetectorSD("PamVMCDetectorHit","TRSL",1000) |
366 |
|
{ |
367 |
|
|
368 |
|
}; |
369 |
|
ClassDef(PamVMCTRSLSD,1) |
370 |
|
|
371 |
|
}; |
372 |
|
|
373 |
|
#endif // PAMVMCTRSL_H |