Skip to content
Snippets Groups Projects

swapping ToF channels for trains 0 and 3

Merged Petr Balek requested to merge pbalek/athena:afp-raw2digi-swap-trains-rel22 into 22.0
Files
2
@@ -195,86 +195,36 @@ void AFP_Raw2DigiTool::setBarAndTrainID(xAOD::AFPToFHit* tofHit, const EventCont
const int hptdcChannel = tofHit->hptdcChannel();
const int hptdcID = tofHit->hptdcID();
int Run = (ctx.eventID().run_number() > 370000 ? 3 : 2);
int swapTrain = (Run==3 ? 1 : 0);
if((hptdcChannel<0 || hptdcChannel>=12) || (hptdcID<=0 || hptdcID>=3))
{
ATH_MSG_WARNING("Invalid hptdcID "<<hptdcID<<", or hptdcChannel "<<hptdcChannel);
return;
}
if (hptdcID == 1) {
switch (hptdcChannel) {
case 0:
tofHit->setTrainID(0+swapTrain);
tofHit->setBarInTrainID(0);
break;
case 2:
tofHit->setTrainID(1-swapTrain);
tofHit->setBarInTrainID(2);
break;
case 3:
tofHit->setTrainID(0+swapTrain);
tofHit->setBarInTrainID(3);
break;
case 5:
tofHit->setTrainID(1-swapTrain);
tofHit->setBarInTrainID(1);
break;
case 6:
tofHit->setTrainID(0+swapTrain);
tofHit->setBarInTrainID(2);
break;
case 8:
tofHit->setTrainID(1-swapTrain);
tofHit->setBarInTrainID(0);
break;
case 9:
tofHit->setTrainID(0+swapTrain);
tofHit->setBarInTrainID(1);
break;
case 11:
tofHit->setTrainID(1-swapTrain);
tofHit->setBarInTrainID(3);
break;
default:
if(Run==2 && (hptdcChannel==1 || hptdcChannel==4)) ATH_MSG_DEBUG("Unrecognised hptdcChannel "<<hptdcChannel<<", hptdcID "<<hptdcID);
else ATH_MSG_WARNING("Unrecognised hptdcChannel "<<hptdcChannel<<", hptdcID "<<hptdcID);
}
int RunID = (ctx.eventID().run_number() > 370000 ? (ctx.eventID().run_number() > 436657 ? 2 : 1) : 0);
int trainID=m_channel2train[RunID][hptdcID-1][hptdcChannel];
int barID=m_channel2bar[RunID][hptdcID-1][hptdcChannel];
if(trainID>=0 && barID>=0)
{
tofHit->setTrainID(trainID);
tofHit->setBarInTrainID(barID);
}
else if (hptdcID == 2) {
switch (hptdcChannel) {
case 0:
tofHit->setTrainID(2+swapTrain);
tofHit->setBarInTrainID(0);
break;
case 2:
tofHit->setTrainID(3-swapTrain);
tofHit->setBarInTrainID(2);
break;
case 3:
tofHit->setTrainID(2+swapTrain);
tofHit->setBarInTrainID(3);
break;
case 5:
tofHit->setTrainID(3-swapTrain);
tofHit->setBarInTrainID(1);
break;
case 6:
tofHit->setTrainID(2+swapTrain);
tofHit->setBarInTrainID(2);
break;
case 8:
tofHit->setTrainID(3-swapTrain);
tofHit->setBarInTrainID(0);
break;
case 9:
tofHit->setTrainID(2+swapTrain);
tofHit->setBarInTrainID(1);
break;
case 11:
tofHit->setTrainID(3-swapTrain);
tofHit->setBarInTrainID(3);
break;
default:
if(Run==2 && (hptdcChannel==1 || hptdcChannel==4)) ATH_MSG_DEBUG("Unrecognised hptdcChannel "<<hptdcChannel<<", hptdcID "<<hptdcID);
else ATH_MSG_WARNING("Unrecognised hptdcChannel "<<hptdcChannel<<", hptdcID "<<hptdcID);
}
else if(trainID==-2 && barID==-2)
{
// this is known problem for Run2, channels 1 and 4
ATH_MSG_DEBUG("Unrecognised hptdcChannel "<<hptdcChannel<<", hptdcID "<<hptdcID);
}
else if(trainID==-1 && barID==-1)
{
// this is not known
ATH_MSG_WARNING("Unrecognised hptdcChannel "<<hptdcChannel<<", hptdcID "<<hptdcID);
}
else
{
// this shouldn't happen
ATH_MSG_WARNING("Unrecognised trainID "<<trainID<<" or barID "<<barID<<"; run "<<ctx.eventID().run_number()<<", hptdcChannel "<<hptdcChannel<<", hptdcID "<<hptdcID);
}
}
Loading