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
00017
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
00038 class AtlfastProtoJetMaker : public Algorithm {
00039
00040 public:
00041
00043 AtlfastProtoJetMaker(const std::string& name, ISvcLocator* pSvcLocator);
00045 ~AtlfastProtoJetMaker();
00046
00048 StatusCode initialize();
00050 StatusCode execute();
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 std::string m_mcLocation;
00075
00076
00077
00078
00079
00080
00081
00082 ISmearer* m_smearer;
00083
00084
00085 template <class T1, class T2> StatusCode FillProtoJets(const std::vector<T1*>&,
00086 T2*,
00087 const std::string&);
00088 template <class T1, class T2> StatusCode FillProtoJets(const std::vector<T1*>&,
00089 T2*,
00090 const std::string&,
00091 bool);
00092 template <class T1, class T2> StatusCode FillProtoJets(const std::vector<T1*>&,
00093 T2*);
00094 };
00095
00096
00097 template <class T1, class T2> inline
00098 StatusCode
00099 AtlfastProtoJetMaker::FillProtoJets(const std::vector<T1*>& vec,
00100 T2* proJ,
00101 const std::string& PJoutputLocation){
00102 bool smear = false;
00103 return this->FillProtoJets(vec,
00104 proJ,
00105 PJoutputLocation,
00106 smear);
00107 }
00108
00109 template <class T1, class T2> inline
00110 StatusCode
00111 AtlfastProtoJetMaker::FillProtoJets(const std::vector<T1*>& vec,
00112 T2* proJ,
00113 const std::string& PJoutputLocation,
00114 bool smear){
00115 MsgStream log( messageService(), name() ) ;
00116 ProtoJetCollection<ProtoJet>* pjs = new ProtoJetCollection<ProtoJet>;
00117 typename std::vector<T1*>::const_iterator itr = vec.begin();
00118 HepLorentzVector hepvec;
00119 for (; itr != vec.end(); ++itr) {
00120 hepvec = (*itr)->momentum();
00121 if(smear){
00122 hepvec = m_smearer->smear(hepvec);
00123 }
00124 proJ = new T2(hepvec);
00125 pjs->push_back(proJ);
00126 }
00127 log << MSG::DEBUG << "Size of vector"<<pjs->size() << endreq;
00128
00129 TesIoStat stat = m_tesIO -> store(pjs, PJoutputLocation);
00130 std::string message;
00131 message = stat ? "AtlfastProtoJet stored by key":
00132 "Failed to store AtlfastProtoJet by key";
00133 log<<MSG::DEBUG<<message<<endreq;
00134 if (!stat) {return StatusCode::FAILURE;}
00135 return (stat)? StatusCode::SUCCESS:StatusCode::FAILURE;
00136 }
00137
00138 template <class T1, class T2> inline
00139 StatusCode
00140 AtlfastProtoJetMaker::FillProtoJets(const std::vector<T1*>& vec, T2* proJ){
00141 MsgStream log( messageService(), name() ) ;
00142 ObjectVector<ProtoJet>* pjs = new ObjectVector<ProtoJet>;
00143 typename std::vector<T1*>::const_iterator itr = vec.begin();
00144 for (; itr != vec.end(); ++itr) {
00145 proJ = new T2((*itr)->momentum());
00146 pjs->push_back(proJ);
00147 }
00148 log << MSG::DEBUG << "Size of vector"<<pjs->size() << endreq;
00149
00150 TesIoStat stat = m_tesIO -> store(pjs);
00151 message = stat ? "AtlfastProtoJet stored by type":
00152 "Failed to store AtlfastProtoJet type";
00153 log<<MSG::DEBUG<<message<<endreq;
00154 return (stat)? StatusCode::SUCCESS:StatusCode::FAILURE;
00155 }
00156
00157 }
00158 #endif
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177