Skip to content

Commit 8c5194a

Browse files
authored
Merge pull request #224 from JeffersonLab/Benitofcalupdate
update scripts and make them compatible with new C compiler on alma9
2 parents cd0de6b + 0ad2a9e commit 8c5194a

File tree

4 files changed

+21
-7
lines changed

4 files changed

+21
-7
lines changed

TOF_calib/DO_CALIB.csh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ root -b -q "src/dofitall.C++($RUN,10)"
5151

5252
# determine adc time offsets so that T_TDC - T_ADC will be peaked at zero.
5353
echo "executing doadctimeoffsets.C"
54-
root -b -q "src/doadctimeoffsets.C++($RUN)"
54+
root -b -q "src/doadctimeoffsets.C++($RUN)" >& calibration$RUN/adctoffsets.log
5555

5656

5757
# determine attenuation length

TOF_calib/src/doadctimeoffsets.C

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ void doadctimeoffsets(int Run){
3535
TH2D *TDiff;
3636
TH2D *TDiffF;
3737

38+
3839
RunNumber = Run;
3940

4041
NPMTS = 176; // TOF 1 geometry
@@ -46,6 +47,8 @@ void doadctimeoffsets(int Run){
4647

4748
double LOLIM = -20.;
4849
double HILIM = 20.;
50+
51+
TH1D *TDiffSingles[NPMTS];
4952

5053
TDiff = new TH2D("TDiff", "TDC_T - ADC_T",
5154
NumPMTMax, 0., (double)NumPMTMax,
@@ -64,7 +67,7 @@ void doadctimeoffsets(int Run){
6467

6568
// get TDC timing offsets
6669
sprintf(fnam,"calibration%d/tofpmt_tdc_offsets_all_FULL_run%d.DB",RunNumber,RunNumber);
67-
cout<<"offsetfile: "<<fnam<<endl;
70+
//cout<<"read TDC timing offsetfile: "<<fnam<<endl;
6871
ifstream INF;
6972
INF.open(fnam);
7073
double PMTOffsets[NumPMTMax];
@@ -354,7 +357,11 @@ void doadctimeoffsets(int Run){
354357

355358
ADC_T_offsets[k] = 0.;
356359
//cout<<"bin "<<k+1<<endl;
357-
TH1D *h = TDiffF->ProjectionY("h",k+1,k+1);
360+
string hnamek = "histDt"+to_string(k);
361+
TDiffSingles[k] = (TH1D*)TDiffF->ProjectionY(hnamek.c_str(),k+1,k+1)->Clone();
362+
// TH1D *h = TDiffF->ProjectionY("h",k+1,k+1);
363+
TH1D *h = TDiffSingles[k];
364+
358365
if (h->GetEntries()>100){
359366

360367
char hnam1[128];
@@ -393,8 +400,8 @@ void doadctimeoffsets(int Run){
393400
pos = func->GetParameter(1);
394401
sig = func->GetParameter(2);
395402

396-
lowlim = pos - 1.2*sig;
397-
higlim = pos + 1.2*sig;
403+
lowlim = pos - 1.7*sig;
404+
higlim = pos + 1.7*sig;
398405
if (lowlim < LOLIM){
399406
lowlim = LOLIM;
400407
}
@@ -420,6 +427,7 @@ void doadctimeoffsets(int Run){
420427
}
421428

422429
sprintf(fnam,"calibration%d/tdc_adc_time_offsets_run%d.DB",RunNumber,RunNumber);
430+
cout<<"write ADC timing offsetfile: "<<fnam<<endl;
423431
ofstream OUTF;
424432
OUTF.open(fnam);
425433
for (int k=0;k<NPMTS;k++) {
@@ -429,10 +437,15 @@ void doadctimeoffsets(int Run){
429437
OUTF.close();
430438

431439
sprintf(fnam,"calibration%d/tdc_adc_times_run%d.root",RunNumber,RunNumber);
440+
cout<<"write root file with histograms and fit for ADC timing offsets: "<<fnam<<endl;
432441
TFile *RootF = new TFile(fnam, "RECREATE");
433442
RootF->cd();
434443
TDiff->Write();
435444
TDiffF->Write();
445+
for (int k=0; k<NPMTS; k++){
446+
TDiffSingles[k]->Write();
447+
}
448+
436449
RootF->Close();
437450

438451
}

TOF_calib/src/meantime1.C

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,8 @@ void findpeak(double *MTPosition, double *MTSigma){
453453

454454
}
455455
if (DEBUG>1){
456-
if (!((k-3)%10) || (DEBUG>98)){
456+
if (!((k-3)%10) || (DEBUG>98)){
457+
//if ((DEBUG>98)){
457458
gPad->SetLogz(0);
458459
h->Draw();
459460
sprintf(exnam,"Mean-Time-Difference Pad%d to Ref-Pad%d",k,REFPAD);

TOF_calib/src/walk1.C

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ void walk1(int Run){
6262
// first get base time offset from ccdb data base
6363
system(TOFDIRcmd);
6464
ifstream INF1("calib.log");
65-
if (INF1 == NULL){
65+
if (!INF1){
6666
cout<<"Error no calibration file found! BAIL NOW!"<<endl;
6767
return;
6868
}

0 commit comments

Comments
 (0)