Page MenuHomeHEPForge

FROG_View_LegoPlot_CaloTower.h
No OneTemporary

FROG_View_LegoPlot_CaloTower.h

// FROG_View_LegoPlot_CaloTower.h
//
//////////////////////////////////////////////////////////////////////
#ifndef _FROG_VIEW_LEGOPLOT_CALOTOWER_H__
#define _FROG_VIEW_LEGOPLOT_CALOTOWER_H__
#include "FROG_View_LegoPlot_CaloHit.h"
class FROG_View_LegoPlot_CaloTower : public FROG_View_LegoPlot_CaloHit{
public :
FROG_View_LegoPlot_CaloTower(int x,int y,int w,int h, char* Name=NULL) : FROG_View_LegoPlot_CaloHit(x,y,w,h,Name){
Type_ = 12;
cam_->R = 150;
cam_->theta = 0.5f;
cam_->phi = 4.3f;
}
virtual void Display_Core(){
if(FROG::SelectedObjects_ && FROG::SelectedObjects_DisplayFlag_){
FROG_Element_Event_CaloTower* tower = dynamic_cast<FROG_Element_Event_CaloTower*>(FROG::SelectedObjects_);
if(tower){
float color[4] = {1 - ((FROG_Element_Base*)FROG::SelectedObjects_)->style_->color_[0],1 - ((FROG_Element_Base*)FROG::SelectedObjects_)->style_->color_[1],1 - ((FROG_Element_Base*)FROG::SelectedObjects_)->style_->color_[2],1};
Draw_Tower_LegoPlot(tower,color);
}
}
Display_Grid();
Display_Towers();
}
void Display_Towers(){
if(!((FROG_Element_Event*)FROG::Event_)) return;
FROG_Element_Base_With_DetId* Coll = (FROG_Element_Base_With_DetId*)((FROG_Element_Event*)FROG::Event_)->FindByDetId(EVTID_CALOTOWER);
if(!Coll){return;}
std::vector<FROG_Element_Base*> CaloTowers;
Coll->GetFullDaughtersVector(&CaloTowers);
for(unsigned int i=0;i<CaloTowers.size();i++){
FROG_Element_Event_CaloTower* tower = dynamic_cast<FROG_Element_Event_CaloTower*>(CaloTowers[i]);
if(!tower)continue;
Draw_Tower_LegoPlot(tower);
}
}
void Draw_Tower_LegoPlot(FROG_Element_Event_CaloTower* tower, float* color=NULL){
FROG_Element_Geom_CaloMod* cell = dynamic_cast<FROG_Element_Geom_CaloMod*>(((FROG_Geometry*)FROG::Geom_)->FindByDetId(tower->DetId()));
if(!cell)return;
float P1 , P2;
float Eta1, Phi1;
float Eta3, Phi3;
FROG_COORD::CartesianToPhysical(cell->PosX-cell->WX-cell->HX,cell->PosY-cell->WY-cell->HY,cell->PosZ-cell->WZ-cell->HZ,P1,Eta1,Phi1);
FROG_COORD::CartesianToPhysical(cell->PosX+cell->WX+cell->HX,cell->PosY+cell->WY+cell->HY,cell->PosZ+cell->WZ+cell->HZ,P1,Eta3,Phi3);
if(Phi1<-2 && Phi3>2)Phi3-=6.2832f;
Eta1*=10;
Phi1*=10;
Eta3*=10;
Phi3*=10;
tower->init();
if(tower->Eem_ + tower->Ehad_ < tower->style_->EMin_)return;
P1 = 10*log10(tower->Eem_/tower->style_->EMin_); if(P1<0)P1=0;
P2 = 10*log10(tower->Ehad_/tower->style_->EMin_);if(P2<0)P2=0;
P2 += P1;
if(P2==0)return;
if(!color)glLoadName( tower->nameId_ );
if(color){glColor4f(color[0] - 0.2f,color[1] - 0.2f,color[2] - 0.2f,color[3]);}else{glColor4fv(tower->Em_Color_);}
DrawCube(Eta1,P1,Phi1,
Eta3,P1,Phi1,
Eta3,P1,Phi3,
Eta1,P1,Phi3,
Eta1,0,Phi1,
Eta3,0,Phi1,
Eta3,0,Phi3,
Eta1,0,Phi3);
if(color){glColor4fv(color);}else{glColor4fv(tower->style_->color_);}
DrawCube(Eta1,P2,Phi1,
Eta3,P2,Phi1,
Eta3,P2,Phi3,
Eta1,P2,Phi3,
Eta1,P1,Phi1,
Eta3,P1,Phi1,
Eta3,P1,Phi3,
Eta1,P1,Phi3);
}
};
#endif

File Metadata

Mime Type
text/x-c++
Expires
Sat, Dec 21, 4:50 PM (18 h, 53 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4023524
Default Alt Text
FROG_View_LegoPlot_CaloTower.h (3 KB)

Event Timeline