Fork me on GitHub

Changes between Version 6 and Version 7 of WorkBook/ModuleSystem


Ignore:
Timestamp:
Nov 13, 2012, 5:39:21 PM (12 years ago)
Author:
Pavel Demin
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • WorkBook/ModuleSystem

    v6 v7  
    1717#define ExampleModule_h
    1818
    19 #include "ExRootAnalysis/ExRootModule.h"
     19#include "classes/DelphesModule.h"
    2020
    2121#include <deque>
    2222
    2323class TObjArray;
    24 class TFormula;
     24class DelphesFormula;
    2525
    26 class ExampleModule: public ExRootModule
     26class ExampleModule: public DelphesModule
    2727{
    2828public:
     
    4242  std::deque <Double_t> fArrayParam;
    4343 
    44   TFormula *fFormula; //!
     44  DelphesFormula *fFormula; //!
    4545
    4646  TIterator *fItInputArray; //!
     
    6262#include "modules/ExampleModule.h"
    6363
     64#include "classes/DelphesClasses.h"
     65#include "classes/DelphesFactory.h"
     66#include "classes/DelphesFormula.h"
     67
    6468#include "ExRootAnalysis/ExRootResult.h"
    65 #include "ExRootAnalysis/ExRootClasses.h"
    66 
    6769#include "ExRootAnalysis/ExRootFilter.h"
    6870#include "ExRootAnalysis/ExRootClassifier.h"
    6971
    70 #include "ExRootAnalysis/ExRootFactory.h"
    71 #include "ExRootAnalysis/ExRootCandidate.h"
    72 
    7372#include "TMath.h"
    74 #include "TRandom.h"
    7573#include "TString.h"
    7674#include "TFormula.h"
     75#include "TRandom3.h"
     76#include "TObjArray.h"
     77#include "TDatabasePDG.h"
    7778#include "TLorentzVector.h"
    78 #include "TDatabasePDG.h"
    79 #include "TClonesArray.h"
    8079
     80#include <algorithm>
     81#include <stdexcept>
    8182#include <iostream>
    82 #include <stdexcept>
    8383#include <sstream>
    84 #include <deque>
    8584
    8685using namespace std;
     
    9190  fFormula(0), fItInputArray(0)
    9291{
    93   fFormula = new TFormula;
     92  fFormula = new DelphesFormula;
    9493}
    9594
     
    143142void ExampleModule::Process()
    144143{
    145   ExRootCandidate *candidate;
     144  Candidate *candidate;
    146145  TLorentzVector candidatePosition, candidateMomentum;
    147146
    148147  // loop over all input candidates
    149148  fItInputArray->Reset();
    150   while((candidate = static_cast<ExRootCandidate*>(fItInputArray->Next())))
     149  while((candidate = static_cast<Candidate*>(fItInputArray->Next())))
    151150  {
    152     candidatePosition = candidate->GetPosition();
    153     candidateMomentum = candidate->GetMomentum();
     151    candidatePosition = candidate->Position;
     152    candidateMomentum = candidate->Momentum;
    154153
    155154    // apply an efficency formula
    156     if(gRandom->Uniform() < fFormula->Eval(candidatePosition.Eta(), candidateMomentum.Pt()))
     155    if(gRandom->Uniform() <= fFormula->Eval(candidateMomentum.Pt(), candidatePosition.Eta()))
    157156    {
    158157      fOutputArray->Add(candidate);