candidate->SetLabel(label);
if (label>-1) candidate->SetPdgCode(fPdgMother);
+ // check for gamma kf particle
+ label=AliDielectronMC::Instance()->GetLabelMotherWithPdg(candidate,22);
+ if (label>-1) {
+ candidate->SetGammaTracks(static_cast<AliVTrack*>(arrTracks1.UncheckedAt(itrack1)), fPdgLeg1,
+ static_cast<AliVTrack*>(arrTracks2.UncheckedAt(itrack2)), fPdgLeg2);
+ // should we set the pdgmothercode and the label
+ }
+
//pair cuts
UInt_t cutMask=fPairFilter.IsSelected(candidate);
///////////////////////////////////////////////////////////////////////////
#include <TObjArray.h>
-#include <TMap.h>
+#include <TExMap.h>
+#include <TProcessID.h>
#include <AliVTrack.h>
#include <AliESDtrack.h>
fArrTrackN(),
fArrVertex("AliAODVertex",1000),
fArrPairs("AliKFParticle",0),
- fMapStoredVertices(0x0),
fNTracksP(0),
fNTracksN(0),
fIsAOD(kFALSE),
- fEventData()
+ fEventData(),
+ fPID(0x0),
+ fPIDIndex(0)
{
//
// Default Constructor
fArrTrackN(),
fArrVertex("AliAODVertex",1000),
fArrPairs("AliKFParticle",0),
- fMapStoredVertices(0x0),
fNTracksP(0),
fNTracksN(0),
fIsAOD(kFALSE),
- fEventData()
+ fEventData(),
+ fPID(0x0),
+ fPIDIndex(0)
{
//
// Named Constructor
fArrTrackN.Delete();
fArrVertex.Delete();
fArrPairs.Delete();
-
- delete fMapStoredVertices;
}
//______________________________________________
fArrTrackN.Expand(arrN.GetSize());
}
+ TExMap mapStoredVertices;
+ fPIDIndex=TProcessID::GetPIDs()->IndexOf(fPID);
// fill particles
Int_t tracks=0;
for (Int_t itrack=0; itrack<arrP.GetEntriesFast(); ++itrack){
// most particles will be assiciated to the primary vertex ...
AliAODVertex *vtx=track->GetProdVertex();
AliAODVertex *cvertex = 0x0;
- if (fMapStoredVertices->FindObject(vtx)) {
- cvertex = (AliAODVertex*)fMapStoredVertices->GetValue(vtx);
- } else {
- if (fArrVertex.GetSize()<=fArrVertex.GetEntriesFast()) fArrVertex.Expand(2*fArrVertex.GetSize());
- if (vtx){
+ if (vtx){
+ cvertex = reinterpret_cast<AliAODVertex*>(mapStoredVertices.GetValue(reinterpret_cast<ULong64_t>(vtx)));
+ if (!cvertex) {
+ if (mapStoredVertices.Capacity()<=mapStoredVertices.GetSize()) mapStoredVertices.Expand(2*mapStoredVertices.GetSize());
+ if (fArrVertex.GetSize()<=fArrVertex.GetEntriesFast()) fArrVertex.Expand(2*fArrVertex.GetSize());
cvertex = new (fArrVertex[fArrVertex.GetEntriesFast()]) AliAODVertex(*vtx);
- fMapStoredVertices->Add(vtx,cvertex);
+ AssignID(cvertex);
+ mapStoredVertices.Add(reinterpret_cast<ULong64_t>(vtx),reinterpret_cast<ULong64_t>(cvertex));
}
}
ctrack->SetProdVertex(cvertex);
// most particles will be assiciated to the primary vertex ...
AliAODVertex *vtx=track->GetProdVertex();
AliAODVertex *cvertex = 0x0;
- if (fMapStoredVertices->FindObject(vtx)) {
- cvertex = (AliAODVertex*)fMapStoredVertices->GetValue(vtx);
- } else {
- if (fArrVertex.GetSize()<=fArrVertex.GetEntriesFast()) fArrVertex.Expand(2*fArrVertex.GetSize());
- if (vtx) {
+ if (vtx){
+ cvertex = reinterpret_cast<AliAODVertex*>(mapStoredVertices.GetValue(reinterpret_cast<ULong64_t>(vtx)));
+ if (!cvertex) {
+ if (mapStoredVertices.Capacity()<=mapStoredVertices.GetSize()) mapStoredVertices.Expand(2*mapStoredVertices.GetSize());
+ if (fArrVertex.GetSize()<=fArrVertex.GetEntriesFast()) fArrVertex.Expand(2*fArrVertex.GetSize());
cvertex = new (fArrVertex[fArrVertex.GetEntriesFast()]) AliAODVertex(*vtx);
- fMapStoredVertices->Add(vtx,cvertex);
+ AssignID(cvertex);
+ mapStoredVertices.Add(reinterpret_cast<ULong64_t>(vtx),reinterpret_cast<ULong64_t>(cvertex));
}
}
ctrack->SetProdVertex(cvertex);
}
fArrPairs.Clear(opt);
-
- if (fMapStoredVertices) fMapStoredVertices->Clear();
-
}
//______________________________________________
fArrTrackP.SetClass("AliAODTrack",1000);
fArrTrackN.SetClass("AliAODTrack",1000);
fIsAOD=kTRUE;
- if (!fMapStoredVertices) fMapStoredVertices=new TMap;
}
//______________________________________________
//
for (Int_t i=AliDielectronVarManager::kPairMax; i<AliDielectronVarManager::kNMaxValues;++i) fEventData[i]=data[i];
}
+
+//______________________________________________
+void AliDielectronEvent::AssignID(TObject *obj)
+{
+ //
+ // Custom function to assign a uid to an object with an own process id
+ // to avoid problems buffering the vertices
+ //
+ UInt_t uid=1;
+ if (fPID->GetObjects()) uid=fPID->GetObjects()->GetEntriesFast();
+ uid+=(fPIDIndex<<24);
+ obj->SetBit(kIsReferenced);
+ obj->SetUniqueID(uid);
+ fPID->PutObjectWithID(obj);
+}
class TObjArray;
-class TMap;
+class TProcessID;
class AliDielectronEvent : public TNamed {
public:
Int_t GetNTracksP() const { return fNTracksP; }
Int_t GetNTracksN() const { return fNTracksN; }
+
+ void SetProcessID(TProcessID *pid) { fPID=pid; }
+ const TProcessID* GetProcessID() { return fPID; }
virtual void Clear(Option_t *opt="C");
TClonesArray fArrPairs; //Pair array
- TMap *fMapStoredVertices;//! already buffered vertices in AOD
-
Int_t fNTracksP; //number of positive tracks
Int_t fNTracksN; //number of negative tracks
Double_t fEventData[AliDielectronVarManager::kNMaxValues]; // event informaion from the var manager
+ TProcessID *fPID; //! internal PID for references to buffered objects
+ UInt_t fPIDIndex; //! index of PID
+
AliDielectronEvent(const AliDielectronEvent &c);
AliDielectronEvent &operator=(const AliDielectronEvent &c);
+ void AssignID(TObject *obj);
ClassDef(AliDielectronEvent,1) // Dielectron Event
};
fAxes(kMaxCuts),
fMixType(kOSonly),
fMixIncomplete(kTRUE),
- fMoveToSameVertex(kFALSE)
+ fMoveToSameVertex(kFALSE),
+ fPID(0x0)
{
//
// Default Constructor
fAxes(kMaxCuts),
fMixType(kOSonly),
fMixIncomplete(kTRUE),
- fMoveToSameVertex(kFALSE)
+ fMoveToSameVertex(kFALSE),
+ fPID(0x0)
{
//
// Named Constructor
// Default Destructor
//
fAxes.Delete();
+ delete fPID;
}
//________________________________________________________________
if(ev->IsA() == AliAODEvent::Class()) event->SetAOD();
else event->SetESD();
+ event->SetProcessID(fPID);
event->SetTracks(*diele->GetTrackArray(0), *diele->GetTrackArray(1), *diele->GetPairArray(1));
event->SetEventData(values);
values+=Form("%.2f, ",(*bins)[irow]);
}
}
+
+ if (!fPID){
+ fPID=TProcessID::AddProcessID();
+ }
AliDebug(10,values.Data());
}
Bool_t fMixIncomplete; // whether to mix uncomplete bins at the end of the processing
Bool_t fMoveToSameVertex; //whether to move the mixed tracks to the same vertex position
-
+
+ TProcessID *fPID; //! internal PID for references to buffered objects
+
void DoMixing(TClonesArray &pool, AliDielectron *diele);
AliDielectronMixingHandler(const AliDielectronMixingHandler &c);
fD2+=kf1;
}
}
+//______________________________________________
+void AliDielectronPair::SetGammaTracks(AliVTrack * const particle1, Int_t pid1,
+ AliVTrack * const particle2, Int_t pid2)
+{
+ //
+ // Sort particles by pt, first particle larget Pt
+ // set AliKF daughters and a GAMMA pair
+ // refParticle1 and 2 are the original tracks. In the case of track rotation
+ // they are needed in the framework
+ //
+ fD1.Initialize();
+ fD2.Initialize();
+
+ AliKFParticle kf1(*particle1,pid1);
+ AliKFParticle kf2(*particle2,pid2);
+ fPair.ConstructGamma(kf1,kf2);
+
+ if (particle1->Pt()>particle2->Pt()){
+ fRefD1 = particle1;
+ fRefD2 = particle2;
+ fD1+=kf1;
+ fD2+=kf2;
+ } else {
+ fRefD1 = particle2;
+ fRefD2 = particle1;
+ fD1+=kf2;
+ fD2+=kf1;
+ }
+}
//______________________________________________
void AliDielectronPair::SetTracks(const AliKFParticle * const particle1,
void SetTracks(AliVTrack * const particle1, Int_t pid1,
AliVTrack * const particle2, Int_t pid2);
+ void SetGammaTracks(AliVTrack * const particle1, Int_t pid1,
+ AliVTrack * const particle2, Int_t pid2);
+
+
void SetTracks(const AliKFParticle * const particle1,
const AliKFParticle * const particle2,
AliVTrack * const refParticle1,