[b443089] | 1 | /*
|
---|
| 2 | * Delphes: a framework for fast simulation of a generic collider experiment
|
---|
| 3 | * Copyright (C) 2012-2014 Universite catholique de Louvain (UCL), Belgium
|
---|
[1fa50c2] | 4 | *
|
---|
[b443089] | 5 | * This program is free software: you can redistribute it and/or modify
|
---|
| 6 | * it under the terms of the GNU General Public License as published by
|
---|
| 7 | * the Free Software Foundation, either version 3 of the License, or
|
---|
| 8 | * (at your option) any later version.
|
---|
[1fa50c2] | 9 | *
|
---|
[b443089] | 10 | * This program is distributed in the hope that it will be useful,
|
---|
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 13 | * GNU General Public License for more details.
|
---|
[1fa50c2] | 14 | *
|
---|
[b443089] | 15 | * You should have received a copy of the GNU General Public License
|
---|
| 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>.
|
---|
| 17 | */
|
---|
| 18 |
|
---|
[d7d2da3] | 19 | /** \class TreeWriter
|
---|
| 20 | *
|
---|
| 21 | * Fills ROOT tree branches.
|
---|
| 22 | *
|
---|
| 23 | * \author P. Demin - UCL, Louvain-la-Neuve
|
---|
| 24 | *
|
---|
| 25 | */
|
---|
| 26 |
|
---|
| 27 | #include "modules/TreeWriter.h"
|
---|
| 28 |
|
---|
| 29 | #include "classes/DelphesClasses.h"
|
---|
| 30 | #include "classes/DelphesFactory.h"
|
---|
| 31 | #include "classes/DelphesFormula.h"
|
---|
| 32 |
|
---|
| 33 | #include "ExRootAnalysis/ExRootClassifier.h"
|
---|
[341014c] | 34 | #include "ExRootAnalysis/ExRootFilter.h"
|
---|
| 35 | #include "ExRootAnalysis/ExRootResult.h"
|
---|
[d7d2da3] | 36 | #include "ExRootAnalysis/ExRootTreeBranch.h"
|
---|
| 37 |
|
---|
| 38 | #include "TDatabasePDG.h"
|
---|
[341014c] | 39 | #include "TFormula.h"
|
---|
[d7d2da3] | 40 | #include "TLorentzVector.h"
|
---|
[341014c] | 41 | #include "TMath.h"
|
---|
| 42 | #include "TObjArray.h"
|
---|
| 43 | #include "TROOT.h"
|
---|
| 44 | #include "TRandom3.h"
|
---|
| 45 | #include "TString.h"
|
---|
[d7d2da3] | 46 |
|
---|
| 47 | #include <algorithm>
|
---|
| 48 | #include <iostream>
|
---|
| 49 | #include <sstream>
|
---|
[341014c] | 50 | #include <stdexcept>
|
---|
[d7d2da3] | 51 |
|
---|
| 52 | using namespace std;
|
---|
| 53 |
|
---|
| 54 | //------------------------------------------------------------------------------
|
---|
| 55 |
|
---|
| 56 | TreeWriter::TreeWriter()
|
---|
| 57 | {
|
---|
| 58 | }
|
---|
| 59 |
|
---|
| 60 | //------------------------------------------------------------------------------
|
---|
| 61 |
|
---|
| 62 | TreeWriter::~TreeWriter()
|
---|
| 63 | {
|
---|
| 64 | }
|
---|
| 65 |
|
---|
| 66 | //------------------------------------------------------------------------------
|
---|
| 67 |
|
---|
| 68 | void TreeWriter::Init()
|
---|
| 69 | {
|
---|
| 70 | fClassMap[GenParticle::Class()] = &TreeWriter::ProcessParticles;
|
---|
[2de4dcd] | 71 | fClassMap[Vertex::Class()] = &TreeWriter::ProcessVertices;
|
---|
[d7d2da3] | 72 | fClassMap[Track::Class()] = &TreeWriter::ProcessTracks;
|
---|
| 73 | fClassMap[Tower::Class()] = &TreeWriter::ProcessTowers;
|
---|
[4d7014e] | 74 | fClassMap[ParticleFlowCandidate::Class()] = &TreeWriter::ProcessParticleFlowCandidates;
|
---|
[d7d2da3] | 75 | fClassMap[Photon::Class()] = &TreeWriter::ProcessPhotons;
|
---|
| 76 | fClassMap[Electron::Class()] = &TreeWriter::ProcessElectrons;
|
---|
| 77 | fClassMap[Muon::Class()] = &TreeWriter::ProcessMuons;
|
---|
| 78 | fClassMap[Jet::Class()] = &TreeWriter::ProcessJets;
|
---|
| 79 | fClassMap[MissingET::Class()] = &TreeWriter::ProcessMissingET;
|
---|
| 80 | fClassMap[ScalarHT::Class()] = &TreeWriter::ProcessScalarHT;
|
---|
[71648c2] | 81 | fClassMap[Rho::Class()] = &TreeWriter::ProcessRho;
|
---|
[2e229c9] | 82 | fClassMap[Weight::Class()] = &TreeWriter::ProcessWeight;
|
---|
[8f7db23] | 83 | fClassMap[HectorHit::Class()] = &TreeWriter::ProcessHectorHit;
|
---|
[d7d2da3] | 84 |
|
---|
| 85 | TBranchMap::iterator itBranchMap;
|
---|
[341014c] | 86 | map<TClass *, TProcessMethod>::iterator itClassMap;
|
---|
[d7d2da3] | 87 |
|
---|
| 88 | // read branch configuration and
|
---|
| 89 | // import array with output from filter/classifier/jetfinder modules
|
---|
| 90 |
|
---|
| 91 | ExRootConfParam param = GetParam("Branch");
|
---|
| 92 | Long_t i, size;
|
---|
| 93 | TString branchName, branchClassName, branchInputArray;
|
---|
| 94 | TClass *branchClass;
|
---|
| 95 | TObjArray *array;
|
---|
| 96 | ExRootTreeBranch *branch;
|
---|
| 97 |
|
---|
| 98 | size = param.GetSize();
|
---|
[341014c] | 99 | for(i = 0; i < size / 3; ++i)
|
---|
[d7d2da3] | 100 | {
|
---|
[341014c] | 101 | branchInputArray = param[i * 3].GetString();
|
---|
| 102 | branchName = param[i * 3 + 1].GetString();
|
---|
| 103 | branchClassName = param[i * 3 + 2].GetString();
|
---|
[d7d2da3] | 104 |
|
---|
| 105 | branchClass = gROOT->GetClass(branchClassName);
|
---|
| 106 |
|
---|
| 107 | if(!branchClass)
|
---|
| 108 | {
|
---|
| 109 | cout << "** ERROR: cannot find class '" << branchClassName << "'" << endl;
|
---|
| 110 | continue;
|
---|
| 111 | }
|
---|
[8f7db23] | 112 |
|
---|
[d7d2da3] | 113 | itClassMap = fClassMap.find(branchClass);
|
---|
| 114 | if(itClassMap == fClassMap.end())
|
---|
| 115 | {
|
---|
| 116 | cout << "** ERROR: cannot create branch for class '" << branchClassName << "'" << endl;
|
---|
| 117 | continue;
|
---|
| 118 | }
|
---|
| 119 |
|
---|
| 120 | array = ImportArray(branchInputArray);
|
---|
| 121 | branch = NewBranch(branchName, branchClass);
|
---|
| 122 |
|
---|
| 123 | fBranchMap.insert(make_pair(branch, make_pair(itClassMap->second, array)));
|
---|
| 124 | }
|
---|
[dc883b4] | 125 |
|
---|
| 126 | param = GetParam("Info");
|
---|
| 127 | TString infoName;
|
---|
| 128 | Double_t infoValue;
|
---|
| 129 |
|
---|
| 130 | size = param.GetSize();
|
---|
| 131 | for(i = 0; i < size / 2; ++i)
|
---|
| 132 | {
|
---|
| 133 | infoName = param[i * 2].GetString();
|
---|
| 134 | infoValue = param[i * 2 + 1].GetDouble();
|
---|
| 135 |
|
---|
| 136 | AddInfo(infoName, infoValue);
|
---|
| 137 | }
|
---|
[d7d2da3] | 138 | }
|
---|
| 139 |
|
---|
| 140 | //------------------------------------------------------------------------------
|
---|
| 141 |
|
---|
| 142 | void TreeWriter::Finish()
|
---|
| 143 | {
|
---|
| 144 | }
|
---|
| 145 |
|
---|
| 146 | //------------------------------------------------------------------------------
|
---|
| 147 |
|
---|
| 148 | void TreeWriter::FillParticles(Candidate *candidate, TRefArray *array)
|
---|
| 149 | {
|
---|
| 150 | TIter it1(candidate->GetCandidates());
|
---|
| 151 | it1.Reset();
|
---|
| 152 | array->Clear();
|
---|
[dc883b4] | 153 |
|
---|
[341014c] | 154 | while((candidate = static_cast<Candidate *>(it1.Next())))
|
---|
[d7d2da3] | 155 | {
|
---|
| 156 | TIter it2(candidate->GetCandidates());
|
---|
| 157 |
|
---|
| 158 | // particle
|
---|
| 159 | if(candidate->GetCandidates()->GetEntriesFast() == 0)
|
---|
| 160 | {
|
---|
| 161 | array->Add(candidate);
|
---|
| 162 | continue;
|
---|
| 163 | }
|
---|
| 164 |
|
---|
| 165 | // track
|
---|
[341014c] | 166 | candidate = static_cast<Candidate *>(candidate->GetCandidates()->At(0));
|
---|
[d7d2da3] | 167 | if(candidate->GetCandidates()->GetEntriesFast() == 0)
|
---|
| 168 | {
|
---|
| 169 | array->Add(candidate);
|
---|
| 170 | continue;
|
---|
| 171 | }
|
---|
| 172 |
|
---|
| 173 | // tower
|
---|
| 174 | it2.Reset();
|
---|
[341014c] | 175 | while((candidate = static_cast<Candidate *>(it2.Next())))
|
---|
[d7d2da3] | 176 | {
|
---|
| 177 | array->Add(candidate->GetCandidates()->At(0));
|
---|
| 178 | }
|
---|
| 179 | }
|
---|
| 180 | }
|
---|
| 181 |
|
---|
| 182 | //------------------------------------------------------------------------------
|
---|
| 183 |
|
---|
| 184 | void TreeWriter::ProcessParticles(ExRootTreeBranch *branch, TObjArray *array)
|
---|
| 185 | {
|
---|
| 186 | TIter iterator(array);
|
---|
| 187 | Candidate *candidate = 0;
|
---|
| 188 | GenParticle *entry = 0;
|
---|
| 189 | Double_t pt, signPz, cosTheta, eta, rapidity;
|
---|
[8f7db23] | 190 |
|
---|
[22dc7fd] | 191 | const Double_t c_light = 2.99792458E8;
|
---|
[8f7db23] | 192 |
|
---|
[d7d2da3] | 193 | // loop over all particles
|
---|
| 194 | iterator.Reset();
|
---|
[341014c] | 195 | while((candidate = static_cast<Candidate *>(iterator.Next())))
|
---|
[d7d2da3] | 196 | {
|
---|
| 197 | const TLorentzVector &momentum = candidate->Momentum;
|
---|
| 198 | const TLorentzVector &position = candidate->Position;
|
---|
| 199 |
|
---|
[341014c] | 200 | entry = static_cast<GenParticle *>(branch->NewEntry());
|
---|
[d7d2da3] | 201 |
|
---|
| 202 | entry->SetBit(kIsReferenced);
|
---|
| 203 | entry->SetUniqueID(candidate->GetUniqueID());
|
---|
| 204 |
|
---|
| 205 | pt = momentum.Pt();
|
---|
| 206 | cosTheta = TMath::Abs(momentum.CosTheta());
|
---|
| 207 | signPz = (momentum.Pz() >= 0.0) ? 1.0 : -1.0;
|
---|
[341014c] | 208 | eta = (cosTheta == 1.0 ? signPz * 999.9 : momentum.Eta());
|
---|
| 209 | rapidity = (cosTheta == 1.0 ? signPz * 999.9 : momentum.Rapidity());
|
---|
[d7d2da3] | 210 |
|
---|
| 211 | entry->PID = candidate->PID;
|
---|
| 212 |
|
---|
| 213 | entry->Status = candidate->Status;
|
---|
| 214 | entry->IsPU = candidate->IsPU;
|
---|
| 215 |
|
---|
| 216 | entry->M1 = candidate->M1;
|
---|
| 217 | entry->M2 = candidate->M2;
|
---|
| 218 |
|
---|
| 219 | entry->D1 = candidate->D1;
|
---|
| 220 | entry->D2 = candidate->D2;
|
---|
| 221 |
|
---|
| 222 | entry->Charge = candidate->Charge;
|
---|
| 223 | entry->Mass = candidate->Mass;
|
---|
| 224 |
|
---|
| 225 | entry->E = momentum.E();
|
---|
| 226 | entry->Px = momentum.Px();
|
---|
| 227 | entry->Py = momentum.Py();
|
---|
| 228 | entry->Pz = momentum.Pz();
|
---|
| 229 |
|
---|
| 230 | entry->Eta = eta;
|
---|
| 231 | entry->Phi = momentum.Phi();
|
---|
| 232 | entry->PT = pt;
|
---|
| 233 |
|
---|
| 234 | entry->Rapidity = rapidity;
|
---|
| 235 |
|
---|
| 236 | entry->X = position.X();
|
---|
| 237 | entry->Y = position.Y();
|
---|
| 238 | entry->Z = position.Z();
|
---|
[341014c] | 239 | entry->T = position.T() * 1.0E-3 / c_light;
|
---|
[d7d2da3] | 240 | }
|
---|
| 241 | }
|
---|
| 242 |
|
---|
| 243 | //------------------------------------------------------------------------------
|
---|
| 244 |
|
---|
[d07e957] | 245 | void TreeWriter::ProcessVertices(ExRootTreeBranch *branch, TObjArray *array)
|
---|
| 246 | {
|
---|
| 247 | TIter iterator(array);
|
---|
[5496767] | 248 | Candidate *candidate = 0, *constituent = 0;
|
---|
[d07e957] | 249 | Vertex *entry = 0;
|
---|
[8f7db23] | 250 |
|
---|
[22dc7fd] | 251 | const Double_t c_light = 2.99792458E8;
|
---|
[5496767] | 252 |
|
---|
[332025f] | 253 | Double_t x, y, z, t, xError, yError, zError, tError, sigma, sumPT2, btvSumPT2, genDeltaZ, genSumPT2;
|
---|
[2600216] | 254 | UInt_t index, ndf;
|
---|
[5496767] | 255 |
|
---|
[3e2bb2b] | 256 | CompBase *compare = Candidate::fgCompare;
|
---|
| 257 | Candidate::fgCompare = CompSumPT2<Candidate>::Instance();
|
---|
[3c46e17] | 258 | array->Sort();
|
---|
[3e2bb2b] | 259 | Candidate::fgCompare = compare;
|
---|
[5496767] | 260 |
|
---|
[d07e957] | 261 | // loop over all vertices
|
---|
| 262 | iterator.Reset();
|
---|
[341014c] | 263 | while((candidate = static_cast<Candidate *>(iterator.Next())))
|
---|
[d07e957] | 264 | {
|
---|
[5496767] | 265 |
|
---|
[2600216] | 266 | index = candidate->ClusterIndex;
|
---|
| 267 | ndf = candidate->ClusterNDF;
|
---|
| 268 | sigma = candidate->ClusterSigma;
|
---|
| 269 | sumPT2 = candidate->SumPT2;
|
---|
| 270 | btvSumPT2 = candidate->BTVSumPT2;
|
---|
| 271 | genDeltaZ = candidate->GenDeltaZ;
|
---|
| 272 | genSumPT2 = candidate->GenSumPT2;
|
---|
[5496767] | 273 |
|
---|
[7bcca65] | 274 | x = candidate->Position.X();
|
---|
| 275 | y = candidate->Position.Y();
|
---|
| 276 | z = candidate->Position.Z();
|
---|
[341014c] | 277 | t = candidate->Position.T() * 1.0E-3 / c_light;
|
---|
[5496767] | 278 |
|
---|
[341014c] | 279 | xError = candidate->PositionError.X();
|
---|
| 280 | yError = candidate->PositionError.Y();
|
---|
| 281 | zError = candidate->PositionError.Z();
|
---|
| 282 | tError = candidate->PositionError.T() * 1.0E-3 / c_light;
|
---|
[d07e957] | 283 |
|
---|
[341014c] | 284 | entry = static_cast<Vertex *>(branch->NewEntry());
|
---|
[d07e957] | 285 |
|
---|
[2600216] | 286 | entry->Index = index;
|
---|
| 287 | entry->NDF = ndf;
|
---|
| 288 | entry->Sigma = sigma;
|
---|
| 289 | entry->SumPT2 = sumPT2;
|
---|
| 290 | entry->BTVSumPT2 = btvSumPT2;
|
---|
| 291 | entry->GenDeltaZ = genDeltaZ;
|
---|
| 292 | entry->GenSumPT2 = genSumPT2;
|
---|
[5496767] | 293 |
|
---|
[2600216] | 294 | entry->X = x;
|
---|
| 295 | entry->Y = y;
|
---|
| 296 | entry->Z = z;
|
---|
| 297 | entry->T = t;
|
---|
[5496767] | 298 |
|
---|
[2600216] | 299 | entry->ErrorX = xError;
|
---|
| 300 | entry->ErrorY = yError;
|
---|
| 301 | entry->ErrorZ = zError;
|
---|
[332025f] | 302 | entry->ErrorT = tError;
|
---|
[5496767] | 303 |
|
---|
[3e2bb2b] | 304 | TIter itConstituents(candidate->GetCandidates());
|
---|
| 305 | itConstituents.Reset();
|
---|
| 306 | entry->Constituents.Clear();
|
---|
[341014c] | 307 | while((constituent = static_cast<Candidate *>(itConstituents.Next())))
|
---|
[5496767] | 308 | {
|
---|
| 309 | entry->Constituents.Add(constituent);
|
---|
| 310 | }
|
---|
[d07e957] | 311 | }
|
---|
| 312 | }
|
---|
| 313 |
|
---|
| 314 | //------------------------------------------------------------------------------
|
---|
| 315 |
|
---|
[d7d2da3] | 316 | void TreeWriter::ProcessTracks(ExRootTreeBranch *branch, TObjArray *array)
|
---|
| 317 | {
|
---|
| 318 | TIter iterator(array);
|
---|
| 319 | Candidate *candidate = 0;
|
---|
| 320 | Candidate *particle = 0;
|
---|
| 321 | Track *entry = 0;
|
---|
[2a3eb22] | 322 | Double_t pt, signz, cosTheta, eta, rapidity, p, ctgTheta, phi;
|
---|
[22dc7fd] | 323 | const Double_t c_light = 2.99792458E8;
|
---|
[8f7db23] | 324 |
|
---|
[d07e957] | 325 | // loop over all tracks
|
---|
[d7d2da3] | 326 | iterator.Reset();
|
---|
[341014c] | 327 | while((candidate = static_cast<Candidate *>(iterator.Next())))
|
---|
[d7d2da3] | 328 | {
|
---|
| 329 | const TLorentzVector &position = candidate->Position;
|
---|
| 330 |
|
---|
| 331 | cosTheta = TMath::Abs(position.CosTheta());
|
---|
| 332 | signz = (position.Pz() >= 0.0) ? 1.0 : -1.0;
|
---|
[341014c] | 333 | eta = (cosTheta == 1.0 ? signz * 999.9 : position.Eta());
|
---|
| 334 | rapidity = (cosTheta == 1.0 ? signz * 999.9 : position.Rapidity());
|
---|
[d7d2da3] | 335 |
|
---|
[341014c] | 336 | entry = static_cast<Track *>(branch->NewEntry());
|
---|
[d7d2da3] | 337 |
|
---|
| 338 | entry->SetBit(kIsReferenced);
|
---|
| 339 | entry->SetUniqueID(candidate->GetUniqueID());
|
---|
| 340 |
|
---|
| 341 | entry->PID = candidate->PID;
|
---|
| 342 |
|
---|
| 343 | entry->Charge = candidate->Charge;
|
---|
| 344 |
|
---|
| 345 | entry->EtaOuter = eta;
|
---|
| 346 | entry->PhiOuter = position.Phi();
|
---|
| 347 |
|
---|
| 348 | entry->XOuter = position.X();
|
---|
| 349 | entry->YOuter = position.Y();
|
---|
| 350 | entry->ZOuter = position.Z();
|
---|
[341014c] | 351 | entry->TOuter = position.T() * 1.0E-3 / c_light;
|
---|
[5496767] | 352 |
|
---|
[acd0621] | 353 | entry->L = candidate->L;
|
---|
[5496767] | 354 |
|
---|
[341014c] | 355 | entry->D0 = candidate->D0;
|
---|
| 356 | entry->DZ = candidate->DZ;
|
---|
[2a3eb22] | 357 |
|
---|
[341014c] | 358 | entry->ErrorP = candidate->ErrorP;
|
---|
| 359 | entry->ErrorPT = candidate->ErrorPT;
|
---|
[2671df6] | 360 |
|
---|
| 361 | // diagonal covariance matrix terms
|
---|
| 362 | entry->ErrorD0 = candidate->ErrorD0;
|
---|
| 363 | entry->ErrorC = candidate->ErrorC;
|
---|
[341014c] | 364 | entry->ErrorPhi = candidate->ErrorPhi;
|
---|
[2671df6] | 365 | entry->ErrorDZ = candidate->ErrorDZ;
|
---|
| 366 | entry->ErrorCtgTheta = candidate->ErrorCtgTheta;
|
---|
| 367 |
|
---|
| 368 | // add some offdiagonal covariance matrix elements
|
---|
| 369 | entry->ErrorD0Phi = candidate->TrackCovariance(0,1);
|
---|
| 370 | entry->ErrorD0C = candidate->TrackCovariance(0,2);
|
---|
| 371 | entry->ErrorD0DZ = candidate->TrackCovariance(0,3);
|
---|
| 372 | entry->ErrorD0CtgTheta = candidate->TrackCovariance(0,4);
|
---|
| 373 | entry->ErrorPhiC = candidate->TrackCovariance(1,2);
|
---|
| 374 | entry->ErrorPhiDZ = candidate->TrackCovariance(1,3);
|
---|
| 375 | entry->ErrorPhiCtgTheta = candidate->TrackCovariance(1,4);
|
---|
| 376 | entry->ErrorCDZ = candidate->TrackCovariance(2,3);
|
---|
| 377 | entry->ErrorCCtgTheta = candidate->TrackCovariance(2,4);
|
---|
| 378 | entry->ErrorDZCtgTheta = candidate->TrackCovariance(3,4);
|
---|
[5496767] | 379 |
|
---|
[e4c3fef] | 380 | entry->Xd = candidate->Xd;
|
---|
| 381 | entry->Yd = candidate->Yd;
|
---|
| 382 | entry->Zd = candidate->Zd;
|
---|
[9040259] | 383 |
|
---|
[d7d2da3] | 384 | const TLorentzVector &momentum = candidate->Momentum;
|
---|
| 385 |
|
---|
| 386 | pt = momentum.Pt();
|
---|
[2a3eb22] | 387 | p = momentum.P();
|
---|
| 388 | phi = momentum.Phi();
|
---|
[341014c] | 389 | ctgTheta = (TMath::Tan(momentum.Theta()) != 0) ? 1 / TMath::Tan(momentum.Theta()) : 1e10;
|
---|
[2a3eb22] | 390 |
|
---|
[d7d2da3] | 391 | cosTheta = TMath::Abs(momentum.CosTheta());
|
---|
| 392 | signz = (momentum.Pz() >= 0.0) ? 1.0 : -1.0;
|
---|
[341014c] | 393 | eta = (cosTheta == 1.0 ? signz * 999.9 : momentum.Eta());
|
---|
| 394 | rapidity = (cosTheta == 1.0 ? signz * 999.9 : momentum.Rapidity());
|
---|
[d7d2da3] | 395 |
|
---|
[c1ea422] | 396 | entry->P = p;
|
---|
[341014c] | 397 | entry->PT = pt;
|
---|
[d7d2da3] | 398 | entry->Eta = eta;
|
---|
[2a3eb22] | 399 | entry->Phi = phi;
|
---|
| 400 | entry->CtgTheta = ctgTheta;
|
---|
[17cd992] | 401 | entry->C = candidate->C;
|
---|
[5496767] | 402 |
|
---|
[341014c] | 403 | particle = static_cast<Candidate *>(candidate->GetCandidates()->At(0));
|
---|
[d7d2da3] | 404 | const TLorentzVector &initialPosition = particle->Position;
|
---|
| 405 |
|
---|
| 406 | entry->X = initialPosition.X();
|
---|
| 407 | entry->Y = initialPosition.Y();
|
---|
| 408 | entry->Z = initialPosition.Z();
|
---|
[341014c] | 409 | entry->T = initialPosition.T() * 1.0E-3 / c_light;
|
---|
[d7d2da3] | 410 |
|
---|
| 411 | entry->Particle = particle;
|
---|
[2600216] | 412 |
|
---|
| 413 | entry->VertexIndex = candidate->ClusterIndex;
|
---|
[d7d2da3] | 414 | }
|
---|
| 415 | }
|
---|
| 416 |
|
---|
| 417 | //------------------------------------------------------------------------------
|
---|
| 418 |
|
---|
| 419 | void TreeWriter::ProcessTowers(ExRootTreeBranch *branch, TObjArray *array)
|
---|
| 420 | {
|
---|
| 421 | TIter iterator(array);
|
---|
| 422 | Candidate *candidate = 0;
|
---|
| 423 | Tower *entry = 0;
|
---|
| 424 | Double_t pt, signPz, cosTheta, eta, rapidity;
|
---|
[22dc7fd] | 425 | const Double_t c_light = 2.99792458E8;
|
---|
[8f7db23] | 426 |
|
---|
[d07e957] | 427 | // loop over all towers
|
---|
[d7d2da3] | 428 | iterator.Reset();
|
---|
[341014c] | 429 | while((candidate = static_cast<Candidate *>(iterator.Next())))
|
---|
[d7d2da3] | 430 | {
|
---|
| 431 | const TLorentzVector &momentum = candidate->Momentum;
|
---|
[22dc7fd] | 432 | const TLorentzVector &position = candidate->Position;
|
---|
[8f7db23] | 433 |
|
---|
[d7d2da3] | 434 | pt = momentum.Pt();
|
---|
| 435 | cosTheta = TMath::Abs(momentum.CosTheta());
|
---|
| 436 | signPz = (momentum.Pz() >= 0.0) ? 1.0 : -1.0;
|
---|
[341014c] | 437 | eta = (cosTheta == 1.0 ? signPz * 999.9 : momentum.Eta());
|
---|
| 438 | rapidity = (cosTheta == 1.0 ? signPz * 999.9 : momentum.Rapidity());
|
---|
[d7d2da3] | 439 |
|
---|
[341014c] | 440 | entry = static_cast<Tower *>(branch->NewEntry());
|
---|
[d7d2da3] | 441 |
|
---|
| 442 | entry->SetBit(kIsReferenced);
|
---|
| 443 | entry->SetUniqueID(candidate->GetUniqueID());
|
---|
| 444 |
|
---|
| 445 | entry->Eta = eta;
|
---|
| 446 | entry->Phi = momentum.Phi();
|
---|
| 447 | entry->ET = pt;
|
---|
| 448 | entry->E = momentum.E();
|
---|
| 449 | entry->Eem = candidate->Eem;
|
---|
| 450 | entry->Ehad = candidate->Ehad;
|
---|
| 451 | entry->Edges[0] = candidate->Edges[0];
|
---|
| 452 | entry->Edges[1] = candidate->Edges[1];
|
---|
| 453 | entry->Edges[2] = candidate->Edges[2];
|
---|
| 454 | entry->Edges[3] = candidate->Edges[3];
|
---|
[8f7db23] | 455 |
|
---|
[341014c] | 456 | entry->T = position.T() * 1.0E-3 / c_light;
|
---|
[839deb7] | 457 | entry->NTimeHits = candidate->NTimeHits;
|
---|
[8f7db23] | 458 |
|
---|
[d7d2da3] | 459 | FillParticles(candidate, &entry->Particles);
|
---|
| 460 | }
|
---|
| 461 | }
|
---|
| 462 |
|
---|
| 463 | //------------------------------------------------------------------------------
|
---|
| 464 |
|
---|
[4d7014e] | 465 | void TreeWriter::ProcessParticleFlowCandidates(ExRootTreeBranch *branch, TObjArray *array)
|
---|
| 466 | {
|
---|
| 467 |
|
---|
| 468 | TIter iterator(array);
|
---|
| 469 | Candidate *candidate = 0;
|
---|
| 470 | Candidate *particle = 0;
|
---|
| 471 | ParticleFlowCandidate *entry = 0;
|
---|
| 472 | Double_t e, pt, signz, cosTheta, eta, rapidity, p, ctgTheta, phi;
|
---|
| 473 | const Double_t c_light = 2.99792458E8;
|
---|
| 474 |
|
---|
| 475 | // loop over all tracks
|
---|
| 476 | iterator.Reset();
|
---|
| 477 | while((candidate = static_cast<Candidate *>(iterator.Next())))
|
---|
| 478 | {
|
---|
| 479 | const TLorentzVector &position = candidate->Position;
|
---|
| 480 |
|
---|
| 481 | cosTheta = TMath::Abs(position.CosTheta());
|
---|
| 482 | signz = (position.Pz() >= 0.0) ? 1.0 : -1.0;
|
---|
| 483 | eta = (cosTheta == 1.0 ? signz * 999.9 : position.Eta());
|
---|
| 484 | rapidity = (cosTheta == 1.0 ? signz * 999.9 : position.Rapidity());
|
---|
| 485 |
|
---|
| 486 | entry = static_cast<ParticleFlowCandidate *>(branch->NewEntry());
|
---|
| 487 |
|
---|
| 488 | entry->SetBit(kIsReferenced);
|
---|
| 489 | entry->SetUniqueID(candidate->GetUniqueID());
|
---|
| 490 |
|
---|
| 491 | entry->PID = candidate->PID;
|
---|
| 492 |
|
---|
| 493 | entry->Charge = candidate->Charge;
|
---|
| 494 |
|
---|
| 495 | entry->EtaOuter = eta;
|
---|
| 496 | entry->PhiOuter = position.Phi();
|
---|
| 497 |
|
---|
| 498 | entry->XOuter = position.X();
|
---|
| 499 | entry->YOuter = position.Y();
|
---|
| 500 | entry->ZOuter = position.Z();
|
---|
| 501 | entry->TOuter = position.T() * 1.0E-3 / c_light;
|
---|
| 502 |
|
---|
| 503 | entry->L = candidate->L;
|
---|
| 504 |
|
---|
| 505 | entry->D0 = candidate->D0;
|
---|
| 506 | entry->DZ = candidate->DZ;
|
---|
| 507 |
|
---|
| 508 | entry->ErrorP = candidate->ErrorP;
|
---|
| 509 | entry->ErrorPT = candidate->ErrorPT;
|
---|
| 510 | entry->ErrorCtgTheta = candidate->ErrorCtgTheta;
|
---|
[2671df6] | 511 |
|
---|
| 512 |
|
---|
| 513 | // diagonal covariance matrix terms
|
---|
| 514 |
|
---|
| 515 | entry->ErrorD0 = candidate->ErrorD0;
|
---|
| 516 | entry->ErrorC = candidate->ErrorC;
|
---|
[4d7014e] | 517 | entry->ErrorPhi = candidate->ErrorPhi;
|
---|
[2671df6] | 518 | entry->ErrorDZ = candidate->ErrorDZ;
|
---|
| 519 | entry->ErrorCtgTheta = candidate->ErrorCtgTheta;
|
---|
| 520 |
|
---|
| 521 | // add some offdiagonal covariance matrix elements
|
---|
| 522 | entry->ErrorD0Phi = candidate->TrackCovariance(0,1);
|
---|
| 523 | entry->ErrorD0C = candidate->TrackCovariance(0,2);
|
---|
| 524 | entry->ErrorD0DZ = candidate->TrackCovariance(0,3);
|
---|
| 525 | entry->ErrorD0CtgTheta = candidate->TrackCovariance(0,4);
|
---|
| 526 | entry->ErrorPhiC = candidate->TrackCovariance(1,2);
|
---|
| 527 | entry->ErrorPhiDZ = candidate->TrackCovariance(1,3);
|
---|
| 528 | entry->ErrorPhiCtgTheta = candidate->TrackCovariance(1,4);
|
---|
| 529 | entry->ErrorCDZ = candidate->TrackCovariance(2,3);
|
---|
| 530 | entry->ErrorCCtgTheta = candidate->TrackCovariance(2,4);
|
---|
| 531 | entry->ErrorDZCtgTheta = candidate->TrackCovariance(3,4);
|
---|
| 532 |
|
---|
[4d7014e] | 533 | entry->Xd = candidate->Xd;
|
---|
| 534 | entry->Yd = candidate->Yd;
|
---|
| 535 | entry->Zd = candidate->Zd;
|
---|
| 536 |
|
---|
| 537 | const TLorentzVector &momentum = candidate->Momentum;
|
---|
| 538 |
|
---|
| 539 | e = momentum.E();
|
---|
| 540 | pt = momentum.Pt();
|
---|
| 541 | p = momentum.P();
|
---|
| 542 | phi = momentum.Phi();
|
---|
| 543 | ctgTheta = (TMath::Tan(momentum.Theta()) != 0) ? 1 / TMath::Tan(momentum.Theta()) : 1e10;
|
---|
| 544 |
|
---|
| 545 | entry->E = e;
|
---|
| 546 | entry->P = p;
|
---|
| 547 | entry->PT = pt;
|
---|
| 548 | entry->Eta = eta;
|
---|
| 549 | entry->Phi = phi;
|
---|
| 550 | entry->CtgTheta = ctgTheta;
|
---|
[17cd992] | 551 | entry->C = candidate->C;
|
---|
[dc883b4] | 552 |
|
---|
[4d7014e] | 553 | particle = static_cast<Candidate *>(candidate->GetCandidates()->At(0));
|
---|
| 554 | const TLorentzVector &initialPosition = particle->Position;
|
---|
| 555 |
|
---|
| 556 | entry->X = initialPosition.X();
|
---|
| 557 | entry->Y = initialPosition.Y();
|
---|
| 558 | entry->Z = initialPosition.Z();
|
---|
| 559 | entry->T = initialPosition.T() * 1.0E-3 / c_light;
|
---|
| 560 |
|
---|
| 561 | entry->VertexIndex = candidate->ClusterIndex;
|
---|
| 562 |
|
---|
| 563 | entry->Eem = candidate->Eem;
|
---|
| 564 | entry->Ehad = candidate->Ehad;
|
---|
| 565 | entry->Edges[0] = candidate->Edges[0];
|
---|
| 566 | entry->Edges[1] = candidate->Edges[1];
|
---|
| 567 | entry->Edges[2] = candidate->Edges[2];
|
---|
| 568 | entry->Edges[3] = candidate->Edges[3];
|
---|
| 569 |
|
---|
| 570 | entry->T = position.T() * 1.0E-3 / c_light;
|
---|
| 571 | entry->NTimeHits = candidate->NTimeHits;
|
---|
| 572 |
|
---|
| 573 | FillParticles(candidate, &entry->Particles);
|
---|
| 574 |
|
---|
| 575 | }
|
---|
| 576 | }
|
---|
| 577 |
|
---|
| 578 | //------------------------------------------------------------------------------
|
---|
| 579 |
|
---|
[d7d2da3] | 580 | void TreeWriter::ProcessPhotons(ExRootTreeBranch *branch, TObjArray *array)
|
---|
| 581 | {
|
---|
| 582 | TIter iterator(array);
|
---|
| 583 | Candidate *candidate = 0;
|
---|
| 584 | Photon *entry = 0;
|
---|
| 585 | Double_t pt, signPz, cosTheta, eta, rapidity;
|
---|
[22dc7fd] | 586 | const Double_t c_light = 2.99792458E8;
|
---|
[8f7db23] | 587 |
|
---|
[d7d2da3] | 588 | array->Sort();
|
---|
| 589 |
|
---|
| 590 | // loop over all photons
|
---|
| 591 | iterator.Reset();
|
---|
[341014c] | 592 | while((candidate = static_cast<Candidate *>(iterator.Next())))
|
---|
[d7d2da3] | 593 | {
|
---|
| 594 | TIter it1(candidate->GetCandidates());
|
---|
| 595 | const TLorentzVector &momentum = candidate->Momentum;
|
---|
[22dc7fd] | 596 | const TLorentzVector &position = candidate->Position;
|
---|
[8f7db23] | 597 |
|
---|
[d7d2da3] | 598 | pt = momentum.Pt();
|
---|
| 599 | cosTheta = TMath::Abs(momentum.CosTheta());
|
---|
| 600 | signPz = (momentum.Pz() >= 0.0) ? 1.0 : -1.0;
|
---|
[341014c] | 601 | eta = (cosTheta == 1.0 ? signPz * 999.9 : momentum.Eta());
|
---|
| 602 | rapidity = (cosTheta == 1.0 ? signPz * 999.9 : momentum.Rapidity());
|
---|
[d7d2da3] | 603 |
|
---|
[341014c] | 604 | entry = static_cast<Photon *>(branch->NewEntry());
|
---|
[d7d2da3] | 605 |
|
---|
| 606 | entry->Eta = eta;
|
---|
| 607 | entry->Phi = momentum.Phi();
|
---|
| 608 | entry->PT = pt;
|
---|
| 609 | entry->E = momentum.E();
|
---|
[341014c] | 610 | entry->T = position.T() * 1.0E-3 / c_light;
|
---|
[8f7db23] | 611 |
|
---|
[d5cae2b] | 612 | // Isolation variables
|
---|
[9040259] | 613 |
|
---|
[d5cae2b] | 614 | entry->IsolationVar = candidate->IsolationVar;
|
---|
[341014c] | 615 | entry->IsolationVarRhoCorr = candidate->IsolationVarRhoCorr;
|
---|
| 616 | entry->SumPtCharged = candidate->SumPtCharged;
|
---|
| 617 | entry->SumPtNeutral = candidate->SumPtNeutral;
|
---|
| 618 | entry->SumPtChargedPU = candidate->SumPtChargedPU;
|
---|
| 619 | entry->SumPt = candidate->SumPt;
|
---|
[d5cae2b] | 620 |
|
---|
[341014c] | 621 | entry->EhadOverEem = candidate->Eem > 0.0 ? candidate->Ehad / candidate->Eem : 999.9;
|
---|
[d7d2da3] | 622 |
|
---|
[0e0f211] | 623 | // 1: prompt -- 2: non prompt -- 3: fake
|
---|
| 624 | entry->Status = candidate->Status;
|
---|
| 625 |
|
---|
[d7d2da3] | 626 | FillParticles(candidate, &entry->Particles);
|
---|
| 627 | }
|
---|
| 628 | }
|
---|
| 629 |
|
---|
| 630 | //------------------------------------------------------------------------------
|
---|
| 631 |
|
---|
| 632 | void TreeWriter::ProcessElectrons(ExRootTreeBranch *branch, TObjArray *array)
|
---|
| 633 | {
|
---|
| 634 | TIter iterator(array);
|
---|
| 635 | Candidate *candidate = 0;
|
---|
| 636 | Electron *entry = 0;
|
---|
| 637 | Double_t pt, signPz, cosTheta, eta, rapidity;
|
---|
[22dc7fd] | 638 | const Double_t c_light = 2.99792458E8;
|
---|
[8f7db23] | 639 |
|
---|
[d7d2da3] | 640 | array->Sort();
|
---|
| 641 |
|
---|
| 642 | // loop over all electrons
|
---|
| 643 | iterator.Reset();
|
---|
[341014c] | 644 | while((candidate = static_cast<Candidate *>(iterator.Next())))
|
---|
[d7d2da3] | 645 | {
|
---|
| 646 | const TLorentzVector &momentum = candidate->Momentum;
|
---|
[22dc7fd] | 647 | const TLorentzVector &position = candidate->Position;
|
---|
[8f7db23] | 648 |
|
---|
[d7d2da3] | 649 | pt = momentum.Pt();
|
---|
| 650 | cosTheta = TMath::Abs(momentum.CosTheta());
|
---|
| 651 | signPz = (momentum.Pz() >= 0.0) ? 1.0 : -1.0;
|
---|
[341014c] | 652 | eta = (cosTheta == 1.0 ? signPz * 999.9 : momentum.Eta());
|
---|
| 653 | rapidity = (cosTheta == 1.0 ? signPz * 999.9 : momentum.Rapidity());
|
---|
[d7d2da3] | 654 |
|
---|
[341014c] | 655 | entry = static_cast<Electron *>(branch->NewEntry());
|
---|
[d7d2da3] | 656 |
|
---|
| 657 | entry->Eta = eta;
|
---|
| 658 | entry->Phi = momentum.Phi();
|
---|
| 659 | entry->PT = pt;
|
---|
[8f7db23] | 660 |
|
---|
[341014c] | 661 | entry->T = position.T() * 1.0E-3 / c_light;
|
---|
[8f7db23] | 662 |
|
---|
[0518688] | 663 | // displacement
|
---|
[341014c] | 664 | entry->D0 = candidate->D0;
|
---|
| 665 | entry->ErrorD0 = candidate->ErrorD0;
|
---|
| 666 | entry->DZ = candidate->DZ;
|
---|
| 667 | entry->ErrorDZ = candidate->ErrorDZ;
|
---|
[9040259] | 668 |
|
---|
[0518688] | 669 | // Isolation variables
|
---|
[d5cae2b] | 670 | entry->IsolationVar = candidate->IsolationVar;
|
---|
[341014c] | 671 | entry->IsolationVarRhoCorr = candidate->IsolationVarRhoCorr;
|
---|
| 672 | entry->SumPtCharged = candidate->SumPtCharged;
|
---|
| 673 | entry->SumPtNeutral = candidate->SumPtNeutral;
|
---|
| 674 | entry->SumPtChargedPU = candidate->SumPtChargedPU;
|
---|
| 675 | entry->SumPt = candidate->SumPt;
|
---|
[d5cae2b] | 676 |
|
---|
[d7d2da3] | 677 | entry->Charge = candidate->Charge;
|
---|
| 678 |
|
---|
| 679 | entry->EhadOverEem = 0.0;
|
---|
| 680 |
|
---|
| 681 | entry->Particle = candidate->GetCandidates()->At(0);
|
---|
| 682 | }
|
---|
| 683 | }
|
---|
| 684 |
|
---|
| 685 | //------------------------------------------------------------------------------
|
---|
| 686 |
|
---|
| 687 | void TreeWriter::ProcessMuons(ExRootTreeBranch *branch, TObjArray *array)
|
---|
| 688 | {
|
---|
| 689 | TIter iterator(array);
|
---|
| 690 | Candidate *candidate = 0;
|
---|
| 691 | Muon *entry = 0;
|
---|
| 692 | Double_t pt, signPz, cosTheta, eta, rapidity;
|
---|
[8f7db23] | 693 |
|
---|
[22dc7fd] | 694 | const Double_t c_light = 2.99792458E8;
|
---|
[8f7db23] | 695 |
|
---|
[d7d2da3] | 696 | array->Sort();
|
---|
| 697 |
|
---|
| 698 | // loop over all muons
|
---|
| 699 | iterator.Reset();
|
---|
[341014c] | 700 | while((candidate = static_cast<Candidate *>(iterator.Next())))
|
---|
[d7d2da3] | 701 | {
|
---|
| 702 | const TLorentzVector &momentum = candidate->Momentum;
|
---|
[22dc7fd] | 703 | const TLorentzVector &position = candidate->Position;
|
---|
[8f7db23] | 704 |
|
---|
[d7d2da3] | 705 | pt = momentum.Pt();
|
---|
| 706 | cosTheta = TMath::Abs(momentum.CosTheta());
|
---|
| 707 | signPz = (momentum.Pz() >= 0.0) ? 1.0 : -1.0;
|
---|
[341014c] | 708 | eta = (cosTheta == 1.0 ? signPz * 999.9 : momentum.Eta());
|
---|
| 709 | rapidity = (cosTheta == 1.0 ? signPz * 999.9 : momentum.Rapidity());
|
---|
[d7d2da3] | 710 |
|
---|
[341014c] | 711 | entry = static_cast<Muon *>(branch->NewEntry());
|
---|
[d7d2da3] | 712 |
|
---|
| 713 | entry->SetBit(kIsReferenced);
|
---|
| 714 | entry->SetUniqueID(candidate->GetUniqueID());
|
---|
| 715 |
|
---|
| 716 | entry->Eta = eta;
|
---|
| 717 | entry->Phi = momentum.Phi();
|
---|
| 718 | entry->PT = pt;
|
---|
| 719 |
|
---|
[341014c] | 720 | entry->T = position.T() * 1.0E-3 / c_light;
|
---|
[0518688] | 721 |
|
---|
| 722 | // displacement
|
---|
[341014c] | 723 | entry->D0 = candidate->D0;
|
---|
| 724 | entry->ErrorD0 = candidate->ErrorD0;
|
---|
| 725 | entry->DZ = candidate->DZ;
|
---|
| 726 | entry->ErrorDZ = candidate->ErrorDZ;
|
---|
[0518688] | 727 |
|
---|
[d5cae2b] | 728 | // Isolation variables
|
---|
[9040259] | 729 |
|
---|
[d5cae2b] | 730 | entry->IsolationVar = candidate->IsolationVar;
|
---|
[341014c] | 731 | entry->IsolationVarRhoCorr = candidate->IsolationVarRhoCorr;
|
---|
| 732 | entry->SumPtCharged = candidate->SumPtCharged;
|
---|
| 733 | entry->SumPtNeutral = candidate->SumPtNeutral;
|
---|
| 734 | entry->SumPtChargedPU = candidate->SumPtChargedPU;
|
---|
| 735 | entry->SumPt = candidate->SumPt;
|
---|
[8f7db23] | 736 |
|
---|
[d7d2da3] | 737 | entry->Charge = candidate->Charge;
|
---|
| 738 |
|
---|
| 739 | entry->Particle = candidate->GetCandidates()->At(0);
|
---|
| 740 | }
|
---|
| 741 | }
|
---|
| 742 |
|
---|
| 743 | //------------------------------------------------------------------------------
|
---|
| 744 |
|
---|
| 745 | void TreeWriter::ProcessJets(ExRootTreeBranch *branch, TObjArray *array)
|
---|
| 746 | {
|
---|
| 747 | TIter iterator(array);
|
---|
| 748 | Candidate *candidate = 0, *constituent = 0;
|
---|
| 749 | Jet *entry = 0;
|
---|
| 750 | Double_t pt, signPz, cosTheta, eta, rapidity;
|
---|
| 751 | Double_t ecalEnergy, hcalEnergy;
|
---|
[22dc7fd] | 752 | const Double_t c_light = 2.99792458E8;
|
---|
[de6d698] | 753 | Int_t i;
|
---|
[8f7db23] | 754 |
|
---|
[d7d2da3] | 755 | array->Sort();
|
---|
| 756 |
|
---|
| 757 | // loop over all jets
|
---|
| 758 | iterator.Reset();
|
---|
[341014c] | 759 | while((candidate = static_cast<Candidate *>(iterator.Next())))
|
---|
[d7d2da3] | 760 | {
|
---|
| 761 | TIter itConstituents(candidate->GetCandidates());
|
---|
[8f7db23] | 762 |
|
---|
[d7d2da3] | 763 | const TLorentzVector &momentum = candidate->Momentum;
|
---|
[22dc7fd] | 764 | const TLorentzVector &position = candidate->Position;
|
---|
[8f7db23] | 765 |
|
---|
[d7d2da3] | 766 | pt = momentum.Pt();
|
---|
| 767 | cosTheta = TMath::Abs(momentum.CosTheta());
|
---|
| 768 | signPz = (momentum.Pz() >= 0.0) ? 1.0 : -1.0;
|
---|
[341014c] | 769 | eta = (cosTheta == 1.0 ? signPz * 999.9 : momentum.Eta());
|
---|
| 770 | rapidity = (cosTheta == 1.0 ? signPz * 999.9 : momentum.Rapidity());
|
---|
[d7d2da3] | 771 |
|
---|
[341014c] | 772 | entry = static_cast<Jet *>(branch->NewEntry());
|
---|
[d7d2da3] | 773 |
|
---|
| 774 | entry->Eta = eta;
|
---|
| 775 | entry->Phi = momentum.Phi();
|
---|
| 776 | entry->PT = pt;
|
---|
| 777 |
|
---|
[341014c] | 778 | entry->T = position.T() * 1.0E-3 / c_light;
|
---|
[8f7db23] | 779 |
|
---|
[d7d2da3] | 780 | entry->Mass = momentum.M();
|
---|
| 781 |
|
---|
[ba1f1ee] | 782 | entry->Area = candidate->Area;
|
---|
| 783 |
|
---|
[d7d2da3] | 784 | entry->DeltaEta = candidate->DeltaEta;
|
---|
| 785 | entry->DeltaPhi = candidate->DeltaPhi;
|
---|
| 786 |
|
---|
[fe0273c] | 787 | entry->Flavor = candidate->Flavor;
|
---|
| 788 | entry->FlavorAlgo = candidate->FlavorAlgo;
|
---|
| 789 | entry->FlavorPhys = candidate->FlavorPhys;
|
---|
| 790 |
|
---|
[d7d2da3] | 791 | entry->BTag = candidate->BTag;
|
---|
[9040259] | 792 |
|
---|
| 793 | entry->BTagAlgo = candidate->BTagAlgo;
|
---|
[fe0273c] | 794 | entry->BTagPhys = candidate->BTagPhys;
|
---|
[9040259] | 795 |
|
---|
[d7d2da3] | 796 | entry->TauTag = candidate->TauTag;
|
---|
[7429c6a] | 797 | entry->TauWeight = candidate->TauWeight;
|
---|
[d7d2da3] | 798 |
|
---|
| 799 | entry->Charge = candidate->Charge;
|
---|
| 800 |
|
---|
| 801 | itConstituents.Reset();
|
---|
| 802 | entry->Constituents.Clear();
|
---|
| 803 | ecalEnergy = 0.0;
|
---|
| 804 | hcalEnergy = 0.0;
|
---|
[341014c] | 805 | while((constituent = static_cast<Candidate *>(itConstituents.Next())))
|
---|
[d7d2da3] | 806 | {
|
---|
| 807 | entry->Constituents.Add(constituent);
|
---|
| 808 | ecalEnergy += constituent->Eem;
|
---|
| 809 | hcalEnergy += constituent->Ehad;
|
---|
| 810 | }
|
---|
| 811 |
|
---|
[341014c] | 812 | entry->EhadOverEem = ecalEnergy > 0.0 ? hcalEnergy / ecalEnergy : 999.9;
|
---|
[8f7db23] | 813 |
|
---|
[24d005f] | 814 | //--- Pile-Up Jet ID variables ----
|
---|
| 815 |
|
---|
| 816 | entry->NCharged = candidate->NCharged;
|
---|
| 817 | entry->NNeutrals = candidate->NNeutrals;
|
---|
[c614dd7] | 818 |
|
---|
| 819 | entry->NeutralEnergyFraction = candidate->NeutralEnergyFraction;
|
---|
| 820 | entry->ChargedEnergyFraction = candidate->ChargedEnergyFraction;
|
---|
[24d005f] | 821 | entry->Beta = candidate->Beta;
|
---|
| 822 | entry->BetaStar = candidate->BetaStar;
|
---|
| 823 | entry->MeanSqDeltaR = candidate->MeanSqDeltaR;
|
---|
| 824 | entry->PTD = candidate->PTD;
|
---|
[9040259] | 825 |
|
---|
[de6d698] | 826 | //--- Sub-structure variables ----
|
---|
[9040259] | 827 |
|
---|
| 828 | entry->NSubJetsTrimmed = candidate->NSubJetsTrimmed;
|
---|
| 829 | entry->NSubJetsPruned = candidate->NSubJetsPruned;
|
---|
[de6d698] | 830 | entry->NSubJetsSoftDropped = candidate->NSubJetsSoftDropped;
|
---|
[9040259] | 831 |
|
---|
[341014c] | 832 | entry->SoftDroppedJet = candidate->SoftDroppedJet;
|
---|
| 833 | entry->SoftDroppedSubJet1 = candidate->SoftDroppedSubJet1;
|
---|
[ba75867] | 834 | entry->SoftDroppedSubJet2 = candidate->SoftDroppedSubJet2;
|
---|
| 835 |
|
---|
[de6d698] | 836 | for(i = 0; i < 5; i++)
|
---|
| 837 | {
|
---|
[341014c] | 838 | entry->FracPt[i] = candidate->FracPt[i];
|
---|
| 839 | entry->Tau[i] = candidate->Tau[i];
|
---|
| 840 | entry->TrimmedP4[i] = candidate->TrimmedP4[i];
|
---|
| 841 | entry->PrunedP4[i] = candidate->PrunedP4[i];
|
---|
| 842 | entry->SoftDroppedP4[i] = candidate->SoftDroppedP4[i];
|
---|
[de6d698] | 843 | }
|
---|
[9040259] | 844 |
|
---|
[e9c0d73] | 845 | //--- exclusive clustering variables ---
|
---|
| 846 | entry->ExclYmerge23 = candidate->ExclYmerge23;
|
---|
| 847 | entry->ExclYmerge34 = candidate->ExclYmerge34;
|
---|
| 848 | entry->ExclYmerge45 = candidate->ExclYmerge45;
|
---|
[341014c] | 849 | entry->ExclYmerge56 = candidate->ExclYmerge56;
|
---|
[e9c0d73] | 850 |
|
---|
[d7d2da3] | 851 | FillParticles(candidate, &entry->Particles);
|
---|
| 852 | }
|
---|
| 853 | }
|
---|
| 854 |
|
---|
| 855 | //------------------------------------------------------------------------------
|
---|
| 856 |
|
---|
| 857 | void TreeWriter::ProcessMissingET(ExRootTreeBranch *branch, TObjArray *array)
|
---|
| 858 | {
|
---|
| 859 | Candidate *candidate = 0;
|
---|
| 860 | MissingET *entry = 0;
|
---|
| 861 |
|
---|
| 862 | // get the first entry
|
---|
[341014c] | 863 | if((candidate = static_cast<Candidate *>(array->At(0))))
|
---|
[d7d2da3] | 864 | {
|
---|
| 865 | const TLorentzVector &momentum = candidate->Momentum;
|
---|
| 866 |
|
---|
[341014c] | 867 | entry = static_cast<MissingET *>(branch->NewEntry());
|
---|
[d7d2da3] | 868 |
|
---|
[3b465ca] | 869 | entry->Eta = (-momentum).Eta();
|
---|
[d7d2da3] | 870 | entry->Phi = (-momentum).Phi();
|
---|
| 871 | entry->MET = momentum.Pt();
|
---|
| 872 | }
|
---|
| 873 | }
|
---|
| 874 |
|
---|
| 875 | //------------------------------------------------------------------------------
|
---|
| 876 |
|
---|
| 877 | void TreeWriter::ProcessScalarHT(ExRootTreeBranch *branch, TObjArray *array)
|
---|
| 878 | {
|
---|
| 879 | Candidate *candidate = 0;
|
---|
| 880 | ScalarHT *entry = 0;
|
---|
| 881 |
|
---|
| 882 | // get the first entry
|
---|
[341014c] | 883 | if((candidate = static_cast<Candidate *>(array->At(0))))
|
---|
[d7d2da3] | 884 | {
|
---|
| 885 | const TLorentzVector &momentum = candidate->Momentum;
|
---|
| 886 |
|
---|
[341014c] | 887 | entry = static_cast<ScalarHT *>(branch->NewEntry());
|
---|
[d7d2da3] | 888 |
|
---|
| 889 | entry->HT = momentum.Pt();
|
---|
| 890 | }
|
---|
| 891 | }
|
---|
| 892 |
|
---|
| 893 | //------------------------------------------------------------------------------
|
---|
| 894 |
|
---|
[71648c2] | 895 | void TreeWriter::ProcessRho(ExRootTreeBranch *branch, TObjArray *array)
|
---|
| 896 | {
|
---|
[3b465ca] | 897 | TIter iterator(array);
|
---|
[71648c2] | 898 | Candidate *candidate = 0;
|
---|
| 899 | Rho *entry = 0;
|
---|
| 900 |
|
---|
[3b465ca] | 901 | // loop over all rho
|
---|
| 902 | iterator.Reset();
|
---|
[341014c] | 903 | while((candidate = static_cast<Candidate *>(iterator.Next())))
|
---|
[71648c2] | 904 | {
|
---|
| 905 | const TLorentzVector &momentum = candidate->Momentum;
|
---|
| 906 |
|
---|
[341014c] | 907 | entry = static_cast<Rho *>(branch->NewEntry());
|
---|
[71648c2] | 908 |
|
---|
[8608ef8] | 909 | entry->Rho = momentum.E();
|
---|
[3b465ca] | 910 | entry->Edges[0] = candidate->Edges[0];
|
---|
| 911 | entry->Edges[1] = candidate->Edges[1];
|
---|
[71648c2] | 912 | }
|
---|
| 913 | }
|
---|
| 914 |
|
---|
| 915 | //------------------------------------------------------------------------------
|
---|
| 916 |
|
---|
[2e229c9] | 917 | void TreeWriter::ProcessWeight(ExRootTreeBranch *branch, TObjArray *array)
|
---|
| 918 | {
|
---|
| 919 | Candidate *candidate = 0;
|
---|
| 920 | Weight *entry = 0;
|
---|
| 921 |
|
---|
| 922 | // get the first entry
|
---|
[341014c] | 923 | if((candidate = static_cast<Candidate *>(array->At(0))))
|
---|
[2e229c9] | 924 | {
|
---|
| 925 | const TLorentzVector &momentum = candidate->Momentum;
|
---|
| 926 |
|
---|
[341014c] | 927 | entry = static_cast<Weight *>(branch->NewEntry());
|
---|
[2e229c9] | 928 |
|
---|
| 929 | entry->Weight = momentum.E();
|
---|
| 930 | }
|
---|
| 931 | }
|
---|
| 932 |
|
---|
| 933 | //------------------------------------------------------------------------------
|
---|
| 934 |
|
---|
[8f7db23] | 935 | void TreeWriter::ProcessHectorHit(ExRootTreeBranch *branch, TObjArray *array)
|
---|
| 936 | {
|
---|
| 937 | TIter iterator(array);
|
---|
| 938 | Candidate *candidate = 0;
|
---|
| 939 | HectorHit *entry = 0;
|
---|
| 940 |
|
---|
| 941 | // loop over all roman pot hits
|
---|
| 942 | iterator.Reset();
|
---|
[341014c] | 943 | while((candidate = static_cast<Candidate *>(iterator.Next())))
|
---|
[8f7db23] | 944 | {
|
---|
| 945 | const TLorentzVector &position = candidate->Position;
|
---|
| 946 | const TLorentzVector &momentum = candidate->Momentum;
|
---|
| 947 |
|
---|
[341014c] | 948 | entry = static_cast<HectorHit *>(branch->NewEntry());
|
---|
[8f7db23] | 949 |
|
---|
| 950 | entry->E = momentum.E();
|
---|
| 951 |
|
---|
| 952 | entry->Tx = momentum.Px();
|
---|
| 953 | entry->Ty = momentum.Py();
|
---|
| 954 |
|
---|
| 955 | entry->T = position.T();
|
---|
| 956 |
|
---|
| 957 | entry->X = position.X();
|
---|
| 958 | entry->Y = position.Y();
|
---|
| 959 | entry->S = position.Z();
|
---|
[64a4950] | 960 |
|
---|
| 961 | entry->Particle = candidate->GetCandidates()->At(0);
|
---|
[8f7db23] | 962 | }
|
---|
| 963 | }
|
---|
| 964 |
|
---|
| 965 | //------------------------------------------------------------------------------
|
---|
| 966 |
|
---|
[d7d2da3] | 967 | void TreeWriter::Process()
|
---|
| 968 | {
|
---|
| 969 | TBranchMap::iterator itBranchMap;
|
---|
| 970 | ExRootTreeBranch *branch;
|
---|
| 971 | TProcessMethod method;
|
---|
| 972 | TObjArray *array;
|
---|
| 973 |
|
---|
| 974 | for(itBranchMap = fBranchMap.begin(); itBranchMap != fBranchMap.end(); ++itBranchMap)
|
---|
| 975 | {
|
---|
| 976 | branch = itBranchMap->first;
|
---|
| 977 | method = itBranchMap->second.first;
|
---|
| 978 | array = itBranchMap->second.second;
|
---|
| 979 |
|
---|
| 980 | (this->*method)(branch, array);
|
---|
| 981 | }
|
---|
| 982 | }
|
---|
| 983 |
|
---|
| 984 | //------------------------------------------------------------------------------
|
---|