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_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
00098
00099
00100
00101
00103 EventHeaderMaker( const std::string& name, ISvcLocator* pSvcLocator ) ;
00105 virtual ~EventHeaderMaker();
00106
00107
00108
00109
00110
00111
00113 StatusCode initialize() ;
00115 StatusCode execute() ;
00117 StatusCode finalize() ;
00118
00119
00120
00121 private:
00122
00123
00124
00125
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
00159
00160
00161
00162
00163
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;
00181 std::vector <int> m_escapingParticles;
00182
00183
00184 int m_lumi;
00185
00186
00187
00188
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
00199
00200 template <class Type> inline
00201 int EventHeaderMaker::numberInList(std::string tesAddress,
00202 Type ) {
00203 std::vector<Type*> aList;
00204 if( !m_tesIO->copy(aList, tesAddress) ) throw "Error in numberInList";
00205
00206 return aList.size();
00207 }
00208
00209
00210
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
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
00230
00231 template <class Type> inline HepLorentzVector
00232 EventHeaderMaker::momentumSum(std::string tesAddress, Type ) {
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
00248
00249 template <class Type, class AssType> inline HepLorentzVector
00250 EventHeaderMaker::assocMomentumSum(std::string tesAddress,
00251 Type ,
00252 AssType ) {
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
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 }
00268
00269 #endif
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279