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_missingMomentumLocation   "/Event/AtlfastMissingMomentum"
00076 #define DEFAULT_runNumber                 1000;
00077 #define DEFAULT_evtNumber                 0;
00078 #define DEFAULT_testMode                  false;
00079 
00080 namespace Atlfast {
00081   class TesIO;
00082   class Jet;
00083 
00091   class EventHeaderMaker : public Algorithm{
00092     
00093   public:
00094     
00095     //-------------------------
00096     // Constructors/Destructors
00097     //
00098     // Gaudi requires that the constructor takes certain arguments
00099     // (and passes them directly to the constructor of the base class)
00100     //-------------------------
00102     EventHeaderMaker( const std::string& name, ISvcLocator* pSvcLocator ) ; 
00104     virtual ~EventHeaderMaker();
00105     
00106     
00107     //------------------------------------------------------
00108     // Methods used by Gaudi to run the algorithm
00109     //------------------------------------------------------
00110     
00112     StatusCode initialize() ;
00114     StatusCode execute() ;
00116     StatusCode finalize() ;
00117     
00118     
00119     
00120   private:
00121     
00122     
00123     //-------------------------------
00124     // Private methods
00125     //-------------------------------
00126     
00128     template <class Type> int numberInList(std::string tesAddress, Type);
00130     int numberJetFlavor(std::string tesAddress, int);
00132     HepLorentzVector missingMomentum(MsgStream&);
00134     HepLorentzVector escapedMomentum(MsgStream&);
00137     template <class Type> 
00138       HepLorentzVector momentumSum(std::string tesAddress, Type dummy);
00141     template <class Type> 
00142       HepLorentzVector smearAndSum(std::string tesAddress, Type dummy);
00145     template <class Type, class AssType> 
00146       HepLorentzVector assocMomentumSum(std::string tesAddress, 
00147                                         Type dum1, AssType dum2);
00149     HepLorentzVector unusedClusterSum(); 
00151     HepLorentzVector unusedMuonSum();    
00153     HepLorentzVector unusedCellSum();    
00154     
00155     
00156     //-------------------------------
00157     // Data members
00158     //-------------------------------
00159     
00160     // the following data members tell the
00161     // algorithm where to retrieve its input particles from
00162     // in the TES. These are written by the job Options service.
00163     std::string m_electronLocation ;
00164     std::string m_photonLocation ;
00165     std::string m_isolatedMuonLocation;
00166     std::string m_nonIsolatedMuonLocation;
00167     std::string m_jetLocation;
00168     std::string m_cellLocation;
00169     std::string m_clusterLocation;
00170     std::string m_mcTruthLocation;
00171     std::string m_outputLocation;
00172     std::string m_missingMomentumLocation;
00173     
00174     
00175     bool m_testMode;
00176     int m_runNumber;
00177     int m_evtNumber;
00178     double m_beamEnergy; // beam energy in GeV
00179     std::vector <int> m_escapingParticles; // PDG ids for escaping particles
00180     
00181     
00182     int           m_lumi;
00183     
00184     //htp random number seed will need to be removed eventually
00185     //    currently used to set up Smearer's random number seed
00186     //    SHOULD BE REPLACED BY FRAMEWORK SERVICE!! 
00187     int           m_randSeed;
00188     double        m_barrelForwardEta;
00189     
00190     TesIO*        m_tesIO;
00191     HepMC_helper::IMCselector*  m_visibleToAtlas;
00192   };
00193 
00194   //-------------------------------------------------------
00195   // numberInList
00196   //-------------------------------------------------------
00197   template <class Type> inline 
00198     int EventHeaderMaker::numberInList(std::string tesAddress, 
00199                                        Type /* dummy */) {
00200     std::vector<Type*> aList;
00201     if( !m_tesIO->copy(aList, tesAddress) ) throw "Error in numberInList";
00202     //if( !m_tesIO->get(aList) ) throw "Error in numberInList";
00203     return aList.size();
00204   }
00205   
00206   //-------------------------------------------------------
00207   // numberJetFlavor
00208   //-------------------------------------------------------
00209   inline
00210     int EventHeaderMaker::numberJetFlavor(
00211                                           std::string tesAddress, 
00212                                           int flavor) {
00213     std::vector<Jet*> theJets;
00214     int temp=0;
00215     if(m_tesIO->copy(theJets, tesAddress)){
00216       //if(m_tesIO->get(theJets)){
00217       std::vector<Jet*>::const_iterator jet  = theJets.begin();
00218       for (; jet != theJets.end(); ++jet) {
00219         if( (*jet)->pdg_id()==flavor ) ++temp;
00220       }
00221     }
00222     return temp;
00223   }
00224   
00225   //-------------------------------------------------------
00226   // momentumSum
00227   //-------------------------------------------------------
00228   template <class Type> inline HepLorentzVector
00229     EventHeaderMaker::momentumSum(std::string tesAddress, Type /*type info*/) {
00230 
00231     std::vector<Type*> aList;
00232 
00233     if(!m_tesIO->copy(aList, tesAddress) ) throw "Error in momentumSum";
00234 
00235     HepLorentzVector temp(0.0,0.0,0.0,0.0);
00236     typename std::vector<Type*>::const_iterator iter = aList.begin();
00237 
00238     for (; iter != aList.end(); ++iter) temp += (*iter)->momentum();
00239 
00240     return temp;
00241   }
00242   
00243   //-------------------------------------------------------
00244   // assocMomentumSum
00245   //-------------------------------------------------------
00246   template <class Type, class AssType> inline HepLorentzVector 
00247     EventHeaderMaker::assocMomentumSum(std::string tesAddress, 
00248                                        Type /* dum1 */,
00249                                        AssType /* dum2 */) {
00250     
00251     HepLorentzVector temp(0.0,0.0,0.0,0.0);
00252     std::vector<Type*> aList;
00253     if(!m_tesIO->copy(aList, tesAddress)) throw "Error in assoc Momentum Sum";
00254     //if(!m_tesIO->get(aList)) throw "Error in assoc Momentum Sum";
00255     
00256     typename std::vector<Type*>::const_iterator iter  = aList.begin();
00257     for (; iter != aList.end(); ++iter){
00258       SmartRefVector<AssType> aList  = (*iter)->associations(AssType());
00259       typename SmartRefVector<AssType>::iterator aIter = aList.begin();
00260       for(; aIter<aList.end(); ++aIter) temp+=(*aIter)->momentum();
00261     }
00262     return temp;  
00263   }
00264 } // end of namespace bracket
00265 
00266 #endif
00267 
00268 
00269 
00270 
00271 
00272 
00273 
00274 
00275 
00276 

Generated on Thu Feb 21 14:30:46 2002 for Atlfast by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001