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__
00027 #define __ATLFAST_EventHeaderMaker__
00028 
00029 // STL
00030 #include <string>
00031 #include <iterator>
00032 #include <vector>
00033 //#include <stl>
00034 
00035 // Gaudi 
00036 #include "GaudiKernel/ISvcLocator.h"
00037 #include "GaudiKernel/Algorithm.h"
00038 #include "GaudiKernel/MsgStream.h"
00039 #include "GaudiKernel/DataObject.h"
00040 
00041 // Other
00042 #include "CLHEP/Vector/LorentzVector.h"
00043 #include "HepMC/GenEvent.h"
00044 #include "HepMC/GenParticle.h"
00045 
00046 // Atlfast
00047 #include "AtlfastCode/ReconstructedParticle.h"
00048 #include "AtlfastCode/CommonData.h"
00049 #include "AtlfastCode/TesIO.h"
00050 #include "AtlfastCode/HepMC_helper.h"
00051 #include "AtlfastCode/Jet.h"
00052 
00053 //*****************************************
00054 // Default paths in the Transient event store to get/put entities
00055 //
00056 //[Note:  This will change as the current system is not considered acceptable.]
00057 //******************************************
00058 
00059 #define DEFAULT_beamEnergy                7000.0;
00060 
00061 #define DEFAULT_lumi          1   // Luminosity option (1=low, 2=high)
00062 #define DEFAULT_randSeed    12345 // Random number seed
00063 
00064 
00065 
00066 
00067 
00068 //places to look in the TES 
00069 #define DEFAULT_electronLocation          "/Event/AtlfastIsolatedElectrons"
00070 #define DEFAULT_photonLocation            "/Event/AtlfastIsolatedPhotons"
00071 #define DEFAULT_isolatedMuonLocation      "/Event/AtlfastIsolatedMuons"
00072 #define DEFAULT_nonIsolatedMuonLocation   "/Event/AtlfastNonIsolatedMuons"
00073 #define DEFAULT_jetLocation               "/Event/AtlfastJets"
00074 #define DEFAULT_cellLocation              "/Event/AtlfastCells"
00075 #define DEFAULT_clusterLocation           "/Event/AtlfastClusters"
00076 #define DEFAULT_mcTruthLocation           "/Event/McEventCollection"
00077 #define DEFAULT_outputLocation            "/Event/AtlfastEventHeader"
00078 #define DEFAULT_commonDataLocation        "/Event/AtlfastCommonData"
00079 #define DEFAULT_missingMomentumLocation   "/Event/AtlfastMissingMomentum"
00080 #define DEFAULT_runNumber                 1000;
00081 #define DEFAULT_evtNumber                 0;
00082 #define DEFAULT_testMode                  false;
00083 
00084 namespace Atlfast {
00085 
00093   class EventHeaderMaker : public Algorithm{
00094     
00095   public:
00096     
00097     //-------------------------
00098     // Constructors/Destructors
00099     //
00100     // Gaudi requires that the constructor takes certain arguments
00101     // (and passes them directly to the constructor of the base class)
00102     //-------------------------
00104     EventHeaderMaker( const std::string& name, ISvcLocator* pSvcLocator ) ; 
00106     virtual ~EventHeaderMaker();
00107     
00108     
00109     //------------------------------------------------------
00110     // Methods used by Gaudi to run the algorithm
00111     //------------------------------------------------------
00112     
00114     StatusCode initialize() ;
00116     StatusCode execute() ;
00118     StatusCode finalize() ;
00119     
00120     
00121     
00122   private:
00123     
00124     
00125     //-------------------------------
00126     // Private methods
00127     //-------------------------------
00128     
00130     template <class Type> int numberInList(std::string tesAddress, Type);
00132     int numberJetFlavor(std::string tesAddress, int);
00134     HepLorentzVector missingMomentum(MsgStream&);
00136     HepLorentzVector escapedMomentum(MsgStream&);
00139     template <class Type> 
00140       HepLorentzVector momentumSum(std::string tesAddress, Type dummy);
00143     template <class Type> 
00144       HepLorentzVector smearAndSum(std::string tesAddress, Type dummy);
00147     template <class Type, class AssType> 
00148       HepLorentzVector assocMomentumSum(std::string tesAddress, 
00149                                         Type dum1, AssType dum2);
00151     HepLorentzVector unusedClusterSum(); 
00153     HepLorentzVector unusedMuonSum();    
00155     HepLorentzVector unusedCellSum();    
00156     
00157     
00158     //-------------------------------
00159     // Data members
00160     //-------------------------------
00161     
00162     // the following data members tell the
00163     // algorithm where to retrieve its input particles from
00164     // in the TES. These are written by the job Options service.
00165     std::string m_electronLocation ;
00166     std::string m_photonLocation ;
00167     std::string m_isolatedMuonLocation;
00168     std::string m_nonIsolatedMuonLocation;
00169     std::string m_jetLocation;
00170     std::string m_cellLocation;
00171     std::string m_clusterLocation;
00172     std::string m_mcTruthLocation;
00173     std::string m_outputLocation;
00174     std::string m_commonDataLocation;
00175     std::string m_missingMomentumLocation;
00176     
00177     
00178     bool m_testMode;
00179     int m_runNumber;
00180     int m_evtNumber;
00181     double m_beamEnergy; // beam energy in GeV
00182     std::vector <int> m_escapingParticles; // PDG ids for escaping particles
00183     
00184     
00185     int           m_lumi;
00186     
00187     //htp random number seed will need to be removed eventually
00188     //    currently used to set up Smearer's random number seed
00189     //    SHOULD BE REPLACED BY FRAMEWORK SERVICE!! 
00190     int           m_randSeed;
00191     double        m_barrelForwardEta;
00192     
00193     double        m_notInit;
00194     TesIO*        m_tesIO;
00195     HepMC_helper::IMCselector*  m_visibleToAtlas;
00196   };
00197 
00198   //-------------------------------------------------------
00199   // numberInList
00200   //-------------------------------------------------------
00201   template <class Type> inline 
00202     int EventHeaderMaker::numberInList(std::string tesAddress, 
00203                                        Type /* dummy */) {
00204     std::vector<Type*> aList;
00205     if( !m_tesIO->copy(aList, tesAddress) ) throw "Error in numberInList";
00206     //if( !m_tesIO->get(aList) ) throw "Error in numberInList";
00207     return aList.size();
00208   }
00209   
00210   //-------------------------------------------------------
00211   // numberJetFlavor
00212   //-------------------------------------------------------
00213   inline
00214     int EventHeaderMaker::numberJetFlavor(
00215                                           std::string tesAddress, 
00216                                           int flavor) {
00217     std::vector<Jet*> theJets;
00218     int temp=0;
00219     if(m_tesIO->copy(theJets, tesAddress)){
00220       //if(m_tesIO->get(theJets)){
00221       std::vector<Jet*>::const_iterator jet  = theJets.begin();
00222       for (; jet != theJets.end(); ++jet) {
00223         if( (*jet)->pdg_id()==flavor ) ++temp;
00224       }
00225     }
00226     return temp;
00227   }
00228   
00229   //-------------------------------------------------------
00230   // momentumSum
00231   //-------------------------------------------------------
00232   template <class Type> inline HepLorentzVector
00233     EventHeaderMaker::momentumSum(std::string tesAddress, Type /*type info*/) {
00234 
00235     std::vector<Type*> aList;
00236 
00237     if(!m_tesIO->copy(aList, tesAddress) ) throw "Error in momentumSum";
00238 
00239     HepLorentzVector temp(0.0,0.0,0.0,0.0);
00240     typename std::vector<Type*>::const_iterator iter = aList.begin();
00241 
00242     for (; iter != aList.end(); ++iter) temp += (*iter)->momentum();
00243 
00244     return temp;
00245   }
00246   
00247   //-------------------------------------------------------
00248   // assocMomentumSum
00249   //-------------------------------------------------------
00250   template <class Type, class AssType> inline HepLorentzVector 
00251     EventHeaderMaker::assocMomentumSum(std::string tesAddress, 
00252                                        Type /* dum1 */,
00253                                        AssType /* dum2 */) {
00254     
00255     HepLorentzVector temp(0.0,0.0,0.0,0.0);
00256     std::vector<Type*> aList;
00257     if(!m_tesIO->copy(aList, tesAddress)) throw "Error in assoc Momentum Sum";
00258     //if(!m_tesIO->get(aList)) throw "Error in assoc Momentum Sum";
00259     
00260     typename std::vector<Type*>::const_iterator iter  = aList.begin();
00261     for (; iter != aList.end(); ++iter){
00262       SmartRefVector<AssType> aList  = (*iter)->associations(AssType());
00263       typename SmartRefVector<AssType>::iterator aIter = aList.begin();
00264       for(; aIter<aList.end(); ++aIter) temp+=(*aIter)->momentum();
00265     }
00266     return temp;  
00267   }
00268 } // end of namespace bracket
00269 
00270 #endif
00271 
00272 
00273 
00274 
00275 
00276 
00277 
00278 
00279 
00280 

Generated on Wed Jan 23 12:58:31 2002 for Atlfast by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001