diff --git a/Calorimeter/CaloRecAlgs/src/CaloRecAlg.cxx b/Calorimeter/CaloRecAlgs/src/CaloRecAlg.cxx index 12ddca3a44a5ba4691ff3feffa2adae37d19e2d5..f4f78d488d6c542637003e38ea0d8959f89b6b1c 100644 --- a/Calorimeter/CaloRecAlgs/src/CaloRecAlg.cxx +++ b/Calorimeter/CaloRecAlgs/src/CaloRecAlg.cxx @@ -23,6 +23,12 @@ StatusCode CaloRecAlg::initialize() { // Initalize tools ATH_CHECK( m_recoCalibTool.retrieve() ); + // Store calibrattiion factos in a vector for ease of access + m_EM_mu_Map[0] = m_calo_ch0_EM_mu; + m_EM_mu_Map[1] = m_calo_ch1_EM_mu; + m_EM_mu_Map[2] = m_calo_ch2_EM_mu; + m_EM_mu_Map[3] = m_calo_ch3_EM_mu; + return StatusCode::SUCCESS; } //---------------------------------------------------------------------- @@ -81,31 +87,34 @@ StatusCode CaloRecAlg::execute(const EventContext& ctx) const { float MIPcharge_ref = m_recoCalibTool->getMIPcharge_ref(hit->channel()); // get reference MIP charge from database - float hit_Edep = 0; + float charge = hit->integral()/50.0; // divide by 50 ohms to get charge + ATH_MSG_DEBUG("calo_hit filled has charge of " << charge << " pC"); + + float gainRatio = 1.0; if (m_isMC) { - hit_Edep = hit->integral() / MIPcharge_ref; // MC MIPcharge_ref from database is really digitization scaling factors that take simulated Edep in MeV to mV*ns - ATH_MSG_DEBUG("isMC == True: calo hit Edep = " << hit_Edep << " MeV"); + gainRatio = 1.0; // put dummy value for now, this will end up being ratio of digi scale factors } else { - float hit_charge = hit->integral()/50.0; // divide by 50 ohms to get charge - ATH_MSG_DEBUG("calo_hit filled has charge of " << hit_charge << " pC"); - - float HVgain_extrap = extrapolateHVgain(hit->channel()); - ATH_MSG_DEBUG("HV gain = " << HVgain_extrap ); + gainRatio = extrapolateHVgain(hit->channel()); + ATH_MSG_DEBUG("HV gain ratio = " << gainRatio ); + } - float hit_MIP = (hit_charge * HVgain_extrap) / MIPcharge_ref; - ATH_MSG_DEBUG("Edep in MIPs = " << hit_MIP ); + float Nmip = (charge * gainRatio) / MIPcharge_ref; + ATH_MSG_DEBUG("Nmip = " << Nmip ); + calo_hit->set_Nmip(Nmip); // set Nmip value - hit_Edep = hit_MIP * m_MIP_sim_Edep_calo; - ATH_MSG_DEBUG("Edep in MeV = " << hit_Edep ); - } + float E_dep = Nmip * m_MIP_sim_Edep_calo; + ATH_MSG_DEBUG("E_dep in MeV = " << E_dep ); + calo_hit->set_E_dep(E_dep); // set calibrated E_dep value - calo_hit->set_Edep(hit_Edep); // set calibrated Edep value + float E_EM = Nmip * m_EM_mu_Map[hit->channel()]; + ATH_MSG_DEBUG("Em E in MeV = " << E_EM ); + calo_hit->set_E_EM(E_EM); // set calibrated E_EM value - float hit_raw_Edep = 0.0; + float fit_to_raw_ratio = 1.0; if (hit->integral() != 0.0) { // avoid possibility of division by zero error - hit_raw_Edep = hit_Edep * (hit->raw_integral() / hit->integral()); + fit_to_raw_ratio = hit->raw_integral() / hit->integral(); } - calo_hit->set_raw_Edep(hit_raw_Edep); // set calibrated raw_Edep value + calo_hit->set_fit_to_raw_ratio(fit_to_raw_ratio); // set fit-to-raw-ratio that can be used to take any of the calibrated values to what they would be if we used the raw integral instead of the fit integral calo_hit->set_channel(hit->channel()); // set channel number @@ -126,28 +135,22 @@ StatusCode CaloRecAlg::execute(const EventContext& ctx) const { float MIPcharge_ref = m_recoCalibTool->getMIPcharge_ref(hit->channel()); // get reference MIP charge from database - float hit_Edep = 0; - if (m_isMC) { - hit_Edep = hit->integral() / MIPcharge_ref; // MC MIPcharge_ref from database is really digitization scaling factors that take simulated Edep in MeV to mV*ns - ATH_MSG_DEBUG("isMC == True: preshower hit Edep = " << hit_Edep << " MeV"); - } else { - float hit_charge = hit->integral()/50.0; // divide by 50 ohms to get charge - ATH_MSG_DEBUG("preshower_hit filled has charge of " << hit_charge << " pC"); + float charge = hit->integral()/50.0; // divide by 50 ohms to get charge + ATH_MSG_DEBUG("preshower_hit filled has charge of " << charge << " pC"); - float hit_MIP = hit_charge / MIPcharge_ref; - ATH_MSG_DEBUG("Edep in MIPs = " << hit_MIP ); - - hit_Edep = hit_MIP * m_MIP_sim_Edep_preshower; - ATH_MSG_DEBUG("Edep in GeV = " << hit_Edep ); - } + float Nmip = charge / MIPcharge_ref; + ATH_MSG_DEBUG("Nmip = " << Nmip ); + preshower_hit->set_Nmip(Nmip); // set Nmip value - preshower_hit->set_Edep(hit_Edep); // set calibrated Edep value + float E_dep = Nmip * m_MIP_sim_Edep_preshower; + ATH_MSG_DEBUG("E_dep in GeV = " << E_dep ); + preshower_hit->set_E_dep(E_dep); // set calibrated E_dep value - float hit_raw_Edep = 0.0; + float fit_to_raw_ratio = 1.0; if (hit->integral() != 0.0) { // avoid possibility of division by zero error - hit_raw_Edep = hit_Edep * (hit->raw_integral() / hit->integral()); + fit_to_raw_ratio = hit->raw_integral() / hit->integral(); } - preshower_hit->set_raw_Edep(hit_raw_Edep); // set calibrated rsw_Edep value + preshower_hit->set_fit_to_raw_ratio(fit_to_raw_ratio); // set fit-to-raw-ratio that can be used to take any of the calibrated values to what they would be if we used the raw integral instead of the fit integral preshower_hit->set_channel(hit->channel()); // set channel number diff --git a/Calorimeter/CaloRecAlgs/src/CaloRecAlg.h b/Calorimeter/CaloRecAlgs/src/CaloRecAlg.h index c9ff4c5146d9e59c94a279345f6bb5977519c997..721f521621ae519778a8ddadd8b5711f1beeac9b 100644 --- a/Calorimeter/CaloRecAlgs/src/CaloRecAlg.h +++ b/Calorimeter/CaloRecAlgs/src/CaloRecAlg.h @@ -88,6 +88,13 @@ class CaloRecAlg : public AthReentrantAlgorithm { FloatProperty m_MIP_sim_Edep_calo {this, "MIP_sim_Edep_calo", 58.5}; // MIP deposits 5.85 MeV of energy in calo FloatProperty m_MIP_sim_Edep_preshower {this, "MIP_sim_Edep_preshower", 4.894}; // MIP deposits 4.894 MeV of energy in a preshower layer + FloatProperty m_calo_ch0_EM_mu {this, "m_calo_ch0_EM_mu", 330.0}; // factor used to do rough calibration of calo ch0 to EM energy: 0.33 GeV or 330 MeV + FloatProperty m_calo_ch1_EM_mu {this, "m_calo_ch1_EM_mu", 330.0}; // factor used to do rough calibration of calo ch1 to EM energy: 0.33 GeV or 330 MeV + FloatProperty m_calo_ch2_EM_mu {this, "m_calo_ch2_EM_mu", 330.0}; // factor used to do rough calibration of calo ch2 to EM energy: 0.33 GeV or 330 MeV + FloatProperty m_calo_ch3_EM_mu {this, "m_calo_ch3_EM_mu", 330.0}; // factor used to do rough calibration of calo ch3 to EM energy: 0.33 GeV or 330 MeV + + float m_EM_mu_Map[4]; // vector that holds EM_mu calibration factors for calo channels + Gaudi::Property<bool> m_isMC {this, "isMC", false}; }; diff --git a/Calorimeter/CaloRecTools/python/CaloRecToolConfig.py b/Calorimeter/CaloRecTools/python/CaloRecToolConfig.py index e87ac3658ec8f92caf00bc19e061d3d9d95c8e5d..65be875da12b6deee3cbf9f35217cee6f40784ff 100644 --- a/Calorimeter/CaloRecTools/python/CaloRecToolConfig.py +++ b/Calorimeter/CaloRecTools/python/CaloRecToolConfig.py @@ -20,8 +20,7 @@ def CaloRecToolCfg(flags, name="CaloRecTool", **kwargs): dbInstance = kwargs.get("dbInstance", "TRIGGER_OFL") acc.merge(addFolders(flags, "/WAVE/Calibration/HV", dbInstance, className="CondAttrListCollection")) - acc.merge(addFolders(flags, "/WAVE/Calibration/HV_ref", dbInstance, className="CondAttrListCollection")) - acc.merge(addFolders(flags, "/WAVE/Calibration/MIP_charge_ref", dbInstance, className="CondAttrListCollection")) + acc.merge(addFolders(flags, "/WAVE/Calibration/MIP_ref", dbInstance, className="CondAttrListCollection")) return acc diff --git a/Calorimeter/CaloRecTools/src/CaloRecTool.cxx b/Calorimeter/CaloRecTools/src/CaloRecTool.cxx index a6bb42c5140d10c1d2efdc486201c2bab81c0365..916011019805ab9087c57427859086dec456eb80 100644 --- a/Calorimeter/CaloRecTools/src/CaloRecTool.cxx +++ b/Calorimeter/CaloRecTools/src/CaloRecTool.cxx @@ -23,8 +23,7 @@ CaloRecTool::initialize() { // Set keys to read calibratiion variables from data base ATH_CHECK( m_PMT_HV_ReadKey.initialize() ); - ATH_CHECK( m_PMT_HV_ref_ReadKey.initialize() ); - ATH_CHECK( m_MIPcharge_ref_ReadKey.initialize() ); + ATH_CHECK( m_MIP_ref_ReadKey.initialize() ); // access and store calo PMT HV gain curves HVgaincurves_rootFile = TFile::Open(m_PMT_HV_Gain_Curve_file.value().c_str(),"read"); // open root file that has TF1 gain curves stored @@ -112,7 +111,7 @@ float CaloRecTool::getHV_ref(const EventContext& ctx, int channel) const { float HV_ref=0.; // Read Cond Handle - SG::ReadCondHandle<CondAttrListCollection> readHandle{m_PMT_HV_ref_ReadKey, ctx}; + SG::ReadCondHandle<CondAttrListCollection> readHandle{m_MIP_ref_ReadKey, ctx}; const CondAttrListCollection* readCdo{*readHandle}; if (readCdo==nullptr) { ATH_MSG_FATAL("Null pointer to the read conditions object"); @@ -154,7 +153,7 @@ float CaloRecTool::getMIPcharge_ref(const EventContext& ctx, int channel) const float MIP_charge_ref =0.; // Read Cond Handle - SG::ReadCondHandle<CondAttrListCollection> readHandle{m_MIPcharge_ref_ReadKey, ctx}; + SG::ReadCondHandle<CondAttrListCollection> readHandle{m_MIP_ref_ReadKey, ctx}; const CondAttrListCollection* readCdo{*readHandle}; if (readCdo==nullptr) { ATH_MSG_FATAL("Null pointer to the read conditions object"); @@ -172,8 +171,8 @@ float CaloRecTool::getMIPcharge_ref(const EventContext& ctx, int channel) const // Read offset for specific channel const CondAttrListCollection::AttributeList& payload{readCdo->attributeList(channel)}; - if (payload.exists("MIP_charge_ref") and not payload["MIP_charge_ref"].isNull()) { - MIP_charge_ref = payload["MIP_charge_ref"].data<float>(); + if (payload.exists("charge_ref") and not payload["charge_ref"].isNull()) { + MIP_charge_ref = payload["charge_ref"].data<float>(); ATH_MSG_DEBUG("Found digitizer channel " << channel << ", MIP_charge_ref as " << MIP_charge_ref); } else { ATH_MSG_WARNING("No valid MIP_charge_ref found for channel "<<channel<<"!"); diff --git a/Calorimeter/CaloRecTools/src/CaloRecTool.h b/Calorimeter/CaloRecTools/src/CaloRecTool.h index c6dc951818cb59472fe6a1ff077e97e6753ec509..6ab891ad42784e3388d933f42de9267545fab3d9 100644 --- a/Calorimeter/CaloRecTools/src/CaloRecTool.h +++ b/Calorimeter/CaloRecTools/src/CaloRecTool.h @@ -78,8 +78,7 @@ class CaloRecTool: public extends<AthAlgTool, ICaloRecTool> { // Read Cond Handle SG::ReadCondHandleKey<CondAttrListCollection> m_PMT_HV_ReadKey{this, "PMT_HV_ReadKey", "/WAVE/Calibration/HV", "Key of folder for PMT HV reading"}; - SG::ReadCondHandleKey<CondAttrListCollection> m_PMT_HV_ref_ReadKey{this, "PMT_HV_ref_ReadKey", "/WAVE/Calibration/HV_ref", "Key of folder for PMT HV at time of MIP calibration measurement"}; - SG::ReadCondHandleKey<CondAttrListCollection> m_MIPcharge_ref_ReadKey{this, "MIPcharge_ref_ReadKey", "/WAVE/Calibration/MIP_charge_ref", "Key of folder for MIPcharge calibration measurment"}; + SG::ReadCondHandleKey<CondAttrListCollection> m_MIP_ref_ReadKey{this, "MIP_ref_ReadKey", "/WAVE/Calibration/MIP_ref", "Key of folder for MIP charge calibration measurment, also stores PMT HV used to measure the reference MIP charge"}; }; diff --git a/xAOD/xAODFaserCalorimeter/Root/CalorimeterHitAuxContainer_v1.cxx b/xAOD/xAODFaserCalorimeter/Root/CalorimeterHitAuxContainer_v1.cxx index f73a83dd127cc0d24d999c0e8f140e913a329e76..277ecd25c0d1e2056a6c2a1eeef101f5570f80c2 100644 --- a/xAOD/xAODFaserCalorimeter/Root/CalorimeterHitAuxContainer_v1.cxx +++ b/xAOD/xAODFaserCalorimeter/Root/CalorimeterHitAuxContainer_v1.cxx @@ -11,8 +11,10 @@ namespace xAOD { : AuxContainerBase() { AUX_VARIABLE(channel); - AUX_VARIABLE(Edep); - AUX_VARIABLE(raw_Edep); + AUX_VARIABLE(Nmip); + AUX_VARIABLE(E_dep); + AUX_VARIABLE(E_EM); + AUX_VARIABLE(fit_to_raw_ratio); AUX_VARIABLE(WaveformLink); } diff --git a/xAOD/xAODFaserCalorimeter/Root/CalorimeterHit_v1.cxx b/xAOD/xAODFaserCalorimeter/Root/CalorimeterHit_v1.cxx index f085cb0c92acca759173260ba56c26813fd72935..ff592dff67ca5c37bf0ea954dcc9eb63f3a26a28 100644 --- a/xAOD/xAODFaserCalorimeter/Root/CalorimeterHit_v1.cxx +++ b/xAOD/xAODFaserCalorimeter/Root/CalorimeterHit_v1.cxx @@ -15,9 +15,13 @@ namespace xAOD { AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( CalorimeterHit_v1, unsigned int, channel, set_channel ) - AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( CalorimeterHit_v1, float, Edep, set_Edep ) + AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( CalorimeterHit_v1, float, Nmip, set_Nmip ) - AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( CalorimeterHit_v1, float, raw_Edep, set_raw_Edep ) + AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( CalorimeterHit_v1, float, E_dep, set_E_dep ) + + AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( CalorimeterHit_v1, float, E_EM, set_E_EM ) + + AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( CalorimeterHit_v1, float, fit_to_raw_ratio, set_fit_to_raw_ratio ) // setters and getters for the Calo WaveformHit links @@ -58,7 +62,7 @@ namespace xAOD { std::ostream& operator<<(std::ostream& s, const xAOD::CalorimeterHit_v1& hit) { s << "xAODCalorimeterHit:" << " channel = " << hit.channel() - << ", Edep = " << hit.Edep() + << ", E_dep = " << hit.E_dep() << std::endl; return s; diff --git a/xAOD/xAODFaserCalorimeter/xAODFaserCalorimeter/versions/CalorimeterHitAuxContainer_v1.h b/xAOD/xAODFaserCalorimeter/xAODFaserCalorimeter/versions/CalorimeterHitAuxContainer_v1.h index 41a89a0325e9dd5ce78dab40ad6ae08458eb37c3..230da2716246909fcf85653c288dc043aa9929a5 100644 --- a/xAOD/xAODFaserCalorimeter/xAODFaserCalorimeter/versions/CalorimeterHitAuxContainer_v1.h +++ b/xAOD/xAODFaserCalorimeter/xAODFaserCalorimeter/versions/CalorimeterHitAuxContainer_v1.h @@ -30,8 +30,10 @@ namespace xAOD { /// @name Basic variables ///@ { std::vector<unsigned int> channel; - std::vector<float> Edep; - std::vector<float> raw_Edep; + std::vector<float> Nmip; + std::vector<float> E_dep; + std::vector<float> E_EM; + std::vector<float> fit_to_raw_ratio; typedef std::vector< ElementLink< WaveformHitContainer > > WaveformHitLink_t; std::vector< WaveformHitLink_t > WaveformLink; diff --git a/xAOD/xAODFaserCalorimeter/xAODFaserCalorimeter/versions/CalorimeterHit_v1.h b/xAOD/xAODFaserCalorimeter/xAODFaserCalorimeter/versions/CalorimeterHit_v1.h index fefc0d5ae3dac013ee734e34ed82c600f8fbde5d..c27d9f033efc6eebaeb2120440a8855362b77700 100644 --- a/xAOD/xAODFaserCalorimeter/xAODFaserCalorimeter/versions/CalorimeterHit_v1.h +++ b/xAOD/xAODFaserCalorimeter/xAODFaserCalorimeter/versions/CalorimeterHit_v1.h @@ -38,11 +38,17 @@ namespace xAOD { unsigned int channel() const; void set_channel(unsigned int value); - float Edep() const; - void set_Edep(float value); + float Nmip() const; + void set_Nmip(float value); - float raw_Edep() const; - void set_raw_Edep(float value); + float E_dep() const; + void set_E_dep(float value); + + float E_EM() const; + void set_E_EM(float value); + + float fit_to_raw_ratio() const; + void set_fit_to_raw_ratio(float value); // Waveform Hits typedef std::vector< ElementLink< xAOD::WaveformHitContainer > > WaveformHitLinks_t;