6.5.2011 Kamil Sedlak

1) Adding/improving the simulation of light signals and APD
2) Many small changes and improvements
3) Adding manual to musrSimAna to the svn repository
4) Adding some example files for musrSim
This commit is contained in:
2011-05-06 15:16:49 +00:00
parent 9bc0d53074
commit cb18486947
22 changed files with 11942 additions and 173 deletions

View File

@ -1187,6 +1187,8 @@ G4VPhysicalVolume* musrDetectorConstruction::Construct() {
if (strcmp(tmpString2,"odet_timeD")==0) {musrRootOutput::store_odet_timeD = false;}
if (strcmp(tmpString2,"odet_timeMean")==0) {musrRootOutput::store_odet_timeMean = false;}
if (strcmp(tmpString2,"odet_timeLast")==0) {musrRootOutput::store_odet_timeLast = false;}
if (strcmp(tmpString2,"odet_timeCFD")==0) {musrRootOutput::store_odet_timeCFD = false;}
if (strcmp(tmpString2,"odet_amplCFD")==0) {musrRootOutput::store_odet_amplCFD = false;}
}
else if(strcmp(storeIt,"on")==0) {
if (strcmp(tmpString2,"fieldIntegralBx")==0){musrRootOutput::store_fieldIntegralBx = true;}
@ -1195,6 +1197,7 @@ G4VPhysicalVolume* musrDetectorConstruction::Construct() {
if (strcmp(tmpString2,"fieldIntegralBz1")==0){musrRootOutput::store_fieldIntegralBz1 = true;}
if (strcmp(tmpString2,"fieldIntegralBz2")==0){musrRootOutput::store_fieldIntegralBz2 = true;}
if (strcmp(tmpString2,"fieldIntegralBz3")==0){musrRootOutput::store_fieldIntegralBz3 = true;}
if (strcmp(tmpString2,"odet_timeCFDarray")==0){musrRootOutput::store_odet_timeCFDarray = true;}
if ((musrRootOutput::store_fieldIntegralBx)||(musrRootOutput::store_fieldIntegralBy)||
(musrRootOutput::store_fieldIntegralBz)||(musrRootOutput::store_fieldIntegralBz1)||

View File

@ -160,7 +160,7 @@ G4bool musrRootOutput::store_odet_timeMean = true;
G4bool musrRootOutput::store_odet_timeLast = true;
G4bool musrRootOutput::store_odet_timeCFD = true;
G4bool musrRootOutput::store_odet_amplCFD = true;
G4bool musrRootOutput::store_odet_timeCFDarray = false;
G4int musrRootOutput::oldEventNumberInG4EqEMFieldWithSpinFunction=-1;
@ -301,7 +301,73 @@ void musrRootOutput::BeginOfRunAction() {
if (store_odet_timeLast) {rootTree->Branch("odet_timeLast",&odet_timeLast,"odet_timeLast[odet_n]/D");}
if (store_odet_timeCFD) {rootTree->Branch("odet_timeCFD",&odet_timeCFD,"odet_timeCFD[odet_n]/D");}
if (store_odet_amplCFD) {rootTree->Branch("odet_amplCFD",&odet_amplCFD,"odet_amplCFD[odet_n]/D");}
if (store_odet_timeCFDarray) {
rootTree->Branch("odet_timeCFD100",&odet_timeCFD100,"odet_timeCFD100[odet_n]/D");
rootTree->Branch("odet_timeCFD101",&odet_timeCFD101,"odet_timeCFD101[odet_n]/D");
rootTree->Branch("odet_timeCFD102",&odet_timeCFD102,"odet_timeCFD102[odet_n]/D");
rootTree->Branch("odet_timeCFD103",&odet_timeCFD103,"odet_timeCFD103[odet_n]/D");
rootTree->Branch("odet_timeCFD104",&odet_timeCFD104,"odet_timeCFD104[odet_n]/D");
rootTree->Branch("odet_timeCFD105",&odet_timeCFD105,"odet_timeCFD105[odet_n]/D");
rootTree->Branch("odet_timeCFD106",&odet_timeCFD106,"odet_timeCFD106[odet_n]/D");
rootTree->Branch("odet_timeCFD107",&odet_timeCFD107,"odet_timeCFD107[odet_n]/D");
rootTree->Branch("odet_timeCFD108",&odet_timeCFD108,"odet_timeCFD108[odet_n]/D");
rootTree->Branch("odet_timeCFD109",&odet_timeCFD109,"odet_timeCFD109[odet_n]/D");
rootTree->Branch("odet_timeCFD110",&odet_timeCFD110,"odet_timeCFD110[odet_n]/D");
rootTree->Branch("odet_timeCFD111",&odet_timeCFD111,"odet_timeCFD111[odet_n]/D");
rootTree->Branch("odet_timeCFD112",&odet_timeCFD112,"odet_timeCFD112[odet_n]/D");
rootTree->Branch("odet_timeCFD200",&odet_timeCFD200,"odet_timeCFD200[odet_n]/D");
rootTree->Branch("odet_timeCFD201",&odet_timeCFD201,"odet_timeCFD201[odet_n]/D");
rootTree->Branch("odet_timeCFD202",&odet_timeCFD202,"odet_timeCFD202[odet_n]/D");
rootTree->Branch("odet_timeCFD203",&odet_timeCFD203,"odet_timeCFD203[odet_n]/D");
rootTree->Branch("odet_timeCFD204",&odet_timeCFD204,"odet_timeCFD204[odet_n]/D");
rootTree->Branch("odet_timeCFD205",&odet_timeCFD205,"odet_timeCFD205[odet_n]/D");
rootTree->Branch("odet_timeCFD206",&odet_timeCFD206,"odet_timeCFD206[odet_n]/D");
rootTree->Branch("odet_timeCFD207",&odet_timeCFD207,"odet_timeCFD207[odet_n]/D");
rootTree->Branch("odet_timeCFD208",&odet_timeCFD208,"odet_timeCFD208[odet_n]/D");
rootTree->Branch("odet_timeCFD209",&odet_timeCFD209,"odet_timeCFD209[odet_n]/D");
rootTree->Branch("odet_timeCFD210",&odet_timeCFD210,"odet_timeCFD210[odet_n]/D");
rootTree->Branch("odet_timeCFD211",&odet_timeCFD211,"odet_timeCFD211[odet_n]/D");
rootTree->Branch("odet_timeCFD212",&odet_timeCFD212,"odet_timeCFD212[odet_n]/D");
rootTree->Branch("odet_timeCFD300",&odet_timeCFD300,"odet_timeCFD300[odet_n]/D");
rootTree->Branch("odet_timeCFD301",&odet_timeCFD301,"odet_timeCFD301[odet_n]/D");
rootTree->Branch("odet_timeCFD302",&odet_timeCFD302,"odet_timeCFD302[odet_n]/D");
rootTree->Branch("odet_timeCFD303",&odet_timeCFD303,"odet_timeCFD303[odet_n]/D");
rootTree->Branch("odet_timeCFD304",&odet_timeCFD304,"odet_timeCFD304[odet_n]/D");
rootTree->Branch("odet_timeCFD305",&odet_timeCFD305,"odet_timeCFD305[odet_n]/D");
rootTree->Branch("odet_timeCFD306",&odet_timeCFD306,"odet_timeCFD306[odet_n]/D");
rootTree->Branch("odet_timeCFD307",&odet_timeCFD307,"odet_timeCFD307[odet_n]/D");
rootTree->Branch("odet_timeCFD308",&odet_timeCFD308,"odet_timeCFD308[odet_n]/D");
rootTree->Branch("odet_timeCFD309",&odet_timeCFD309,"odet_timeCFD309[odet_n]/D");
rootTree->Branch("odet_timeCFD310",&odet_timeCFD310,"odet_timeCFD310[odet_n]/D");
rootTree->Branch("odet_timeCFD311",&odet_timeCFD311,"odet_timeCFD311[odet_n]/D");
rootTree->Branch("odet_timeCFD312",&odet_timeCFD312,"odet_timeCFD312[odet_n]/D");
rootTree->Branch("odet_timeCFD400",&odet_timeCFD400,"odet_timeCFD400[odet_n]/D");
rootTree->Branch("odet_timeCFD401",&odet_timeCFD401,"odet_timeCFD401[odet_n]/D");
rootTree->Branch("odet_timeCFD402",&odet_timeCFD402,"odet_timeCFD402[odet_n]/D");
rootTree->Branch("odet_timeCFD403",&odet_timeCFD403,"odet_timeCFD403[odet_n]/D");
rootTree->Branch("odet_timeCFD404",&odet_timeCFD404,"odet_timeCFD404[odet_n]/D");
rootTree->Branch("odet_timeCFD405",&odet_timeCFD405,"odet_timeCFD405[odet_n]/D");
rootTree->Branch("odet_timeCFD406",&odet_timeCFD406,"odet_timeCFD406[odet_n]/D");
rootTree->Branch("odet_timeCFD407",&odet_timeCFD407,"odet_timeCFD407[odet_n]/D");
rootTree->Branch("odet_timeCFD408",&odet_timeCFD408,"odet_timeCFD408[odet_n]/D");
rootTree->Branch("odet_timeCFD409",&odet_timeCFD409,"odet_timeCFD409[odet_n]/D");
rootTree->Branch("odet_timeCFD410",&odet_timeCFD410,"odet_timeCFD410[odet_n]/D");
rootTree->Branch("odet_timeCFD411",&odet_timeCFD411,"odet_timeCFD411[odet_n]/D");
rootTree->Branch("odet_timeCFD412",&odet_timeCFD412,"odet_timeCFD412[odet_n]/D");
rootTree->Branch("odet_timeCFD500",&odet_timeCFD500,"odet_timeCFD500[odet_n]/D");
rootTree->Branch("odet_timeCFD501",&odet_timeCFD501,"odet_timeCFD501[odet_n]/D");
rootTree->Branch("odet_timeCFD502",&odet_timeCFD502,"odet_timeCFD502[odet_n]/D");
rootTree->Branch("odet_timeCFD503",&odet_timeCFD503,"odet_timeCFD503[odet_n]/D");
rootTree->Branch("odet_timeCFD504",&odet_timeCFD504,"odet_timeCFD504[odet_n]/D");
rootTree->Branch("odet_timeCFD505",&odet_timeCFD505,"odet_timeCFD505[odet_n]/D");
rootTree->Branch("odet_timeCFD506",&odet_timeCFD506,"odet_timeCFD506[odet_n]/D");
rootTree->Branch("odet_timeCFD507",&odet_timeCFD507,"odet_timeCFD507[odet_n]/D");
rootTree->Branch("odet_timeCFD508",&odet_timeCFD508,"odet_timeCFD508[odet_n]/D");
rootTree->Branch("odet_timeCFD509",&odet_timeCFD509,"odet_timeCFD509[odet_n]/D");
rootTree->Branch("odet_timeCFD510",&odet_timeCFD510,"odet_timeCFD510[odet_n]/D");
rootTree->Branch("odet_timeCFD511",&odet_timeCFD511,"odet_timeCFD511[odet_n]/D");
rootTree->Branch("odet_timeCFD512",&odet_timeCFD512,"odet_timeCFD512[odet_n]/D");
}
// htest1 = new TH1F("htest1","The debugging histogram 1",50,-4.,4.);
// htest2 = new TH1F("htest2","The debugging histogram 2",50,0.,3.142);
@ -562,7 +628,74 @@ void musrRootOutput::SetOPSAinfo (G4int nDetectors, G4int ID, G4int nPhot, G4
odet_amplCFD[nDetectors]=amplCFD;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void musrRootOutput::SetCFDSpecialInfo (G4int n, G4double time) {
if (n==100) {odet_timeCFD100[odet_n-1] = time/microsecond;} // G4cout<<"OKKKKK odet_n-1="<<odet_n-1<<G4endl;}
else if (n==101) {odet_timeCFD101[odet_n-1] = time/microsecond;}
else if (n==102) {odet_timeCFD102[odet_n-1] = time/microsecond;}
else if (n==103) {odet_timeCFD103[odet_n-1] = time/microsecond;}
else if (n==104) {odet_timeCFD104[odet_n-1] = time/microsecond;}
else if (n==105) {odet_timeCFD105[odet_n-1] = time/microsecond;}
else if (n==106) {odet_timeCFD106[odet_n-1] = time/microsecond;}
else if (n==107) {odet_timeCFD107[odet_n-1] = time/microsecond;}
else if (n==108) {odet_timeCFD108[odet_n-1] = time/microsecond;}
else if (n==109) {odet_timeCFD109[odet_n-1] = time/microsecond;}
else if (n==110) {odet_timeCFD110[odet_n-1] = time/microsecond;}
else if (n==111) {odet_timeCFD111[odet_n-1] = time/microsecond;}
else if (n==112) {odet_timeCFD112[odet_n-1] = time/microsecond;}
else if (n==200) {odet_timeCFD200[odet_n-1] = time/microsecond;}
else if (n==201) {odet_timeCFD201[odet_n-1] = time/microsecond;}
else if (n==202) {odet_timeCFD202[odet_n-1] = time/microsecond;}
else if (n==203) {odet_timeCFD203[odet_n-1] = time/microsecond;}
else if (n==204) {odet_timeCFD204[odet_n-1] = time/microsecond;}
else if (n==205) {odet_timeCFD205[odet_n-1] = time/microsecond;}
else if (n==206) {odet_timeCFD206[odet_n-1] = time/microsecond;}
else if (n==207) {odet_timeCFD207[odet_n-1] = time/microsecond;}
else if (n==208) {odet_timeCFD208[odet_n-1] = time/microsecond;}
else if (n==209) {odet_timeCFD209[odet_n-1] = time/microsecond;}
else if (n==210) {odet_timeCFD210[odet_n-1] = time/microsecond;}
else if (n==211) {odet_timeCFD211[odet_n-1] = time/microsecond;}
else if (n==212) {odet_timeCFD212[odet_n-1] = time/microsecond;}
else if (n==300) {odet_timeCFD300[odet_n-1] = time/microsecond;}
else if (n==301) {odet_timeCFD301[odet_n-1] = time/microsecond;}
else if (n==302) {odet_timeCFD302[odet_n-1] = time/microsecond;}
else if (n==303) {odet_timeCFD303[odet_n-1] = time/microsecond;}
else if (n==304) {odet_timeCFD304[odet_n-1] = time/microsecond;}
else if (n==305) {odet_timeCFD305[odet_n-1] = time/microsecond;}
else if (n==306) {odet_timeCFD306[odet_n-1] = time/microsecond;}
else if (n==307) {odet_timeCFD307[odet_n-1] = time/microsecond;}
else if (n==308) {odet_timeCFD308[odet_n-1] = time/microsecond;}
else if (n==309) {odet_timeCFD309[odet_n-1] = time/microsecond;}
else if (n==310) {odet_timeCFD310[odet_n-1] = time/microsecond;}
else if (n==311) {odet_timeCFD311[odet_n-1] = time/microsecond;}
else if (n==312) {odet_timeCFD312[odet_n-1] = time/microsecond;}
else if (n==400) {odet_timeCFD400[odet_n-1] = time/microsecond;}
else if (n==401) {odet_timeCFD401[odet_n-1] = time/microsecond;}
else if (n==402) {odet_timeCFD402[odet_n-1] = time/microsecond;}
else if (n==403) {odet_timeCFD403[odet_n-1] = time/microsecond;}
else if (n==404) {odet_timeCFD404[odet_n-1] = time/microsecond;}
else if (n==405) {odet_timeCFD405[odet_n-1] = time/microsecond;}
else if (n==406) {odet_timeCFD406[odet_n-1] = time/microsecond;}
else if (n==407) {odet_timeCFD407[odet_n-1] = time/microsecond;}
else if (n==408) {odet_timeCFD408[odet_n-1] = time/microsecond;}
else if (n==409) {odet_timeCFD409[odet_n-1] = time/microsecond;}
else if (n==410) {odet_timeCFD410[odet_n-1] = time/microsecond;}
else if (n==411) {odet_timeCFD411[odet_n-1] = time/microsecond;}
else if (n==412) {odet_timeCFD412[odet_n-1] = time/microsecond;}
else if (n==500) {odet_timeCFD500[odet_n-1] = time/microsecond;}
else if (n==501) {odet_timeCFD501[odet_n-1] = time/microsecond;}
else if (n==502) {odet_timeCFD502[odet_n-1] = time/microsecond;}
else if (n==503) {odet_timeCFD503[odet_n-1] = time/microsecond;}
else if (n==504) {odet_timeCFD504[odet_n-1] = time/microsecond;}
else if (n==505) {odet_timeCFD505[odet_n-1] = time/microsecond;}
else if (n==506) {odet_timeCFD506[odet_n-1] = time/microsecond;}
else if (n==507) {odet_timeCFD507[odet_n-1] = time/microsecond;}
else if (n==508) {odet_timeCFD508[odet_n-1] = time/microsecond;}
else if (n==509) {odet_timeCFD509[odet_n-1] = time/microsecond;}
else if (n==510) {odet_timeCFD510[odet_n-1] = time/microsecond;}
else if (n==511) {odet_timeCFD511[odet_n-1] = time/microsecond;}
else if (n==512) {odet_timeCFD512[odet_n-1] = time/microsecond;}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void musrRootOutput::setRootOutputDirectoryName(char dirName[1000]) {

View File

@ -688,6 +688,7 @@ void musrScintSD::EndOfEvent_OptiacalPhotons() {
OPSA_timeMean = OPSAhisto->GetMean() + OPSA_timeFirst;
// if required, convert the histogram with photon times to histogram of electronic pulse shape
G4double timeCFDarray[1000];
if (bool_pulseShapeExists) {
// for (Int_t iBin=1; iBin<=OPSAhistoNbin; iBin++) { // loop over all bins of photon histogram
// Double_t photonCount = OPSAhisto ->GetBinContent(iBin);
@ -703,50 +704,45 @@ void musrScintSD::EndOfEvent_OptiacalPhotons() {
// }
if (boolStoreThisOPSAhist) OPSAshape -> Write();
// Now fill the histogram with the CFD signal
for (Int_t iBin=1; iBin<=OPSAhistoNbin; iBin++) { // loop over all bins of electronic signal histogram
Double_t signalValue = OPSAshape->GetBinContent(iBin);
Double_t xValue = (iBin-0.5)*OPSAhistoBinWidth;
OPSA_CFD->Fill(xValue,signalValue*OPSA_CFD_a1);
Double_t xValueShifted = xValue + OPSA_CFD_delay;
if (xValueShifted>OPSAhistoMax) continue; //return if out of range;
OPSA_CFD->Fill(xValueShifted,signalValue);
}
if (boolStoreThisOPSAhist) OPSA_CFD -> Write();
// Find the timeCFD from CFD signal
Double_t oldYvalue;
Double_t yValue=-1000;
// 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
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;
// If requested, store CFD times for various CFD delays and amplitudes of the reverted signal
if (musrRootOutput::store_odet_timeCFDarray) {
G4double OPSA_CFD_a1_saveThis = OPSA_CFD_a1;
G4double OPSA_CFD_delay_saveThis = OPSA_CFD_delay;
const int nDelay = 13;
G4double delay[nDelay]={0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 1.0, 1.5, 2.0, 2.5, 3.0, 4.0};
const int nAmpl1 = 5;
G4double ampl1[nAmpl1] = {-0.05, -0.1, -0.2, -0.3, -0.4};
for (Int_t kk=0; kk<nDelay; kk++) {
for (Int_t ll=0; ll<nAmpl1; ll++) {
OPSA_CFD_a1 = ampl1[ll];
OPSA_CFD_delay = delay[kk];
FindCFDtime(OPSA_CFD_time, OPSA_CFD_ampl, OPSA_timeFirst);
int index = (ll+1)*100+kk;
if (index<1000) timeCFDarray[(ll+1)*100+kk] = OPSA_CFD_time;
else {G4cout<<"FATALNI ERROR in musrScintSD by calculating (ll+1)*100+kk"<<G4endl;}
// G4cout<<" delay= "<<OPSA_CFD_delay<<" ampl1= "<<OPSA_CFD_a1
// <<" OPSA_CFD_time= "<<OPSA_CFD_time<<" OPSA_CFD_ampl= "<<OPSA_CFD_ampl<<G4endl;
}
}
OPSA_CFD_a1 = OPSA_CFD_a1_saveThis;
OPSA_CFD_delay = OPSA_CFD_delay_saveThis;
}
// Now fill the histogram with the CFD signal
FindCFDtime(OPSA_CFD_time, OPSA_CFD_ampl, OPSA_timeFirst);
// G4cout<<"OPSA_CFD_time = "<<OPSA_CFD_time<<" OPSA_CFD_ampl = "<<OPSA_CFD_ampl<<G4endl;
if (boolStoreThisOPSAhist) OPSA_CFD -> Write();
// Find the timeC and timeD from the shape histogram
yValue=-1000;
Double_t yValue=-1000;
G4bool OPSA_C_time_found = false;
G4bool OPSA_D_time_found = false;
Double_t D_threshold = OPSA_D_threshold * (OPSAshape->GetMaximum()); // covert relative "OPSA_D_threshold" into
// the absolute threshold using signal amplitude
for (Int_t iBin=1; iBin<=OPSAhistoNbin; iBin++) { // loop over all bins of CFD histogram
Double_t xValue = (iBin-0.5)*OPSAhistoBinWidth;
oldYvalue = yValue;
Double_t oldYvalue = yValue;
yValue = OPSAshape->GetBinContent(iBin);
if ( (yValue>=OPSA_C_threshold) && (!OPSA_C_time_found) ) { // signal just moved above the threshold
OPSA_C_time_found = true;
@ -777,7 +773,7 @@ void musrScintSD::EndOfEvent_OptiacalPhotons() {
}
signalInfo* mySignalInfo = new signalInfo(OPSA_detID,OPSA_nPhot,OPSA_timeFirst,OPSA_timeA,OPSA_timeB,OPSA_timeC,
OPSA_timeD,OPSA_timeMean,OPSA_timeLast,OPSA_CFD_time,OPSA_CFD_ampl);
OPSA_timeD,OPSA_timeMean,OPSA_timeLast,OPSA_CFD_time,OPSA_CFD_ampl,timeCFDarray);
OPSA_signal_Map.insert(std::pair<G4int,signalInfo*>(OPSA_nPhot,mySignalInfo) );
}
OPSA_nPhot = 0;
@ -890,4 +886,35 @@ G4int musrScintSD::FindAPDcellID(G4Step* aStep) {
"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......
void musrScintSD::FindCFDtime(G4double& OPSA_CFD_time, G4double& OPSA_CFD_ampl, G4double timeOfFirstPhoton) {
OPSA_CFD->Reset("M");
for (Int_t iBin=1; iBin<=OPSAhistoNbin; iBin++) { // loop over all bins of electronic signal histogram
Double_t signalValue = OPSAshape->GetBinContent(iBin);
Double_t xValue = (iBin-0.5)*OPSAhistoBinWidth;
OPSA_CFD->Fill(xValue,signalValue*OPSA_CFD_a1);
Double_t xValueShifted = xValue + OPSA_CFD_delay;
if (xValueShifted>OPSAhistoMax) continue; //return if out of range;
OPSA_CFD->Fill(xValueShifted,signalValue);
}
// Find the timeCFD from CFD signal
Double_t oldYvalue;
Double_t yValue=-1000;
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 = OPSA_CFD->GetXaxis()->GetBinCenter(iBin);
oldYvalue = yValue;
yValue = OPSA_CFD->GetBinContent(iBin);
if (yValue >= 0) { // signal just crossed the y=0 axis
OPSA_CFD_time = xValue - yValue/(yValue-oldYvalue)*OPSAhistoBinWidth; //linear interpolation
OPSA_CFD_time += timeOfFirstPhoton - OPSA_CFD_delay + OPSA_CFD_timeShiftOffset; // correct for
break;
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......