35 |
// YODA headers |
// YODA headers |
36 |
// |
// |
37 |
#include <PamelaRun.h> |
#include <PamelaRun.h> |
38 |
#include <physics/trigger/TriggerEvent.h> |
//#include <physics/trigger/TriggerEvent.h> |
39 |
#include <physics/tof/TofEvent.h> |
#include <physics/tof/TofEvent.h> |
40 |
// |
// |
41 |
// This program headers |
// This program headers |
104 |
// Variables for level2 |
// Variables for level2 |
105 |
// |
// |
106 |
TTree *tracker = 0; |
TTree *tracker = 0; |
107 |
|
TTree *trigger = 0; |
108 |
TTree *toft = 0; |
TTree *toft = 0; |
109 |
UInt_t nevents = 0; |
UInt_t nevents = 0; |
110 |
Long64_t maxsize = 10000000000LL; |
Long64_t maxsize = 10000000000LL; |
142 |
TrkLevel2 *trk = new TrkLevel2(); |
TrkLevel2 *trk = new TrkLevel2(); |
143 |
Int_t nevtrkl2 = 0; |
Int_t nevtrkl2 = 0; |
144 |
// |
// |
145 |
|
// trigger level2 variables |
146 |
|
// |
147 |
|
TrigLevel2 *trg = new TrigLevel2(); |
148 |
|
Int_t nevtrgl2 = 0; |
149 |
|
// |
150 |
// define variables for opening and reading level0 file |
// define variables for opening and reading level0 file |
151 |
// |
// |
152 |
TFile *l0File = 0; |
TFile *l0File = 0; |
153 |
TTree *l0tr = 0; |
TTree *l0tr = 0; |
154 |
TBranch *l0head = 0; |
TBranch *l0head = 0; |
155 |
TBranch *l0trig = 0; |
// TBranch *l0trig = 0; |
156 |
TBranch *l0tof = 0; |
TBranch *l0tof = 0; |
157 |
pamela::EventHeader *eh = 0; |
pamela::EventHeader *eh = 0; |
158 |
pamela::PscuHeader *ph = 0; |
pamela::PscuHeader *ph = 0; |
159 |
pamela::trigger::TriggerEvent *trig = 0; |
// pamela::trigger::TriggerEvent *trig = 0; |
160 |
pamela::tof::TofEvent *tofEvent = 0; |
pamela::tof::TofEvent *tofEvent = 0; |
161 |
// |
// |
162 |
// Define other basic variables |
// Define other basic variables |
216 |
// |
// |
217 |
// WM variables perform dE/dx II order corrections |
// WM variables perform dE/dx II order corrections |
218 |
// |
// |
219 |
Float_t dedx_corr_m[100][48],dedx_corr[48]; |
//Float_t dedx_corr_m[100][48],dedx_corr[48]; |
220 |
Double_t mtime[100],t1,t2,tm; |
Double_t mtime[100],t1,t2,tm; |
221 |
Float_t yhelp1,yhelp2,slope,inter,thelp1,thelp2; |
//Float_t yhelp1,yhelp2,slope,inter,thelp1,thelp2; |
222 |
|
|
223 |
|
//RC variables for new dEdx II order correction (10th reduction) |
224 |
|
Float_t Heyhelp1,Heyhelp2,Heslope,Heinter,thelp1,thelp2; |
225 |
|
Float_t pyhelp1,pyhelp2,pslope,pinter; |
226 |
|
Float_t dedx_Hepeak[48],dedx_ppeak[48]; |
227 |
|
Float_t dedx_Hepeak_m[100][48],dedx_ppeak_m[100][48]; |
228 |
|
Float_t inter_dedx[48],slope_dedx[48]; |
229 |
|
|
230 |
Float_t xmean1,xwidth1; |
Float_t xmean1,xwidth1; |
231 |
Int_t ical,ii,wj,jj; |
Int_t ical,ii,wj,jj; |
232 |
Float_t xleft=0; |
Float_t xleft=0; |
233 |
Float_t xright=0; |
Float_t xright=0; |
234 |
Float_t yleft=0; |
Float_t yleft=0; |
235 |
Float_t yright=0; |
Float_t yright=0; |
236 |
|
|
237 |
|
Int_t warning = 0; |
238 |
|
int a=0, b=0; |
239 |
|
|
240 |
// |
// |
241 |
// Let's start! |
// Let's start! |
242 |
// |
// |
268 |
// |
// |
269 |
tracker->SetBranchAddress("TrkLevel2",&trk); |
tracker->SetBranchAddress("TrkLevel2",&trk); |
270 |
nevtrkl2 = tracker->GetEntries(); |
nevtrkl2 = tracker->GetEntries(); |
271 |
|
|
272 |
|
// |
273 |
|
// Does it contain the Trigger tree? |
274 |
|
// |
275 |
|
trigger = (TTree*)file->Get("Trigger"); |
276 |
|
if ( !trigger ) { |
277 |
|
if ( verbose ) printf(" TOF - ERROR: no trigger tree\n"); |
278 |
|
code = -302; |
279 |
|
goto closeandexit; |
280 |
|
}; |
281 |
|
// |
282 |
|
// get trigger level2 data pointer |
283 |
|
// |
284 |
|
trigger->SetBranchAddress("TrigLevel2",&trg); |
285 |
|
nevtrgl2 = trigger->GetEntries(); |
286 |
|
|
287 |
// |
// |
288 |
// Retrieve GL_RUN variables from the level2 file |
// Retrieve GL_RUN variables from the level2 file |
289 |
// |
// |
513 |
code = -8; |
code = -8; |
514 |
goto closeandexit; |
goto closeandexit; |
515 |
}; |
}; |
516 |
l0trig = l0tr->GetBranch("Trigger"); |
// l0trig = l0tr->GetBranch("Trigger"); |
517 |
if ( !l0trig ) { |
// if ( !l0trig ) { |
518 |
if ( verbose ) printf(" TOF - ERROR: no Trigger branch in Level0 tree\n"); |
// if ( verbose ) printf(" TOF - ERROR: no Trigger branch in Level0 tree\n"); |
519 |
l0File->Close(); |
// l0File->Close(); |
520 |
code = -300; |
// code = -300; |
521 |
goto closeandexit; |
// goto closeandexit; |
522 |
}; |
// }; |
523 |
l0tof = l0tr->GetBranch("Tof"); |
l0tof = l0tr->GetBranch("Tof"); |
524 |
if ( !l0tof ) { |
if ( !l0tof ) { |
525 |
if ( verbose ) printf(" TOF - ERROR: no ToF branch in Level0 tree\n"); |
if ( verbose ) printf(" TOF - ERROR: no ToF branch in Level0 tree\n"); |
528 |
goto closeandexit; |
goto closeandexit; |
529 |
}; |
}; |
530 |
// |
// |
531 |
l0tr->SetBranchAddress("Trigger", &trig); |
// l0tr->SetBranchAddress("Trigger", &trig); |
532 |
l0tr->SetBranchAddress("Tof", &tofEvent); |
l0tr->SetBranchAddress("Tof", &tofEvent); |
533 |
l0tr->SetBranchAddress("Header", &eh); |
l0tr->SetBranchAddress("Header", &eh); |
534 |
// |
// |
646 |
// |
// |
647 |
// WM reading parameter file for dE/dx II order corrections |
// WM reading parameter file for dE/dx II order corrections |
648 |
// |
// |
649 |
memset(dedx_corr_m,0,100*48*sizeof(Float_t)); |
//memset(dedx_corr_m,0,100*48*sizeof(Float_t)); |
650 |
memset(dedx_corr,0,48*sizeof(Float_t)); |
//memset(dedx_corr,0,48*sizeof(Float_t)); |
651 |
|
//memset(mtime,0,100*sizeof(Double_t)); |
652 |
|
|
653 |
|
// |
654 |
|
// RC reading parameter file for new dE/dx II order correction (10th red) |
655 |
|
// |
656 |
|
memset(dedx_Hepeak_m,0,100*48*sizeof(Float_t)); |
657 |
|
memset(dedx_ppeak_m,0,100*48*sizeof(Float_t)); |
658 |
|
memset(dedx_Hepeak,0,48*sizeof(Float_t)); |
659 |
|
memset(dedx_ppeak,0,48*sizeof(Float_t)); |
660 |
memset(mtime,0,100*sizeof(Double_t)); |
memset(mtime,0,100*sizeof(Double_t)); |
661 |
|
|
662 |
// |
// |
663 |
// Query the DB to get the file |
// Query the DB to get the file |
664 |
// |
// |
679 |
UInt_t window = 200000; |
UInt_t window = 200000; |
680 |
Bool_t first = true; |
Bool_t first = true; |
681 |
Bool_t last = true; |
Bool_t last = true; |
682 |
Float_t sdedx_corr_m[48]; |
//Float_t sdedx_corr_m[48]; |
683 |
memset(sdedx_corr_m,0,48*sizeof(Float_t)); |
//memset(sdedx_corr_m,0,48*sizeof(Float_t)); |
684 |
|
|
685 |
|
Float_t sdedx_Hepeak_m[48]; |
686 |
|
memset(sdedx_Hepeak_m,0,48*sizeof(Float_t)); |
687 |
|
Float_t sdedx_ppeak_m[48]; |
688 |
|
memset(sdedx_ppeak_m,0,48*sizeof(Float_t)); |
689 |
|
|
690 |
Double_t stm = 0; |
Double_t stm = 0; |
691 |
while ( !fin.eof() ){ |
while ( !fin.eof() ){ |
692 |
stm = tm; |
stm = tm; |
708 |
fin>>wj>>xmean1>>xwidth1; |
fin>>wj>>xmean1>>xwidth1; |
709 |
if ( (tm >= (runinfo->RUNHEADER_TIME-window) && tm <= (runinfo->RUNTRAILER_TIME+window)) || (tm > (runinfo->RUNTRAILER_TIME+window) && last) ){ |
if ( (tm >= (runinfo->RUNHEADER_TIME-window) && tm <= (runinfo->RUNTRAILER_TIME+window)) || (tm > (runinfo->RUNTRAILER_TIME+window) && last) ){ |
710 |
if ( first ){ |
if ( first ){ |
711 |
dedx_corr_m[jj-1][ii]=sdedx_corr_m[ii]; |
//dedx_corr_m[jj-1][ii]=sdedx_corr_m[ii]; |
712 |
|
|
713 |
|
dedx_Hepeak_m[jj-1][ii]=sdedx_Hepeak_m[ii]; |
714 |
|
dedx_ppeak_m[jj-1][ii]=sdedx_ppeak_m[ii]; |
715 |
}; |
}; |
716 |
dedx_corr_m[jj][ii]=xmean1; |
//dedx_corr_m[jj][ii]=xmean1; |
717 |
|
|
718 |
|
dedx_Hepeak_m[jj][ii]=xmean1; |
719 |
|
dedx_ppeak_m[jj][ii]=xwidth1; |
720 |
}; |
}; |
721 |
sdedx_corr_m[ii]=xmean1; // BUG sdedx should be the previous in time not the previous saved [absurd dE/dx for 8th reduction March and > March 2008 data - fixed on 2009/02/04 |
//sdedx_corr_m[ii]=xmean1; // BUG sdedx should be the previous in time not the previous saved [absurd dE/dx for 8th reduction March and > March 2008 data - fixed on 2009/02/04 |
722 |
|
sdedx_Hepeak_m[ii]=xmean1; |
723 |
|
sdedx_ppeak_m[ii]=xwidth1; |
724 |
|
|
725 |
}; |
}; |
726 |
if ( (tm >= (runinfo->RUNHEADER_TIME-window) && tm <= (runinfo->RUNTRAILER_TIME+window)) || (tm > (runinfo->RUNTRAILER_TIME+window) && last)){ |
if ( (tm >= (runinfo->RUNHEADER_TIME-window) && tm <= (runinfo->RUNTRAILER_TIME+window)) || (tm > (runinfo->RUNTRAILER_TIME+window) && last)){ |
727 |
if ( first ) first = false; |
if ( first ) first = false; |
805 |
code = -313; |
code = -313; |
806 |
goto closeandexit; |
goto closeandexit; |
807 |
}; |
}; |
808 |
|
if ( itr > nevtrgl2 ){ // nevtrgl2 trigger entry number |
809 |
|
if ( verbose ) printf(" TOF - ERROR: no trigger events with entry = %i in Level2 file\n",itr); |
810 |
|
l0File->Close(); |
811 |
|
code = -319; |
812 |
|
goto closeandexit; |
813 |
|
}; |
814 |
// |
// |
815 |
trk->Clear(); |
trk->Clear(); |
816 |
|
trg->Clear(); |
817 |
// |
// |
818 |
if ( tracker->GetEntry(itr) <= 0 ) throw -36; |
if ( tracker->GetEntry(itr) <= 0 ) throw -36; |
819 |
|
if ( trigger->GetEntry(itr) <= 0 ) throw -36; |
820 |
/// |
/// |
821 |
// |
// |
822 |
if ( l0tof->GetEntry(re) <= 0 ) throw -36; |
if ( l0tof->GetEntry(re) <= 0 ) throw -36; |
823 |
if ( l0trig->GetEntry(re) <= 0 ) throw -36; |
// if ( l0trig->GetEntry(re) <= 0 ) throw -36; |
824 |
/// |
/// |
825 |
// |
// |
826 |
procev++; |
procev++; |
852 |
thelp1 = mtime[ical]; |
thelp1 = mtime[ical]; |
853 |
thelp2 = mtime[ical+1]; |
thelp2 = mtime[ical+1]; |
854 |
for (ii=0; ii<48;ii++) { |
for (ii=0; ii<48;ii++) { |
855 |
yhelp1 = fabs(dedx_corr_m[ical][ii]); |
//yhelp1 = fabs(dedx_corr_m[ical][ii]); |
856 |
if ( yhelp1 < 0.1 ) yhelp1 = 4.; |
//if ( yhelp1 < 0.1 ) yhelp1 = 4.; |
857 |
yhelp2 = fabs(dedx_corr_m[ical+1][ii]); |
//yhelp2 = fabs(dedx_corr_m[ical+1][ii]); |
858 |
if ( yhelp2 < 0.1 ) yhelp2 = 4.; |
//if ( yhelp2 < 0.1 ) yhelp2 = 4.; |
859 |
slope = (yhelp2-yhelp1)/(thelp2-thelp1); |
//slope = (yhelp2-yhelp1)/(thelp2-thelp1); |
860 |
inter = yhelp1 - slope*thelp1; |
//inter = yhelp1 - slope*thelp1; |
861 |
dedx_corr[ii] = slope*atime + inter; |
//dedx_corr[ii] = slope*atime + inter; |
862 |
if ( fabs(dedx_corr[ii]) <= 1e-15 ){ |
|
863 |
if ( verbose ) printf("ii %i slope %f atime %u inter %f dedx_corr %f \n",ii,slope,atime,inter,dedx_corr[ii]); |
Heyhelp1 = fabs(dedx_Hepeak_m[ical][ii]); |
864 |
if ( verbose ) printf("ical %i yhelp2 %f yhelp1 %f thelp2 %f thelp1 %f \n",ical,yhelp2,yhelp1,thelp2,thelp1); |
if ( Heyhelp1 < 0.1 ) Heyhelp1 = 4.; |
865 |
|
Heyhelp2 = fabs(dedx_Hepeak_m[ical+1][ii]); |
866 |
|
if ( Heyhelp2 < 0.1 ) Heyhelp2 = 4.; |
867 |
|
Heslope = (Heyhelp2-Heyhelp1)/(thelp2-thelp1); |
868 |
|
Heinter = Heyhelp1 - Heslope*thelp1; |
869 |
|
dedx_Hepeak[ii] = Heslope*atime + Heinter; |
870 |
|
|
871 |
|
pyhelp1 = fabs(dedx_ppeak_m[ical][ii]); |
872 |
|
if ( pyhelp1 < 0.1 ) pyhelp1 = 1.; |
873 |
|
pyhelp2 = fabs(dedx_ppeak_m[ical+1][ii]); |
874 |
|
if ( pyhelp2 < 0.1 ) pyhelp2 = 1.; |
875 |
|
pslope = (pyhelp2-pyhelp1)/(thelp2-thelp1); |
876 |
|
pinter = pyhelp1 - pslope*thelp1; |
877 |
|
dedx_ppeak[ii] = pslope*atime + pinter; |
878 |
|
|
879 |
|
if(dedx_Hepeak[ii]>dedx_ppeak[ii])slope_dedx[ii]=3./(dedx_Hepeak[ii]-dedx_ppeak[ii]); |
880 |
|
else slope_dedx[ii]=4.; |
881 |
|
if(dedx_Hepeak[ii]>dedx_ppeak[ii])inter_dedx[ii]=1.-(slope_dedx[ii]*dedx_ppeak[ii]); |
882 |
|
else inter_dedx[ii]=0.; |
883 |
|
|
884 |
|
|
885 |
|
//if ( fabs(dedx_corr[ii]) <= 1e-15 ){ |
886 |
|
if ( fabs(dedx_ppeak[ii]) <= 1e-15 ){ |
887 |
|
//if ( verbose ) printf("ii %i slope %f atime %u inter %f dedx_corr %f \n",ii,slope,atime,inter,dedx_corr[ii]); |
888 |
|
if ( verbose ) printf("ii %i pslope %f atime %u pinter %f dedx_ppeak %f \n",ii,pslope,atime,pinter,dedx_ppeak[ii]); |
889 |
|
//if ( verbose ) printf("ical %i yhelp2 %f yhelp1 %f thelp2 %f thelp1 %f \n",ical,yhelp2,yhelp1,thelp2,thelp1); |
890 |
|
if ( verbose ) printf("ical %i pyhelp2 %f pyhelp1 %f thelp2 %f thelp1 %f \n",ical,pyhelp2,pyhelp1,thelp2,thelp1); |
891 |
code = -316; |
code = -316; |
892 |
goto closeandexit; |
goto closeandexit; |
893 |
}; |
}; |
899 |
// |
// |
900 |
for (Int_t gg=0; gg<4;gg++){ |
for (Int_t gg=0; gg<4;gg++){ |
901 |
for (Int_t hh=0; hh<12;hh++){ |
for (Int_t hh=0; hh<12;hh++){ |
902 |
tofinput_.tdc[hh][gg]=tofEvent->tdc[gg][hh]; |
tofinput_.tdc[hh][gg] = (0xFFF & tofEvent->tdc[gg][hh]); // exclude warning bits |
903 |
tofinput_.adc[hh][gg]=tofEvent->adc[gg][hh]; |
tofinput_.adc[hh][gg] = (0xFFF & tofEvent->adc[gg][hh]); // exclude warning bits |
904 |
}; |
}; |
905 |
}; |
}; |
906 |
// |
// |
907 |
tofdedx->Init(tofEvent); |
tofdedx->Init(tofEvent); |
908 |
|
warning = 0; |
909 |
// |
// |
910 |
for (Int_t hh=0; hh<5;hh++){ |
for (Int_t hh=0; hh<5;hh++){ |
911 |
tofinput_.patterntrig[hh]=trig->patterntrig[hh]; |
tofinput_.patterntrig[hh]=trg->patterntrig[hh]; |
912 |
}; |
}; |
913 |
// |
// |
914 |
// Here we have calibrated data, ready to be passed to the FORTRAN routine which will extract common and track-related variables. |
// Here we have calibrated data, ready to be passed to the FORTRAN routine which will extract common and track-related variables. |
1005 |
// Int_t IpaddleT=-1; |
// Int_t IpaddleT=-1; |
1006 |
tof->GetPMTPaddle(pmt_id, Iplane, Ipaddle); |
tof->GetPMTPaddle(pmt_id, Iplane, Ipaddle); |
1007 |
tof->GetPaddleGeometry(Iplane,Ipaddle,xleft,xright,yleft,yright); |
tof->GetPaddleGeometry(Iplane,Ipaddle,xleft,xright,yleft,yright); |
1008 |
if ( tofdedx->GetdEdx_pmt(pmt_id)>-1. &&((xtof_temp[Iplane]>=xleft&&xtof_temp[Iplane]<=xright) || (ytof_temp[Iplane]>=yleft&&ytof_temp[Iplane]<=yright)) ){ //attenzione:qui va inserito un controllo sulla traccia tof o sulle variabili di posizione !!!! |
if ( tofdedx->GetdEdx_pmt(pmt_id)>-1. && (inter_dedx[pmt_id]+slope_dedx[pmt_id]*tofdedx->GetdEdx_pmt(pmt_id)) > 0. &&((xtof_temp[Iplane]>=xleft&&xtof_temp[Iplane]<=xright) || (ytof_temp[Iplane]>=yleft&&ytof_temp[Iplane]<=yright)) ){ |
1009 |
t_tof->dedx.AddAt((tofdedx->GetdEdx_pmt(pmt_id)*4./dedx_corr[pmt_id]),t_tof->npmtadc); |
//t_tof->dedx.AddAt((tofdedx->GetdEdx_pmt(pmt_id)*4./dedx_corr[pmt_id]),t_tof->npmtadc); |
1010 |
|
|
1011 |
|
t_tof->dedx.AddAt((inter_dedx[pmt_id]+slope_dedx[pmt_id]*tofdedx->GetdEdx_pmt(pmt_id)),t_tof->npmtadc);// RC new dE/dx II order correction |
1012 |
|
|
1013 |
t_tof->pmtadc.AddAt(pmt_id,t_tof->npmtadc); |
t_tof->pmtadc.AddAt(pmt_id,t_tof->npmtadc); |
1014 |
t_tof->adcflag.AddAt(0,t_tof->npmtadc); // gf: Jan 09/07 |
t_tof->adcflag.AddAt(0,t_tof->npmtadc); // gf: Jan 09/07 |
1015 |
t_tof->npmtadc++; |
t_tof->npmtadc++; |
1038 |
for (Int_t hh=0; hh<12;hh++){ |
for (Int_t hh=0; hh<12;hh++){ |
1039 |
for (Int_t kk=0; kk<4;kk++){ |
for (Int_t kk=0; kk<4;kk++){ |
1040 |
// new WM |
// new WM |
1041 |
if ( tofoutput_.tdc_c[hh][kk] < 4095 || tofEvent->adc[kk][hh] < 4095 || tofEvent->tdc[kk][hh] < 4095 ){ |
if ( tofoutput_.tdc_c[hh][kk] < 4095 || (0xFFF & tofEvent->adc[kk][hh]) < 4095 || (0xFFF & tofEvent->tdc[kk][hh]) < 4095 ){ |
1042 |
// |
// |
1043 |
t_pmt->pmt_id = tof->GetPMTid(kk,hh); |
t_pmt->pmt_id = tof->GetPMTid(kk,hh); |
1044 |
t_pmt->tdc_tw = tofoutput_.tdc_c[hh][kk]; |
t_pmt->tdc_tw = tofoutput_.tdc_c[hh][kk]; |
1045 |
t_pmt->adc = (Float_t)tofEvent->adc[kk][hh]; |
t_pmt->adc = (Float_t)(0xFFF & tofEvent->adc[kk][hh]); |
1046 |
t_pmt->tdc = (Float_t)tofEvent->tdc[kk][hh]; |
t_pmt->tdc = (Float_t)(0xFFF & tofEvent->tdc[kk][hh]); |
1047 |
|
t_pmt->l0flag_adc = (Float_t)(tofEvent->adc[kk][hh]>>12); |
1048 |
|
t_pmt->l0flag_tdc = (Float_t)(tofEvent->tdc[kk][hh]>>12); |
1049 |
|
if ( t_pmt->l0flag_adc || t_pmt->l0flag_tdc ) warning |= 1 << 0; |
1050 |
// |
// |
1051 |
new(tpmt[npmtentry]) ToFPMT(*t_pmt); |
new(tpmt[npmtentry]) ToFPMT(*t_pmt); |
1052 |
npmtentry++; |
npmtentry++; |
1117 |
Int_t IpaddleT=-1; |
Int_t IpaddleT=-1; |
1118 |
tof->GetPMTPaddle(pmt_id, Iplane, Ipaddle); |
tof->GetPMTPaddle(pmt_id, Iplane, Ipaddle); |
1119 |
IpaddleT=tof->GetPaddleIdOfTrack(t_tof->xtr_tof[Iplane],t_tof->ytr_tof[Iplane], Iplane,0.0); |
IpaddleT=tof->GetPaddleIdOfTrack(t_tof->xtr_tof[Iplane],t_tof->ytr_tof[Iplane], Iplane,0.0); |
1120 |
if ( debug ) printf(" 1nt %i pmt_id %i npmtadc %i dedx %f dedx corr %f\n",nt,pmt_id,t_tof->npmtadc,(tofdedx->GetdEdx_pmt(pmt_id)*4./dedx_corr[pmt_id]),dedx_corr[pmt_id]); |
//if ( debug ) printf(" 1nt %i pmt_id %i npmtadc %i dedx %f dedx corr %f\n",nt,pmt_id,t_tof->npmtadc,(tofdedx->GetdEdx_pmt(pmt_id)*4./dedx_corr[pmt_id]),dedx_corr[pmt_id]); |
1121 |
if ( tofdedx->GetdEdx_pmt(pmt_id) > -1. && Ipaddle==IpaddleT ){ |
if ( debug ) printf(" 1nt %i pmt_id %i npmtadc %i dedx %f dedx slope %f dedx inter %f\n",nt,pmt_id,t_tof->npmtadc,(inter_dedx[pmt_id]+slope_dedx[pmt_id]*tofdedx->GetdEdx_pmt(pmt_id)),inter_dedx[pmt_id],slope_dedx[pmt_id]); |
1122 |
t_tof->dedx.AddAt((tofdedx->GetdEdx_pmt(pmt_id)*4./dedx_corr[pmt_id]),t_tof->npmtadc); |
if ( tofdedx->GetdEdx_pmt(pmt_id) > -1. && (inter_dedx[pmt_id]+slope_dedx[pmt_id]*tofdedx->GetdEdx_pmt(pmt_id)) > 0. && Ipaddle==IpaddleT ){ |
1123 |
if ( debug ) printf(" 2nt %i npmtadc %i dedx %f dedx corr %f\n",nt,t_tof->npmtadc,(tofdedx->GetdEdx_pmt(pmt_id)*4./dedx_corr[pmt_id]),dedx_corr[pmt_id]); |
//t_tof->dedx.AddAt((tofdedx->GetdEdx_pmt(pmt_id)*4./dedx_corr[pmt_id]),t_tof->npmtadc); |
1124 |
|
|
1125 |
|
t_tof->dedx.AddAt((inter_dedx[pmt_id]+slope_dedx[pmt_id]*tofdedx->GetdEdx_pmt(pmt_id)),t_tof->npmtadc);// RC new dE/dx II order correction |
1126 |
|
|
1127 |
|
//if ( debug ) printf(" 2nt %i npmtadc %i dedx %f dedx corr %f\n",nt,t_tof->npmtadc,(tofdedx->GetdEdx_pmt(pmt_id)*4./dedx_corr[pmt_id]),dedx_corr[pmt_id]); |
1128 |
|
if ( debug ) printf(" 2nt %i npmtadc %i dedx %f dedx slope %f dedx inter %f\n",nt,t_tof->npmtadc,(inter_dedx[pmt_id]+slope_dedx[pmt_id]*tofdedx->GetdEdx_pmt(pmt_id)),inter_dedx[pmt_id],slope_dedx[pmt_id]); |
1129 |
t_tof->pmtadc.AddAt(pmt_id,t_tof->npmtadc); |
t_tof->pmtadc.AddAt(pmt_id,t_tof->npmtadc); |
1130 |
t_tof->adcflag.AddAt(0,t_tof->npmtadc); // gf: Jan 09/07 |
t_tof->adcflag.AddAt(0,t_tof->npmtadc); // gf: Jan 09/07 |
1131 |
t_tof->npmtadc++; |
t_tof->npmtadc++; |
1158 |
}; |
}; |
1159 |
// |
// |
1160 |
tof->unpackError = tofEvent->unpackError; |
tof->unpackError = tofEvent->unpackError; |
1161 |
|
|
1162 |
|
a = 0; |
1163 |
|
b = 0; |
1164 |
|
if ( !tof->checkPMTpatternPMThit(trg, a, b) ) warning |= 1 << 1; |
1165 |
|
if ( !tof->checkPMTpmttrig(trg) ) warning |= 1 << 2; |
1166 |
|
if ( !trg->checkPMTpatterntrig() ) warning |= 1 << 3; |
1167 |
|
tof->unpackWarning = warning; |
1168 |
|
|
1169 |
if ( defcal ){ |
if ( defcal ){ |
1170 |
tof->default_calib = 1; |
tof->default_calib = 1; |
1171 |
} else { |
} else { |