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