using namespace std;
#include <stdlib.h>
#include <stdio.h>
#include <iostream>
#include "hevent.h"
#include "heventheader.h"
#include "hdetector.h"
#include "hratreeext.h"
#include "hcategory.h"
#include "hmatrixcategory.h"
#include "hlinearcategory.h"
#include "hlinearcatiter.h"
#include "hlocation.h"
#include "hiterator.h"
#include "hdebug.h"
#include "hades.h"
#include "hhypPPProjector.h"
#include "hhyplist.h"
#include "hhypchannel.h"
#include "hypinfodef.h"
ClassImp(HHypPPProjector)
HHypPPProjector::HHypPPProjector(Char_t *name_i, Option_t par[])
  :HHypBaseAlgorithm(name_i,par)
{
  simuflag = 0;
}
HHypPPProjector::~HHypPPProjector()
{
}
Bool_t HHypPPProjector::execute()
{
  if (!beam) {
    cerr << algoName << " needs beam particle! " << endl;
    return kFALSE;
  }
  
  HEventHeader *evHeader = gHades->getCurrentEvent()->getHeader();
  
	
	
	
	
	
  
  
  mylist->CombIteratorReset();
  while (mylist->CombIterator()) {
	Int_t fakes;
	fakes=mylist->getNrOfFakes();
    
    TLorentzVector proton1 = mylist->getTLorentzVector("p", 1);
    TLorentzVector proton2 = mylist->getTLorentzVector("p", 2);
    if (mylist->getIterStatus() == kTRUE) {
      
      TLorentzVector pp_miss = (*beam) - (proton1 + proton2);
      Double_t prob = mylist->getProbAlg();
      miss->Fill(pp_miss.M2(), fabs(proton1.Phi() - proton2.Phi()), prob);
      if (evHeader) {
			UInt_t downscalingFlag = evHeader->getDownscalingFlag();
			UInt_t triggerDecision = evHeader->getTriggerDecision();
			header->Fill(downscalingFlag,triggerDecision,fakes);
      }
    } else
      cerr << algoName << " got no TLorentzVector " << endl;
  }
  return kTRUE;
}
Bool_t HHypPPProjector::init()
{
	
  simCat = gHades->getCurrentEvent()->getCategory(catGeantKine);
  if (!simCat) {
    simuflag = 0;
  } else {
    simuflag = 1;
    
    CatTrackCandSim = NULL;          
    if ((CatTrackCandSim =
         gHades->getCurrentEvent()->getCategory(catPidTrackCand)) == NULL) {
      Error("init", "Cannot get catPidTrackCandSim cat");
      return kFALSE;
    }
  }
  
  TString input(channel->Get(initList));
  miss =
    new TNtuple(input + TString("_proj"), "PP Demo ntuple",
                "pp_miss:pp_dphi:fProbAlg");
  header = new TNtuple(input + TString("_hdr"), "Header info",
		     "downscalingFlag:triggerDecision:fakes");
	
	
	return kTRUE;
}
Bool_t HHypPPProjector::reinit()
{
  return kTRUE;
}
Bool_t HHypPPProjector::finalize()
{
  miss->Write();
  header->Write();
  return kTRUE;
}
Last change: Sat May 22 12:58:03 2010
Last generated: 2010-05-22 12:58
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.