13 #include "fastjet/ClusterSequence.hh"
14 #include "fastjet/PseudoJet.hh"
16 #include "JetStabilityDefs.h"
17 #include "JetStability.h"
18 #include "DiffusionDistFastJet.h"
19 #include "SimpleSmear.h"
20 #include "SimpleEvent.hh"
21 #include "SimulatedEvent.hh"
22 #include "QCDandCmsLikeSmear.h"
24 #include "PythiaJetGun.hh"
26 #include "geners/BinaryFileArchive.hh"
27 #include "geners/Reference.hh"
33 bool oddSort (
const std::pair<unsigned,double> & a,
const std::pair<unsigned,double> &b ) {
34 return a.second > b.second;
38 void printUsage(
int argc,
char **argv ) {
40 std::cout << argv[0] <<
" -a archive [-A nEvents] [-C nCycles] [-o outputFile] [-q fuzzyFile] [-m scanMin] [-M scanMax] [-n nScan] [-f fixedVar] [-E (set exclusive)] [-d distCut] [-N nJets] [-r R]" << std::endl;
44 int main (
int argc,
char **argv ) {
48 char *archiveName = 0;
52 bool exclusive =
false;
66 double qcdCutOff = 0.705796;
67 bool doFlatPhaseSpace =
true;
71 while (( c = getopt(argc,argv,
"a:A:o:r:C:N:m:M:n:f:Ed:q:")) != -1 )
77 nEvents = atoi(optarg);
89 nCycles = atoi(optarg);
92 scanMin = atof(optarg);
95 scanMax = atof(optarg);
101 fixed = atof(optarg);
107 distCut = atof(optarg);
113 printUsage(argc,argv);
122 out.open(outFile,std::ios_base::out);
127 fout.open(fuzzyFile,std::ios_base::out);
130 std::cout <<
"Opening archive.......";
132 BinaryFileArchive ar(archiveName,
"r");
135 std::cerr << ar.error() << std::endl;
138 std::cout <<
"done" << std::endl;
141 std::cout <<
"Finding events.......";
142 Reference<SimulatedEvent> ref(ar, Regex(
".*"),
"dijet");
143 if ( !nEvents ) nEvents = ref.size();
144 std::cout <<
"done found: " << ref.size() <<
" events" << std::endl;
149 jstab.setScan(scanN,scanMin,scanMax);
150 jstab.setNCycles(nCycles);
159 for (
unsigned evNum=0; evNum != nEvents; evNum++ ) {
162 stab::StabilityEventInfo evInfo;
165 ref.restore(evNum, &ev);
167 const unsigned nSimulatedJets = evs.size();
168 for (
unsigned j=0; j != nSimulatedJets; j++ ) {
169 const std::vector<PythiaJetGun::Particle> & constituents = evs[j].jetParticles;
170 const unsigned nConstituents = constituents.size();
171 for (
unsigned c=0; c != nConstituents; c++ ) {
173 const rk::P4 & p4 = part.p4();
174 const geom3::Vector3 & mom = p4.momentum();
175 stab::PseudoJet pj(mom.x(),mom.y(),mom.z(),p4.e());
179 event.push_back( pj );
183 jstab.reset(event,evInfo);
188 const std::vector<std::vector<double> > & stability = jstab.pairwiseRandStability();
189 const std::vector<std::vector<double> > & fuzziness = jstab.fuzzinessNJet();
191 const double sMax = jstab.scanMax();
192 const double sMin = jstab.scanMin();
193 const unsigned sN = jstab.nScan();
194 const double dScan = (sMax-sMin)/sN;
196 const unsigned nStab = stability.size();
197 assert( nStab == sN );
198 assert( stability.size() == fuzziness.size() );
199 for (
unsigned s=0; s != nStab; s++ ) {
200 const double dCut = sMin + dScan*s;
201 const std::vector<double> & stabPoints = stability[s];
202 const std::vector<double> & fuzzPoints = fuzziness[s];
203 const unsigned nPoints = stabPoints.size();
204 long double avg = 0.L;
205 long double favg = 0.L;
206 for (
unsigned p=0; p != nPoints; p++ ) {
207 avg += stabPoints[p];
208 favg += fuzzPoints[p];
212 out << dCut <<
" " << avg << std::endl;
213 fout << dCut <<
" " << favg << std::endl;