Report problems to ATLAS LXR Team (with time and IP address indicated)

The LXR Cross Referencer

source navigation ]
diff markup ]
identifier search ]
general search ]
 
 
Architecture: linux ]
Version: head ] [ nightly ] [ GaudiDev ]
  Links to LXR source navigation pages for stable releases [ 12.*.* ]   [ 13.*.* ]   [ 14.*.* ]   [ 15.*.* ] 

001 //////////////////////////////////////////////////////////////////////////
002 //                                                                      //
003 // RMS  calorimeter class implementation.                               //
004 //                                                                      //
005 // HTP  put into namespace & a little tidying up                        //
006 //                                                                      //
007 // PS   radically changed.                                              //
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   // create calorimeter as a number of CalSections
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     //make m_sections point to different instances
079     // of the CalSections, with the same value as those
080     //owned by c.
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       // do NOT delete the element vector pointees - they are used by the
093       // clients!
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     // put all the elements from all gridlets into a containers    
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     //    cerr<<"Calorimeter: no  of e elements "<<ei.second - ei.first<<endl;
132     //    cerr<<"Calorimeter: no  of h elements "<<hi.second - hi.first<<endl;
133 
134     //Deposit Elements, generated particle energies for showered particles
135     //(needed for calibration) and unshowered particles.
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       //need to make the iterators because the call is to references,
141       //and so we need an object to reference. 
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     // the iterators have been messed around with , so get a fresh set before
149     // deleting the elements
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     // return cells in calorimeter passed by cellSelector
166     // could make type change from Calorimeter cells to TES cells here 
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 } // end of namespace bracket
190 
191 
192 
193 
194 
195 
196 
197 
198 
199 
200 
201 
202 
203 
204 
205 

source navigation ] diff markup ] identifier search ] general search ]

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. Valid HTML 4.01!