00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef ATLFAST_EVENTHEADERMAKER_H
00027 #define ATLFAST_EVENTHEADERMAKER_H
00028
00029
00030 #include <string>
00031
00032 #include <vector>
00033
00034
00035 #include "GaudiKernel/Algorithm.h"
00036
00037
00038
00039 #include "CLHEP/Vector/LorentzVector.h"
00040
00041
00042 #include "AtlfastCode/Jet.h"
00043 #include "AtlfastCode/TesIO.h"
00044
00045 class ISvcLocator;
00046 class MsgStream;
00047 namespace HepMC_helper{
00048 class IMCselector;
00049 }
00050
00051
00052
00053
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
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
00097
00098
00099
00100
00102 EventHeaderMaker( const std::string& name, ISvcLocator* pSvcLocator ) ;
00104 virtual ~EventHeaderMaker();
00105
00106
00107
00108
00109
00110
00112 StatusCode initialize() ;
00114 StatusCode execute() ;
00116 StatusCode finalize() ;
00117
00118
00119
00120 private:
00121
00122
00123
00124
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
00158
00159
00160
00161
00162
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;
00179 std::vector <int> m_escapingParticles;
00180
00181
00182 int m_lumi;
00183
00184
00185
00186
00187 int m_randSeed;
00188 double m_barrelForwardEta;
00189
00190 TesIO* m_tesIO;
00191 HepMC_helper::IMCselector* m_visibleToAtlas;
00192 };
00193
00194
00195
00196
00197 template <class Type> inline
00198 int EventHeaderMaker::numberInList(std::string tesAddress,
00199 Type ) {
00200 std::vector<Type*> aList;
00201 if( !m_tesIO->copy(aList, tesAddress) ) throw "Error in numberInList";
00202
00203 return aList.size();
00204 }
00205
00206
00207
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
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
00227
00228 template <class Type> inline HepLorentzVector
00229 EventHeaderMaker::momentumSum(std::string tesAddress, Type ) {
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
00245
00246 template <class Type, class AssType> inline HepLorentzVector
00247 EventHeaderMaker::assocMomentumSum(std::string tesAddress,
00248 Type ,
00249 AssType ) {
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
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 }
00265
00266 #endif
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276