Skip to content
Snippets Groups Projects
Commit d0d90074 authored by Stewart Martin-Haugh's avatar Stewart Martin-Haugh
Browse files

Merge branch 'testDebug_2' into '23.0'

Fixing jFEX input data monitoring

See merge request atlas/athena!64296
parents 661af25c 64e2b71d
No related branches found
No related tags found
No related merge requests found
...@@ -135,6 +135,7 @@ StatusCode jFexEmulatedTowers::execute(const EventContext& ctx) const { ...@@ -135,6 +135,7 @@ StatusCode jFexEmulatedTowers::execute(const EventContext& ctx) const {
} }
float Total_Et = 0; float Total_Et = 0;
unsigned int countMasked = 0;
for (auto const& SCellID : it_TTower2SCells->second ) { for (auto const& SCellID : it_TTower2SCells->second ) {
//check that the SCell Identifier exists in the map //check that the SCell Identifier exists in the map
...@@ -150,6 +151,7 @@ StatusCode jFexEmulatedTowers::execute(const EventContext& ctx) const { ...@@ -150,6 +151,7 @@ StatusCode jFexEmulatedTowers::execute(const EventContext& ctx) const {
if( (myCell->provenance() >> 7 & 0x1) and m_apply_masking ) { if( (myCell->provenance() >> 7 & 0x1) and m_apply_masking ) {
//if masked then Et = 0 //if masked then Et = 0
et = 0.0; et = 0.0;
countMasked++;
} }
if(myCell->quality() == 1){ if(myCell->quality() == 1){
...@@ -160,7 +162,7 @@ StatusCode jFexEmulatedTowers::execute(const EventContext& ctx) const { ...@@ -160,7 +162,7 @@ StatusCode jFexEmulatedTowers::execute(const EventContext& ctx) const {
} }
Total_Et_encoded = jFEXCompression::Compress( Total_Et ); Total_Et_encoded = jFEXCompression::Compress( Total_Et, countMasked == (it_TTower2SCells->second).size() ? true : false );
} }
else{ else{
......
...@@ -194,8 +194,15 @@ StatusCode jFexTower2SCellDecorator::execute(const EventContext& ctx) const { ...@@ -194,8 +194,15 @@ StatusCode jFexTower2SCellDecorator::execute(const EventContext& ctx) const {
for(const auto& tmpet : scEt){ for(const auto& tmpet : scEt){
tmpSCellEt += tmpet; tmpSCellEt += tmpet;
} }
//How many SCell are masked? if all then send invalid code
unsigned int count_scMask =0;
for(const auto& masked : scMask){
if(masked) count_scMask++;
}
SCellEt = tmpSCellEt; SCellEt = tmpSCellEt;
jFexEtencoded = jFEXCompression::Compress( tmpSCellEt ); jFexEtencoded = jFEXCompression::Compress( tmpSCellEt, count_scMask == scMask.size() ? true : false );
jFexEt = jFEXCompression::Expand( jTower->jTowerEt() ); jFexEt = jFEXCompression::Expand( jTower->jTowerEt() );
} }
else if(source == 1){ else if(source == 1){
......
...@@ -31,7 +31,7 @@ class jFEXCompression { ...@@ -31,7 +31,7 @@ class jFEXCompression {
public: public:
/** Compress data */ /** Compress data */
static unsigned int Compress(float floatEt); static unsigned int Compress(float floatEt, bool empty = false);
/** Uncompress data */ /** Uncompress data */
static int Expand(unsigned int code); static int Expand(unsigned int code);
/** Apply threshold to compressed data */ /** Apply threshold to compressed data */
......
...@@ -17,7 +17,10 @@ const int jFEXCompression::s_steps[] = {25, 50, 100, 200, 400}; ...@@ -17,7 +17,10 @@ const int jFEXCompression::s_steps[] = {25, 50, 100, 200, 400};
const int jFEXCompression::s_minET[] = {-3150, 6400, 25600, 102400, 409600}; const int jFEXCompression::s_minET[] = {-3150, 6400, 25600, 102400, 409600};
const int jFEXCompression::s_minCode[] = {2, 384, 768, 1536, 3072}; const int jFEXCompression::s_minCode[] = {2, 384, 768, 1536, 3072};
unsigned int jFEXCompression::Compress(float floatEt) { unsigned int jFEXCompression::Compress(float floatEt, bool empty) {
//If all Scells are masked, then send empty/data not available
if(empty) return s_NoData;
int Et = std::round(floatEt); int Et = std::round(floatEt);
......
...@@ -20,7 +20,7 @@ def JfexInputMonitoringConfig(inputFlags): ...@@ -20,7 +20,7 @@ def JfexInputMonitoringConfig(inputFlags):
#Decorator for the DataTowers #Decorator for the DataTowers
from L1CaloFEXAlgos.L1CaloFEXAlgosConfig import L1CaloFEXDecoratorCfg from L1CaloFEXAlgos.L1CaloFEXAlgosConfig import L1CaloFEXDecoratorCfg
result.merge(L1CaloFEXDecoratorCfg(inputFlags,"jFexTower2SCellDecorator")) result.merge(L1CaloFEXDecoratorCfg(inputFlags,"jFexTower2SCellDecorator",ExtraInfo = False))
#jfex emulated input: EmulatedTowers #jfex emulated input: EmulatedTowers
from L1CaloFEXAlgos.FexEmulatedTowersConfig import jFexEmulatedTowersCfg from L1CaloFEXAlgos.FexEmulatedTowersConfig import jFexEmulatedTowersCfg
...@@ -76,11 +76,11 @@ def JfexInputMonitoringConfig(inputFlags): ...@@ -76,11 +76,11 @@ def JfexInputMonitoringConfig(inputFlags):
DetailsGroup.append( helper.addGroup(JfexInputMonAlg, groupName+"_details_"+str(i) , mainDir)) DetailsGroup.append( helper.addGroup(JfexInputMonAlg, groupName+"_details_"+str(i) , mainDir))
if(i == 1): if(i == 1):
DetailsGroup[i].defineHistogram('DataEt,EmuSum;SumSCell_vs_Data_'+Calosource_names[i], title='Data Et vs Tile Et ('+ Calosource_names[i]+'); Data Et [GeV]; Tile Et [GeV]', DetailsGroup[i].defineHistogram('DataEt_Tile,EmulatedEt_Tile;SumSCell_vs_Data_'+Calosource_names[i], title='Data Et vs Tile Et ('+ Calosource_names[i]+'); Data Et [GeV]; Tile Et [GeV]',
type='TH2F',path=trigPath+"expert/", xbins=200,xmin=0,xmax=100,ybins=200,ymin=0,ymax=100) type='TH2F',path=trigPath+"expert/", xbins=200,xmin=0,xmax=100,ybins=200,ymin=0,ymax=100)
else: else:
DetailsGroup[i].defineHistogram('DataEt,EmuSum;SumSCell_vs_Data_'+Calosource_names[i], title='Data vs SCell Sum Et ('+ Calosource_names[i]+'); Data Et [MeV]; SCell Sum Et [MeV]', DetailsGroup[i].defineHistogram('DataEt,EmulatedEt;SumSCell_vs_Data_'+Calosource_names[i], title='Data vs SCell Sum Et ('+ Calosource_names[i]+'); Data Et [MeV]; SCell Sum Et [MeV]',
type='TH2F',path=trigPath+"expert/", xbins=160,xmin=-2000,xmax=2000,ybins=160,ymin=-2000,ymax=2000) type='TH2F',path=trigPath+"expert/", xbins=160,xmin=-2000,xmax=2000,ybins=160,ymin=-2000,ymax=2000)
...@@ -88,7 +88,10 @@ def JfexInputMonitoringConfig(inputFlags): ...@@ -88,7 +88,10 @@ def JfexInputMonitoringConfig(inputFlags):
myGroup.defineHistogram('region,type;DataErrors', title='jFEX Data mismatches per region; Region; Type', myGroup.defineHistogram('region,type;DataErrors', title='jFEX Data mismatches per region; Region; Type',
type='TH2F',path=trigPath, xbins=7,xmin=0,xmax=7,ybins=2,ymin=0,ymax=2,xlabels=Calosource_names,ylabels=["Invalid codes","Data mismatch"]) type='TH2F',path=trigPath, xbins=7,xmin=0,xmax=7,ybins=2,ymin=0,ymax=2,xlabels=Calosource_names,ylabels=["Invalid codes","Data mismatch"])
myGroup.defineHistogram('TowerEtaInvalid,TowerPhiInvalid;2Dmap_InvalidCodes', title='jFex DataTower Invalid Et codes; #eta; #phi', myGroup.defineHistogram('TowerEtaInvalid,TowerPhiInvalid;2Dmap_InvalidCodes', title='jFex DataTower Invalid Et codes (4095); #eta; #phi',
type='TH2F',path=trigPath, **eta_phi_bins)
myGroup.defineHistogram('TowerEtaEmpty,TowerPhiEmpty;2Dmap_EmptyCodes', title='jFex DataTower Empty Et codes (0); #eta; #phi',
type='TH2F',path=trigPath, **eta_phi_bins) type='TH2F',path=trigPath, **eta_phi_bins)
DecorGroup.defineHistogram('TowerEta,TowerPhi;2Dmap_MismatchedEts', title='jFex DataTower mismatches (no invalid codes); #eta; #phi', DecorGroup.defineHistogram('TowerEta,TowerPhi;2Dmap_MismatchedEts', title='jFex DataTower mismatches (no invalid codes); #eta; #phi',
......
...@@ -86,20 +86,23 @@ StatusCode JfexInputMonitorAlgorithm::fillHistograms( const EventContext& ctx ) ...@@ -86,20 +86,23 @@ StatusCode JfexInputMonitorAlgorithm::fillHistograms( const EventContext& ctx )
// monitored variables for histogramscd // monitored variables for histograms
auto nJfexTowers = Monitored::Scalar<int>("NJfexTowers",0.0); auto nJfexTowers = Monitored::Scalar<int>("NJfexTowers",0.0);
auto Towereta = Monitored::Scalar<float>("TowerEta",0.0); auto Towereta = Monitored::Scalar<float>("TowerEta",0.0);
auto Towerphi = Monitored::Scalar<float>("TowerPhi",0.0); auto Towerphi = Monitored::Scalar<float>("TowerPhi",0.0);
auto ToweretaDeco = Monitored::Scalar<float>("TowerEtaDeco",0.0); auto ToweretaDeco = Monitored::Scalar<float>("TowerEtaDeco",0.0);
auto TowerphiDeco = Monitored::Scalar<float>("TowerPhiDeco",0.0); auto TowerphiDeco = Monitored::Scalar<float>("TowerPhiDeco",0.0);
auto DataEt = Monitored::Scalar<float>("DataEt",0.0); auto DataEt = Monitored::Scalar<float>("DataEt",0.0);
auto SCellSum = Monitored::Scalar<float>("SCellSum",0.0); auto EmulatedEt = Monitored::Scalar<float>("EmulatedEt",0.0);
auto EmuSum = Monitored::Scalar<float>("EmuSum",0.0); auto DataEt_Tile = Monitored::Scalar<float>("DataEt_Tile",0.0);
auto EmulatedEt_Tile = Monitored::Scalar<float>("EmulatedEt_Tile",0.0);
auto region = Monitored::Scalar<int>("region",0.0); auto region = Monitored::Scalar<int>("region",0.0);
auto type = Monitored::Scalar<int>("type",0.0); auto type = Monitored::Scalar<int>("type",0.0);
auto frac_SCellSum = Monitored::Scalar<float>("frac_SCellSum",0.0); auto frac_SCellSum = Monitored::Scalar<float>("frac_SCellSum",0.0);
auto ToweretaInvalid = Monitored::Scalar<float>("TowerEtaInvalid",-99.0); auto ToweretaInvalid = Monitored::Scalar<float>("TowerEtaInvalid",-99.0);
auto TowerPhiInvalid = Monitored::Scalar<float>("TowerPhiInvalid",-99.0); auto TowerPhiInvalid = Monitored::Scalar<float>("TowerPhiInvalid",-99.0);
auto ToweretaEmpty = Monitored::Scalar<float>("TowerEtaEmpty",-99.0);
auto TowerPhiEmpty = Monitored::Scalar<float>("TowerPhiEmpty",-99.0);
auto Towerglobaleta = Monitored::Scalar<int>("TowerGlobalEta",0); auto Towerglobaleta = Monitored::Scalar<int>("TowerGlobalEta",0);
auto Towerglobalphi = Monitored::Scalar<uint32_t>("TowerGlobalPhi",0); auto Towerglobalphi = Monitored::Scalar<uint32_t>("TowerGlobalPhi",0);
auto Towermodule = Monitored::Scalar<uint8_t>("TowerModule",0); auto Towermodule = Monitored::Scalar<uint8_t>("TowerModule",0);
...@@ -145,25 +148,63 @@ StatusCode JfexInputMonitorAlgorithm::fillHistograms( const EventContext& ctx ) ...@@ -145,25 +148,63 @@ StatusCode JfexInputMonitorAlgorithm::fillHistograms( const EventContext& ctx )
ATH_MSG_WARNING("DataTower: "<<TTID<< " with Calosource: "<<source<< "is repeated. It shouldn't! "); ATH_MSG_WARNING("DataTower: "<<TTID<< " with Calosource: "<<source<< "is repeated. It shouldn't! ");
} }
DataEt = jTowerEtMeV(*dataTower);
EmulatedEt = SCellEtMeV(*dataTower);
// If Tile (Calosource == 1) then use Tile information
if(source == 1){
EmulatedEt = TileEtMeV(*dataTower);
DataEt_Tile = DataEt/Gaudi::Units::GeV;
EmulatedEt_Tile = EmulatedEt/Gaudi::Units::GeV;
fill(m_Grouphist+"_details_"+std::to_string(source),DataEt_Tile,EmulatedEt_Tile);
}
else{
fill(m_Grouphist+"_details_"+std::to_string(source),DataEt,EmulatedEt);
}
fill(m_Grouphist+"_decorated_all" ,DataEt,EmulatedEt);
DataEt = jTowerEtMeV(*dataTower);
SCellSum = SCellEtMeV(*dataTower);
fill(m_Grouphist+"_decorated_all",DataEt,SCellSum);
//Looking at decorated variables //Looking at decorated variables. Is real time path data Et the same as the simulated one (encoded Et)?
if( (dataTower->et_count()).at(0) != emulated_jtowerEt(*dataTower)) { if( (dataTower->et_count()).at(0) != emulated_jtowerEt(*dataTower)) {
std::string location = "EM layer"; std::string location = "EM layer";
// if source is Tile, HEC, FCAL2 and FCAL3 then location is HAD if(dataTower->Calosource()== 1 || dataTower->Calosource()== 3 || dataTower->Calosource() == 5 || dataTower->Calosource() == 6 ){ // if source is Tile, HEC, FCAL2 and FCAL3 then location is HAD
if(dataTower->Calosource()== 1 || dataTower->Calosource()== 3 || dataTower->Calosource() == 5 || dataTower->Calosource() == 6 ){
location="HAD layer"; location="HAD layer";
} }
if( (dataTower->et_count()).at(0) != m_InvalidCode ){ if( (dataTower->et_count()).at(0) != m_InvalidCode ){
frac_SCellSum = DataEt != 0 ? (SCellSum - DataEt)/DataEt : 0; ATH_MSG_WARNING("Tower:"<< TTID << " source:"<< +dataTower->Calosource() << " for eventNumber:"<< GetEventInfo(ctx)->eventNumber()<< " and LB:"<<GetEventInfo(ctx)->lumiBlock() << ". DataTower Et:"<< (dataTower->et_count()).at(0) <<"/"<< DataEt<<" vs EmulatedTower Et:" << emulated_jtowerEt(*dataTower)<<"/"<< EmulatedEt);
fill(m_Grouphist+"_decorated",Towereta,Towerphi,DataEt,SCellSum,frac_SCellSum);
/*Commented block, needed for further debugging
for(uint i=0;i<(dataTower->SCellEt()).size();i++){
printf("%11.1f ",(dataTower->SCellEt()).at(i) );
}
printf("\n");
for(uint i=0;i<(dataTower->SCellEta()).size();i++){
printf("%5.2f/%5.2f ",(dataTower->SCellEta()).at(i),(dataTower->SCellPhi()).at(i) );
}
printf("\n");
for(uint i=0;i<(dataTower->SCellEta()).size();i++){
printf(" 0x%08x ",(dataTower->SCellID()).at(i) );
}
printf("\n");
for(uint i=0;i<(dataTower->SCellEta()).size();i++){
printf("%11d ",(dataTower->SCellMask()).at(i) );
}
printf("\n");
*/
frac_SCellSum = DataEt != 0 ? (EmulatedEt - DataEt)/DataEt : 0;
fill(m_Grouphist+"_decorated",Towereta,Towerphi,DataEt,EmulatedEt,frac_SCellSum);
genError("Input_Mismatch", location); genError("Input_Mismatch", location);
} }
else{ else{
...@@ -176,14 +217,6 @@ StatusCode JfexInputMonitorAlgorithm::fillHistograms( const EventContext& ctx ) ...@@ -176,14 +217,6 @@ StatusCode JfexInputMonitorAlgorithm::fillHistograms( const EventContext& ctx )
fill(m_Grouphist,region,type); fill(m_Grouphist,region,type);
} }
EmuSum = SCellEtMeV(*dataTower);
if(source == 1){
DataEt /= 1e3;
EmuSum = TileEtMeV(*dataTower)/1e3;
}
fill(m_Grouphist+"_details_"+std::to_string(source),DataEt,EmuSum);
} }
fill(m_Grouphist,Towereta,Towerphi); fill(m_Grouphist,Towereta,Towerphi);
...@@ -219,12 +252,21 @@ StatusCode JfexInputMonitorAlgorithm::fillHistograms( const EventContext& ctx ) ...@@ -219,12 +252,21 @@ StatusCode JfexInputMonitorAlgorithm::fillHistograms( const EventContext& ctx )
Toweretcount_fcal2=Toweret_count.at(0); Toweretcount_fcal2=Toweret_count.at(0);
Toweretcount_fcal3=Toweret_count.at(0); Toweretcount_fcal3=Toweret_count.at(0);
if(Toweret_count.at(0) == m_InvalidCode){ if(dataTower->Calosource() != 1){ // Only for LATOME, not Tile
ToweretaInvalid=dataTower->eta(); if(Toweret_count.at(0) == m_InvalidCode){
TowerPhiInvalid=dataTower->phi(); ToweretaInvalid=dataTower->eta();
fill(m_Grouphist,ToweretaInvalid,TowerPhiInvalid); TowerPhiInvalid=dataTower->phi();
fill(m_Grouphist,ToweretaInvalid,TowerPhiInvalid);
}
if(Toweret_count.at(0) == m_EmptyCode){
ToweretaEmpty=dataTower->eta();
TowerPhiEmpty=dataTower->phi();
fill(m_Grouphist,ToweretaEmpty,TowerPhiEmpty);
}
} }
if(Towercalosource==0) { if(Towercalosource==0) {
fill(m_Grouphist,Toweretcount_barrel); fill(m_Grouphist,Toweretcount_barrel);
} }
......
...@@ -39,6 +39,7 @@ class JfexInputMonitorAlgorithm : public AthMonitorAlgorithm { ...@@ -39,6 +39,7 @@ class JfexInputMonitorAlgorithm : public AthMonitorAlgorithm {
unsigned int m_InvalidCode = 4095; unsigned int m_InvalidCode = 4095;
unsigned int m_EmptyCode = 0;
int codedVal(int, int) const; int codedVal(int, int) const;
......
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