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 **************************************************************************/
10 #include "AliEveVSDCreator.h"
12 #include <TEveTreeTools.h>
15 #include <AliITSLoader.h>
16 #include <AliTPCTrackHitsV2.h>
19 #include <AliSimDigits.h>
20 #include <AliKalmanTrack.h>
21 #include <AliESDEvent.h>
23 #include <AliTPCclusterMI.h>
24 #include <AliTPCClustersRow.h>
26 #include <AliITSclusterV2.h>
27 #include <AliTrackReference.h>
28 #include <AliESDkink.h>
29 #include <AliESDtrack.h>
32 #include <AliTPCParam.h>
38 //______________________________________________________________________________
40 // Create VSD file from ALICE data.
42 ClassImp(AliEveVSDCreator)
44 AliEveVSDCreator::AliEveVSDCreator(const Text_t* name, const Text_t* title) :
59 // Particles not in ROOT's PDG database occuring in ALICE
60 AliPDG::AddParticlesToPdgDataBase();
62 TDatabasePDG *pdgDB = TDatabasePDG::Instance();
63 // const Int_t kspe=50000000;
64 const Int_t kion=10000000;
66 const Double_t kAu2Gev=0.9314943228;
67 const Double_t khSlash = 1.0545726663e-27;
68 const Double_t kErg2Gev = 1/1.6021773349e-3;
69 const Double_t khShGev = khSlash*kErg2Gev;
70 const Double_t kYear2Sec = 3600*24*365.25;
72 pdgDB->AddParticle("Deuteron","Deuteron",2*kAu2Gev+8.071e-3,kTRUE,
73 0,1,"Ion",kion+10020);
74 pdgDB->AddParticle("Triton","Triton",3*kAu2Gev+14.931e-3,kFALSE,
75 khShGev/(12.33*kYear2Sec),1,"Ion",kion+10030);
76 pdgDB->AddParticle("Alpha","Alpha",4*kAu2Gev+2.424e-3,kTRUE,
77 khShGev/(12.33*kYear2Sec),2,"Ion",kion+20040);
78 pdgDB->AddParticle("HE3","HE3",3*kAu2Gev+14.931e-3,kFALSE,
79 0,2,"Ion",kion+20030);
82 // AliKalmanTrack::SetConvConst(1);
85 /******************************************************************************/
87 void AliEveVSDCreator::CreateVSD(const Text_t* dataDir, Int_t event,
88 const Text_t* vsdFile)
90 // Create the VSD for specified data-directory and event.
91 // Result is stored in vsdFile.
93 // Needs to be extended to support conversion of multiple events.
95 static const TEveException eH("AliEveVSDCreator::CreateVSD ");
100 string galiceFile (Form("%s/galice.root", fDataDir.Data()));
103 printf("%s opening %s \n", eH.Data(), galiceFile.c_str());
105 if(gSystem->AccessPathName(galiceFile.c_str(), kReadPermission)) {
106 throw(eH + "Can not read file '" + galiceFile + "'.");
108 fRunLoader = AliRunLoader::Open(galiceFile.c_str());
110 throw(eH + "AliRunLoader::Open failed.");
112 fRunLoader->LoadgAlice();
113 Int_t status = fRunLoader->GetEvent(fEvent);
115 throw(eH + Form("GetEvent(%d) failed, exit code %s.", fEvent, status));
118 printf("%s open seems ok. Now loading sim data.\n", eH.Data());
120 fRunLoader->LoadHeader();
121 fRunLoader->LoadKinematics();
122 fRunLoader->LoadTrackRefs();
123 fRunLoader->LoadHits();
128 printf("%s opening output TEveVSD.\n", eH.Data());
130 TFile* file = TFile::Open(vsdFile, "RECREATE", "ALICE VisualizationDataSummary");
131 fDirectory = new TDirectoryFile("Event0", "");
134 printf("%s creating trees now ...\n", eH.Data());
139 printf("%s trees created, closing files.\n", eH.Data());
148 // clean after the TEveVSD data was sucessfuly written
158 fRunLoader->UnloadAll();
161 delete gAlice; gAlice = 0;
166 printf("%s all done.\n", eH.Data());
169 void AliEveVSDCreator::CreateTrees()
171 // Create and fill the output trees by calling all the
172 // ConvertXyzz() functions.
173 // Exceptions from individual functions are displayed as warnings.
175 static const TEveException eH("AliEveVSDCreator::CreateTrees ");
178 throw(eH + "output directory not set.");
182 printf("%sConvertKinematics.\n", eH.Data());
184 } catch(TEveException& exc) { Warning(eH, exc); }
188 printf("%sConvertHits.\n", eH.Data());
190 } catch(TEveException& exc) { Warning(eH, exc); }
194 printf("%sConvertClusters.\n", eH.Data());
196 } catch(TEveException& exc) { Warning(eH, exc); }
200 printf("%sConvertRecTracks.\n", eH.Data());
202 } catch(TEveException& exc) {
203 Warning(exc, "skipping AliEveV0 extraction.");
204 goto end_esd_processing;
209 printf("%sConvertV0.\n", eH.Data());
211 } catch(TEveException& exc) { Warning(eH, exc); }
215 printf("%sConvertKinks.\n", eH.Data());
217 } catch(TEveException& exc) { Warning(eH, exc); }
223 printf("%sConvertGenInfo.\n", eH.Data());
225 } catch(TEveException& exc) { Warning(eH, exc); }
230 /******************************************************************************/
232 /******************************************************************************/
234 void AliEveVSDCreator::ConvertKinematics()
236 // Convert kinematics.
237 // Track references are not stored, they should be.
239 static const TEveException eH("AliEveVSDCreator::ConvertKinematics ");
242 throw (eH + "kinematics already converted");
244 AliStack* stack = fRunLoader->Stack();
246 throw(eH + "stack is null.");
249 fTreeK = new TTree("Kinematics", "TParticles sorted by Label");
251 Int_t nentries = stack->GetNtrack();
252 std::vector<TEveMCTrack> vmc(nentries);
253 for (Int_t idx=0; idx<nentries; idx++) {
254 TParticle* tp = stack->Particle(idx);
256 vmc[idx].fLabel = idx;
259 // read track refrences
260 // functionality now in AliEveKineTools.
262 TTree* fTreeTR = fRunLoader->TreeTR();
265 Warning(eH, "no TrackRefs; some data will not be available.");
267 TClonesArray* RunArrayTR = 0;
268 fTreeTR->SetBranchAddress("AliRun", &RunArrayTR);
270 Int_t nPrimaries = (Int_t) fTreeTR->GetEntries();
271 for (Int_t iPrimPart = 0; iPrimPart<nPrimaries; iPrimPart++) {
272 // printf("T0 fTreeTR->GetEntry(%d) \n",iPrimPart);
273 fTreeTR->GetEntry(iPrimPart);
274 // printf("END fTreeTR->GetEntry(%d) \n",iPrimPart);
276 for (Int_t iTrackRef = 0; iTrackRef < RunArrayTR->GetEntriesFast(); iTrackRef++) {
277 AliTrackReference *trackRef = (AliTrackReference*)RunArrayTR->At(iTrackRef);
278 Int_t track = trackRef->GetTrack();
279 if(track < nentries && track > 0){
280 TEveMCTrack& mct = vmc[track];
281 if(trackRef->TestBit(kNotDeleted)) {
283 mct.t_decay = trackRef->GetTime();
284 mct.V_decay.x = trackRef->X();
285 mct.V_decay.y = trackRef->Y();
286 mct.V_decay.z = trackRef->Z();
287 mct.P_decay.x = trackRef->Px();
288 mct.P_decay.y = trackRef->Py();
289 mct.P_decay.z = trackRef->Pz();
290 if(TMath::Abs(mct.GetPdgCode()) == 11)
291 mct.decayed = false; // a bug in TreeTR
299 fTreeK->Branch("K", "TEveMCTrack", &fpK, fBuffSize);
301 printf("sizeofvmc = %d\n", vmc.size());
302 for(std::vector<TEveMCTrack>::iterator k=vmc.begin(); k!=vmc.end(); ++k) {
303 TEveMCTrack& mct = *k;
307 Int_t mi = mct.fLabel;
309 while(m->GetMother(0) != -1) {
311 printf("cnt %d mi=%d, mo=%d\n", cnt, mi, m->GetMother(0));
313 mi = m->GetMother(0);
322 fTreeK->BuildIndex("label");
325 /******************************************************************************/
327 /******************************************************************************/
334 const char* hitbranch;
335 unsigned char detidx;
338 Detector detects[] = {
339 { "ITS", "AliITShit", 0 },
340 { "TPC", "AliTPCTrackHitsV2", 1 },
341 { "TRD", "AliTRDhit", 2 },
342 { "TOF", "AliTOFhit", 3 }
343 // { "HMPID", "AliHMPIDhit", 4 },
348 /******************************************************************************/
350 void AliEveVSDCreator::ConvertHits()
353 // TPC hits are handled specially as they are compressed - only mayor
356 static const TEveException eH("AliEveVSDCreator::ConvertHits ");
359 throw(eH + "hits already converted.");
362 fTreeH = new TTree("Hits", "Combined detector hits.");
363 fTreeH->Branch("H", "TEveHit", &fpH, fBuffSize);
365 std::map<Int_t, Int_t> hmap;
366 // parameters for ITS, TPC hits filtering
367 Float_t x,y,z, x1,y1,z1;
368 Float_t tpcSqrRes = fTPCHitRes*fTPCHitRes;
369 Float_t trdSqrRes = fTRDHitRes*fTRDHitRes;
372 // load hits from the rest of detectors
373 while (detects[l].name != 0)
375 Detector& det = detects[l++];
382 TTree* treeh = fRunLoader->GetTreeH(det.name, false);
384 Warning(eH, Form("no hits for %s.", det.name));
387 AliTPCTrackHitsV2 hv2, *hv2p = &hv2;
388 treeh->SetBranchAddress("TPC2", &hv2p);
389 Int_t np = treeh->GetEntries();
390 for (Int_t i = 0; i < np; ++i)
393 Int_t evaIdx = np -i -1;
394 if (hv2.First() == 0) continue;
397 AliHit* ah = hv2.GetHit();
398 x1 = ah->X(); y1 = ah->Y(); z1 = ah->Z();
399 if ((x-x1)*(x-x1) + (y-y1)*(y-y1) + (z-z1)*(z-z1) > tpcSqrRes)
401 fH.fDetId = det.detidx;
403 fH.fLabel = ah->Track();
404 fH.fEvaLabel = evaIdx;
405 fH.fV.fX = x1; fH.fV.fY = y1; fH.fV.fZ = z1;
408 x = x1; y = y1; z = z1;
411 } while (hv2.Next());
413 // printf("%d entries in TPChits \n",count);
418 TTree* treeh = fRunLoader->GetTreeH(det.name, false);
420 Warning(eH, Form("no hits for %s.", det.name));
423 TClonesArray *arr = new TClonesArray(det.hitbranch);
424 treeh->SetBranchAddress(det.name, &arr);
425 Int_t np = treeh->GetEntries();
426 // in TreeH files hits are grouped in clones arrays
427 // each eva particle has its own clone array
428 for (Int_t i = 0; i < np; ++i)
431 Int_t evaIdx = np -i -1;
432 Int_t nh=arr->GetEntriesFast();
434 // printf("%d entry %d hits for primary %d \n", i, nh, evaIdx);
435 for (Int_t j = 0; j < nh; ++j)
437 AliHit* aliHit = (AliHit*)arr->UncheckedAt(j);
438 fH.fDetId = det.detidx;
440 fH.fLabel = aliHit->GetTrack();
441 fH.fEvaLabel = evaIdx;
442 fH.fV.Set(aliHit->X(), aliHit->Y(), aliHit->Z());
445 x1=aliHit->X();y1=aliHit->Y();z1=aliHit->Z();
446 if ((x-x1)*(x-x1)+(y-y1)*(y-y1)+(z-z1)*(z-z1) < trdSqrRes) continue;
461 for(std::map<Int_t, Int_t>::iterator j=hmap.begin(); j!=hmap.end(); ++j)
463 GetGeninfo(j->first)->fNHits += j->second;
467 /******************************************************************************/
469 /******************************************************************************/
471 void AliEveVSDCreator::ConvertClusters()
475 // Only supported for ITS and TPC at the moment, see dedicated
476 // functions ConvertITSClusters() and ConvertTPCClusters().
478 // It should be possible now to do this in a general manner (with
479 // the alignment framework).
481 static const TEveException eH("AliEveVSDCreator::ConvertClusters ");
484 throw(eH + "clusters already converted.");
487 fTreeC = new TTree("Clusters", "rec clusters");
488 fTreeC->Branch("C", "TEveCluster", &fpC, fBuffSize);
491 ConvertITSClusters();
492 } catch(TEveException& exc) { Warning(eH, exc); }
495 ConvertTPCClusters();
496 } catch(TEveException& exc) { Warning(eH, exc); }
499 /******************************************************************************/
501 void AliEveVSDCreator::ConvertTPCClusters()
503 // Convert TPC clusters and transform them to global coordinates.
505 static const TEveException eH("AliEveVSDCreator::ConvertTPCClusters ");
508 ( TFile::Open(Form("%s/TPC.RecPoints.root", fDataDir.Data())) );
510 throw(eH + "can not open 'TPC.RecPoints.root' file.");
512 auto_ptr<TDirectory> d
513 ( (TDirectory*) f->Get(Form("Event%d", fEvent)) );
515 throw(eH + Form("event directory '%d' not found.", 0));
517 auto_ptr<TTree> tree( (TTree*) d->Get("TreeR") );
519 throw(eH + "'TreeR' not found.");
521 auto_ptr<AliTPCParam> par( GetTpcParam(eH) );
523 AliTPCClustersRow clrow, *clrowp = &clrow;
525 clrow.SetClass("AliTPCclusterMI");
526 tree->SetBranchAddress("Segment", &clrowp);
530 Int_t nEnt = tree->GetEntries();
531 for (Int_t n = 0; n < nEnt; ++n)
534 nClusters += clrow.GetArray()->GetEntriesFast();
537 // calculate xyz for a cluster and add it to container
540 std::map<Int_t, Int_t> cmap;
542 for (Int_t n = 0; n < tree->GetEntries(); ++n)
545 Int_t ncl = clrow.GetArray()->GetEntriesFast();
549 par->AdjustSectorRow(clrow.GetID(),sec,row);
552 if (clrow.GetArray())
554 // cl = new AliTPCclusterMI(*(AliTPCclusterMI*)clrow.GetArray()->UncheckedAt(ncl));
555 cl = (AliTPCclusterMI*)clrow.GetArray()->UncheckedAt(ncl);
556 if (cl->GetLabel(0) >= 0)
558 x = par->GetPadRowRadii(sec,row); y = cl->GetY(); z = cl->GetZ();
559 par->AdjustCosSin(sec,cs,sn);
560 tmp = x*cs-y*sn; y= x*sn+y*cs; x=tmp;
564 fC.fLabel[0] = cl->GetLabel(0);
565 fC.fLabel[1] = cl->GetLabel(1);
566 fC.fLabel[2] = cl->GetLabel(2);
572 while (i < 3 && fC.fLabel[i])
573 cmap[fC.fLabel[i++]]++;
581 for (std::map<Int_t, Int_t>::iterator j=cmap.begin(); j!=cmap.end(); ++j)
583 GetGeninfo(j->first)->fNClus += j->second;
587 /******************************************************************************/
589 void AliEveVSDCreator::ConvertITSClusters()
591 // Convert ITS clusters and transform them to global coordinates.
593 static const TEveException eH("AliEveVSDCreator::ConvertITSClusters ");
596 ( TFile::Open(Form("%s/ITS.RecPoints.root", fDataDir.Data())) );
598 throw(eH + "can not open 'ITS.RecPoints.root' file.");
600 auto_ptr<TDirectory> d
601 ( (TDirectory*) f->Get(Form("Event%d", fEvent)) );
603 throw(eH + Form("event directory '%d' not found.", 0));
605 auto_ptr<TTree> tree( (TTree*) d->Get("TreeR") );
607 throw(eH + "'TreeR' not found.");
610 AliITSLoader* ITSld = (AliITSLoader*) fRunLoader->GetLoader("ITSLoader");
611 AliITSgeom* geom = ITSld->GetITSgeom();
613 //printf("alice ITS geom %p \n",geom );
616 throw(eH + "can not find ITS geometry");
618 TClonesArray *arr = new TClonesArray("AliITSclusterV2");
619 tree->SetBranchAddress("Clusters", &arr);
620 Int_t nmods = tree->GetEntries();
622 std::map<Int_t, Int_t> cmap;
624 for (Int_t mod = 0; mod < nmods; ++mod)
627 Int_t nc=arr->GetEntriesFast();
628 for (Int_t j = 0; j < nc; ++j)
630 AliITSclusterV2* recp = (AliITSclusterV2*) arr->UncheckedAt(j);
633 geom->GetRotMatrix(mod,rot);
635 geom->GetModuleId(mod,lay,lad,det);
637 geom->GetTrans(lay,lad,det,tx,ty,tz);
639 Double_t alpha=TMath::ATan2(rot[1],rot[0])+TMath::Pi();
640 Double_t phi1=TMath::Pi()/2+alpha;
641 if (lay == 1) phi1+=TMath::Pi();
643 Float_t cp=TMath::Cos(phi1), sp=TMath::Sin(phi1);
644 Float_t r=tx*cp+ty*sp;
645 gc[0] = r*cp - recp->GetY()*sp;
646 gc[1] = r*sp + recp->GetY()*cp;
647 gc[2] = recp->GetZ();
651 fC.fLabel[0] = recp->GetLabel(0);
652 fC.fLabel[1] = recp->GetLabel(1);
653 fC.fLabel[2] = recp->GetLabel(2);
654 fC.fV.fX = r*cp - recp->GetY()*sp;
655 fC.fV.fY = r*sp + recp->GetY()*cp;
656 fC.fV.fZ = recp->GetZ();
659 while(i < 3 && fC.fLabel[i])
660 cmap[fC.fLabel[i++]]++;
664 for (std::map<Int_t, Int_t>::iterator j=cmap.begin(); j!=cmap.end(); ++j)
666 GetGeninfo(j->first)->fNClus += j->second;
672 /******************************************************************************/
674 /******************************************************************************/
676 void AliEveVSDCreator::ConvertRecTracks()
678 // Convert reconstructed tracks.
680 static const TEveException eH("AliEveVSDCreator::ConvertRecTracks ");
683 throw(eH + "tracks already converted.");
686 fTreeR = new TTree("RecTracks", "rec tracks");
688 fTreeR->Branch("R", "TEveRecTrack", &fpR, 512*1024,1);
690 TFile f(Form("%s/AliESDs.root", fDataDir.Data()));
692 throw(eH + "no AliESDs.root file.");
694 TTree* tree = (TTree*) f.Get("esdTree");
696 throw(eH + "no esdTree.");
699 AliESDEvent *esdEvent = new AliESDEvent();
700 esdEvent->ReadFromTree(tree);
701 tree->GetEntry(fEvent);
702 if (esdEvent->GetAliESDOld()) esdEvent->CopyFromOldESD();
705 // reconstructed tracks
708 for (Int_t n = 0; n < esdEvent->GetNumberOfTracks(); ++n)
710 esd_t = esdEvent->GetTrack(n);
712 fR.fLabel = esd_t->GetLabel();
713 fR.fStatus = (Int_t) esd_t->GetStatus();
714 fR.fSign = (Int_t) esd_t->GetSign();
715 esd_t->GetXYZ(dbuf); fR.fV.Set(dbuf);
716 esd_t->GetPxPyPz(dbuf); fR.fP.Set(dbuf);
717 Double_t ep = esd_t->GetP();
718 fR.fBeta = ep/TMath::Sqrt(ep*ep + TMath::C()*TMath::C()*esd_t->GetMass()*esd_t->GetMass());
721 fTreeR->BuildIndex("label");
725 /******************************************************************************/
727 void AliEveVSDCreator::ConvertV0()
729 // Convert reconstructed V0s.
731 static const TEveException eH("AliEveVSDCreator::ConvertV0 ");
734 throw(eH + "AliEveV0 already converted.");
737 fTreeV0 = new TTree("AliEveV0", "AliEveV0 points");
739 fTreeV0->Branch("AliEveV0", "TEveRecV0", &fpV0, 512*1024,1);
741 TFile f(Form("%s/AliESDs.root", fDataDir.Data()));
743 throw(eH + "no AliESDs.root file.");
746 TTree* tree = (TTree*) f.Get("esdTree");
748 throw(eH + "no esdTree.");
750 AliESDEvent *esdEvent= new AliESDEvent();
751 esdEvent->ReadFromTree(tree);
752 tree->GetEntry(fEvent);
753 if (esdEvent->GetAliESDOld()) esdEvent->CopyFromOldESD();
755 for (Int_t n = 0; n < esdEvent->GetNumberOfV0s(); ++n)
757 AliESDv0 *av = esdEvent->GetV0(n);
758 AliESDtrack *trackN = esdEvent->GetTrack(av->GetNindex()); // negative daughter
759 AliESDtrack *trackP = esdEvent->GetTrack(av->GetPindex()); // positive daughter
763 fV0.fStatus = av->GetStatus();
764 // Point of closest approach
765 av->GetXYZ(pos[0],pos[1],pos[2]);
766 fV0.fVCa.fX = pos[0];
767 fV0.fVCa.fY = pos[1];
768 fV0.fVCa.fZ = pos[2];
769 // set birth vertex of neutral particle
770 av->GetXYZ(pos[0], pos[1], pos[2]);
771 fV0.fV0Birth.Set(pos);
773 // momentum and position of negative particle
774 av->GetParamN()->GetPxPyPz(pos);
776 av->GetParamN()->GetXYZ(pos);
779 // momentum and position of positive particle
780 av->GetParamP()->GetPxPyPz(pos);
782 av->GetParamP()->GetXYZ(pos);
785 fV0.fLabel = 0; // !!!! mother label unknown
786 fV0.fPdg = av->GetPdgCode();
789 fV0.fDLabel[0] = TMath::Abs(trackN->GetLabel());
790 fV0.fDLabel[1] = TMath::Abs(trackP->GetLabel());
792 // printf("AliEveV0 convert labels(%d,%d) index(%d,%d)\n",
793 // fV0.d_label[0], fV0.d_label[1],
794 // av->GetNIndex(), av->GetPIndex());
798 // if (esdEvent->GetNumberOfV0s()) fTreeV0->BuildIndex("label");
802 /******************************************************************************/
804 void AliEveVSDCreator::ConvertKinks()
806 // Convert reconstructed kinks.
808 static const TEveException eH("AliEveVSDCreator::ConvertKinks ");
811 throw(eH + "Kinks already converted.");
814 fTreeKK = new TTree("Kinks", "ESD Kinks");
816 fTreeKK->Branch("KK", "TEveRecKink", &fpKK, fBuffSize);
818 TFile f(Form("%s/AliESDs.root", fDataDir.Data()));
820 throw(eH + "no AliESDs.root file.");
823 TTree* tree = (TTree*) f.Get("esdTree");
825 throw(eH + "no esdTree.");
828 AliESDEvent *esdEvent= new AliESDEvent();
829 esdEvent->ReadFromTree(tree);
830 tree->GetEntry(fEvent);
831 if (esdEvent->GetAliESDOld()) esdEvent->CopyFromOldESD();
833 // printf("CONVERT KINK Read %d entries in tree kinks \n", esdEvent->GetNumberOfKinks());
834 for (Int_t n = 0; n < esdEvent->GetNumberOfKinks(); ++n)
836 AliESDkink* kk = esdEvent->GetKink(n);
840 fKK.fLabel = kk->GetLabel(0);
841 fKK.fStatus = Int_t(kk->GetStatus(1) << 8 + kk->GetStatus(2));
843 // reconstructed kink position
844 fKK.fLabelSec = kk->GetLabel(1);
845 fKK.fVKink.Set(kk->GetPosition());
847 const AliExternalTrackParam& tpMother = kk->RefParamMother();
848 // momentum and position of mother
849 tpMother.GetPxPyPz(pos);
851 tpMother.GetXYZ(pos);
853 const Double_t* par = tpMother.GetParameter();
854 // printf("KINK Pt %f, %f \n",1/tpMother.Pt(),par[4] );
855 fKK.fSign = (par[4] < 0) ? -1 : 1;
857 const AliExternalTrackParam& tpDaughter = kk->RefParamDaughter();
858 // momentum and position of daughter
859 tpDaughter.GetPxPyPz(pos);
861 tpDaughter.GetXYZ(pos);
866 if (esdEvent->GetNumberOfKinks()) fTreeKK->BuildIndex("label");
869 /******************************************************************************/
871 /******************************************************************************/
873 void AliEveVSDCreator::ConvertGenInfo()
875 // Build simulation-reconstruction cross-reference table.
876 // In a rather poor state at the moment.
878 static const TEveException eH("AliEveVSDCreator::ConvertGenInfo ");
881 throw(eH + "GI already converted.");
884 fTreeGI = new TTree("TEveMCRecCrossRef", "Objects prepared for cross querry");
886 TEveMCRecCrossRef::Class()->IgnoreTObjectStreamer(true);
887 fTreeGI->Branch("GI", "TEveMCRecCrossRef", &fpGI, fBuffSize);
888 fTreeGI->Branch("K.", "TEveMCTrack", &fpK);
889 fTreeGI->Branch("R.", "TEveRecTrack", &fpR);
891 for (std::map<Int_t, TEveMCRecCrossRef*>::iterator j=fGenInfoMap.begin(); j!=fGenInfoMap.end(); ++j) {
893 fGI.fLabel = j->first;
894 fTreeK->GetEntry(j->first);
897 Int_t re = fTreeR->GetEntryNumberWithIndex(j->first);
901 // Int_t hasV0 = fTreeV0->GetEntryNumberWithIndex(j->first);
903 // fGI.has_AliEveV0 = true;
905 Int_t hasKk = fTreeKK->GetEntryNumberWithIndex(j->first);
914 /******************************************************************************/
915 /******************************************************************************/
917 /******************************************************************************/
918 /******************************************************************************/
920 AliTPCParam* AliEveVSDCreator::GetTpcParam(const TEveException& eh)
922 // Return TPC parameters, needed for local-global transformation of
925 auto_ptr<TFile> fp( TFile::Open(Form("%s/galice.root", fDataDir.Data())) );
927 throw(eh + "can not open 'galice.root' file.");
928 AliTPCParam* par = (AliTPCParam *) fp->Get("75x40_100x60_150x60");
930 throw(eh + "TPC data not found.");
934 TEveMCRecCrossRef* AliEveVSDCreator::GetGeninfo(Int_t label)
936 // Return the cross-reference structure for given label.
937 // If the object does not exist it is created.
939 // printf("get_geninfo %d\n", label);
940 TEveMCRecCrossRef* gi;
941 std::map<Int_t, TEveMCRecCrossRef*>::iterator i = fGenInfoMap.find(label);
942 if (i == fGenInfoMap.end()) {
943 gi = new TEveMCRecCrossRef();
944 fGenInfoMap[label] = gi;