]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
New macros to display SDD raw data and digits (F. Prino)
authorprino <prino@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 16 Aug 2008 09:12:39 +0000 (09:12 +0000)
committerprino <prino@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 16 Aug 2008 09:12:39 +0000 (09:12 +0000)
ITS/PlotSDDDigits.C [new file with mode: 0644]
ITS/PlotSDDRawData.C [new file with mode: 0644]

diff --git a/ITS/PlotSDDDigits.C b/ITS/PlotSDDDigits.C
new file mode 100644 (file)
index 0000000..1fa6d79
--- /dev/null
@@ -0,0 +1,130 @@
+#if !defined(__CINT__) || defined(__MAKECINT__)
+#include <TCanvas.h>
+#include <TClassTable.h>
+#include <TGraph.h>
+#include <TGraph2D.h>
+#include <TGeoManager.h>
+#include <TStyle.h>
+#include <TH1.h>
+#include <TH2.h>
+#include <TInterpreter.h>
+#include "AliGeomManager.h"
+#include "AliCDBManager.h"
+#include "AliHeader.h"
+#include "AliITS.h"
+#include "AliITSdigit.h"
+#include "AliITSDetTypeRec.h"
+#include "AliITSgeomTGeo.h"
+#include "AliITSRecPoint.h"
+#include "AliRun.h"
+#endif
+
+// Macro to display the SDD digits for 1 ladder
+// Origin: F. Prino,   prino@to.infn.it
+
+
+Int_t PlotSDDDigits(Int_t lay, Int_t lad, Int_t iev=0){
+    if (gClassTable->GetID("AliRun") < 0) {
+    gInterpreter->ExecuteMacro("loadlibs.C");
+  }
+
+
+  AliCDBManager* man = AliCDBManager::Instance();
+  if (!man->IsDefaultStorageSet()) {
+    printf("Setting a local default storage and run number 0\n");
+    man->SetDefaultStorage("local://$ALICE_ROOT");
+    man->SetRun(0);
+  }
+  else {
+    printf("Using deafult storage \n");
+  }
+  // retrives geometry 
+  if(!gGeoManager){
+    AliGeomManager::LoadGeometry("geometry.root");
+  }
+
+  AliRunLoader* rl = AliRunLoader::Open("galice.root");
+  if (rl == 0x0){
+    cerr<<"Can not open session RL=NULL"<< endl;
+    return -1;
+  }
+  Int_t retval = rl->LoadgAlice();
+  if (retval){
+    cerr<<"AliITSGeoPlot.C : LoadgAlice returned error"<<endl;
+    return -1;
+  }
+  gAlice=rl->GetAliRun();
+
+  retval = rl->LoadHeader();
+  if (retval){
+    cerr<<"LoadHeader returned error"<<endl;
+    return -1;
+  }
+
+
+  AliITSLoader* ITSloader =  (AliITSLoader*) rl->GetLoader("ITSLoader");
+  if(!ITSloader){
+    cerr<<"ITS loader not found"<<endl;
+    return -1;
+  }
+  AliITSgeom *geom = ITSloader->GetITSgeom();
+
+  ITSloader->LoadDigits("read");
+  rl->GetEvent(iev);
+  AliITS *ITS  = (AliITS*)gAlice->GetModule("ITS");
+  ITS->SetTreeAddress();
+
+  TTree *TD = ITSloader->TreeD();
+  AliITSDetTypeRec* detTypeRec = new AliITSDetTypeRec();
+  detTypeRec->SetITSgeom(geom);
+  detTypeRec->SetDefaults();
+  TClonesArray *ITSdigits  = ITS->DigitsAddress(1);
+  detTypeRec->ResetDigits();
+  Int_t maxmod=6;
+  if(lay==4) maxmod=8;
+  TH2F **hdig0=new TH2F*[8];
+  TH2F **hdig1=new TH2F*[8];
+  Char_t histtit[100], histname[10];
+  Int_t nbytes;
+  for(Int_t i=0; i<maxmod; i++){
+    Int_t nmod=AliITSgeomTGeo::GetModuleIndex(lay,lad,i+1);
+    nbytes = TD->GetEvent(nmod);
+    Int_t ndigits = ITSdigits->GetEntries();
+    printf("Module %d  ndigits=%d\n",nmod,ndigits);
+    sprintf(histname,"hdig%ds0",nmod);
+    sprintf(histtit,"Digit mod %d side 0",nmod);
+    hdig0[i]=new TH2F(histname,histtit,256,-0.5,255.5,256,-0.5,255.5);
+    sprintf(histname,"hdig%ds1",nmod);
+    sprintf(histtit,"Digit mod %d side 1",nmod);
+    hdig1[i]=new TH2F(histname,histtit,256,-0.5,255.5,256,-0.5,255.5);
+    hdig0[i]->SetStats(0);
+    hdig1[i]->SetStats(0);
+    for (Int_t idig=0; idig<ndigits; idig++) {
+      AliITSdigit *dig=(AliITSdigit*)ITSdigits->UncheckedAt(idig);
+      Int_t iz=dig->GetCoord1();  // cell number z
+      Int_t ix=dig->GetCoord2();  // cell number x
+      Int_t sig=dig->GetSignal();
+      if(iz<256){
+       hdig0[i]->SetBinContent(ix+1,iz+1,sig);
+      }else{
+       iz-=256;
+       hdig1[i]->SetBinContent(ix+1,iz+1,sig);
+      }
+    }
+  }
+  gStyle->SetPalette(1);
+  TCanvas *c1=new TCanvas("c1","",1200,900);
+  c1->Divide(4,maxmod/2);
+  for(Int_t i=0;i<maxmod;i++){
+    c1->cd(1+2*i);
+    hdig0[i]->Draw("colz");
+    hdig0[i]->GetXaxis()->SetTitle("Time bin");
+    hdig0[i]->GetYaxis()->SetTitle("Anode");
+    c1->cd(2+2*i);
+    hdig1[i]->Draw("colz");
+    hdig1[i]->GetXaxis()->SetTitle("Time bin");
+    hdig1[i]->GetYaxis()->SetTitle("Anode");
+  }
+  return 0;
+}
diff --git a/ITS/PlotSDDRawData.C b/ITS/PlotSDDRawData.C
new file mode 100644 (file)
index 0000000..552469e
--- /dev/null
@@ -0,0 +1,73 @@
+#if !defined(__CINT__) || defined(__MAKECINT__)
+#include <TH2F.h>
+#include <TCanvas.h>
+#include <TStopwatch.h>
+#include <TStyle.h>
+#include "AliRawReaderDate.h"
+#include "AliRawReaderRoot.h"
+#include "AliITSRawStreamSDD.h"
+#endif
+
+// Macro to display the SDD Raw Data for 1 DDL
+// Origin: F. Prino,   prino@to.infn.it
+
+void PlotSDDRawData(Char_t datafil[100], Int_t nDDL, Int_t firstEv=0, Int_t lastEv=5){
+
+  Int_t eqOffset = 256;
+  Int_t DDLid_range= 24;
+  const Int_t nHybrids=24;
+
+  TH2F** histo = new TH2F*[nHybrids];
+  Char_t nome[20];
+  for(Int_t i=0;i<nHybrids;i++){
+    sprintf(nome,"histo%d",i);
+    histo[i]=new TH2F(nome,"",256,-0.5,255.5,256,-0.5,255.5);
+    histo[i]->SetStats(0);
+  }
+
+  Int_t iev=firstEv;
+  AliRawReader *rd; 
+  if(strstr(datafil,".root")!=0){
+    rd=new AliRawReaderRoot(datafil,iev);
+  }else{
+    rd=new AliRawReaderDate(datafil,iev);
+  }
+  TStopwatch *evtime=new TStopwatch();
+  TCanvas* c0 = new TCanvas("cd0","c0",900,900);
+  gStyle->SetPalette(1);
+  Int_t idev;
+  do{
+    c0->Clear();                               
+    c0->Divide(4,6,0.001,0.001);
+
+    evtime->Start();
+    printf("Event # %d\n",iev);
+    rd->SelectEquipment(17,eqOffset,eqOffset+DDLid_range); 
+    rd->Reset();
+    for(Int_t i=0;i<nHybrids;i++) histo[i]->Reset();
+    AliITSRawStreamSDD s(rd);
+    rd->SelectEquipment(17,eqOffset,eqOffset+DDLid_range); 
+    Int_t iCountNext=0;    
+    while(s.Next()){
+      iCountNext++;
+      if(s.IsCompletedModule()==kFALSE){
+       Int_t i=s.GetCarlosId()*2+s.GetChannel();
+       if(rd->GetDDLID()==nDDL) histo[i]->Fill(s.GetCoord2(),s.GetCoord1(),s.GetSignal());
+      }
+    }
+    idev=s.GetEventId();
+    evtime->Stop();
+    printf("**** Event=%d  ID=%d\n",iev,idev);
+    evtime->Print("u");
+    evtime->Reset();
+    iev++;
+    
+    for(Int_t i=0;i<nHybrids;i++){
+      c0->cd(i+1);
+      histo[i]->DrawCopy("colz");
+    }
+    c0->Update();
+  }while(rd->NextEvent()&&iev<=lastEv);
+
+}
+