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 #include "JetRec/Jet.h"
00018
00019 #include "AtlfastCode/TesIO.h"
00020
00021
00022
00023
00024 #define DEFAULT_inputCellLocation "/Event/AtlfastCells"
00025 #define DEFAULT_inputClusterLocation "/Event/AtlfastClusters"
00026 #define DEFAULT_outputTowerPJKey "/Event/AtlfastTowerProtoJets"
00027 #define DEFAULT_outputClusterPJKey "/Event/AtlfastClusterProtoJets"
00028 #define DEFAULT_outputFinalStatePJKey "/Event/AtlfastFinalStateProtoJets"
00029 #define DEFAULT_outputTowerJetKey "/Event/AtlfastTowerJets"
00030 #define DEFAULT_outputClusterJetKey "/Event/AtlfastClusterJets"
00031 #define DEFAULT_outputFinalStateJetKey "/Event/AtlfastFinalStateJets"
00032 #define DEFAULT_towerPJConstruct true
00033 #define DEFAULT_clusterPJConstruct true
00034 #define DEFAULT_finalStatePJConstruct true
00035 #define DEFAULT_finalStatePJConstruct true
00036 #define DEFAULT_towerPJSmearOn false
00037 #define DEFAULT_clusterPJSmearOn false
00038
00039 class ISvcLocator;
00040
00041 namespace Atlfast {
00042 class ISmearer;
00043 class AtlfastProtoJet;
00044
00053 class AtlfastProtoJetMaker : public Algorithm {
00054
00055 public:
00056
00058 AtlfastProtoJetMaker(const std::string& name, ISvcLocator* pSvcLocator);
00060 ~AtlfastProtoJetMaker();
00061
00063 StatusCode initialize();
00065 StatusCode execute();
00067
00068 StatusCode finalize();
00069
00070 private:
00071
00072
00073
00075 std::string m_inputCellLocation;
00076 std::string m_inputClusterLocation;
00078 std::string m_outputTowerPJKey;
00079 std::string m_outputClusterPJKey;
00080 std::string m_outputFinalStatePJKey;
00082 std::string m_outputTowerJetKey;
00083 std::string m_outputClusterJetKey;
00084 std::string m_outputFinalStateJetKey;
00086 TesIO* m_tesIO;
00087 bool m_notInit;
00088 bool m_towerPJConstruct;
00089 bool m_clusterPJConstruct;
00090 bool m_finalStatePJConstruct;
00091 bool m_towerPJSmearOn;
00092 bool m_clusterPJSmearOn;
00093
00094
00095
00096
00097
00098 ISmearer* m_smearer;
00099
00100
00101 template <class T1, class T2> StatusCode FillProtoJets(const std::vector<T1*>&,
00102 T2*,
00103 const std::string&,
00104 const std::string&);
00105 template <class T1, class T2> StatusCode FillProtoJets(const std::vector<T1*>&,
00106 T2*,
00107 const std::string&,
00108 const std::string&,
00109 bool);
00110 template <class T1, class T2> StatusCode FillProtoJets(const std::vector<T1*>&,
00111 T2*);
00112 };
00113
00114
00115 template <class T1, class T2> inline
00116 StatusCode
00117 AtlfastProtoJetMaker::FillProtoJets(const std::vector<T1*>& vec,
00118 T2* proJ,
00119 const std::string& PJoutputLocation,
00120 const std::string& JoutputLocation){
00121 bool smear = false;
00122 return this->FillProtoJets(vec,
00123 proJ,
00124 PJoutputLocation,
00125 JoutputLocation,
00126 smear);
00127 }
00128
00129 template <class T1, class T2> inline
00130 StatusCode
00131 AtlfastProtoJetMaker::FillProtoJets(const std::vector<T1*>& vec,
00132 T2* proJ,
00133 const std::string& PJoutputLocation,
00134 const std::string& JoutputLocation,
00135 bool smear){
00136 MsgStream log( messageService(), name() ) ;
00137 ObjectVector<ProtoJet>* pjs = new ObjectVector<ProtoJet>;
00138 ObjectVector< ::Jet >* jets = new ObjectVector< ::Jet >;
00139 typename std::vector<T1*>::const_iterator itr = vec.begin();
00140 HepLorentzVector hepvec;
00141 ::Jet* jet;
00142 for (; itr != vec.end(); ++itr) {
00143 hepvec = (*itr)->momentum();
00144 if(smear){
00145 hepvec = m_smearer->smear(hepvec);
00146 }
00147 proJ = new T2(hepvec);
00148 pjs->push_back(proJ);
00149 jet = new ::Jet();
00150 jet->add(*proJ,1.);
00151 jets->push_back(jet);
00152 }
00153 log << MSG::DEBUG << "Size of vector"<<pjs->size() << endreq;
00154
00155 TesIoStat stat = m_tesIO -> store(pjs, PJoutputLocation);
00156 std::string message;
00157 message = stat ? "AtlfastProtoJet stored by key":
00158 "Failed to store AtlfastProtoJet by key";
00159 log<<MSG::DEBUG<<message<<endreq;
00160 if (!stat) {return StatusCode::FAILURE;}
00161
00162 stat = m_tesIO -> store(pjs, JoutputLocation);
00163 message = stat ? "JetRec Jet stored by key":
00164 "Failed to store JetRec Jet by key";
00165 log<<MSG::DEBUG<<message<<endreq;
00166 return (stat)? StatusCode::SUCCESS:StatusCode::FAILURE;
00167 }
00168
00169 template <class T1, class T2> inline
00170 StatusCode
00171 AtlfastProtoJetMaker::FillProtoJets(const std::vector<T1*>& vec, T2* proJ){
00172 MsgStream log( messageService(), name() ) ;
00173 ObjectVector<ProtoJet>* pjs = new ObjectVector<ProtoJet>;
00174 typename std::vector<T1*>::const_iterator itr = vec.begin();
00175 for (; itr != vec.end(); ++itr) {
00176 proJ = new T2((*itr)->momentum());
00177 pjs->push_back(proJ);
00178 }
00179 log << MSG::DEBUG << "Size of vector"<<pjs->size() << endreq;
00180
00181 TesIoStat stat = m_tesIO -> store(pjs);
00182 message = stat ? "AtlfastProtoJet stored by type":
00183 "Failed to store AtlfastProtoJet type";
00184 log<<MSG::DEBUG<<message<<endreq;
00185 return (stat)? StatusCode::SUCCESS:StatusCode::FAILURE;
00186 }
00187
00188 }
00189 #endif
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208