From c3e344989ec2d2c6068a149e1220762710b4ed70 Mon Sep 17 00:00:00 2001 From: mtadel Date: Tue, 1 Jul 2008 17:13:29 +0000 Subject: [PATCH] From Magali Estienne. New classes and a macro for EMCAL visualization. --- EVE/EveDet/AliEveEMCALData.cxx | 633 ++++++++++++++++++++++++++ EVE/EveDet/AliEveEMCALData.h | 92 ++++ EVE/EveDet/AliEveEMCALSModule.cxx | 474 +++++++++++++++++++ EVE/EveDet/AliEveEMCALSModule.h | 97 ++++ EVE/EveDet/AliEveEMCALSModuleData.cxx | 235 ++++++++++ EVE/EveDet/AliEveEMCALSModuleData.h | 97 ++++ EVE/EveDet/LinkDef.h | 5 + EVE/alice-macros/emcal_all.C | 97 ++++ EVE/libEveDet.pkg | 2 +- 9 files changed, 1731 insertions(+), 1 deletion(-) create mode 100644 EVE/EveDet/AliEveEMCALData.cxx create mode 100644 EVE/EveDet/AliEveEMCALData.h create mode 100644 EVE/EveDet/AliEveEMCALSModule.cxx create mode 100644 EVE/EveDet/AliEveEMCALSModule.h create mode 100644 EVE/EveDet/AliEveEMCALSModuleData.cxx create mode 100644 EVE/EveDet/AliEveEMCALSModuleData.h create mode 100644 EVE/alice-macros/emcal_all.C diff --git a/EVE/EveDet/AliEveEMCALData.cxx b/EVE/EveDet/AliEveEMCALData.cxx new file mode 100644 index 00000000000..e4e843938a4 --- /dev/null +++ b/EVE/EveDet/AliEveEMCALData.cxx @@ -0,0 +1,633 @@ +//********************************************************************* +// - AliEVE implementation - +// Fill containers for visualisation of EMCAL data structures +// - read and store MC Hits +// - read and store digits from esds or runloader +// - read and store clusters from esds or runloader +// +// Author: Magali Estienne (magali.estienne@cern.ch) +// June 30 2008 +//********************************************************************* + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "AliRun.h" +#include "AliRunLoader.h" +#include "AliEMCALLoader.h" +#include "AliESDEvent.h" +#include "AliESDVertex.h" +#include "AliEMCAL.h" +#include "AliEMCALGeometry.h" +#include "AliEMCALHit.h" +#include "AliEMCALDigit.h" +#include "AliEMCALRecPoint.h" +#include "AliESDCaloCells.h" +#include "AliESDCaloCluster.h" + +#include "AliEveEMCALData.h" +#include "AliEveEMCALSModule.h" +#include "AliEveEMCALSModuleData.h" + +ClassImp(AliEveEMCALData) + +//______________________________________________________________________________ +AliEveEMCALData::AliEveEMCALData(): + TObject(), + TEveRefCnt(), + fEmcal(0x0), + fGeom(0x0), + fNode(0x0), + fHMatrix(0), + fTree(0x0), + fESD(0x0), + fNsm(12), + fNsmfull(10), + fNsmhalf(2), + fSM(12), + fSMfull(10), + fSMhalf(2), + fRunLoader(0), + fDebug(0), + fPoint(0) +{ + + // + // Constructor + // + // for(Int_t i=0; i<12; i++) + // fSM[i] = 0x0; + // for(Int_t i=0; i<10; i++) + // fSMfull[i] = 0x0; + // fSMhalf[0] = fSMhalf[1] = 0x0; + // InitEMCALGeom(); + CreateAllSModules(); + + +} + +//______________________________________________________________________________ +AliEveEMCALData::AliEveEMCALData(AliRunLoader* rl, TGeoNode* node, TGeoHMatrix* m): + TObject(), + TEveRefCnt(), + fEmcal(0x0), + fGeom(0x0), + fNode(node), + fHMatrix(m), + fTree(0x0), + fESD(0x0), + fNsm(12), + fNsmfull(10), + fNsmhalf(2), + fSM(12), + fSMfull(10), + fSMhalf(2), + fRunLoader(rl), + fDebug(0), + fPoint(0) +{ + + // + // Constructor + // +// for(Int_t i=0; i<12; i++) +// fSM[i] = 0x0; +// for(Int_t i=0; i<10; i++) +// fSMfull[i] = 0x0; +// fSMhalf[0] = fSMhalf[1] = 0x0; + InitEMCALGeom(rl); + CreateAllSModules(); + + +} + +//______________________________________________________________________________ +AliEveEMCALData::~AliEveEMCALData() +{ + // + // Destructor + // + + DeleteSuperModules(); + delete fTree; + delete fEmcal; + delete fGeom; + delete fNode; + delete fHMatrix; + delete fPoint; +} + +//______________________________________________________________________________ +void AliEveEMCALData::Reset() +{ + +} + +//______________________________________________________________________________ +AliEveEMCALData::AliEveEMCALData(const AliEveEMCALData &edata) : + TObject(edata), + TEveRefCnt(edata), + fEmcal(edata.fEmcal), + fGeom(edata.fGeom), + fNode(edata.fNode), + fHMatrix(edata.fHMatrix), + fTree(edata.fTree), + fESD(edata.fESD), + fNsm(edata.fNsm), + fNsmfull(edata.fNsmfull), + fNsmhalf(edata.fNsmhalf), + fSM(edata.fSM), + fSMfull(edata.fSMfull), + fSMhalf(edata.fSMhalf), + fRunLoader(edata.fRunLoader), + fDebug(edata.fDebug), + fPoint(edata.fPoint) +{ + // + // Copy constructor + // + InitEMCALGeom(edata.fRunLoader); + CreateAllSModules(); +} + +//______________________________________________________________________________ +AliEveEMCALData& AliEveEMCALData::operator=(const AliEveEMCALData &edata) +{ + // + // Assignment operator + // + + if (this != &edata) { + + } + + return *this; + +} + +//______________________________________________________________________________ +void AliEveEMCALData::SetTree(TTree* tree) +{ + + // Set digit-tree to be used for digit retrieval. Data is loaded on + // demand. + + fTree = tree; + +} + +//______________________________________________________________________________ +void AliEveEMCALData::SetESD(AliESDEvent* esd) +{ + fESD = esd; +} + +//______________________________________________________________________________ +void AliEveEMCALData::SetNode(TGeoNode* node) +{ + fNode = node; +} + +//______________________________________________________________________________ +void AliEveEMCALData::InitEMCALGeom(AliRunLoader* rl) +{ +// // Handle an individual point selection from GL. + +// fParent->SpawnEditor(); + fEmcal = (AliEMCAL*) rl->GetAliRun()->GetDetector("EMCAL"); + fGeom = (AliEMCALGeometry*) fEmcal->GetGeometry(); + +} + +//______________________________________________________________________________ +void AliEveEMCALData::GetGeomInfo(Int_t id, Int_t &iSupMod, Double_t& x, Double_t& y, Double_t& z) +{ + // Get geometrical information from hit/digit/cluster absolute id + + Int_t iTower = 0 ; + Int_t iIphi = 0 ; + Int_t iIeta = 0 ; + Int_t iphi = 0 ; + Int_t ieta = 0 ; + + //Geometry methods + fGeom->GetCellIndex(id,iSupMod,iTower,iIphi,iIeta); + //Gives SuperModule and Tower numbers + fGeom->RelPosCellInSModule(id, x, y, z); + +} + +//______________________________________________________________________________ +void AliEveEMCALData::CreateAllSModules() +{ + + // Create all fNsm super modules + for(Int_t sm = 0; sm < fNsm; sm++) + CreateSModule(sm); + +} + +//______________________________________________________________________________ +void AliEveEMCALData::CreateSModule(Int_t sm) +{ + // Create super-module-data for sm if it does not exist already. + if(fSM[sm] == 0) fSM[sm] = new AliEveEMCALSModuleData(sm,fGeom,fNode,fHMatrix); + if(fSMfull[sm] == 0 && sm < 10) fSMfull[sm] = new AliEveEMCALSModuleData(sm,fGeom,fNode,fHMatrix); + if(fSMhalf[sm-10] == 0 && sm > 10) fSMhalf[sm-10] = new AliEveEMCALSModuleData(sm,fGeom,fNode,fHMatrix); +} + +//______________________________________________________________________________ +void AliEveEMCALData::DropAllSModules() +{ + // Drop data of all existing sectors. + + for (Int_t sm = 0; sm < fNsm; sm++) { + if (fSM[sm] != 0) + fSM[sm]->DropData(); + } +} + +//______________________________________________________________________________ +void AliEveEMCALData::DeleteSuperModules() +{ + // + // delete all super module data + // + + for (Int_t sm = 0; sm < fNsm; sm++) + { + fSM[sm] = 0; + delete fSM[sm]; + } + + for(Int_t smf = 0; smf < fNsmfull; smf++) + { + fSMfull[smf] = 0; + delete fSMfull[smf]; + } + + for(Int_t smh = 0; smh < fNsmhalf; smh++) + { + fSMhalf[smh] = 0; + delete fSMhalf[smh]; + } + +} + +//______________________________________________________________________________ +void AliEveEMCALData::LoadHits(TTree* t) +{ + + // With TTreeH + + // These are global coordinates ! + char form[1000]; + const char *selection = ""; + const char *varexp = "fX:fY:fZ"; + sprintf(form,"EMCAL Hits '%s'", selection); + fPoint = new TEvePointSet(form); + + TEvePointSelector ps(t, fPoint, varexp, selection); + ps.Select(); + + if (fPoint->Size() == 0) { + Warning("emcal_hits", Form("No hits match '%s'", selection)); + delete fPoint; + // return 0; + } + + +// TObjArray *harr=NULL; +// TBranch *hbranch=t->GetBranch("EMCAL"); +// hbranch->SetAddress(&harr); + +// if(hbranch->GetEvent(0)) { +// for(Int_t ih = 0; ih < harr->GetEntriesFast(); ih++) { +// AliEMCALHit* hit =(AliEMCALHit*)harr->UncheckedAt(ih); +// if(hit != 0){ +// cout << "Hit info " << hit->GetId() << " " << hit->GetEnergy() << endl; +// fSM[iSupMod]->RegisterDigit(id,iSupMod,amp,x,y,z); +// } +// } +// } +// //******************************** +// // To be completed !!! +// //******************************** + +} + +//______________________________________________________________________________ +void AliEveEMCALData::LoadHitsFromEMCALLoader(AliEMCALLoader* emcl) +{ + + // Need to know the local position in each sm + + // With EMCALLoader + AliEMCALHit* hit; + + //Fill array of hits + TClonesArray *hits = (TClonesArray*)emcl->Hits(); + + //Get hits from the list + for(Int_t ihit = 0; ihit< hits->GetEntries();ihit++){ + //cout<<">> idig "<(hits->At(ihit)) ; + + if(hit != 0){ + cout << "Hit info " << hit->GetId() << " " << hit->GetEnergy() << endl; + } + } + + //******************************** + // To be completed !!! + //******************************** + + + +} + +//______________________________________________________________________________ +void AliEveEMCALData::LoadDigits(TTree *t) +{ + // + // load digits from the TreeD + // + + TClonesArray *digits = 0; + t->SetBranchAddress("EMCAL", &digits); + t->GetEntry(0); + + Int_t nEnt = digits->GetEntriesFast(); + cout << "nEnt: " << nEnt << endl; + AliEMCALDigit * dig; + + Float_t amp = -1 ; + Int_t id = -1 ; + Int_t iSupMod = 0 ; + Double_t x, y, z; + + for (Int_t idig = 0; idig < nEnt; idig++) + { + dig = static_cast(digits->At(idig)); + + if(dig != 0) { + id = dig->GetId() ; //cell (digit) label + amp = dig->GetAmp(); //amplitude in cell (digit) + + GetGeomInfo(id,iSupMod,x,y,z); + + fSM[iSupMod]->RegisterDigit(id,iSupMod,amp,x,y,z); +// fSM[iSupMod]->SaveDigit(dig); +// if(iSupModRegisterDigit(id,iSupMod,amp,x,y,z); +// if(iSupMod>fNsmfull) fSMhalf[iSupMod-10]->RegisterDigit(id,iSupMod,amp,x,y,z); + } + else { + cout << "Digit object empty" << endl; + return; + } + } // end loop digits + cout << "after loop on digits !" << endl; +} + +//______________________________________________________________________________ +void AliEveEMCALData::LoadDigitsFromEMCALLoader(AliEMCALLoader* emcl) +{ + + // + // load digits from EMCAL Loader + // + + AliEMCALDigit* dig; + + //Fill array of digits + TClonesArray *digits = (TClonesArray*)emcl->Digits(); + + //Get digits from the list + + Float_t amp = -1 ; + Int_t id = -1 ; + Int_t iSupMod = 0 ; + Double_t x, y, z; + + for(Int_t idig = 0; idig< digits->GetEntries();idig++){ + + dig = static_cast(digits->At(idig)) ; + + if(dig != 0){ + if(fDebug>1) cout << "Digit info " << dig->GetId() << " " << dig->GetAmp() << endl; + id = dig->GetId() ; //cell (digit) label + amp = dig->GetAmp(); //amplitude in cell (digit) + + GetGeomInfo(id,iSupMod,x,y,z); + + fSM[iSupMod]->RegisterDigit(id,iSupMod,amp,x,y,z); + } + else { + cout << "Digit object empty" << endl; + return; + } + } // end loop on digits + +} + +//______________________________________________________________________________ +void AliEveEMCALData::LoadDigitsFromESD() +{ + // + // Get digit information from esd + // + + AliESDCaloCells &cells= *(fESD->GetEMCALCells()); + Int_t ncell = cells.GetNumberOfCells() ; + Int_t type = cells.GetType(); + Float_t pos[3] ; + Int_t iSupMod = 0 ; + Double_t x, y, z; + + // Extract digit information from the ESDs + for (Int_t icell= 0; icell < ncell; icell++) + { + Int_t id = cells.GetCellNumber(icell); + Float_t amp = cells.GetAmplitude(icell); + + GetGeomInfo(id,iSupMod,x,y,z); + + fSM[iSupMod]->RegisterDigit(id,iSupMod,amp,x,y,z); + if(iSupModRegisterDigit(id,iSupMod,amp,x,y,z); + if(iSupMod>fNsmfull) fSMhalf[iSupMod-10]->RegisterDigit(id,iSupMod,amp,x,y,z); + + } // end loop cells +} + +//______________________________________________________________________________ +void AliEveEMCALData::LoadRecPoints(TTree* t) +{ + //************************************************* + // To be improved !!!!! + // Size and shape of cluster to be implemented + // + //************************************************* + + // From TTreeR + TObjArray *carr=NULL; + TBranch *cbranch=t->GetBranch("EMCALECARP"); + cbranch->SetAddress(&carr); + + if(cbranch->GetEvent(0)) { + for(Int_t ic = 0; ic < carr->GetEntriesFast(); ic++) { + AliEMCALRecPoint* rp =(AliEMCALRecPoint*)carr->UncheckedAt(ic); + if(rp){ + cout << "RecPoint info " << rp->GetAbsId() << " " << rp->GetEnergy() << endl; + Int_t iSupMod = rp->GetSuperModuleNumber(); + Float_t amp = rp->GetEnergy(); + TVector3 lpos; + rp->GetLocalPosition(lpos); + + fSM[iSupMod]->RegisterCluster(iSupMod,amp,lpos[0],lpos[1],lpos[2]); + } + } + } + +} + +//______________________________________________________________________________ +void AliEveEMCALData::LoadRecPointsFromEMCALLoader(AliEMCALLoader* emcl) +{ + //************************************************* + // To be improved !!!!! + // Size and shape of cluster to be implemented + // + //************************************************* + + // From EMCALLoader + AliEMCALRecPoint* rp; + + //Fill array of clusters + TClonesArray *clusters = (TClonesArray*)emcl->RecPoints(); + + //Get clusters from the list + for(Int_t iclu = 0; iclu< clusters->GetEntries();iclu++){ + + rp = static_cast(clusters->At(iclu)) ; + + if(rp){ + cout << "RecPoint info " << rp->GetAbsId() << " " << rp->GetEnergy() << endl; + Int_t iSupMod = rp->GetSuperModuleNumber(); + Float_t amp = rp->GetEnergy(); + TVector3 lpos; + rp->GetLocalPosition(lpos); + + fSM[iSupMod]->RegisterCluster(iSupMod,amp,lpos[0],lpos[1],lpos[2]); + } + } + +} + +//______________________________________________________________________________ +void AliEveEMCALData::LoadRecPointsFromESD() +{ + Int_t iSupMod = 0 ; + Double_t x, y, z; + Int_t iSM = 0 ; + Int_t iT = 0 ; + Int_t iIp = 0 ; + Int_t iIe = 0 ; + Int_t ip = 0 ; + Int_t ie = 0 ; + Double_t xd, yd, zd; + Float_t pos[3] ; + + // Get reconstructed vertex position + AliESDVertex* primVertex =(AliESDVertex*) fESD->GetVertex(); + Double_t vertex_position[3] ; + primVertex->GetXYZ(vertex_position) ; + + //Get the CaloClusters + //select EMCAL clusters only + TRefArray * caloClusters = new TRefArray(); + fESD->GetEMCALClusters(caloClusters); + Int_t nclus = caloClusters->GetEntries(); + cout << "nclus: " << nclus << endl; + + if(!caloClusters) return; + + for (Int_t iclus = 0; iclus < nclus; iclus++) + { + AliESDCaloCluster *clus = (AliESDCaloCluster *) caloClusters->At(iclus) ; + //Get the cluster info + + Float_t energy = clus->E() ; + Int_t eneInt = (Int_t) energy*500+0.5; + Float_t disp = clus->GetClusterDisp() ; + Int_t iprim = clus->GetLabel(); + + clus->GetPosition(pos) ; // Global position + TVector3 vpos(pos[0],pos[1],pos[2]) ; + TLorentzVector p4 ; + TVector3 p3; + clus->GetMomentum(p4,vertex_position); + p3.SetXYZ(p4[0],p4[1],p4[2]); + Float_t eta = p3.Eta(); + Float_t phi = ( (p3.Phi()) < 0) ? (p3.Phi()) + 2. * TMath::Pi() : (p3.Phi()); + + Int_t mult = clus->GetNCells() ; + if(fDebug>1) { + cout << "In cluster: " << iclus << ", ncells: " << mult << ", energy: " << + eneInt << ", disp: " << disp << endl; + cout << "Cluster " << iclus << ", eta: " << eta << ", phi: " << phi << endl; + } + + Int_t clusId = 0; + fGeom->GetAbsCellIdFromEtaPhi(eta,phi,clusId); + if(fDebug>1) { + cout << "Abs Cluster Id: " << clusId << ", xc: " << pos[0] << + ", yc: " << pos[1] << ", zc: " << pos[2] << endl; + } + + GetGeomInfo(clusId,iSupMod,x,y,z); + + //******** Not used yet but will come ******** + Int_t digMult = clus->GetNCells() ; + UShort_t *digID = clus->GetCellsAbsId() ; + for(Int_t i=0; iRelPosCellInSModule(digID[i], xd, yd, zd); + //Geometry methods + fGeom->GetCellIndex(digID[i],iSM,iT,iIp,iIe); + //Gives SuperModule and Tower numbers + + } // end digit loop + //********************************************* + + fSM[iSupMod]->RegisterCluster(iSM,energy,x,y,z); + + } // end cluster loop +} + +//______________________________________________________________________________ +AliEveEMCALSModuleData* AliEveEMCALData::GetSModuleData(Int_t sm) +{ + // + // return super module data + // + + if (sm < 0 || sm > fNsm) + { + printf("The number of super modules must be lower or equal to %d",fNsm); + return 0; + } + + return fSM[sm]; +} + +//______________________________________________________________________________ +void AliEveEMCALData::LoadRaw() +{ + +} + diff --git a/EVE/EveDet/AliEveEMCALData.h b/EVE/EveDet/AliEveEMCALData.h new file mode 100644 index 00000000000..0652e5c4ba9 --- /dev/null +++ b/EVE/EveDet/AliEveEMCALData.h @@ -0,0 +1,92 @@ +//********************************************************************* +// - AliEVE implementation - +// Fill containers for visualisation of EMCAL data structures +// - read and store MC Hits +// - read and store digits from esds or runloader +// - read and store clusters from esds or runloader +// +// Author: Magali Estienne (magali.estienne@cern.ch) +// June 30 2008 +//********************************************************************* + +#ifndef AliEveEMCALData_H +#define AliEveEMCALData_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +class AliRunLoader; +class AliESDEvent; +class AliEMCAL; +class AliEMCALLoader; +class AliEMCALGeometry; +class AliEveEMCALSModule; +class AliEveEMCALSModuleData; + +class AliEveEMCALData : public TObject, public TEveRefCnt +{ + public: + AliEveEMCALData(); + AliEveEMCALData(AliRunLoader* rl, TGeoNode* node, TGeoHMatrix* m); + ~AliEveEMCALData(); + + void Reset(); + void SetTree(TTree* tree); + void SetESD(AliESDEvent* esd); + void SetNode(TGeoNode* node); + void InitEMCALGeom(AliRunLoader* rl); + void GetGeomInfo(Int_t id, Int_t &iSupMod, Double_t& x, Double_t& y, Double_t& z); + + void CreateAllSModules(); + void CreateSModule(Int_t sm); + void DropAllSModules(); + void DeleteSuperModules(); + + void LoadHits(TTree* t); + void LoadDigits(TTree* t); + void LoadRecPoints(TTree* t); + void LoadHitsFromEMCALLoader(AliEMCALLoader* emcl); + void LoadDigitsFromEMCALLoader(AliEMCALLoader* emcl); + void LoadRecPointsFromEMCALLoader(AliEMCALLoader* emcl); + void LoadDigitsFromESD(); + void LoadRecPointsFromESD(); + void LoadRaw(); + + AliEveEMCALSModuleData* GetSModuleData(Int_t sm); + TEvePointSet* GetPointSetData() {return fPoint;}; + + protected: + AliEMCAL* fEmcal; // EMCal data member + AliEMCALGeometry* fGeom; // Data member to set/call EMCAL geometry + TGeoNode* fNode; // node + TGeoHMatrix* fHMatrix; // matrix for local to global transformation + TTree* fTree; // tree + AliESDEvent* fESD; // esd + Int_t fNsm; // Total number of Super Modules + Int_t fNsmfull; // Number of full size Super Modules + Int_t fNsmhalf; // Number of half size Super Modules + std::vector fSM; // vector of fNsm SModules + std::vector fSMfull; // vector of fNsmfull SModules + std::vector fSMhalf; // vector of fNhalf SModules + AliRunLoader* fRunLoader; // Run Loader + Int_t fDebug; // Debug option + TEvePointSet* fPoint; // TEvePointSet for hits + + private: + AliEveEMCALData(const AliEveEMCALData &edata); + AliEveEMCALData& operator=(const AliEveEMCALData&); // Not implemented + + ClassDef(AliEveEMCALData, 0); // Base class for TRD hits visualisation +}; + +#endif diff --git a/EVE/EveDet/AliEveEMCALSModule.cxx b/EVE/EveDet/AliEveEMCALSModule.cxx new file mode 100644 index 00000000000..f3ecddb6b4d --- /dev/null +++ b/EVE/EveDet/AliEveEMCALSModule.cxx @@ -0,0 +1,474 @@ +//************************************************************************* +// EMCAL event display +// Visualization of an EMCAL super module. +// +// Author: Magali Estienne (magali.estienne@cern.ch) +// June 30 2008 +//************************************************************************* + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "AliEveEMCALData.h" +#include "AliEveEMCALSModule.h" +#include "AliEveEMCALSModuleData.h" +#include "AliEMCALHit.h" +#include "AliEMCALDigit.h" + + +ClassImp(AliEveEMCALSModule) + +TEveFrameBox* AliEveEMCALSModule::fFrameBigBox = 0; +TEveFrameBox* AliEveEMCALSModule::fFrameSmallBox = 0; +TEveRGBAPalette* AliEveEMCALSModule::fFrameDigPalette = 0; +TEveRGBAPalette* AliEveEMCALSModule::fFrameCluPalette = 0; + +AliEveEMCALSModule::AliEveEMCALSModule(Int_t smid, const Text_t* n, const Text_t* t) : + TEveElement(fFrameColor), + TNamed(n,t), + fEMCALData(0), + fEMCALSModuleData(0), + fFrameColor((Color_t)10), + fRTS(1), + fSModuleID(smid), + fQuadSet(new TEveQuadSet(n,t)), + fQuadSet2(new TEveQuadSet(n,t)), + fPointSet(new TEvePointSet(n)), + fThreshold(0), + fMaxVal(4096), + fClusterSize(5), + fHitSize(5), + fColorArray(0), + fDebug(0) +{ + // Constructor. + Char_t name[256]; + if (smid < 10) { + sprintf(name,"Full Super Module %02d",smid); + } else { + sprintf(name,"Half Super Module %02d",smid); + } + SetName(name); + + for(Int_t i=0; i<3; i++) fSMBigBBox[i] = 0.; + for(Int_t i=0; i<3; i++) fSMSmallBBox[i] = 0.; + for(Int_t i=0; i<3; i++) fSMBBoxCenter[i] = 0.; + + // Hits + fPointSet->IncDenyDestroy(); + AddElement(fPointSet); + // Digits + fQuadSet->IncDenyDestroy(); + AddElement(fQuadSet); + // Clusters + fQuadSet2->IncDenyDestroy(); + AddElement(fQuadSet2); + +} + +AliEveEMCALSModule::AliEveEMCALSModule(const AliEveEMCALSModule &esm) : + TEveElement(fFrameColor), + TNamed(), + fEMCALData(esm.fEMCALData), + fEMCALSModuleData(esm.fEMCALSModuleData), + fFrameColor(esm.fFrameColor), + fRTS(esm.fRTS), + fSModuleID(esm.fSModuleID), + fQuadSet(esm.fQuadSet), + fQuadSet2(esm.fQuadSet2), + fPointSet(esm.fPointSet), + fThreshold(esm.fThreshold), + fMaxVal(esm.fMaxVal), + fClusterSize(esm.fClusterSize), + fHitSize(esm.fHitSize), + fColorArray(esm.fColorArray), + fDebug(esm.fDebug) +{ + // Constructor. + Char_t name[256]; + if (fSModuleID < 10) { + sprintf(name,"Full Super Module %02d",fSModuleID); + } else { + sprintf(name,"Half Super Module %02d",fSModuleID); + } + SetName(name); + + for(Int_t i=0; i<3; i++) fSMBigBBox[i] = 0.; + for(Int_t i=0; i<3; i++) fSMSmallBBox[i] = 0.; + for(Int_t i=0; i<3; i++) fSMBBoxCenter[i] = 0.; + + // Hits + fPointSet->IncDenyDestroy(); + AddElement(fPointSet); + // Digits + fQuadSet->IncDenyDestroy(); + AddElement(fQuadSet); + // Clusters + fQuadSet2->IncDenyDestroy(); + AddElement(fQuadSet2); + +} + +AliEveEMCALSModule::~AliEveEMCALSModule() +{ + // + // Destructor. + // + + fPointSet->DecDenyDestroy(); + fQuadSet->DecDenyDestroy(); + + if(fEMCALData) fEMCALData->DecRefCount(); + if(fFrameBigBox) fFrameBigBox->Delete(); + if(fFrameSmallBox) fFrameSmallBox->Delete(); + if(fFrameDigPalette) fFrameDigPalette->Delete(); + if(fFrameCluPalette) fFrameCluPalette->Delete(); + +} + +//______________________________________________________________________________ +void AliEveEMCALSModule::DropData() +{ + // + // release the sm data + // + +// fNDigits = 0; +// fNClusters = 0; +// fNHits = 0; + + return; + +} + +//______________________________________________________________________________ +void AliEveEMCALSModule::ComputeBBox() +{ + // + // bounding box + // + + fEMCALSModuleData->GetSModuleBigBox(fSMBigBBox[0],fSMBigBBox[1], fSMBigBBox[2]); + fEMCALSModuleData->GetSModuleSmallBox(fSMSmallBBox[0],fSMSmallBBox[1], fSMSmallBBox[2]); + +// if (fgStaticInitDone) return; +// fgStaticInitDone = kTRUE; + + fFrameBigBox = new TEveFrameBox(); + fFrameBigBox->SetAABoxCenterHalfSize(0, 0, 0, fSMBigBBox[0], fSMBigBBox[1], fSMBigBBox[2]); + fFrameBigBox->SetFrameColor((Color_t)10); + fFrameDigPalette = new TEveRGBAPalette(0,512); + fFrameDigPalette->SetLimits(0, 1024); + fFrameDigPalette->IncRefCount(); + + fFrameSmallBox = new TEveFrameBox(); + fFrameSmallBox->SetAABoxCenterHalfSize(0, 0, 0, fSMSmallBBox[0], fSMSmallBBox[1], fSMSmallBBox[2]); + fFrameSmallBox->SetFrameColor((Color_t)10); + fFrameCluPalette = new TEveRGBAPalette(0,512); + fFrameCluPalette->SetLimits(0, 1024); + fFrameCluPalette->IncRefCount(); + + BBoxInit(); + + fBBox[0] = - 2*fSMBigBBox[0]; + fBBox[1] = + 2*fSMBigBBox[0]; + fBBox[2] = - 2*fSMBigBBox[1]; + fBBox[3] = + 2*fSMBigBBox[1]; + fBBox[4] = - 2*fSMBigBBox[2]; + fBBox[5] = + 2*fSMBigBBox[2]; + +} + +//______________________________________________________________________________ +void AliEveEMCALSModule::SetThreshold(Short_t t) +{ + // + // digits amplitude threshold + // + + fThreshold = TMath::Min(t, (Short_t)(fMaxVal - 1)); + ClearColorArray(); + IncRTS(); + +} + +//______________________________________________________________________________ +void AliEveEMCALSModule::SetMaxVal(Int_t mv) +{ + // + // digits amplitude maximum value + // + + fMaxVal = TMath::Max(mv, (Int_t)(fThreshold + 1)); + ClearColorArray(); + IncRTS(); + +} + +//______________________________________________________________________________ +void AliEveEMCALSModule::SetClusterSize(Int_t size) +{ + // + // cluster point size + // + + fClusterSize = TMath::Max(1, size); + IncRTS(); + +} + +//______________________________________________________________________________ +void AliEveEMCALSModule::SetHitSize(Int_t size) +{ + // + // hit point size + // + + fHitSize = TMath::Max(1, size); + IncRTS(); + +} + +//______________________________________________________________________________ +void AliEveEMCALSModule::SetupColor(Int_t val, UChar_t* pixel) const +{ + // + // RGBA color for amplitude "val" + // + + Float_t div = TMath::Max(1, fMaxVal - fThreshold); + Int_t nCol = gStyle->GetNumberOfColors(); + Int_t cBin = (Int_t) TMath::Nint(nCol*(val - fThreshold)/div); + + TEveUtil::TEveUtil::ColorFromIdx(gStyle->GetColorPalette(TMath::Min(nCol - 1, cBin)), pixel); + +} + +//______________________________________________________________________________ +Int_t AliEveEMCALSModule::ColorIndex(Int_t val) const +{ + // + // index color + // + + if(val < fThreshold) val = fThreshold; + if(val > fMaxVal) val = fMaxVal; + + Float_t div = TMath::Max(1, fMaxVal - fThreshold); + Int_t nCol = gStyle->GetNumberOfColors(); + Int_t cBin = (Int_t) TMath::Nint(nCol*(val - fThreshold)/div); + + return gStyle->GetColorPalette(TMath::Min(nCol - 1, cBin)); + +} + +//______________________________________________________________________________ +void AliEveEMCALSModule::SetupColorArray() const +{ + // + // build array of colors + // + + if(fColorArray) + return; + + fColorArray = new UChar_t [4 * (fMaxVal - fThreshold + 1)]; + UChar_t* p = fColorArray; + for(Int_t v=fThreshold; v<=fMaxVal; ++v, p+=4) + SetupColor(v, p); + +} + +//______________________________________________________________________________ +void AliEveEMCALSModule::ClearColorArray() +{ + // + // delete array of colors + // + + if(fColorArray) { + delete [] fColorArray; + fColorArray = 0; + } +} + +//______________________________________________________________________________ +void AliEveEMCALSModule::SetDataSource(AliEveEMCALData* data) +{ + // Set source of data. + + if (data == fEMCALData) return; + if(fEMCALData) fEMCALData->DecRefCount(); + fEMCALData = data; + if(fEMCALData) fEMCALData->IncRefCount(); + + fEMCALSModuleData = GetSModuleData(); + + IncRTS(); +} + +//______________________________________________________________________________ +AliEveEMCALSModuleData* AliEveEMCALSModule::GetSModuleData() const +{ + // Return source of data. + + return fEMCALData ? fEMCALData->GetSModuleData(fSModuleID) : 0; +} + +//______________________________________________________________________________ +void AliEveEMCALSModule::UpdateQuads() +{ + // Update hit/digit/cluster representation. + + vector< vector > bufferDigit; + vector< vector > bufferCluster; + vector< vector > bufferHit; + Float_t x0, y0, z, w, h, clsq; + Int_t charge, cathode, nDigits, nClusters, nHits, oldSize, ic1, ic2; + Double_t clsX, clsY, clsZ; + Float_t hitX, hitY, hitZ; + Int_t smId = fEMCALSModuleData->GetSmId(); + + //-------------------------- + // Hits from runloader + //-------------------------- + fPointSet->Reset(); + + TEvePointSet* points = fEMCALData->GetPointSetData(); + char form[1000]; + if(points){ + sprintf(form,"N=%d", points->Size()); + points->SetTitle(form); + points->SetMarkerSize(.5); + points->SetMarkerColor((Color_t)2); + fPointSet->AddElement(points); + } + else {printf("There is no hits in Runloader \n"); } + + if (fEMCALSModuleData != 0) { + + // digits ------------------------ + fQuadSet->SetOwnIds(kTRUE); + fQuadSet->Reset(TEveQuadSet::kQT_RectangleYZFixedDimX, kFALSE, 32); + fQuadSet->SetDefWidth (fEMCALSModuleData->GetPhiTileSize()); + fQuadSet->SetDefHeight(fEMCALSModuleData->GetEtaTileSize()); + fQuadSet->RefMainTrans().SetFrom(*fEMCALSModuleData->GetSModuleMatrix()); + fQuadSet->SetPalette(fFrameDigPalette); + if(smIdGetNsmf()) + fQuadSet->SetFrame(fFrameBigBox); + else fQuadSet->SetFrame(fFrameSmallBox); + + bufferDigit = fEMCALSModuleData->GetDigitBuffer(); + if(!bufferDigit.empty()) + { + nDigits = fEMCALSModuleData->GetNDigits(); + if(fDebug>1) cout << "nDigits: " << nDigits << endl; + // loop over digits + for (Int_t id = 0; id < nDigits; id++) { + if(fDebug>1) { + cout << "bufferDigit[" << id << "][0]: " << bufferDigit[id][0] << endl; + cout << "bufferDigit[" << id << "][1]: " << bufferDigit[id][1] << endl; + cout << "bufferDigit[" << id << "][2]: " << bufferDigit[id][2] << endl; + cout << "bufferDigit[" << id << "][3]: " << bufferDigit[id][3] << endl; + cout << "bufferDigit[" << id << "][4]: " << bufferDigit[id][4] << endl; + } + Int_t iid = bufferDigit[id][0]; + Int_t isupMod = bufferDigit[id][1]; + Float_t iamp = bufferDigit[id][2]; + Float_t ix = bufferDigit[id][3]; + Float_t iy = bufferDigit[id][4]; + Float_t iz = bufferDigit[id][5]; + + fQuadSet->AddQuad(iy, iz); + fQuadSet->QuadValue(iamp); + // fQuadSet->QuadId(iid); + + } // end digits loop + } + else { printf("There is no digits in SM %d \n", smId); } + + // hits -------------------------- + bufferHit = fEMCALSModuleData->GetDigitBuffer(); + if(!bufferHit.empty()) + { + nHits = fEMCALSModuleData->GetNHits(); + if(fDebug>1) cout << "nHits: " << nHits << endl; + oldSize = fPointSet->GrowFor(nHits); + // Loop over hits + for (Int_t ih = 0; ih < nHits; ih++) { + hitX = bufferHit[ih][2]; + hitY = bufferHit[ih][3]; + hitZ = bufferHit[ih][4]; + fPointSet->SetPoint(ih,hitX,hitY,hitZ); + } + } + else {printf("There is no hits in SM %d \n", smId); } + + // clusters ------------------------ + fQuadSet2->SetOwnIds(kTRUE); + fQuadSet2->Reset(TEveQuadSet::kQT_RectangleYZFixedDimX, kFALSE, 32); + fQuadSet2->SetDefWidth (fEMCALSModuleData->GetPhiTileSize()); + fQuadSet2->SetDefHeight(fEMCALSModuleData->GetEtaTileSize()); + fQuadSet2->RefMainTrans().SetFrom(*fEMCALSModuleData->GetSModuleMatrix()); + fQuadSet2->SetPalette(fFrameCluPalette); + if(smIdGetNsmf()) + fQuadSet2->SetFrame(fFrameBigBox); + else fQuadSet2->SetFrame(fFrameSmallBox); + + bufferCluster = fEMCALSModuleData->GetClusterBuffer(); + if(!bufferCluster.empty()) + { + nClusters = fEMCALSModuleData->GetNClusters(); + if(fDebug>1) cout << "nClusters: " << nClusters << endl; + // loop over clusters + for (Int_t id = 0; id < nClusters; id++) { + if(fDebug>1) { + cout << "bufferCluster[" << id << "][0]: " << bufferCluster[id][0] << endl; + cout << "bufferCluster[" << id << "][1]: " << bufferCluster[id][1] << endl; + cout << "bufferCluster[" << id << "][2]: " << bufferCluster[id][2] << endl; + cout << "bufferCluster[" << id << "][3]: " << bufferCluster[id][3] << endl; + cout << "bufferCluster[" << id << "][4]: " << bufferCluster[id][4] << endl; + } + Int_t isupMod = bufferCluster[id][0]; + Float_t iamp = bufferCluster[id][1]; + Float_t ix = bufferCluster[id][2]; + Float_t iy = bufferCluster[id][3]; + Float_t iz = bufferCluster[id][4]; + + fQuadSet2->AddQuad(iy, iz); + fQuadSet2->QuadValue(iamp); + // fQuadSet2->QuadId(iid); + + } // end clusters loop + } + else { printf("There is no clusters in SM %d \n", smId); } + + } // end if (fEMCALSModuleData != 0) + +} + +//______________________________________________________________________________ +void AliEveEMCALSModule::SetSModuleID(Int_t id) +{ + // Set id of chamber to display. + + if (id < 0) id = 0; + if (id > 12) id = 12; + + fSModuleID = id; + IncRTS(); +} diff --git a/EVE/EveDet/AliEveEMCALSModule.h b/EVE/EveDet/AliEveEMCALSModule.h new file mode 100644 index 00000000000..9854721fc7f --- /dev/null +++ b/EVE/EveDet/AliEveEMCALSModule.h @@ -0,0 +1,97 @@ +//************************************************************************* +// EMCAL event display +// Visualization of an EMCAL super module. +// +// Author: Magali Estienne (magali.estienne@cern.ch) +// June 30 2008 +//************************************************************************* + +#ifndef ALIEVEEMCALSMODULE_H +#define ALIEVEEMCALSMODULE_H + +#include +#include +#include +#include +#include +#include +#include + +#include + +class AliEveEMCALData; +class AliEveEMCALSModuleData; + + +class AliEveEMCALSModule : public TEveElement, + public TNamed, + public TAtt3D, + public TAttBBox +{ + + public: + AliEveEMCALSModule(Int_t smodid, const Text_t* n, const Text_t* t); + ~AliEveEMCALSModule(); + + void DropData(); + + virtual void ComputeBBox(); + virtual UInt_t IncRTS() { return ++fRTS; }; + virtual Bool_t CanEditMainColor() const { return kTRUE; } + + void SetDataSource(AliEveEMCALData *data); + void SetSModuleID(Int_t id); + void SetFrameColor(Color_t col) { fFrameColor = col; IncRTS(); }; + AliEveEMCALData* GetData() const { return fEMCALData; }; + AliEveEMCALSModuleData* GetSModuleData() const; + Int_t GetID() const { return fSModuleID; }; + void SetThreshold(Short_t t); + void SetMaxVal(Int_t mv); + void SetClusterSize(Int_t size); + void SetHitSize(Int_t size); + + void UpdateQuads(); + + protected: + AliEveEMCALData *fEMCALData; // data for the current event + AliEveEMCALSModuleData *fEMCALSModuleData; // data of super module + Color_t fFrameColor; // main coloring + UInt_t fRTS; //! Rendering Time Stamp + Int_t fSModuleID; // Id of super module, 0 to 11 + TEveQuadSet *fQuadSet; // 1st cathode plane digits + TEveQuadSet *fQuadSet2; // 2nd cathode plane digits + TEvePointSet *fPointSet; // reconstructed points (1st cathode) + Short_t fThreshold; // digit amplitude threshold + Int_t fMaxVal; // digit amplitude maximum value + Int_t fClusterSize; // cluster point size + Int_t fHitSize; // hit point size + mutable UChar_t *fColorArray; // color-cache + Int_t fDebug; // Debug option + + Float_t fSMBigBBox[3]; + Float_t fSMSmallBBox[3]; + Float_t fSMBBoxCenter[3]; + + static TEveFrameBox *fFrameBigBox; // Frame box per super module + static TEveFrameBox *fFrameSmallBox; // Frame box per super module + static TEveRGBAPalette *fFrameDigPalette; // Signal to color mapping for EMCAL + static TEveRGBAPalette *fFrameCluPalette; // Signal to color mapping for EMCAL + + void SetupColor(Int_t val, UChar_t* pix) const; + + //****** Not used yet ************** + void ClearColorArray(); + void SetupColorArray() const; + UChar_t* ColorFromArray(Int_t val) const; + void ColorFromArray(Int_t val, UChar_t* pix) const; + Int_t ColorIndex(Int_t val) const; + //********************************** + + private: + AliEveEMCALSModule(const AliEveEMCALSModule&); // Not implemented + AliEveEMCALSModule& operator=(const AliEveEMCALSModule&); // Not implemented + + ClassDef(AliEveEMCALSModule, 0); // Base class for TRD hits visualisation +}; + +#endif diff --git a/EVE/EveDet/AliEveEMCALSModuleData.cxx b/EVE/EveDet/AliEveEMCALSModuleData.cxx new file mode 100644 index 00000000000..fa5d9fd09ae --- /dev/null +++ b/EVE/EveDet/AliEveEMCALSModuleData.cxx @@ -0,0 +1,235 @@ +//************************************************************************* +// EMCAL event display +// Store the data related to each Super Module (SM) +// Possible storage of hits, digits and clusters per SM +// +// Author: Magali Estienne (magali.estienne@cern.ch) +// June 30 2008 +//************************************************************************* + +#include +#include + +#include "AliEveEMCALSModuleData.h" + +#include + +#include +#include +#include +#include +#include +#include + +#include + +/////////////////////////////////////////////////////////////////////////////// +/// +/// AliEveEMCALSModuleData: geometry and digits +/// +/////////////////////////////////////////////////////////////////////////////// + + +ClassImp(AliEveEMCALSModuleData) + +Float_t AliEveEMCALSModuleData::fSModuleBigBox0 = 0.; +Float_t AliEveEMCALSModuleData::fSModuleBigBox1 = 0.; +Float_t AliEveEMCALSModuleData::fSModuleBigBox2 = 0.; +Float_t AliEveEMCALSModuleData::fSModuleSmallBox0 = 0.; +Float_t AliEveEMCALSModuleData::fSModuleSmallBox1 = 0.; +Float_t AliEveEMCALSModuleData::fSModuleSmallBox2 = 0.; +Float_t AliEveEMCALSModuleData::fSModuleCenter0 = 0.; +Float_t AliEveEMCALSModuleData::fSModuleCenter1 = 0.; +Float_t AliEveEMCALSModuleData::fSModuleCenter2 = 0.; + +//______________________________________________________________________________ +AliEveEMCALSModuleData::AliEveEMCALSModuleData(Int_t sm,AliEMCALGeometry* geom, TGeoNode* node, TGeoHMatrix* m) : + TObject(), + fGeom(geom), + fNode(node), + fSmId(sm), + fNsm(0), + fNsmfull(0), + fNsmhalf(0), + fNDigits(0), + fNClusters(0), + fNHits(0), + fHitArray(0), + fDigitArray(0), + fClusterArray(0), + fMatrix(0), + fHMatrix(m) +{ + // + // constructor + // + + Init(sm); + +} + +//______________________________________________________________________________ + AliEveEMCALSModuleData::AliEveEMCALSModuleData(const AliEveEMCALSModuleData &esmdata) : + TObject(), + fGeom(esmdata.fGeom), + fNode(esmdata.fNode), + fSmId(esmdata.fSmId), + fNsm(esmdata.fNsm), + fNsmfull(esmdata.fNsmfull), + fNsmhalf(esmdata.fNsmhalf), + fNDigits(esmdata.fNDigits), + fNClusters(esmdata.fNClusters), + fNHits(esmdata.fNHits), + fHitArray(esmdata.fHitArray), + fDigitArray(esmdata.fDigitArray), + fClusterArray(esmdata.fClusterArray), + fMatrix(esmdata.fMatrix), + fHMatrix(esmdata.fHMatrix) +{ + // + // constructor + // + + Init(esmdata.fNsm); + +} + +//______________________________________________________________________________ +AliEveEMCALSModuleData::~AliEveEMCALSModuleData() +{ + // + // destructor + // + + if(!fHitArray.empty()){ + fHitArray.clear(); + } + if(!fDigitArray.empty()){ + fDigitArray.clear(); + } + if(!fClusterArray.empty()){ + fClusterArray.clear(); + } + +} + +//______________________________________________________________________________ +void AliEveEMCALSModuleData::DropData() +{ + // + // release the sm data + // + + fNDigits = 0; + fNClusters = 0; + fNHits = 0; + + if(!fHitArray.empty()) + fHitArray.clear(); + + if(!fDigitArray.empty()) + fDigitArray.clear(); + + if(!fClusterArray.empty()) + fClusterArray.clear(); + + return; + +} + +// ______________________________________________________________________________ +void AliEveEMCALSModuleData::Init(Int_t sm) +{ + fNsm = 12; + fNsmfull = 10; + fNsmhalf = 2; + + fPhiTileSize = fGeom->GetPhiTileSize(); + fEtaTileSize = fGeom->GetPhiTileSize(); + + TGeoBBox* bbbox = (TGeoBBox*) fNode->GetDaughter(0) ->GetVolume()->GetShape(); + bbbox->Dump(); + TGeoBBox* sbbox = (TGeoBBox*) fNode->GetDaughter(10)->GetVolume()->GetShape(); + sbbox->Dump(); + + fMatrix = (TGeoMatrix*) fNode->GetDaughter(sm)->GetMatrix(); + + if(smGetDX(); + fSModuleBigBox1 = bbbox->GetDY(); + fSModuleBigBox2 = bbbox->GetDZ(); + } + else + { + fSModuleSmallBox0 = sbbox->GetDX(); + fSModuleSmallBox1 = sbbox->GetDY(); + fSModuleSmallBox2 = sbbox->GetDZ(); + } +} + + +// ______________________________________________________________________________ +void AliEveEMCALSModuleData::RegisterDigit(Int_t AbsId, Int_t isupMod, Float_t iamp, Float_t ix, Float_t iy, Float_t iz) +{ + // + // add a digit to this sm + // + + vector bufDig(6); + bufDig[0] = AbsId; + bufDig[1] = isupMod; + bufDig[2] = iamp; + bufDig[3] = ix; + bufDig[4] = iy; + bufDig[5] = iz; + + cout << "bufDig[0]: " << bufDig[0] << ", bufDig[1]: " << bufDig[1] << ", bufDig[2]: " << bufDig[2] << + ", bufDig[3]: " << bufDig[3] << ", bufDig[4]: " << bufDig[4] << ", bufDig[5]: " << bufDig[5] << endl; + + fDigitArray.push_back(bufDig); + + fNDigits++; + +} + +// ______________________________________________________________________________ +void AliEveEMCALSModuleData::RegisterHit(Int_t AbsId, Int_t isupMod, Float_t iamp, Float_t ix, Float_t iy, Float_t iz) +{ + // + // add a hit to this sm + // + + vector bufHit(6); + bufHit[0] = AbsId; + bufHit[1] = isupMod; + bufHit[2] = iamp; + bufHit[3] = ix; + bufHit[4] = iy; + bufHit[5] = iz; + + fHitArray.push_back(bufHit); + + fNHits++; + +} + +// ______________________________________________________________________________ +void AliEveEMCALSModuleData::RegisterCluster(Int_t isupMod, Float_t iamp, Float_t ix, Float_t iy, Float_t iz) +{ + // + // add a cluster to this sm + // + + vector bufClu(5); + bufClu[0] = isupMod; + bufClu[1] = iamp; + bufClu[2] = ix; + bufClu[3] = iy; + bufClu[4] = iz; + + fClusterArray.push_back(bufClu); + + fNClusters++; + +} diff --git a/EVE/EveDet/AliEveEMCALSModuleData.h b/EVE/EveDet/AliEveEMCALSModuleData.h new file mode 100644 index 00000000000..62887214ab0 --- /dev/null +++ b/EVE/EveDet/AliEveEMCALSModuleData.h @@ -0,0 +1,97 @@ +//************************************************************************* +// EMCAL event display +// Store the data related to each Super Module +// +// Author: Magali Estienne (magali.estienne@cern.ch) +// June 30 2008 +//************************************************************************* + +#ifndef AliEveEMCALSModuleData_H +#define AliEveEMCALSModuleData_H + +#include + +#include +#include +#include +#include +#include + +class AliEMCALGeometry; + +class AliEveEMCALSModuleData : public TObject +{ +public: + AliEveEMCALSModuleData(Int_t chamber,AliEMCALGeometry* geom,TGeoNode* node, TGeoHMatrix* m); + virtual ~AliEveEMCALSModuleData(); + + void DropData(); + + void Init(Int_t sm); + + void RegisterDigit(Int_t AbsId, Int_t isupMod, Float_t iamp, Float_t ix, Float_t iy, Float_t iz); + void RegisterCluster(Int_t isupMod, Float_t iamp, Float_t ix, Float_t iy, Float_t iz); + void RegisterHit(Int_t AbsId, Int_t isupMod, Float_t iamp, Float_t ix, Float_t iy, Float_t iz); + + Int_t GetNDigits() const { return fNDigits; }; + Int_t GetNClusters() const { return fNClusters; }; + Int_t GetNHits() const { return fNHits; }; + Int_t GetSmId() const { return fSmId; }; + Int_t GetNsm() const {return fNsm;}; + Int_t GetNsmf() const {return fNsmfull;}; + Int_t GetNsmh() const {return fNsmhalf;}; + vector< vector > GetDigitBuffer() { return fDigitArray; }; + vector< vector > GetClusterBuffer() { return fClusterArray; }; + vector< vector > GetHitBuffer() { return fHitArray; }; + + void GetSModuleBigBox(Float_t& bbox0, Float_t& bbox1, Float_t& bbox2) + { bbox0 = fSModuleBigBox0; bbox1 = fSModuleBigBox1; bbox2 = fSModuleBigBox2;}; + void GetSModuleSmallBox(Float_t& bbox0, Float_t& bbox1, Float_t& bbox2) + { bbox0 = fSModuleSmallBox0; bbox1 = fSModuleSmallBox1; bbox2 = fSModuleSmallBox2;}; + void GetSModuleCenter(Float_t& bboxCenter0, Float_t& bboxCenter1, Float_t& bboxCenter2) + { bboxCenter0 = fSModuleCenter0; bboxCenter1 = fSModuleCenter1; bboxCenter2 = fSModuleCenter2;}; + Float_t GetPhiTileSize() {return fPhiTileSize;}; + Float_t GetEtaTileSize() {return fEtaTileSize;}; + TGeoMatrix* GetSModuleMatrix() {return fMatrix;}; + +protected: + + AliEMCALGeometry* fGeom; + TGeoNode* fNode; + Int_t fSmId; // number of the chamber, 0 to 13 + Int_t fNsm; + Int_t fNsmfull; + Int_t fNsmhalf; + Int_t fNDigits; // number of found digits + Int_t fNClusters; // number of found rec points + Int_t fNHits; // number of simulation hits + + Float_t fPhiTileSize; + Float_t fEtaTileSize; + + vector< vector > fHitArray; //|| hits coordinates, etc. + vector< vector > fDigitArray; //|| digits coordinates, etc. + vector< vector > fClusterArray; //|| cluster coordinates, etc. + + static Float_t fSModuleBigBox0; // sm envelope box + static Float_t fSModuleBigBox1; // sm envelope box + static Float_t fSModuleBigBox2; // sm envelope box + static Float_t fSModuleSmallBox0; // sm envelope box + static Float_t fSModuleSmallBox1; // sm envelope box + static Float_t fSModuleSmallBox2; // sm envelope box + static Float_t fSModuleCenter0; // sm envelope box + static Float_t fSModuleCenter1; // sm envelope box + static Float_t fSModuleCenter2; // sm envelope box + + TGeoMatrix* fMatrix; + TGeoHMatrix* fHMatrix; + +private: + + AliEveEMCALSModuleData(const AliEveEMCALSModuleData&); // Not implemented + AliEveEMCALSModuleData& operator=(const AliEveEMCALSModuleData&); // Not implemented + + ClassDef(AliEveEMCALSModuleData, 0); // class with data for one chamber +}; + +#endif diff --git a/EVE/EveDet/LinkDef.h b/EVE/EveDet/LinkDef.h index 1b95fd1b14b..32bc21d546c 100644 --- a/EVE/EveDet/LinkDef.h +++ b/EVE/EveDet/LinkDef.h @@ -11,6 +11,11 @@ #pragma link off all globals; #pragma link off all classes; +// EMCAL +#pragma link C++ class AliEveEMCALData+; +#pragma link C++ class AliEveEMCALSModuleData+; +#pragma link C++ class AliEveEMCALSModule+; + // FMD #pragma link C++ class AliEveFMDLoader+; diff --git a/EVE/alice-macros/emcal_all.C b/EVE/alice-macros/emcal_all.C new file mode 100644 index 00000000000..79b7e7f1c5b --- /dev/null +++ b/EVE/alice-macros/emcal_all.C @@ -0,0 +1,97 @@ +//************************************************************************ +// A macro to read and visualize EMCAL data +// The macro: +// - can read hits, digits and clusters information from AliRunLoader: +// emcal_data->LoadHits(ht); +// emcal_data->LoadDigits(dt); +// emcal_data->LoadRecPoints(rt); +// - can read hits, digits and clusters information from AliEMCALLoader: +// rl->GetEvent(evtNum); +// emcal_data->LoadHitsFromEMCALLoader(emcl); // Does not work +// emcal_data->LoadDigitsFromEMCALLoader(emcl); +// emcal_data->LoadRecPointsFromEMCALLoader(emcl); +// - can read hits, digits and clusters information from ESDs +// emcal_data->LoadDigitsFromESD(); +// emcal_data->LoadClustersFromESD(); +// - will read hits, digits and clusters information from raw +// => To be implemented +// +//************************************************************************ +// Author: Magali Estienne (magali.estienne@cern.ch) +// June 30 2008 +//************************************************************************ + +#include +#include + + +class AliEveEMCALData; +AliEveEMCALData *emcal_data = 0; + +void emcal_all(const UInt_t evtNum = 0, Bool_t digFile = 0, + const UInt_t eventsToProcess = 5, TString dirName = "./", + const TString esdTreeName = "esdTree", const char * pattern = ".") +{ + AliRunLoader* rl = AliEveEventManager::AssertRunLoader(); + if (rl == 0x0) + cout<<"Can not instatiate the Run Loader"< (rl->GetDetectorLoader("EMCAL")); + Int_t evtID = gAliEveEvent->GetEventId(); + if(evtID != evtNum) gAliEveEvent->GotoEvent(evtNum); + + //Load Hits + rl->LoadHits("EMCAL"); + //Load Digits + rl->LoadDigits("EMCAL"); + //Load RecPoints + rl->LoadRecPoints("EMCAL"); + + TTree* ht = rl->GetTreeH("EMCAL",false); + TTree* dt = rl->GetTreeD("EMCAL",false); + TTree *rt = rl->GetTreeR("EMCAL",false); + + gGeoManager = gEve->GetGeometry("$REVESYS/alice-data/alice_fullgeo.root"); + TGeoNode* node = gGeoManager->GetTopVolume()->FindNode("XEN1_1"); + TGeoHMatrix* m = gGeoManager->GetCurrentMatrix(); + emcal_data = new AliEveEMCALData(rl,node,m); + emcal_data->SetESD(esd); + // RunLoader information + emcal_data->LoadHits(ht); // Does not work per sm but ok for all emcal + emcal_data->LoadDigits(dt); + emcal_data->LoadRecPoints(rt); + + // To be uncommented if use of emcalLoader + // rl->GetEvent(evtNum); + // emcal_data->LoadHitsFromEMCALLoader(emcl); // Does not work + // emcal_data->LoadDigitsFromEMCALLoader(emcl); + // emcal_data->LoadRecPointsFromEMCALLoader(emcl); + + // To be uncommented to read esds + // emcal_data->LoadDigitsFromESD(); + // emcal_data->LoadRecPointsFromESD(); + + gStyle->SetPalette(1, 0); + + gEve->DisableRedraw(); + + TEveElementList* l = new TEveElementList("EMCAL"); + l->SetTitle("Tooltip"); + l->SetMainColor(Color_t(2)); + gEve->AddElement(l); + + for (Int_t sm=0; sm<12; sm++) + { + cout << "\n Form: " << Form("SM %d", sm) << endl; + AliEveEMCALSModule* esm = new AliEveEMCALSModule(sm,Form("SM %d Element \n", sm),"test"); + // esm->SetSModuleID(sm); + esm->SetDataSource(emcal_data); + esm->ComputeBBox(); + esm->UpdateQuads(); + l->AddElement(esm); + } + + gEve->Redraw3D(kTRUE); + + gEve->EnableRedraw(); +} diff --git a/EVE/libEveDet.pkg b/EVE/libEveDet.pkg index c4f551ba110..69c71853392 100644 --- a/EVE/libEveDet.pkg +++ b/EVE/libEveDet.pkg @@ -6,7 +6,7 @@ HDRS := $(SRCS:.cxx=.h) DHDR := EveDet/LinkDef.h -EINCLUDE := RAW ITS TPC TRD TOF T0 MUON MUON/mapping PMD HLT/BASE HLT/BASE/HOMER +EINCLUDE := RAW EMCAL ITS TPC TRD TOF T0 MUON MUON/mapping PMD HLT/BASE HLT/BASE/HOMER ifeq (win32gcc,$(ALICE_TARGET)) PACKCXXFLAGS:= $(CXXFLAGS) -I/usr/X11R6/include -- 2.43.0