AliPhysics  59e0e03 (59e0e03)
AliParticleMap.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-2015, ALICE Experiment at CERN, All rights reserved. *
3  * *
4  * Author: The ALICE Off-line Project. *
5  * Contributors are mentioned in the code where appropriate. *
6  * *
7  * Permission to use, copy, modify and distribute this software and its *
8  * documentation strictly for non-commercial purposes is hereby granted *
9  * without fee, provided that the above copyright notice appears in all *
10  * copies and that both the copyright notice and this permission notice *
11  * appear in the supporting documentation. The authors make no claims *
12  * about the suitability of this software for any purpose. It is *
13  * provided "as is" without express or implied warranty. *
14  **************************************************************************/
15 #include <iostream>
16 
17 #include <TMath.h>
18 
19 #include "AliVParticle.h"
20 #include "AliVTrack.h"
21 
22 #include "AliParticleMap.h"
23 
24 namespace HighPtTracks {
25 
30  for(std::map<int, AliParticleList *>::iterator it = fParticles.begin(); it != fParticles.end(); ++it){
31  delete it->second;
32  }
33 }
34 
41 void AliParticleMap::AddParticle(AliVTrack *track){
42  int label = TMath::Abs(track->GetLabel());
43  std::map<int, AliParticleList *>::iterator it = fParticles.find(label);
44  if(it == fParticles.end()){ // not existing
45  AliParticleList *nextparticle = new AliParticleList;
46  nextparticle->AddParticle(track);
47  fParticles.insert(std::pair<int, AliParticleList *>(label, nextparticle));
48  } else {
49  AliParticleList *mylist = it->second;
50  mylist->AddParticle(track);
51  }
52 }
53 
61  AliParticleList *result = NULL, *content = NULL;
62  std::map<int, AliParticleList *>::const_iterator found = fParticles.find(label);
63  if(found != fParticles.end()){
64  result = found->second;
65  }
66  return result;
67 }
68 
72 void AliParticleMap::Print() const {
73  for(std::map<int, AliParticleList *>::const_iterator it = fParticles.begin(); it != fParticles.end(); ++it){
74  std::cout << "Particle with label " << it->first << ", number of reconstructed assigned: " << it->second->GetNumberOfParticles() << std::endl;
75  }
76 }
77 
78 } /* namespace HighPtTracks */
void AddParticle(AliVTrack *track)
void AddParticle(AliVTrack *track)
std::map< int, AliParticleList * > fParticles
connection of particles to labels
AliParticleList * GetParticles(int label) const
Container of reconstructed particles.
Namespace for classes creating trees of events with jets.
Helper objects for mapping MC-particles to reconstructed particles.