#ifndef _CALOUTIL_H_ #define _CALOUTIL_H_ /*********************************************************************** ** ** ** /----------------------------------------------\ ** ** | Delphes, a framework for the fast simulation | ** ** | of a generic collider experiment | ** ** \------------- arXiv:0903.2225v1 ------------/ ** ** ** ** ** ** This package uses: ** ** ------------------ ** ** ROOT: Nucl. Inst. & Meth. in Phys. Res. A389 (1997) 81-86 ** ** FastJet algorithm: Phys. Lett. B641 (2006) [hep-ph/0512210] ** ** Hector: JINST 2:P09005 (2007) [physics.acc-ph:0707.1198v2] ** ** FROG: [hep-ex/0901.2718v1] ** ** HepMC: Comput. Phys. Commun.134 (2001) 41 ** ** ** ** ------------------------------------------------------------------ ** ** ** ** Main authors: ** ** ------------- ** ** ** ** Severine Ovyn Xavier Rouby ** ** severine.ovyn@uclouvain.be xavier.rouby@cern ** ** ** ** Center for Particle Physics and Phenomenology (CP3) ** ** Universite catholique de Louvain (UCL) ** ** Louvain-la-Neuve, Belgium ** ** ** ** Copyright (C) 2008-2009, ** ** All rights reserved. ** ** ** ***********************************************************************/ /// \file D_CaloUtil.h /// \brief D_CaloElement, D_CaloResolution and D_CaloList classes #include #include #include #include #include "D_Constants.h" using namespace std; class D_CaloResolution { public: D_CaloResolution(const float cterm, const float nterm, const float sterm) : _c(cterm), _n(nterm), _s(sterm) {}; D_CaloResolution(const D_CaloResolution& resolution) : _c(resolution._c), _n(resolution._n), _s(resolution._s) {}; D_CaloResolution& operator=(const D_CaloResolution& resolution); const float getC() const {return _c;} const float getN() const {return _n;} const float getS() const {return _s;} const float Smear(const float energy) const; void print() const; private: float _c, _n, _s; }; class D_CaloElement { public: D_CaloElement(const string& name, const float etamin, const float etamax, const float c_em, const float n_em, const float s_em, const float c_had, const float n_had, const float s_had) : _name(name), _etamin(min(etamin,etamax)), _etamax(max(etamin,etamax)), _resol_em(c_em,n_em,s_em), _resol_had(c_had,n_had,s_had) {}; D_CaloElement(const D_CaloElement& calo) : _name(calo._name), _etamin(calo._etamin), _etamax(calo._etamax), _resol_em(calo._resol_em), _resol_had(calo._resol_had) {}; D_CaloElement& operator=(const D_CaloElement& calo); const D_CaloResolution& getElectromagneticResolution() const {return _resol_em;} const D_CaloResolution& getHadronicResolution() const {return _resol_had;} const string& getName() const {return _name;} const float getEtamin() const {return _etamin;} const float getEtamax() const {return _etamax;} /// Ordering operator acting on eta inline const bool operator>(const D_CaloElement& tocomp) const {if(_etamin > tocomp._etamin) { return true; } else { return false; }}; /// Ordering operator acting on eta inline const bool operator<(const D_CaloElement& tocomp) const {if(_etamin < tocomp._etamin) { return true; } else { return false; }}; private: string _name; float _etamin, _etamax; D_CaloResolution _resol_em; D_CaloResolution _resol_had; }; class D_CaloList { public: D_CaloList() : _calorimeters(), _etamin(UNDEFINED), _etamax(UNDEFINED), _sorted(false) {}; D_CaloList(const D_CaloList& list) : _calorimeters(list._calorimeters), _etamin(list._etamin), _etamax(list._etamax), _sorted(list._sorted) {}; D_CaloList& operator=(const D_CaloList& list); const D_CaloElement& getElement(const float eta) const; // returns the pointer to the calorimeter lying in eta void addElement(const D_CaloElement & calo); void sortElements(); // sorts the list with respect to the eta const float getEtamax() {if(!_sorted) sortElements(); return _etamax;} const float getEtamin() {if(!_sorted) sortElements(); return _etamin;} void print() const; private: vector _calorimeters; float _etamin; float _etamax; bool _sorted; struct ordering{ bool operator()(const D_CaloElement& el1, const D_CaloElement& el2) const { return (el1 < el2);}}; }; const D_CaloElement dummyCalo("not found calo",UNDEFINED,UNDEFINED+1,1,0,0,1,0,0); class D_CaloTower { public: //D_CaloTower(); risk that _eta and _phi not initialised before using Set_Eem_Ehad_E_ET! D_CaloTower(const float iEta, const float iPhi); D_CaloTower(const D_CaloTower& tower); D_CaloTower& operator=(const D_CaloTower& tower); void Set_Eta_Phi(const float iEta, const float iPhi) {_eta=iEta; _phi=iPhi;} void Set_Eem_Ehad_E_ET(const float eem, const float ehad) { _Eem = eem ; _Ehad = ehad; _E = _Eem + _Ehad; _ET = _E/cosh(_eta);} const float getEta() const {return _eta;} const float getPhi() const {return _phi;} const float getE() const {return _E;} const float getET() const {return _ET;} const float getEem() const {return _Eem;} const float getEhad() const {return _Ehad;} /// Ordering operator acting on eta const bool operator>(const D_CaloTower& tocomp) const; /// Ordering operator acting on eta const bool operator<(const D_CaloTower& tocomp) const; /// Egality testing if eta/phi are equal const bool operator==(const D_CaloTower& el) const; private: float _eta, _phi; // segmented eta, phi float _Eem, _Ehad; // electromagnetic and hadronic components of the tower energy float _E, _ET; // total tower energy and transverse energy }; const D_CaloTower dummyTower(UNDEFINED,UNDEFINED); class D_CaloTowerList { public: D_CaloTowerList() : _calotowers(), _sorted(true), _merged(true) {} D_CaloTowerList(const D_CaloTowerList& list) : _calotowers(list._calotowers), _sorted(list._sorted), _merged(list._merged) {} D_CaloTowerList& operator=(const D_CaloTowerList& list); D_CaloTower& operator[](const unsigned int i) {return _calotowers[i];} const D_CaloTower& getElement(const float eta, const float phi) ; const D_CaloTower& getElement(const float eta, const float phi) const; void addTower(const D_CaloTower& tower); // sorts the elements with respect to their eta void sortElements(); // merges the CaloTowers with the same eta and the same phi void mergeDuplicates(); void smearTowers(const D_CaloList& list_of_calorimeters); void print() const; const unsigned int size() const {return _calotowers.size();} //void pop_back() {_calotowers.pop_back();} private: vector _calotowers; bool _sorted; bool _merged; struct ordering{ bool operator()(const D_CaloTower& el1, const D_CaloTower& el2) const { return (el1 < el2); }}; }; #endif