]>
Commit | Line | Data |
---|---|---|
d810d0de | 1 | // $Id$ |
2 | // Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007 | |
3 | ||
4 | /************************************************************************** | |
5 | * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. * | |
6 | * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for * | |
51346b82 | 7 | * full copyright notice. * |
d810d0de | 8 | **************************************************************************/ |
38aefcea | 9 | #ifndef __CINT__ |
10 | ||
11 | #include <TEveManager.h> | |
12 | #include <TEveQuadSet.h> | |
13 | #include <TGeoNode.h> | |
14 | #include <TGeoBBox.h> | |
15 | #include <TGeoManager.h> | |
16 | #include <TStyle.h> | |
17 | #include <TEveTrans.h> | |
18 | #include <TClonesArray.h> | |
19 | ||
20 | #include <EveBase/AliEveEventManager.h> | |
21 | ||
22 | #include <AliRunLoader.h> | |
23 | #include <AliCluster.h> | |
24 | #include <EMCAL/AliEMCALGeometry.h> | |
25 | #include <EMCAL/AliEMCALDigit.h> | |
26 | ||
864cb96e | 27 | #include <Riostream.h> |
38aefcea | 28 | #endif |
16718cdc | 29 | |
38fb31ba | 30 | void emcal_digits() |
31 | { | |
38aefcea | 32 | AliEveEventManager::AssertGeometry(); |
38fb31ba | 33 | |
38fb31ba | 34 | TGeoNode* node = gGeoManager->GetTopVolume()->FindNode("XEN1_1"); |
a7f62b75 | 35 | if (!node) return; |
38fb31ba | 36 | |
a7f62b75 | 37 | Int_t nModules = node->GetNdaughters(); |
38fb31ba | 38 | |
84aff7a4 | 39 | TEveElementList* l = new TEveElementList("EMCAL"); |
38fb31ba | 40 | l->SetTitle("Tooltip"); |
84aff7a4 | 41 | gEve->AddElement(l); |
38fb31ba | 42 | |
a7f62b75 | 43 | TGeoBBox* bbbox = (TGeoBBox*) node->GetDaughter(0) ->GetVolume()->GetShape(); |
84aff7a4 | 44 | TEveFrameBox* frame_big = new TEveFrameBox(); |
38aefcea | 45 | frame_big->SetFrameColorRGBA(200,200,0,50); |
38fb31ba | 46 | frame_big->SetAABoxCenterHalfSize(0, 0, 0, bbbox->GetDX(), bbbox->GetDY(), bbbox->GetDZ()); |
47 | ||
a7f62b75 | 48 | TEveFrameBox* frame_sml = 0x0; |
49 | ||
50 | if (nModules==12) { | |
51 | TGeoBBox* sbbox = (TGeoBBox*) node->GetDaughter(10)->GetVolume()->GetShape(); | |
52 | frame_sml = new TEveFrameBox(); | |
53 | frame_sml->SetFrameColorRGBA(200,200,0,50); | |
54 | frame_sml->SetAABoxCenterHalfSize(0, 0, 0, sbbox->GetDX(), sbbox->GetDY(), sbbox->GetDZ()); | |
55 | } | |
38fb31ba | 56 | |
b58ff8e4 | 57 | gStyle->SetPalette(1, 0); |
84aff7a4 | 58 | TEveRGBAPalette* pal = new TEveRGBAPalette(0, 512); |
b58ff8e4 | 59 | pal->SetLimits(0, 1024); |
60 | ||
84aff7a4 | 61 | TEveQuadSet* smodules[12]; |
a7f62b75 | 62 | memset(smodules,0,12*sizeof(TEveQuadSet*)); |
38fb31ba | 63 | |
38aefcea | 64 | |
65 | AliEMCALGeometry * geom = AliEMCALGeometry::GetInstance(); | |
66 | if (!geom) geom = AliEMCALGeometry::GetInstance("",""); | |
67 | ||
a7f62b75 | 68 | for (Int_t sm=0; sm<nModules; ++sm) |
38fb31ba | 69 | { |
84aff7a4 | 70 | TEveQuadSet* q = new TEveQuadSet(Form("SM %d", sm+1)); |
38fb31ba | 71 | q->SetOwnIds(kTRUE); |
84aff7a4 | 72 | q->Reset(TEveQuadSet::kQT_RectangleYZFixedDimX, kFALSE, 32); |
38fb31ba | 73 | q->SetDefWidth (geom->GetPhiTileSize()); |
74 | q->SetDefHeight(geom->GetEtaTileSize()); | |
75 | ||
a15e6d7d | 76 | q->RefMainTrans().SetFrom(*node->GetDaughter(sm)->GetMatrix()); |
38fb31ba | 77 | |
78 | q->SetFrame(sm < 10 ? frame_big : frame_sml); | |
b58ff8e4 | 79 | q->SetPalette(pal); |
38fb31ba | 80 | |
84aff7a4 | 81 | gEve->AddElement(q, l); |
38fb31ba | 82 | smodules[sm] = q; |
83 | } | |
84 | ||
a7f62b75 | 85 | AliRunLoader* rl = AliEveEventManager::AssertRunLoader(); |
86 | ||
87 | rl->LoadDigits("EMCAL"); | |
88 | TTree* dt = rl->GetTreeD("EMCAL", kFALSE); | |
89 | if (!dt) return; | |
90 | ||
38fb31ba | 91 | TClonesArray *digits = 0; |
92 | dt->SetBranchAddress("EMCAL", &digits); | |
93 | dt->GetEntry(0); | |
94 | Int_t nEnt = digits->GetEntriesFast(); | |
95 | AliEMCALDigit * dig; | |
96 | ||
38fb31ba | 97 | Float_t amp = -1 ; |
98 | Float_t time = -1 ; | |
99 | Int_t id = -1 ; | |
100 | Int_t iSupMod = 0 ; | |
101 | Int_t iTower = 0 ; | |
102 | Int_t iIphi = 0 ; | |
103 | Int_t iIeta = 0 ; | |
104 | Int_t iphi = 0 ; | |
105 | Int_t ieta = 0 ; | |
106 | Double_t x, y, z; | |
107 | ||
84aff7a4 | 108 | for (Int_t idig = 0; idig < nEnt; ++idig) |
38fb31ba | 109 | { |
110 | dig = static_cast<AliEMCALDigit *>(digits->At(idig)); | |
111 | ||
112 | if(dig != 0) { | |
113 | id = dig->GetId() ; //cell (digit) label | |
114 | amp = dig->GetAmp(); //amplitude in cell (digit) | |
115 | time = dig->GetTime();//time of creation of digit after collision | |
116 | ||
864cb96e | 117 | cout<<"Cell ID "<<id<<" Amp "<<amp<<endl;//" time "<<time<<endl; |
38fb31ba | 118 | |
51346b82 | 119 | //Geometry methods |
120 | geom->GetCellIndex(id,iSupMod,iTower,iIphi,iIeta); | |
38fb31ba | 121 | //Gives SuperModule and Tower numbers |
122 | geom->GetCellPhiEtaIndexInSModule(iSupMod,iTower, | |
123 | iIphi, iIeta,iphi,ieta); | |
124 | //Gives label of cell in eta-phi position per each supermodule | |
125 | ||
864cb96e | 126 | cout<< "SModule "<<iSupMod<<"; Tower "<<iTower |
38fb31ba | 127 | <<"; Eta "<<iIeta<<"; Phi "<<iIphi |
864cb96e | 128 | <<"; Cell Eta "<<ieta<<"; Cell Phi "<<iphi<<endl; |
38fb31ba | 129 | |
130 | geom->RelPosCellInSModule(id, x, y, z); | |
864cb96e | 131 | cout << x <<" "<< y <<" "<< z <<endl; |
38fb31ba | 132 | |
84aff7a4 | 133 | TEveQuadSet* q = smodules[iSupMod]; |
a7f62b75 | 134 | if (q) { |
135 | q->AddQuad(y, z); | |
136 | q->QuadValue(TMath::Nint(amp)); | |
137 | q->QuadId(new AliEMCALDigit(*dig)); | |
138 | } | |
38fb31ba | 139 | } else { |
864cb96e | 140 | cout<<"Digit pointer 0x0"<<endl; |
38fb31ba | 141 | } |
142 | } | |
143 | ||
38aefcea | 144 | rl->UnloadDigits("EMCAL"); |
145 | ||
146 | ||
a7f62b75 | 147 | for (Int_t sm = 0; sm < nModules; ++sm) |
b58ff8e4 | 148 | { |
149 | smodules[iSupMod]->RefitPlex(); | |
150 | } | |
151 | ||
84aff7a4 | 152 | gEve->Redraw3D(); |
38fb31ba | 153 | } |