001
002
003
004
005
006
007
008
009
010
011 #include "AtlfastAlgs/Calorimeter.h"
012 #include "AtlfastAlgs/ICellSelector.h"
013 #include "AtlfastAlgs/CalSection.h"
014
015 #include "AtlfastUtils/ISmearer.h"
016 #include "AtlfastUtils/DeleteObject.h"
017 #include "AtlfastUtils/CheckNull.h"
018
019 #include "AtlfastEvent/IKinematic.h"
020
021 #include "FastShowerUtils/GridletForger.h"
022 #include "FastShowerUtils/Gridlet.h"
023
024 #include "GaudiKernel/MsgStream.h"
025 #include <cmath>
026 #include <vector>
027 #include <iostream>
028
029
030 namespace Atlfast {
031 using std::abs;
032 using FastShower::GridletForger;
033 using FastShower::Gridlet;
034 using FastShower::GridletElement;
035
036
037
038 Calorimeter::Calorimeter(
039 MsgStream& log,
040 bool fastShower,
041 const double MaxEta,
042 const double barrelMaxEta,
043 const double granBarrelEta,
044 const double granBarrelPhi,
045 const double granForwardEta,
046 const double granForwardPhi,
047 const std::string detEffectsFileName
048 ):m_log(log){
049
050 m_section[0] = new CalSection(log,
051 abs(barrelMaxEta), abs(MaxEta),
052 granForwardEta, granForwardPhi, detEffectsFileName);
053
054 m_section[1] = new CalSection(log,
055 -abs(barrelMaxEta), abs(barrelMaxEta),
056 granBarrelEta, granBarrelPhi, detEffectsFileName);
057
058 m_section[2] = new CalSection(log,
059 -abs(MaxEta), -abs(barrelMaxEta),
060 granForwardEta, granForwardPhi, detEffectsFileName);
061
062 if(fastShower) {
063 m_gridletForger = new GridletForger;
064 }else{
065 m_gridletForger = 0;
066 }
067
068 }
069 Calorimeter::~Calorimeter(){
070 m_log<<MSG::DEBUG<<"Calorimeter destructor starts "<<endreq;
071 delete m_section[0];
072 delete m_section[1];
073 delete m_section[2];
074 delete m_gridletForger;
075 m_log<<MSG::DEBUG<<"Calorimeter destructor ends "<<endreq;
076 }
077 Calorimeter::Calorimeter(const Calorimeter& c):m_log(c.m_log){
078
079
080
081 m_section[0] = new CalSection(*(c.m_section[0]));
082 m_section[1] = new CalSection(*(c.m_section[1]));
083 m_section[2] = new CalSection(*(c.m_section[2]));
084 m_gridletForger= new GridletForger(*(c.m_gridletForger));
085 }
086
087 class Elements{
088 public:
089 typedef vector<const GridletElement*> Vector;
090 typedef Vector::iterator Iter;
091 ~Elements(){
092
093
094 }
095 void operator()(const Gridlet* g){
096 std::vector<const GridletElement*> eEl = g->eElements();
097 std::vector<const GridletElement*> hEl = g->hElements();
098
099 m_eElements.insert(m_eElements.end(), eEl.begin(), eEl.end());
100 m_hElements.insert(m_hElements.end(), hEl.begin(), hEl.end());
101
102 }
103 std::pair<Iter, Iter> eIters(){
104 return std::pair<Iter,Iter>(m_eElements.begin(),m_eElements.end());
105 }
106 std::pair<Iter, Iter> hIters(){
107 return std::pair<Iter,Iter>(m_hElements.begin(), m_hElements.end());
108 }
109 private:
110 Vector m_eElements;
111 Vector m_hElements;
112 };
113
114 void Calorimeter::addGridlet(Gridlet* g){m_gridlets.push_back(g);}
115
116 void Calorimeter::deposit(ITransportedParticleCollectionIter& f,
117 ITransportedParticleCollectionIter& l){
118
119 ITransportedParticleCollectionIter divider =
120 std::partition(f, l, TryToShower(this));
121
122
123
124 Elements els;
125 els = std::for_each(m_gridlets.begin(), m_gridlets.end(), els);
126 std::pair<Elements::Iter, Elements::Iter> ei = els.eIters();
127 std::pair<Elements::Iter, Elements::Iter> hi = els.hIters();
128 std::for_each(ei.first, ei.second, CheckNull());
129 std::for_each(hi.first, hi.second, CheckNull());
130
131
132
133
134
135
136 for(int ind =0 ;ind<=2; ++ind){
137 m_section[ind]->depositEcal(ei.first, ei.second);
138 m_section[ind]->depositHcal(hi.first, hi.second);
139
140
141
142 std::vector<const Gridlet*>::iterator b = m_gridlets.begin();
143 std::vector<const Gridlet*>::iterator e = m_gridlets.end();
144 m_section[ind]->depositEgen(b, e);
145
146 m_section[ind]->deposit(divider, l);
147 }
148
149
150 ei = els.eIters();
151 hi = els.hIters();
152 std::for_each(ei.first, ei.second, DeleteObject());
153 std::for_each(hi.first, hi.second, DeleteObject());
154 }
155
156 const GridletForger* Calorimeter::gridletForger() const {
157 return m_gridletForger;
158 }
159
160 MsgStream& Calorimeter::msgStream() const {return m_log;}
161
162 void Calorimeter::giveHitCells(const ICellSelector* p_cellSelector,
163 ITwoCptCellCollection* cells) {
164
165
166
167
168 for(int ind=0; ind<=2; ++ind) {
169 m_section[ind]->giveHits(p_cellSelector, cells);
170 }
171 }
172
173
174 void Calorimeter::reset(){
175
176 for(int ind=0; ind<=2; ++ind) {m_section[ind]->reset();}
177
178 std::for_each(m_gridlets.begin(), m_gridlets.end(), DeleteObject());
179 m_gridlets.clear();
180
181 }
182
183 void Calorimeter::smearCells(ISmearer* p_smearer)
184 {
185 for(int ind=0; ind<=2; ++ind) {
186 m_section[ind]->smearCells(p_smearer);
187 }
188 }
189 }
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
| Due to the LXR bug, the updates fail sometimes to remove references to deleted files. The Saturday's full rebuilds fix these problems |
|
This page was automatically generated by the
LXR engine.
|
|