ROOT logo
void readRecPoint(){
  gSystem->Load("libITSUpgradeBase");
  gSystem->Load("libITSUpgradeSim");
  gSystem->Load("libITSUpgradeRec");
  gROOT->SetStyle("Plain");
  gStyle->SetOptStat(1111111);
  Int_t nbins=100;
  Int_t xmin=0;
  Int_t xmax=50000;//00*1e-09;


  AliITSsegmentationUpgrade *seg = new AliITSsegmentationUpgrade();
  if(!seg){
    printf("no segmentation info available... Exiting");
    return;
  }
  Int_t nLayers = seg->GetNLayers();

  TH1D **hNel, **hNsect;
  hNel = new TH1D[nLayers]; 
  hNsect = new TH1D[nLayers]; 
 // [nLayers];
  for(Int_t i=0; i< nLayers; i++ ) {
  hNel[i] = new TH1D(Form("hNel%i",i),Form("cluster charge distribution [ Layer %i] ",i),nbins,xmin,xmax);
  hNel[i]->SetXTitle("N electrons");
  hNsect[i] = new TH1D(Form("hNsect%i",i),Form("cluster entries per sector [ Layer %i] ",i),seg->GetNSectors(),-0.5,seg->GetNSectors()-0.5);
  hNsect[i]->SetXTitle("Sector Number");
  hNsect[i]->SetYTitle("# clusters");
  hNsect[i]->SetMinimum(0);
  }

  TH1D * type = new TH1D("hCluType"," cluster type" , 50,0,15 );

  TH2F *xyGlob = new TH2F("xyGlob"," X - Y Global coordinates ",100,-50,50,100,-50,50);
  xyGlob->SetXTitle("cm"); 
  xyGlob->SetMarkerStyle(7); 
  TH1F *zGlob  = new TH1F("zGlob", " Z Global coordinates ",200, -50,50 );
  zGlob->SetXTitle("cm"); 

  gAlice=NULL;
  AliRunLoader* runLoader = AliRunLoader::Open("galice.root");
  runLoader->LoadgAlice();

  gAlice = runLoader->GetAliRun();

  runLoader->LoadHeader();
  runLoader->LoadKinematics();
  runLoader->LoadRecPoints();

  AliITSLoader *dl = (AliITSLoader*)runLoader->GetDetectorLoader("ITS");

  TTree *clusTree = 0x0;

  TClonesArray statITSCluster("AliITSRecPointU");

  for (Int_t iEvent = 0; iEvent < runLoader->GetNumberOfEvents(); iEvent++) {
    runLoader->GetEvent(iEvent);
    clusTree=dl->TreeR();
    TClonesArray *ITSCluster = &statITSCluster;
    TBranch* itsClusterBranch=clusTree->GetBranch("ITSRecPoints");
    if (!itsClusterBranch) {
      printf("can't get the branch with the ITS clusters ! \n");
      return;
    }
    itsClusterBranch->SetAddress(&ITSCluster);
    clusTree->GetEntry(0);   
    Double_t charge=0.;
    Int_t nCluster = ITSCluster->GetEntriesFast();
    for(Int_t i=0; i<nCluster; i++){
      AliITSRecPointU *recp = (AliITSRecPointU*)ITSCluster->UncheckedAt(i);
      //  cout<<"layer "<<recp->GetLayer()<<endl;
      Double_t xyz[3]={-1,-1,-1};
      seg->DetToGlobal(recp->GetLayer(), recp->GetModule(), recp->GetDetLocalX(), recp->GetDetLocalZ(), xyz[0],xyz[1],xyz[2]) ;
      xyGlob->Fill(xyz[0],xyz[1]);
      zGlob->Fill(xyz[2]);
      charge=recp->GetQ();
      type->Fill(recp->GetType());
      hNel[recp->GetLayer()]->Fill(charge);
      hNsect[recp->GetLayer()]->Fill(recp->GetModule());
    }
  }
  
  Int_t size = 400;

  TCanvas *xyCanv =  new TCanvas("xvCanvClus","RecPoint X-Y Positions",10,10,size,size);
  xyCanv->cd();
  xyGlob->Draw();

  TCanvas *zCanv =  new TCanvas("zCanvClus","RecPoint Z Positions",size+20,10,size,size);
  zCanv->cd();
  zGlob->Draw();
  TCanvas *typeCanv = new TCanvas("ClusType","Cluster type distribution",10,size+40,2*size+10,size);
  type->Draw();


  TCanvas *c = new TCanvas("c","Cluster charge distribution",900,0, 1000,550);
   c->Divide(3,(nLayers/3)+1);
  for(Int_t ip =1; ip<=nLayers; ip++){
    c->cd(ip);
    hNel[ip-1]->Draw();
  }
 
  TCanvas *cS = new TCanvas("cS","clusters in sectors",900,640,1000,550);
   cS->Divide(3,(nLayers/3)+1);
  for(Int_t ip =1; ip<=nLayers; ip++){
    cS->cd(ip);
    hNsect[ip-1]->Draw();
  } 
}

 readRecPoint.C:1
 readRecPoint.C:2
 readRecPoint.C:3
 readRecPoint.C:4
 readRecPoint.C:5
 readRecPoint.C:6
 readRecPoint.C:7
 readRecPoint.C:8
 readRecPoint.C:9
 readRecPoint.C:10
 readRecPoint.C:11
 readRecPoint.C:12
 readRecPoint.C:13
 readRecPoint.C:14
 readRecPoint.C:15
 readRecPoint.C:16
 readRecPoint.C:17
 readRecPoint.C:18
 readRecPoint.C:19
 readRecPoint.C:20
 readRecPoint.C:21
 readRecPoint.C:22
 readRecPoint.C:23
 readRecPoint.C:24
 readRecPoint.C:25
 readRecPoint.C:26
 readRecPoint.C:27
 readRecPoint.C:28
 readRecPoint.C:29
 readRecPoint.C:30
 readRecPoint.C:31
 readRecPoint.C:32
 readRecPoint.C:33
 readRecPoint.C:34
 readRecPoint.C:35
 readRecPoint.C:36
 readRecPoint.C:37
 readRecPoint.C:38
 readRecPoint.C:39
 readRecPoint.C:40
 readRecPoint.C:41
 readRecPoint.C:42
 readRecPoint.C:43
 readRecPoint.C:44
 readRecPoint.C:45
 readRecPoint.C:46
 readRecPoint.C:47
 readRecPoint.C:48
 readRecPoint.C:49
 readRecPoint.C:50
 readRecPoint.C:51
 readRecPoint.C:52
 readRecPoint.C:53
 readRecPoint.C:54
 readRecPoint.C:55
 readRecPoint.C:56
 readRecPoint.C:57
 readRecPoint.C:58
 readRecPoint.C:59
 readRecPoint.C:60
 readRecPoint.C:61
 readRecPoint.C:62
 readRecPoint.C:63
 readRecPoint.C:64
 readRecPoint.C:65
 readRecPoint.C:66
 readRecPoint.C:67
 readRecPoint.C:68
 readRecPoint.C:69
 readRecPoint.C:70
 readRecPoint.C:71
 readRecPoint.C:72
 readRecPoint.C:73
 readRecPoint.C:74
 readRecPoint.C:75
 readRecPoint.C:76
 readRecPoint.C:77
 readRecPoint.C:78
 readRecPoint.C:79
 readRecPoint.C:80
 readRecPoint.C:81
 readRecPoint.C:82
 readRecPoint.C:83
 readRecPoint.C:84
 readRecPoint.C:85
 readRecPoint.C:86
 readRecPoint.C:87
 readRecPoint.C:88
 readRecPoint.C:89
 readRecPoint.C:90
 readRecPoint.C:91
 readRecPoint.C:92
 readRecPoint.C:93
 readRecPoint.C:94
 readRecPoint.C:95
 readRecPoint.C:96
 readRecPoint.C:97
 readRecPoint.C:98
 readRecPoint.C:99
 readRecPoint.C:100
 readRecPoint.C:101
 readRecPoint.C:102
 readRecPoint.C:103
 readRecPoint.C:104
 readRecPoint.C:105
 readRecPoint.C:106
 readRecPoint.C:107
 readRecPoint.C:108
 readRecPoint.C:109
 readRecPoint.C:110
 readRecPoint.C:111