Commit a269c5ca authored by Sanya Solodkov's avatar Sanya Solodkov Committed by Graeme Stewart
Browse files

Updates for E4' in RUN2 geometry when running digitization with pileup (TileSimAlgs-00-11-22)

	* more changes for E4' in TileHitVecToCntTool
	* Tagging TileSimAlgs-00-11-21

2014-10-02  Sanya Solodkov  <solodkov@pcatl03.cern.ch>

	* updates in TileHitVecToCntTool for E4' cells
	* Tagging TileSimAlgs-00-11-20
parent a5586efe
...@@ -100,6 +100,7 @@ class TileHitVecToCntTool: public PileUpToolBase { ...@@ -100,6 +100,7 @@ class TileHitVecToCntTool: public PileUpToolBase {
std::vector<std::string> m_hitVectorNames; //!< vector with the names of TileHitVectors to use std::vector<std::string> m_hitVectorNames; //!< vector with the names of TileHitVectors to use
std::string m_hitContainer; //!< name of the TileHitCointainer std::string m_hitContainer; //!< name of the TileHitCointainer
std::string m_infoName; //!< name of TileInfo object in TES std::string m_infoName; //!< name of TileInfo object in TES
bool m_run2; //!< if true => RUN2 geometry with E4' and merged E1
bool m_pileUp; //!< if true => pileup mode is activated bool m_pileUp; //!< if true => pileup mode is activated
double m_deltaT; //!< minimal time granularity for TileHit double m_deltaT; //!< minimal time granularity for TileHit
int m_timeFlag; //!< specail options to deal with times of hits for cosmics and TB int m_timeFlag; //!< specail options to deal with times of hits for cosmics and TB
...@@ -118,7 +119,7 @@ class TileHitVecToCntTool: public PileUpToolBase { ...@@ -118,7 +119,7 @@ class TileHitVecToCntTool: public PileUpToolBase {
const TileTBID* m_tileTBID; //!< Pointer to TileID helper const TileTBID* m_tileTBID; //!< Pointer to TileID helper
const TileInfo* m_tileInfo; //!< Pointer to TileInfo const TileInfo* m_tileInfo; //!< Pointer to TileInfo
const TileDetDescrManager* m_tileMgr; //!< Pointer to TileDetDescrManager const TileDetDescrManager* m_tileMgr; //!< Pointer to TileDetDescrManager
float numPhElec[6]; //!< number of photo electrons per GeV in samplings float numPhElec[7]; //!< number of photo electrons per GeV in samplings
CLHEP::HepRandomEngine* m_pHRengine; //!< Random number service to use CLHEP::HepRandomEngine* m_pHRengine; //!< Random number service to use
ServiceHandle<IAtRndmGenSvc> m_rndmSvc; //!< Random number generator engine to use ServiceHandle<IAtRndmGenSvc> m_rndmSvc; //!< Random number generator engine to use
...@@ -137,6 +138,13 @@ class TileHitVecToCntTool: public PileUpToolBase { ...@@ -137,6 +138,13 @@ class TileHitVecToCntTool: public PileUpToolBase {
inline int mbts_index(int side, int phi, int eta) const { inline int mbts_index(int side, int phi, int eta) const {
return (side * nPhi + phi) * nEta + eta + m_mbtsOffset; return (side * nPhi + phi) * nEta + eta + m_mbtsOffset;
} }
static const int E4side = -1;
static const int E4eta = 2;
static const int E4nPhi = 4;
static const int nCellE4pr = E4nPhi;
inline int e4pr_index(int phi) const {
return phi + nCellMBTS + m_mbtsOffset;
}
ServiceHandle<TileCablingSvc> m_cablingSvc; ServiceHandle<TileCablingSvc> m_cablingSvc;
const TileCablingService* m_cabling; const TileCablingService* m_cabling;
......
...@@ -62,6 +62,7 @@ TileHitVecToCntTool::TileHitVecToCntTool(const std::string& type, ...@@ -62,6 +62,7 @@ TileHitVecToCntTool::TileHitVecToCntTool(const std::string& type,
: PileUpToolBase(type,name,parent) : PileUpToolBase(type,name,parent)
, m_hitContainer("TileHitCnt") , m_hitContainer("TileHitCnt")
, m_infoName("TileInfo") , m_infoName("TileInfo")
, m_run2(false)
, m_pileUp(false) , m_pileUp(false)
, m_deltaT(1.0 * Gaudi::Units::nanosecond) , m_deltaT(1.0 * Gaudi::Units::nanosecond)
, m_timeFlag(0) , m_timeFlag(0)
...@@ -128,9 +129,19 @@ StatusCode TileHitVecToCntTool::initialize() { ...@@ -128,9 +129,19 @@ StatusCode TileHitVecToCntTool::initialize() {
CHECK( detStore()->retrieve(m_tileInfo, m_infoName) ); CHECK( detStore()->retrieve(m_tileInfo, m_infoName) );
for (int i = 0; i < 6; ++i) { CHECK( m_cablingSvc.retrieve() );
m_cabling = m_cablingSvc->cablingService();
m_run2 = (m_cabling->getCablingType() == TileCablingService::RUN2Cabling);
for (int i = 0; i < 7; ++i) {
Identifier pmt_id; Identifier pmt_id;
switch (i) { // invent pmt_id in a given part(sampling) of the calorimeter switch (i) { // invent pmt_id in a given part(sampling) of the calorimeter
case 6:
//pmt_id = m_tileTBID->channel_id(-1/*side*/, 0/*phi*/, 2/*radius*/);
// use the same ID as for normal E-cell - to obtain the same Npe at the end
pmt_id = m_tileID->pmt_id(3/*section*/, 1/*side*/, 0/*module*/, 11/*tower*/, 3/*sample*/, 0);
break; // E4' cell uses special ID, similar to MBTS
case 5: case 5:
pmt_id = m_tileTBID->channel_id(1/*side*/, 0/*phi*/, 1/*radius*/); pmt_id = m_tileTBID->channel_id(1/*side*/, 0/*phi*/, 1/*radius*/);
break; // MBTS outer cell break; // MBTS outer cell
...@@ -148,20 +159,25 @@ StatusCode TileHitVecToCntTool::initialize() { ...@@ -148,20 +159,25 @@ StatusCode TileHitVecToCntTool::initialize() {
// and multiply by inverted sampling fraction (35.9) // and multiply by inverted sampling fraction (35.9)
// to get number of photoelectrons per 1 MeV energy in scintillator // to get number of photoelectrons per 1 MeV energy in scintillator
numPhElec[i] = (m_tileInfo->NPhElec(i)) / (Gaudi::Units::GeV / Gaudi::Units::MeV) * m_tileInfo->HitCalib(pmt_id); numPhElec[i] = (m_tileInfo->NPhElec(i)) / (Gaudi::Units::GeV / Gaudi::Units::MeV) * m_tileInfo->HitCalib(pmt_id);
//ATH_MSG_DEBUG( i << " " << m_tileInfo->NPhElec(i) << " " << m_tileInfo->HitCalib(pmt_id) );
} }
if (numPhElec[0] <= 0) { if (numPhElec[0] <= 0) {
numPhElec[5] = numPhElec[4] = numPhElec[3] = numPhElec[2] = numPhElec[1] = numPhElec[0]; numPhElec[6] = numPhElec[5] = numPhElec[4] = numPhElec[3] = numPhElec[2] = numPhElec[1] = numPhElec[0];
ATH_MSG_DEBUG( "No photostatistics effect will be simulated"); ATH_MSG_DEBUG( "No photostatistics effect will be simulated");
} }
ATH_MSG_DEBUG( " numPhElec/MeV for TileHit energy: " ATH_MSG_DEBUG( " numPhElec/MeV for TileHit energy: "
<< numPhElec[0] << " " << " A " << numPhElec[0]
<< numPhElec[1] << " " << " BC " << numPhElec[1]
<< numPhElec[2] << " " << " D " << numPhElec[2]
<< numPhElec[3] << " " << " E " << numPhElec[3]
<< numPhElec[4] << " " << " E4' " << numPhElec[6]
<< numPhElec[5]); << " MBTSout " << numPhElec[5]
<< " MBTSin " << numPhElec[4]
);
if (m_rndmEvtOverlay) { if (m_rndmEvtOverlay) {
m_pileUp = false; m_pileUp = false;
...@@ -194,7 +210,8 @@ StatusCode TileHitVecToCntTool::initialize() { ...@@ -194,7 +210,8 @@ StatusCode TileHitVecToCntTool::initialize() {
if (m_pileUp) { if (m_pileUp) {
// prepare vector with all hits // prepare vector with all hits
m_mbtsOffset = m_tileID->pmt_hash_max(); m_mbtsOffset = m_tileID->pmt_hash_max();
m_allHits.resize(m_mbtsOffset + nCellMBTS); if (m_run2) m_allHits.resize(m_mbtsOffset + nCellMBTS + nCellE4pr);
else m_allHits.resize(m_mbtsOffset + nCellMBTS);
Identifier hit_id; Identifier hit_id;
IdContext pmt_context = m_tileID->pmt_context(); IdContext pmt_context = m_tileID->pmt_context();
for (int i = 0; i < m_mbtsOffset; ++i) { for (int i = 0; i < m_mbtsOffset; ++i) {
...@@ -213,6 +230,14 @@ StatusCode TileHitVecToCntTool::initialize() { ...@@ -213,6 +230,14 @@ StatusCode TileHitVecToCntTool::initialize() {
} }
} }
} }
if (m_run2) {
for (int phi = 0; phi < E4nPhi; ++phi) {
hit_id = m_tileTBID->channel_id(E4side, phi, E4eta);
TileHit * pHit = new TileHit(hit_id, 0., 0.);
pHit->reserve(71); // reserve max possible size for pileup
m_allHits[e4pr_index(phi)] = pHit;
}
}
} }
} else { } else {
...@@ -262,10 +287,7 @@ StatusCode TileHitVecToCntTool::initialize() { ...@@ -262,10 +287,7 @@ StatusCode TileHitVecToCntTool::initialize() {
} }
} }
CHECK( m_cablingSvc.retrieve() ); if (m_run2) {
m_cabling = m_cablingSvc->cablingService();
if (m_cabling->getCablingType() == TileCablingService::RUN2Cabling) {
const TileHWID* tileHWID; const TileHWID* tileHWID;
CHECK( detStore()->retrieve(tileHWID) ); CHECK( detStore()->retrieve(tileHWID) );
...@@ -278,11 +300,8 @@ StatusCode TileHitVecToCntTool::initialize() { ...@@ -278,11 +300,8 @@ StatusCode TileHitVecToCntTool::initialize() {
for (int drawer = 0; drawer < 64; ++drawer) { for (int drawer = 0; drawer < 64; ++drawer) {
int frag_id = tileHWID->frag(ros, drawer); int frag_id = tileHWID->frag(ros, drawer);
IdentifierHash frag_hash = m_fragHashFunc(frag_id); IdentifierHash frag_hash = m_fragHashFunc(frag_id);
if (m_cabling->E1_merged_with_run2(drawer) != 0) m_E1merged[frag_hash] = true; m_E1merged[frag_hash] = (m_cabling->E1_merged_with_run2(ros,drawer) != 0);
else m_E1merged[frag_hash] = false; m_MBTSmerged[frag_hash] = (m_cabling->is_MBTS_merged_run2(drawer));
if (m_cabling->is_MBTS_merged_run2(drawer)) m_MBTSmerged[frag_hash] = true;
else m_MBTSmerged[frag_hash] = false;
} }
} }
ATH_MSG_INFO("Number of E1 cell to be merged: " << std::count (m_E1merged.begin(), m_E1merged.end(), true)); ATH_MSG_INFO("Number of E1 cell to be merged: " << std::count (m_E1merged.begin(), m_E1merged.end(), true));
...@@ -403,7 +422,8 @@ void TileHitVecToCntTool::processHitVectorForPileUp(const TileHitVector* inputHi ...@@ -403,7 +422,8 @@ void TileHitVecToCntTool::processHitVectorForPileUp(const TileHitVector* inputHi
int side = std::max(0, m_tileTBID->type(hit_id)); int side = std::max(0, m_tileTBID->type(hit_id));
int phi = m_tileTBID->module(hit_id); int phi = m_tileTBID->module(hit_id);
int eta = m_tileTBID->channel(hit_id); int eta = m_tileTBID->channel(hit_id);
hit_idhash = mbts_index(side, phi, eta); if (eta<2) hit_idhash = mbts_index(side, phi, eta);
else hit_idhash = e4pr_index(phi);
} else { } else {
m_tileID->get_hash(hit_id, hit_idhash, &pmt_context); m_tileID->get_hash(hit_id, hit_idhash, &pmt_context);
} }
...@@ -860,7 +880,7 @@ StatusCode TileHitVecToCntTool::mergeEvent() { ...@@ -860,7 +880,7 @@ StatusCode TileHitVecToCntTool::mergeEvent() {
m_tileTBID->set_do_checks(do_checks_tb); // set back this flag to TileTBID m_tileTBID->set_do_checks(do_checks_tb); // set back this flag to TileTBID
if (m_cabling->getCablingType() == TileCablingService::RUN2Cabling) { if (m_run2) {
// Merge MBTS and E1 where it is needed. // Merge MBTS and E1 where it is needed.
TileHitContainer::const_iterator collIt = m_hits->begin(); TileHitContainer::const_iterator collIt = m_hits->begin();
...@@ -941,7 +961,7 @@ StatusCode TileHitVecToCntTool::finalize() { ...@@ -941,7 +961,7 @@ StatusCode TileHitVecToCntTool::finalize() {
} }
double TileHitVecToCntTool::ApplyPhotoStat(double energy, Identifier pmt_id) { double TileHitVecToCntTool::ApplyPhotoStat(double energy, Identifier pmt_id) {
// pmt_sample = 0-3 for normal cells 4 for inner MBTS, 5 for outer MBTS // pmt_sample = 0-3 for normal cells 4 for inner MBTS, 5 for outer MBTS, 6 for E4'
int pmt_sample = (m_tileTBID->is_tiletb(pmt_id)) int pmt_sample = (m_tileTBID->is_tiletb(pmt_id))
? TileID::SAMP_X + m_tileTBID->channel(pmt_id) ? TileID::SAMP_X + m_tileTBID->channel(pmt_id)
: m_tileID->sample(pmt_id); : m_tileID->sample(pmt_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