Skip to content
Snippets Groups Projects
Commit 34a44f85 authored by Vakhtang Tsulaia's avatar Vakhtang Tsulaia
Browse files

Merge branch 'LArCalibUtils_forSC' into 'master'

LAr SuperCells processing in LArCalibUtils

See merge request atlas/athena!37064
parents d27df0f0 3deae17f
No related branches found
No related tags found
No related merge requests found
...@@ -23,6 +23,7 @@ class LArCalibDigitMaker : public AthAlgorithm ...@@ -23,6 +23,7 @@ class LArCalibDigitMaker : public AthAlgorithm
StatusCode finalize(){return StatusCode::SUCCESS;} StatusCode finalize(){return StatusCode::SUCCESS;}
private: private:
SG::ReadCondHandleKey<LArCalibLineMapping> m_calibMapKey{this,"CalibMapKey","LArCalibLineMap","SG Key of calib line mapping object"}; SG::ReadCondHandleKey<LArCalibLineMapping> m_calibMapKey{this,"CalibMapKey","LArCalibLineMap","SG Key of calib line mapping object"};
SG::ReadCondHandleKey<LArCalibLineMapping> m_calibMapSCKey{this,"CalibMapSCKey","LArCalibIdMapSC","SG Key of calib line mapping object"};
std::vector<std::string> m_keylist; std::vector<std::string> m_keylist;
std::vector<unsigned> m_vPattern; std::vector<unsigned> m_vPattern;
std::vector<unsigned> m_vDAC; std::vector<unsigned> m_vDAC;
...@@ -31,6 +32,8 @@ class LArCalibDigitMaker : public AthAlgorithm ...@@ -31,6 +32,8 @@ class LArCalibDigitMaker : public AthAlgorithm
unsigned m_nTrigger; unsigned m_nTrigger;
double m_delayScale; double m_delayScale;
bool m_dontRun; bool m_dontRun;
bool m_isSC;
}; };
#endif #endif
...@@ -47,8 +47,9 @@ ...@@ -47,8 +47,9 @@
#include "LArCabling/LArOnOffIdMapping.h" #include "LArCabling/LArOnOffIdMapping.h"
#include "StoreGate/ReadCondHandleKey.h" #include "StoreGate/ReadCondHandleKey.h"
#include "LArRecConditions/LArCalibLineMapping.h"
//#include "LArCalibTriggerAccumulator.h" //#include "LArCalibTriggerAccumulator.h"
#include "CaloDetDescr/ICaloSuperCellIDTool.h"
#include <vector> #include <vector>
#include <string> #include <string>
#include <map> #include <map>
...@@ -76,6 +77,8 @@ public: ...@@ -76,6 +77,8 @@ public:
private: private:
SG::ReadCondHandleKey<LArOnOffIdMapping> m_cablingKey{this, "OnOffMap", "LArOnOffIdMap", "SG key for mapping object"}; SG::ReadCondHandleKey<LArOnOffIdMapping> m_cablingKey{this, "OnOffMap", "LArOnOffIdMap", "SG key for mapping object"};
SG::ReadCondHandleKey<LArOnOffIdMapping> m_cablingKeySC{this,"ScCablingKey","LArOnOffIdMapSC","SG Key of SC LArOnOffIdMapping object"};
//Private member functions //Private member functions
// choose reconstruction mode (i.e. OF or Parabola) // choose reconstruction mode (i.e. OF or Parabola)
void chooseRecoMode() ; void chooseRecoMode() ;
...@@ -100,7 +103,8 @@ private: ...@@ -100,7 +103,8 @@ private:
ToolHandle<LArParabolaPeakRecoTool> m_peakParabolaTool; ToolHandle<LArParabolaPeakRecoTool> m_peakParabolaTool;
ToolHandle<LArShapePeakRecoTool> m_peakShapeTool; ToolHandle<LArShapePeakRecoTool> m_peakShapeTool;
ToolHandle<LArOFPeakRecoTool> m_peakOFTool; ToolHandle<LArOFPeakRecoTool> m_peakOFTool;
ToolHandle<ICaloSuperCellIDTool> m_sc2ccMappingTool;
unsigned m_event_counter; unsigned m_event_counter;
int m_delay; int m_delay;
int m_ipassShape; int m_ipassShape;
...@@ -162,6 +166,14 @@ private: ...@@ -162,6 +166,14 @@ private:
uint16_t m_fatalFebErrorPattern; uint16_t m_fatalFebErrorPattern;
// For calib line mapping, only used for SC for now
IntegerProperty m_nPulsedCalibLines;
std::vector<int> m_pulsedCalibLines;
SG::ReadCondHandleKey<LArCalibLineMapping> m_calibMapKey{this,"CalibMapKey","LArCalibLineMap","SG Key of calib line mapping object"};
SG::ReadCondHandleKey<LArCalibLineMapping> m_calibMapSCKey{this,"CalibMapSCKey","LArCalibIdMapSC","SG Key of calib line mapping object"};
}; };
#endif #endif
...@@ -49,7 +49,6 @@ LArAutoCorrMaker::LArAutoCorrMaker(const std::string& name, ISvcLocator* pSvcLoc ...@@ -49,7 +49,6 @@ LArAutoCorrMaker::LArAutoCorrMaker(const std::string& name, ISvcLocator* pSvcLoc
declareProperty("KeyOutput", m_keyoutput="LArAutoCorr"); declareProperty("KeyOutput", m_keyoutput="LArAutoCorr");
declareProperty("events_ref", m_nref=50); declareProperty("events_ref", m_nref=50);
declareProperty("nsigma", m_rms_cut=5); declareProperty("nsigma", m_rms_cut=5);
declareProperty("Nsamples", m_nsamples=32);
declareProperty("normalize", m_normalize=1); declareProperty("normalize", m_normalize=1);
declareProperty("physics", m_physics=0); declareProperty("physics", m_physics=0);
declareProperty("GroupingType", m_groupingType); declareProperty("GroupingType", m_groupingType);
...@@ -139,7 +138,10 @@ StatusCode LArAutoCorrMaker::execute() ...@@ -139,7 +138,10 @@ StatusCode LArAutoCorrMaker::execute()
ATH_MSG_DEBUG("Got LArDigitContainer with key " << *key_it <<", size=" << larDigitContainer->size()); ATH_MSG_DEBUG("Got LArDigitContainer with key " << *key_it <<", size=" << larDigitContainer->size());
++m_nEvents; ++m_nEvents;
LArDigitContainer::const_iterator it=larDigitContainer->begin(); LArDigitContainer::const_iterator it=larDigitContainer->begin();
LArDigitContainer::const_iterator it_end=larDigitContainer->end(); LArDigitContainer::const_iterator it_end=larDigitContainer->end();
m_nsamples = (*larDigitContainer->begin())->nsamples();
ATH_MSG_DEBUG("NSAMPLES (from digit container) = " << m_nsamples );
for(;it!=it_end;it++){ for(;it!=it_end;it++){
const HWIdentifier chid=(*it)->hardwareID(); const HWIdentifier chid=(*it)->hardwareID();
const CaloGain::CaloGain gain=(*it)->gain(); const CaloGain::CaloGain gain=(*it)->gain();
......
...@@ -33,6 +33,7 @@ LArCalibDigitMaker::LArCalibDigitMaker(const std::string& name, ISvcLocator* pSv ...@@ -33,6 +33,7 @@ LArCalibDigitMaker::LArCalibDigitMaker(const std::string& name, ISvcLocator* pSv
declareProperty("BoardIDs",m_vBoardIDs); declareProperty("BoardIDs",m_vBoardIDs);
declareProperty("DelayScale",m_delayScale=(25./240.)*ns); declareProperty("DelayScale",m_delayScale=(25./240.)*ns);
declareProperty("DontRun",m_dontRun=false); //Put only Board configuration in DetectorStore declareProperty("DontRun",m_dontRun=false); //Put only Board configuration in DetectorStore
declareProperty("isSC",m_isSC=false);
} }
LArCalibDigitMaker::~LArCalibDigitMaker() LArCalibDigitMaker::~LArCalibDigitMaker()
...@@ -42,7 +43,18 @@ LArCalibDigitMaker::~LArCalibDigitMaker() ...@@ -42,7 +43,18 @@ LArCalibDigitMaker::~LArCalibDigitMaker()
StatusCode LArCalibDigitMaker::initialize() StatusCode LArCalibDigitMaker::initialize()
{ {
ATH_MSG_DEBUG ( "======== LArCalibDigitMaker Initialize ========" ); ATH_MSG_DEBUG ( "======== LArCalibDigitMaker Initialize ========" );
ATH_CHECK( m_calibMapKey.initialize() ); // bool containsKeySC = false;
for (unsigned int i = 0; i < m_keylist.size(); ++i) {
if (m_keylist.at(i).compare("SC") == 0) {
m_isSC = true;
ATH_MSG_DEBUG ( "======== LArCalibDigitMaker isSC is True ========" );
}
}
if(m_isSC){
ATH_CHECK( m_calibMapSCKey.initialize() );
}else{
ATH_CHECK( m_calibMapKey.initialize() );
}
// std::cout << "Pattern.size()=" << m_vPattern.size() << std::endl; // std::cout << "Pattern.size()=" << m_vPattern.size() << std::endl;
// std::cout << "DAC.size()=" << m_vDAC.size() << std::endl; // std::cout << "DAC.size()=" << m_vDAC.size() << std::endl;
...@@ -51,6 +63,9 @@ StatusCode LArCalibDigitMaker::initialize() ...@@ -51,6 +63,9 @@ StatusCode LArCalibDigitMaker::initialize()
// std::cout << "BoardIDs.size()=" << m_vBoardIDs.size() << std::endl; // std::cout << "BoardIDs.size()=" << m_vBoardIDs.size() << std::endl;
//Check if calibParams are given consistently: Either all or non //Check if calibParams are given consistently: Either all or non
if (!((m_vBoardIDs.size()==0 && m_vDAC.size()==0 && m_vDelay.size()==0 && m_vPattern.size()==0 && m_nTrigger==0) || if (!((m_vBoardIDs.size()==0 && m_vDAC.size()==0 && m_vDelay.size()==0 && m_vPattern.size()==0 && m_nTrigger==0) ||
(m_vBoardIDs.size() && m_vDAC.size() && m_vDelay.size() && m_vPattern.size() && m_nTrigger))) { (m_vBoardIDs.size() && m_vDAC.size() && m_vDelay.size() && m_vPattern.size() && m_nTrigger))) {
ATH_MSG_ERROR ( "Problem with jobOptions! Please set either ALL calibration parameters" << std:: endl ATH_MSG_ERROR ( "Problem with jobOptions! Please set either ALL calibration parameters" << std:: endl
...@@ -92,8 +107,18 @@ StatusCode LArCalibDigitMaker::execute() { ...@@ -92,8 +107,18 @@ StatusCode LArCalibDigitMaker::execute() {
const EventContext& ctx = Gaudi::Hive::currentContext(); const EventContext& ctx = Gaudi::Hive::currentContext();
SG::ReadCondHandle<LArCalibLineMapping> clHdl{m_calibMapKey};
const LArCalibLineMapping* clcabling{*clHdl}; const LArCalibLineMapping *clcabling=0;
if(m_isSC) {
ATH_MSG_DEBUG ( "======== LArCalibDigitMaker: using SC calib line map" );
SG::ReadCondHandle<LArCalibLineMapping> clHdl{m_calibMapSCKey};
clcabling=*clHdl;
} else {
SG::ReadCondHandle<LArCalibLineMapping> clHdl{m_calibMapKey};
clcabling=*clHdl;
}
if(!clcabling) { if(!clcabling) {
ATH_MSG_ERROR( "Do not have cabling mapping from key " << m_calibMapKey.key() ); ATH_MSG_ERROR( "Do not have cabling mapping from key " << m_calibMapKey.key() );
return StatusCode::FAILURE; return StatusCode::FAILURE;
......
...@@ -26,6 +26,7 @@ LArRampBuilder::LArRampBuilder(const std::string& name, ISvcLocator* pSvcLocator ...@@ -26,6 +26,7 @@ LArRampBuilder::LArRampBuilder(const std::string& name, ISvcLocator* pSvcLocator
m_peakParabolaTool("LArParabolaPeakRecoTool"), m_peakParabolaTool("LArParabolaPeakRecoTool"),
m_peakShapeTool("LArShapePeakRecoTool"), m_peakShapeTool("LArShapePeakRecoTool"),
m_peakOFTool("LArOFPeakRecoTool"), m_peakOFTool("LArOFPeakRecoTool"),
m_sc2ccMappingTool("CaloSuperCellIDTool"),
m_event_counter(0), m_event_counter(0),
m_recoType(OF), m_recoType(OF),
m_onlineHelper(), m_onlineHelper(),
...@@ -87,6 +88,7 @@ StatusCode LArRampBuilder::initialize() ...@@ -87,6 +88,7 @@ StatusCode LArRampBuilder::initialize()
StatusCode sc; StatusCode sc;
if ( m_isSC ) { if ( m_isSC ) {
ATH_MSG_DEBUG("==== LArRampBuilder - looking at SuperCells ====");
const LArOnline_SuperCellID* ll; const LArOnline_SuperCellID* ll;
sc = detStore()->retrieve(ll, "LArOnline_SuperCellID"); sc = detStore()->retrieve(ll, "LArOnline_SuperCellID");
if (sc.isFailure()) { if (sc.isFailure()) {
...@@ -111,8 +113,19 @@ StatusCode LArRampBuilder::initialize() ...@@ -111,8 +113,19 @@ StatusCode LArRampBuilder::initialize()
} }
} }
if ( m_isSC ) ATH_CHECK( m_sc2ccMappingTool.retrieve() );
ATH_CHECK( m_cablingKey.initialize() ); ATH_CHECK( m_cablingKey.initialize() );
if ( m_isSC ) ATH_CHECK( m_cablingKeySC.initialize() );
// Initialise keys for calib line mapping
if (m_isSC){
ATH_CHECK( m_calibMapSCKey.initialize() );
ATH_CHECK( m_calibMapKey.initialize() );
}else{
ATH_CHECK( m_calibMapKey.initialize() );
}
if(m_doBadChannelMask) { if(m_doBadChannelMask) {
sc=m_badChannelMask.retrieve(); sc=m_badChannelMask.retrieve();
...@@ -151,6 +164,9 @@ StatusCode LArRampBuilder::initialize() ...@@ -151,6 +164,9 @@ StatusCode LArRampBuilder::initialize()
ATH_MSG_INFO( " register callback for HEC map " ); ATH_MSG_INFO( " register callback for HEC map " );
} }
} }
return StatusCode::SUCCESS; return StatusCode::SUCCESS;
} }
...@@ -229,6 +245,55 @@ StatusCode LArRampBuilder::execute() ...@@ -229,6 +245,55 @@ StatusCode LArRampBuilder::execute()
if (m_event_counter==1) if (m_event_counter==1)
ATH_MSG_WARNING("No FebErrorSummaryObject found! Feb errors not checked!"); ATH_MSG_WARNING("No FebErrorSummaryObject found! Feb errors not checked!");
///*
// calib line mapping for SC
const LArCalibLineMapping *clCont=0;
const LArCalibLineMapping *clContSC=0;
if(m_isSC) {
ATH_MSG_DEBUG( "LArRampBuilder: using SC calib map" );
SG::ReadCondHandle<LArCalibLineMapping> clHdlSC{m_calibMapSCKey};
clContSC=*clHdlSC;
if(!clContSC) {
ATH_MSG_WARNING( "Do not have SC calib line mapping !!!" );
return StatusCode::FAILURE;
} else {
ATH_MSG_DEBUG( "DONE THE SETUP SC calib line" );
}
}//} else {
// calib line mapping for main readout
SG::ReadCondHandle<LArCalibLineMapping> clHdl{m_calibMapKey};
clCont=*clHdl;
//}
if(!clCont) {
ATH_MSG_WARNING( "Do not have calib line mapping !!!" );
return StatusCode::FAILURE;
} else {
ATH_MSG_DEBUG( "DONE THE SETUP calib line" );
}
// end of calib line mapping
// */
const LArOnOffIdMapping* cabling(0);
if( m_isSC ){
SG::ReadCondHandle<LArOnOffIdMapping> cablingHdl{m_cablingKeySC};
cabling = {*cablingHdl};
if(!cabling) {
ATH_MSG_ERROR("Do not have mapping object " << m_cablingKeySC.key());
return StatusCode::FAILURE;
}
}else{
SG::ReadCondHandle<LArOnOffIdMapping> cablingHdl{m_cablingKey};
cabling = {*cablingHdl};
if(!cabling) {
ATH_MSG_ERROR("Do not have mapping object " << m_cablingKey.key());
return StatusCode::FAILURE;
}
}
std::vector<std::string>::const_iterator key_it=m_keylist.begin(); std::vector<std::string>::const_iterator key_it=m_keylist.begin();
std::vector<std::string>::const_iterator key_it_e=m_keylist.end(); std::vector<std::string>::const_iterator key_it_e=m_keylist.end();
...@@ -301,6 +366,8 @@ StatusCode LArRampBuilder::execute() ...@@ -301,6 +366,8 @@ StatusCode LArRampBuilder::execute()
int DAC = larCaliWave.getDAC(); int DAC = larCaliWave.getDAC();
IdentifierHash chidwave_hash = m_onlineHelper->channel_Hash(itVec.channelId()); IdentifierHash chidwave_hash = m_onlineHelper->channel_Hash(itVec.channelId());
bool IsBad = false; bool IsBad = false;
for(int i=0;i<24*NSamplesKeep;i++){ for(int i=0;i<24*NSamplesKeep;i++){
tempWave[i] = larCaliWave.getSample(i); tempWave[i] = larCaliWave.getSample(i);
...@@ -371,6 +438,27 @@ StatusCode LArRampBuilder::execute() ...@@ -371,6 +438,27 @@ StatusCode LArRampBuilder::execute()
} }
} }
// HEC Calibration lines
const std::vector<HWIdentifier>& calibLineV = clCont->calibSlotLine(chid);
ATH_MSG_DEBUG( "pulsed lines: "<< calibLineV.size() );
if(m_isSC){
const std::vector<HWIdentifier>& calibLineVSC = clContSC->calibSlotLine(chid);
ATH_MSG_DEBUG( "pulsed SC lines: "<< calibLineVSC.size() );
}
// std::vector<HWIdentifier>::const_iterator calibLineIt = calibLineV.begin();
// for(calibLineIt = calibLineV.begin(); calibLineIt != calibLineV.end();++calibLineIt) {
// ATH_MSG_DEBUG( "CALIB LINE "<< m_onlineHelper->channel(*calibLineIt) );
// }
std::vector<Identifier> ccellIds(0);
if( m_isSC ){
Identifier myofflineID = cabling->cnvToIdentifier((*it)->hardwareID()) ;
ccellIds = m_sc2ccMappingTool->superCellToOfflineID( myofflineID );
ATH_MSG_DEBUG( "Cell: " << myofflineID << " " << (*it)->channelID() << " " << chid << " " << ccellIds.size() << " : " << ccellIds );
}
if (m_delay==-1) { //First (pulsed) cell to be processed: if (m_delay==-1) { //First (pulsed) cell to be processed:
m_delay=(*it)->delay(); m_delay=(*it)->delay();
} }
...@@ -440,16 +528,28 @@ StatusCode LArRampBuilder::execute() ...@@ -440,16 +528,28 @@ StatusCode LArRampBuilder::execute()
// << " mean " << (*it)->mean()[0] << " " << (*it)->mean()[1] << " " << (*it)->mean()[2] << " " << (*it)->mean()[3] // << " mean " << (*it)->mean()[0] << " " << (*it)->mean()[1] << " " << (*it)->mean()[2] << " " << (*it)->mean()[3]
// << " " << (*it)->mean()[4] << " " << (*it)->mean()[5] << " " << (*it)->mean()[6] << std::endl; // << " " << (*it)->mean()[4] << " " << (*it)->mean()[5] << " " << (*it)->mean()[6] << std::endl;
// } // }
// } // }
LArCalibTriggerAccumulator& accpoints=(m_ramps->get(chid,gain))[(*it)->DAC()]; if (m_isSC){ // Changed here to give DAC value for supercell, rather than DAC for a constituent cell
//rawramp.addAccumulatedEvent( (*it)->mean(),(*it)->RMS(), (*it)->nTriggers() ); LArCalibTriggerAccumulator& accpoints=(m_ramps->get(chid,gain))[(*it)->DAC()*ccellIds.size()];
LArCalibTriggerAccumulator::ERRTYPE ec=accpoints.add((*it)->sampleSum(),(*it)->sample2Sum(),(*it)->nTriggers()); LArCalibTriggerAccumulator::ERRTYPE ec=accpoints.add((*it)->sampleSum(),(*it)->sample2Sum(),(*it)->nTriggers());
if (ec==LArCalibTriggerAccumulator::WrongNSamples) { if (ec==LArCalibTriggerAccumulator::WrongNSamples) {
ATH_MSG_ERROR( "Failed to accumulate sub-steps: Inconsistent number of ADC samples"); ATH_MSG_ERROR( "Failed to accumulate sub-steps: Inconsistent number of ADC samples");
} }
if (ec==LArCalibTriggerAccumulator::NumericOverflow) { if (ec==LArCalibTriggerAccumulator::NumericOverflow) {
ATH_MSG_ERROR( "Failed to accumulate sub-steps: Numeric Overflow"); ATH_MSG_ERROR( "Failed to accumulate sub-steps: Numeric Overflow");
}
}else{
LArCalibTriggerAccumulator& accpoints=(m_ramps->get(chid,gain))[(*it)->DAC()];
//rawramp.addAccumulatedEvent( (*it)->mean(),(*it)->RMS(), (*it)->nTriggers() );
LArCalibTriggerAccumulator::ERRTYPE ec=accpoints.add((*it)->sampleSum(),(*it)->sample2Sum(),(*it)->nTriggers());
if (ec==LArCalibTriggerAccumulator::WrongNSamples) {
ATH_MSG_ERROR( "Failed to accumulate sub-steps: Inconsistent number of ADC samples");
}
if (ec==LArCalibTriggerAccumulator::NumericOverflow) {
ATH_MSG_ERROR( "Failed to accumulate sub-steps: Numeric Overflow");
}
} }
}//End loop over all cells }//End loop over all cells
} //End loop over all containers } //End loop over all containers
...@@ -483,13 +583,17 @@ StatusCode LArRampBuilder::stop() ...@@ -483,13 +583,17 @@ StatusCode LArRampBuilder::stop()
else else
larRampComplete=NULL; larRampComplete=NULL;
SG::ReadCondHandle<LArOnOffIdMapping> cablingHdl{m_cablingKey}; SG::ReadCondHandle<LArOnOffIdMapping> cablingHdl{m_cablingKey};
const LArOnOffIdMapping* cabling{*cablingHdl}; const LArOnOffIdMapping* cabling{*cablingHdl};
if(!cabling) { if(!cabling) {
ATH_MSG_ERROR("Do not have mapping object " << m_cablingKey.key()); ATH_MSG_ERROR("Do not have mapping object " << m_cablingKey.key());
return StatusCode::FAILURE; return StatusCode::FAILURE;
} }
int containerCounter=0; int containerCounter=0;
//Outermost loop goes over all gains (different containers). //Outermost loop goes over all gains (different containers).
//for (CaloGain::CaloGain gain=CaloGain::LARHIGHGAIN;gain<CaloGain::LARNGAIN;gain++) { //for (CaloGain::CaloGain gain=CaloGain::LARHIGHGAIN;gain<CaloGain::LARNGAIN;gain++) {
...@@ -525,6 +629,9 @@ StatusCode LArRampBuilder::stop() ...@@ -525,6 +629,9 @@ StatusCode LArRampBuilder::stop()
std::vector<float> adc0v; std::vector<float> adc0v;
bool isADCsat = false; bool isADCsat = false;
for (;dac_it!=dac_it_e;dac_it++) { for (;dac_it!=dac_it_e;dac_it++) {
LArRawRamp::RAMPPOINT_t ramppoint; LArRawRamp::RAMPPOINT_t ramppoint;
......
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