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 "AtlfastEvent/Jet.h"
00043 #include "AtlfastUtils/TesIO.h"
00044
00045 #ifndef ATLFAST_COLLECTIONDEFS_H
00046 #include "AtlfastEvent/CollectionDefs.h"
00047 #endif
00048
00049 class ISvcLocator;
00050 class MsgStream;
00051 namespace HepMC_helper{
00052 class IMCselector;
00053 }
00054 namespace Atlfast {
00055 class TesIO;
00056 class Jet;
00057 using std::string;
00065 class EventHeaderMaker : public Algorithm{
00066
00067 public:
00068
00069
00070
00071
00072
00073
00074
00076 EventHeaderMaker( const std::string& name, ISvcLocator* pSvcLocator ) ;
00078 virtual ~EventHeaderMaker();
00079
00080
00081
00082
00083
00084
00086 StatusCode initialize() ;
00088 StatusCode execute() ;
00090 StatusCode finalize() ;
00091
00092
00093
00094 private:
00095
00096
00097
00098
00099
00100
00102 template <class Collection> int numberInList(std::string tesAddress);
00104 int numberJetFlavor(std::string tesAddress, int);
00106 HepLorentzVector missingMomentum(MsgStream&);
00108 HepLorentzVector escapedMomentum(MsgStream&);
00111 template <class Collection>
00112 HepLorentzVector momentumSum(std::string tesAddress);
00115 template <class Type>
00116 HepLorentzVector smearAndSum(std::string tesAddress, Type dummy);
00119 template <class Collection, class AssType>
00120 HepLorentzVector assocMomentumSum(std::string tesAddress);
00122 HepLorentzVector unusedClusterSum();
00124 HepLorentzVector unusedMuonSum();
00126 HepLorentzVector unusedCellSum();
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136 std::string m_electronLocation ;
00137 std::string m_photonLocation ;
00138 std::string m_isolatedMuonLocation;
00139 std::string m_nonIsolatedMuonLocation;
00140 std::string m_jetLocation;
00141 std::string m_cellLocation;
00142 std::string m_clusterLocation;
00143 std::string m_mcTruthLocation;
00144 std::string m_outputLocation;
00145 std::string m_missingMomentumLocation;
00146
00147
00148 bool m_testMode;
00149 double m_beamEnergy;
00150 std::vector <int> m_escapingParticles;
00151
00152
00153 int m_lumi;
00154
00155
00156
00157
00158 double m_barrelForwardEta;
00159
00160 TesIO* m_tesIO;
00161 HepMC_helper::IMCselector* m_visibleToAtlas;
00162 };
00163
00164
00165
00166
00167 template <class Collection> inline
00168 int EventHeaderMaker::numberInList(std::string tesAddress) {
00169 DataHandle<Collection> dh;
00170 if( !m_tesIO->getDH(dh, tesAddress) ) throw "Error in numberInList";
00171 return dh->size();
00172
00173
00174
00175
00176 }
00177
00178
00179
00180
00181 inline
00182 int EventHeaderMaker::numberJetFlavor(
00183 std::string tesAddress,
00184 int flavor) {
00185 std::vector<Jet*> theJets;
00186 int temp=0;
00187 if(m_tesIO->copy<JetCollection >(theJets, tesAddress)){
00188
00189 std::vector<Jet*>::const_iterator jet = theJets.begin();
00190 for (; jet != theJets.end(); ++jet) {
00191 if( (*jet)->pdg_id()==flavor ) ++temp;
00192 }
00193 }
00194 return temp;
00195 }
00196
00197
00198
00199
00200 template <class Collection> inline HepLorentzVector
00201 EventHeaderMaker::momentumSum(std::string tesAddress) {
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215 HepLorentzVector temp(0.0,0.0,0.0,0.0);
00216
00217 DataHandle<Collection> dh;
00218 if( !m_tesIO->getDH(dh, tesAddress) ) throw "Error in numberInList";
00219
00220 typename Collection::const_iterator iter = dh->begin();
00221 typename Collection::const_iterator end = dh->end();
00222
00223 for (; iter != end; ++iter) temp += (*iter)->momentum();
00224
00225 return temp;
00226 }
00227
00228
00229
00230
00231 template <class Collection, class AssType> inline HepLorentzVector
00232 EventHeaderMaker::assocMomentumSum(std::string tesAddress) {
00233
00234 HepLorentzVector temp(0.0,0.0,0.0,0.0);
00235
00236 DataHandle<Collection> dh;
00237 if( !m_tesIO->getDH(dh, tesAddress) ) throw "Error in assocMomentumSum";
00238
00239 typename Collection::const_iterator iter = dh->begin();
00240 typename Collection::const_iterator end = dh->end();
00241
00242 for (; iter != end; ++iter){
00243 IAssociationManager* ia = *iter;
00244 AssType assType;
00245 std::vector<const AssType*> aList = ia->associations(assType);
00246 typename std::vector<const AssType*>::const_iterator aIter = aList.begin();
00247 for(; aIter<aList.end(); ++aIter) temp+=(*aIter)->momentum();
00248 }
00249 return temp;
00250 }
00251 }
00252
00253 #endif
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263