]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/alice-macros/emcal_digits.C
Do not transpose rotation part of super-module matrix.
[u/mrichter/AliRoot.git] / EVE / alice-macros / emcal_digits.C
1 void emcal_digits()
2 {
3   AliRunLoader* rl =  Alieve::Event::AssertRunLoader();
4
5   rl->LoadgAlice();
6   AliEMCAL         * emcal = (AliEMCAL*) rl->GetAliRun()->GetDetector("EMCAL");
7   AliEMCALGeometry * geom  = emcal->GetGeometry();
8
9   rl->LoadDigits("EMCAL");
10   TTree* dt = rl->GetTreeD("EMCAL", kFALSE);
11
12   gGeoManager = gReve->GetGeometry("$REVESYS/alice-data/alice_fullgeo.root");
13   TGeoNode* node = gGeoManager->GetTopVolume()->FindNode("XEN1_1");
14
15   TGeoBBox* bbbox = (TGeoBBox*) node->GetDaughter(0) ->GetVolume()->GetShape();
16   bbbox->Dump();
17   TGeoBBox* sbbox = (TGeoBBox*) node->GetDaughter(10)->GetVolume()->GetShape();
18   sbbox->Dump();
19
20   Reve::RenderElementList* l = new Reve::RenderElementList("EMCAL");
21   l->SetTitle("Tooltip");
22   gReve->AddRenderElement(l);
23
24   Reve::FrameBox* frame_big = new Reve::FrameBox();
25   frame_big->SetAABoxCenterHalfSize(0, 0, 0, bbbox->GetDX(), bbbox->GetDY(), bbbox->GetDZ());
26
27   Reve::FrameBox* frame_sml = new Reve::FrameBox();
28   frame_sml->SetAABoxCenterHalfSize(0, 0, 0, sbbox->GetDX(), sbbox->GetDY(), sbbox->GetDZ());
29
30   gStyle->SetPalette(1, 0);
31   Reve::RGBAPalette* pal = new Reve::RGBAPalette(0, 512);
32   pal->SetLimits(0, 1024);
33
34   Reve::QuadSet* smodules[12];
35
36   for (Int_t sm=0; sm<12; ++sm)
37   {
38     Reve::QuadSet* q = new Reve::QuadSet(Form("SM %d", sm+1));
39     q->SetOwnIds(kTRUE);
40     q->Reset(Reve::QuadSet::QT_RectangleYZFixedDimX, kFALSE, 32);
41     q->SetDefWidth (geom->GetPhiTileSize());
42     q->SetDefHeight(geom->GetEtaTileSize());
43
44     q->RefHMTrans().SetFrom(*node->GetDaughter(sm)->GetMatrix());
45
46     q->SetFrame(sm < 10 ? frame_big : frame_sml);
47     q->SetPalette(pal);
48
49     gReve->AddRenderElement(l, q);
50     smodules[sm] = q;
51   }
52
53   TClonesArray *digits = 0;
54   dt->SetBranchAddress("EMCAL", &digits);
55   dt->GetEntry(0);
56   Int_t nEnt = digits->GetEntriesFast();
57   AliEMCALDigit * dig;
58
59   Int_t iEvent  = -1 ;
60   Float_t amp   = -1 ;
61   Float_t time  = -1 ;
62   Int_t id      = -1 ;
63   Int_t iSupMod =  0 ;
64   Int_t iTower  =  0 ;
65   Int_t iIphi   =  0 ;
66   Int_t iIeta   =  0 ;
67   Int_t iphi    =  0 ;
68   Int_t ieta    =  0 ;
69   Double_t x, y, z;
70
71   for(Int_t idig = 0; idig<nEnt; idig++)
72   {
73     dig = static_cast<AliEMCALDigit *>(digits->At(idig));
74
75     if(dig != 0) {
76       id   = dig->GetId() ; //cell (digit) label
77       amp  = dig->GetAmp(); //amplitude in cell (digit)
78       time = dig->GetTime();//time of creation of digit after collision
79
80       cout<<"Cell ID "<<id<<" Amp "<<amp<<endl;//" time "<<time<<endl;
81
82       //Geometry methods  
83       geom->GetCellIndex(id,iSupMod,iTower,iIphi,iIeta); 
84       //Gives SuperModule and Tower numbers
85       geom->GetCellPhiEtaIndexInSModule(iSupMod,iTower,
86                                         iIphi, iIeta,iphi,ieta);
87       //Gives label of cell in eta-phi position per each supermodule
88
89       cout<< "SModule "<<iSupMod<<"; Tower "<<iTower
90           <<"; Eta "<<iIeta<<"; Phi "<<iIphi
91           <<"; Cell Eta "<<ieta<<"; Cell Phi "<<iphi<<endl;
92
93       geom->RelPosCellInSModule(id, x, y, z);
94       cout << x <<" "<< y <<" "<< z <<endl;
95
96       Reve::QuadSet* q = smodules[iSupMod];
97       q->AddQuad(y, z);
98       q->QuadValue(amp);
99       q->QuadId(dig);
100     } else {
101       cout<<"Digit pointer 0x0"<<endl;
102     }
103   }
104
105   for (Int_t sm=0; sm<12; ++sm)
106   {
107     smodules[iSupMod]->RefitPlex();
108   }
109
110   gReve->Redraw3D();
111 }