00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef ATLFAST_STANDARDHISTOGRAMMAKER_H
00024 #define ATLFAST_STANDARDHISTOGRAMMAKER_H
00025
00026
00027 #include <vector>
00028 #include <string>
00029
00030
00031 #include "GaudiKernel/ISvcLocator.h"
00032 #include "GaudiKernel/Algorithm.h"
00033 #include "GaudiKernel/MsgStream.h"
00034 #include "GaudiKernel/DataObject.h"
00035
00036 #include "AIDA/IHistogram1D.h"
00037
00038
00039 #include "CLHEP/Vector/LorentzVector.h"
00040 #include "HepMC/GenEvent.h"
00041 #include "HepMC/GenParticle.h"
00042
00043
00044
00045 #include "AtlfastEvent/IKinematic.h"
00046 #include "AtlfastUtils/TesIO.h"
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060 namespace Atlfast {
00061 using std::string;
00065 class StandardHistogramMaker : public Algorithm
00066 {
00067
00068 public:
00069
00070
00071
00072
00073
00074
00075
00076
00077 StandardHistogramMaker( const std::string& name, ISvcLocator* pSvcLocator ) ;
00078 ~StandardHistogramMaker();
00079
00080
00081
00082
00083
00084
00085 StatusCode initialize() ;
00086 StatusCode execute() ;
00087 StatusCode finalize() ;
00088
00089
00090
00091 private:
00092
00093
00094
00095
00096
00097
00098 void bookNonIsolatedElectronHistograms();
00099 void bookNonIsolatedPhotonHistograms();
00100 void bookNonIsolatedMuonHistograms();
00101 void bookIsolatedElectronHistograms();
00102 void bookIsolatedPhotonHistograms();
00103 void bookIsolatedMuonHistograms();
00104 void bookCellHistograms();
00105 void bookClusterHistograms();
00106 void bookJetHistograms();
00107 void bookEventHeaderHistograms();
00108
00109 template<class Collection>
00110 void kinHistogramFiller(const std::string&,
00111 IHistogram1D*,
00112 IHistogram1D*,
00113 IHistogram1D*,
00114 IHistogram1D*,
00115 IHistogram1D*,
00116 IHistogram1D*
00117 ) ;
00118
00119 TesIO* m_tesIO;
00120
00121 std::string m_mcLocation;
00122
00123
00124
00125
00126
00127
00128 std::string m_electronLocation ;
00129 std::string m_isolatedElectronLocation;
00130 std::string m_photonLocation ;
00131 std::string m_isolatedPhotonLocation;
00132 std::string m_muonLocation ;
00133 std::string m_isolatedMuonLocation;
00134 std::string m_cellLocation;
00135 std::string m_clusterLocation;
00136 std::string m_jetLocation;
00137 std::string m_eventHeaderLocation;
00138 std::string m_mcTruthLocation;
00139
00140
00141
00142
00143
00144
00145
00146 IHistogram1D* m_h_electronMultiplicity;
00147 IHistogram1D* m_h_electronPx;
00148 IHistogram1D* m_h_electronPy;
00149 IHistogram1D* m_h_electronPz;
00150 IHistogram1D* m_h_electronE;
00151 IHistogram1D* m_h_electronPt;
00152
00153
00154 IHistogram1D* m_h_isolatedElectronMultiplicity;
00155 IHistogram1D* m_h_isolatedElectronPx;
00156 IHistogram1D* m_h_isolatedElectronPy;
00157 IHistogram1D* m_h_isolatedElectronPz;
00158 IHistogram1D* m_h_isolatedElectronE;
00159 IHistogram1D* m_h_isolatedElectronPt;
00160
00161
00162 IHistogram1D* m_h_photonMultiplicity;
00163 IHistogram1D* m_h_photonPx;
00164 IHistogram1D* m_h_photonPy;
00165 IHistogram1D* m_h_photonPz;
00166 IHistogram1D* m_h_photonE;
00167 IHistogram1D* m_h_photonPt;
00168
00169
00170 IHistogram1D* m_h_isolatedPhotonMultiplicity;
00171 IHistogram1D* m_h_isolatedPhotonPx;
00172 IHistogram1D* m_h_isolatedPhotonPy;
00173 IHistogram1D* m_h_isolatedPhotonPz;
00174 IHistogram1D* m_h_isolatedPhotonE;
00175 IHistogram1D* m_h_isolatedPhotonPt;
00176
00177
00178 IHistogram1D* m_h_muonMultiplicity;
00179 IHistogram1D* m_h_muonPx;
00180 IHistogram1D* m_h_muonPy;
00181 IHistogram1D* m_h_muonPz;
00182 IHistogram1D* m_h_muonE;
00183 IHistogram1D* m_h_muonPt;
00184
00185
00186 IHistogram1D* m_h_isolatedMuonMultiplicity;
00187 IHistogram1D* m_h_isolatedMuonPx;
00188 IHistogram1D* m_h_isolatedMuonPy;
00189 IHistogram1D* m_h_isolatedMuonPz;
00190 IHistogram1D* m_h_isolatedMuonE;
00191 IHistogram1D* m_h_isolatedMuonPt;
00192
00193
00194 IHistogram1D* m_h_cellMultiplicity;
00195 IHistogram1D* m_h_cellPx;
00196 IHistogram1D* m_h_cellPy;
00197 IHistogram1D* m_h_cellPz;
00198 IHistogram1D* m_h_cellE;
00199 IHistogram1D* m_h_cellPt;
00200
00201
00202
00203 IHistogram1D* m_h_clusterMultiplicity;
00204 IHistogram1D* m_h_clusterPx;
00205 IHistogram1D* m_h_clusterPy;
00206 IHistogram1D* m_h_clusterPz;
00207 IHistogram1D* m_h_clusterE;
00208 IHistogram1D* m_h_clusterPt;
00209
00210
00211 IHistogram1D* m_h_jetMultiplicity;
00212 IHistogram1D* m_h_jetPx;
00213 IHistogram1D* m_h_jetPy;
00214 IHistogram1D* m_h_jetPz;
00215 IHistogram1D* m_h_jetE;
00216 IHistogram1D* m_h_jetPt;
00217
00218
00219 IHistogram1D* m_h_njetb;
00220 IHistogram1D* m_h_njetc;
00221 IHistogram1D* m_h_njettau;
00222 IHistogram1D* m_h_pxmiss;
00223 IHistogram1D* m_h_pymiss;
00224 IHistogram1D* m_h_pxnue;
00225 IHistogram1D* m_h_pynue;
00226 IHistogram1D* m_h_mcWeight0;
00227 IHistogram1D* m_h_mcWeight1;
00228 IHistogram1D* m_h_mcWeight2;
00229
00230
00231
00232
00233 int m_histStart;
00234
00235 int m_nHist;
00236 };
00237
00238 class FillKHist{
00239 public:
00240 FillKHist(IHistogram1D* hpx,
00241 IHistogram1D* hpy,
00242 IHistogram1D* hpz,
00243 IHistogram1D* he,
00244 IHistogram1D* hpt
00245 ):
00246 m_hpx(hpx), m_hpy(hpy), m_hpz(hpz), m_he(he), m_hpt(hpt){
00247 }
00248
00249 template<class T>
00250 void operator()(T* tt){
00251
00252
00253 IKinematic* t = tt;
00254 m_hpx->fill(float( t->px()), 1.0);
00255 m_hpy->fill(float( t->py()), 1.0);
00256 m_hpz->fill(float( t->pz()), 1.0);
00257 m_he ->fill(float( t->e()), 1.0);
00258 m_hpt->fill(float( t->pT()), 1.0);
00259 }
00260 private:
00261 IHistogram1D* m_hpx;
00262 IHistogram1D* m_hpy;
00263 IHistogram1D* m_hpz;
00264 IHistogram1D* m_he;
00265 IHistogram1D* m_hpt;
00266 };
00267
00268 template<class Collection>
00269 inline
00270 void StandardHistogramMaker::kinHistogramFiller(
00271 const std::string& location,
00272 IHistogram1D* hmul,
00273 IHistogram1D* hpx,
00274 IHistogram1D* hpy,
00275 IHistogram1D* hpz,
00276 IHistogram1D* he,
00277 IHistogram1D* hpt
00278
00279 ) {
00280
00281 MsgStream log( messageService(), name() ) ;
00282 log << MSG::DEBUG << "Getting Particles from "<<location << endreq;
00283
00284 const Collection* rps;
00285
00286 if(!m_tesIO->getDH(rps, location)){
00287 log << MSG::DEBUG << "no rps found in the TES at "<<location << endreq;
00288
00289
00290
00291 hmul->fill(0.0,1.0);
00292 } else {
00293
00294 hmul->fill(float(rps->size()),1.0);
00295 std::for_each(rps->begin(), rps->end(), FillKHist(hpx, hpy, hpz, he, hpt));
00296 }
00297 return;
00298 }
00299
00300
00301 }
00302
00303 #endif
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314