// $Id: its_digits.C 30728 2009-01-22 18:14:34Z mtadel $ // Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007 /************************************************************************** * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. * * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for * * full copyright notice. * **************************************************************************/ #if !defined(__CINT__) || defined(__MAKECINT__) #include // bypass a cint problem in root-5.20 #include #include #include #include #include #include #include #include #include "AliEveEventManager.h" #include "AliGeomManager.h" #include "../ITS/UPGRADE/AliITSUGeomTGeo.h" #include "../ITS/UPGRADE/AliITSUSegmentationPix.h" #include "../ITS/UPGRADE/AliITSUDigitPix.h" #include "AliRunLoader.h" #include "AliEveITSUModule.h" #else class TEveElement; class TEvePointSet; #endif void itsU_digits() // Int_t mode = 63, // Bool_t check_empty = kTRUE, // Bool_t scaled_modules = kFALSE) { gSystem->Load("libITSUpgradeBase"); gSystem->Load("libITSUpgradeSim"); gGeoManager = gEve->GetGeometry("geometry.root"); // if (AliGeomManager::GetGeometry() == 0) AliGeomManager::LoadGeometry("geometry.root"); AliITSUGeomTGeo* gm = new AliITSUGeomTGeo(kTRUE); TObjArray segmArr; AliITSUSegmentationPix::LoadSegmentations(&segmArr, AliITSUGeomTGeo::GetITSsegmentationFileName()); // // Int_t nLayers = gm->GetNLayers(); Int_t nModules = gm->GetNModules(); AliEveEventManager::AssertGeometry(); AliRunLoader* rl = AliEveEventManager::AssertRunLoader(); rl->LoadDigits("ITS"); TTree* digTree = rl->GetTreeD("ITS", false); // printf(" -------------------- event %d - nModules %d \n",rl->GetEventNumber(), nModules); //DIGITS INIT TClonesArray *digArr= new TClonesArray("AliITSUDigitPix"); digTree->SetBranchAddress("ITSDigitsPix",&digArr); TEveElementList* evITSdig = new TEveElementList("ITSU Digits - as modules"); TEveElementList* layITSdig = 0; TEveElementList* evITSdigPoints = new TEveElementList("ITSU Digits - as points"); TEvePointSet* layITSdigPoints = 0; Int_t layOld =-1; for (int imod=0;imodGetEntry(imod); // clone array, because digArr is reused for the next module // and the digit pointers for prev. modules are lost TClonesArray *digArrClone = (TClonesArray*)digArr->Clone("digits clone"); int ndig = digArrClone->GetEntries(); if (ndig<1) continue; int detType = gm->GetModuleDetTypeID(imod); AliITSUSegmentationPix* segm = (AliITSUSegmentationPix*)segmArr.At(detType); int lay,lad,det; gm->GetModuleId(imod, lay,lad,det); // printf("\nModule %3d: (det %2d in ladder %2d of Layer %d) | NDigits: %4d\n",imod,det,lad,lay,ndig); // if (lay!=layOld) { // assumes order in the digits ! layITSdigPoints = new TEvePointSet(Form("ITSU Digits (points) - Layer %d",lay),10000); // layITSdigPoints->ApplyVizTag(viz_tag, "Clusters"); layITSdigPoints->SetMarkerColor(kBlack); layITSdigPoints->SetMarkerStyle(kFullDotMedium); layITSdigPoints->SetRnrSelf(kTRUE); layITSdigPoints->SetOwnIds(kTRUE); evITSdigPoints->AddElement(layITSdigPoints); } AliEveITSUModule *evMod = new AliEveITSUModule(gm,imod,lay,lad,det); for (int idig=0;idigAt(idig); evMod->SetDigitInQuad(pDig); /* printf("#%3d digit (0x%lx), col:%4d/row:%3d signal: %5d e-, generated by tracks ", idig,(ULong_t)pDig,pDig->GetCoord1(),pDig->GetCoord2(),pDig->GetSignalPix()); for (int itr=0;itrGetNTracks();itr++) if (pDig->GetTrack(itr)>=0) printf(" %5d",pDig->GetTrack(itr)); printf("\n"); */ // extract global coordinates Float_t x,z; segm->DetToLocal(pDig->GetCoord2(),pDig->GetCoord1(),x,z); Double_t loc[3]={x,0,z}; Double_t glob[3]; gm->LocalToGlobal(imod,loc,glob); layITSdigPoints->SetNextPoint(glob[0], glob[1], glob[2]); layITSdigPoints->SetPointId(pDig); // printf(" loc(%.3lf,%.3lf,%.3lf)->glob(%.3lf,%.3lf,%.3lf) \n",loc[0],loc[1],loc[2],glob[0],glob[1],glob[2]); } if (lay!=layOld) { // assumes order in the digits ! if (layOld>=0) { evITSdig->AddElement(layITSdig); } layITSdig = new TEveElementList(Form("ITSU Digits - Layer %d",lay)); layOld=lay; } layITSdig->AddElement(evMod); } evITSdig->AddElement(layITSdig); // add list of digits of last layer // gEve->AddElement(evITSdigPoints); gEve->AddElement(evITSdig); gEve->Redraw3D(); }