1 /**************************************************************************
2 * This file is property of and copyright by the ALICE HLT Project *
3 * ALICE Experiment at CERN, All rights reserved. *
5 * Primary Authors: Svein Lindal <slindal@fys.uio.no > *
6 * for The ALICE HLT Project. *
8 * Permission to use, copy, modify and distribute this software and its *
9 * documentation strictly for non-commercial purposes is hereby granted *
10 * without fee, provided that the above copyright notice appears in all *
11 * copies and that both the copyright notice and this permission notice *
12 * appear in the supporting documentation. The authors make no claims *
13 * about the suitability of this software for any purpose. It is *
14 * provided "as is" without express or implied warranty. *
15 **************************************************************************/
17 /// @file AliHLTEvePhos.cxx
18 /// @author Svein Lindal <slindal@fys.uio.no>
19 /// @brief Muon processor for the HLT EVE display
21 #include "AliHLTEveMuon.h"
22 #include "AliHLTMUONDataBlockReader.h"
23 #include "AliHLTHOMERBlockDesc.h"
25 #include "TEveStraightLineSet.h"
26 #include "TEvePointSet.h"
27 #include "AliEveHOMERManager.h"
28 #include "TEveManager.h"
29 #include "AliMUONConstants.h"
31 ClassImp(AliHLTEveMuon);
33 AliHLTEveMuon::AliHLTEveMuon() :
41 AliHLTEveMuon::~AliHLTEveMuon()
54 void AliHLTEveMuon::ProcessBlock(AliHLTHOMERBlockDesc * block) {
55 //See header file for documentation
56 if ( (block->GetDataType().CompareTo("RECHITS") == 0) || (block->GetDataType().CompareTo("TRIGRECS") == 0) ) {
58 fClusters = CreateClusters();
59 fEventManager->GetEveManager()->AddElement(fClusters);
61 ProcessClusters( block, fClusters );
63 }else if(block->GetDataType().CompareTo("MANTRACK") == 0){
66 fTracks = CreateTrackSet();
67 fEventManager->GetEveManager()->AddElement(fTracks);
68 gEve->AddElement(fTracks);
71 ProcessTracks( block, fTracks );
75 TEvePointSet * AliHLTEveMuon::CreateClusters() {
76 //See header file for documentation
77 TEvePointSet * ps = new TEvePointSet("MUON RecHits");
78 ps->SetMainColor(kBlue);
79 ps->SetMarkerStyle(20);
83 TEveStraightLineSet * AliHLTEveMuon::CreateTrackSet() {
84 TEveStraightLineSet * ls = new TEveStraightLineSet("MUON Tracks");
85 ls->SetMainColor(kRed);
90 void AliHLTEveMuon::ProcessHistogram(AliHLTHOMERBlockDesc * block ) {
91 //See header file for documentation
93 fCanvas = CreateCanvas("MUON QA", "MUON QA");
94 fCanvas->Divide(3, 2);
96 AddHistogramsToCanvas(block, fCanvas, fHistoCount);
99 void AliHLTEveMuon::UpdateElements() {
100 //See header file for documentation
101 if(fCanvas) fCanvas->Update();
102 if(fClusters) fClusters->ResetBBox();
103 if(fTracks) fTracks->ElementChanged();
106 void AliHLTEveMuon::ResetElements(){
107 //See header file for documentation
110 if ( fClusters ) fClusters->Reset();
118 void AliHLTEveMuon::ProcessClusters(AliHLTHOMERBlockDesc * block, TEvePointSet * clusters) {
119 //See header file for documentation
120 unsigned long size = block->GetSize();
123 buffer = (Int_t *)block->GetData();
124 //cout<<"block size : "<<size<<", buffer : "<<buffer<<", DataType : "<<block->GetDataType()<<endl;
126 if(block->GetDataType().CompareTo("RECHITS") == 0){
128 AliHLTMUONRecHitsBlockReader trackblock((char*)buffer, size);
129 const AliHLTMUONRecHitStruct* hit = trackblock.GetArray();
131 for(AliHLTUInt32_t ientry = 0; ientry < trackblock.Nentries(); ientry++){
132 if(hit->fX!=0.0 && hit->fY!=0.0 && hit->fZ!=0.0)
133 clusters->SetNextPoint(hit->fX,hit->fY,hit->fZ);
140 // if(!strcmp((BlockType(ULong64_t(reader->GetBlockDataType(i)))).Data(),"TRIGRECS")){
142 AliHLTMUONTriggerRecordsBlockReader trigblock(buffer, size);
143 const AliHLTMUONTriggerRecordStruct* trigrec = trigblock.GetArray();
144 for(AliHLTUInt32_t ientry = 0; ientry < trigblock.Nentries(); ientry++){
146 const AliHLTMUONRecHitStruct* hit = &trigrec->fHit[0];
147 for(AliHLTUInt32_t ch = 0; ch < 4; ch++)
149 if(hit->fX!=0.0 && hit->fY!=0.0 && hit->fZ!=0.0)
150 clusters->SetNextPoint(hit->fX,hit->fY,hit->fZ);
152 }// trig chamber loop
159 void AliHLTEveMuon::ProcessTracks(AliHLTHOMERBlockDesc * block, TEveStraightLineSet * tracks) {
160 //See header file for documentation
161 unsigned long size = block->GetSize();
162 Int_t * buffer = (Int_t *)block->GetData();
163 AliHLTMUONRecHitStruct hit1,hit2;
164 hit1.fX = hit1.fY = hit1.fZ = hit2.fX = hit2.fY = hit2.fZ = 0;
166 Float_t x0=0.0,y0=0.0,z0=0.0;
167 Float_t x3=0.0,y3=0.0,z3=0.0;
168 if(block->GetDataType().CompareTo("MANTRACK") == 0){
169 AliHLTMUONMansoTracksBlockReader mantrackblock(buffer, size);
170 const AliHLTMUONMansoTrackStruct* mtrack = mantrackblock.GetArray();
171 for(AliHLTUInt32_t ientry = 0; ientry < mantrackblock.Nentries(); ientry++){
172 const AliHLTMUONRecHitStruct* hit = &mtrack->fHit[0];
173 for(AliHLTUInt32_t ch = 0; ch < 4; ch++){
174 // cout << setw(10) << left << ch + 7 << setw(0);
175 // cout << setw(13) << left << hit->fX << setw(0);
176 // cout << setw(13) << left << hit->fY << setw(0);
177 // cout << hit->fZ << setw(0) << endl;
180 hit1 = *hit; ch1 = ch+6;
182 hit2 = *hit; ch2 = ch+6;
186 }// trig chamber loop
187 // printf("ch : %d, (X,Y,Z) : (%f,%f,%f)\n",ch1,hit1.fX,hit1.fY,hit1.fZ);
188 // printf("ch : %d, (X,Y,Z) : (%f,%f,%f)\n",ch2,hit2.fX,hit2.fY,hit2.fZ);
190 z3 = AliMUONConstants::DefaultChamberZ(ch2+4);
191 y3 = hit1.fY - (hit1.fZ-z3)*(hit1.fY - hit2.fY)/(hit1.fZ - hit2.fZ) ;
192 x3 = hit1.fX - (hit1.fZ-z3)*(hit1.fX - hit2.fX)/(hit1.fZ - hit2.fZ) ;
194 z0 = AliMUONConstants::DefaultChamberZ(ch1);
195 y0 = hit1.fY - (hit1.fZ-z0)*(hit1.fY - hit2.fY)/(hit1.fZ - hit2.fZ) ;
196 x0 = hit1.fX - (hit1.fZ-z0)*(hit1.fX - hit2.fX)/(hit1.fZ - hit2.fZ) ;
199 tracks->AddLine(x0,y0,z0,x3,y3,z3);
202 // cout<<"NofManso Tracks : "<<mantrackblock.Nentries()<<endl;