00001
00002
00003 #include "StjRunJetFinder.h"
00004
00005 #include <StJetFinder/StJetFinder.h>
00006 #include <StJetFinder/StJetPars.h>
00007
00008 #include <StjFourVecForJetFinder.h>
00009
00010 #include <StjEtaToDetectorEta.h>
00011
00012 #include <TLorentzVector.h>
00013
00014 #include <iostream>
00015
00016 ClassImp(StjRunJetFinder)
00017
00018 using namespace std;
00019
00020 void StjRunJetFinder::Init(StJetPars* pars)
00021 {
00022 _jetFinder = pars->constructJetFinder();
00023 _jetFinder->Init();
00024 }
00025
00026 StjJetList StjRunJetFinder::operator()(const StjFourVecList& fourVecList)
00027 {
00028 typedef std::list<StProtoJet> ProtoJetList;
00029 typedef std::vector<const AbstractFourVec*> FourList;
00030
00031 FourList fourList;
00032
00033 for(StjFourVecList::const_iterator p4 = fourVecList.begin(); p4 != fourVecList.end(); ++p4) {
00034 fourList.push_back(new StjFourVecForJetFinder(*p4));
00035 }
00036
00037 ProtoJetList protoJetList;
00038
00039 _jetFinder->findJets(protoJetList, fourList);
00040
00041 StjJetList jetList;
00042
00043 int jetId(1);
00044 for(list<StProtoJet>::iterator it = protoJetList.begin(); it != protoJetList.end(); ++it) {
00045 StProtoJet& protoJet = *it;
00046
00047 StjJet jet;
00048 jet.jetId = jetId++;
00049 jet.pt = protoJet.pt();
00050 jet.eta = protoJet.eta();
00051 jet.phi = protoJet.phi();
00052 jet.m = protoJet.mass();
00053
00054 FourList parList = protoJet.list();
00055 for(FourList::const_iterator it = parList.begin(); it != parList.end(); ++it) {
00056 StjFourVec fourVec = (dynamic_cast<const StjFourVecForJetFinder*>(*it))->fourVec();
00057 jet.runNumber = fourVec.runNumber;
00058 jet.eventId = fourVec.eventId;
00059 jet.vertexZ = fourVec.vertexZ;
00060 jet.fourVecList.push_back(fourVec);
00061 }
00062 jet.neuRt = computeNeuRt(jet.fourVecList);
00063 StjEtaToDetectorEta eta2deta;
00064 jet.detectorEta = eta2deta(jet.eta, jet.vertexZ);
00065 jetList.push_back(jet);
00066 }
00067
00068 for(FourList::iterator it = fourList.begin(); it != fourList.end(); ++it) {
00069 delete *it;
00070 }
00071
00072 return jetList;
00073 }
00074
00075 double StjRunJetFinder::computeNeuRt(const StjFourVecList& fourList)
00076 {
00077 double totalEt = 0.0;
00078 double neutralEt = 0.0;
00079 for(StjFourVecList::const_iterator it = fourList.begin(); it != fourList.end(); ++it) {
00080 TLorentzVector p4;
00081 p4.SetPtEtaPhiM((*it).pt, (*it).eta, (*it).phi, (*it).m);
00082 totalEt += p4.Et();
00083 if((*it).type == 2) neutralEt += p4.Et();
00084 }
00085 return (totalEt) ? neutralEt/totalEt: 0.0;
00086 }
00087