29.3.2011 Kamil Sedlak
1) Small change in optical photon simulation 2) Some other small changes, probably not very important
This commit is contained in:
@ -736,6 +736,22 @@ G4VPhysicalVolume* musrDetectorConstruction::Construct() {
|
||||
sscanf(&line[0],"%*s %*s %*s %lf %lf %lf",&a1,&delay,&timeShiftOffset);
|
||||
myMusrScintSD -> Set_OPSA_CFD(a1,delay,timeShiftOffset);
|
||||
}
|
||||
else if (strcmp(varName,"APDcells")==0) {
|
||||
int nx, ny, nz;
|
||||
double halfLenght_x, halfLenght_y, halfLenght_z;
|
||||
sscanf(&line[0],"%*s %*s %*s %d %d %d %lf %lf %lf",&nx,&ny,&nz,&halfLenght_x,&halfLenght_y,&halfLenght_z);
|
||||
myMusrScintSD -> SetAPDcellSizes(nx, ny, nz, halfLenght_x, halfLenght_y, halfLenght_z);
|
||||
}
|
||||
else if (strcmp(varName,"SetAPDcellsTimeVariationSigma")==0) {
|
||||
double sigma;
|
||||
sscanf(&line[0],"%*s %*s %*s %lf",&sigma);
|
||||
myMusrScintSD ->SetAPDcellsTimeVariationSigma(sigma*nanosecond);
|
||||
}
|
||||
else {
|
||||
G4cout<<"musrDetectorConstruction.cc: ERROR: Unknown parameterName \""
|
||||
<<varName<<"\" ."<<G4endl;
|
||||
ReportGeometryProblem(line);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -84,6 +84,10 @@ musrScintSD::musrScintSD(G4String name)
|
||||
OPSA_CFD_a1 = -0.2;
|
||||
OPSA_CFD_delay = 2.;
|
||||
OPSA_CFD_timeShiftOffset = 0.;
|
||||
APDcell_nx =1; APDcell_ny=10; APDcell_nz=10;
|
||||
APDcell_ax =0.3; APDcell_ay=0.3; APDcell_az=0.3;
|
||||
APDcellsEffectRequested=false;
|
||||
APDcellsTimeVariationRequested=false;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@ -259,7 +263,25 @@ void musrScintSD::ProcessOpticalPhoton(G4Step* aStep) {
|
||||
// case Detection: //Note, this assumes that the volume causing detection
|
||||
//is the photocathode because it is the only one with
|
||||
//non-zero efficiency
|
||||
optHitDetectorMap->insert(std::pair<G4double,G4int>(tmpTime,boundaryStatus));
|
||||
|
||||
|
||||
// If the simulation of the effect of the finite number of cells in APD is requested, find out
|
||||
// whether a given cell already fired - if so, do not store the photon.
|
||||
G4bool APDcellAlreadyFired = false;
|
||||
G4int APDcellID = 0;
|
||||
if (APDcellsEffectRequested) {
|
||||
APDcellID = FindAPDcellID(aStep);
|
||||
// G4cout<<"Cell ID="<<APDcellID<<G4endl;
|
||||
for (optHitDetectorMapType::const_iterator it2 = optHitDetectorMap->begin(); it2 != optHitDetectorMap->end(); it2++ ) {
|
||||
if ((it2->second)==APDcellID) {
|
||||
APDcellAlreadyFired = true;
|
||||
// G4cout<<"HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH already fired cell ="<<APDcellID<<G4endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (APDcellsTimeVariationRequested) tmpTime += G4RandGauss::shoot(0,APDcellsTimeVariationSigma);
|
||||
if (!APDcellAlreadyFired) optHitDetectorMap->insert(std::pair<G4double,G4int>(tmpTime,APDcellID));
|
||||
// G4cout<<" tmpTime="<<tmpTime<<G4endl;
|
||||
// G4cout<<" Detection"<<G4endl;
|
||||
// break;
|
||||
@ -636,6 +658,7 @@ void musrScintSD::EndOfEvent_OptiacalPhotons() {
|
||||
for (optHitDetectorMapType::const_iterator it3 = optHitDetectorSUBmap.begin(); it3 != optHitDetectorSUBmap.end(); it3++) {
|
||||
nP++;
|
||||
G4double timePhot = it3->first;
|
||||
// if (APDcellsTimeVariationRequested) timePhot += G4RandGauss::shoot(0,APDcellsTimeVariationSigma); // Shifted above
|
||||
if (nP==1) OPSA_timeFirst = timePhot;
|
||||
if (nP==NA) OPSA_timeA = timePhot;
|
||||
if (nP==NB) OPSA_timeB = timePhot;
|
||||
@ -694,17 +717,24 @@ void musrScintSD::EndOfEvent_OptiacalPhotons() {
|
||||
// Find the timeCFD from CFD signal
|
||||
Double_t oldYvalue;
|
||||
Double_t yValue=-1000;
|
||||
G4bool OPSA_CFD_time_found = false;
|
||||
for (Int_t iBin=1; iBin<=OPSAhistoNbin; iBin++) { // loop over all bins of CFD histogram
|
||||
Double_t xValue = (iBin-0.5)*OPSAhistoBinWidth;
|
||||
// G4bool OPSA_CFD_time_found = false;
|
||||
OPSA_CFD_ampl = OPSA_CFD->GetMaximum();
|
||||
int binmax = OPSA_CFD->GetMaximumBin();
|
||||
int binmim = OPSA_CFD->GetMinimumBin();
|
||||
for (Int_t iBin=binmim; iBin<=binmax; iBin++) { // loop over bins between min and max of CFD histogram
|
||||
// Double_t xValue = (iBin-0.5)*OPSAhistoBinWidth;
|
||||
Double_t xValue = OPSA_CFD->GetXaxis()->GetBinCenter(iBin);
|
||||
oldYvalue = yValue;
|
||||
yValue = OPSA_CFD->GetBinContent(iBin);
|
||||
if (yValue>OPSA_CFD_ampl) OPSA_CFD_ampl=yValue; // find the CFD signal amplitude;
|
||||
if (xValue < 0.6*OPSA_CFD_delay) continue; // it is believed the CFD signal can not cross y=0 much before the delay time
|
||||
if ((yValue >= 0)&&(!OPSA_CFD_time_found)) { // signal just crossed the y=0 axis for the first time ==> record CFD time
|
||||
OPSA_CFD_time_found = true;
|
||||
// if (yValue>OPSA_CFD_ampl) OPSA_CFD_ampl=yValue; // find the CFD signal amplitude;
|
||||
// if (xValue < 0.6*OPSA_CFD_delay) continue; // it is believed the CFD signal can not cross y=0 much before the delay time
|
||||
// if ((yValue >= 0)&&(!OPSA_CFD_time_found)) { // signal just crossed the y=0 axis for the first time ==> record CFD time
|
||||
if (yValue >= 0) { // signal just crossed the y=0 axis
|
||||
// OPSA_CFD_time_found = true;
|
||||
OPSA_CFD_time = xValue - yValue/(yValue-oldYvalue)*OPSAhistoBinWidth; //linear interpolation
|
||||
OPSA_CFD_time += OPSA_timeFirst - OPSA_CFD_delay + OPSA_CFD_timeShiftOffset; // correct for
|
||||
// G4cout<<"OPSA_CFD_time = "<<OPSA_CFD_time<<G4endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -839,3 +869,25 @@ void musrScintSD::ReadInPulseShapeArray(const char* filename) {
|
||||
// G4cout<<G4endl;
|
||||
}
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4int musrScintSD::FindAPDcellID(G4Step* aStep) {
|
||||
// TEST:
|
||||
G4StepPoint* postPoint = aStep->GetPostStepPoint();
|
||||
G4ThreeVector postStepPoint = postPoint->GetPosition();
|
||||
const G4AffineTransform* trans = postPoint->GetTouchable()->GetHistory()->GetPtrTopTransform();
|
||||
G4ThreeVector postStepPointLocal = trans->TransformPoint(postStepPoint);
|
||||
// G4cout<<"musrScintSD::FindAPDcellID: postStepPointLocal="<<postStepPointLocal<<G4endl;
|
||||
G4int ix = (APDcell_nx>1) ? int ((postStepPointLocal.x() / APDcell_ax + APDcell_nx/2.)) : 0;
|
||||
G4int iy = (APDcell_ny>1) ? int ((postStepPointLocal.y() / APDcell_ay + APDcell_ny/2.)) : 0;
|
||||
G4int iz = (APDcell_nz>1) ? int ((postStepPointLocal.z() / APDcell_az + APDcell_nz/2.)) : 0;
|
||||
G4int in = ix * APDcell_ny * APDcell_nz + iy * APDcell_nz + iz;
|
||||
// G4cout<<"musrScintSD::FindAPDcellID: in = "<<in<<", ix = "<<ix<<", iy = "<<iy<<", iz = "<<iz<<G4endl;
|
||||
if ((ix<0)||(ix>APDcell_nx)) musrErrorMessage::GetInstance()->musrError(FATAL,
|
||||
"musrScintSD::FindAPDcellID: APD cell out of range (ix). Wrong dimensions of APD in \"/musr/command OPSA APDcells\" command?",false);
|
||||
if ((iy<0)||(iy>APDcell_ny)) musrErrorMessage::GetInstance()->musrError(FATAL,
|
||||
"musrScintSD::FindAPDcellID: APD cell out of range (iy). Wrong dimensions of APD in \"/musr/command OPSA APDcells\" command?",false);
|
||||
if ((iz<0)||(iz>APDcell_nz)) musrErrorMessage::GetInstance()->musrError(FATAL,
|
||||
"musrScintSD::FindAPDcellID: APD cell out of range (iz). Wrong dimensions of APD in \"/musr/command OPSA APDcells\" command?",false);
|
||||
return in;
|
||||
}
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
@ -50,6 +50,9 @@ musrStackingAction::~musrStackingAction()
|
||||
G4ClassificationOfNewTrack musrStackingAction::ClassifyNewTrack(const G4Track * aTrack) {
|
||||
if (aTrack->GetDefinition() == G4OpticalPhoton::OpticalPhotonDefinition()) {
|
||||
opticalPhotonCounter++;
|
||||
return fWaiting; // Optical photons will be treated after all other particles in order
|
||||
// to have the reproducibility of the other particle tracks if a parameter
|
||||
// for the optical photons is changed in the next run.
|
||||
}
|
||||
return fUrgent;
|
||||
}
|
||||
|
Reference in New Issue
Block a user