using namespace std;
#include "TRandom.h"
#include <time.h>
#include <iostream>
#include <iomanip>
#include <math.h>
#include "TMath.h"
#include "phyanadef.h"
#include "hdileptonfiller.h"
#include "hparticle.h"
#include "hphysicsconstants.h"
#include "hphysicsevent.h"
#include "hdilepton.h"
#include "hades.h"
#include "hevent.h"
#include "hpartialevent.h"
#include "hcategory.h"
#include "hlinearcategory.h"
#include "hrecevent.h"
#include "hlocation.h"
HDileptonFiller::HDileptonFiller(void) {
fPartCat=0;
fDileptCat=0;
phyEvent=0;
kSkip = kFALSE;
}
HDileptonFiller::HDileptonFiller(const Text_t *name,const Text_t *title,Bool_t skip) :
HReconstructor(name,title) {
fPartCat=0;
fDileptCat=0;
phyEvent=0;
kSkip = skip;
}
Bool_t HDileptonFiller::init(void) {
fPartCat=gHades->getCurrentEvent()->getCategory(catParticle);
if (!fPartCat) {
Error("init","catParticle doesn't exist in input");
return kFALSE;
}
phyEvent = new HPhysicsEvent(fPartCat);
fDileptCat=gHades->getCurrentEvent()->getCategory(catDilepton);
if (!fDileptCat) {
fDileptCat = new HLinearCategory("HDilepton",1000);
if (fDileptCat) gHades->getCurrentEvent()->addCategory(catDilepton,
fDileptCat,"PhyAna");
else {
Error("init","Unable to setup output");
return kFALSE;
}
}
return kTRUE;
}
Int_t HDileptonFiller::execute(void) {
HParticle *part1, *part2;
TObjArray *electrons = 0, *positrons = 0;
Int_t i,k,nElec,nPosi,iElec,iPosi;
Int_t nDileptons = 0;
nElec = nPosi = 0;
electrons = phyEvent->getParticles("e-");
positrons = phyEvent->getParticles("e+");
nElec = electrons->GetEntriesFast();
nPosi = positrons->GetEntriesFast();
if (nElec+nPosi<1) return 0;
for(iElec = 0;iElec<nElec; iElec++) {
for(iPosi = 0;iPosi<nPosi; iPosi++) {
part1 = (HParticle*) electrons->At(iElec);
part2 = (HParticle*) positrons->At(iPosi);
makeDilepton(part1,part2);
nDileptons++;
}
}
for(i=0; i<nElec; i++) {
for(k = i+1; k<nElec; k++) {
part1 = (HParticle*) electrons->At(i);
part2 = (HParticle*) electrons->At(k);
makeDilepton(part1,part2);
nDileptons++;
}
}
for(i=0; i<nPosi; i++) {
for(k = i+1; k<nPosi; k++) {
part1 = (HParticle*) positrons->At(i);
part2 = (HParticle*) positrons->At(k);
makeDilepton(part1,part2);
nDileptons++;
}
}
if(nDileptons == 0 && kSkip == kTRUE) return kSkipEvent;
return 0;
}
void HDileptonFiller::makeDilepton(HParticle *part1, HParticle *part2) {
HDilepton *dilept = 0;
HLocation loc;
Double_t invMass,angle;
dilept = (HDilepton*) fDileptCat->getNewSlot(loc);
dilept = new(dilept) HDilepton;
dilept->setPart1(part1);
dilept->setPart2(part2);
dilept->setPart1Id(part1->getIndex());
dilept->setPart2Id(part2->getIndex());
dilept->setCharge( part1->getCharge() + part2->getCharge() );
angle = part1->Angle(part2);
invMass = 2.*sin(angle/2.)*sqrt( part1->P()*part2->P() );
dilept->setInvMass(invMass);
}
ClassImp(HDileptonFiller)
Last change: Sat May 22 12:54:47 2010
Last generated: 2010-05-22 12:54
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.