3 |
* \author Gianfranca DeRosa, Wolfgang Menn |
* \author Gianfranca DeRosa, Wolfgang Menn |
4 |
*/ |
*/ |
5 |
|
|
|
#include <TObject.h> |
|
6 |
#include <ToFLevel2.h> |
#include <ToFLevel2.h> |
7 |
#include <iostream> |
|
8 |
using namespace std; |
using namespace std; |
9 |
|
|
10 |
ClassImp(ToFPMT); |
ClassImp(ToFPMT); |
11 |
ClassImp(ToFTrkVar); |
ClassImp(ToFTrkVar); |
12 |
ClassImp(ToFLevel2); |
ClassImp(ToFLevel2); |
508 |
|
|
509 |
}; |
}; |
510 |
|
|
511 |
|
// wm jun 08 |
512 |
|
Int_t ToFLevel2::GetPaddleIdOfTrack(Float_t xtr, Float_t ytr, Int_t plane){ |
513 |
|
return GetPaddleIdOfTrack(xtr ,ytr ,plane, 0.4); |
514 |
|
} |
515 |
|
|
516 |
// gf Apr 07 |
// gf Apr 07 |
517 |
Int_t ToFLevel2::GetPaddleIdOfTrack(Float_t xtr, Float_t ytr, Int_t plane){ |
// wm jun 08 introduced a margin as input parameter |
518 |
|
Int_t ToFLevel2::GetPaddleIdOfTrack(Float_t xtr, Float_t ytr, Int_t plane, Float_t margin){ |
519 |
|
|
520 |
Double_t xt,yt,xl,xh,yl,yh; |
Double_t xt,yt,xl,xh,yl,yh; |
521 |
|
|
546 |
yh = 33.0/2. ; |
yh = 33.0/2. ; |
547 |
if ((yt>yl)&&(yt<yh)) { |
if ((yt>yl)&&(yt<yh)) { |
548 |
for (Int_t i1=0; i1<8;i1++){ |
for (Int_t i1=0; i1<8;i1++){ |
549 |
xl = tof11_x[i1] - (5.1-0.4)/2. ; |
xl = tof11_x[i1] - (5.1-margin)/2. ; |
550 |
xh = tof11_x[i1] + (5.1-0.4)/2. ; |
xh = tof11_x[i1] + (5.1-margin)/2. ; |
551 |
if ((xt>xl)&&(xt<xh)) paddleidoftrack=i1; |
if ((xt>xl)&&(xt<xh)) paddleidoftrack=i1; |
552 |
} |
} |
553 |
} |
} |
564 |
|
|
565 |
if ((xt>xl)&&(xt<xh)) { |
if ((xt>xl)&&(xt<xh)) { |
566 |
for (Int_t i1=0; i1<6;i1++){ |
for (Int_t i1=0; i1<6;i1++){ |
567 |
yl = tof12_y[i1] - (5.5-0.4)/2. ; |
yl = tof12_y[i1] - (5.5-margin)/2. ; |
568 |
yh = tof12_y[i1] + (5.5-0.4)/2. ; |
yh = tof12_y[i1] + (5.5-margin)/2. ; |
569 |
if ((yt>yl)&&(yt<yh)) paddleidoftrack=i1; |
if ((yt>yl)&&(yt<yh)) paddleidoftrack=i1; |
570 |
} |
} |
571 |
} |
} |
582 |
|
|
583 |
if ((xt>xl)&&(xt<xh)) { |
if ((xt>xl)&&(xt<xh)) { |
584 |
for (Int_t i1=0; i1<2;i1++){ |
for (Int_t i1=0; i1<2;i1++){ |
585 |
yl = tof21_y[i1] - (7.5-0.4)/2. ; |
yl = tof21_y[i1] - (7.5-margin)/2. ; |
586 |
yh = tof21_y[i1] + (7.5-0.4)/2. ; |
yh = tof21_y[i1] + (7.5-margin)/2. ; |
587 |
if ((yt>yl)&&(yt<yh)) paddleidoftrack=i1; |
if ((yt>yl)&&(yt<yh)) paddleidoftrack=i1; |
588 |
} |
} |
589 |
} |
} |
599 |
|
|
600 |
if ((yt>yl)&&(yt<yh)) { |
if ((yt>yl)&&(yt<yh)) { |
601 |
for (Int_t i1=0; i1<2;i1++){ |
for (Int_t i1=0; i1<2;i1++){ |
602 |
xl = tof22_x[i1] - (9.0-0.4)/2. ; |
xl = tof22_x[i1] - (9.0-margin)/2. ; |
603 |
xh = tof22_x[i1] + (9.0-0.4)/2. ; |
xh = tof22_x[i1] + (9.0-margin)/2. ; |
604 |
if ((xt>xl)&&(xt<xh)) paddleidoftrack=i1; |
if ((xt>xl)&&(xt<xh)) paddleidoftrack=i1; |
605 |
} |
} |
606 |
} |
} |
616 |
|
|
617 |
if ((yt>yl)&&(yt<yh)) { |
if ((yt>yl)&&(yt<yh)) { |
618 |
for (Int_t i1=0; i1<3;i1++){ |
for (Int_t i1=0; i1<3;i1++){ |
619 |
xl = tof31_x[i1] - (6.0-0.4)/2. ; |
xl = tof31_x[i1] - (6.0-margin)/2. ; |
620 |
xh = tof31_x[i1] + (6.0-0.4)/2. ; |
xh = tof31_x[i1] + (6.0-margin)/2. ; |
621 |
if ((xt>xl)&&(xt<xh)) paddleidoftrack=i1; |
if ((xt>xl)&&(xt<xh)) paddleidoftrack=i1; |
622 |
} |
} |
623 |
} |
} |
633 |
|
|
634 |
if ((xt>xl)&&(xt<xh)) { |
if ((xt>xl)&&(xt<xh)) { |
635 |
for (Int_t i1=0; i1<3;i1++){ |
for (Int_t i1=0; i1<3;i1++){ |
636 |
yl = tof32_y[i1] - (5.0-0.4)/2. ; |
yl = tof32_y[i1] - (5.0-margin)/2. ; |
637 |
yh = tof32_y[i1] + (5.0-0.4)/2. ; |
yh = tof32_y[i1] + (5.0-margin)/2. ; |
638 |
if ((yt>yl)&&(yt<yh)) paddleidoftrack=i1; |
if ((yt>yl)&&(yt<yh)) paddleidoftrack=i1; |
639 |
} |
} |
640 |
} |
} |
701 |
// gf Apr 07 |
// gf Apr 07 |
702 |
|
|
703 |
void ToFLevel2::GetPaddlePMT(Int_t paddle, Int_t &pmtleft, Int_t &pmtright){ |
void ToFLevel2::GetPaddlePMT(Int_t paddle, Int_t &pmtleft, Int_t &pmtright){ |
704 |
|
pmtleft=paddle*2; |
705 |
if(paddle==0){ |
pmtright= pmtleft+1; |
|
pmtleft=0; |
|
|
pmtright=1; |
|
|
} |
|
|
|
|
|
if(paddle==1){ |
|
|
pmtleft=2; |
|
|
pmtright=3; |
|
|
} |
|
|
|
|
|
if(paddle==2){ |
|
|
pmtleft=4; |
|
|
pmtright=5; |
|
|
} |
|
|
|
|
|
if(paddle==3){ |
|
|
pmtleft=6; |
|
|
pmtright=7; |
|
|
} |
|
|
|
|
|
if(paddle==4){ |
|
|
pmtleft=8; |
|
|
pmtright=9; |
|
|
} |
|
|
|
|
|
if(paddle==5){ |
|
|
pmtleft=10; |
|
|
pmtright=11; |
|
|
} |
|
|
|
|
|
if(paddle==6){ |
|
|
pmtleft=12; |
|
|
pmtright=13; |
|
|
} |
|
|
|
|
|
if(paddle==7){ |
|
|
pmtleft=14; |
|
|
pmtright=15; |
|
|
} |
|
|
|
|
|
if(paddle==8){ |
|
|
pmtleft=16; |
|
|
pmtright=17; |
|
|
} |
|
|
|
|
|
if(paddle==9){ |
|
|
pmtleft=18; |
|
|
pmtright=19; |
|
|
} |
|
|
|
|
|
if(paddle==10){ |
|
|
pmtleft=20; |
|
|
pmtright=21; |
|
|
} |
|
|
|
|
|
if(paddle==11){ |
|
|
pmtleft=22; |
|
|
pmtright=23; |
|
|
} |
|
|
|
|
|
if(paddle==12){ |
|
|
pmtleft=24; |
|
|
pmtright=25; |
|
|
} |
|
|
|
|
|
if(paddle==13){ |
|
|
pmtleft=26; |
|
|
pmtright=27; |
|
|
} |
|
|
|
|
|
if(paddle==14){ |
|
|
pmtleft=28; |
|
|
pmtright=29; |
|
|
} |
|
|
|
|
|
if(paddle==15){ |
|
|
pmtleft=30; |
|
|
pmtright=31; |
|
|
} |
|
|
|
|
|
if(paddle==16){ |
|
|
pmtleft=32; |
|
|
pmtright=33; |
|
|
} |
|
|
|
|
|
if(paddle==17){ |
|
|
pmtleft=34; |
|
|
pmtright=35; |
|
|
} |
|
|
|
|
|
if(paddle==18){ |
|
|
pmtleft=36; |
|
|
pmtright=37; |
|
|
} |
|
|
|
|
|
if(paddle==19){ |
|
|
pmtleft=38; |
|
|
pmtright=39; |
|
|
} |
|
|
|
|
|
if(paddle==20){ |
|
|
pmtleft=40; |
|
|
pmtright=41; |
|
|
} |
|
|
|
|
|
if(paddle==21){ |
|
|
pmtleft=42; |
|
|
pmtright=43; |
|
|
} |
|
|
|
|
|
if(paddle==22){ |
|
|
pmtleft=44; |
|
|
pmtright=45; |
|
|
} |
|
|
|
|
|
if(paddle==23){ |
|
|
pmtleft=46; |
|
|
pmtright=47; |
|
|
} |
|
|
|
|
706 |
return; |
return; |
707 |
} |
} |
708 |
|
|
816 |
*/ |
*/ |
817 |
Int_t ToFLevel2::GetPaddleid(Int_t plane, Int_t paddle) |
Int_t ToFLevel2::GetPaddleid(Int_t plane, Int_t paddle) |
818 |
{ |
{ |
|
|
|
819 |
Int_t padid=-1; |
Int_t padid=-1; |
820 |
Int_t pads11=8; |
Int_t pads[6]={8,6,2,2,3,3}; |
|
Int_t pads12=6; |
|
|
Int_t pads21=2; |
|
|
Int_t pads22=2; |
|
|
Int_t pads31=3; |
|
|
// Int_t pads32=3; |
|
821 |
|
|
822 |
|
int somma=0; |
823 |
if(plane == 0){ |
int np=plane; |
824 |
padid=paddle; |
for(Int_t j=0; j<np; j++){ |
825 |
} |
somma+=pads[j]; |
|
|
|
|
if(plane == 1){ |
|
|
padid=pads11+paddle; |
|
|
} |
|
|
|
|
|
if(plane == 2){ |
|
|
padid=pads11+pads12+paddle; |
|
|
} |
|
|
|
|
|
if(plane == 3){ |
|
|
padid=pads11+pads12+pads21+paddle; |
|
|
} |
|
|
|
|
|
if(plane == 4){ |
|
|
padid=pads11+pads12+pads21+pads22+paddle; |
|
|
} |
|
|
|
|
|
if(plane == 5){ |
|
|
padid=pads11+pads12+pads21+pads22+pads31+paddle; |
|
826 |
} |
} |
827 |
|
padid=paddle+somma; |
828 |
return padid; |
return padid; |
|
|
|
829 |
} |
} |
830 |
|
|
831 |
|
|
909 |
|
|
910 |
} |
} |
911 |
|
|
|
|
|
|
|
|
912 |
/// wm feb 08 |
/// wm feb 08 |
913 |
|
|
914 |
/** |
/** |
1055 |
//////////////////////////////////////////////////// |
//////////////////////////////////////////////////// |
1056 |
|
|
1057 |
|
|
1058 |
|
|
1059 |
/** |
/** |
1060 |
* Fills a struct cToFLevel2 with values from a ToFLevel2 object (to put data into a F77 common). |
* Fills a struct cToFLevel2 with values from a ToFLevel2 object (to put data into a F77 common). |
1061 |
*/ |
*/ |
1102 |
} |
} |
1103 |
} //ELENA |
} //ELENA |
1104 |
} |
} |
1105 |
|
|
1106 |
|
|
1107 |
|
// |
1108 |
|
// Reprocessing tool // Emiliano 08/04/07 |
1109 |
|
// |
1110 |
|
Int_t ToFLevel2::Process(TrkLevel2 *trk, TrigLevel2 *trg, GL_RUN *run, OrbitalInfo *orb, Bool_t force){ |
1111 |
|
// |
1112 |
|
// Copiare qui qualcosa di simile a calonuclei per evitare di riprocessare sempre tutto |
1113 |
|
// |
1114 |
|
|
1115 |
|
|
1116 |
|
|
1117 |
|
|
1118 |
|
// |
1119 |
|
// structures to communicate with F77 |
1120 |
|
// |
1121 |
|
extern struct ToFInput tofinput_; |
1122 |
|
extern struct ToFOutput tofoutput_; |
1123 |
|
// |
1124 |
|
// DB connection |
1125 |
|
// |
1126 |
|
TString host; |
1127 |
|
TString user; |
1128 |
|
TString psw; |
1129 |
|
const char *pamdbhost=gSystem->Getenv("PAM_DBHOST"); |
1130 |
|
const char *pamdbuser=gSystem->Getenv("PAM_DBUSER"); |
1131 |
|
const char *pamdbpsw=gSystem->Getenv("PAM_DBPSW"); |
1132 |
|
if ( !pamdbhost ) pamdbhost = ""; |
1133 |
|
if ( !pamdbuser ) pamdbuser = ""; |
1134 |
|
if ( !pamdbpsw ) pamdbpsw = ""; |
1135 |
|
if ( strcmp(pamdbhost,"") ) host = pamdbhost; |
1136 |
|
if ( strcmp(pamdbuser,"") ) user = pamdbuser; |
1137 |
|
if ( strcmp(pamdbpsw,"") ) psw = pamdbpsw; |
1138 |
|
// |
1139 |
|
// |
1140 |
|
TSQLServer *dbc = TSQLServer::Connect(host.Data(),user.Data(),psw.Data()); |
1141 |
|
if ( !dbc->IsConnected() ) return 1; |
1142 |
|
stringstream myquery; |
1143 |
|
myquery.str(""); |
1144 |
|
myquery << "SET time_zone='+0:00'"; |
1145 |
|
dbc->Query(myquery.str().c_str()); |
1146 |
|
GL_PARAM *glparam = new GL_PARAM(); |
1147 |
|
glparam->Query_GL_PARAM(1,1,dbc); // parameters stored in DB in GL_PRAM table |
1148 |
|
trk->LoadField(glparam->PATH+glparam->NAME); |
1149 |
|
// |
1150 |
|
Bool_t defcal = true; |
1151 |
|
Int_t error=glparam->Query_GL_PARAM(run->RUNHEADER_TIME,201,dbc); // parameters stored in DB in GL_PRAM table |
1152 |
|
if ( error<0 ) { |
1153 |
|
return(1); |
1154 |
|
}; |
1155 |
|
printf(" Reading ToF parameter file: %s \n",(glparam->PATH+glparam->NAME).Data()); |
1156 |
|
if ( (UInt_t)glparam->TO_TIME != (UInt_t)4294967295UL ) defcal = false; |
1157 |
|
// |
1158 |
|
Int_t nlen = (Int_t)(glparam->PATH+glparam->NAME).Length(); |
1159 |
|
rdtofcal((char *)(glparam->PATH+glparam->NAME).Data(),&nlen); |
1160 |
|
// |
1161 |
|
Int_t adc[4][12]; |
1162 |
|
Int_t tdc[4][12]; |
1163 |
|
Float_t tdcc[4][12]; |
1164 |
|
// |
1165 |
|
// process tof data |
1166 |
|
// |
1167 |
|
for (Int_t hh=0; hh<12;hh++){ |
1168 |
|
for (Int_t kk=0; kk<4;kk++){ |
1169 |
|
adc[kk][hh] = 4095; |
1170 |
|
tdc[kk][hh] = 4095; |
1171 |
|
tdcc[kk][hh] = 4095.; |
1172 |
|
tofinput_.adc[hh][kk] = 4095; |
1173 |
|
tofinput_.tdc[hh][kk] = 4095; |
1174 |
|
}; |
1175 |
|
}; |
1176 |
|
Int_t ntrkentry = 0; |
1177 |
|
Int_t npmtentry = 0; |
1178 |
|
Int_t gg = 0; |
1179 |
|
Int_t hh = 0; |
1180 |
|
Int_t adcf[48]; |
1181 |
|
memset(adcf, 0, 48*sizeof(Int_t)); |
1182 |
|
Int_t tdcf[48]; |
1183 |
|
memset(tdcf, 0, 48*sizeof(Int_t)); |
1184 |
|
for (Int_t pm=0; pm < this->ntrk() ; pm++){ |
1185 |
|
ToFTrkVar *ttf = this->GetToFTrkVar(pm); |
1186 |
|
for ( Int_t nc=0; nc < ttf->npmttdc; nc++){ |
1187 |
|
if ( (ttf->tdcflag).At(nc) != 0 ) tdcf[(ttf->pmttdc).At(nc)] = 1; |
1188 |
|
}; |
1189 |
|
for ( Int_t nc=0; nc < ttf->npmtadc; nc++){ |
1190 |
|
if ( (ttf->adcflag).At(nc) != 0 ) adcf[(ttf->pmtadc).At(nc)] = 1; |
1191 |
|
}; |
1192 |
|
}; |
1193 |
|
// |
1194 |
|
for (Int_t pm=0; pm < this->npmt() ; pm++){ |
1195 |
|
ToFPMT *pmt = this->GetToFPMT(pm); |
1196 |
|
this->GetPMTIndex(pmt->pmt_id, gg, hh); |
1197 |
|
if ( adcf[pmt->pmt_id] == 0 ){ |
1198 |
|
tofinput_.adc[gg][hh] = (int)pmt->adc; |
1199 |
|
adc[hh][gg] = (int)pmt->adc; |
1200 |
|
}; |
1201 |
|
if ( tdcf[pmt->pmt_id] == 0 ){ |
1202 |
|
tofinput_.tdc[gg][hh] = (int)pmt->tdc; |
1203 |
|
tdc[hh][gg] = (int)pmt->tdc; |
1204 |
|
}; |
1205 |
|
tdcc[hh][gg] = (float)pmt->tdc_tw; |
1206 |
|
// Int_t pppid = this->GetPMTid(hh,gg); |
1207 |
|
// printf(" pm %i pmt_id %i pppid %i hh %i gg %i tdcc %f tdc %f adc %f \n",pm,pmt->pmt_id,pppid,hh,gg,pmt->tdc_tw,pmt->tdc,pmt->adc); |
1208 |
|
}; |
1209 |
|
// |
1210 |
|
Int_t unpackError = this->unpackError; |
1211 |
|
// |
1212 |
|
for (Int_t hh=0; hh<5;hh++){ |
1213 |
|
tofinput_.patterntrig[hh]=trg->patterntrig[hh]; |
1214 |
|
}; |
1215 |
|
// |
1216 |
|
this->Clear(); |
1217 |
|
// |
1218 |
|
Int_t pmt_id = 0; |
1219 |
|
ToFPMT *t_pmt = new ToFPMT(); |
1220 |
|
if(!(this->PMT)) this->PMT = new TClonesArray("ToFPMT",12); //ELENA |
1221 |
|
TClonesArray &tpmt = *this->PMT; |
1222 |
|
ToFTrkVar *t_tof = new ToFTrkVar(); |
1223 |
|
if(!(this->ToFTrk)) this->ToFTrk = new TClonesArray("ToFTrkVar",2); //ELENA |
1224 |
|
TClonesArray &t = *this->ToFTrk; |
1225 |
|
// |
1226 |
|
// |
1227 |
|
// Here we have calibrated data, ready to be passed to the FORTRAN routine which will extract common and track-related variables. |
1228 |
|
// |
1229 |
|
npmtentry = 0; |
1230 |
|
// |
1231 |
|
ntrkentry = 0; |
1232 |
|
// |
1233 |
|
// Calculate tracks informations from ToF alone |
1234 |
|
// |
1235 |
|
tofl2com(); |
1236 |
|
// |
1237 |
|
memcpy(this->tof_j_flag,tofoutput_.tof_j_flag,6*sizeof(Int_t)); |
1238 |
|
// |
1239 |
|
t_tof->trkseqno = -1; |
1240 |
|
// |
1241 |
|
// and now we must copy from the output structure to the level2 class: |
1242 |
|
// |
1243 |
|
t_tof->npmttdc = 0; |
1244 |
|
// |
1245 |
|
for (Int_t hh=0; hh<12;hh++){ |
1246 |
|
for (Int_t kk=0; kk<4;kk++){ |
1247 |
|
if ( tofoutput_.tofmask[hh][kk] != 0 ){ |
1248 |
|
pmt_id = this->GetPMTid(kk,hh); |
1249 |
|
t_tof->pmttdc.AddAt(pmt_id,t_tof->npmttdc); |
1250 |
|
t_tof->tdcflag.AddAt(tofoutput_.tdcflagtof[hh][kk],t_tof->npmttdc); // gf: Jan 09/07 |
1251 |
|
t_tof->npmttdc++; |
1252 |
|
}; |
1253 |
|
}; |
1254 |
|
}; |
1255 |
|
for (Int_t kk=0; kk<13;kk++){ |
1256 |
|
t_tof->beta[kk] = tofoutput_.betatof_a[kk]; |
1257 |
|
} |
1258 |
|
// |
1259 |
|
t_tof->npmtadc = 0; |
1260 |
|
for (Int_t hh=0; hh<12;hh++){ |
1261 |
|
for (Int_t kk=0; kk<4;kk++){ |
1262 |
|
if ( tofoutput_.adctof_c[hh][kk] < 1000 ){ |
1263 |
|
t_tof->dedx.AddAt(tofoutput_.adctof_c[hh][kk],t_tof->npmtadc); |
1264 |
|
pmt_id = this->GetPMTid(kk,hh); |
1265 |
|
t_tof->pmtadc.AddAt(pmt_id,t_tof->npmtadc); |
1266 |
|
t_tof->adcflag.AddAt(tofoutput_.adcflagtof[hh][kk],t_tof->npmtadc); // gf: Jan 09/07 |
1267 |
|
t_tof->npmtadc++; |
1268 |
|
}; |
1269 |
|
}; |
1270 |
|
}; |
1271 |
|
// |
1272 |
|
memcpy(t_tof->xtofpos,tofoutput_.xtofpos,sizeof(t_tof->xtofpos)); |
1273 |
|
memcpy(t_tof->ytofpos,tofoutput_.ytofpos,sizeof(t_tof->ytofpos)); |
1274 |
|
memcpy(t_tof->xtr_tof,tofoutput_.xtr_tof,sizeof(t_tof->xtr_tof)); |
1275 |
|
memcpy(t_tof->ytr_tof,tofoutput_.ytr_tof,sizeof(t_tof->ytr_tof)); |
1276 |
|
// |
1277 |
|
new(t[ntrkentry]) ToFTrkVar(*t_tof); |
1278 |
|
ntrkentry++; |
1279 |
|
t_tof->Clear(); |
1280 |
|
// |
1281 |
|
// |
1282 |
|
// |
1283 |
|
t_pmt->Clear(); |
1284 |
|
// |
1285 |
|
for (Int_t hh=0; hh<12;hh++){ |
1286 |
|
for (Int_t kk=0; kk<4;kk++){ |
1287 |
|
// new WM |
1288 |
|
if ( tofoutput_.tdc_c[hh][kk] < 4095 || adc[kk][hh] < 4095 || tdc[kk][hh] < 4095 ){ |
1289 |
|
// if ( tdcc[kk][hh] < 4095. || adc[kk][hh] < 4095 || tdc[kk][hh] < 4095 ){ |
1290 |
|
// |
1291 |
|
t_pmt->pmt_id = this->GetPMTid(kk,hh); |
1292 |
|
t_pmt->tdc_tw = tofoutput_.tdc_c[hh][kk]; |
1293 |
|
t_pmt->adc = (Float_t)adc[kk][hh]; |
1294 |
|
t_pmt->tdc = (Float_t)tdc[kk][hh]; |
1295 |
|
// |
1296 |
|
new(tpmt[npmtentry]) ToFPMT(*t_pmt); |
1297 |
|
npmtentry++; |
1298 |
|
t_pmt->Clear(); |
1299 |
|
}; |
1300 |
|
}; |
1301 |
|
}; |
1302 |
|
// |
1303 |
|
// Calculate track-related variables |
1304 |
|
// |
1305 |
|
if ( trk->ntrk() > 0 ){ |
1306 |
|
// |
1307 |
|
// We have at least one track |
1308 |
|
// |
1309 |
|
// |
1310 |
|
// Run over tracks |
1311 |
|
// |
1312 |
|
for(Int_t nt=0; nt < trk->ntrk(); nt++){ |
1313 |
|
// |
1314 |
|
TrkTrack *ptt = trk->GetStoredTrack(nt); |
1315 |
|
// |
1316 |
|
// Copy the alpha vector in the input structure |
1317 |
|
// |
1318 |
|
for (Int_t e = 0; e < 5 ; e++){ |
1319 |
|
tofinput_.al_pp[e] = ptt->al[e]; |
1320 |
|
}; |
1321 |
|
// |
1322 |
|
// Get tracker related variables for this track |
1323 |
|
// |
1324 |
|
toftrk(); |
1325 |
|
// |
1326 |
|
// Copy values in the class from the structure (we need to use a temporary class to store variables). |
1327 |
|
// |
1328 |
|
t_tof->npmttdc = 0; |
1329 |
|
for (Int_t hh=0; hh<12;hh++){ |
1330 |
|
for (Int_t kk=0; kk<4;kk++){ |
1331 |
|
if ( tofoutput_.tofmask[hh][kk] != 0 ){ |
1332 |
|
pmt_id = this->GetPMTid(kk,hh); |
1333 |
|
t_tof->pmttdc.AddAt(pmt_id,t_tof->npmttdc); |
1334 |
|
t_tof->tdcflag.AddAt(tofoutput_.tdcflag[hh][kk],t_tof->npmttdc); // gf: Jan 09/07 |
1335 |
|
t_tof->npmttdc++; |
1336 |
|
}; |
1337 |
|
}; |
1338 |
|
}; |
1339 |
|
for (Int_t kk=0; kk<13;kk++){ |
1340 |
|
t_tof->beta[kk] = tofoutput_.beta_a[kk]; |
1341 |
|
}; |
1342 |
|
// |
1343 |
|
t_tof->npmtadc = 0; |
1344 |
|
for (Int_t hh=0; hh<12;hh++){ |
1345 |
|
for (Int_t kk=0; kk<4;kk++){ |
1346 |
|
if ( tofoutput_.adc_c[hh][kk] < 1000 ){ |
1347 |
|
t_tof->dedx.AddAt(tofoutput_.adc_c[hh][kk],t_tof->npmtadc); |
1348 |
|
pmt_id = this->GetPMTid(kk,hh); |
1349 |
|
t_tof->pmtadc.AddAt(pmt_id,t_tof->npmtadc); |
1350 |
|
t_tof->adcflag.AddAt(tofoutput_.adcflag[hh][kk],t_tof->npmtadc); // gf: Jan 09/07 |
1351 |
|
t_tof->npmtadc++; |
1352 |
|
}; |
1353 |
|
}; |
1354 |
|
}; |
1355 |
|
// |
1356 |
|
memcpy(t_tof->xtofpos,tofoutput_.xtofpos,sizeof(t_tof->xtofpos)); |
1357 |
|
memcpy(t_tof->ytofpos,tofoutput_.ytofpos,sizeof(t_tof->ytofpos)); |
1358 |
|
memcpy(t_tof->xtr_tof,tofoutput_.xtr_tof,sizeof(t_tof->xtr_tof)); |
1359 |
|
memcpy(t_tof->ytr_tof,tofoutput_.ytr_tof,sizeof(t_tof->ytr_tof)); |
1360 |
|
// |
1361 |
|
// Store the tracker track number in order to be sure to have shyncronized data during analysis |
1362 |
|
// |
1363 |
|
t_tof->trkseqno = nt; |
1364 |
|
// |
1365 |
|
// create a new object for this event with track-related variables |
1366 |
|
// |
1367 |
|
new(t[ntrkentry]) ToFTrkVar(*t_tof); |
1368 |
|
ntrkentry++; |
1369 |
|
t_tof->Clear(); |
1370 |
|
// |
1371 |
|
}; // loop on all the tracks |
1372 |
|
// |
1373 |
|
this->unpackError = unpackError; |
1374 |
|
if ( defcal ){ |
1375 |
|
this->default_calib = 1; |
1376 |
|
} else { |
1377 |
|
this->default_calib = 0; |
1378 |
|
}; |
1379 |
|
}; |
1380 |
|
|
1381 |
|
|
1382 |
|
|
1383 |
|
return(0); |
1384 |
|
} |