]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
TOF Raw data and clusters visualization
authordecaro <decaro@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 25 Jan 2008 10:03:24 +0000 (10:03 +0000)
committerdecaro <decaro@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 25 Jan 2008 10:03:24 +0000 (10:03 +0000)
EVE/alice-macros/tof_clusters.C [new file with mode: 0644]
EVE/alice-macros/tof_digits.C
EVE/alice-macros/tof_digits_sector.C
EVE/alice-macros/tof_digits_strips.C
EVE/alice-macros/tof_hits.C
EVE/alice-macros/tof_raw.C [new file with mode: 0644]

diff --git a/EVE/alice-macros/tof_clusters.C b/EVE/alice-macros/tof_clusters.C
new file mode 100644 (file)
index 0000000..b681a13
--- /dev/null
@@ -0,0 +1,96 @@
+// 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.                                                 *
+ **************************************************************************/
+
+
+#ifdef __CINT__
+
+namespace TEve
+{
+class Element;
+class PointSet;
+}
+
+#else
+
+#include <TEve/TEve.h>
+#include <TEve/TEveManager.h>
+#include <TEve/PointSet.h>
+#include <Alieve/EventAlieve.h>
+
+#include <AliRunLoader.h>
+#include <AliCluster.h>
+
+#include <TClonesArray.h>
+
+#endif
+
+TEvePointSet* tof_clusters(TEveElement* cont=0, Float_t maxR=390)
+{
+
+  AliEveEventManager::AssertGeometry();
+
+  AliRunLoader* rl = AliEveEventManager::AssertRunLoader();
+  rl->LoadRecPoints("TOF");
+
+  TTree *cTree = rl->GetTreeR("TOF", false);
+
+  TEvePointSet* clusters = new TEvePointSet(10000);  
+  clusters->SetOwnIds(kTRUE);
+
+  TClonesArray *cl=NULL;
+  TBranch *branch=cTree->GetBranch("TOF");
+  branch->SetAddress(&cl);
+
+  Int_t nentr=(Int_t)cTree->GetEntries();
+  for (Int_t i=0; i<nentr; i++) {
+    if (!cTree->GetEvent(i)) continue;
+
+    Int_t ncl=cl->GetEntriesFast();
+    cout<<" ncl = "<<ncl<<endl;
+    Float_t maxRsqr = maxR*maxR;
+    while (ncl--) {
+      
+      AliCluster *c=(AliCluster*)cl->UncheckedAt(ncl);
+     
+      Float_t g[3]; //global coordinates
+      c->GetGlobalXYZ(g);
+      
+      if (g[0]*g[0]+g[1]*g[1] < maxRsqr)
+      {
+       clusters->SetNextPoint(g[0], g[1], g[2]);
+       AliCluster *atp = new AliCluster(*c);
+
+       clusters->SetPointId(atp);
+       }
+    }
+  }
+
+  if(clusters->Size() == 0 && gEve->GetKeepEmptyCont() == kFALSE) {
+    Warning("tof_clusters", "No TOF clusters");
+    delete clusters;
+    return 0;
+  }
+
+  clusters->SetMarkerStyle(2);
+  clusters->SetMarkerSize(0.2);
+  clusters->SetMarkerColor(4);
+
+  char form[1000];
+  sprintf(form,"TOF Clusters");
+  clusters->SetName(form);
+
+  char tip[1000];
+  sprintf(tip,"N=%d", clusters->Size());
+  clusters->SetTitle(tip);
+
+  using namespace Eve;
+  gEve->AddElement(clusters, cont);
+  gEve->Redraw3D();
+
+  return clusters;
+}
index faa516ad839446dfc05516e0a445f0e84c159de5..f7834d8aa6af9a36e13e9e5a8a9286390e4bddca 100644 (file)
@@ -7,12 +7,11 @@
  * full copyright notice.                                                 *
  **************************************************************************/
 
+
 void tof_digits()
