2 // Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
4 /**************************************************************************
5 * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. *
6 * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for *
7 * full copyright notice. *
8 **************************************************************************/
11 #include "AliEveVSDCreator.h"
14 #include <AliITSLoader.h>
15 #include <AliTPCTrackHitsV2.h>
18 #include <AliESDEvent.h>
20 #include <AliTPCclusterMI.h>
21 #include <AliTPCClustersRow.h>
22 #include <AliITSclusterV2.h>
23 #include <AliESDkink.h>
24 #include <AliESDtrack.h>
27 #include <AliRunLoader.h>
28 #include <AliTPCParam.h>
33 //______________________________________________________________________________
35 // Create VSD file from ALICE data.
37 ClassImp(AliEveVSDCreator)
39 AliEveVSDCreator::AliEveVSDCreator(const Text_t* name, const Text_t* title) :
54 // Particles not in ROOT's PDG database occuring in ALICE
55 AliPDG::AddParticlesToPdgDataBase();
57 TDatabasePDG *pdgDB = TDatabasePDG::Instance();
58 // const Int_t kspe=50000000;
59 const Int_t kion=10000000;
61 const Double_t kAu2Gev=0.9314943228;
62 const Double_t khSlash = 1.0545726663e-27;
63 const Double_t kErg2Gev = 1/1.6021773349e-3;
64 const Double_t khShGev = khSlash*kErg2Gev;
65 const Double_t kYear2Sec = 3600*24*365.25;
67 pdgDB->AddParticle("Deuteron","Deuteron",2*kAu2Gev+8.071e-3,kTRUE,
68 0,1,"Ion",kion+10020);
69 pdgDB->AddParticle("Triton","Triton",3*kAu2Gev+14.931e-3,kFALSE,
70 khShGev/(12.33*kYear2Sec),1,"Ion",kion+10030);
71 pdgDB->AddParticle("Alpha","Alpha",4*kAu2Gev+2.424e-3,kTRUE,
72 khShGev/(12.33*kYear2Sec),2,"Ion",kion+20040);
73 pdgDB->AddParticle("HE3","HE3",3*kAu2Gev+14.931e-3,kFALSE,
74 0,2,"Ion",kion+20030);
77 // AliKalmanTrack::SetConvConst(1);
80 /******************************************************************************/
82 void AliEveVSDCreator::CreateVSD(const Text_t* dataDir, Int_t event,
83 const Text_t* vsdFile)
85 // Create the VSD for specified data-directory and event.
86 // Result is stored in vsdFile.
88 // Needs to be extended to support conversion of multiple events.
90 static const TEveException kEH("AliEveVSDCreator::CreateVSD ");
95 string galiceFile (Form("%s/galice.root", fDataDir.Data()));
98 printf("%s opening %s \n", kEH.Data(), galiceFile.c_str());
100 if(gSystem->AccessPathName(galiceFile.c_str(), kReadPermission)) {
101 throw(kEH + "Can not read file '" + galiceFile + "'.");
103 fRunLoader = AliRunLoader::Open(galiceFile.c_str());
105 throw(kEH + "AliRunLoader::Open failed.");
107 fRunLoader->LoadgAlice();
108 Int_t status = fRunLoader->GetEvent(fEvent);
110 throw(kEH + Form("GetEvent(%d) failed, exit code %s.", fEvent, status));
113 printf("%s open seems ok. Now loading sim data.\n", kEH.Data());
115 fRunLoader->LoadHeader();
116 fRunLoader->LoadKinematics();
117 fRunLoader->LoadTrackRefs();
118 fRunLoader->LoadHits();
123 printf("%s opening output TEveVSD.\n", kEH.Data());
125 TFile* file = TFile::Open(vsdFile, "RECREATE", "ALICE VisualizationDataSummary");
126 fDirectory = new TDirectoryFile("Event0", "");
129 printf("%s creating trees now ...\n", kEH.Data());
134 printf("%s trees created, closing files.\n", kEH.Data());
143 // clean after the TEveVSD data was sucessfuly written
153 fRunLoader->UnloadAll();
156 delete gAlice; gAlice = 0;
161 printf("%s all done.\n", kEH.Data());
164 void AliEveVSDCreator::CreateTrees()
166 // Create and fill the output trees by calling all the
167 // ConvertXyzz() functions.
168 // Exceptions from individual functions are displayed as warnings.
170 static const TEveException kEH("AliEveVSDCreator::CreateTrees ");
173 throw(kEH + "output directory not set.");
177 printf("%sConvertKinematics.\n", kEH.Data());
179 } catch(TEveException& exc) { Warning(kEH, exc); }
183 printf("%sConvertHits.\n", kEH.Data());
185 } catch(TEveException& exc) { Warning(kEH, exc); }
189 printf("%sConvertClusters.\n", kEH.Data());
191 } catch(TEveException& exc) { Warning(kEH, exc); }
195 printf("%sConvertRecTracks.\n", kEH.Data());
197 } catch(TEveException& exc) {
198 Warning(exc, "skipping AliEveV0 extraction.");
199 goto end_esd_processing;
204 printf("%sConvertV0.\n", kEH.Data());
206 } catch(TEveException& exc) { Warning(kEH, exc); }
210 printf("%sConvertKinks.\n", kEH.Data());
212 } catch(TEveException& exc) { Warning(kEH, exc); }
218 printf("%sConvertGenInfo.\n", kEH.Data());
220 } catch(TEveException& exc) { Warning(kEH, exc); }
225 /******************************************************************************/
227 /******************************************************************************/
229 void AliEveVSDCreator::ConvertKinematics()
231 // Convert kinematics.
232 // Track references are not stored, they should be.
234 static const TEveException kEH("AliEveVSDCreator::ConvertKinematics ");
237 throw (kEH + "kinematics already converted");
239 AliStack* stack = fRunLoader->Stack();
241 throw(kEH + "stack is null.");
244 fTreeK = new TTree("Kinematics", "TParticles sorted by Label");
246 Int_t nentries = stack->GetNtrack();
247 std::vector<TEveMCTrack> vmc(nentries);
248 for (Int_t idx=0; idx<nentries; idx++) {
249 TParticle* tp = stack->Particle(idx);
251 vmc[idx].fLabel = idx;
254 // read track refrences
255 // functionality now in AliEveKineTools.
257 TTree* fTreeTR = fRunLoader->TreeTR();
260 Warning(kEH, "no TrackRefs; some data will not be available.");
262 TClonesArray* RunArrayTR = 0;
263 fTreeTR->SetBranchAddress("AliRun", &RunArrayTR);
265 Int_t nPrimaries = (Int_t) fTreeTR->GetEntries();
266 for (Int_t iPrimPart = 0; iPrimPart<nPrimaries; iPrimPart++) {
267 // printf("T0 fTreeTR->GetEntry(%d) \n",iPrimPart);
268 fTreeTR->GetEntry(iPrimPart);
269 // printf("END fTreeTR->GetEntry(%d) \n",iPrimPart);
271 for (Int_t iTrackRef = 0; iTrackRef < RunArrayTR->GetEntriesFast(); iTrackRef++) {
272 AliTrackReference *trackRef = (AliTrackReference*)RunArrayTR->At(iTrackRef);
273 Int_t track = trackRef->GetTrack();
274 if(track < nentries && track > 0){
275 TEveMCTrack& mct = vmc[track];
276 if(trackRef->TestBit(kNotDeleted)) {
278 mct.t_decay = trackRef->GetTime();
279 mct.V_decay.x = trackRef->X();
280 mct.V_decay.y = trackRef->Y();
281 mct.V_decay.z = trackRef->Z();
282 mct.P_decay.x = trackRef->Px();
283 mct.P_decay.y = trackRef->Py();
284 mct.P_decay.z = trackRef->Pz();
285 if(TMath::Abs(mct.GetPdgCode()) == 11)
286 mct.decayed = false; // a bug in TreeTR
294 fTreeK->Branch("K", "TEveMCTrack", &fpK, fBuffSize);
296 printf("sizeofvmc = %d\n", (Int_t) vmc.size());
297 for(std::vector<TEveMCTrack>::iterator k=vmc.begin(); k!=vmc.end(); ++k) {
298 TEveMCTrack& mct = *k;
302 Int_t mi = mct.fLabel;
304 while(m->GetMother(0) != -1) {
306 printf("cnt %d mi=%d, mo=%d\n", cnt, mi, m->GetMother(0));
308 mi = m->GetMother(0);
317 fTreeK->BuildIndex("label");
320 /******************************************************************************/
322 /******************************************************************************/
328 const char* fName; // Detector name.
329 const char* fHitbranch; // Name of branch containing hits.
330 unsigned char fDetidx; // Index identifying the detector internally.
333 Detector_t fgDetectors[] = {
334 { "ITS", "AliITShit", 0 },
335 { "TPC", "AliTPCTrackHitsV2", 1 },
336 { "TRD", "AliTRDhit", 2 },
337 { "TOF", "AliTOFhit", 3 }
338 // { "HMPID", "AliHMPIDhit", 4 },
343 /******************************************************************************/
345 void AliEveVSDCreator::ConvertHits()
348 // TPC hits are handled specially as they are compressed - only mayor
351 static const TEveException kEH("AliEveVSDCreator::ConvertHits ");
354 throw(kEH + "hits already converted.");
357 fTreeH = new TTree("Hits", "Combined detector hits.");
358 fTreeH->Branch("H", "TEveHit", &fpH, fBuffSize);
360 std::map<Int_t, Int_t> hmap;
361 // parameters for ITS, TPC hits filtering
362 Float_t x,y,z, x1,y1,z1;
363 Float_t tpcSqrRes = fTPCHitRes*fTPCHitRes;
364 Float_t trdSqrRes = fTRDHitRes*fTRDHitRes;
367 // load hits from the rest of detectors
368 while (fgDetectors[l].fName != 0)
370 Detector_t& det = fgDetectors[l++];
377 TTree* treeh = fRunLoader->GetTreeH(det.fName, false);
379 Warning(kEH, Form("no hits for %s.", det.fName));
382 AliTPCTrackHitsV2 hv2, *hv2p = &hv2;
383 treeh->SetBranchAddress("TPC2", &hv2p);
384 Int_t np = treeh->GetEntries();
385 for (Int_t i = 0; i < np; ++i)
388 Int_t evaIdx = np -i -1;
389 if (hv2.First() == 0) continue;
392 AliHit* ah = hv2.GetHit();
393 x1 = ah->X(); y1 = ah->Y(); z1 = ah->Z();
394 if ((x-x1)*(x-x1) + (y-y1)*(y-y1) + (z-z1)*(z-z1) > tpcSqrRes)
396 fH.fDetId = det.fDetidx;
398 fH.fLabel = ah->Track();
399 fH.fEvaLabel = evaIdx;
400 fH.fV.fX = x1; fH.fV.fY = y1; fH.fV.fZ = z1;
403 x = x1; y = y1; z = z1;
406 } while (hv2.Next());
408 // printf("%d entries in TPChits \n",count);
413 TTree* treeh = fRunLoader->GetTreeH(det.fName, false);
415 Warning(kEH, Form("no hits for %s.", det.fName));
418 TClonesArray *arr = new TClonesArray(det.fHitbranch);
419 treeh->SetBranchAddress(det.fName, &arr);
420 Int_t np = treeh->GetEntries();
421 // in TreeH files hits are grouped in clones arrays
422 // each eva particle has its own clone array
423 for (Int_t i = 0; i < np; ++i)
426 Int_t evaIdx = np -i -1;
427 Int_t nh=arr->GetEntriesFast();
429 // printf("%d entry %d hits for primary %d \n", i, nh, evaIdx);
430 for (Int_t j = 0; j < nh; ++j)
432 AliHit* aliHit = (AliHit*)arr->UncheckedAt(j);
433 fH.fDetId = det.fDetidx;
435 fH.fLabel = aliHit->GetTrack();
436 fH.fEvaLabel = evaIdx;
437 fH.fV.Set(aliHit->X(), aliHit->Y(), aliHit->Z());
438 if (det.fDetidx == 2)
440 x1=aliHit->X();y1=aliHit->Y();z1=aliHit->Z();
441 if ((x-x1)*(x-x1)+(y-y1)*(y-y1)+(z-z1)*(z-z1) < trdSqrRes) continue;
456 for(std::map<Int_t, Int_t>::iterator j=hmap.begin(); j!=hmap.end(); ++j)
458 GetGeninfo(j->first)->fNHits += j->second;
462 /******************************************************************************/
464 /******************************************************************************/
466 void AliEveVSDCreator::ConvertClusters()
470 // Only supported for ITS and TPC at the moment, see dedicated
471 // functions ConvertITSClusters() and ConvertTPCClusters().
473 // It should be possible now to do this in a general manner (with
474 // the alignment framework).
476 static const TEveException kEH("AliEveVSDCreator::ConvertClusters ");
479 throw(kEH + "clusters already converted.");
482 fTreeC = new TTree("Clusters", "rec clusters");
483 fTreeC->Branch("C", "TEveCluster", &fpC, fBuffSize);
486 ConvertITSClusters();
487 } catch(TEveException& exc) { Warning(kEH, exc); }
490 ConvertTPCClusters();
491 } catch(TEveException& exc) { Warning(kEH, exc); }
494 /******************************************************************************/
496 void AliEveVSDCreator::ConvertTPCClusters()
498 // Convert TPC clusters and transform them to global coordinates.
500 static const TEveException kEH("AliEveVSDCreator::ConvertTPCClusters ");
503 ( TFile::Open(Form("%s/TPC.RecPoints.root", fDataDir.Data())) );
505 throw(kEH + "can not open 'TPC.RecPoints.root' file.");
507 auto_ptr<TDirectory> d
508 ( (TDirectory*) f->Get(Form("Event%d", fEvent)) );
510 throw(kEH + Form("event directory '%d' not found.", 0));
512 auto_ptr<TTree> tree( (TTree*) d->Get("TreeR") );
514 throw(kEH + "'TreeR' not found.");
516 auto_ptr<AliTPCParam> par( GetTpcParam(kEH) );
518 AliTPCClustersRow clrow, *clrowp = &clrow;
520 clrow.SetClass("AliTPCclusterMI");
521 tree->SetBranchAddress("Segment", &clrowp);
525 Int_t nEnt = tree->GetEntries();
526 for (Int_t n = 0; n < nEnt; ++n)
529 nClusters += clrow.GetArray()->GetEntriesFast();
532 // calculate xyz for a cluster and add it to container
535 std::map<Int_t, Int_t> cmap;
537 for (Int_t n = 0; n < tree->GetEntries(); ++n)
540 Int_t ncl = clrow.GetArray()->GetEntriesFast();
544 par->AdjustSectorRow(clrow.GetID(),sec,row);
547 if (clrow.GetArray())
549 // cl = new AliTPCclusterMI(*(AliTPCclusterMI*)clrow.GetArray()->UncheckedAt(ncl));
550 cl = (AliTPCclusterMI*)clrow.GetArray()->UncheckedAt(ncl);
551 if (cl->GetLabel(0) >= 0)
553 x = par->GetPadRowRadii(sec,row); y = cl->GetY(); z = cl->GetZ();
554 par->AdjustCosSin(sec,cs,sn);
555 tmp = x*cs-y*sn; y= x*sn+y*cs; x=tmp;
559 fC.fLabel[0] = cl->GetLabel(0);
560 fC.fLabel[1] = cl->GetLabel(1);
561 fC.fLabel[2] = cl->GetLabel(2);
567 while (i < 3 && fC.fLabel[i])
568 cmap[fC.fLabel[i++]]++;
576 for (std::map<Int_t, Int_t>::iterator j=cmap.begin(); j!=cmap.end(); ++j)
578 GetGeninfo(j->first)->fNClus += j->second;
582 /******************************************************************************/
584 void AliEveVSDCreator::ConvertITSClusters()
586 // Convert ITS clusters and transform them to global coordinates.
588 static const TEveException kEH("AliEveVSDCreator::ConvertITSClusters ");
591 ( TFile::Open(Form("%s/ITS.RecPoints.root", fDataDir.Data())) );
593 throw(kEH + "can not open 'ITS.RecPoints.root' file.");
595 auto_ptr<TDirectory> d
596 ( (TDirectory*) f->Get(Form("Event%d", fEvent)) );
598 throw(kEH + Form("event directory '%d' not found.", 0));
600 auto_ptr<TTree> tree( (TTree*) d->Get("TreeR") );
602 throw(kEH + "'TreeR' not found.");
605 AliITSLoader *itsLd = (AliITSLoader*) fRunLoader->GetLoader("ITSLoader");
606 AliITSgeom *geom = itsLd->GetITSgeom();
608 //printf("alice ITS geom %p \n",geom );
611 throw(kEH + "can not find ITS geometry");
613 TClonesArray *arr = new TClonesArray("AliITSclusterV2");
614 tree->SetBranchAddress("Clusters", &arr);
615 Int_t nmods = tree->GetEntries();
617 std::map<Int_t, Int_t> cmap;
619 for (Int_t mod = 0; mod < nmods; ++mod)
622 Int_t nc=arr->GetEntriesFast();
623 for (Int_t j = 0; j < nc; ++j)
625 AliITSclusterV2* recp = (AliITSclusterV2*) arr->UncheckedAt(j);
628 geom->GetRotMatrix(mod,rot);
630 geom->GetModuleId(mod,lay,lad,det);
632 geom->GetTrans(lay,lad,det,tx,ty,tz);
634 Double_t alpha=TMath::ATan2(rot[1],rot[0])+TMath::Pi();
635 Double_t phi1=TMath::Pi()/2+alpha;
636 if (lay == 1) phi1+=TMath::Pi();
638 Float_t cp=TMath::Cos(phi1), sp=TMath::Sin(phi1);
639 Float_t r=tx*cp+ty*sp;
640 gc[0] = r*cp - recp->GetY()*sp;
641 gc[1] = r*sp + recp->GetY()*cp;
642 gc[2] = recp->GetZ();
646 fC.fLabel[0] = recp->GetLabel(0);
647 fC.fLabel[1] = recp->GetLabel(1);
648 fC.fLabel[2] = recp->GetLabel(2);
649 fC.fV.fX = r*cp - recp->GetY()*sp;
650 fC.fV.fY = r*sp + recp->GetY()*cp;
651 fC.fV.fZ = recp->GetZ();
654 while(i < 3 && fC.fLabel[i])
655 cmap[fC.fLabel[i++]]++;
659 for (std::map<Int_t, Int_t>::iterator j=cmap.begin(); j!=cmap.end(); ++j)
661 GetGeninfo(j->first)->fNClus += j->second;
667 /******************************************************************************/
669 /******************************************************************************/
671 void AliEveVSDCreator::ConvertRecTracks()
673 // Convert reconstructed tracks.
675 static const TEveException kEH("AliEveVSDCreator::ConvertRecTracks ");
678 throw(kEH + "tracks already converted.");
681 fTreeR = new TTree("RecTracks", "rec tracks");
683 fTreeR->Branch("R", "TEveRecTrack", &fpR, 512*1024,1);
685 TFile f(Form("%s/AliESDs.root", fDataDir.Data()));
687 throw(kEH + "no AliESDs.root file.");
689 TTree* tree = (TTree*) f.Get("esdTree");
691 throw(kEH + "no esdTree.");
694 AliESDEvent *esdEvent = new AliESDEvent();
695 esdEvent->ReadFromTree(tree);
696 tree->GetEntry(fEvent);
697 if (esdEvent->GetAliESDOld()) esdEvent->CopyFromOldESD();
700 // reconstructed tracks
701 AliESDtrack* esdTrack;
703 for (Int_t n = 0; n < esdEvent->GetNumberOfTracks(); ++n)
705 esdTrack = esdEvent->GetTrack(n);
707 fR.fLabel = esdTrack->GetLabel();
708 fR.fStatus = (Int_t) esdTrack->GetStatus();
709 fR.fSign = (Int_t) esdTrack->GetSign();
710 esdTrack->GetXYZ(dbuf); fR.fV.Set(dbuf);
711 esdTrack->GetPxPyPz(dbuf); fR.fP.Set(dbuf);
712 Double_t ep = esdTrack->GetP();
713 fR.fBeta = ep/TMath::Sqrt(ep*ep + TMath::C()*TMath::C()*esdTrack->GetMass()*esdTrack->GetMass());
716 fTreeR->BuildIndex("label");
720 /******************************************************************************/
722 void AliEveVSDCreator::ConvertV0()
724 // Convert reconstructed V0s.
726 static const TEveException kEH("AliEveVSDCreator::ConvertV0 ");
729 throw(kEH + "AliEveV0 already converted.");
732 fTreeV0 = new TTree("AliEveV0", "AliEveV0 points");
734 fTreeV0->Branch("AliEveV0", "TEveRecV0", &fpV0, 512*1024,1);
736 TFile f(Form("%s/AliESDs.root", fDataDir.Data()));
738 throw(kEH + "no AliESDs.root file.");
741 TTree* tree = (TTree*) f.Get("esdTree");
743 throw(kEH + "no esdTree.");
745 AliESDEvent *esdEvent= new AliESDEvent();
746 esdEvent->ReadFromTree(tree);
747 tree->GetEntry(fEvent);
748 if (esdEvent->GetAliESDOld()) esdEvent->CopyFromOldESD();
750 for (Int_t n = 0; n < esdEvent->GetNumberOfV0s(); ++n)
752 AliESDv0 *av = esdEvent->GetV0(n);
753 AliESDtrack *trackN = esdEvent->GetTrack(av->GetNindex()); // negative daughter
754 AliESDtrack *trackP = esdEvent->GetTrack(av->GetPindex()); // positive daughter
758 fV0.fStatus = av->GetStatus();
759 // Point of closest approach
760 av->GetXYZ(pos[0],pos[1],pos[2]);
761 fV0.fVCa.fX = pos[0];
762 fV0.fVCa.fY = pos[1];
763 fV0.fVCa.fZ = pos[2];
764 // set birth vertex of neutral particle
765 av->GetXYZ(pos[0], pos[1], pos[2]);
766 fV0.fV0Birth.Set(pos);
768 // momentum and position of negative particle
769 av->GetParamN()->GetPxPyPz(pos);
771 av->GetParamN()->GetXYZ(pos);
774 // momentum and position of positive particle
775 av->GetParamP()->GetPxPyPz(pos);
777 av->GetParamP()->GetXYZ(pos);
780 fV0.fLabel = 0; // !!!! mother label unknown
781 fV0.fPdg = av->GetPdgCode();
784 fV0.fDLabel[0] = TMath::Abs(trackN->GetLabel());
785 fV0.fDLabel[1] = TMath::Abs(trackP->GetLabel());
787 // printf("AliEveV0 convert labels(%d,%d) index(%d,%d)\n",
788 // fV0.d_label[0], fV0.d_label[1],
789 // av->GetNIndex(), av->GetPIndex());
793 // if (esdEvent->GetNumberOfV0s()) fTreeV0->BuildIndex("label");
797 /******************************************************************************/
799 void AliEveVSDCreator::ConvertKinks()
801 // Convert reconstructed kinks.
803 static const TEveException kEH("AliEveVSDCreator::ConvertKinks ");
806 throw(kEH + "Kinks already converted.");
809 fTreeKK = new TTree("Kinks", "ESD Kinks");
811 fTreeKK->Branch("KK", "TEveRecKink", &fpKK, fBuffSize);
813 TFile f(Form("%s/AliESDs.root", fDataDir.Data()));
815 throw(kEH + "no AliESDs.root file.");
818 TTree* tree = (TTree*) f.Get("esdTree");
820 throw(kEH + "no esdTree.");
823 AliESDEvent *esdEvent= new AliESDEvent();
824 esdEvent->ReadFromTree(tree);
825 tree->GetEntry(fEvent);
826 if (esdEvent->GetAliESDOld()) esdEvent->CopyFromOldESD();
828 // printf("CONVERT KINK Read %d entries in tree kinks \n", esdEvent->GetNumberOfKinks());
829 for (Int_t n = 0; n < esdEvent->GetNumberOfKinks(); ++n)
831 AliESDkink* kk = esdEvent->GetKink(n);
835 fKK.fLabel = kk->GetLabel(0);
836 fKK.fStatus = 0; // status is Char_t[12] ... have no idea how/what to extract.
838 // reconstructed kink position
839 fKK.fLabelSec = kk->GetLabel(1);
840 fKK.fVKink.Set(kk->GetPosition());
842 const AliExternalTrackParam& tpMother = kk->RefParamMother();
843 // momentum and position of mother
844 tpMother.GetPxPyPz(pos);
846 tpMother.GetXYZ(pos);
848 const Double_t* par = tpMother.GetParameter();
849 // printf("KINK Pt %f, %f \n",1/tpMother.Pt(),par[4] );
850 fKK.fSign = (par[4] < 0) ? -1 : 1;
852 const AliExternalTrackParam& tpDaughter = kk->RefParamDaughter();
853 // momentum and position of daughter
854 tpDaughter.GetPxPyPz(pos);
856 tpDaughter.GetXYZ(pos);
861 if (esdEvent->GetNumberOfKinks()) fTreeKK->BuildIndex("label");
864 /******************************************************************************/
866 /******************************************************************************/
868 void AliEveVSDCreator::ConvertGenInfo()
870 // Build simulation-reconstruction cross-reference table.
871 // In a rather poor state at the moment.
873 static const TEveException kEH("AliEveVSDCreator::ConvertGenInfo ");
876 throw(kEH + "GI already converted.");
879 fTreeGI = new TTree("TEveMCRecCrossRef", "Objects prepared for cross querry");
881 TEveMCRecCrossRef::Class()->IgnoreTObjectStreamer(true);
882 fTreeGI->Branch("GI", "TEveMCRecCrossRef", &fpGI, fBuffSize);
883 fTreeGI->Branch("K.", "TEveMCTrack", &fpK);
884 fTreeGI->Branch("R.", "TEveRecTrack", &fpR);
886 for (std::map<Int_t, TEveMCRecCrossRef*>::iterator j=fGenInfoMap.begin(); j!=fGenInfoMap.end(); ++j) {
888 fGI.fLabel = j->first;
889 fTreeK->GetEntry(j->first);
892 Int_t re = fTreeR->GetEntryNumberWithIndex(j->first);
896 // Int_t hasV0 = fTreeV0->GetEntryNumberWithIndex(j->first);
898 // fGI.has_AliEveV0 = true;
900 Int_t hasKk = fTreeKK->GetEntryNumberWithIndex(j->first);
909 /******************************************************************************/
910 /******************************************************************************/
912 /******************************************************************************/
913 /******************************************************************************/
915 AliTPCParam* AliEveVSDCreator::GetTpcParam(const TEveException& eh)
917 // Return TPC parameters, needed for local-global transformation of
920 auto_ptr<TFile> fp( TFile::Open(Form("%s/galice.root", fDataDir.Data())) );
922 throw(eh + "can not open 'galice.root' file.");
923 AliTPCParam* par = (AliTPCParam *) fp->Get("75x40_100x60_150x60");
925 throw(eh + "TPC data not found.");
929 TEveMCRecCrossRef* AliEveVSDCreator::GetGeninfo(Int_t label)
931 // Return the cross-reference structure for given label.
932 // If the object does not exist it is created.
934 // printf("get_geninfo %d\n", label);
935 TEveMCRecCrossRef* gi;
936 std::map<Int_t, TEveMCRecCrossRef*>::iterator i = fGenInfoMap.find(label);
937 if (i == fGenInfoMap.end()) {
938 gi = new TEveMCRecCrossRef();
939 fGenInfoMap[label] = gi;