Fork me on GitHub

source: svn/trunk/interface/CaloUtil.h@ 1011

Last change on this file since 1011 was 443, checked in by Xavier Rouby, 15 years ago

new header in all files

File size: 7.9 KB
RevLine 
[264]1#ifndef _CALOUTIL_H_
2#define _CALOUTIL_H_
3
[443]4/***********************************************************************
5** **
6** /----------------------------------------------\ **
7** | Delphes, a framework for the fast simulation | **
8** | of a generic collider experiment | **
9** \------------- arXiv:0903.2225v1 ------------/ **
10** **
11** **
12** This package uses: **
13** ------------------ **
14** ROOT: Nucl. Inst. & Meth. in Phys. Res. A389 (1997) 81-86 **
15** FastJet algorithm: Phys. Lett. B641 (2006) [hep-ph/0512210] **
16** Hector: JINST 2:P09005 (2007) [physics.acc-ph:0707.1198v2] **
17** FROG: [hep-ex/0901.2718v1] **
18** HepMC: Comput. Phys. Commun.134 (2001) 41 **
19** **
20** ------------------------------------------------------------------ **
21** **
22** Main authors: **
23** ------------- **
24** **
25** Severine Ovyn Xavier Rouby **
26** severine.ovyn@uclouvain.be xavier.rouby@cern **
27** **
28** Center for Particle Physics and Phenomenology (CP3) **
29** Universite catholique de Louvain (UCL) **
30** Louvain-la-Neuve, Belgium **
31** **
32** Copyright (C) 2008-2009, **
33** All rights reserved. **
34** **
35***********************************************************************/
[264]36
37/// \file D_CaloUtil.h
38/// \brief D_CaloElement, D_CaloResolution and D_CaloList classes
39
40#include <iostream>
41#include <vector>
42#include <string>
43#include <cmath>
44#include "D_Constants.h"
45using namespace std;
46
47
48class D_CaloResolution {
49 public:
50 D_CaloResolution(const float cterm, const float nterm, const float sterm) : _c(cterm), _n(nterm), _s(sterm) {};
51 D_CaloResolution(const D_CaloResolution& resolution) : _c(resolution._c), _n(resolution._n), _s(resolution._s) {};
52 D_CaloResolution& operator=(const D_CaloResolution& resolution);
53 const float getC() const {return _c;}
54 const float getN() const {return _n;}
55 const float getS() const {return _s;}
56 const float Smear(const float energy) const;
57 void print() const;
58 private:
59 float _c, _n, _s;
60};
61
62
63
64class D_CaloElement {
65 public:
66 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) {};
67 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) {};
68 D_CaloElement& operator=(const D_CaloElement& calo);
69 const D_CaloResolution& getElectromagneticResolution() const {return _resol_em;}
70 const D_CaloResolution& getHadronicResolution() const {return _resol_had;}
71 const string& getName() const {return _name;}
72 const float getEtamin() const {return _etamin;}
73 const float getEtamax() const {return _etamax;}
74 /// Ordering operator acting on eta
75 inline const bool operator>(const D_CaloElement& tocomp) const {if(_etamin > tocomp._etamin) { return true; } else { return false; }};
76 /// Ordering operator acting on eta
77 inline const bool operator<(const D_CaloElement& tocomp) const {if(_etamin < tocomp._etamin) { return true; } else { return false; }};
78
79 private:
80 string _name;
81 float _etamin, _etamax;
82 D_CaloResolution _resol_em;
83 D_CaloResolution _resol_had;
84};
85
86
87
88class D_CaloList {
89 public:
90 D_CaloList() : _calorimeters(), _etamin(UNDEFINED), _etamax(UNDEFINED), _sorted(false) {};
91 D_CaloList(const D_CaloList& list) :
92 _calorimeters(list._calorimeters), _etamin(list._etamin), _etamax(list._etamax), _sorted(list._sorted) {};
93 D_CaloList& operator=(const D_CaloList& list);
94 const D_CaloElement& getElement(const float eta) const; // returns the pointer to the calorimeter lying in eta
95 void addElement(const D_CaloElement & calo);
96 void sortElements(); // sorts the list with respect to the eta
97 const float getEtamax() {if(!_sorted) sortElements(); return _etamax;}
98 const float getEtamin() {if(!_sorted) sortElements(); return _etamin;}
99 void print() const;
100 private:
101 vector<D_CaloElement> _calorimeters;
102 float _etamin;
103 float _etamax;
104 bool _sorted;
105 struct ordering{ bool operator()(const D_CaloElement& el1, const D_CaloElement& el2) const { return (el1 < el2);}};
106};
107
108const D_CaloElement dummyCalo("not found calo",UNDEFINED,UNDEFINED+1,1,0,0,1,0,0);
109
110
111
112class D_CaloTower {
113 public:
114 //D_CaloTower(); risk that _eta and _phi not initialised before using Set_Eem_Ehad_E_ET!
115 D_CaloTower(const float iEta, const float iPhi);
116 D_CaloTower(const D_CaloTower& tower);
117 D_CaloTower& operator=(const D_CaloTower& tower);
118 void Set_Eta_Phi(const float iEta, const float iPhi) {_eta=iEta; _phi=iPhi;}
119 void Set_Eem_Ehad_E_ET(const float eem, const float ehad) { _Eem = eem ; _Ehad = ehad; _E = _Eem + _Ehad; _ET = _E/cosh(_eta);}
120 const float getEta() const {return _eta;}
121 const float getPhi() const {return _phi;}
122 const float getE() const {return _E;}
123 const float getET() const {return _ET;}
124 const float getEem() const {return _Eem;}
125 const float getEhad() const {return _Ehad;}
126 /// Ordering operator acting on eta
127 const bool operator>(const D_CaloTower& tocomp) const;
128 /// Ordering operator acting on eta
129 const bool operator<(const D_CaloTower& tocomp) const;
130 /// Egality testing if eta/phi are equal
131 const bool operator==(const D_CaloTower& el) const;
132
133 private:
134 float _eta, _phi; // segmented eta, phi
135 float _Eem, _Ehad; // electromagnetic and hadronic components of the tower energy
136 float _E, _ET; // total tower energy and transverse energy
137};
138
139const D_CaloTower dummyTower(UNDEFINED,UNDEFINED);
140
141
142
143class D_CaloTowerList {
144 public:
145 D_CaloTowerList() : _calotowers(), _sorted(true), _merged(true) {}
146 D_CaloTowerList(const D_CaloTowerList& list) : _calotowers(list._calotowers), _sorted(list._sorted), _merged(list._merged) {}
147 D_CaloTowerList& operator=(const D_CaloTowerList& list);
148 D_CaloTower& operator[](const unsigned int i) {return _calotowers[i];}
149 const D_CaloTower& getElement(const float eta, const float phi) ;
[391]150 const D_CaloTower& getElement(const float eta, const float phi) const;
[264]151 void addTower(const D_CaloTower& tower);
152 // sorts the elements with respect to their eta
153 void sortElements();
154 // merges the CaloTowers with the same eta and the same phi
155 void mergeDuplicates();
156 void smearTowers(const D_CaloList& list_of_calorimeters);
157 void print() const;
158 const unsigned int size() const {return _calotowers.size();}
159 //void pop_back() {_calotowers.pop_back();}
160 private:
161 vector<D_CaloTower> _calotowers;
162 bool _sorted;
163 bool _merged;
164 struct ordering{ bool operator()(const D_CaloTower& el1, const D_CaloTower& el2) const { return (el1 < el2); }};
165};
166
167#endif
Note: See TracBrowser for help on using the repository browser.