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

EventHeaderMaker.h

Go to the documentation of this file.
00001 // ================================================
00002 // EventHeaderMaker class description
00003 // ================================================
00004 //
00005 // THIS TEXT TO BE REPLACED BY ATLAS STANDARD FORMAT
00006 //
00007 //
00008 // This version....
00009 //
00010 //
00011 // Namespace Atlfast::
00012 //
00013 // class: EventHeaderMaker
00014 //
00015 // Description: 
00016 //
00017 //  Algorithm which makes the Atlfast Event Header
00018 //  This must be run as the final algorithm in the 
00019 //  Atlfast suite as it requires the information from
00020 //  all the earlier makers.
00021 //
00022 //
00023 // ................................................................
00024 //
00025 
00026 #ifndef ATLFAST_EVENTHEADERMAKER_H
00027 #define ATLFAST_EVENTHEADERMAKER_H
00028 
00029 // STL
00030 #include <string>
00031 //#include <iterator>
00032 #include <vector>
00033 
00034 // Gaudi 
00035 #include "GaudiKernel/Algorithm.h"
00036 //#include "GaudiKernel/DataObject.h"
00037 
00038 // Other
00039 #include "CLHEP/Vector/LorentzVector.h"
00040 
00041 // Atlfast
00042 #include "AtlfastEvent/Jet.h"          //no forward dec: used in inline function
00043 #include "AtlfastUtils/TesIO.h"        //no forward dec: used in inline function
00044 
00045 class ISvcLocator;
00046 class MsgStream;
00047 namespace HepMC_helper{
00048   class IMCselector;
00049 }
00050 namespace Atlfast {
00051   class TesIO;
00052   class Jet;
00053   using std::string;
00061   class EventHeaderMaker : public Algorithm{
00062     
00063   public:
00064     
00065     //-------------------------
00066     // Constructors/Destructors
00067     //
00068     // Gaudi requires that the constructor takes certain arguments
00069     // (and passes them directly to the constructor of the base class)
00070     //-------------------------
00072     EventHeaderMaker( const std::string& name, ISvcLocator* pSvcLocator ) ; 
00074     virtual ~EventHeaderMaker();
00075     
00076     
00077     //------------------------------------------------------
00078     // Methods used by Gaudi to run the algorithm
00079     //------------------------------------------------------
00080     
00082     StatusCode initialize() ;
00084     StatusCode execute() ;
00086     StatusCode finalize() ;
00087     
00088     
00089     
00090   private:
00091     
00092     
00093     //-------------------------------
00094     // Private methods
00095     //-------------------------------
00096     
00098     template <class Type> int numberInList(std::string tesAddress, Type);
00100     int numberJetFlavor(std::string tesAddress, int);
00102     HepLorentzVector missingMomentum(MsgStream&);
00104     HepLorentzVector escapedMomentum(MsgStream&);
00107     template <class Type> 
00108       HepLorentzVector momentumSum(std::string tesAddress, Type dummy);
00111     template <class Type> 
00112       HepLorentzVector smearAndSum(std::string tesAddress, Type dummy);
00115     template <class Type, class AssType> 
00116       HepLorentzVector assocMomentumSum(std::string tesAddress, 
00117                                         Type dum1, AssType dum2);
00119     HepLorentzVector unusedClusterSum(); 
00121     HepLorentzVector unusedMuonSum();    
00123     HepLorentzVector unusedCellSum();    
00124     
00125     
00126     //-------------------------------
00127     // Data members
00128     //-------------------------------
00129     
00130     // the following data members tell the
00131     // algorithm where to retrieve its input particles from
00132     // in the TES. These are written by the job Options service.
00133     std::string m_electronLocation ;
00134     std::string m_photonLocation ;
00135     std::string m_isolatedMuonLocation;
00136     std::string m_nonIsolatedMuonLocation;
00137     std::string m_jetLocation;
00138     std::string m_cellLocation;
00139     std::string m_clusterLocation;
00140     std::string m_mcTruthLocation;
00141     std::string m_outputLocation;
00142     std::string m_missingMomentumLocation;
00143     
00144     
00145     bool m_testMode;
00146     double m_beamEnergy; // beam energy in GeV
00147     std::vector <int> m_escapingParticles; // PDG ids for escaping particles
00148     
00149     
00150     int           m_lumi;
00151     
00152     //htp random number seed will need to be removed eventually
00153     //    currently used to set up Smearer's random number seed
00154     //    SHOULD BE REPLACED BY FRAMEWORK SERVICE!! 
00155     double        m_barrelForwardEta;
00156     
00157     TesIO*        m_tesIO;
00158     HepMC_helper::IMCselector*  m_visibleToAtlas;
00159   };
00160 
00161   //-------------------------------------------------------
00162   // numberInList
00163   //-------------------------------------------------------
00164   template <class Type> inline 
00165     int EventHeaderMaker::numberInList(std::string tesAddress, 
00166                                        Type /* dummy */) {
00167     std::vector<Type*> aList;
00168     if( !m_tesIO->copy(aList, tesAddress) ) throw "Error in numberInList";
00169     //if( !m_tesIO->get(aList) ) throw "Error in numberInList";
00170     return aList.size();
00171   }
00172   
00173   //-------------------------------------------------------
00174   // numberJetFlavor
00175   //-------------------------------------------------------
00176   inline
00177     int EventHeaderMaker::numberJetFlavor(
00178                                           std::string tesAddress, 
00179                                           int flavor) {
00180     std::vector<Jet*> theJets;
00181     int temp=0;
00182     if(m_tesIO->copy(theJets, tesAddress)){
00183       //if(m_tesIO->get(theJets)){
00184       std::vector<Jet*>::const_iterator jet  = theJets.begin();
00185       for (; jet != theJets.end(); ++jet) {
00186         if( (*jet)->pdg_id()==flavor ) ++temp;
00187       }
00188     }
00189     return temp;
00190   }
00191   
00192   //-------------------------------------------------------
00193   // momentumSum
00194   //-------------------------------------------------------
00195   template <class Type> inline HepLorentzVector
00196     EventHeaderMaker::momentumSum(std::string tesAddress, Type /*type info*/) {
00197 
00198     std::vector<Type*> aList;
00199 
00200     if(!m_tesIO->copy(aList, tesAddress) ) throw "Error in momentumSum";
00201 
00202     HepLorentzVector temp(0.0,0.0,0.0,0.0);
00203     typename std::vector<Type*>::const_iterator iter = aList.begin();
00204 
00205     for (; iter != aList.end(); ++iter) temp += (*iter)->momentum();
00206 
00207     return temp;
00208   }
00209   
00210   //-------------------------------------------------------
00211   // assocMomentumSum
00212   //-------------------------------------------------------
00213   template <class Type, class AssType> inline HepLorentzVector 
00214     EventHeaderMaker::assocMomentumSum(std::string tesAddress, 
00215                                        Type /* dum1 */,
00216                                        AssType /* dum2 */) {
00217     
00218     HepLorentzVector temp(0.0,0.0,0.0,0.0);
00219     std::vector<Type*> aList;
00220     if(!m_tesIO->copy(aList, tesAddress)) throw "Error in assoc Momentum Sum";
00221     //if(!m_tesIO->get(aList)) throw "Error in assoc Momentum Sum";
00222     
00223     typename std::vector<Type*>::const_iterator iter  = aList.begin();
00224     for (; iter != aList.end(); ++iter){
00225       SmartRefVector<AssType> aList  = (*iter)->associations(AssType());
00226       typename SmartRefVector<AssType>::iterator aIter = aList.begin();
00227       for(; aIter<aList.end(); ++aIter) temp+=(*aIter)->momentum();
00228     }
00229     return temp;  
00230   }
00231 } // end of namespace bracket
00232 
00233 #endif
00234 
00235 
00236 
00237 
00238 
00239 
00240 
00241 
00242 
00243 

Generated on Wed May 1 14:11:31 2002 for AtlfastAlgs by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001