00001
00002 #include "Rivet/Analysis.hh"
00003 #include "Rivet/RivetAIDA.hh"
00004 #include "Rivet/Tools/Logging.hh"
00005 #include "Rivet/Projections/FinalState.hh"
00006 #include "Rivet/Projections/FastJets.hh"
00007 #include "Rivet/Projections/ChargedFinalState.hh"
00008 #include "Rivet/Projections/Thrust.hh"
00009 #include "Rivet/Projections/Sphericity.hh"
00010 #include "Rivet/Projections/ParisiTensor.hh"
00011 #include "Rivet/Projections/Hemispheres.hh"
00012 #include "Rivet/Projections/Beam.hh"
00013
00014 namespace Rivet {
00015
00016
00017
00018 class ALEPH_2004_S5765862 : public Analysis {
00019 public:
00020
00021 ALEPH_2004_S5765862()
00022 : Analysis("ALEPH_2004_S5765862") , _initialisedJets(false),
00023 _initialisedSpectra(false), _weightedTotalChargedPartNum(0)
00024 {
00025 }
00026
00027
00028 public:
00029
00030 void init() {
00031 _initialisedJets = true;
00032 _initialisedSpectra = true;
00033
00034
00035
00036 const FinalState fs;
00037 addProjection(fs, "FS");
00038 FastJets durhamjets(fs, FastJets::DURHAM, 0.7);
00039 durhamjets.useInvisibles(true);
00040 addProjection(durhamjets, "DurhamJets");
00041
00042 const Thrust thrust(fs);
00043 addProjection(thrust, "Thrust");
00044 addProjection(Sphericity(fs), "Sphericity");
00045 addProjection(ParisiTensor(fs), "Parisi");
00046 addProjection(Hemispheres(thrust), "Hemispheres");
00047
00048 const ChargedFinalState cfs;
00049 addProjection(Beam(), "Beams");
00050 addProjection(cfs, "CFS");
00051
00052
00053
00054 int offset = 0;
00055 switch (int(sqrtS()/GeV + 0.5)) {
00056 case 91: offset = 0; break;
00057 case 133: offset = 1; break;
00058 case 161: offset = 2; break;
00059 case 172: offset = 3; break;
00060 case 183: offset = 4; break;
00061 case 189: offset = 5; break;
00062 case 200: offset = 6; break;
00063 case 206: offset = 7; break;
00064 default:
00065 _initialisedJets = false;
00066 }
00067
00068 if(_initialisedJets) {
00069 _h_thrust = bookHistogram1D(offset+54, 1, 1);
00070 _h_heavyjetmass = bookHistogram1D(offset+62, 1, 1);
00071 _h_totaljetbroadening = bookHistogram1D(offset+70, 1, 1);
00072 _h_widejetbroadening = bookHistogram1D(offset+78, 1, 1);
00073 _h_cparameter = bookHistogram1D(offset+86, 1, 1);
00074 _h_thrustmajor = bookHistogram1D(offset+94, 1, 1);
00075 _h_thrustminor = bookHistogram1D(offset+102, 1, 1);
00076 _h_jetmassdifference = bookHistogram1D(offset+110, 1, 1);
00077 _h_aplanarity = bookHistogram1D(offset+118, 1, 1);
00078 _h_planarity = offset==0 ? NULL : bookHistogram1D(offset+125, 1, 1);
00079 _h_oblateness = bookHistogram1D(offset+133, 1, 1);
00080 _h_sphericity = bookHistogram1D(offset+141, 1, 1);
00081
00082
00083 _h_y_Durham[0] = bookHistogram1D(offset+149, 1, 1);
00084 _h_y_Durham[1] = bookHistogram1D(offset+157, 1, 1);
00085 if (offset<6) {
00086 _h_y_Durham[2] = bookHistogram1D(offset+165, 1, 1);
00087 _h_y_Durham[3] = bookHistogram1D(offset+173, 1, 1);
00088 _h_y_Durham[4] = bookHistogram1D(offset+180, 1, 1);
00089 }
00090 else if (offset==6) {
00091 _h_y_Durham[2] = NULL;
00092 _h_y_Durham[3] = NULL;
00093 _h_y_Durham[4] = NULL;
00094 }
00095 else if (offset==7) {
00096 _h_y_Durham[2] = bookHistogram1D(172, 1, 1);
00097 _h_y_Durham[3] = bookHistogram1D(179, 1, 1);
00098 _h_y_Durham[4] = bookHistogram1D(186, 1, 1);
00099 }
00100
00101
00102 _h_R_Durham[0] = bookDataPointSet(offset+187, 1, 1);
00103 _h_R_Durham[1] = bookDataPointSet(offset+195, 1, 1);
00104 _h_R_Durham[2] = bookDataPointSet(offset+203, 1, 1);
00105 _h_R_Durham[3] = bookDataPointSet(offset+211, 1, 1);
00106 _h_R_Durham[4] = bookDataPointSet(offset+219, 1, 1);
00107 _h_R_Durham[5] = bookDataPointSet(offset+227, 1, 1);
00108 }
00109
00110 offset = 0;
00111 switch (int(sqrtS()/GeV + 0.5)) {
00112 case 133: offset = 0; break;
00113 case 161: offset = 1; break;
00114 case 172: offset = 2; break;
00115 case 183: offset = 3; break;
00116 case 189: offset = 4; break;
00117 case 196: offset = 5; break;
00118 case 200: offset = 6; break;
00119 case 206: offset = 7; break;
00120 default:
00121 _initialisedSpectra=false;
00122 }
00123 if (_initialisedSpectra) {
00124 _h_xp = bookHistogram1D( 2+offset, 1, 1);
00125 _h_xi = bookHistogram1D(11+offset, 1, 1);
00126 _h_xe = bookHistogram1D(19+offset, 1, 1);
00127 _h_pTin = bookHistogram1D(27+offset, 1, 1);
00128 _h_pTout = offset != 7 ? NULL : bookHistogram1D(35, 1, 1);
00129 _h_rapidityT = bookHistogram1D(36+offset, 1, 1);
00130 _h_rapidityS = bookHistogram1D(44+offset, 1, 1);
00131 }
00132
00133 if (!_initialisedSpectra && !_initialisedJets) {
00134 MSG_WARNING("CoM energy of events sqrt(s) = " << sqrtS()/GeV
00135 << " doesn't match any available analysis energy .");
00136 }
00137 }
00138
00139
00140 void analyze(const Event& e) {
00141 const double weight = e.weight();
00142
00143 const Thrust& thrust = applyProjection<Thrust>(e, "Thrust");
00144 const Sphericity& sphericity = applyProjection<Sphericity>(e, "Sphericity");
00145
00146 if(_initialisedJets) {
00147 bool LEP1 = fuzzyEquals(sqrtS(),91.2*GeV,0.01);
00148
00149 double thr = LEP1 ? thrust.thrust() : 1.0 - thrust.thrust();
00150 _h_thrust->fill(thr,weight);
00151 _h_thrustmajor->fill(thrust.thrustMajor(),weight);
00152 if(LEP1)
00153 _h_thrustminor->fill(log(thrust.thrustMinor()),weight);
00154 else
00155 _h_thrustminor->fill(thrust.thrustMinor(),weight);
00156 _h_oblateness->fill(thrust.oblateness(),weight);
00157
00158 const Hemispheres& hemi = applyProjection<Hemispheres>(e, "Hemispheres");
00159 _h_heavyjetmass->fill(hemi.scaledM2high(),weight);
00160 _h_jetmassdifference->fill(hemi.scaledM2diff(),weight);
00161 _h_totaljetbroadening->fill(hemi.Bsum(),weight);
00162 _h_widejetbroadening->fill(hemi.Bmax(),weight);
00163
00164 const ParisiTensor& parisi = applyProjection<ParisiTensor>(e, "Parisi");
00165 _h_cparameter->fill(parisi.C(),weight);
00166
00167 _h_aplanarity->fill(sphericity.aplanarity(),weight);
00168 if(_h_planarity)
00169 _h_planarity->fill(sphericity.planarity(),weight);
00170 _h_sphericity->fill(sphericity.sphericity(),weight);
00171
00172
00173 const FastJets& durjet = applyProjection<FastJets>(e, "DurhamJets");
00174 double log10e = log10(exp(1.));
00175 if (durjet.clusterSeq()) {
00176 double logynm1=0.;
00177 double logyn;
00178 for (size_t i=0; i<5; ++i) {
00179 logyn = -log(durjet.clusterSeq()->exclusive_ymerge_max(i+1));
00180 if (_h_y_Durham[i]) {
00181 _h_y_Durham[i]->fill(logyn, weight);
00182 }
00183 if(!LEP1) logyn *= log10e;
00184 for (int j = 0; j < _h_R_Durham[i]->size(); ++j) {
00185 IDataPoint* dp = _h_R_Durham[i]->point(j);
00186 double val = -dp->coordinate(0)->value()+dp->coordinate(0)->errorMinus();
00187 if(val<=logynm1) break;
00188 if(val<logyn) {
00189 dp->coordinate(1)->setValue(dp->coordinate(1)->value()+weight);
00190 }
00191 }
00192 logynm1 = logyn;
00193 }
00194 for (int j = 0; j < _h_R_Durham[5]->size(); ++j) {
00195 IDataPoint* dp = _h_R_Durham[5]->point(j);
00196 double val = -dp->coordinate(0)->value()+dp->coordinate(0)->errorMinus();
00197 if(val<=logynm1) break;
00198 dp->coordinate(1)->setValue(dp->coordinate(1)->value()+weight);
00199 }
00200 }
00201 if( !_initialisedSpectra) {
00202 const ChargedFinalState& cfs = applyProjection<ChargedFinalState>(e, "CFS");
00203 const size_t numParticles = cfs.particles().size();
00204 _weightedTotalChargedPartNum += numParticles * weight;
00205 }
00206 }
00207
00208
00209 if(_initialisedSpectra) {
00210 const ChargedFinalState& cfs = applyProjection<ChargedFinalState>(e, "CFS");
00211 const size_t numParticles = cfs.particles().size();
00212 _weightedTotalChargedPartNum += numParticles * weight;
00213 const ParticlePair& beams = applyProjection<Beam>(e, "Beams").beams();
00214 const double meanBeamMom = ( beams.first.momentum().vector3().mod() +
00215 beams.second.momentum().vector3().mod() ) / 2.0;
00216 foreach (const Particle& p, cfs.particles()) {
00217 const double xp = p.momentum().vector3().mod()/meanBeamMom;
00218 _h_xp->fill(xp , weight);
00219 const double logxp = -std::log(xp);
00220 _h_xi->fill(logxp, weight);
00221 const double xe = p.momentum().E()/meanBeamMom;
00222 _h_xe->fill(xe , weight);
00223 const double pTinT = dot(p.momentum().vector3(), thrust.thrustMajorAxis());
00224 const double pToutT = dot(p.momentum().vector3(), thrust.thrustMinorAxis());
00225 _h_pTin->fill(fabs(pTinT/GeV), weight);
00226 if(_h_pTout) _h_pTout->fill(fabs(pToutT/GeV), weight);
00227 const double momT = dot(thrust.thrustAxis() ,p.momentum().vector3());
00228 const double rapidityT = 0.5 * std::log((p.momentum().E() + momT) /
00229 (p.momentum().E() - momT));
00230 _h_rapidityT->fill(rapidityT, weight);
00231 const double momS = dot(sphericity.sphericityAxis(),p.momentum().vector3());
00232 const double rapidityS = 0.5 * std::log((p.momentum().E() + momS) /
00233 (p.momentum().E() - momS));
00234 _h_rapidityS->fill(rapidityS, weight);
00235 }
00236 }
00237 }
00238
00239 void finalize() {
00240 if(!_initialisedJets && !_initialisedSpectra) return;
00241
00242 if (_initialisedJets) {
00243 normalize(_h_thrust);
00244 normalize(_h_heavyjetmass);
00245 normalize(_h_totaljetbroadening);
00246 normalize(_h_widejetbroadening);
00247 normalize(_h_cparameter);
00248 normalize(_h_thrustmajor);
00249 normalize(_h_thrustminor);
00250 normalize(_h_jetmassdifference);
00251 normalize(_h_aplanarity);
00252 if(_h_planarity) normalize(_h_planarity);
00253 normalize(_h_oblateness);
00254 normalize(_h_sphericity);
00255
00256 for (size_t N=1; N<7; ++N) {
00257 for (int i = 0; i < _h_R_Durham[N-1]->size(); ++i) {
00258 _h_R_Durham[N-1]->point(i)->coordinate(1)->
00259 setValue(_h_R_Durham[N-1]->point(i)->coordinate(1)->value()/sumOfWeights());
00260 }
00261 }
00262
00263 for (size_t n = 0; n < 5; ++n) {
00264 if (_h_y_Durham[n]) {
00265 scale(_h_y_Durham[n], 1.0/sumOfWeights());
00266 }
00267 }
00268 }
00269
00270 const double avgNumParts = _weightedTotalChargedPartNum / sumOfWeights();
00271 AIDA::IDataPointSet * mult = bookDataPointSet(1, 1, 1);
00272 for (int i = 0; i < mult->size(); ++i) {
00273 if (fuzzyEquals(sqrtS(), mult->point(i)->coordinate(0)->value(), 0.01)) {
00274 mult->point(i)->coordinate(1)->setValue(avgNumParts);
00275 }
00276 }
00277
00278 if (_initialisedSpectra) {
00279 normalize(_h_xp, avgNumParts);
00280 normalize(_h_xi, avgNumParts);
00281 normalize(_h_xe, avgNumParts);
00282 normalize(_h_pTin , avgNumParts);
00283 if (_h_pTout) normalize(_h_pTout, avgNumParts);
00284 normalize(_h_rapidityT, avgNumParts);
00285 normalize(_h_rapidityS, avgNumParts);
00286 }
00287 }
00288
00289 private:
00290
00291 bool _initialisedJets;
00292 bool _initialisedSpectra;
00293
00294 AIDA::IHistogram1D *_h_xp;
00295 AIDA::IHistogram1D *_h_xi;
00296 AIDA::IHistogram1D *_h_xe;
00297 AIDA::IHistogram1D *_h_pTin;
00298 AIDA::IHistogram1D *_h_pTout;
00299 AIDA::IHistogram1D *_h_rapidityT;
00300 AIDA::IHistogram1D *_h_rapidityS;
00301 AIDA::IHistogram1D *_h_thrust;
00302 AIDA::IHistogram1D *_h_heavyjetmass;
00303 AIDA::IHistogram1D *_h_totaljetbroadening;
00304 AIDA::IHistogram1D *_h_widejetbroadening;
00305 AIDA::IHistogram1D *_h_cparameter;
00306 AIDA::IHistogram1D *_h_thrustmajor;
00307 AIDA::IHistogram1D *_h_thrustminor;
00308 AIDA::IHistogram1D *_h_jetmassdifference;
00309 AIDA::IHistogram1D *_h_aplanarity;
00310 AIDA::IHistogram1D *_h_planarity;
00311 AIDA::IHistogram1D *_h_oblateness;
00312 AIDA::IHistogram1D *_h_sphericity;
00313
00314 AIDA::IDataPointSet *_h_R_Durham[6];
00315 AIDA::IHistogram1D *_h_y_Durham[5];
00316
00317 double _weightedTotalChargedPartNum;
00318
00319 };
00320
00321
00322
00323
00324 DECLARE_RIVET_PLUGIN(ALEPH_2004_S5765862);
00325
00326 }