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