Skip to content
Snippets Groups Projects
Commit ef34a097 authored by Petr Balek's avatar Petr Balek :fishing_pole_and_fish: Committed by Julien Maurer
Browse files

swapping ToF channels for trains 0 and 3

swapping ToF channels for trains 0 and 3
parent ab2bc4f3
No related branches found
No related tags found
Loading
......@@ -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);
}
}
......
......@@ -75,5 +75,19 @@ protected:
/// tofHit passed as argument. Mapping is implemented according to
/// https://twiki.cern.ch/twiki/bin/view/Atlas/AFPHPTDC#Channel_Mapping
void setBarAndTrainID(xAOD::AFPToFHit* tofHit, const EventContext& ctx) const;
private:
// TODO: this should go to the database at some moment
// @brief mapping of channels to trainID and barID
//
// indices are: runID (Run2, Run3 till 12 Oct 2002, Run3 since 12 Oct 2022); hptdcID (1,2); channel (0...11)
// channels 1,4,7,10 shouldn't exist; Run2 data has channels 1 and 4 as well, this is a known problem
const int m_channel2train[3][2][12]={{{0,-2,1,0,-2,1, 0,-1,1,0,-1,1}, {2,-2,3,2,-2,3, 2,-1,3,2,-1,3}},
{{1,-1,0,1,-1,0, 1,-1,0,1,-1,0}, {3,-1,2,3,-1,2, 3,-1,2,3,-1,2}},
{{1,-1,3,1,-1,3, 1,-1,3,1,-1,3}, {0,-1,2,0,-1,2, 0,-1,2,0,-1,2}}};
const int m_channel2bar[3][2][12] = {{{0,-2,2,3,-2,1, 2,-1,0,1,-1,3}, {0,-2,2,3,-2,1, 2,-1,0,1,-1,3}},
{{0,-1,2,3,-1,1, 2,-1,0,1,-1,3}, {0,-1,2,3,-1,1, 2,-1,0,1,-1,3}},
{{0,-1,2,3,-1,1, 2,-1,0,1,-1,3}, {0,-1,2,3,-1,1, 2,-1,0,1,-1,3}}};
};
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment