Page MenuHomeHEPForge

No OneTemporary

diff --git a/DIPSY/PTAnalysis.cc b/DIPSY/PTAnalysis.cc
new file mode 100644
--- /dev/null
+++ b/DIPSY/PTAnalysis.cc
@@ -0,0 +1,165 @@
+// -*- C++ -*-
+//
+// This is the implementation of the non-inlined, non-templated member
+// functions of the PTAnalysis class.
+//
+
+#include "PTAnalysis.h"
+#include "ThePEG/Interface/ClassDocumentation.h"
+#include "ThePEG/PDT/EnumParticles.h"
+#include "ThePEG/Repository/EventGenerator.h"
+#include "DipoleEventHandler.h"
+#include "EventFiller.h"
+#include "DiffractiveEventFiller.h"
+#include "ThePEG/Utilities/Current.h"
+
+#include "ThePEG/Persistency/PersistentOStream.h"
+#include "ThePEG/Persistency/PersistentIStream.h"
+
+#ifndef LWH_AIAnalysisFactory_H
+#ifndef LWH
+#define LWH ThePEGLWH
+#endif
+#include "ThePEG/Analysis/LWH/AnalysisFactory.h"
+#endif
+
+using namespace DIPSY;
+
+PTAnalysis::PTAnalysis() {}
+
+PTAnalysis::~PTAnalysis() {}
+
+void PTAnalysis::analyze(tEventPtr event, long ieve, int loop, int state) {
+ AnalysisHandler::analyze(event, ieve, loop, state);
+ if ( !event->primaryCollision() ) return;
+ const StepVector & steps = event->primaryCollision()->steps();
+ double maxpt = 0.0;
+ for ( int is = 0, Ns = max(steps.size(), 2); is < Ns ; ++is ) {
+ tH1DPtr h = is? hptG1: hptg1;
+ tParticleVector
+ gluons(steps[is]->particles().begin(), steps[is]->particles().end());
+ for ( int i = 0, N = gluons.size(); i < N; ++i )
+ if ( abs(gluons[i]->eta()) < 1.0 ) {
+ double pt = gluons[i]->momentum().perp()/GeV;
+ h->fill(pt, event->weight());
+ if ( pt > maxpt ) maxpt = pt;
+ }
+ }
+ hptm1->fill(maxpt, event->weight());
+}
+
+LorentzRotation PTAnalysis::transform(tEventPtr event) const {
+ return LorentzRotation();
+ // Return the Rotation to the frame in which you want to perform the analysis.
+}
+
+void PTAnalysis::analyze(const tPVector & particles, double weight) {
+ AnalysisHandler::analyze(particles, weight);
+ // Calls analyze() for each particle.
+ sumw += weight;
+}
+
+void PTAnalysis::analyze(tPPtr p, double weight) {
+ if ( !p->data().iCharge() ) return;
+ double eta = p->eta();
+ double pt = p->momentum().perp()/GeV;
+ if ( pt > 5.0 ) heta5->fill(eta, weight);
+ if ( eta < -7.0 )
+ return;
+ else if ( eta < -5.0 )
+ hpt75->fill(pt, weight);
+ else if ( eta < -3.0 )
+ hpt53->fill(pt, weight);
+ else if ( eta < -1.0 )
+ hpt31->fill(pt, weight);
+ else if ( eta < 1.0 )
+ hpt11->fill(pt, weight);
+ else if ( eta < 3.0 )
+ hpt13->fill(pt, weight);
+ else if ( eta < 5.0 )
+ hpt35->fill(pt, weight);
+ else if ( eta < 7.0 )
+ hpt57->fill(pt, weight);
+ // sumw += weight;
+}
+
+IBPtr PTAnalysis::clone() const {
+ return new_ptr(*this);
+}
+
+IBPtr PTAnalysis::fullclone() const {
+ return new_ptr(*this);
+}
+
+
+void PTAnalysis::doinitrun() {
+ AnalysisHandler::doinitrun();
+ histogramFactory().initrun();
+ histogramFactory().registerClient(this);
+ hpt75 = histogramFactory().createHistogram1D
+ ("pt75",40,0.0,20.0);
+ hpt53 = histogramFactory().createHistogram1D
+ ("pt53",40,0.0,20.0);
+ hpt31 = histogramFactory().createHistogram1D
+ ("pt31",40,0.0,20.0);
+ hpt11 = histogramFactory().createHistogram1D
+ ("pt11",100,0.0,100.0);
+ hptm1 = histogramFactory().createHistogram1D
+ ("ptm1",100,0.0,100.0);
+ hptg1 = histogramFactory().createHistogram1D
+ ("ptg1",100,0.0,100.0);
+ hptG1 = histogramFactory().createHistogram1D
+ ("ptG1",100,0.0,100.0);
+ hpt13 = histogramFactory().createHistogram1D
+ ("pt13",40,0.0,20.0);
+ hpt35 = histogramFactory().createHistogram1D
+ ("pt35",40,0.0,20.0);
+ hpt57 = histogramFactory().createHistogram1D
+ ("pt57",40,0.0,20.0);
+ heta5 = histogramFactory().createHistogram1D
+ ("eta5",40,-10.0,10.0);
+ sumw = 0.0;
+}
+
+
+void PTAnalysis::dofinish() {
+ AnalysisHandler::dofinish();
+ if ( sumw <= 0.0 ) return;
+ double sc = 2.0/sumw;
+ hpt75->scale(sc);
+ hpt53->scale(sc);
+ hpt31->scale(sc);
+ hpt11->scale(sc/2.0);
+ hptm1->scale(sc/2.0);
+ hptg1->scale(sc/2.0);
+ hptG1->scale(sc/2.0);
+ hpt13->scale(sc);
+ hpt35->scale(sc);
+ hpt57->scale(sc);
+ heta5->scale(sc);
+
+
+
+}
+
+void PTAnalysis::persistentOutput(PersistentOStream & os) const {
+ // *** ATTENTION *** os << ; // Add all member variable which should be written persistently here.
+}
+
+void PTAnalysis::persistentInput(PersistentIStream & is, int) {
+ // *** ATTENTION *** is >> ; // Add all member variable which should be read persistently here.
+}
+
+
+// Static variable needed for the type description system in ThePEG.
+#include "ThePEG/Utilities/DescribeClass.h"
+DescribeClass<PTAnalysis,AnalysisHandler>
+ describeDIPSYPTAnalysis("DIPSY::PTAnalysis", "PTAnalysis.so");
+
+void PTAnalysis::Init() {
+
+ static ClassDocumentation<PTAnalysis> documentation
+ ("There is no documentation for the PTAnalysis class");
+
+}
+
diff --git a/DIPSY/PTAnalysis.h b/DIPSY/PTAnalysis.h
new file mode 100644
--- /dev/null
+++ b/DIPSY/PTAnalysis.h
@@ -0,0 +1,189 @@
+// -*- C++ -*-
+#ifndef DIPSY_PTAnalysis_H
+#define DIPSY_PTAnalysis_H
+//
+// This is the declaration of the PTAnalysis class.
+//
+
+#include "ThePEG/Handlers/AnalysisHandler.h"
+#include <iostream>
+#include <fstream>
+
+namespace DIPSY {
+
+using namespace ThePEG;
+
+/**
+ * Here is the documentation of the PTAnalysis class.
+ *
+ * @see \ref PTAnalysisInterfaces "The interfaces"
+ * defined for PTAnalysis.
+ */
+class PTAnalysis: public AnalysisHandler {
+
+public:
+
+ /** @name Standard constructors and destructors. */
+ //@{
+ /**
+ * The default constructor.
+ */
+ PTAnalysis();
+
+ /**
+ * The destructor.
+ */
+ virtual ~PTAnalysis();
+ //@}
+
+public:
+
+ /** @name Virtual functions required by the AnalysisHandler class. */
+ //@{
+ /**
+ * Analyze a given Event. Note that a fully generated event
+ * may be presented several times, if it has been manipulated in
+ * between. The default version of this function will call transform
+ * to make a lorentz transformation of the whole event, then extract
+ * all final state particles and call analyze(tPVector) of this
+ * analysis object and those of all associated analysis objects. The
+ * default version will not, however, do anything on events which
+ * have not been fully generated, or have been manipulated in any
+ * way.
+ * @param event pointer to the Event to be analyzed.
+ * @param ieve the event number.
+ * @param loop the number of times this event has been presented.
+ * If negative the event is now fully generated.
+ * @param state a number different from zero if the event has been
+ * manipulated in some way since it was last presented.
+ */
+ virtual void analyze(tEventPtr event, long ieve, int loop, int state);
+
+ /**
+ * Transform the event to the desired Lorentz frame and return the
+ * corresponding LorentzRotation.
+ * @param event a pointer to the Event to be transformed.
+ * @return the LorentzRotation used in the transformation.
+ */
+ virtual LorentzRotation transform(tEventPtr event) const;
+
+ /**
+ * Analyze the given vector of particles. The default version calls
+ * analyze(tPPtr) for each of the particles.
+ * @param particles the vector of pointers to particles to be analyzed
+ */
+ virtual void analyze(const tPVector & particles, double weight);
+
+ /**
+ * Analyze the given particle.
+ * @param particle pointer to the particle to be analyzed.
+ */
+ virtual void analyze(tPPtr particle, double weight);
+ //@}
+
+public:
+
+ /** @name Functions used by the persistent I/O system. */
+ //@{
+ /**
+ * Function used to write out object persistently.
+ * @param os the persistent output stream written to.
+ */
+ void persistentOutput(PersistentOStream & os) const;
+
+ /**
+ * Function used to read in object persistently.
+ * @param is the persistent input stream read from.
+ * @param version the version number of the object when written.
+ */
+ void persistentInput(PersistentIStream & is, int version);
+ //@}
+
+ /**
+ * The standard Init function used to initialize the interfaces.
+ * Called exactly once for each class by the class description system
+ * before the main function starts or
+ * when this class is dynamically loaded.
+ */
+ static void Init();
+
+protected:
+
+ /** @name Clone Methods. */
+ //@{
+ /**
+ * Make a simple clone of this object.
+ * @return a pointer to the new object.
+ */
+ virtual IBPtr clone() const;
+
+ /** Make a clone of this object, possibly modifying the cloned object
+ * to make it sane.
+ * @return a pointer to the new object.
+ */
+ virtual IBPtr fullclone() const;
+ //@}
+
+
+
+protected:
+
+ /** @name Standard Interfaced functions. */
+ //@{
+ /**
+ * Initialize this object. Called in the run phase just before
+ * a run begins.
+ */
+ virtual void doinitrun();
+
+ /**
+ * Finalize this object. Called in the run phase just after a
+ * run has ended. Used eg. to write out statistics.
+ */
+ virtual void dofinish();
+ //@}
+
+private:
+
+ /** The pt-distribution of charged particles -7 < y < -5. */
+ tH1DPtr hpt75;
+
+ /** The pt-distribution of charged particles -5 < y < -3. */
+ tH1DPtr hpt53;
+
+ /** The pt-distribution of charged particles -3 < y < -1. */
+ tH1DPtr hpt31;
+
+ /** The pt-distribution of charged particles -1 < y < 1. */
+ tH1DPtr hpt11, hptm1, hptg1, hptG1;
+
+ /** The pt-distribution of charged particles 1 < y < 3. */
+ tH1DPtr hpt13;
+
+ /** The pt-distribution of charged particles 3 < y < 5. */
+ tH1DPtr hpt35;
+
+ /** The pt-distribution of charged particles 5 < y < 07. */
+ tH1DPtr hpt57;
+
+ /** The eta-distribution of charged particles pt > 5 GeV. */
+ tH1DPtr heta5;
+
+ /**
+ * The sum of weights.
+ */
+ double sumw;
+
+private:
+
+ /**
+ * The assignment operator is private and must never be called.
+ * In fact, it should not even be implemented.
+ */
+ PTAnalysis & operator=(const PTAnalysis &);
+
+};
+
+}
+
+#endif /* DIPSY_PTAnalysis_H */

File Metadata

Mime Type
text/x-diff
Expires
Thu, Apr 3, 8:06 PM (22 h, 8 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4721040
Default Alt Text
(9 KB)

Event Timeline