1149 |
// |
// |
1150 |
// Copiare qui qualcosa di simile a calonuclei per evitare di riprocessare sempre tutto |
// Copiare qui qualcosa di simile a calonuclei per evitare di riprocessare sempre tutto |
1151 |
// |
// |
1152 |
|
printf("\n\n\n ERROR: NOT IMPLEMENTED ANYMORE, write Emiliano if you need this method (Emiliano.Mocchiutti@ts.infn.it) \n\n\n"); |
1153 |
|
return(-1); |
1154 |
|
// // |
1155 |
|
// // structures to communicate with F77 |
1156 |
// |
// // |
1157 |
// structures to communicate with F77 |
// extern struct ToFInput tofinput_; |
1158 |
// |
// extern struct ToFOutput tofoutput_; |
1159 |
extern struct ToFInput tofinput_; |
// // |
1160 |
extern struct ToFOutput tofoutput_; |
// // DB connection |
1161 |
// |
// // |
1162 |
// DB connection |
// TString host; |
1163 |
// |
// TString user; |
1164 |
TString host; |
// TString psw; |
1165 |
TString user; |
// const char *pamdbhost=gSystem->Getenv("PAM_DBHOST"); |
1166 |
TString psw; |
// const char *pamdbuser=gSystem->Getenv("PAM_DBUSER"); |
1167 |
const char *pamdbhost=gSystem->Getenv("PAM_DBHOST"); |
// const char *pamdbpsw=gSystem->Getenv("PAM_DBPSW"); |
1168 |
const char *pamdbuser=gSystem->Getenv("PAM_DBUSER"); |
// if ( !pamdbhost ) pamdbhost = ""; |
1169 |
const char *pamdbpsw=gSystem->Getenv("PAM_DBPSW"); |
// if ( !pamdbuser ) pamdbuser = ""; |
1170 |
if ( !pamdbhost ) pamdbhost = ""; |
// if ( !pamdbpsw ) pamdbpsw = ""; |
1171 |
if ( !pamdbuser ) pamdbuser = ""; |
// if ( strcmp(pamdbhost,"") ) host = pamdbhost; |
1172 |
if ( !pamdbpsw ) pamdbpsw = ""; |
// if ( strcmp(pamdbuser,"") ) user = pamdbuser; |
1173 |
if ( strcmp(pamdbhost,"") ) host = pamdbhost; |
// if ( strcmp(pamdbpsw,"") ) psw = pamdbpsw; |
1174 |
if ( strcmp(pamdbuser,"") ) user = pamdbuser; |
// // |
1175 |
if ( strcmp(pamdbpsw,"") ) psw = pamdbpsw; |
// // |
1176 |
// |
// TSQLServer *dbc = TSQLServer::Connect(host.Data(),user.Data(),psw.Data()); |
1177 |
// |
// if ( !dbc->IsConnected() ) return 1; |
1178 |
TSQLServer *dbc = TSQLServer::Connect(host.Data(),user.Data(),psw.Data()); |
// stringstream myquery; |
1179 |
if ( !dbc->IsConnected() ) return 1; |
// myquery.str(""); |
1180 |
stringstream myquery; |
// myquery << "SET time_zone='+0:00'"; |
1181 |
myquery.str(""); |
// dbc->Query(myquery.str().c_str()); |
1182 |
myquery << "SET time_zone='+0:00'"; |
// GL_PARAM *glparam = new GL_PARAM(); |
1183 |
dbc->Query(myquery.str().c_str()); |
// glparam->Query_GL_PARAM(1,1,dbc); // parameters stored in DB in GL_PRAM table |
1184 |
GL_PARAM *glparam = new GL_PARAM(); |
// trk->LoadField(glparam->PATH+glparam->NAME); |
1185 |
glparam->Query_GL_PARAM(1,1,dbc); // parameters stored in DB in GL_PRAM table |
// // |
1186 |
trk->LoadField(glparam->PATH+glparam->NAME); |
// Bool_t defcal = true; |
1187 |
// |
// Int_t error=glparam->Query_GL_PARAM(run->RUNHEADER_TIME,201,dbc); // parameters stored in DB in GL_PRAM table |
1188 |
Bool_t defcal = true; |
// if ( error<0 ) { |
1189 |
Int_t error=glparam->Query_GL_PARAM(run->RUNHEADER_TIME,201,dbc); // parameters stored in DB in GL_PRAM table |
// return(1); |
1190 |
if ( error<0 ) { |
// }; |
1191 |
return(1); |
// printf(" Reading ToF parameter file: %s \n",(glparam->PATH+glparam->NAME).Data()); |
1192 |
}; |
// if ( (UInt_t)glparam->TO_TIME != (UInt_t)4294967295UL ) defcal = false; |
1193 |
printf(" Reading ToF parameter file: %s \n",(glparam->PATH+glparam->NAME).Data()); |
// // |
1194 |
if ( (UInt_t)glparam->TO_TIME != (UInt_t)4294967295UL ) defcal = false; |
// Int_t nlen = (Int_t)(glparam->PATH+glparam->NAME).Length(); |
1195 |
// |
// rdtofcal((char *)(glparam->PATH+glparam->NAME).Data(),&nlen); |
1196 |
Int_t nlen = (Int_t)(glparam->PATH+glparam->NAME).Length(); |
// // |
1197 |
rdtofcal((char *)(glparam->PATH+glparam->NAME).Data(),&nlen); |
// Int_t adc[4][12]; |
1198 |
// |
// Int_t tdc[4][12]; |
1199 |
Int_t adc[4][12]; |
// Float_t tdcc[4][12]; |
1200 |
Int_t tdc[4][12]; |
// // |
1201 |
Float_t tdcc[4][12]; |
// // process tof data |
1202 |
// |
// // |
1203 |
// process tof data |
// for (Int_t hh=0; hh<12;hh++){ |
1204 |
// |
// for (Int_t kk=0; kk<4;kk++){ |
1205 |
for (Int_t hh=0; hh<12;hh++){ |
// adc[kk][hh] = 4095; |
1206 |
for (Int_t kk=0; kk<4;kk++){ |
// tdc[kk][hh] = 4095; |
1207 |
adc[kk][hh] = 4095; |
// tdcc[kk][hh] = 4095.; |
1208 |
tdc[kk][hh] = 4095; |
// tofinput_.adc[hh][kk] = 4095; |
1209 |
tdcc[kk][hh] = 4095.; |
// tofinput_.tdc[hh][kk] = 4095; |
1210 |
tofinput_.adc[hh][kk] = 4095; |
// }; |
1211 |
tofinput_.tdc[hh][kk] = 4095; |
// }; |
1212 |
}; |
// Int_t ntrkentry = 0; |
1213 |
}; |
// Int_t npmtentry = 0; |
1214 |
Int_t ntrkentry = 0; |
// Int_t gg = 0; |
1215 |
Int_t npmtentry = 0; |
// Int_t hh = 0; |
1216 |
Int_t gg = 0; |
// Int_t adcf[48]; |
1217 |
Int_t hh = 0; |
// memset(adcf, 0, 48*sizeof(Int_t)); |
1218 |
Int_t adcf[48]; |
// Int_t tdcf[48]; |
1219 |
memset(adcf, 0, 48*sizeof(Int_t)); |
// memset(tdcf, 0, 48*sizeof(Int_t)); |
1220 |
Int_t tdcf[48]; |
// for (Int_t pm=0; pm < this->ntrk() ; pm++){ |
1221 |
memset(tdcf, 0, 48*sizeof(Int_t)); |
// ToFTrkVar *ttf = this->GetToFTrkVar(pm); |
1222 |
for (Int_t pm=0; pm < this->ntrk() ; pm++){ |
// for ( Int_t nc=0; nc < ttf->npmttdc; nc++){ |
1223 |
ToFTrkVar *ttf = this->GetToFTrkVar(pm); |
// if ( (ttf->tdcflag).At(nc) != 0 ) tdcf[(ttf->pmttdc).At(nc)] = 1; |
1224 |
for ( Int_t nc=0; nc < ttf->npmttdc; nc++){ |
// }; |
1225 |
if ( (ttf->tdcflag).At(nc) != 0 ) tdcf[(ttf->pmttdc).At(nc)] = 1; |
// for ( Int_t nc=0; nc < ttf->npmtadc; nc++){ |
1226 |
}; |
// if ( (ttf->adcflag).At(nc) != 0 ) adcf[(ttf->pmtadc).At(nc)] = 1; |
1227 |
for ( Int_t nc=0; nc < ttf->npmtadc; nc++){ |
// }; |
1228 |
if ( (ttf->adcflag).At(nc) != 0 ) adcf[(ttf->pmtadc).At(nc)] = 1; |
// }; |
1229 |
}; |
// // |
1230 |
}; |
// for (Int_t pm=0; pm < this->npmt() ; pm++){ |
1231 |
// |
// ToFPMT *pmt = this->GetToFPMT(pm); |
1232 |
for (Int_t pm=0; pm < this->npmt() ; pm++){ |
// this->GetPMTIndex(pmt->pmt_id, gg, hh); |
1233 |
ToFPMT *pmt = this->GetToFPMT(pm); |
// if ( adcf[pmt->pmt_id] == 0 ){ |
1234 |
this->GetPMTIndex(pmt->pmt_id, gg, hh); |
// tofinput_.adc[gg][hh] = (int)pmt->adc; |
1235 |
if ( adcf[pmt->pmt_id] == 0 ){ |
// adc[hh][gg] = (int)pmt->adc; |
1236 |
tofinput_.adc[gg][hh] = (int)pmt->adc; |
// }; |
1237 |
adc[hh][gg] = (int)pmt->adc; |
// if ( tdcf[pmt->pmt_id] == 0 ){ |
1238 |
}; |
// tofinput_.tdc[gg][hh] = (int)pmt->tdc; |
1239 |
if ( tdcf[pmt->pmt_id] == 0 ){ |
// tdc[hh][gg] = (int)pmt->tdc; |
1240 |
tofinput_.tdc[gg][hh] = (int)pmt->tdc; |
// }; |
1241 |
tdc[hh][gg] = (int)pmt->tdc; |
// tdcc[hh][gg] = (float)pmt->tdc_tw; |
1242 |
}; |
// // Int_t pppid = this->GetPMTid(hh,gg); |
1243 |
tdcc[hh][gg] = (float)pmt->tdc_tw; |
// // 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); |
1244 |
// Int_t pppid = this->GetPMTid(hh,gg); |
// }; |
1245 |
// 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); |
// // |
1246 |
}; |
// Int_t unpackError = this->unpackError; |
1247 |
// |
// // |
1248 |
Int_t unpackError = this->unpackError; |
// for (Int_t hh=0; hh<5;hh++){ |
1249 |
// |
// tofinput_.patterntrig[hh]=trg->patterntrig[hh]; |
1250 |
for (Int_t hh=0; hh<5;hh++){ |
// }; |
1251 |
tofinput_.patterntrig[hh]=trg->patterntrig[hh]; |
// // |
1252 |
}; |
// this->Clear(); |
1253 |
// |
// // |
1254 |
this->Clear(); |
// Int_t pmt_id = 0; |
1255 |
// |
// ToFPMT *t_pmt = new ToFPMT(); |
1256 |
Int_t pmt_id = 0; |
// if(!(this->PMT)) this->PMT = new TClonesArray("ToFPMT",12); //ELENA |
1257 |
ToFPMT *t_pmt = new ToFPMT(); |
// TClonesArray &tpmt = *this->PMT; |
1258 |
if(!(this->PMT)) this->PMT = new TClonesArray("ToFPMT",12); //ELENA |
// ToFTrkVar *t_tof = new ToFTrkVar(); |
1259 |
TClonesArray &tpmt = *this->PMT; |
// if(!(this->ToFTrk)) this->ToFTrk = new TClonesArray("ToFTrkVar",2); //ELENA |
1260 |
ToFTrkVar *t_tof = new ToFTrkVar(); |
// TClonesArray &t = *this->ToFTrk; |
1261 |
if(!(this->ToFTrk)) this->ToFTrk = new TClonesArray("ToFTrkVar",2); //ELENA |
// // |
1262 |
TClonesArray &t = *this->ToFTrk; |
// // |
1263 |
// |
// // Here we have calibrated data, ready to be passed to the FORTRAN routine which will extract common and track-related variables. |
1264 |
// |
// // |
1265 |
// Here we have calibrated data, ready to be passed to the FORTRAN routine which will extract common and track-related variables. |
// npmtentry = 0; |
1266 |
// |
// // |
1267 |
npmtentry = 0; |
// ntrkentry = 0; |
1268 |
// |
// // |
1269 |
ntrkentry = 0; |
// // Calculate tracks informations from ToF alone |
1270 |
// |
// // |
1271 |
// Calculate tracks informations from ToF alone |
// tofl2com(); |
1272 |
// |
// // |
1273 |
tofl2com(); |
// memcpy(this->tof_j_flag,tofoutput_.tof_j_flag,6*sizeof(Int_t)); |
1274 |
// |
// // |
1275 |
memcpy(this->tof_j_flag,tofoutput_.tof_j_flag,6*sizeof(Int_t)); |
// t_tof->trkseqno = -1; |
1276 |
// |
// // |
1277 |
t_tof->trkseqno = -1; |
// // and now we must copy from the output structure to the level2 class: |
1278 |
// |
// // |
1279 |
// and now we must copy from the output structure to the level2 class: |
// t_tof->npmttdc = 0; |
1280 |
// |
// // |
1281 |
t_tof->npmttdc = 0; |
// for (Int_t hh=0; hh<12;hh++){ |
1282 |
// |
// for (Int_t kk=0; kk<4;kk++){ |
1283 |
for (Int_t hh=0; hh<12;hh++){ |
// if ( tofoutput_.tofmask[hh][kk] != 0 ){ |
1284 |
for (Int_t kk=0; kk<4;kk++){ |
// pmt_id = this->GetPMTid(kk,hh); |
1285 |
if ( tofoutput_.tofmask[hh][kk] != 0 ){ |
// t_tof->pmttdc.AddAt(pmt_id,t_tof->npmttdc); |
1286 |
pmt_id = this->GetPMTid(kk,hh); |
// t_tof->tdcflag.AddAt(tofoutput_.tdcflagtof[hh][kk],t_tof->npmttdc); // gf: Jan 09/07 |
1287 |
t_tof->pmttdc.AddAt(pmt_id,t_tof->npmttdc); |
// t_tof->npmttdc++; |
1288 |
t_tof->tdcflag.AddAt(tofoutput_.tdcflagtof[hh][kk],t_tof->npmttdc); // gf: Jan 09/07 |
// }; |
1289 |
t_tof->npmttdc++; |
// }; |
1290 |
}; |
// }; |
1291 |
}; |
// for (Int_t kk=0; kk<13;kk++){ |
1292 |
}; |
// t_tof->beta[kk] = tofoutput_.betatof_a[kk]; |
1293 |
for (Int_t kk=0; kk<13;kk++){ |
// } |
1294 |
t_tof->beta[kk] = tofoutput_.betatof_a[kk]; |
// // |
1295 |
} |
// t_tof->npmtadc = 0; |
1296 |
// |
// for (Int_t hh=0; hh<12;hh++){ |
1297 |
t_tof->npmtadc = 0; |
// for (Int_t kk=0; kk<4;kk++){ |
1298 |
for (Int_t hh=0; hh<12;hh++){ |
// if ( tofoutput_.adctof_c[hh][kk] < 1000 ){ |
1299 |
for (Int_t kk=0; kk<4;kk++){ |
// t_tof->dedx.AddAt(tofoutput_.adctof_c[hh][kk],t_tof->npmtadc); |
1300 |
if ( tofoutput_.adctof_c[hh][kk] < 1000 ){ |
// pmt_id = this->GetPMTid(kk,hh); |
1301 |
t_tof->dedx.AddAt(tofoutput_.adctof_c[hh][kk],t_tof->npmtadc); |
// t_tof->pmtadc.AddAt(pmt_id,t_tof->npmtadc); |
1302 |
pmt_id = this->GetPMTid(kk,hh); |
// t_tof->adcflag.AddAt(tofoutput_.adcflagtof[hh][kk],t_tof->npmtadc); // gf: Jan 09/07 |
1303 |
t_tof->pmtadc.AddAt(pmt_id,t_tof->npmtadc); |
// t_tof->npmtadc++; |
1304 |
t_tof->adcflag.AddAt(tofoutput_.adcflagtof[hh][kk],t_tof->npmtadc); // gf: Jan 09/07 |
// }; |
1305 |
t_tof->npmtadc++; |
// }; |
1306 |
}; |
// }; |
1307 |
}; |
// // |
1308 |
}; |
// memcpy(t_tof->xtofpos,tofoutput_.xtofpos,sizeof(t_tof->xtofpos)); |
1309 |
// |
// memcpy(t_tof->ytofpos,tofoutput_.ytofpos,sizeof(t_tof->ytofpos)); |
1310 |
memcpy(t_tof->xtofpos,tofoutput_.xtofpos,sizeof(t_tof->xtofpos)); |
// memcpy(t_tof->xtr_tof,tofoutput_.xtr_tof,sizeof(t_tof->xtr_tof)); |
1311 |
memcpy(t_tof->ytofpos,tofoutput_.ytofpos,sizeof(t_tof->ytofpos)); |
// memcpy(t_tof->ytr_tof,tofoutput_.ytr_tof,sizeof(t_tof->ytr_tof)); |
1312 |
memcpy(t_tof->xtr_tof,tofoutput_.xtr_tof,sizeof(t_tof->xtr_tof)); |
// // |
1313 |
memcpy(t_tof->ytr_tof,tofoutput_.ytr_tof,sizeof(t_tof->ytr_tof)); |
// new(t[ntrkentry]) ToFTrkVar(*t_tof); |
1314 |
// |
// ntrkentry++; |
1315 |
new(t[ntrkentry]) ToFTrkVar(*t_tof); |
// t_tof->Clear(); |
1316 |
ntrkentry++; |
// // |
1317 |
t_tof->Clear(); |
// // |
1318 |
// |
// // |
1319 |
// |
// t_pmt->Clear(); |
1320 |
// |
// // |
1321 |
t_pmt->Clear(); |
// for (Int_t hh=0; hh<12;hh++){ |
1322 |
// |
// for (Int_t kk=0; kk<4;kk++){ |
1323 |
for (Int_t hh=0; hh<12;hh++){ |
// // new WM |
1324 |
for (Int_t kk=0; kk<4;kk++){ |
// if ( tofoutput_.tdc_c[hh][kk] < 4095 || adc[kk][hh] < 4095 || tdc[kk][hh] < 4095 ){ |
1325 |
// new WM |
// // if ( tdcc[kk][hh] < 4095. || adc[kk][hh] < 4095 || tdc[kk][hh] < 4095 ){ |
1326 |
if ( tofoutput_.tdc_c[hh][kk] < 4095 || adc[kk][hh] < 4095 || tdc[kk][hh] < 4095 ){ |
// // |
1327 |
// if ( tdcc[kk][hh] < 4095. || adc[kk][hh] < 4095 || tdc[kk][hh] < 4095 ){ |
// t_pmt->pmt_id = this->GetPMTid(kk,hh); |
1328 |
// |
// t_pmt->tdc_tw = tofoutput_.tdc_c[hh][kk]; |
1329 |
t_pmt->pmt_id = this->GetPMTid(kk,hh); |
// t_pmt->adc = (Float_t)adc[kk][hh]; |
1330 |
t_pmt->tdc_tw = tofoutput_.tdc_c[hh][kk]; |
// t_pmt->tdc = (Float_t)tdc[kk][hh]; |
1331 |
t_pmt->adc = (Float_t)adc[kk][hh]; |
// // |
1332 |
t_pmt->tdc = (Float_t)tdc[kk][hh]; |
// new(tpmt[npmtentry]) ToFPMT(*t_pmt); |
1333 |
// |
// npmtentry++; |
1334 |
new(tpmt[npmtentry]) ToFPMT(*t_pmt); |
// t_pmt->Clear(); |
1335 |
npmtentry++; |
// }; |
1336 |
t_pmt->Clear(); |
// }; |
1337 |
}; |
// }; |
1338 |
}; |
// // |
1339 |
}; |
// // Calculate track-related variables |
1340 |
// |
// // |
1341 |
// Calculate track-related variables |
// if ( trk->ntrk() > 0 ){ |
1342 |
// |
// // |
1343 |
if ( trk->ntrk() > 0 ){ |
// // We have at least one track |
1344 |
// |
// // |
1345 |
// We have at least one track |
// // |
1346 |
// |
// // Run over tracks |
1347 |
// |
// // |
1348 |
// Run over tracks |
// for(Int_t nt=0; nt < trk->ntrk(); nt++){ |
1349 |
// |
// // |
1350 |
for(Int_t nt=0; nt < trk->ntrk(); nt++){ |
// TrkTrack *ptt = trk->GetStoredTrack(nt); |
1351 |
// |
// // |
1352 |
TrkTrack *ptt = trk->GetStoredTrack(nt); |
// // Copy the alpha vector in the input structure |
1353 |
// |
// // |
1354 |
// Copy the alpha vector in the input structure |
// for (Int_t e = 0; e < 5 ; e++){ |
1355 |
// |
// tofinput_.al_pp[e] = ptt->al[e]; |
1356 |
for (Int_t e = 0; e < 5 ; e++){ |
// }; |
1357 |
tofinput_.al_pp[e] = ptt->al[e]; |
// // |
1358 |
}; |
// // Get tracker related variables for this track |
1359 |
// |
// // |
1360 |
// Get tracker related variables for this track |
// toftrk(); |
1361 |
// |
// // |
1362 |
toftrk(); |
// // Copy values in the class from the structure (we need to use a temporary class to store variables). |
1363 |
// |
// // |
1364 |
// Copy values in the class from the structure (we need to use a temporary class to store variables). |
// t_tof->npmttdc = 0; |
1365 |
// |
// for (Int_t hh=0; hh<12;hh++){ |
1366 |
t_tof->npmttdc = 0; |
// for (Int_t kk=0; kk<4;kk++){ |
1367 |
for (Int_t hh=0; hh<12;hh++){ |
// if ( tofoutput_.tofmask[hh][kk] != 0 ){ |
1368 |
for (Int_t kk=0; kk<4;kk++){ |
// pmt_id = this->GetPMTid(kk,hh); |
1369 |
if ( tofoutput_.tofmask[hh][kk] != 0 ){ |
// t_tof->pmttdc.AddAt(pmt_id,t_tof->npmttdc); |
1370 |
pmt_id = this->GetPMTid(kk,hh); |
// t_tof->tdcflag.AddAt(tofoutput_.tdcflag[hh][kk],t_tof->npmttdc); // gf: Jan 09/07 |
1371 |
t_tof->pmttdc.AddAt(pmt_id,t_tof->npmttdc); |
// t_tof->npmttdc++; |
1372 |
t_tof->tdcflag.AddAt(tofoutput_.tdcflag[hh][kk],t_tof->npmttdc); // gf: Jan 09/07 |
// }; |
1373 |
t_tof->npmttdc++; |
// }; |
1374 |
}; |
// }; |
1375 |
}; |
// for (Int_t kk=0; kk<13;kk++){ |
1376 |
}; |
// t_tof->beta[kk] = tofoutput_.beta_a[kk]; |
1377 |
for (Int_t kk=0; kk<13;kk++){ |
// }; |
1378 |
t_tof->beta[kk] = tofoutput_.beta_a[kk]; |
// // |
1379 |
}; |
// t_tof->npmtadc = 0; |
1380 |
// |
// for (Int_t hh=0; hh<12;hh++){ |
1381 |
t_tof->npmtadc = 0; |
// for (Int_t kk=0; kk<4;kk++){ |
1382 |
for (Int_t hh=0; hh<12;hh++){ |
// if ( tofoutput_.adc_c[hh][kk] < 1000 ){ |
1383 |
for (Int_t kk=0; kk<4;kk++){ |
// t_tof->dedx.AddAt(tofoutput_.adc_c[hh][kk],t_tof->npmtadc); |
1384 |
if ( tofoutput_.adc_c[hh][kk] < 1000 ){ |
// pmt_id = this->GetPMTid(kk,hh); |
1385 |
t_tof->dedx.AddAt(tofoutput_.adc_c[hh][kk],t_tof->npmtadc); |
// t_tof->pmtadc.AddAt(pmt_id,t_tof->npmtadc); |
1386 |
pmt_id = this->GetPMTid(kk,hh); |
// t_tof->adcflag.AddAt(tofoutput_.adcflag[hh][kk],t_tof->npmtadc); // gf: Jan 09/07 |
1387 |
t_tof->pmtadc.AddAt(pmt_id,t_tof->npmtadc); |
// t_tof->npmtadc++; |
1388 |
t_tof->adcflag.AddAt(tofoutput_.adcflag[hh][kk],t_tof->npmtadc); // gf: Jan 09/07 |
// }; |
1389 |
t_tof->npmtadc++; |
// }; |
1390 |
}; |
// }; |
1391 |
}; |
// // |
1392 |
}; |
// memcpy(t_tof->xtofpos,tofoutput_.xtofpos,sizeof(t_tof->xtofpos)); |
1393 |
// |
// memcpy(t_tof->ytofpos,tofoutput_.ytofpos,sizeof(t_tof->ytofpos)); |
1394 |
memcpy(t_tof->xtofpos,tofoutput_.xtofpos,sizeof(t_tof->xtofpos)); |
// memcpy(t_tof->xtr_tof,tofoutput_.xtr_tof,sizeof(t_tof->xtr_tof)); |
1395 |
memcpy(t_tof->ytofpos,tofoutput_.ytofpos,sizeof(t_tof->ytofpos)); |
// memcpy(t_tof->ytr_tof,tofoutput_.ytr_tof,sizeof(t_tof->ytr_tof)); |
1396 |
memcpy(t_tof->xtr_tof,tofoutput_.xtr_tof,sizeof(t_tof->xtr_tof)); |
// // |
1397 |
memcpy(t_tof->ytr_tof,tofoutput_.ytr_tof,sizeof(t_tof->ytr_tof)); |
// // Store the tracker track number in order to be sure to have shyncronized data during analysis |
1398 |
// |
// // |
1399 |
// Store the tracker track number in order to be sure to have shyncronized data during analysis |
// t_tof->trkseqno = nt; |
1400 |
// |
// // |
1401 |
t_tof->trkseqno = nt; |
// // create a new object for this event with track-related variables |
1402 |
// |
// // |
1403 |
// create a new object for this event with track-related variables |
// new(t[ntrkentry]) ToFTrkVar(*t_tof); |
1404 |
// |
// ntrkentry++; |
1405 |
new(t[ntrkentry]) ToFTrkVar(*t_tof); |
// t_tof->Clear(); |
1406 |
ntrkentry++; |
// // |
1407 |
t_tof->Clear(); |
// }; // loop on all the tracks |
1408 |
// |
// // |
1409 |
}; // loop on all the tracks |
// this->unpackError = unpackError; |
1410 |
// |
// if ( defcal ){ |
1411 |
this->unpackError = unpackError; |
// this->default_calib = 1; |
1412 |
if ( defcal ){ |
// } else { |
1413 |
this->default_calib = 1; |
// this->default_calib = 0; |
1414 |
} else { |
// }; |
1415 |
this->default_calib = 0; |
//}; |
1416 |
}; |
// return(0); |
|
}; |
|
|
|
|
|
|
|
|
|
|
|
return(0); |
|
1417 |
} |
} |
1418 |
|
|
1419 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1420 |
ToFdEdx::ToFdEdx() |
ToFdEdx::ToFdEdx() |
1421 |
{ |
{ |
1422 |
memset(conn,0,12*sizeof(Bool_t)); |
memset(conn,0,12*sizeof(Bool_t)); |
1423 |
memset(ts,0,12*sizeof(UInt_t)); |
memset(ts,0,12*sizeof(UInt_t)); |
1424 |
memset(te,0,12*sizeof(UInt_t)); |
memset(te,0,12*sizeof(UInt_t)); |
1425 |
|
eDEDXpmt = new TArrayF(48); |
1426 |
Define_PMTsat(); |
Define_PMTsat(); |
1427 |
Clear(); |
Clear(); |
1428 |
} |
} |
1429 |
|
|
1430 |
|
ToFdEdx::~ToFdEdx(){ |
1431 |
|
Clear(); |
1432 |
|
Delete(); |
1433 |
|
} |
1434 |
|
|
1435 |
|
void ToFdEdx::Delete(Option_t *option){ |
1436 |
|
if ( eDEDXpmt ){ |
1437 |
|
eDEDXpmt->Set(0); |
1438 |
|
if ( eDEDXpmt) delete eDEDXpmt; |
1439 |
|
} |
1440 |
|
} |
1441 |
|
|
1442 |
//------------------------------------------------------------------------ |
//------------------------------------------------------------------------ |
1443 |
void ToFdEdx::CheckConnectors(UInt_t atime, GL_PARAM *glparam, TSQLServer *dbc) |
void ToFdEdx::CheckConnectors(UInt_t atime, GL_PARAM *glparam, TSQLServer *dbc) |
1444 |
{ |
{ |
1480 |
{ |
{ |
1481 |
// |
// |
1482 |
// Set arrays and initialize structure |
// Set arrays and initialize structure |
1483 |
|
// eDEDXpmt.Set(48); eDEDXpmt.Reset(-1); // Set array size and reset structure |
1484 |
eDEDXpmt.Set(48); eDEDXpmt.Reset(-1); // Set array size and reset structure |
eDEDXpmt->Set(48); eDEDXpmt->Reset(-1); // Set array size and reset structure |
|
eZpmt.Set(48); eZpmt.Reset(-1); |
|
|
eDEDXpad.Set(24); eDEDXpad.Reset(-1); |
|
|
eZpad.Set(24); eZpad.Reset(-1); |
|
|
eDEDXlayer.Set(6); eDEDXlayer.Reset(-1); |
|
|
eZlayer.Set(6); eZlayer.Reset(-1); |
|
|
eDEDXplane.Set(3); eDEDXplane.Reset(-1); |
|
|
eZplane.Set(3); eZplane.Reset(-1); |
|
|
INFOpmt.Set(48); INFOpmt.Reset(0); |
|
|
INFOlayer.Set(6); INFOlayer.Reset(0); |
|
1485 |
// |
// |
1486 |
}; |
}; |
1487 |
|
|
1493 |
|
|
1494 |
}; |
}; |
1495 |
|
|
|
|
|
1496 |
//------------------------------------------------------------------------ |
//------------------------------------------------------------------------ |
1497 |
// void ToFdEdx::InitPar(TString parname, TString parfile) |
void ToFdEdx::Init(pamela::tof::TofEvent *tofl0) |
1498 |
// { |
{ |
1499 |
// // expensive function - call it once/run |
// |
1500 |
|
ToFLevel2 tf; |
1501 |
|
for (Int_t gg=0; gg<4;gg++){ |
1502 |
|
for (Int_t hh=0; hh<12;hh++){ |
1503 |
// ReadParAtt( Form("%s/attenuation.txt" , pardir) ); |
// tofinput_.tdc[hh][gg]=tofEvent->tdc[gg][hh]; |
1504 |
// ReadParPos( Form("%s/desaturation_position.txt" , pardir) ); |
int mm = tf.GetPMTid(gg,hh); |
1505 |
// ReadParBBneg( Form("%s/BetheBloch.txt" , pardir) ); |
adc[mm]=tofl0->adc[gg][hh]; |
1506 |
// ReadParBBpos( Form("%s/BetheBloch_betagt1.txt" , pardir) ); |
}; |
1507 |
// ReadParDesatBB( Form("%s/desaturation_beta.txt" , pardir) ); |
}; |
1508 |
|
|
1509 |
// }; |
}; |
|
|
|
1510 |
|
|
1511 |
//------------------------------------------------------------------------ |
//------------------------------------------------------------------------ |
1512 |
void ToFdEdx::Process(UInt_t atime, Float_t betamean, Float_t *xtr_tof, Float_t *ytr_tof, pamela::tof::TofEvent *tofl0 ) |
void ToFdEdx::Init(Int_t gg, Int_t hh, Float_t adce) |
1513 |
|
{ |
1514 |
|
// |
1515 |
|
ToFLevel2 tf; |
1516 |
|
// for (Int_t gg=0; gg<4;gg++){ |
1517 |
|
// for (Int_t hh=0; hh<12;hh++){ |
1518 |
|
int mm = tf.GetPMTid(gg,hh); |
1519 |
|
adc[mm]=adce; |
1520 |
|
|
1521 |
|
}; |
1522 |
|
//------------------------------------------------------------------------ |
1523 |
|
void ToFdEdx::Process(UInt_t atime, Float_t betamean, Float_t *xtr_tof, Float_t *ytr_tof, Int_t exitat) |
1524 |
{ |
{ |
1525 |
// the parameters should be already initialised by InitPar() |
// the parameters should be already initialised by InitPar() |
1526 |
|
// printf(" in process \n"); |
|
|
|
1527 |
Clear(); |
Clear(); |
1528 |
|
|
|
|
|
|
|
|
|
// Float_t betamean = fabs(trackTRK->GetToFTrack()->beta[12]); |
|
|
|
|
|
if(betamean<0.05 || betamean>2){ |
|
|
for(int i=0;i<48;i++)INFOpmt[i]=1; |
|
|
} |
|
|
|
|
1529 |
// define angle: |
// define angle: |
1530 |
double dx = xtr_tof[1] - xtr_tof[5]; |
double dx = xtr_tof[1] - xtr_tof[5]; |
1531 |
double dy = ytr_tof[0] - ytr_tof[4]; |
double dy = ytr_tof[0] - ytr_tof[4]; |
1532 |
double dr = sqrt(dx*dx+dy*dy); |
double dr = sqrt(dx*dx+dy*dy); |
1533 |
double theta=atan(dr/76.81); |
double theta=atan(dr/76.81); |
1534 |
|
// |
1535 |
|
if ( xtr_tof[1] > 99. || xtr_tof[5] > 99. || ytr_tof[0] > 99. || ytr_tof[4] > 99. ) theta = 0.; |
1536 |
|
for (Int_t ii=0; ii<6; ii++){ |
1537 |
// TArrayF adc; |
if ( xtr_tof[ii] > 99. ) xtr_tof[ii] = 0.; |
1538 |
Float_t adc[48]; |
if ( ytr_tof[ii] > 99. ) ytr_tof[ii] = 0.; |
|
|
|
|
ToFLevel2 tf; |
|
|
|
|
|
for (Int_t gg=0; gg<4;gg++){ |
|
|
for (Int_t hh=0; hh<12;hh++){ |
|
|
// tofinput_.tdc[hh][gg]=tofEvent->tdc[gg][hh]; |
|
|
int mm = tf.GetPMTid(gg,hh); |
|
|
adc[mm]=tofl0->adc[gg][hh]; |
|
|
}; |
|
1539 |
}; |
}; |
1540 |
|
// |
1541 |
|
|
1542 |
|
|
1543 |
|
//--------------------- TABLE OF PERIODS WITH HV PROBLEMS ---------------------------- |
1544 |
|
|
1545 |
|
int Aconn=conn[0]; // PMT 0,20,22,24 |
1546 |
|
int Bconn=conn[1]; // PMT 6,12,26,34 |
1547 |
|
int Cconn=conn[2]; // PMT 4,14,28,32 |
1548 |
|
int Dconn=conn[3]; // PMT 2,8,10,30 |
1549 |
|
int Econn=conn[4]; // PMT 42,43,44,47 |
1550 |
|
int Fconn=conn[5]; // PMT 7,19,23,27 |
1551 |
|
int Gconn=conn[6]; // PMT 3,11,25,33 |
1552 |
|
int Hconn=conn[7]; // PMT 1,9,13,21 |
1553 |
|
int Iconn=conn[8]; // PMT 5,29,31,35 |
1554 |
|
int Lconn=conn[9]; // PMT 37,40,45,46 |
1555 |
|
int Mconn=conn[10]; // PMT 15,16,17,18 |
1556 |
|
int Nconn=conn[11]; // PMT 36,38,39,41 |
1557 |
|
if( false ) cout << Gconn << Iconn << Lconn <<endl; // to avoid compilation warnings |
1558 |
|
|
1559 |
|
// printf(" size %i \n",eDEDXpmt.GetSize()); |
1560 |
for( int ii=0; ii<48; ii++ ) { |
for( int ii=0; ii<48; ii++ ) { |
1561 |
if( adc[ii] >= PMTsat[ii]-5 ) continue; |
// |
1562 |
if( adc[ii] <= 0. ) continue; |
// eDEDXpmt.SetAt(-1.,ii); |
1563 |
|
// printf(" ii %i beta %f atime %u xtr 1 %f ytr 1 %f adc %f \n",ii,betamean,atime,xtr_tof[0],ytr_tof[0],adc[ii]); |
1564 |
double adcpC = f_adcPC( adc[ii] ); // - adc conversion in pC |
|
1565 |
double adccorr = adcpC*fabs(cos(theta)); |
if( adc[ii] >= 4095. ){ |
1566 |
|
// eDEDXpmt[ii] = 0.; |
1567 |
if(adccorr<=0.) continue; |
eDEDXpmt->AddAt(0.,ii); |
1568 |
|
continue; // EMILIANO |
1569 |
|
}; |
1570 |
|
|
1571 |
//--------------------- TABLE OF PERIODS WITH HV PROBLEMS ---------------------------- |
if( adc[ii] >= (PMTsat[ii]-5.) && adc[ii] < 4095. ){ |
1572 |
|
eDEDXpmt->AddAt(1000.,ii); |
1573 |
|
continue; // EMILIANO |
1574 |
|
}; |
1575 |
|
|
1576 |
int Aconn=conn[0]; // PMT 0,20,22,24 |
if( adc[ii] <= 0. ) { |
1577 |
int Bconn=conn[1]; // PMT 6,12,26,34 |
eDEDXpmt->AddAt(1500.,ii); |
1578 |
int Cconn=conn[2]; // PMT 4,14,28,32 |
continue; |
1579 |
int Dconn=conn[3]; // PMT 2,8,10,30 |
}; |
1580 |
int Econn=conn[4]; // PMT 42,43,44,47 |
// |
1581 |
int Fconn=conn[5]; // PMT 7,19,23,27 |
double adcpC = f_adcPC( adc[ii] ); // - adc conversion in pC |
1582 |
int Gconn=conn[6]; // PMT 3,11,25,33 |
if ( exitat == 0 ){ |
1583 |
int Hconn=conn[7]; // PMT 1,9,13,21 |
eDEDXpmt->AddAt((Float_t)adcpC,ii); |
1584 |
int Iconn=conn[8]; // PMT 5,29,31,35 |
continue; |
1585 |
int Lconn=conn[9]; // PMT 37,40,45,46 |
} |
1586 |
int Mconn=conn[10]; // PMT 15,16,17,18 |
// printf(" e qua? \n"); |
1587 |
int Nconn=conn[11]; // PMT 36,38,39,41 |
|
1588 |
|
double adccorr = adcpC*fabs(cos(theta)); |
1589 |
|
if(adccorr<=0.) continue; |
1590 |
|
if ( exitat == 1 ){ |
1591 |
|
eDEDXpmt->AddAt((Float_t)adccorr,ii); |
1592 |
|
continue; |
1593 |
|
} |
1594 |
|
// printf(" e quo? \n"); |
1595 |
|
|
1596 |
// int standard=0; |
// int standard=0; |
|
if( false ) cout << Gconn << Iconn << Lconn <<endl; |
|
1597 |
int S115B_ok=0; |
int S115B_ok=0; |
1598 |
int S115B_break=0; |
int S115B_break=0; |
1599 |
|
|
|
// if(atime>=1153660001 && atime<=1154375000)Dconn=1; |
|
|
// else if(atime>=1155850001 && atime<=1156280000){ |
|
|
// Hconn=1; |
|
|
// Nconn=1; |
|
|
// } |
|
|
|
|
|
// else if(atime>=1168490001 && atime<=1168940000)Dconn=1; |
|
|
// else if(atime>=1168940001 && atime<=1169580000){ |
|
|
// Fconn=1; |
|
|
// Mconn=1; |
|
|
// } |
|
|
|
|
|
// else if(atime>=1174665001 && atime<=1175000000)Bconn=1; |
|
|
// else if(atime>=1176120001 && atime<=1176800000)Hconn=1; |
|
|
// else if(atime>=1176800001 && atime<=1178330000)Econn=1; |
|
|
// else if(atime>=1178330001 && atime<=1181322000)Hconn=1; |
|
|
// else if(atime>=1182100001 && atime<=1183030000)Aconn=1; |
|
|
// else if(atime>=1184000001 && atime<=1184570000)Hconn=1; |
|
|
// else if(atime>=1185090001 && atime<=1185212000)Dconn=1; |
|
|
// else if(atime>=1191100001 && atime<=1191940000)Dconn=1; |
|
|
// else if(atime>=1196230001 && atime<=1196280000)Hconn=1; |
|
|
// else if(atime>=1206100001 && atime<=1206375600)Cconn=1; |
|
|
// else if(atime>=1217989201 && atime<=1218547800)Econn=1; |
|
|
// else if(atime>=1225789201 && atime<=1226566800)Econn=1; |
|
|
// else if(atime>=1229400901 && atime<=1229700000)Econn=1; |
|
|
// else if(atime>=1230318001 && atime<=1230415200)Econn=1; |
|
|
// else { |
|
|
// standard=1; |
|
|
// } |
|
1600 |
if(atime<1158720000)S115B_ok=1; |
if(atime<1158720000)S115B_ok=1; |
1601 |
else S115B_break=1; |
else S115B_break=1; |
1602 |
|
|
1603 |
|
|
1604 |
//------------------------------------------------------------------------ |
//------------------------------------------------------------------------ |
1605 |
|
// printf(" e qui? \n"); |
1606 |
//---------------------------------------------------- Z reconstruction |
//---------------------------------------------------- Z reconstruction |
1607 |
|
|
1608 |
double adcHe, adcnorm, adclin, dEdx, Zeta; |
double adcHe, adcnorm, adclin, dEdx, Zeta; |
1609 |
|
|
1610 |
adcHe=-2; |
adcHe=-2; |
1611 |
adcnorm=-2; |
adcnorm=-2; |
1612 |
adclin=-2; |
adclin=-2; |
1613 |
dEdx=-2; |
dEdx=-2; |
1614 |
Zeta=-2; |
Zeta=-2; |
1615 |
|
Double_t correction = 1.; |
|
|
|
|
// float ZetaH=-2; |
|
|
// float dEdxH=-2; |
|
|
|
|
|
// double day = (atime-1150000000)/84600; |
|
1616 |
|
|
1617 |
if(Aconn==1 && (ii==0 || ii==20 || ii==22 || ii==24)){ |
if(Aconn==1 && (ii==0 || ii==20 || ii==22 || ii==24)){ |
1618 |
adcHe = (Get_adc_he(ii, xtr_tof, ytr_tof))/1.675; |
correction = 1.675; |
1619 |
} |
} |
1620 |
else if(Bconn==1 && (ii==6 || ii==12 || ii==26 || ii==34)){ |
else if(Bconn==1 && (ii==6 || ii==12 || ii==26 || ii==34)){ |
1621 |
adcHe = (Get_adc_he(ii, xtr_tof, ytr_tof))/2.482; |
correction = 2.482; |
1622 |
} |
} |
1623 |
else if(Cconn==1 && (ii==4 || ii==14 || ii==28 || ii==32)){ |
else if(Cconn==1 && (ii==4 || ii==14 || ii==28 || ii==32)){ |
1624 |
adcHe = (Get_adc_he(ii, xtr_tof, ytr_tof))/1.464; |
correction = 1.464; |
1625 |
} |
} |
1626 |
else if(Dconn==1 && (ii==2 || ii==8 || ii==10 || ii==30)){ |
else if(Dconn==1 && (ii==2 || ii==8 || ii==10 || ii==30)){ |
1627 |
adcHe = (Get_adc_he(ii, xtr_tof, ytr_tof))/1.995; |
correction = 1.995; |
1628 |
} |
} |
1629 |
else if(Econn==1 && (ii==42 || ii==43 || ii==44 || ii==47)){ |
else if(Econn==1 && (ii==42 || ii==43 || ii==44 || ii==47)){ |
1630 |
adcHe = (Get_adc_he(ii, xtr_tof, ytr_tof))/1.273; |
correction = 1.273; |
1631 |
} |
} |
1632 |
else if(Fconn==1 && (ii==7 || ii==19 || ii==23 || ii==27)){ |
else if(Fconn==1 && (ii==7 || ii==19 || ii==23 || ii==27)){ |
1633 |
adcHe = (Get_adc_he(ii, xtr_tof, ytr_tof))/1.565; |
correction = 1.565; |
1634 |
} |
} |
1635 |
else if(Mconn==1 && (ii==15 || ii==16 || ii==17 || ii==18)){ |
else if(Mconn==1 && (ii==15 || ii==16 || ii==17 || ii==18)){ |
1636 |
adcHe = (Get_adc_he(ii, xtr_tof, ytr_tof))/1.565; |
correction = 1.565; |
1637 |
} |
} |
1638 |
else if(Nconn==1 && (ii==36 || ii==38 || ii==39 || ii==41)){ |
else if(Nconn==1 && (ii==36 || ii==38 || ii==39 || ii==41)){ |
1639 |
adcHe = (Get_adc_he(ii, xtr_tof, ytr_tof))/1.018; |
correction = 1.018; |
1640 |
} |
} |
1641 |
else if(Hconn==1 && (ii==1 || ii==13 || ii==21 || (ii==9&&S115B_ok==1))){ |
else if(Hconn==1 && (ii==1 || ii==13 || ii==21 || (ii==9&&S115B_ok==1))){ |
1642 |
adcHe = (Get_adc_he(ii, xtr_tof, ytr_tof))/1.84; |
correction = 1.84; |
|
} |
|
|
else if(S115B_break==1 && ii==9 && Hconn==0){ |
|
|
adcHe = f_att5B( ytr_tof[0] ); //N.B.: this function refers to the Carbon!!! |
|
1643 |
} |
} |
1644 |
else if(S115B_break==1 && ii==9 && Hconn==1){ |
else if(S115B_break==1 && ii==9 && Hconn==1){ |
1645 |
adcHe = (f_att5B( ytr_tof[0] ))/1.64; |
correction = 1.64; |
1646 |
} |
} |
1647 |
else adcHe = Get_adc_he(ii, xtr_tof, ytr_tof); |
else correction = 1.; |
1648 |
|
|
1649 |
|
if( ii==9 && S115B_break==1 ){ |
1650 |
|
adcHe = f_att5B( ytr_tof[0] )/correction; |
1651 |
|
} else { |
1652 |
|
adcHe = Get_adc_he(ii, xtr_tof, ytr_tof)/correction; |
1653 |
|
}; |
1654 |
if(adcHe<=0) continue; |
if(adcHe<=0) continue; |
1655 |
|
if ( exitat == 2 ){ |
1656 |
|
if(ii==9 && S115B_break==1) eDEDXpmt->AddAt(36.*(Float_t)adccorr/adcHe,ii); |
1657 |
|
else adclin = 4.*(Float_t)adccorr/adcHe; |
1658 |
|
continue; |
1659 |
|
} |
1660 |
|
|
1661 |
if(ii==9 && S115B_break==1) adcnorm = f_pos5B(adccorr); |
if(ii==9 && S115B_break==1) adcnorm = f_pos5B(adccorr); |
1662 |
else adcnorm = f_pos( (parPos[ii]), adccorr); |
else adcnorm = f_pos( (parPos[ii]), adccorr); |
|
|
|
1663 |
if(adcnorm<=0) continue; |
if(adcnorm<=0) continue; |
|
|
|
1664 |
if(ii==9 && S115B_break==1) adclin = 36.*adcnorm/adcHe; |
if(ii==9 && S115B_break==1) adclin = 36.*adcnorm/adcHe; |
1665 |
else adclin = 4.*adcnorm/adcHe; |
else adclin = 4.*adcnorm/adcHe; |
|
|
|
1666 |
if(adclin<=0) continue; |
if(adclin<=0) continue; |
1667 |
|
if ( exitat == 3 ){ |
1668 |
|
if(ii==9 && S115B_break==1) eDEDXpmt->AddAt((Float_t)adclin,ii); |
1669 |
|
else eDEDXpmt->AddAt((Float_t)adclin,ii); |
1670 |
|
continue; |
1671 |
|
} |
1672 |
|
// |
1673 |
|
if ( betamean > 99. ){ |
1674 |
|
// eDEDXpmt.AddAt((Float_t)adclin,ii); |
1675 |
|
eDEDXpmt->AddAt((Float_t)adclin,ii); |
1676 |
|
// printf(" AAPMT IS %i dedx is %f vector is %f \n",ii,adclin,eDEDXpmt[ii]); |
1677 |
|
continue; |
1678 |
|
}; |
1679 |
|
// |
1680 |
double dEdxHe=-2; |
double dEdxHe=-2; |
1681 |
if(ii==9 && S115B_break==1){ |
if(ii==9 && S115B_break==1){ |
1682 |
if( betamean <1. ) dEdxHe = f_BB5B( betamean ); |
if( betamean <1. ) dEdxHe = f_BB5B( betamean ); |
1685 |
if( betamean <1. ) dEdxHe = f_BB( (parBBneg[ii]), betamean ); |
if( betamean <1. ) dEdxHe = f_BB( (parBBneg[ii]), betamean ); |
1686 |
else dEdxHe = parBBpos[ii]; |
else dEdxHe = parBBpos[ii]; |
1687 |
} |
} |
1688 |
|
|
1689 |
if(dEdxHe<=0) continue; |
|
1690 |
|
if(dEdxHe<=0){ |
1691 |
|
eDEDXpmt->AddAt((Float_t)adclin,ii); |
1692 |
|
continue; |
1693 |
|
}; |
1694 |
|
|
1695 |
if(ii==9 && S115B_break==1) dEdx = f_desatBB5B( adclin ); |
if(ii==9 && S115B_break==1) dEdx = f_desatBB5B( adclin ); |
1696 |
else dEdx = f_desatBB((parDesatBB[ii]), adclin ); |
else dEdx = f_desatBB((parDesatBB[ii]), adclin ); |
1697 |
|
|
1698 |
if(dEdx<=0) continue; |
if(dEdx<=0){ |
1699 |
|
eDEDXpmt->AddAt((Float_t)adclin,ii); |
1700 |
if(ii==9 && S115B_break==1) Zeta = sqrt(36.*(dEdx/dEdxHe)); |
continue; |
1701 |
else Zeta = sqrt(4.*(dEdx/dEdxHe)); |
}; |
|
|
|
|
if(Zeta<=0) continue; |
|
|
|
|
|
//--------------------- TIME DEPENDENCE ---------------------------------- |
|
|
|
|
|
|
|
|
// TArrayF &binx = TDx[ii]; |
|
|
// TArrayF &biny = TDy[ii]; |
|
|
// for(int k=0; k<200; k++) { |
|
|
// if (day > binx[k]-2.5 && day<=binx[k]+2.5 && biny[k]>0) { |
|
|
// ZetaH=Zeta/biny[k]*6; |
|
|
// dEdxH=dEdx/(pow(biny[k],2))*36; |
|
|
// } |
|
|
// } |
|
|
|
|
|
// if(ZetaH!=-2)eZpmt[ii]=(Float_t)ZetaH; |
|
|
// else eZpmt[ii]=(Float_t)Zeta; |
|
|
|
|
|
// if(dEdxH!=-2)eDEDXpmt[ii]=(Float_t)dEdxH; |
|
|
// else eDEDXpmt[ii]=(Float_t)dEdx; |
|
|
|
|
|
// printf("%5d %8.2f %8.2f %8.2f %8.2f %8.2f %8.2f %5.4f \n", ii, adcpC, adccorr, adcHe, dEdxHe, dEdx, Zeta, betamean ); |
|
|
|
|
|
eZpmt[ii]=(Float_t)Zeta; |
|
|
eDEDXpmt[ii]=(Float_t)dEdx; |
|
|
|
|
|
|
|
|
} //end loop on 48 PMT |
|
|
|
|
|
//--------------------------------------------------- paddle + layer -------------------- |
|
|
|
|
|
for(int j=0;j<48;j++){ |
|
|
int k=100; |
|
|
if(j%2==0 || j==0)k=j/2; |
|
|
|
|
|
double zpdl=-1; |
|
|
|
|
|
if((j%2==0 || j==0) && eZpmt[j]!=-1 && eZpmt[j+1]!=-1){ |
|
|
zpdl=0.5*(eZpmt[j]+eZpmt[j+1]); |
|
|
}else if((j%2==0 || j==0) && eZpmt[j]!=-1 && eZpmt[j+1]==-1){ |
|
|
zpdl=eZpmt[j]; |
|
|
}else if((j%2==0 || j==0) && eZpmt[j]==-1 && eZpmt[j+1]!=-1){ |
|
|
zpdl=eZpmt[j+1]; |
|
|
} |
|
|
|
|
|
if(j%2==0 || j==0)eZpad[k]= (Float_t)zpdl; |
|
|
|
|
|
if((j%2==0 || j==0)&&eZpad[k]!=-1){ |
|
|
if(k>=0&&k<8)eZlayer[0]=eZpad[k]; |
|
|
if(k>=8&&k<14)eZlayer[1]=eZpad[k]; |
|
|
if(k>=14&&k<16)eZlayer[2]=eZpad[k]; |
|
|
if(k>=16&&k<18)eZlayer[3]=eZpad[k]; |
|
|
if(k>=18&&k<21)eZlayer[4]=eZpad[k]; |
|
|
if(k>=21)eZlayer[5]=eZpad[k]; |
|
|
} |
|
|
|
|
|
if(eZlayer[0]!=-1&&eZlayer[1]!=-1&&fabs(eZlayer[0]-eZlayer[1])<1.5)eZplane[0]=0.5*(eZlayer[0]+eZlayer[1]); |
|
|
else if(eZlayer[0]!=-1&&eZlayer[1]==-1)eZplane[0]=eZlayer[0]; |
|
|
else if(eZlayer[1]!=-1&&eZlayer[0]==-1)eZplane[0]=eZlayer[1]; |
|
|
|
|
|
if(eZlayer[2]!=-1&&eZlayer[3]!=-1&&fabs(eZlayer[2]-eZlayer[3])<1.5)eZplane[1]=0.5*(eZlayer[2]+eZlayer[3]); |
|
|
else if(eZlayer[2]!=-1&&eZlayer[3]==-1)eZplane[1]=eZlayer[2]; |
|
|
else if(eZlayer[3]!=-1&&eZlayer[2]==-1)eZplane[1]=eZlayer[3]; |
|
|
|
|
|
if(eZlayer[4]!=-1&&eZlayer[5]!=-1&&fabs(eZlayer[4]-eZlayer[5])<1.5)eZplane[2]=0.5*(eZlayer[4]+eZlayer[5]); |
|
|
else if(eZlayer[4]!=-1&&eZlayer[5]==-1)eZplane[2]=eZlayer[4]; |
|
|
else if(eZlayer[5]!=-1&&eZlayer[4]==-1)eZplane[2]=eZlayer[5]; |
|
1702 |
|
|
1703 |
} |
eDEDXpmt->AddAt((Float_t)dEdx,ii); |
1704 |
|
// eDEDXpmt.AddAt((Float_t)dEdx,ii); |
1705 |
|
|
1706 |
for(int jj=0;jj<48;jj++){ |
// printf(" PMT IS %i dedx is %f vector is %f \n",ii,dEdx,eDEDXpmt[ii]); |
|
int k=100; |
|
|
if(jj%2==0 || jj==0)k=jj/2; |
|
|
|
|
|
double dedxpdl=-1; |
|
|
|
|
|
if((jj%2==0 || jj==0) && eDEDXpmt[jj]!=-1 && eDEDXpmt[jj+1]!=-1){ |
|
|
dedxpdl=0.5*(eDEDXpmt[jj]+eDEDXpmt[jj+1]); |
|
|
}else if((jj%2==0 || jj==0) && eDEDXpmt[jj]!=-1 && eDEDXpmt[jj+1]==-1){ |
|
|
dedxpdl=eDEDXpmt[jj]; |
|
|
}else if((jj%2==0 || jj==0) && eDEDXpmt[jj]==-1 && eDEDXpmt[jj+1]!=-1){ |
|
|
dedxpdl=eDEDXpmt[jj+1]; |
|
|
} |
|
|
|
|
|
if(jj%2==0 || jj==0)eDEDXpad[k]= (Float_t)dedxpdl; |
|
|
|
|
|
if((jj%2==0 || jj==0)&&eDEDXpad[k]!=-1){ |
|
|
if(k>=0&&k<8)eDEDXlayer[0]=eDEDXpad[k]; |
|
|
if(k>=8&&k<14)eDEDXlayer[1]=eDEDXpad[k]; |
|
|
if(k>=14&&k<16)eDEDXlayer[2]=eDEDXpad[k]; |
|
|
if(k>=16&&k<18)eDEDXlayer[3]=eDEDXpad[k]; |
|
|
if(k>=18&&k<21)eDEDXlayer[4]=eDEDXpad[k]; |
|
|
if(k>=21)eDEDXlayer[5]=eDEDXpad[k]; |
|
|
} |
|
|
|
|
|
if(eDEDXlayer[0]!=-1&&eDEDXlayer[1]!=-1&&fabs(eDEDXlayer[0]-eDEDXlayer[1])<10)eDEDXplane[0]=0.5*(eDEDXlayer[0]+eDEDXlayer[1]); |
|
|
else if(eDEDXlayer[0]!=-1&&eDEDXlayer[1]==-1)eDEDXplane[0]=eDEDXlayer[0]; |
|
|
else if(eDEDXlayer[1]!=-1&&eDEDXlayer[0]==-1)eDEDXplane[0]=eDEDXlayer[1]; |
|
|
|
|
|
if(eDEDXlayer[2]!=-1&&eDEDXlayer[3]!=-1&&fabs(eDEDXlayer[2]-eDEDXlayer[3])<10)eDEDXplane[1]=0.5*(eDEDXlayer[2]+eDEDXlayer[3]); |
|
|
else if(eDEDXlayer[2]!=-1&&eDEDXlayer[3]==-1)eDEDXplane[1]=eDEDXlayer[2]; |
|
|
else if(eDEDXlayer[3]!=-1&&eDEDXlayer[2]==-1)eDEDXplane[1]=eDEDXlayer[3]; |
|
|
|
|
|
if(eDEDXlayer[4]!=-1&&eDEDXlayer[5]!=-1&&fabs(eDEDXlayer[4]-eDEDXlayer[5])<10)eDEDXplane[2]=0.5*(eDEDXlayer[4]+eDEDXlayer[5]); |
|
|
else if(eDEDXlayer[4]!=-1&&eDEDXlayer[5]==-1)eDEDXplane[2]=eDEDXlayer[4]; |
|
|
else if(eDEDXlayer[5]!=-1&&eDEDXlayer[4]==-1)eDEDXplane[2]=eDEDXlayer[5]; |
|
|
|
|
|
} |
|
|
|
|
1707 |
|
|
1708 |
|
} //end loop on 48 PMT |
1709 |
|
|
1710 |
}; |
}; |
1711 |
|
|
1712 |
|
|
1713 |
//------------------------------------------------------------------------ |
//------------------------------------------------------------------------ |
|
void ToFdEdx::PrintTD() |
|
|
{ |
|
|
for(int i=0; i<48; i++) { |
|
|
TArrayF &binx = TDx[i]; |
|
|
TArrayF &biny = TDy[i]; |
|
|
for(int k=0; k<200; k++) { // bin temporali |
|
|
printf("%d %d %f %f", i,k, binx[k], biny[k]); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------ |
|
1714 |
void ToFdEdx::Define_PMTsat() |
void ToFdEdx::Define_PMTsat() |
1715 |
{ |
{ |
1716 |
Float_t sat[48] = { |
Float_t sat[48] = { |
1724 |
} |
} |
1725 |
|
|
1726 |
//------------------------------------------------------------------------ |
//------------------------------------------------------------------------ |
|
// void ToFdEdx::ReadParTD( Int_t ipmt, const char *fname ) |
|
|
// { |
|
|
// printf("read %s\n",fname); |
|
|
// if(ipmt<0) return; |
|
|
// if(ipmt>47) return; |
|
|
// FILE *fattin = fopen( fname , "r" ); |
|
|
// Float_t yTD[200],xTD[200]; |
|
|
// for(int j=0;j<200;j++){ |
|
|
// float x,y,ym,e; |
|
|
// if(fscanf(fattin,"%f %f %f %f", |
|
|
// &x, &y, &ym, &e )!=4) break; |
|
|
// xTD[j]=x; |
|
|
// if(ym>0&&fabs(y-ym)>1) yTD[j]=ym; |
|
|
// else yTD[j]=y; |
|
|
// } |
|
|
// TDx[ipmt].Set(200,xTD); |
|
|
// TDy[ipmt].Set(200,yTD); |
|
|
// fclose(fattin); |
|
|
// } |
|
|
|
|
|
//------------------------------------------------------------------------ |
|
1727 |
void ToFdEdx::ReadParBBpos( const char *fname ) |
void ToFdEdx::ReadParBBpos( const char *fname ) |
1728 |
{ |
{ |
1729 |
printf("read %s\n",fname); |
// printf("read %s\n",fname); |
1730 |
parBBpos.Set(48); |
parBBpos.Set(48); |
1731 |
FILE *fattin = fopen( fname , "r" ); |
FILE *fattin = fopen( fname , "r" ); |
1732 |
for (int i=0; i<48; i++) { |
for (int i=0; i<48; i++) { |
1742 |
//------------------------------------------------------------------------ |
//------------------------------------------------------------------------ |
1743 |
void ToFdEdx::ReadParDesatBB( const char *fname ) |
void ToFdEdx::ReadParDesatBB( const char *fname ) |
1744 |
{ |
{ |
1745 |
printf("read %s\n",fname); |
// printf("read %s\n",fname); |
1746 |
FILE *fattin = fopen( fname , "r" ); |
FILE *fattin = fopen( fname , "r" ); |
1747 |
for (int i=0; i<48; i++) { |
for (int i=0; i<48; i++) { |
1748 |
int tid=0; |
int tid=0; |
1759 |
void ToFdEdx::ReadParBBneg( const char *fname ) |
void ToFdEdx::ReadParBBneg( const char *fname ) |
1760 |
|
|
1761 |
{ |
{ |
1762 |
printf("read %s\n",fname); |
// printf("read %s\n",fname); |
1763 |
FILE *fattin = fopen( fname , "r" ); |
FILE *fattin = fopen( fname , "r" ); |
1764 |
for (int i=0; i<48; i++) { |
for (int i=0; i<48; i++) { |
1765 |
int tid=0; |
int tid=0; |
1774 |
//------------------------------------------------------------------------ |
//------------------------------------------------------------------------ |
1775 |
void ToFdEdx::ReadParPos( const char *fname ) |
void ToFdEdx::ReadParPos( const char *fname ) |
1776 |
{ |
{ |
1777 |
printf("read %s\n",fname); |
// printf("read %s\n",fname); |
1778 |
FILE *fattin = fopen( fname , "r" ); |
FILE *fattin = fopen( fname , "r" ); |
1779 |
for (int i=0; i<48; i++) { |
for (int i=0; i<48; i++) { |
1780 |
int tid=0; |
int tid=0; |
1789 |
//------------------------------------------------------------------------ |
//------------------------------------------------------------------------ |
1790 |
void ToFdEdx::ReadParAtt( const char *fname ) |
void ToFdEdx::ReadParAtt( const char *fname ) |
1791 |
{ |
{ |
1792 |
printf("read %s\n",fname); |
// printf("read %s\n",fname); |
1793 |
FILE *fattin = fopen( fname , "r" ); |
FILE *fattin = fopen( fname , "r" ); |
1794 |
for (int i=0; i<48; i++) { |
for (int i=0; i<48; i++) { |
1795 |
int tid=0; |
int tid=0; |
1862 |
// pl_x - coord x of the tof plane |
// pl_x - coord x of the tof plane |
1863 |
// pl_y - coord y |
// pl_y - coord y |
1864 |
|
|
1865 |
adc_he = 0; |
adc_he = 0; |
1866 |
if( eGeom.GetXY(id)==1 ) adc_he = f_att( (parAtt[id]), pl_x[eGeom.GetPlane(id)] ); |
if( eGeom.GetXY(id)==1 ) adc_he = f_att( (parAtt[id]), pl_x[eGeom.GetPlane(id)] ); |
1867 |
if( eGeom.GetXY(id)==2 ) adc_he = f_att( (parAtt[id]), pl_y[eGeom.GetPlane(id)] ); |
if( eGeom.GetXY(id)==2 ) adc_he = f_att( (parAtt[id]), pl_y[eGeom.GetPlane(id)] ); |
1868 |
return adc_he; |
return adc_he; |