Kamil Sedlak 7.2.2013
Implemented changes of James Lord. Compiling was possible, but no testing was done so far.
This commit is contained in:
20
src/meyer.cc
20
src/meyer.cc
@ -60,6 +60,10 @@
|
||||
#include <iostream>
|
||||
#include <stdlib.h>
|
||||
#include <ios>
|
||||
// James Lord:
|
||||
// already defines its own constant Pi so no need to look for M_PI anywhere
|
||||
// #define _USE_MATH_DEFINES 1
|
||||
// #include <math.h>
|
||||
using namespace std;
|
||||
|
||||
meyer::meyer()
|
||||
@ -258,7 +262,7 @@ void meyer::Get_F_Function_Meyer(double tau, double Ekin, double Z1, double Z2,
|
||||
}
|
||||
// std::cout<< "M4: "<<Meyer_faktor4<<std::endl;
|
||||
// std::cout<< "Ekin: "<<Ekin <<std::endl;
|
||||
thetaMax = thetaSchlangeMax / Meyer_faktor4 / Ekin/M_PI*180;
|
||||
thetaMax = thetaSchlangeMax / Meyer_faktor4 / Ekin/Pi*180;
|
||||
if (thetaMax>50.)
|
||||
{
|
||||
thetaStep = .5;
|
||||
@ -292,7 +296,7 @@ void meyer::Get_F_Function_Meyer(double tau, double Ekin, double Z1, double Z2,
|
||||
// ! Berechne aus theta das 'reduzierte' thetaSchlange (dabei gleich
|
||||
// ! noch von degree bei theta in Radiant bei thetaSchlange umrechnen):
|
||||
//
|
||||
thetaSchlange = Meyer_faktor4 * Ekin * theta *M_PI/180;
|
||||
thetaSchlange = Meyer_faktor4 * Ekin * theta *Pi/180;
|
||||
|
||||
// ! Auslesen der Tabellenwerte fuer die f-Funktionen:
|
||||
|
||||
@ -305,7 +309,7 @@ void meyer::Get_F_Function_Meyer(double tau, double Ekin, double Z1, double Z2,
|
||||
}
|
||||
|
||||
// ! Berechnen der Streuintensitaet:
|
||||
F = Meyer_faktor4*Meyer_faktor4 * Ekin*Ekin /2 /M_PI * (f1 - Meyer_faktor3*f2);// TAO, Anselm was: Meyer_faktor5 * Ekin*Ekin * (f1 - Meyer_faktor3*f2);
|
||||
F = Meyer_faktor4*Meyer_faktor4 * Ekin*Ekin /2 /Pi * (f1 - Meyer_faktor3*f2);// TAO, Anselm was: Meyer_faktor5 * Ekin*Ekin * (f1 - Meyer_faktor3*f2);
|
||||
|
||||
nBin = nBin + 1;
|
||||
if (nBin>nBinMax)
|
||||
@ -317,7 +321,7 @@ void meyer::Get_F_Function_Meyer(double tau, double Ekin, double Z1, double Z2,
|
||||
value[nBin] = sin(theta)*F;
|
||||
|
||||
fValues[nBin+1] = F; // ! fuer Testzwecke
|
||||
fValuesFolded[nBin+1] = sin(theta/180*M_PI)*F;// ! fuer Testzwecke
|
||||
fValuesFolded[nBin+1] = sin(theta/180*Pi)*F;// ! fuer Testzwecke
|
||||
|
||||
|
||||
}// end of do loop
|
||||
@ -348,7 +352,7 @@ void meyer::Get_F_Function_Meyer(double tau, double Ekin, double Z1, double Z2,
|
||||
//! Berechne die Werte fuer theta=0:
|
||||
|
||||
F_Functions_Meyer(tau,0.,&f1,&f2);
|
||||
F = Meyer_faktor4*Meyer_faktor4 * Ekin*Ekin /2 /M_PI * (f1 - Meyer_faktor3*f2);// TAO, Anselm was: Meyer_faktor5 * Ekin*Ekin * (f1 - Meyer_faktor3*f2);
|
||||
F = Meyer_faktor4*Meyer_faktor4 * Ekin*Ekin /2 /Pi * (f1 - Meyer_faktor3*f2);// TAO, Anselm was: Meyer_faktor5 * Ekin*Ekin * (f1 - Meyer_faktor3*f2);
|
||||
fValues[1] = F;
|
||||
fValuesFolded[1] = 0.;
|
||||
|
||||
@ -463,7 +467,7 @@ void meyer:: Get_F_Function(double tau,double theta, double Ekin, double Z1, dou
|
||||
|
||||
nBin = 0;
|
||||
|
||||
thetaSchlange = Meyer_faktor4 * Ekin * theta *M_PI/180;
|
||||
thetaSchlange = Meyer_faktor4 * Ekin * theta *Pi/180;
|
||||
|
||||
|
||||
F_Functions_Meyer(tau,thetaSchlange,&f1,&f2);
|
||||
@ -472,7 +476,7 @@ void meyer:: Get_F_Function(double tau,double theta, double Ekin, double Z1, dou
|
||||
goto bigtheta;
|
||||
}
|
||||
|
||||
*F = Meyer_faktor4*Meyer_faktor4 * Ekin*Ekin /2 /M_PI * (f1 - Meyer_faktor3*f2);
|
||||
*F = Meyer_faktor4*Meyer_faktor4 * Ekin*Ekin /2 /Pi * (f1 - Meyer_faktor3*f2);
|
||||
|
||||
bigtheta:for( i = 1;i<= nBin; i++)
|
||||
{
|
||||
@ -486,7 +490,7 @@ void meyer:: Get_F_Function(double tau,double theta, double Ekin, double Z1, dou
|
||||
//! Berechne die Werte fuer theta=0:
|
||||
double norm;
|
||||
F_Functions_Meyer(tau,0.,&f1,&f2);
|
||||
norm = Meyer_faktor4*Meyer_faktor4 * Ekin*Ekin /2 /M_PI * (f1 - Meyer_faktor3*f2);
|
||||
norm = Meyer_faktor4*Meyer_faktor4 * Ekin*Ekin /2 /Pi * (f1 - Meyer_faktor3*f2);
|
||||
*F=*F/norm;
|
||||
|
||||
}
|
||||
|
@ -44,6 +44,7 @@
|
||||
#include "G4Box.hh"
|
||||
#include "G4Cons.hh"
|
||||
#include "G4Polycone.hh"
|
||||
#include "G4Torus.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4PVPlacement.hh"
|
||||
#include "G4Tubs.hh"
|
||||
@ -329,6 +330,13 @@ G4VPhysicalVolume* musrDetectorConstruction::Construct() {
|
||||
solidName+=name;
|
||||
solid = new G4Para(solidName,x1*mm,x2*mm,x3*mm,x4*deg,x5*deg,x6*deg);
|
||||
}
|
||||
else if (strcmp(tmpString2,"torus")==0){ // added JSL. Torus piece, Rmin (bore), Rmax (outer), Rtorus (swept), pSPhi (start angle), pDPhi (swept angle)
|
||||
sscanf(&line[0],"%*s %*s %*s %s %lf %lf %lf %lf %lf %s %lf %lf %lf %s %s",
|
||||
name,&x1,&x2,&x3,&x4,&x5,material,&posx,&posy,&posz,mothersName,rotMatrix);
|
||||
sscanf(&line[0],"%*s %*s %*s %*s %*g %*g %*g %*g %*g %*s %*g %*g %*g %*s %*s %s %d %s",sensitiveDet,&volumeID,actualFieldName);
|
||||
solidName+=name;
|
||||
solid = new G4Torus(solidName,x1*mm,x2*mm,x3*mm,x4*deg,x5*deg);
|
||||
}
|
||||
else if (strcmp(tmpString2,"cylpart")==0){ // Volume introduced by Pavel Bakule on 12 May 2009
|
||||
sscanf(&line[0],"%*s %*s %*s %s %lf %lf %lf %lf %s %lf %lf %lf %s %s",
|
||||
name,&x1,&x2,&x3,&x4,material,&posx,&posy,&posz,mothersName,rotMatrix);
|
||||
@ -665,7 +673,7 @@ G4VPhysicalVolume* musrDetectorConstruction::Construct() {
|
||||
sscanf(&line[0],"%*s %*s %*s %*s %*g %*g %*g %*s %*g %*g %*g %*s %*s %s %d",sensitiveDet,&volumeID);
|
||||
solidName+=name;
|
||||
G4Box* solidGPDcutOut = new G4Box ("solidGPDcutOut",x1*mm,x1*mm,(x3+0.01)*mm);
|
||||
G4Box* solidGPDmHolder = new G4Box ("solidGPDmHolder",sqrt(2)*x1*mm,x2*mm,x3*mm);
|
||||
G4Box* solidGPDmHolder = new G4Box ("solidGPDmHolder",sqrt((double)2)*x1*mm,x2*mm,x3*mm);
|
||||
// G4RotationMatrix* rot = new G4RotationMatrix(45*deg,0,0);
|
||||
G4RotationMatrix* rot = new G4RotationMatrix(G4ThreeVector(0,0,1),45*deg);
|
||||
// G4RotationMatrix* rot = new G4RotationMatrix();
|
||||
@ -673,6 +681,28 @@ G4VPhysicalVolume* musrDetectorConstruction::Construct() {
|
||||
solid = new G4SubtractionSolid(solidName,solidGPDmHolder,solidGPDcutOut,rot,trans);
|
||||
// solid = new G4SubtractionSolid(solidName,solidGPDcutOut,solidGPDmHolder,rot,trans);
|
||||
}
|
||||
else if (strcmp(tmpString2,"cruciform")==0){
|
||||
// JSL: Create a solid cruciform (union of 3 mutually perpendicular cylinders). Top port can be different to bottom.
|
||||
// x1=radius of main (+-z) x2=radius of +-x and -y, x3=radius of +y x4=z extent x5=x,y extent
|
||||
// could enclose another of these inside, filled with vacuum
|
||||
sscanf(&line[0],"%*s %*s %*s %s %lf %lf %lf %lf %lf %s %lf %lf %lf %s %s",
|
||||
name,&x1,&x2,&x3,&x4,&x5,material,&posx,&posy,&posz,mothersName,rotMatrix);
|
||||
sscanf(&line[0],"%*s %*s %*s %*s %*g %*g %*g %*g %*g %*s %*g %*g %*g %*s %*s %s %d %s",sensitiveDet,&volumeID,actualFieldName);
|
||||
solidName+=name;
|
||||
//G4double roundingErr=0.01*mm; // to avoid some displaying problems of the subtracted volumes
|
||||
G4Tubs* solidMainBore = new G4Tubs("solidMainBore" ,0.*mm,x1*mm,x4*mm,0*deg,360*deg);
|
||||
G4Tubs* solidHorizCrossBore = new G4Tubs("solidHorizCrossBore",0.*mm,x2*mm,x5*mm,0*deg,360*deg);
|
||||
G4Tubs* solidBottomBore = new G4Tubs("solidBottomBore" ,0.*mm,x2*mm,x5/2*mm,0*deg,360*deg);
|
||||
G4Tubs* solidTopBore = new G4Tubs("solidTopBore" ,0.*mm,x3*mm,x5/2*mm,0*deg,360*deg);
|
||||
G4RotationMatrix* rotx = new G4RotationMatrix(G4ThreeVector(0.,1.,0.),90.*deg);
|
||||
G4RotationMatrix* roty = new G4RotationMatrix(G4ThreeVector(1.,0.,0.),90.*deg);
|
||||
G4ThreeVector nowhere( 0,0,0);
|
||||
G4ThreeVector UpOffset( 0., x5/2.*mm, 0.);
|
||||
G4ThreeVector DownOffset( 0., -x5/2.*mm, 0.);
|
||||
G4UnionSolid* partXZonly = new G4UnionSolid("partXZonly", solidMainBore, solidHorizCrossBore, rotx, nowhere);
|
||||
G4UnionSolid* partXZBonly = new G4UnionSolid("partXZBonly", partXZonly, solidBottomBore, roty, DownOffset);
|
||||
solid = new G4UnionSolid(solidName, partXZBonly, solidTopBore, roty, UpOffset);
|
||||
}
|
||||
else ReportGeometryProblem(line);
|
||||
|
||||
G4ThreeVector position = G4ThreeVector (posx*mm,posy*mm,posz*mm);
|
||||
@ -1631,6 +1661,41 @@ void musrDetectorConstruction::DefineMaterials()
|
||||
Air->AddElement(N, fractionmass=0.7);
|
||||
Air->AddElement(O, fractionmass=0.3);
|
||||
|
||||
G4Material* Air1mbar =
|
||||
new G4Material("Air1mbar" , density= 1.290e-3*mg/cm3, ncomponents=2);
|
||||
Air1mbar->AddElement(N, fractionmass=0.7);
|
||||
Air1mbar->AddElement(O, fractionmass=0.3);
|
||||
|
||||
G4Material* AirE1mbar =
|
||||
new G4Material("AirE1mbar" , density= 1.290e-4*mg/cm3, ncomponents=2);
|
||||
AirE1mbar->AddElement(N, fractionmass=0.7);
|
||||
AirE1mbar->AddElement(O, fractionmass=0.3);
|
||||
|
||||
G4Material* AirE2mbar =
|
||||
new G4Material("AirE2mbar" , density= 1.290e-5*mg/cm3, ncomponents=2);
|
||||
AirE2mbar->AddElement(N, fractionmass=0.7);
|
||||
AirE2mbar->AddElement(O, fractionmass=0.3);
|
||||
|
||||
G4Material* AirE3mbar =
|
||||
new G4Material("AirE3mbar" , density= 1.290e-6*mg/cm3, ncomponents=2);
|
||||
AirE3mbar->AddElement(N, fractionmass=0.7);
|
||||
AirE3mbar->AddElement(O, fractionmass=0.3);
|
||||
|
||||
G4Material* AirE4mbar =
|
||||
new G4Material("AirE4mbar" , density= 1.290e-7*mg/cm3, ncomponents=2);
|
||||
AirE4mbar->AddElement(N, fractionmass=0.7);
|
||||
AirE4mbar->AddElement(O, fractionmass=0.3);
|
||||
|
||||
G4Material* AirE5mbar =
|
||||
new G4Material("AirE5mbar" , density= 1.290e-8*mg/cm3, ncomponents=2);
|
||||
AirE5mbar->AddElement(N, fractionmass=0.7);
|
||||
AirE5mbar->AddElement(O, fractionmass=0.3);
|
||||
|
||||
G4Material* AirE6mbar =
|
||||
new G4Material("AirE6mbar" , density= 1.290e-9*mg/cm3, ncomponents=2);
|
||||
AirE6mbar->AddElement(N, fractionmass=0.7);
|
||||
AirE6mbar->AddElement(O, fractionmass=0.3);
|
||||
|
||||
//
|
||||
// examples of vacuum
|
||||
//
|
||||
@ -1661,6 +1726,9 @@ void musrDetectorConstruction::DefineMaterials()
|
||||
new G4Material("HeliumGas80mbar",z=2., a=4.002602*g/mole, density= 0.00001410112*g/cm3);
|
||||
new G4Material("HeliumGas90mbar",z=2., a=4.002602*g/mole, density= 0.00001586376*g/cm3);
|
||||
new G4Material("HeliumGas100mbar",z=2.,a=4.002602*g/mole, density= 0.00001762640*g/cm3);
|
||||
new G4Material("HeliumGasSat4K",z=2., a=4.002602*g/mole, density= 0.016891*g/cm3); // saturated vapour above liquid at 4.2K (JSL)
|
||||
new G4Material("HeliumGas5mbar4K",z=2.,a=4.002602*g/mole, density= 0.016891*5.0/1013.0*g/cm3); // typical cold exchange gas, 4.2K and 5 mbar
|
||||
new G4Material("HeliumGas2mbar4K",z=2.,a=4.002602*g/mole, density= 0.016891*2.0/1013.0*g/cm3); // typical cold exchange gas, 4.2K and 5 mbar
|
||||
|
||||
if (musrParameters::boolG4OpticalPhotons) {
|
||||
|
||||
|
@ -47,6 +47,7 @@ void musrErrorMessage::musrError(SEVERITY severity, G4String message, G4bool sil
|
||||
actualErrorMessage.mesSeverity = severity;
|
||||
actualErrorMessage.nTimes = 1;
|
||||
ErrorMapping[message]=actualErrorMessage;
|
||||
it = ErrorMapping.find(message);
|
||||
G4cout<<"!!!"<<severityWord[severity]<<"!!! "<<message<<" (First time occurrence)"<<G4endl;
|
||||
nErrors++;
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ void musrEventAction::EndOfEventAction(const G4Event* evt) {
|
||||
fRunManager->AbortRun(true);
|
||||
}
|
||||
|
||||
if (thisEventNr != 0 and thisEventNr%nHowOftenToPrintEvent == 0) {
|
||||
if ((thisEventNr != 0) && (thisEventNr%nHowOftenToPrintEvent == 0)) {
|
||||
time_t curr=time(0);
|
||||
//char * ctime(const time_t * tp);
|
||||
G4cout << ">>> Event " << evt->GetEventID() <<". Running already for "<<curr-timeOfRunStart<<" seconds. Present time: "<< ctime(&curr);
|
||||
@ -133,7 +133,7 @@ void musrEventAction::EndOfEventAction(const G4Event* evt) {
|
||||
for (G4int i=0; i<n_trajectories; i++)
|
||||
{ G4Trajectory* trj = (G4Trajectory*)
|
||||
((*(evt->GetTrajectoryContainer()))[i]);
|
||||
trj->DrawTrajectory(1000);
|
||||
trj->DrawTrajectory(); //removed argument 1000 (JSL)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -264,6 +264,7 @@ void musrPhysicsList::ConstructProcess()
|
||||
|
||||
// For optical photons
|
||||
#include "G4Scintillation.hh"
|
||||
#include "G4Cerenkov.hh"
|
||||
|
||||
// For models
|
||||
#include "G4ProcessTable.hh"
|
||||
@ -336,6 +337,13 @@ void musrPhysicsList::ConstructEM()
|
||||
else if (stringProcessName=="G4OpRayleigh") pManager->AddDiscreteProcess(new G4OpRayleigh);
|
||||
else if (stringProcessName=="G4OpBoundaryProcess") pManager->AddDiscreteProcess(new G4OpBoundaryProcess);
|
||||
else if (stringProcessName=="G4OpWLS") pManager->AddDiscreteProcess(new G4OpWLS);
|
||||
else if (stringProcessName=="G4Cerenkov") {
|
||||
G4Cerenkov* myCerenkov = new G4Cerenkov();
|
||||
myCerenkov->SetMaxNumPhotonsPerStep(20); // settings from GEANT example N06
|
||||
myCerenkov->SetMaxBetaChangePerStep(10.0);
|
||||
myCerenkov->SetTrackSecondariesFirst(false); // as for Scintillation, do main high energy particles first
|
||||
pManager->AddDiscreteProcess(myCerenkov); // added JSL
|
||||
}
|
||||
else {
|
||||
sprintf(eMessage,"musrPhysicsList: Process \"%s\" is not implemented in musrPhysicsList.cc for addDiscreteProcess. It can be easily added.",
|
||||
charProcessName);
|
||||
@ -373,6 +381,14 @@ void musrPhysicsList::ConstructEM()
|
||||
if (musrParameters::finiteRiseTimeInScintillator) myScintillation->SetFiniteRiseTime(true);
|
||||
pManager->AddProcess(myScintillation,nr1,nr2,nr3);
|
||||
}
|
||||
else if (stringProcessName=="G4Cerenkov") {
|
||||
G4Cerenkov* myCerenkov = new G4Cerenkov();
|
||||
myCerenkov->SetMaxNumPhotonsPerStep(20); // settings from GEANT example N06
|
||||
myCerenkov->SetMaxBetaChangePerStep(10.0);
|
||||
myCerenkov->SetTrackSecondariesFirst(false); // as for Scintillation, do main high energy particles first
|
||||
pManager->AddProcess(myCerenkov,nr1,nr2,nr3); // added JSL
|
||||
pManager->SetProcessOrdering(myCerenkov,idxPostStep); // from Example N06
|
||||
}
|
||||
// cks: musrMuScatter could be uncommented here, but testing is needed, because Toni has some strange comments
|
||||
// in his original "musrPhysicsList.cc about implementing musrMuScatter.
|
||||
// else if (stringProcessName=="musrMuScatter") pManager->AddProcess(new musrMuScatter,nr1,nr2,nr3);
|
||||
|
@ -833,8 +833,9 @@ void musrRootOutput::SetPhotDetTime(G4double time) {
|
||||
nOptPhotDet++;
|
||||
}
|
||||
else {
|
||||
nOptPhotDet++; // still want to know how many in total (JSL)
|
||||
char message[200];
|
||||
sprintf(message,"musrRootOutput.cc::SetPhotDetTime: number of individual photons larger than maxNOptPhotDet (=%d)",maxNOptPhotDet);
|
||||
musrErrorMessage::GetInstance()->musrError(WARNING,message,false);
|
||||
musrErrorMessage::GetInstance()->musrError(WARNING,message,true); // had silent=false and printed all messages (JSL)
|
||||
}
|
||||
}
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include "musrErrorMessage.hh"
|
||||
#include "musrSteppingAction.hh"
|
||||
//#include "TCanvas.h"
|
||||
#include "TH1D.h"
|
||||
#include "TMath.h"
|
||||
#include "TF1.h"
|
||||
#include <vector>
|
||||
@ -131,6 +132,7 @@ musrScintSD::musrScintSD(G4String name)
|
||||
APDcellsTimeVariationRequested=false;
|
||||
APDcrossTalkRequested=false;
|
||||
APDcrossTalkProb=0.;
|
||||
// verboseLevel = 9; // JSL
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@ -167,8 +169,10 @@ void musrScintSD::Initialize(G4HCofThisEvent* HCE) {
|
||||
if (musrParameters::boolG4OpticalPhotons) {
|
||||
if (!musrParameters::boolG4OpticalPhotonsUnprocess) {
|
||||
for (optHitMapType::const_iterator it=optHitMap.begin() ; it != optHitMap.end(); it++ ) {
|
||||
if (verboseLevel>1) G4cout<<"VERBOSE 2 : deleting optHitDetectorMap" <<"\n";
|
||||
delete (it->second);
|
||||
}
|
||||
if (verboseLevel>1) G4cout<<"VERBOSE 2 : clearing optHitMap" <<"\n";
|
||||
optHitMap.clear();
|
||||
}
|
||||
}
|
||||
@ -208,6 +212,7 @@ G4bool musrScintSD::ProcessHits(G4Step* aStep,G4TouchableHistory*)
|
||||
|
||||
|
||||
|
||||
if (verboseLevel>1) G4cout<<"VERBOSE 2 : creating a new musrScintHit" <<"\n";
|
||||
musrScintHit* newHit = new musrScintHit();
|
||||
// newHit->SetParticleName (aTrack->GetDefinition()->GetParticleName());
|
||||
newHit->SetParticleName(particleName);
|
||||
@ -286,6 +291,7 @@ void musrScintSD::ProcessOpticalPhoton(G4Step* aStep) {
|
||||
// G4cout<<" detID ="<<detID<<" actualVolume="<<actualVolume<<G4endl;
|
||||
optHitMapType::iterator iter = optHitMap.find(detID);
|
||||
if (iter==optHitMap.end()) { // optHitDetectorMapType does not exist ==> create it
|
||||
if (verboseLevel>1) G4cout<<"VERBOSE 2 : creating a new OptHitDetectorMap" <<"\n";
|
||||
optHitDetectorMapType* optHitDetectorMapTmp = new optHitDetectorMapType;
|
||||
optHitMap.insert(std::pair<Int_t,optHitDetectorMapType*>(detID,optHitDetectorMapTmp));
|
||||
iter = optHitMap.find(detID);
|
||||
@ -380,7 +386,7 @@ void musrScintSD::EndOfEvent(G4HCofThisEvent*) {
|
||||
// in which case times are huge and due to the limited rounding
|
||||
// precision become equal --> map ignores the same "keys",
|
||||
// multimap does not.
|
||||
std::map<G4double,G4int>::iterator it;
|
||||
std::multimap<G4double,G4int>::iterator it;
|
||||
for (G4int i=0; i<NbHits; i++) {
|
||||
musrScintHit* aHit = (*scintCollection)[i];
|
||||
G4double tmptime=aHit->GetGlobalTime();
|
||||
@ -670,6 +676,7 @@ void musrScintSD::EndOfEvent_OptiacalPhotons() {
|
||||
iHistNr++;
|
||||
char nameHist[200]; sprintf(nameHist,"OPSAhist_%d_%d_%d",eeeventID,OPSA_detID,iHistNr);
|
||||
char nameHistTitle[200]; sprintf(nameHistTitle,"OPSAhist_%d_%d_%d;time (ns);Nr of photons",eeeventID,OPSA_detID,iHistNr);
|
||||
if (verboseLevel>1) G4cout<<"VERBOSE 2 : creating a new TH1D for OPSAhisto" <<"\n";
|
||||
OPSAhisto = new TH1D(nameHist, nameHistTitle, OPSAhistoNbin, OPSAhistoMin, OPSAhistoMax);
|
||||
// poiss = new TF1("poiss",poissonf,0.,.5,2); // x in [0;300], 2
|
||||
// poiss->SetParameter(0,1);
|
||||
@ -677,9 +684,11 @@ void musrScintSD::EndOfEvent_OptiacalPhotons() {
|
||||
if (bool_pulseShapeExists) {
|
||||
sprintf(nameHist,"OPSAshape_%d_%d_%d",eeeventID,OPSA_detID,iHistNr);
|
||||
sprintf(nameHistTitle,"OPSAshape_%d_%d_%d;time (ns);Pulse signal",eeeventID,OPSA_detID,iHistNr);
|
||||
if (verboseLevel>1) G4cout<<"VERBOSE 2 : creating a new TH1D for OPSAshape" <<"\n";
|
||||
OPSAshape = new TH1D(nameHist, nameHistTitle, OPSAhistoNbin, OPSAhistoMin, OPSAhistoMax);
|
||||
sprintf(nameHist,"OPSA_CFD_%d_%d_%d",eeeventID,OPSA_detID,iHistNr);
|
||||
sprintf(nameHistTitle,"OPSA_CFD_%d_%d_%d;time (ns);CFD signal",eeeventID,OPSA_detID,iHistNr);
|
||||
if (verboseLevel>1) G4cout<<"VERBOSE 2 : creating a new TH1D for OPSA_CFD" <<"\n";
|
||||
OPSA_CFD = new TH1D(nameHist, nameHistTitle, OPSAhistoNbin, OPSAhistoMin, OPSAhistoMax);
|
||||
}
|
||||
}
|
||||
@ -695,6 +704,7 @@ void musrScintSD::EndOfEvent_OptiacalPhotons() {
|
||||
else { // create histogram because it does not exist
|
||||
char nameHistTitle[200]; sprintf(nameHistTitle,"OPSAhistSUM_%d_%d;time (ns);Nr of photons",OPSA_detID,iHistNrSUM);
|
||||
char nameHistTitle0[200]; sprintf(nameHistTitle0,"OPSAhistSUM0_%d_%d;time (ns);Nr of photons",OPSA_detID,iHistNrSUM);
|
||||
if (verboseLevel>1) G4cout<<"VERBOSE 2 : creating new TH1Ds for OPSAhistoSUM,0" <<"\n";
|
||||
OPSAhistoSUM = new TH1D(nameHist, nameHistTitle, OPSAhistoNbin, OPSAhistoMin, OPSAhistoMax);
|
||||
OPSAhistoSUM0= new TH1D(nameHist0,nameHistTitle0,OPSAhistoNbin, OPSAhistoMin, OPSAhistoMax);
|
||||
mapOfOPSAsumHistograms.insert(std::pair<std::string,TH1D*>(nameHist,OPSAhistoSUM));
|
||||
@ -1026,13 +1036,16 @@ void musrScintSD::EndOfEvent_OptiacalPhotons() {
|
||||
|
||||
// Delete the histograms from memory if they were created
|
||||
if ((boolStoreThisOPSAhist)||(bool_pulseShapeExists)) {
|
||||
if (verboseLevel>1) G4cout<<"VERBOSE 2 : deleting OPSAhisto" <<"\n";
|
||||
delete OPSAhisto;
|
||||
if (bool_pulseShapeExists) {
|
||||
if (verboseLevel>1) G4cout<<"VERBOSE 2 : deleting OPSAshape and CFD" <<"\n";
|
||||
delete OPSAshape;
|
||||
delete OPSA_CFD;
|
||||
}
|
||||
}
|
||||
|
||||
if (verboseLevel>1) G4cout<<"VERBOSE 2 : creating new signalInfo" <<"\n";
|
||||
signalInfo* mySignalInfo = new signalInfo(OPSA_detID,OPSA_nPhot,OPSA_nPhotPrim,OPSA_timeFirst,OPSA_timeSecond,OPSA_timeThird,
|
||||
OPSA_timeA,OPSA_timeB,OPSA_timeC,OPSA_timeD,OPSA_timeMean,OPSA_timeLast,
|
||||
OPSA_CFD_time,OPSA_CFD_ampl,timeCFDarray,OPSA_timeC1);
|
||||
@ -1070,6 +1083,7 @@ void musrScintSD::EndOfEvent_OptiacalPhotons() {
|
||||
}
|
||||
// Now delete all mySignalInfo* from OPSA_signal_Map
|
||||
for (OPSA_signal_MapType::const_iterator itOPSA = OPSA_signal_Map.begin(); itOPSA != OPSA_signal_Map.end(); itOPSA++) {
|
||||
if (verboseLevel>1) G4cout<<"VERBOSE 2 : deleting itOPSA->second" <<"\n";
|
||||
delete (itOPSA->second);
|
||||
}
|
||||
OPSA_signal_Map.clear();
|
||||
@ -1162,16 +1176,20 @@ G4int musrScintSD::FindAPDcellID(G4Step* aStep) {
|
||||
void musrScintSD::FireAPDcell(optHitDetectorMapType* optHitDetectorMap, G4int APDcellID, G4double time, G4int nTruePhe) {
|
||||
if ( (musrRootOutput::store_phot_time) && (nTruePhe>0) ) myRootOutput->SetPhotDetTime(time);
|
||||
if (!APDcellsEffectRequested) {
|
||||
if (verboseLevel>1) G4cout<<"VERBOSE 2 : storing photon hit (non APD)" <<"\n";
|
||||
APDidClass tmpAPDid(0,nTruePhe);
|
||||
// optHitDetectorMap->insert(std::pair<G4double,G4int>(time,0));
|
||||
optHitDetectorMap->insert(std::pair<G4double,APDidClass>(time,tmpAPDid));
|
||||
}
|
||||
else {
|
||||
G4bool APDcellAlreadyFired = false;
|
||||
if (verboseLevel>1) G4cout<<"VERBOSE 2 : searching for the APD element" <<"\n";
|
||||
for (optHitDetectorMapType::iterator it2 = optHitDetectorMap->begin(); it2 != optHitDetectorMap->end(); it2++ ) {
|
||||
if ((it2->second).GetAPDcellID()==APDcellID) { // this cell already fired before ==> check times
|
||||
if (verboseLevel>1) G4cout<<"VERBOSE 2 : this cell already fired before" <<"\n";
|
||||
APDcellAlreadyFired = true;
|
||||
if (time<(it2->first)) { // the new cell fired before the already saved cell ==> replace it
|
||||
if (verboseLevel>1) G4cout<<"VERBOSE 2 : and the new photon is earlier, replacing" <<"\n";
|
||||
G4int tmpAPDcellNphot = (it2->second).GetAPDcellNphot() + nTruePhe;
|
||||
APDidClass tmpAPDid(APDcellID,tmpAPDcellNphot);
|
||||
optHitDetectorMap->erase(it2);
|
||||
@ -1183,6 +1201,7 @@ void musrScintSD::FireAPDcell(optHitDetectorMapType* optHitDetectorMap, G4int AP
|
||||
}
|
||||
if (!APDcellAlreadyFired) {
|
||||
// optHitDetectorMap->insert(std::pair<G4double,G4int>(time,APDcellID));
|
||||
if (verboseLevel>1) G4cout<<"VERBOSE 2 : this cell hasn't fired, storing" <<"\n";
|
||||
APDidClass tmpAPDid(APDcellID,nTruePhe);
|
||||
optHitDetectorMap->insert(std::pair<G4double,APDidClass>(time,tmpAPDid));
|
||||
}
|
||||
|
@ -617,10 +617,12 @@ void musrTabulatedElementField::addFieldValue2D(const G4double point[4],
|
||||
local = global2local.TransformPoint(global);
|
||||
|
||||
double x, z, z_sign;
|
||||
if ((strcmp(fieldTableType,"2D")==0)||(strcmp(fieldTableType,"2DBOpera")==0)||
|
||||
(strcmp(fieldTableType,"2D_OperaXY"))||(strcmp(fieldTableType,"2DEf")==0)) {
|
||||
// if ((strcmp(fieldTableType,"2D")==0)||(strcmp(fieldTableType,"2DBOpera")==0)||
|
||||
// (strcmp(fieldTableType,"2D_OperaXY"))||(strcmp(fieldTableType,"2DEf")==0)) {
|
||||
// Field is defined in just positive range of z; i.e. it is expected to be "symmetric"
|
||||
// and the field for negative z is calculated from the positive z half.
|
||||
if (minimumz >= 0) {
|
||||
// JSL: Use field values for z<0 if they're in the table! Reflect otherwise.
|
||||
x = sqrt(local.x()*local.x()+local.y()*local.y());
|
||||
z = fabs(local.z());
|
||||
z_sign = (local.z()>0) ? 1.:-1.;
|
||||
@ -631,8 +633,9 @@ void musrTabulatedElementField::addFieldValue2D(const G4double point[4],
|
||||
z = local.z();
|
||||
z_sign = 1;
|
||||
}
|
||||
// Check that the point is within the defined region
|
||||
if ( x<maximumx && z<maximumz ) {
|
||||
// Check that the point is within the defined region (JSL: 2-sided check)
|
||||
if ( x>=minimumx && x<maximumx &&
|
||||
z>=minimumz && z<maximumz ) {
|
||||
// if (evNr>evNrKriz) std::cout<<"bol som tu"<<std::endl;
|
||||
|
||||
// Position of given point within region, normalized to the range
|
||||
|
Reference in New Issue
Block a user