00001
00002
00003
00004 #ifndef ATLFAST_ATLFASTPROTOJETMAKER_H
00005 #define ATLFAST_ATLFASTPROTOJETMAKER_H
00006
00007
00008
00009 #include "CLHEP/Vector/LorentzVector.h"
00010 #include <vector>
00011 #include <string>
00012
00013
00014 #include "GaudiKernel/Algorithm.h"
00015 #include "GaudiKernel/MsgStream.h"
00016 #include "ProtoJetEvent/ProtoJet.h"
00017 #include "ProtoJetEvent/ProtoJetCollection.h"
00018
00019 #include "AtlfastUtils/TesIO.h"
00020
00021 class ISvcLocator;
00022
00023 namespace Atlfast {
00024 class ISmearer;
00025 class AtlfastProtoJet;
00026
00027 using std::string;
00028
00037 class AtlfastProtoJetMaker : public Algorithm {
00038
00039 public:
00040
00042 AtlfastProtoJetMaker(const std::string& name, ISvcLocator* pSvcLocator);
00044 ~AtlfastProtoJetMaker();
00045
00047 StatusCode initialize();
00049 StatusCode execute();
00051
00052 StatusCode finalize();
00053
00054 private:
00055
00056
00057
00059 std::string m_inputCellLocation;
00060 std::string m_inputClusterLocation;
00062 std::string m_outputTowerPJKey;
00063 std::string m_outputClusterPJKey;
00064 std::string m_outputFinalStatePJKey;
00066 TesIO* m_tesIO;
00067 bool m_towerPJConstruct;
00068 bool m_clusterPJConstruct;
00069 bool m_finalStatePJConstruct;
00070 bool m_towerPJSmearOn;
00071 bool m_clusterPJSmearOn;
00072
00073
00074
00075
00076
00077 ISmearer* m_smearer;
00078
00079
00080 template <class T1, class T2> StatusCode FillProtoJets(const std::vector<T1*>&,
00081 T2*,
00082 const std::string&);
00083 template <class T1, class T2> StatusCode FillProtoJets(const std::vector<T1*>&,
00084 T2*,
00085 const std::string&,
00086 bool);
00087 template <class T1, class T2> StatusCode FillProtoJets(const std::vector<T1*>&,
00088 T2*);
00089 };
00090
00091
00092 template <class T1, class T2> inline
00093 StatusCode
00094 AtlfastProtoJetMaker::FillProtoJets(const std::vector<T1*>& vec,
00095 T2* proJ,
00096 const std::string& PJoutputLocation){
00097 bool smear = false;
00098 return this->FillProtoJets(vec,
00099 proJ,
00100 PJoutputLocation,
00101 smear);
00102 }
00103
00104 template <class T1, class T2> inline
00105 StatusCode
00106 AtlfastProtoJetMaker::FillProtoJets(const std::vector<T1*>& vec,
00107 T2* proJ,
00108 const std::string& PJoutputLocation,
00109 bool smear){
00110 MsgStream log( messageService(), name() ) ;
00111 ProtoJetCollection<ProtoJet>* pjs = new ProtoJetCollection<ProtoJet>;
00112 typename std::vector<T1*>::const_iterator itr = vec.begin();
00113 HepLorentzVector hepvec;
00114 for (; itr != vec.end(); ++itr) {
00115 hepvec = (*itr)->momentum();
00116 if(smear){
00117 hepvec = m_smearer->smear(hepvec);
00118 }
00119 proJ = new T2(hepvec);
00120 pjs->push_back(proJ);
00121 }
00122 log << MSG::DEBUG << "Size of vector"<<pjs->size() << endreq;
00123
00124 TesIoStat stat = m_tesIO -> store(pjs, PJoutputLocation);
00125 std::string message;
00126 message = stat ? "AtlfastProtoJet stored by key":
00127 "Failed to store AtlfastProtoJet by key";
00128 log<<MSG::DEBUG<<message<<endreq;
00129 if (!stat) {return StatusCode::FAILURE;}
00130 return (stat)? StatusCode::SUCCESS:StatusCode::FAILURE;
00131 }
00132
00133 template <class T1, class T2> inline
00134 StatusCode
00135 AtlfastProtoJetMaker::FillProtoJets(const std::vector<T1*>& vec, T2* proJ){
00136 MsgStream log( messageService(), name() ) ;
00137 ObjectVector<ProtoJet>* pjs = new ObjectVector<ProtoJet>;
00138 typename std::vector<T1*>::const_iterator itr = vec.begin();
00139 for (; itr != vec.end(); ++itr) {
00140 proJ = new T2((*itr)->momentum());
00141 pjs->push_back(proJ);
00142 }
00143 log << MSG::DEBUG << "Size of vector"<<pjs->size() << endreq;
00144
00145 TesIoStat stat = m_tesIO -> store(pjs);
00146 message = stat ? "AtlfastProtoJet stored by type":
00147 "Failed to store AtlfastProtoJet type";
00148 log<<MSG::DEBUG<<message<<endreq;
00149 return (stat)? StatusCode::SUCCESS:StatusCode::FAILURE;
00150 }
00151
00152 }
00153 #endif
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172