AliRoot Core  edcc906 (edcc906)
AliEveTree.C
Go to the documentation of this file.
1 
22 #include "TFile.h"
23 #include "TTree.h"
24 #include "TTreeStream.h"
25 #include "TPolyMarker3D.h"
26 #include "TVectorD.h"
27 
28 #include "AliESDEvent.h"
29 #include "AliESDtrack.h"
30 #include "AliESDfriendTrack.h"
31 #include "AliTrackPointArray.h"
32 
33 
34 AliTrackPointArray* MakeArray(TPolyMarker3D *pol);
35 void MakeESDTree(AliESDEvent*esd, TTreeSRedirector &cstream);
36 
37 void MakeEveTree(){
38  TFile fesd("AliESDs.root");
39  TTree * esdTree = (TTree*)fesd.Get("esdTree");
40  AliESDEvent cesd;
41  esdTree->SetBranchStatus("*",kTRUE);
42  cesd.ReadFromTree(esdTree);
43  TTreeSRedirector cstream("eveTree.root");
44  for (Int_t ievent=0; ievent<esdTree->GetEntries();ievent++) {
45  //cout<<endl<<endl<<"********* Processing event number: "<<event<<"*******\n";
46  esdTree->GetEvent(ievent);
47  AliESDfriend *fESDfriend = (AliESDfriend*)cesd.FindListObject("AliESDfriend");
48  cesd.SetESDfriend(fESDfriend);
49  MakeESDTree(&cesd,cstream);
50  }
51 }
52 
53 
56 
57  Float_t bz = esd->GetMagneticField();
58  //AliTPCseed dummyTPC;
59  //AliTPCseed dummyTRD;
60  for (Int_t i=0;i<esd->GetNumberOfTracks(); i++){
61  AliESDtrack * track = esd->GetTrack(i);
62  if (!track) continue;
63  TPolyMarker3D polA;
64  TPolyMarker3D polV;
65  TPolyMarker3D polI;
66  TPolyMarker3D polO;
67  //
68  AliTrackPointArray * arrayA=0;
69  AliTrackPointArray * arrayV=0;
70  AliTrackPointArray * arrayI=0;
71  AliTrackPointArray * arrayO=0;
72  //
73  if (track->GetInnerParam()) {
74  ((AliExternalTrackParam*)track->GetInnerParam())->FillPolymarker(&polA,bz,0,350,1);}
75  else{
76  track->FillPolymarker(&polA,bz,0,300,5);
77  }
78  arrayA=MakeArray(&polA);
79  track->FillPolymarker(&polV,bz,0,60,1);
80  arrayV=MakeArray(&polV);
81  if (track->GetInnerParam()) {
82  ((AliExternalTrackParam*)track->GetInnerParam())->FillPolymarker(&polI,bz,60,170,1);
83  arrayI = MakeArray(&polI);
84  }
85  if (track->GetOuterParam()) {
86  ((AliExternalTrackParam*)track->GetOuterParam())->FillPolymarker(&polO,bz,170,350,1);
87  arrayO=MakeArray(&polO);
88  }
89  static AliTrackPointArray cldummy(5);
90  AliTrackPointArray *clarray= &cldummy;
91  const AliESDfriendTrack *ftrack = track->GetFriendTrack();
92  if (ftrack && ftrack->GetTrackPointArray()) {
93  clarray=(AliTrackPointArray *)ftrack->GetTrackPointArray();
94  }
95  Int_t event = esd->GetEventNumberInFile();
96  Int_t id = track->GetID();
97  cstream<<"Tracks"<<
98  "eventNr="<<event<<
99  "trackNr="<<id<<
100  "Tr.="<<track<<
101  "Cl.="<<clarray<<
102  //
103  "pA.="<<&polA<<
104  "pV.="<<&polV<<
105  "pI.="<<&polI<<
106  "pO.="<<&polO<<
107  //
108  "aA.="<<arrayA<<
109  "aV.="<<arrayV<<
110  "aI.="<<arrayI<<
111  "aO.="<<arrayO<<
112  "\n";
113  }
114 }
115 
116 
117 
118 AliTrackPointArray *MakeArray(TPolyMarker3D *pol){
120 
121  Int_t entries = pol->GetN();
123  for (Int_t i=0;i<entries;i++){
124  Double_t xyz[3]={0,0,0};
125  pol->GetPoint(i,xyz[0],xyz[1],xyz[2]);
126  ((Float_t*)array->GetX())[i]=xyz[0];
127  ((Float_t*)array->GetY())[i]=xyz[1];
128  ((Float_t*)array->GetZ())[i]=xyz[2];
129  }
130  return array;
131 }
132 
Double_t GetMagneticField() const
Definition: AliESDEvent.h:148
const AliExternalTrackParam * GetInnerParam() const
Definition: AliESDtrack.h:132
const AliExternalTrackParam * GetOuterParam() const
Definition: AliESDtrack.h:147
Int_t GetID() const
Definition: AliESDtrack.h:69
const Float_t * GetY() const
AliTPCfastTrack * track
TObjArray * array
Definition: AnalyzeLaser.C:12
void MakeEveTree()
Definition: AliEveTree.C:37
TObject * FindListObject(const char *name) const
const AliTrackPointArray * GetTrackPointArray() const
void SetESDfriend(const AliESDfriend *f) const
AliTrackPointArray * MakeArray(TPolyMarker3D *pol)
Definition: AliEveTree.C:118
void ReadFromTree(TTree *tree, Option_t *opt="")
void FillPolymarker(TPolyMarker3D *pol, Float_t magf, Float_t minR, Float_t maxR, Float_t stepR)
Int_t GetNumberOfTracks() const
Definition: AliESDEvent.h:536
AliESDtrack * GetTrack(Int_t i) const
Definition: AliESDEvent.h:405
const AliESDfriendTrack * GetFriendTrack() const
Definition: AliESDtrack.h:59
Int_t GetEventNumberInFile() const
Definition: AliESDEvent.h:224
void MakeESDTree(AliESDEvent *esd, TTreeSRedirector &cstream)
Definition: AliEveTree.C:54
const Float_t * GetZ() const
const Float_t * GetX() const