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

Generated on Mon Feb 4 15:54:23 2002 for Atlfast by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001