1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
|
// -*- C++ -*-
//
// LWHFactory.cc is a part of ThePEG - Toolkit for HEP Event Generation
// Copyright (C) 1999-2011 Leif Lonnblad
//
// ThePEG is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
//
// This is the implementation of the non-inlined, non-templated member
// functions of the LWHFactory class.
//
#include "LWHFactory.h"
#include "ThePEG/Interface/ClassDocumentation.h"
#include "ThePEG/Persistency/PersistentOStream.h"
#include "ThePEG/Persistency/PersistentIStream.h"
#include "ThePEG/Repository/EventGenerator.h"
#ifndef LWH
#define LWH ThePEGLWH
#endif
#include "AnalysisFactory.h"
using namespace ThePEG;
void LWHFactory::doinitrun() {
analysisFactory(new LWH::AnalysisFactory);
FactoryBase::doinitrun();
}
void LWHFactory::normalizeToXSec(tH1DPtr histogram, CrossSection unit) const {
LWH::Histogram1D * h = dynamic_cast<LWH::Histogram1D *>(histogram);
if ( h )
h->normalize(h->sumAllBinHeights()*generator()->integratedXSec()/
(generator()->sumWeights()*unit));
}
void LWHFactory::normalizeToXSecFraction(tH1DPtr histogram) const {
LWH::Histogram1D * h = dynamic_cast<LWH::Histogram1D *>(histogram);
if ( h ) h->normalize(h->sumAllBinHeights()/generator()->sumWeights());
}
void LWHFactory::normalizeToUnity(tH1DPtr histogram) const {
LWH::Histogram1D * h = dynamic_cast<LWH::Histogram1D *>(histogram);
if ( h ) h->normalize(1.0);
}
void LWHFactory::normalizeToXSec(tH2DPtr histogram, CrossSection unit) const {
LWH::Histogram2D * h = dynamic_cast<LWH::Histogram2D *>(histogram);
if ( h )
h->normalize(h->sumAllBinHeights()*generator()->integratedXSec()/
(generator()->sumWeights()*unit));
}
void LWHFactory::normalizeToXSecFraction(tH2DPtr histogram) const {
LWH::Histogram2D * h = dynamic_cast<LWH::Histogram2D *>(histogram);
if ( h ) h->normalize(h->sumAllBinHeights()/generator()->sumWeights());
}
void LWHFactory::normalizeToUnity(tH2DPtr histogram) const {
LWH::Histogram2D * h = dynamic_cast<LWH::Histogram2D *>(histogram);
if ( h ) h->normalize(1.0);
}
void LWHFactory::persistentOutput(PersistentOStream &) const {}
void LWHFactory::persistentInput(PersistentIStream &, int) {}
ClassDescription<LWHFactory> LWHFactory::initLWHFactory;
// Definition of the static class description member.
void LWHFactory::Init() {
static ClassDocumentation<LWHFactory> documentation
("This class represents the Light-Weight Histogram package which "
"implements the most rudimentary histogramming facilities according "
"to the <a href=\"http://aida.freehep.org\">AIDA</a> interface "
"specifications. Currently the only thing that is supported is "
"simple, equally binned, one dimensional histograms. If you are "
"using AnalysisHandlers which accesses other features in the AIDA "
"interface you may end up with an ungraceful crash.");
}
|