]>
Commit | Line | Data |
---|---|---|
a91c42d1 | 1 | #include "iostream" |
2 | #include "AliFMDInput.h" | |
3 | #include "AliFMDHit.h" | |
4 | #include "TFile.h" | |
5 | #include "TTree.h" | |
6 | #include "TClonesArray.h" | |
7 | #include "AliTrackReference.h" | |
8 | #include "AliFMDStripIndex.h" | |
960f0a95 | 9 | #include "TParticle.h" |
a91c42d1 | 10 | //Script to compare the hits and the FMD track references for one event. |
11 | //To run: | |
12 | //>gSystem->Load("libFMDutil") | |
13 | //>.L CompareTrackRefsAndHits.C++ | |
14 | //>ReadHits t | |
15 | //>t.Run() | |
16 | //Note that the order of hits and trackrefs is different. | |
17 | ||
18 | class ReadHits : public AliFMDInput{ | |
19 | ||
20 | private: | |
21 | Int_t nHits; | |
960f0a95 | 22 | Int_t nTracks; |
a91c42d1 | 23 | public: |
24 | ||
25 | ||
26 | ||
27 | ReadHits(){ | |
28 | AddLoad(kKinematics); | |
960f0a95 | 29 | AddLoad(kTracks); |
30 | AddLoad(kTrackRefs); | |
a91c42d1 | 31 | AddLoad(kHits); |
32 | nHits = 0; | |
960f0a95 | 33 | nTracks = 0; |
34 | fGAliceFile.Form("galice.root"); | |
a91c42d1 | 35 | } |
36 | ||
37 | Bool_t ProcessHit(AliFMDHit* hit, TParticle* p) | |
38 | { | |
39 | nHits++; | |
960f0a95 | 40 | // std::cout<<hit->Px()<<" "<<hit->Py()<<" "<<hit->Pz()<<std::endl; |
41 | //std::cout<<hit->Detector()<<" "<<hit->Ring()<<" "<<hit->Sector()<<" "<<hit->Strip()<<std::endl; | |
42 | return kTRUE; | |
43 | } | |
44 | Bool_t ProcessTrackRef(AliTrackReference* trackRef, TParticle* p) | |
45 | { | |
46 | UShort_t det,sec,strip; | |
47 | Char_t ring; | |
48 | if(trackRef->DetectorId() == AliTrackReference::kFMD) { | |
49 | nTracks++; | |
50 | AliFMDStripIndex::Unpack(trackRef->UserId(),det,ring,sec,strip); | |
51 | //std::cout<<p->Px()<<" "<<p->Py()<<" "<<p->Pz()<<std::endl; | |
52 | //std::cout<<det<<" "<<ring<<" "<<sec<<" "<<strip<<std::endl; | |
53 | } | |
54 | ||
a91c42d1 | 55 | return kTRUE; |
56 | } | |
960f0a95 | 57 | |
58 | ||
a91c42d1 | 59 | Bool_t Finish() |
60 | { | |
960f0a95 | 61 | // Int_t nTracks = 0; |
62 | /* TFile* f=TFile::Open("TrackRefs.root"); | |
a91c42d1 | 63 | TTree* tree = (TTree*)f->Get("Event0/TreeTR"); |
64 | ||
65 | ||
66 | TClonesArray* array=new TClonesArray("AliTrackReference"); | |
67 | ||
68 | tree->SetBranchAddress("TrackReferences",&array); | |
69 | ||
70 | UShort_t det,sec,strip; | |
71 | Char_t ring; | |
72 | for (int i=0; i<tree->GetEntries(); i++) { | |
73 | tree->GetEvent(i); | |
74 | for(Int_t j = 0; j <array->GetEntriesFast();j++) { | |
75 | ||
76 | AliTrackReference* track = static_cast<AliTrackReference*>(array->At(j)); | |
77 | ||
78 | if(track->DetectorId()==AliTrackReference::kFMD) { | |
79 | nTracks++; | |
80 | AliFMDStripIndex::Unpack(track->UserId(),det,ring,sec,strip); | |
81 | std::cout<<track->Px()<<" "<<track->Py()<<" "<<track->Pz()<<" "<<track->UserId()<<endl; | |
82 | std::cout<<det<<" "<<ring<<" "<<sec<<" "<<strip<<std::endl; | |
83 | } | |
84 | ||
85 | } | |
86 | ||
960f0a95 | 87 | } |
88 | */ | |
a91c42d1 | 89 | std::cout<<nTracks<<" "<<nHits<<std::endl; |
90 | return kTRUE; | |
91 | } | |
92 | ||
93 | }; |