Commit ffd120f2 authored by Rachid Mazini's avatar Rachid Mazini
Browse files

Merge branch 'LArCafJobs-21.0-Xtalk3' into '21.0'

Add possibility to store pulse shape for cross-talk studies

See merge request !43629
parents 12c3d61c 74bb9e80
......@@ -22,12 +22,16 @@
#include "LArElecCalib/ILArPedestal.h"
#include "CaloUtils/CaloCellList.h"
LArReadCells::LArReadCells( const std::string& name, ISvcLocator* pSvcLocator ) : AthAlgorithm( name, pSvcLocator ){
m_etcut=-10000.;
m_etcut=7500.;
m_etcut2=7500.;
declareProperty("etCut",m_etcut);
declareProperty("etCut2",m_etcut2);
}
......@@ -57,7 +61,7 @@ StatusCode LArReadCells::initialize() {
m_tree->Branch("QuaCell", m_QuaCell,"quaCell[ncells]/I");
m_tree->Branch("GainCell", m_GainCell,"gainCell[ncells]/I");
m_tree->Branch("HwidCell", m_HwidCell,"hwidCell[ncells]/I");
m_tree->Branch("ADC",m_ADC,"ADC[ncells][32]/I");
m_tree->Branch("ADC",m_ADC,"ADC[ncells][32]/F");
ATH_CHECK(detStore()->retrieve(m_caloIdMgr));
m_calo_id = m_caloIdMgr->getCaloCell_ID();
......@@ -79,8 +83,6 @@ StatusCode LArReadCells::finalize() {
StatusCode LArReadCells::execute() {
ATH_MSG_DEBUG ("Executing " << name() << "...");
std::cout << " Et cut is " << m_etcut << std::endl;
const ILArPedestal* larPedestal = nullptr;
if( detStore()->retrieve(larPedestal).isFailure() ){
std::cout << " cannot retrieve pedestal " << std::endl;
......@@ -88,7 +90,6 @@ StatusCode LArReadCells::execute() {
const xAOD::EventInfo* eventInfo = 0;
ATH_CHECK( evtStore()->retrieve( eventInfo) );
std::cout << " run number " << eventInfo->runNumber() << std::endl;
m_runNumber = eventInfo->runNumber();
m_eventNumber = eventInfo->eventNumber();
......@@ -103,7 +104,6 @@ StatusCode LArReadCells::execute() {
const LArDigitContainer* digit_container;
if (evtStore()->contains<LArDigitContainer>("FREE")) {
std::cout << " retrieving digit container " << std::endl;
CHECK(evtStore()->retrieve(digit_container,"FREE"));
LArDigitContainer::const_iterator first_digit = digit_container->begin();
LArDigitContainer::const_iterator end_digit = digit_container->end();
......@@ -117,25 +117,48 @@ StatusCode LArReadCells::execute() {
}
std::cout << " retrieving cell container " << std::endl;
const CaloCellContainer* cell_container;
CHECK( evtStore()->retrieve(cell_container,"AllCalo"));
std::vector<int> iflag_cell;
iflag_cell.resize(nCell,0);
CaloCellContainer::const_iterator first_cell = cell_container->begin();
CaloCellContainer::const_iterator end_cell = cell_container->end();
m_ncells=0;
for (; first_cell != end_cell; ++first_cell)
{
Identifier cellID = (*first_cell)->ID();
int index = (int) (m_calo_id->calo_cell_hash(cellID));
double et = (*first_cell)->et();
if (et > m_etcut && !(m_calo_id->is_tile(cellID)) ){
iflag_cell[index]=1;
// select only layer 1 cells 2.2-2.4 in eta
// if (m_calo_id->calo_sample(cellID)!=4) continue;
// if ((*first_cell)->eta()<2.2) continue;
// if ((*first_cell)->eta()>2.4) continue;
if ((m_calo_id->calo_sample(cellID)==CaloSampling::CaloSample::EMB2 || m_calo_id->calo_sample(cellID)==CaloSampling::CaloSample::EME2) && et>m_etcut2) {
CaloCellList myList(cell_container);
myList.select((*first_cell)->eta(),(*first_cell)->phi(),0.10);
for (const CaloCell* cell : myList) {
Identifier cellID2 =cell->ID();
int index2 = (int)(m_calo_id->calo_cell_hash(cellID2));
iflag_cell[index2]=1;
}
}
}
}
first_cell = cell_container->begin();
for (; first_cell != end_cell; ++first_cell) {
Identifier cellID = (*first_cell)->ID();
int index = (int) (m_calo_id->calo_cell_hash(cellID));
if (iflag_cell[index]==1 ){
m_ECell[m_ncells]= (*first_cell)->energy();
m_TCell[m_ncells]= (*first_cell)->time();
......@@ -146,31 +169,33 @@ StatusCode LArReadCells::execute() {
m_QuaCell[m_ncells]=(*first_cell)->quality();
m_GainCell[m_ncells]=(*first_cell)->gain();
HWIdentifier hwid = m_larCablingSvc->createSignalChannelID(cellID);
int barrel_ec = m_lar_online_id->barrel_ec(hwid);
int pos_neg = m_lar_online_id->pos_neg(hwid);
int FT = m_lar_online_id->feedthrough(hwid);
int slot = m_lar_online_id->slot(hwid);
int channel = m_lar_online_id->channel(hwid);
int myid=0;
if (barrel_ec<2 && pos_neg<2 && FT<32 && slot<16 && channel<128)
myid = (channel) | (slot << 7) | (FT<<11) | (pos_neg << 16) | (barrel_ec << 17);
float pedestal=0.;
if (larPedestal) {
pedestal = larPedestal->pedestal(cellID,(*first_cell)->gain());
}
int myid=0;
for (int i=0;i<32;i++) m_ADC[m_ncells][i]=0.;
if (!(m_calo_id->is_tile(cellID))) {
HWIdentifier hwid = m_larCablingSvc->createSignalChannelID(cellID);
int barrel_ec = m_lar_online_id->barrel_ec(hwid);
int pos_neg = m_lar_online_id->pos_neg(hwid);
int FT = m_lar_online_id->feedthrough(hwid);
int slot = m_lar_online_id->slot(hwid);
int channel = m_lar_online_id->channel(hwid);
if (barrel_ec<2 && pos_neg<2 && FT<32 && slot<16 && channel<128)
myid = (channel) | (slot << 7) | (FT<<11) | (pos_neg << 16) | (barrel_ec << 17);
if (larPedestal) {
pedestal = larPedestal->pedestal(cellID,(*first_cell)->gain());
}
m_HwidCell[m_ncells]=myid;
m_HwidCell[m_ncells]=myid;
int index = (int) (m_calo_id->calo_cell_hash(cellID));
//std::cout << " index " << index << std::endl;
if (m_IndexDigit[index]) {
int index = (int) (m_calo_id->calo_cell_hash(cellID));
if (m_IndexDigit[index]) {
const std::vector<short>& vSamples=(m_IndexDigit[index])->samples();
int nsamples = vSamples.size();
for (int i=0;i<std::min(32,nsamples);i++) {
m_ADC[m_ncells][i]=vSamples[i]-pedestal;
m_ADC[m_ncells][i]=(float)(vSamples[i])-pedestal;
}
}
}
m_ncells++;
......@@ -182,7 +207,6 @@ StatusCode LArReadCells::execute() {
}
}
std::cout << " Number of cells read " << m_ncells << std::endl;
m_tree->Fill();
......
......@@ -29,6 +29,7 @@ class LArReadCells: public ::AthAlgorithm {
private:
double m_etcut;
double m_etcut2;
const DataHandle<CaloIdManager> m_caloIdMgr;
const CaloCell_ID* m_calo_id;
......@@ -50,7 +51,7 @@ class LArReadCells: public ::AthAlgorithm {
int m_QuaCell[250000];
int m_GainCell[250000];
int m_HwidCell[250000];
int m_ADC[250000][32];
float m_ADC[250000][32];
ToolHandle<LArCablingService> m_larCablingSvc;
const LArOnlineID* m_lar_online_id;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment