Int_t nKPlus = 0;
Int_t nKMinus = 0;
+// global arrays and pointers
+Float_t p[3];
+Float_t x[3];
+Float_t *cov = NULL; // set to NULL because not provided
+Float_t *pid = NULL; // set to NULL because not provided
+AliAODVertex *primary = NULL;
+AliAODVertex *secondary = NULL;
+AliAODTrack *currTrack = NULL;
+
void CreateAODfromKineTree(const char *inFileName,
const char *outFileName) {
printf("This macro works only correctly in comiled mode!\n");
TFile *outFile = TFile::Open(outFileName, "RECREATE");
// create the tree
- TTree *aodTree = new TTree("AOD", "AliAOD tree");
+ TTree *aodTree = new TTree("aodTree", "AliAOD tree");
aodTree->Branch(aod->GetList());
AliRunLoader *runLoader;
nKPlus = 0;
nKMinus = 0;
- // create the header
- aod->AddHeader(new AliAODHeader(aliHeader->GetRun(),
- 0, // bunchX number
- 0, // orbit number
- nTracks,
- nPos,
- nNeg,
- -999, // mag. field
- -999., // muon mag. field
- -999., // centrality
- -999, // ZDCN1Energy
- -999, // ZDCP1Energy
- -999, // ZDCN2Energy
- -999, // ZDCP2Energy
- -999, // ZDCEMEnergy
- 0, // TriggerMask
- 0, // TriggerCluster
- 0)); // EventType
-
// Access to the header
AliAODHeader *header = aod->GetHeader();
+ Double_t emEnergy[2] = {-999., -999.};
+
+ // fill the header
+ *header = AliAODHeader(aliHeader->GetRun(),
+ 0, // bunchX number
+ 0, // orbit number
+ 0, // period number
+ nTracks,
+ nPos,
+ nNeg,
+ -999, // mag. field
+ -999., // muon mag. field
+ -999., // centrality
+ -999., // ZDCN1Energy
+ -999., // ZDCP1Energy
+ -999., // ZDCN2Energy
+ -999., // ZDCP2Energy
+ emEnergy, // emEnergy
+ 0, // TriggerMask
+ 0, // TriggerCluster
+ 0, // EventType
+ ""); // title
+
// Access to the AOD container of vertices
TClonesArray &vertices = *(aod->GetVertices());
jVertices=0;
aod->ResetStd(nTracks, 1);
- Float_t p[3];
- Float_t x[3];
- Float_t *covTr = NULL;
- Float_t *pid = NULL;
- AliAODVertex *primary = NULL;
- AliAODTrack* currTrack = NULL;
// track loop
for (Int_t iTrack = 0; iTrack < nPrims; ++iTrack) {
kTRUE,
x,
kFALSE,
- covTr,
+ cov,
(Short_t)-99,
0, // no ITSClusterMap
pid,
primary,
+ kFALSE, // no fit performed
kFALSE, // no fit preformed
AliAODTrack::kPrimary));
currTrack = (AliAODTrack*)tracks.Last();
TClonesArray &vertices = *(aod->GetVertices());
TClonesArray &tracks = *(aod->GetTracks());
- Float_t pSec[3];
- Float_t xSec[3];
- Float_t *covSec = NULL;
- Float_t *pidSec = NULL;
- AliAODVertex *secondary = NULL;
- AliAODTrack* currTrackSec = NULL;
-
for (Int_t iDaughter = mother->GetFirstDaughter(); iDaughter <= mother->GetLastDaughter(); iDaughter++) {
- TParticle *partSec = stack->Particle(iDaughter);
-
- pSec[0] = partSec->Px(); pSec[1] = partSec->Py(); pSec[2] = partSec->Pz();
- xSec[0] = partSec->Vx(); xSec[1] = partSec->Vy(); xSec[2] = partSec->Vz();
+ TParticle *part = stack->Particle(iDaughter);
+ p[0] = part->Px();
+ p[1] = part->Py();
+ p[2] = part->Pz();
+ x[0] = part->Vx();
+ x[1] = part->Vy();
+ x[2] = part->Vz();
if (iDaughter == mother->GetFirstDaughter()) {
// add secondary vertex
secondary = new(vertices[jVertices++])
- AliAODVertex(xSec, NULL, -999., tracks.Last(), AliAODVertex::kUndef);
+ AliAODVertex(x, NULL, -999., tracks.Last(), AliAODVertex::kUndef);
- SetVertexType(partSec, secondary);
+ SetVertexType(part, secondary);
}
// add secondary tracks
secondary->AddDaughter(new(tracks[jTracks++]) AliAODTrack(0, // ID
0, // label
- pSec,
+ p,
kTRUE,
- xSec,
+ x,
kFALSE,
- covSec,
+ cov,
(Short_t)-99,
0, // no cluster map available
- pidSec,
+ pid,
secondary,
kFALSE, // no fit performed
+ kFALSE, // no fit performed
AliAODTrack::kSecondary));
- currTrackSec = (AliAODTrack*)tracks.Last();
- SetChargeAndPID(partSec->GetPdgCode(), currTrackSec);
- if (currTrackSec->Charge() != -99) {
- if (currTrackSec->Charge() > 0) {
+ currTrack = (AliAODTrack*)tracks.Last();
+ SetChargeAndPID(part->GetPdgCode(), currTrack);
+ if (currTrack->Charge() != -99) {
+ if (currTrack->Charge() > 0) {
nPos++;
- } else if (currTrackSec->Charge() < 0) {
+ } else if (currTrack->Charge() < 0) {
nNeg++;
}
}
- LoopOverSecondaries(partSec);
+ LoopOverSecondaries(part);
}
return 1;
} else {