]>
Commit | Line | Data |
---|---|---|
405965e0 | 1 | |
2 | ||
3 | ||
4 | void TestEMCALData() { | |
5 | ||
6 | TH1F* hE = new TH1F("hEmcalHits", "Hits energy distribution in EMCAL", 100, 0., 10.) ; | |
7 | hE->Sumw2() ; | |
8 | TH1I* hM = new TH1I("hEmcalHitsMul", "Hits multiplicity distribution in EMCAL", 500, 0., 10000) ; | |
9 | hM->Sumw2() ; | |
10 | ||
11 | TH1I * dA = new TH1I("hEmcalDigits", "Digits amplitude distribution in EMCAL", 500, 0, 5000) ; | |
12 | dA->Sumw2() ; | |
13 | TH1I * dM = new TH1I("hEmcalDigitsMul", "Digits multiplicity distribution in EMCAL", 500, 0, 1000) ; | |
14 | dM->Sumw2() ; | |
15 | ||
16 | TH1F * sE = new TH1F("hEmcalSDigits", "SDigits energy distribution in EMCAL", 200, 0, 1000) ; | |
17 | sE->Sumw2() ; | |
18 | TH1I * sM = new TH1I("hEmcalSDigitsMul", "SDigits multiplicity distribution in EMCAL", 500, 0, 1000) ; | |
19 | sM->Sumw2() ; | |
20 | ||
21 | TH1F * cE = new TH1F("hEmcalRecPoints", "RecPoints energy distribution in EMCAL", 100, 0, 20) ; | |
22 | cE->Sumw2() ; | |
23 | TH1I * cM = new TH1I("hEmcalRecPointsMul", "RecPoints multiplicity distribution in EMCAL", 500, 0, 1000) ; | |
24 | cM->Sumw2() ; | |
25 | ||
26 | AliRunLoader *rl = AliRunLoader::Open("galice.root",AliConfig::GetDefaultEventFolderName(),"read"); | |
27 | if (rl == 0x0) | |
28 | cout<<"Can not instatiate the Run Loader"<<endl; | |
29 | ||
30 | AliEMCALLoader *emcalLoader = dynamic_cast<AliEMCALLoader*> | |
31 | (rl->GetDetectorLoader("EMCAL")); | |
32 | ||
33 | //Load Hits | |
34 | rl->LoadHits("EMCAL"); | |
35 | //Load Digits | |
36 | rl->LoadDigits("EMCAL"); | |
37 | //Load SDigits | |
38 | rl->LoadSDigits("EMCAL"); | |
39 | //Load RecPoints | |
40 | rl->LoadRecPoints("EMCAL"); | |
41 | ||
42 | ||
43 | //one way to do it that works for all three | |
44 | AliEMCALHit* hit; | |
45 | AliEMCALDigit* dig; | |
46 | AliEMCALRecPoint* rp; | |
47 | ||
48 | rl->GetEvent(0); | |
49 | ||
50 | //Fill array of hits | |
51 | TClonesArray *hits = emcalLoader->Hits(); | |
52 | //Fill array of digits | |
53 | TClonesArray *digits = emcalLoader->Digits(); | |
54 | //Fill array of clusters | |
55 | TClonesArray *clusters = emcalLoader->RecPoints(); | |
56 | ||
57 | //Get hits from the list | |
58 | hM->Fill(hits->GetEntries()); | |
59 | for(Int_t ihit = 0; ihit< hits->GetEntries();ihit++){ | |
60 | //cout<<">> idig "<<idig<<endl; | |
61 | hit = static_cast<AliEMCALHit *>(hits->At(ihit)) ; | |
62 | ||
63 | if(hit != 0){ | |
64 | hE->Fill(hit->GetEnergy()); | |
65 | cout << "Hit info " << hit->GetId() << " " << hit->GetEnergy() << endl; | |
66 | } | |
67 | } | |
68 | ||
69 | //Get digits from the list | |
70 | dM->Fill(digits->GetEntries()); | |
71 | for(Int_t idig = 0; idig< digits->GetEntries();idig++){ | |
72 | //cout<<">> idig "<<idig<<endl; | |
73 | dig = static_cast<AliEMCALDigit *>(digits->At(idig)) ; | |
74 | ||
75 | if(dig != 0){ | |
76 | dA->Fill(dig->GetAmp()); | |
77 | cout << "Digit info " << dig->GetId() << " " << dig->GetAmp() << endl; | |
78 | } | |
79 | } | |
80 | ||
81 | ||
82 | //Get clusters from the list | |
83 | cM->Fill(clusters->GetEntries()); | |
84 | for(Int_t iclu = 0; iclu< clusters->GetEntries();iclu++){ | |
85 | //cout<<">> idig "<<idig<<endl; | |
86 | rp = static_cast<AliEMCALRecPoint *>(clusters->At(iclu)) ; | |
87 | ||
88 | if(rp != 0){ | |
89 | cE->Fill(rp->GetEnergy()); | |
90 | cout << "RecPoint info " << rp->GetAbsId() << " " << rp->GetEnergy() << endl; | |
91 | } | |
92 | } | |
93 | ||
94 | ||
95 | /* | |
96 | //another way to do it | |
97 | TTree *hTree = rl->GetTreeH("EMCAL",false); | |
98 | TTree *dTree = rl->GetTreeD("EMCAL",false); | |
99 | TTree *sTree = rl->GetTreeS("EMCAL",false); | |
100 | TTree *cTree = rl->GetTreeR("EMCAL",false); | |
101 | ||
102 | TObjArray *harr=NULL; | |
103 | TBranch *hbranch=hTree->GetBranch("EMCAL"); | |
104 | hbranch->SetAddress(&harr); | |
105 | ||
106 | TObjArray *darr=NULL; | |
107 | TBranch *dbranch=dTree->GetBranch("EMCAL"); | |
108 | dbranch->SetAddress(&darr); | |
109 | ||
110 | TObjArray *sarr=NULL; | |
111 | TBranch *sbranch=sTree->GetBranch("EMCAL"); | |
112 | sbranch->SetAddress(&sarr); | |
113 | ||
114 | TObjArray *carr=NULL; | |
115 | TBranch *cbranch=cTree->GetBranch("EMCALECARP"); | |
116 | cbranch->SetAddress(&carr); | |
117 | ||
118 | ||
119 | if(hbranch->GetEvent(0)) { | |
120 | for(Int_t ih = 0; ih < harr->GetEntriesFast(); ih++) { | |
121 | hM->Fill(harr->GetEntriesFast()); | |
122 | AliEMCALHit* hit =(AliEMCALHit*)harr->UncheckedAt(ih); | |
123 | if(hit != 0){ | |
124 | hE->Fill(hit->GetEnergy()); | |
125 | cout << "Hit info " << hit->GetId() << " " << hit->GetEnergy()*10.5 << endl; | |
126 | } | |
127 | } | |
128 | } | |
129 | ||
130 | if(dbranch->GetEvent(0)) { | |
131 | for(Int_t id = 0; id < darr->GetEntriesFast(); id++) { | |
132 | dM->Fill(darr->GetEntriesFast()); | |
133 | AliEMCALDigit* dig =(AliEMCALDigit*)darr->UncheckedAt(id); | |
134 | if(dig != 0){ | |
135 | dA->Fill(dig->GetAmp()); | |
136 | cout << "Digit info " << dig->GetId() << " " << dig->GetAmp() << endl; | |
137 | } | |
138 | } | |
139 | } | |
140 | ||
141 | if(sbranch->GetEvent(0)) { | |
142 | for(Int_t id = 0; id < sarr->GetEntriesFast(); id++) { | |
143 | sM->Fill(sarr->GetEntriesFast()); | |
144 | AliEMCALDigit* sdig =(AliEMCALDigit*)sarr->UncheckedAt(id); | |
145 | if(sdig != 0){ | |
146 | sE->Fill(sdig->GetAmp()/1.e+6); | |
147 | cout << "SDigit info " << sdig->GetId() << " " << sdig->GetAmp()/1.e+6 << endl; | |
148 | } | |
149 | } | |
150 | } | |
151 | ||
152 | if(cbranch->GetEvent(0)) { | |
153 | for(Int_t ic = 0; ic < carr->GetEntriesFast(); ic++) { | |
154 | cE->Fill(carr->GetEntriesFast()); | |
155 | AliEMCALRecPoint* rp =(AliEMCALRecPoint*)carr->UncheckedAt(ic); | |
156 | if(rp != 0){ | |
157 | cE->Fill(rp->GetEnergy()); | |
158 | cout << "RecPoint info " << rp->GetAbsId() << " " << rp->GetEnergy() << endl; | |
159 | } | |
160 | } | |
161 | } | |
162 | ||
163 | */ | |
164 | ||
165 | TCanvas *chits = new TCanvas("chits","Hits",20,20,800,400); | |
166 | chits->Divide(2,1); | |
167 | chits->cd(1); | |
168 | hE->Draw(); | |
169 | chits->cd(2); | |
170 | hM->Draw(); | |
171 | ||
172 | TCanvas *cdig = new TCanvas("cdig","Digits",20,40,800,400); | |
173 | cdig->Divide(2,1); | |
174 | cdig->cd(1); | |
175 | dA->Draw(); | |
176 | cdig->cd(2); | |
177 | dM->Draw(); | |
178 | ||
179 | /* | |
180 | TCanvas *csdig = new TCanvas("csdig","SDigits",20,60,800,400); | |
181 | csdig->Divide(2,1); | |
182 | csdig->cd(1); | |
183 | sE->Draw(); | |
184 | csdig->cd(2); | |
185 | sM->Draw(); | |
186 | */ | |
187 | ||
188 | TCanvas *cclu = new TCanvas("cclu","Clusters",20,60,800,400); | |
189 | cclu->Divide(2,1); | |
190 | cclu->cd(1); | |
191 | cE->Draw(); | |
192 | cclu->cd(2); | |
193 | cM->Draw(); | |
194 | ||
195 | } |