1 #include "FastJetFilter.h"
3 #include "StarGenerator/EVENT/StarGenEvent.h"
4 #include "StarGenerator/EVENT/StarGenParticle.h"
9 MyParticleId(
const int & pdg_id_in,
const int & part_id_in) : _pdg_id(pdg_id_in), _part_id(part_id_in){}
25 Double_t Mass(Double_t m1, Double_t m2, Double_t E1, Double_t E2, Double_t px1, Double_t px2, Double_t py1, Double_t py2, Double_t pz1, Double_t pz2) {
27 m = TMath::Sqrt(pow(m1,2) + pow(m2,2) + 2*(E1*E2 - px1*px2 - py1*py2 - pz1*pz2));
32 Double_t standardPhi(Double_t phi){
33 Double_t phi_standard = phi;
34 if (phi_standard < 0) phi_standard+=2*(TMath::Pi());
35 if (phi_standard < 0) cout <<
"Something wrong with angle!" << endl;
40 int countlines(
const char* VertexFileName =
"./VERTEXFULL/st_physics_15094070_raw_0000007.txt"){
41 int numberoflines = 0;
43 std::ifstream file(VertexFileName, ios::in);
45 while (std::getline(file, line))
52 FastJetFilter::FastJetFilter(
const char* name ) :
StarFilterMaker(name)
55 SetAttr(
"algorithm",
"antikt");
56 SetAttr(
"radius", 0.4 );
62 mTriggers.push_back(
Trigger_t(
id, mnpt, mxpt, mneta, mxeta, idm ) );
65 int FastJetFilter::Init() {
67 TString algo = SAttr(
"algorithm"); algo.ToLower();
69 if ( algo ==
"kt" ) algorithm = fastjet::kt_algorithm;
70 else if ( algo ==
"cambridge" ) algorithm = fastjet::cambridge_algorithm;
71 else algorithm = fastjet::antikt_algorithm;
73 double R = DAttr(
"radius"); assert(R>0);
75 jetdefinition =
new fastjet::JetDefinition(algorithm, R, recombScheme, strategy);
85 std::vector <fastjet::PseudoJet> fjInputs;
100 TLorentzVector momentum = part->
momentum();
101 double pT = momentum.Perp();
102 double eta = momentum.Eta();
105 if ( TMath::Abs(part->
GetId()) != 421 )
continue;
106 if ( pT < 0.200 || TMath::Abs(eta) > 1 )
continue;
116 if (
false == go )
return StarGenEvent::kReject;
127 if ( TMath::Abs(part->
GetId()) < 10 )
continue;
131 TLorentzVector momentum = part->
momentum();
132 double pT = momentum.Perp();
133 if ( pT < 0.05 )
continue;
134 double eta = momentum.Eta();
135 if ( pT < 0.20 || TMath::Abs(eta) > 1 )
continue;
137 fastjet::PseudoJet pseudoJet(momentum[0], momentum[1], momentum[2], momentum[3]);
140 fjInputs.push_back(pseudoJet);
144 vector <fastjet::PseudoJet> inclusiveJets, sortedJets, selectedJets;
145 fastjet::ClusterSequence clustSeq(fjInputs, *jetdefinition);
148 inclusiveJets = clustSeq.inclusive_jets(3.);
149 sortedJets = sorted_by_pt(inclusiveJets);
151 LOG_INFO <<
"Inclusive jets size = " << inclusiveJets.size() << endm;
152 LOG_INFO <<
"Sorted jets size = " << sortedJets.size() << endm;
154 fastjet::Selector eta_selector = fastjet::SelectorEtaRange(-0.6, 0.6);
155 fastjet::Selector selector = eta_selector;
156 selectedJets = eta_selector(sortedJets);
158 bool fInterestingEvent = kFALSE;
160 LOG_INFO <<
"Looking for D0 jet in " << selectedJets.size() <<
" candidates" << endm;
162 for(
unsigned jetid = 0; jetid < selectedJets.size(); jetid++){
165 vector <fastjet::PseudoJet> constituents = selectedJets[jetid].constituents();
166 vector <fastjet::PseudoJet> sortedconstituents = sorted_by_pt(constituents);
170 for (
unsigned j = 0; j < sortedconstituents.size(); j++){
171 if (sortedconstituents[j].user_info<MyParticleId>().pid() == 421){
178 fInterestingEvent = kTRUE;
181 if (fInterestingEvent) {
182 LOG_INFO <<
"D0 jet found return kAccept! " << endm;
183 return StarGenEvent::kAccept;
189 return StarGenEvent::kReject;
int Filter(StarGenEvent *event=0)
Int_t GetNumberOfParticles()
Obtain the number of particles in the event record.
Yet another particle class.
Int_t GetStatus()
Get the status code of the particle according to the HEPEVT standard.
Int_t GetId()
Get the id code of the particle according to the PDG standard.
Main filter class. Goes anywhere in the chain, filters StarGenEvent objects.
TLorentzVector momentum()
Return the 4-momentum of the particle.
Base class for event records.
void AddTrigger(int _pdgid, double _ptmn=0, double _ptmx=-1, double _etamn=-1, double _etamx=1, int _pdgidParent=0)