LHCB_2011_I917009.cc
Go to the documentation of this file.
00001 // -*- C++ -*- 00002 #include "Rivet/Analysis.hh" 00003 #include "Rivet/RivetYODA.hh" 00004 #include "Rivet/Tools/Logging.hh" 00005 #include "Rivet/Tools/ParticleIdUtils.hh" 00006 #include "Rivet/Projections/UnstableFinalState.hh" 00007 //#include "LWH/Histogram1D.h" 00008 #include "Rivet/Math/MathUtils.hh" 00009 #include "Rivet/Math/Constants.hh" 00010 00011 #include "HepMC/GenEvent.h" 00012 #include "HepMC/GenParticle.h" 00013 #include "HepMC/GenVertex.h" 00014 #include "HepMC/SimpleVector.h" 00015 00016 #include <iostream> 00017 #include <sstream> 00018 #include <string> 00019 00020 namespace Rivet { 00021 00022 00023 class LHCB_2011_I917009 : public Analysis { 00024 public: 00025 00026 /// @name Constructors etc. 00027 //@{ 00028 00029 /// Constructor 00030 LHCB_2011_I917009() 00031 : Analysis("LHCB_2011_I917009"), 00032 rap_beam(0.0), pt_min(0.0), 00033 pt1_edge(0.65), pt2_edge(1.0), 00034 pt3_edge(2.5), rap_min(2.), 00035 rap_max(0.0), dsShift(0) 00036 { } 00037 00038 //@} 00039 00040 00041 public: 00042 00043 /// @name Analysis methods 00044 //@{ 00045 00046 /// Book histograms and initialise projections before the run 00047 void init() { 00048 int y_nbins = 4; 00049 fillMap(partLftMap); 00050 if ( fuzzyEquals(sqrtS(), 0.9*TeV) ) { 00051 rap_beam = 6.87; 00052 rap_max = 4.; 00053 pt_min = 0.25; 00054 } else if ( fuzzyEquals(sqrtS(), 7*TeV) ) { 00055 rap_beam = 8.92; 00056 rap_max = 4.5; 00057 pt_min = 0.15; 00058 y_nbins = 5; 00059 dsShift = 8; 00060 } else { 00061 MSG_ERROR("Incompatible beam energy!"); 00062 } 00063 /// @todo YODA 00064 ////pT edges are the same for all 3 histos in this suite 00065 //const BinEdges& pt_edges = binEdges(dsShift+5,1,1); 00066 //// booking temporary histos 00067 //for (int i = 0; i<12; i++ ) _tmphistos[i].reset(new LWH::Histogram1D(y_nbins, rap_min, rap_max)); 00068 //for (int i = 12; i<15; i++ ) _tmphistos[i].reset(new LWH::Histogram1D(pt_edges)); 00069 //for (int i = 15; i<18; i++ ) _tmphistos[i].reset(new LWH::Histogram1D(y_nbins, rap_beam - rap_max, rap_beam - rap_min)); 00070 addProjection(UnstableFinalState(), "UFS"); 00071 } 00072 00073 00074 /// Perform the per-event analysis 00075 void analyze(const Event& event) { 00076 const double weight = event.weight(); 00077 const UnstableFinalState& ufs = applyProjection<UnstableFinalState>(event, "UFS"); 00078 double ancestor_lftsum = 0.0; 00079 double y, pT; 00080 int id; 00081 int partIdx = -1; 00082 foreach (const Particle& p, ufs.particles()) { 00083 id = p.pdgId(); 00084 // continue if particle not a K0s nor (anti-)Lambda 00085 if ( (id == 310) || (id == -310) ) { 00086 partIdx = 2; 00087 } else if ( id == 3122 ) { 00088 partIdx = 1; 00089 } else if ( id == -3122 ) { 00090 partIdx = 0; 00091 } else { 00092 continue; 00093 }; 00094 ancestor_lftsum = getMotherLifeTimeSum(p); 00095 // Lifetime cut: ctau sum of all particle ancestors < 10^-9 m according to the paper (see eq. 5) 00096 const double MAX_CTAU = 1.0E-9; // [m] 00097 if ( (ancestor_lftsum < 0.0) || (ancestor_lftsum > MAX_CTAU) ) continue; 00098 const FourMomentum& qmom = p.momentum(); 00099 y = log((qmom.E() + qmom.pz())/(qmom.E() - qmom.pz()))/2.; 00100 // skip this particle if it has too high or too low rapidity (extremely rare cases when E = +- pz) 00101 if ( isnan(y) || isinf(y) ) continue; 00102 y = fabs(y); 00103 if ( (y < rap_min) || (y > rap_max) ) continue; 00104 pT = sqrt((qmom.px() * qmom.px()) + (qmom.py() * qmom.py())); 00105 if ( (pT < pt_min) || (pT > pt3_edge) ) continue; 00106 /// @todo YODA 00107 //// Filling corresponding temporary histograms for pT intervals 00108 //if ( (pT >= pt_min ) && (pT < pt1_edge) ) _tmphistos[partIdx*3]->fill(y, weight); 00109 //if ( (pT >= pt1_edge) && (pT < pt2_edge) ) _tmphistos[partIdx*3+1]->fill(y, weight); 00110 //if ( (pT >= pt2_edge) && (pT < pt3_edge) ) _tmphistos[partIdx*3+2]->fill(y, weight); 00111 //// Fill histo in rapidity for whole pT interval 00112 //_tmphistos[partIdx+9]->fill(y, weight); 00113 //// Fill histo in pT for whole rapidity interval 00114 //_tmphistos[partIdx+12]->fill(pT, weight); 00115 //// Fill histo in rapidity loss for whole pT interval 00116 //_tmphistos[partIdx+15]->fill(rap_beam - y, weight); 00117 } 00118 } 00119 00120 00121 // Generate the ratio histograms 00122 void finalize() { 00123 /// @todo YODA 00124 //// needed to determine AIDA to save the file! 00125 //tree().mkdirs(histoDir()); 00126 //int dsId = dsShift+1; 00127 //for (int j=0; j<3; j++ ) { 00128 // histogramFactory().divide(histoPath(dsId, 1, j+1), *_tmphistos[j], *_tmphistos[3+j]); 00129 // histogramFactory().divide(histoPath(dsId+1, 1, j+1), *_tmphistos[j], *_tmphistos[6+j]); 00130 //} 00131 //dsId += 2; 00132 //for (int j = 3; j<6; j++) { 00133 // histogramFactory().divide(histoPath(dsId, 1, 1), *_tmphistos[3*j], *_tmphistos[3*j+1]); 00134 // dsId ++; 00135 // histogramFactory().divide(histoPath(dsId, 1, 1), *_tmphistos[3*j], *_tmphistos[3*j+2]); 00136 // dsId ++; 00137 //} 00138 } 00139 00140 //@} 00141 00142 00143 private: 00144 00145 00146 // //doubles the protected makeAxisCode function in Analysis.cc 00147 // //if only it wouldn't be defined in anonymous namespace...! 00148 // string _datasetName(int d, int x, int y) { 00149 // stringstream dsns; 00150 // dsns << "d"; 00151 // if (d < 10) dsns << '0'; 00152 // dsns << dec << d << "-x"; 00153 // if (x < 10) dsns << '0'; 00154 // dsns << dec << x << "-y"; 00155 // if (y < 10) dsns << '0'; 00156 // dsns << dec << y; 00157 // return dsns.str(); 00158 // } 00159 00160 00161 // Get particle lifetime from hardcoded data 00162 double getLifeTime(int pid) { 00163 double lft = -1.0; 00164 if (pid < 0) pid = - pid; 00165 // Correct Pythia6 PIDs for f0(980), f0(1370) mesons 00166 if (pid == 10331) pid = 30221; 00167 if (pid == 10221) pid = 9010221; 00168 map<int, double>::iterator pPartLft = partLftMap.find(pid); 00169 // search stable particle list 00170 if (pPartLft == partLftMap.end()) { 00171 if (pid <= 100) return 0.0; 00172 for (size_t i=0; i < sizeof(stablePDGIds)/sizeof(unsigned int); i++) { 00173 if (pid == stablePDGIds[i]) { lft = 0.0; break; } 00174 } 00175 } else { 00176 lft = (*pPartLft).second; 00177 } 00178 if (lft < 0.0 && PID::isHadron(pid)) { 00179 MSG_ERROR("Could not determine lifetime for particle with PID " << pid 00180 << "... This V^0 will be considered unprompt!"); 00181 } 00182 return lft; 00183 } 00184 00185 // Data members like post-cuts event weight counters go here 00186 const double getMotherLifeTimeSum(const Particle& p) { 00187 if ( !p.hasGenParticle() ) return -1.; 00188 double lftSum = 0.; 00189 double plft = 0.; 00190 const GenParticle* part = &(p.genParticle()); 00191 GenVertex* ivtx = part->production_vertex(); 00192 while(ivtx) 00193 { 00194 if (ivtx->particles_in_size() < 1) { lftSum = -1.; break; }; 00195 const HepMC::GenVertex::particles_in_const_iterator iPart_invtx = ivtx->particles_in_const_begin(); 00196 part = (*iPart_invtx); 00197 if ( !(part) ) { lftSum = -1.; break; }; 00198 ivtx = part->production_vertex(); 00199 if ( (part->pdg_id() == 2212) || !(ivtx) ) break; //reached beam 00200 plft = getLifeTime(part->pdg_id()); 00201 if (plft < 0.) { lftSum = -1.; break; }; 00202 lftSum += plft; 00203 }; 00204 return (lftSum * c_light); 00205 } 00206 00207 /// @name Private variables: 00208 // The rapidity of the beam according to the selected beam energy 00209 double rap_beam; 00210 // The edges of the intervals of transversal momentum 00211 double pt_min; 00212 double pt1_edge; 00213 double pt2_edge; 00214 double pt3_edge; 00215 // The limits of the rapidity window 00216 double rap_min; 00217 double rap_max; 00218 // Indicates which set of histograms will be output to yoda file (according to beam energy) 00219 int dsShift; 00220 // Map between PDG id and particle lifetimes in seconds 00221 std::map<int, double> partLftMap; 00222 // Set of PDG Ids for stable particles (PDG Id <= 100 are considered stable) 00223 static const int stablePDGIds[205]; 00224 /// @name Helper Histograms: 00225 //@{ 00226 /// @todo YODA 00227 //shared_ptr<LWH::Histogram1D> _tmphistos[18]; 00228 // Histograms are defined in the following order: anti-Lambda, Lambda and K0s. 00229 // First 3 suites of 3 histograms correspond to each particle in bins of y for the 3 pT intervals. (9 histos) 00230 // Next 3 histograms contain the particles in y bins for the whole pT interval (3 histos) 00231 // Next 3 histograms contain the particles in y_loss bins for the whole pT interval (3 histos) 00232 // Last 3 histograms contain the particles in pT bins for the whole rapidity (y) interval (3 histos) 00233 //@} 00234 00235 // Fill the PDG Id to Lifetime[seconds] map 00236 // Data was extracted from LHCb Particle Table through LHCb::ParticlePropertySvc 00237 bool fillMap(map<int, double> &m) { 00238 m[6] = 4.707703E-25; m[11] = 1.E+16; m[12] = 1.E+16; 00239 m[13] = 2.197019E-06; m[14] = 1.E+16; m[15] = 2.906E-13; m[16] = 1.E+16; m[22] = 1.E+16; 00240 m[23] = 2.637914E-25; m[24] = 3.075758E-25; m[25] = 9.4E-26; m[35] = 9.4E-26; 00241 m[36] = 9.4E-26; m[37] = 9.4E-26; m[84] = 3.335641E-13; m[85] = 1.290893E-12; 00242 m[111] = 8.4E-17; m[113] = 4.405704E-24; m[115] = 6.151516E-24; m[117] = 4.088275E-24; 00243 m[119] = 2.102914E-24; m[130] = 5.116E-08; m[150] = 1.525E-12; m[211] = 2.6033E-08; 00244 m[213] = 4.405704E-24; m[215] = 6.151516E-24; m[217] = 4.088275E-24; m[219] = 2.102914E-24; 00245 m[221] = 5.063171E-19; m[223] = 7.752794E-23; m[225] = 3.555982E-24; m[227] = 3.91793E-24; 00246 m[229] = 2.777267E-24; m[310] = 8.953E-11; m[313] = 1.308573E-23; m[315] = 6.038644E-24; 00247 m[317] = 4.139699E-24; m[319] = 3.324304E-24; m[321] = 1.238E-08; m[323] = 1.295693E-23; 00248 m[325] = 6.682357E-24; m[327] = 4.139699E-24; m[329] = 3.324304E-24; m[331] = 3.210791E-21; 00249 m[333] = 1.545099E-22; m[335] = 9.016605E-24; m[337] = 7.565657E-24; m[350] = 1.407125E-12; 00250 m[411] = 1.04E-12; m[413] = 6.856377E-21; m[415] = 1.778952E-23; m[421] = 4.101E-13; 00251 m[423] = 1.000003E-19; m[425] = 1.530726E-23; m[431] = 5.E-13; m[433] = 1.000003E-19; 00252 m[435] = 3.291061E-23; m[441] = 2.465214E-23; m[443] = 7.062363E-21; m[445] = 3.242425E-22; 00253 m[510] = 1.525E-12; m[511] = 1.525E-12; m[513] = 1.000019E-19; m[515] = 1.31E-23; 00254 m[521] = 1.638E-12; m[523] = 1.000019E-19; m[525] = 1.31E-23; m[530] = 1.536875E-12; 00255 m[531] = 1.472E-12; m[533] = 1.E-19; m[535] = 1.31E-23; m[541] = 4.5E-13; 00256 m[553] = 1.218911E-20; m[1112] = 4.539394E-24; m[1114] = 5.578069E-24; m[1116] = 1.994582E-24; 00257 m[1118] = 2.269697E-24; m[1212] = 4.539394E-24; m[1214] = 5.723584E-24; m[1216] = 1.994582E-24; 00258 m[1218] = 1.316424E-24; m[2112] = 8.857E+02; m[2114] = 5.578069E-24; m[2116] = 4.388081E-24; 00259 m[2118] = 2.269697E-24; m[2122] = 4.539394E-24; m[2124] = 5.723584E-24; m[2126] = 1.994582E-24; 00260 m[2128] = 1.316424E-24; m[2212] = 1.E+16; m[2214] = 5.578069E-24; m[2216] = 4.388081E-24; 00261 m[2218] = 2.269697E-24; m[2222] = 4.539394E-24; m[2224] = 5.578069E-24; m[2226] = 1.994582E-24; 00262 m[2228] = 2.269697E-24; m[3112] = 1.479E-10; m[3114] = 1.670589E-23; m[3116] = 5.485102E-24; 00263 m[3118] = 3.656734E-24; m[3122] = 2.631E-10; m[3124] = 4.219309E-23; m[3126] = 8.227653E-24; 00264 m[3128] = 3.291061E-24; m[3212] = 7.4E-20; m[3214] = 1.828367E-23; m[3216] = 5.485102E-24; 00265 m[3218] = 3.656734E-24; m[3222] = 8.018E-11; m[3224] = 1.838582E-23; m[3226] = 5.485102E-24; 00266 m[3228] = 3.656734E-24; m[3312] = 1.639E-10; m[3314] = 6.648608E-23; m[3322] = 2.9E-10; 00267 m[3324] = 7.233101E-23; m[3334] = 8.21E-11; m[4112] = 2.991874E-22; m[4114] = 4.088274E-23; 00268 m[4122] = 2.E-13; m[4132] = 1.12E-13; m[4212] = 3.999999E-22; m[4214] = 3.291061E-22; 00269 m[4222] = 2.951624E-22; m[4224] = 4.417531E-23; m[4232] = 4.42E-13; m[4332] = 6.9E-14; 00270 m[4412] = 3.335641E-13; m[4422] = 3.335641E-13; m[4432] = 3.335641E-13; m[5112] = 1.E-19; 00271 m[5122] = 1.38E-12; m[5132] = 1.42E-12; m[5142] = 1.290893E-12; m[5212] = 1.E-19; 00272 m[5222] = 1.E-19; m[5232] = 1.42E-12; m[5242] = 1.290893E-12; m[5312] = 1.E-19; 00273 m[5322] = 1.E-19; m[5332] = 1.55E-12; m[5342] = 1.290893E-12; m[5442] = 1.290893E-12; 00274 m[5512] = 1.290893E-12; m[5522] = 1.290893E-12; m[5532] = 1.290893E-12; m[5542] = 1.290893E-12; 00275 m[10111] = 2.48382E-24; m[10113] = 4.635297E-24; m[10115] = 2.54136E-24; m[10211] = 2.48382E-24; 00276 m[10213] = 4.635297E-24; m[10215] = 2.54136E-24; m[10223] = 1.828367E-24; m[10225] = 3.636531E-24; 00277 m[10311] = 2.437823E-24; m[10313] = 7.313469E-24; m[10315] = 3.538775E-24; 00278 m[10321] = 2.437823E-24; m[10323] = 7.313469E-24; m[10325] = 3.538775E-24; 00279 m[10331] = 4.804469E-24; m[10411] = 4.38E-24; m[10413] = 3.29E-23; m[10421] = 4.38E-24; 00280 m[10423] = 3.22653E-23; m[10431] = 6.5821E-22; m[10433] = 6.5821E-22; m[10441] = 6.453061E-23; 00281 m[10511] = 4.39E-24; m[10513] = 1.65E-23; m[10521] = 4.39E-24; m[10523] = 1.65E-23; 00282 m[10531] = 4.39E-24; m[10533] = 1.65E-23; m[11114] = 2.194041E-24; m[11116] = 1.828367E-24; 00283 m[11212] = 1.880606E-24; m[11216] = 1.828367E-24; m[12112] = 2.194041E-24; 00284 m[12114] = 2.194041E-24; m[12116] = 5.063171E-24; m[12126] = 1.828367E-24; 00285 m[12212] = 2.194041E-24; m[12214] = 2.194041E-24; m[12216] = 5.063171E-24; 00286 m[12224] = 2.194041E-24; m[12226] = 1.828367E-24; m[13112] = 6.582122E-24; m[13114] = 1.09702E-23; 00287 m[13116] = 5.485102E-24; m[13122] = 1.316424E-23; m[13124] = 1.09702E-23; m[13126] = 6.928549E-24; 00288 m[13212] = 6.582122E-24; m[13214] = 1.09702E-23; m[13216] = 5.485102E-24; m[13222] = 6.582122E-24; 00289 m[13224] = 1.09702E-23; m[13226] = 5.485102E-24; m[13314] = 2.742551E-23; 00290 m[13324] = 2.742551E-23; m[14122] = 1.828367E-22; m[20022] = 1.E+16; m[20113] = 1.567172E-24; 00291 m[20213] = 1.567172E-24; m[20223] = 2.708692E-23; m[20313] = 3.782829E-24; 00292 m[20315] = 2.384827E-24; m[20323] = 3.782829E-24; m[20325] = 2.384827E-24; 00293 m[20333] = 1.198929E-23; m[20413] = 2.63E-24; m[20423] = 2.63E-24; m[20433] = 6.5821E-22; 00294 m[20443] = 7.395643E-22; m[20513] = 2.63E-24; m[20523] = 2.63E-24; m[20533] = 2.63E-24; 00295 m[21112] = 2.632849E-24; m[21114] = 3.291061E-24; m[21212] = 2.632849E-24; 00296 m[21214] = 6.582122E-24; m[22112] = 4.388081E-24; m[22114] = 3.291061E-24; 00297 m[22122] = 2.632849E-24; m[22124] = 6.582122E-24; m[22212] = 4.388081E-24; 00298 m[22214] = 3.291061E-24; m[22222] = 2.632849E-24; m[22224] = 3.291061E-24; 00299 m[23112] = 7.313469E-24; m[23114] = 2.991874E-24; m[23122] = 4.388081E-24; 00300 m[23124] = 6.582122E-24; m[23126] = 3.291061E-24; m[23212] = 7.313469E-24; 00301 m[23214] = 2.991874E-24; m[23222] = 7.313469E-24; m[23224] = 2.991874E-24; 00302 m[30113] = 2.632849E-24; m[30213] = 2.632849E-24; m[30221] = 1.880606E-24; 00303 m[30223] = 2.089563E-24; m[30313] = 2.056913E-24; m[30323] = 2.056913E-24; 00304 m[30443] = 2.419898E-23; m[31114] = 1.880606E-24; m[31214] = 3.291061E-24; 00305 m[32112] = 3.989164E-24; m[32114] = 1.880606E-24; m[32124] = 3.291061E-24; 00306 m[32212] = 3.989164E-24; m[32214] = 1.880606E-24; m[32224] = 1.880606E-24; 00307 m[33122] = 1.880606E-23; m[42112] = 6.582122E-24; m[42212] = 6.582122E-24; 00308 m[43122] = 2.194041E-24; m[53122] = 4.388081E-24; m[100111] = 1.645531E-24; 00309 m[100113] = 1.64553E-24; m[100211] = 1.645531E-24; m[100213] = 1.64553E-24; 00310 m[100221] = 1.196749E-23; m[100223] = 3.061452E-24; m[100313] = 2.837122E-24; 00311 m[100323] = 2.837122E-24; m[100331] = 4.459432E-25; m[100333] = 4.388081E-24; 00312 m[100441] = 4.701516E-23; m[100443] = 2.076379E-21; m[100553] = 2.056913E-20; 00313 m[200553] = 3.242425E-20; m[300553] = 3.210791E-23; m[9000111] = 8.776163E-24; 00314 m[9000211] = 8.776163E-24; m[9000443] = 8.227652E-24; m[9000553] = 5.983747E-24; 00315 m[9010111] = 3.164482E-24; m[9010211] = 3.164482E-24; m[9010221] = 9.403031E-24; 00316 m[9010443] = 8.438618E-24; m[9010553] = 8.3318E-24; m[9020443] = 1.061633E-23; 00317 m[9030221] = 6.038644E-24; m[9042413] = 2.07634E-21; m[9050225] = 1.394517E-24; 00318 m[9060225] = 3.291061E-24; m[9080225] = 4.388081E-24; m[9090225] = 2.056913E-24; 00319 m[9910445] = 2.07634E-21; m[9920443] = 2.07634E-21; 00320 return true; 00321 } 00322 00323 }; 00324 00325 00326 const int LHCB_2011_I917009::stablePDGIds[205] = { 00327 311, 543, 545, 551, 555, 557, 1103, 2101, 2103, 2203, 3101, 3103, 3201, 3203, 3303, 00328 4101, 4103, 4124, 4201, 4203, 4301, 4303, 4312, 4314, 4322, 4324, 4334, 4403, 4414, 00329 4424, 4434, 4444, 5101, 5103, 5114, 5201, 5203, 5214, 5224, 5301, 5303, 5314, 5324, 00330 5334, 5401, 5403, 5412, 5414, 5422, 5424, 5432, 5434, 5444, 5503, 5514, 5524, 5534, 00331 5544, 5554, 10022, 10333, 10335, 10443, 10541, 10543, 10551, 10553, 10555, 11112, 00332 12118, 12122, 12218, 12222, 13316, 13326, 20543, 20553, 20555, 23314, 23324, 30343, 00333 30353, 30363, 30553, 33314, 33324, 41214, 42124, 52114, 52214, 100311, 100315, 100321, 00334 100325, 100411, 100413, 100421, 100423, 100551, 100555, 100557, 110551, 110553, 110555, 00335 120553, 120555, 130553, 200551, 200555, 210551, 210553, 220553, 1000001, 1000002, 00336 1000003, 1000004, 1000005, 1000006, 1000011, 1000012, 1000013, 1000014, 1000015, 00337 1000016, 1000021, 1000022, 1000023, 1000024, 1000025, 1000035, 1000037, 1000039, 00338 2000001, 2000002, 2000003, 2000004, 2000005, 2000006, 2000011, 2000012, 2000013, 00339 2000014, 2000015, 2000016, 3000111, 3000113, 3000211, 3000213, 3000221, 3000223, 00340 3000331, 3100021, 3100111, 3100113, 3200111, 3200113, 3300113, 3400113, 4000001, 00341 4000002, 4000011, 4000012, 5000039, 9000221, 9900012, 9900014, 9900016, 9900023, 00342 9900024, 9900041, 9900042 }; 00343 00344 00345 // Hook for the plugin system 00346 DECLARE_RIVET_PLUGIN(LHCB_2011_I917009); 00347 00348 } Generated on Fri Dec 21 2012 15:03:41 for The Rivet MC analysis system by ![]() |