herwig is hosted by Hepforge, IPPP Durham
Herwig++  2.7.0
Analysis2Base.h
00001 // -*- C++ -*-
00002 
00003 // (C) 2007-2009 Simon Plaetzer -- sp@particle.uni-karlsruhe.de
00004 
00005 #ifndef Analysis2_Analysis2Base_H
00006 #define Analysis2_Analysis2Base_H
00007 //
00008 // This is the declaration of the Analysis2Base class.
00009 //
00010 
00011 #include "ThePEG/Handlers/AnalysisHandler.h"
00012 #include "Analysis2Base.fh"
00013 
00014 #include "ThePEG/Repository/EventGenerator.h"
00015 #include "ThePEG/Handlers/EventHandler.h"
00016 
00017 #include "ThePEG/Utilities/StringUtils.h"
00018 
00019 #include "Analysis2/Histogram2/Histogram2.h"
00020 #include "Analysis2/Histogram2/Histogram2Output.h"
00021 #include "EventExtractor.h"
00022 #include "JetFinder.h"
00023 
00024 namespace Analysis2 {
00025 
00026 using namespace ThePEG;
00027 
00038 class Analysis2Base: public AnalysisHandler {
00039 
00040 public:
00041 
00047   inline Analysis2Base();
00048 
00052   virtual ~Analysis2Base();
00054 
00055 public:
00056 
00068   void insert (const string& name,
00069                const string& instring,
00070                Histogram2Options&);
00071 
00079   inline void insertObservable (const string& name,
00080                                 Histogram2Ptr,
00081                                 const Histogram2Options& =
00082                                 Histogram2Options());
00083 
00088   inline void insertObservable (const string& name,
00089                                 const string& dataName,
00090                                 const string& dataFile,
00091                                 const Histogram2Options& =
00092                                 Histogram2Options());
00093 
00098   inline tcHistogram2Ptr histogram (const string&) const;
00099 
00106   void book (double evt, const string& name, double weight);
00107 
00111   enum NormalisationMode {
00112     FromMap = -1,
00113     NoNormalisation = 0,
00114     NormaliseToUnity = 1,
00115     NormaliseToXSec = 2,
00116     NormaliseToData = 3
00117   };
00118 
00138   void finish (const string& name,
00139                int normMode = FromMap,
00140                bool combined = false);
00141 
00146   void combineObservable (const string& prefix,
00147                           const string& name,
00148                           unsigned int numRuns,
00149                           int normMode = FromMap);
00150 
00155   inline string startCombine (string);
00156 
00167   string combine (string);
00168 
00173   inline string finishCombine (string);
00174 
00178   inline tcHistogram2OutputPtr output () const;
00179 
00183   inline tcJetFinderPtr jetFinder () const;
00184 
00188   inline tcEventExtractorPtr eventExtractor () const { return _eventExtractor; }
00189 
00190 protected:
00191 
00196   inline tHistogram2Ptr histogram (const string&);
00197 
00201   inline tHistogram2OutputPtr output ();
00202 
00206   inline tcEventPtr lastEvent () const;
00207 
00212   inline unsigned int minMult () const;
00213 
00218   inline unsigned int maxMult () const;
00219 
00223   inline tJetFinderPtr jetFinder ();
00224 
00228   inline tEventExtractorPtr eventExtractor () { return _eventExtractor; }
00229 
00230 public:
00231 
00251   virtual void analyze(tEventPtr event, long ieve, int loop, int state);
00252 
00259   virtual LorentzRotation transform(tEventPtr event) const;
00260 
00266   virtual void analyze(const tPVector & particles);
00267 
00272   virtual void analyze(tPPtr particle);
00274 
00275 public:
00276 
00283   void persistentOutput(PersistentOStream & os) const;
00284 
00290   void persistentInput(PersistentIStream & is, int version);
00292 
00299   static void Init();
00300 
00301 
00302 // If needed, insert declarations of virtual function defined in the
00303 // InterfacedBase class here (using ThePEG-interfaced-decl in Emacs).
00304 
00305 public:
00306 
00311   inline void finalize ();
00312 
00313 protected:
00314 
00317 
00322   inline virtual void dofinish();
00323 
00333   inline virtual void rebind(const TranslationMap & trans)
00334     throw(RebindException);
00335 
00341   inline virtual IVector getReferences();
00342 
00344 
00345 private:
00346 
00350   Histogram2OutputPtr _output;
00351 
00355   map<string,Histogram2Ptr> _histograms;
00356 
00361   map<string,Histogram2Options> _outputOptions;
00362 
00366   map<string,string> _datachannels;
00367 
00371   map<string,int> _normalisation;
00372 
00377   bool _bookPerSubprocess;
00378 
00382   tcEventPtr _lastEvent;
00383 
00388   unsigned int _minMult;
00389 
00394   unsigned int _maxMult;
00395 
00399   bool _parallel;
00400 
00404   JetFinderPtr _jetFinder;
00405 
00409   EventExtractorPtr _eventExtractor;
00410 
00414   bool _backParallel;
00415 
00420   static AbstractClassDescription<Analysis2Base> initAnalysis2Base;
00421 
00426   Analysis2Base & operator=(const Analysis2Base &);
00427 
00428 };
00429 
00430 }
00431 
00432 #include "ThePEG/Utilities/ClassTraits.h"
00433 
00434 namespace ThePEG {
00435 
00440 template <>
00441 struct BaseClassTrait<Analysis2::Analysis2Base,1> {
00443   typedef AnalysisHandler NthBase;
00444 };
00445 
00448 template <>
00449 struct ClassTraits<Analysis2::Analysis2Base>
00450   : public ClassTraitsBase<Analysis2::Analysis2Base> {
00452   static string className() { return "Analysis2::Analysis2Base"; }
00460   static string library() { return "Analysis2.so"; }
00461 };
00462 
00465 }
00466 
00467 #include "Analysis2Base.icc"
00468 #ifndef ThePEG_TEMPLATES_IN_CC_FILE
00469 // #include "Analysis2Base.tcc"
00470 #endif
00471 
00472 #endif /* Analysis2_Analysis2Base_H */