-{
+{  
   TClonesArray *array = 0x0;
 
-  Int_t nDigitsInVolume[3] = {-1, -1, -1};
-  Int_t nStrips=19;
   TGeoManager *localGeoManager = (TGeoManager*)gEve->GetGeometry("./geometry.root");//"$REVESYS/alice-data/alice_fullgeo.root");
   if (!localGeoManager) {
     printf("ERROR: no TGeo\n");
@@ -28,7 +27,7 @@ void tof_digits()
   di->Dump();
 
   AliTOFGeometry* g = di->fGeom;
-
   gStyle->SetPalette(1, 0);
   gEve->DisableRedraw();
 
@@ -38,9 +37,9 @@ void tof_digits()
   gEve->AddElement(ll);
 
   for(Int_t iSector=0; iSector<g->NSectors(); iSector++) {
-
+    
     array = di->GetDigits(iSector);
-
+   
     AliEveTOFSector* m = new AliEveTOFSector(localGeoManager,iSector,array);
 
     gEve->AddElement(m, ll);
index 4481bc46ed8abcafaf1c255886b9d6d8c2ad7133..38e4449932b661f51eefc775ad2d1a22d8422a91 100644 (file)
@@ -9,8 +9,7 @@
 
 void tof_digits_sector(Int_t sector=0)
 {
-  Int_t nDigitsInVolume[3] = {-1, -1, -1};
-  Int_t nStrips=19;
+  
   TGeoManager *localGeoManager = (TGeoManager*)gEve->GetGeometry("./geometry.root");//"$REVESYS/alice-data/alice_fullgeo.root");
   if (!localGeoManager) {
     printf("ERROR: no TGeo\n");
index e65f805aeecc779b832079fa8f4946af2fc64fa7..b72f1f6c4f59d5e272a604127d852cefc67a2857 100644 (file)
@@ -40,7 +40,7 @@ void tof_digits_strips()
   TString bsPadZ="PadZ";
   TString sPadX;
   TString bsPadX="PadX";
-
+  
   Char_t sectorName[100];
   Char_t sectorTitle[200];
 
@@ -66,7 +66,7 @@ void tof_digits_strips()
       sPlate+=iPlate;
       TEveElementList* relPlate = new TEveElementList(sPlate.Data());
       relPlate->SetMainColor((Color_t)2);
-      gEve->AddElement(relPlaete, l);
+      gEve->AddElement(relPlate, l);
 
 
       for(Int_t iStrip=0; iStrip<nStrips; iStrip++) {
index 800215cfde1986ec7a95a389ef974a32fcd906c8..e8c417a24c78ba0c36add8b6fdc8e385cc6a7b15 100644 (file)
@@ -7,6 +7,7 @@
  * full copyright notice.                                                 *
  **************************************************************************/
 
+
 TEvePointSet*
 tof_hits(const char *varexp    = "fX:fY:fZ",
         const char *selection = "",
@@ -16,7 +17,7 @@ tof_hits(const char *varexp    = "fX:fY:fZ",
   rl->LoadHits("TOF");
 
   TTree* ht = rl->GetTreeH("TOF", false);
-
+  
   //PH The line below is replaced waiting for a fix in Root
   //PH which permits to use variable siza arguments in CINT
   //PH on some platforms (alphalinuxgcc, solariscc5, etc.)
diff --git a/EVE/alice-macros/tof_raw.C b/EVE/alice-macros/tof_raw.C
new file mode 100644 (file)
index 0000000..cf4d69b
--- /dev/null
@@ -0,0 +1,70 @@
+void tof_raw(const char *input = "raw.root",
+            const char *geometry = "geometry.root",
+            Int_t  event = 0)
+{
+
+  TClonesArray *array = 0x0;
+
+  if (gSystem->AccessPathName(input, kReadPermission))
+  {
+    Error("tof_raw", "file '%s' not found.", input);
+    return;
+  }
+
+  TGeoManager *localGeoManager = (TGeoManager*)gEve->GetGeometry(geometry);
+  if (!localGeoManager) {
+    printf("ERROR: no TGeo\n");
+  }
+
+  AliRawReader *rawReader = NULL;
+  TString fileName(input);
+  if (fileName.EndsWith("/")) {
+    rawReader = new AliRawReaderFile(fileName);
+  } else if (fileName.EndsWith(".root")) {
+    rawReader = new AliRawReaderRoot(fileName);
+  } else if (!fileName.IsNull()) {
+    rawReader = new AliRawReaderDate(fileName);
+    rawReader->SelectEvents(7);
+  }
+
+  AliEveTOFDigitsInfo* di = new AliEveTOFDigitsInfo();
+
+  for (Int_t ev=0; rawReader->NextEvent(); ev++) {
+    if (ev==event) {
+
+      if (di) {
+       di->Delete();
+       di = new AliEveTOFDigitsInfo();
+      }
+
+      di->ReadRaw(rawReader, ev);
+      continue;
+    }
+
+    else continue;
+
+  }
+
+  AliTOFGeometry* g = new AliTOFGeometry();
+  gStyle->SetPalette(1, 0);
+  gEve->DisableRedraw();
+
+  TEveElementList* ll = new TEveElementList("TOF");
+  ll->SetTitle("TOF detector");
+  ll->SetMainColor((Color_t)2);
+  gEve->AddElement(ll);
+
+  for(Int_t iSector=0; iSector<g->NSectors(); iSector++) {
+
+    array = di->GetDigits(iSector);
+
+    AliEveTOFSector* m = new AliEveTOFSector(localGeoManager,iSector,array);
+
+    gEve->AddElement(m, ll);
+
+  }
+
+  gEve->EnableRedraw();
+
+}