Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

Calorimeter.cxx

Go to the documentation of this file.
00001 
00002 //                                                                      //
00003 // RMS  calorimeter class implementation.                               //
00004 //                                                                      //
00005 // HTP  put into namespace & a little tidying up                        //
00006 //                                                                      //
00007 // PS   radically changed.                                              //
00009 
00010 
00011 #include "AtlfastAlgs/Calorimeter.h"
00012 #include "AtlfastAlgs/ICellSelector.h"
00013 #include "AtlfastAlgs/CalSection.h"
00014 #include "AtlfastEvent/IKinematic.h"
00015 #include "AtlfastEvent/EPileupDeposit.h"
00016 #include "AtlfastAlgs/ISmearer.h"
00017 #include "FastShowerUtils/GridletForger.h"
00018 #include "GaudiKernel/MsgStream.h"
00019 #include <cmath> 
00020 #include <vector>
00021 #include <iostream>
00022 
00023 
00024 namespace Atlfast {
00025   using std::abs;
00026   using FastShower::GridletForger;
00027 
00028   //____________________________________________________________________
00029   // create calorimeter as a number of CalSections
00030   Calorimeter::Calorimeter(
00031                            MsgStream& log,
00032                            bool  fastShower,
00033                            const double MaxEta,
00034                            const double barrelMaxEta, 
00035                            const double granBarrelEta,
00036                            const double granBarrelPhi,
00037                            const double granForwardEta,
00038                            const double granForwardPhi
00039                            ):m_log(log){ 
00040     
00041     m_section[0] =  new CalSection(log,
00042                                    abs(barrelMaxEta),  abs(MaxEta), 
00043                                    granForwardEta, granForwardPhi);
00044     
00045     m_section[1] =  new CalSection(log,
00046                                    -abs(barrelMaxEta), abs(barrelMaxEta), 
00047                                    granBarrelEta,  granBarrelPhi);
00048 
00049     m_section[2] =  new CalSection(log,
00050                                    -abs(MaxEta),       -abs(barrelMaxEta), 
00051                                    granForwardEta, granForwardPhi);
00052 
00053     if(fastShower) {
00054       m_gridletForger   = new GridletForger;
00055     }else{
00056       m_gridletForger   = 0;
00057     }
00058 
00059   }
00060   Calorimeter::~Calorimeter(){
00061     m_log<<MSG::DEBUG<<"Calorimeter destructor starts "<<endreq;
00062     delete m_section[0];
00063     delete m_section[1];
00064     delete m_section[2];
00065     //    delete m_gridletForger;
00066     m_log<<MSG::DEBUG<<"Calorimeter destructor ends "<<endreq;
00067   }
00068   Calorimeter::Calorimeter(const Calorimeter& c):m_log(c.m_log){
00069     //make m_sections point to different instances
00070     // of the CalSections, with the same value as those
00071     //owned by c.
00072     m_section[0]   = new CalSection(*(c.m_section[0]));
00073     m_section[1]   = new CalSection(*(c.m_section[1]));
00074     m_section[2]   = new CalSection(*(c.m_section[2]));
00075     m_gridletForger= new GridletForger(*(c.m_gridletForger));
00076   }
00077   //_____________________________________________________________________
00078   void Calorimeter::deposit(TransportedParticleCollectionIter& f, 
00079                             TransportedParticleCollectionIter& l){
00080     
00081     TransportedParticleCollectionIter divider = 
00082       std::partition(f, l, TryToShower(this));
00083 
00084     // send gridlet elements and unshowered aprticlesto calorimeter sections
00085     for(int ind =0 ;ind<=2; ++ind){ 
00086       m_section[ind]->depositEcal(m_eElements.begin(), m_eElements.end() );
00087       m_section[ind]->depositHcal(m_hElements.begin(), m_hElements.end() );
00088       m_section[ind]->deposit(divider, l);
00089     }
00090   }
00091   //_____________________________________________________________________
00092     // deposit energy pileup
00093   void Calorimeter::deposit(std::vector<Atlfast::EPileupDeposit*>::iterator& f, 
00094                             std::vector<Atlfast::EPileupDeposit*>::iterator& l)const{
00095     //send energy pileup to calorimeter sections
00096     for(int ind =0 ;ind<=2; ++ind){
00097       m_section[ind]->deposit(f, l);
00098     }
00099 
00100     }
00101   //__________________________________________________________________
00102   const GridletForger*  Calorimeter::gridletForger() const {
00103     return m_gridletForger;
00104   }
00105   //__________________________________________________________________
00106   MsgStream&  Calorimeter::msgStream() const {return m_log;}
00107   //__________________________________________________________________
00108   void  Calorimeter::addEelements(ElementCollectionIter f, 
00109                                   ElementCollectionIter l){
00110     for(ElementCollectionIter iter = f; iter != l; ++iter){
00111       m_eElements.push_back(*iter);}
00112   }
00113   //__________________________________________________________________
00114   void  Calorimeter::addHelements(ElementCollectionIter f, 
00115                                   ElementCollectionIter l){
00116     for(ElementCollectionIter iter = f; iter != l;++iter){
00117       m_hElements.push_back(*iter);}
00118   }
00119   //__________________________________________________________________
00120   void Calorimeter::giveHitCells(const ICellSelector* p_cellSelector, 
00121                                  ITwoCptCellCollection* cells)  {
00122     
00123     // return cells in calorimeter passed by cellSelector
00124     // could make type change from Calorimeter cells to TES cells here 
00125     
00126     for(int ind=0; ind<=2; ++ind) {
00127       m_section[ind]->giveHits(p_cellSelector, cells);
00128     }
00129   }
00130     
00131   //_______________________________________________________________________
00132   void Calorimeter::reset()
00133   {
00134     for(int ind=0; ind<=2; ++ind) {m_section[ind]->reset();}
00135 
00136     ElementCollection::iterator iter;
00137 
00138     iter = m_eElements.begin();
00139     for(; iter!=m_eElements.end(); ++iter){delete *iter;}
00140     m_eElements.clear();
00141 
00142     iter = m_hElements.begin();
00143     for(; iter!=m_hElements.end(); ++iter){delete *iter;}
00144     m_hElements.clear();
00145   }
00146   //_______________________________________________________________________
00147   void Calorimeter::smearCells(ISmearer* p_smearer)
00148   {
00149     for(int ind=0; ind<=2; ++ind) {
00150       m_section[ind]->smearCells(p_smearer);
00151     }
00152   }
00153 } // end of namespace bracket
00154 
00155 
00156 
00157 
00158 
00159 
00160 
00161 
00162 
00163 
00164 
00165 
00166 
00167 
00168 
00169 

Generated on Tue Mar 18 11:18:22 2003 for AtlfastAlgs by doxygen1.3-rc1