]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSFindClustersV2.C
AliGenSTRANGElib.cxx first commit.
[u/mrichter/AliRoot.git] / ITS / AliITSFindClustersV2.C
index 46395e1282a1839dae697381317f9b6c40297ca4..6f9d1515ff07b5b486a63b508ac733a8715b01ce 100644 (file)
@@ -1,4 +1,6 @@
 #ifndef __CINT__
+  #include <iostream.h>
+
   #include "AliRun.h"
   #include "AliITS.h"
   #include "AliITSgeom.h"
@@ -39,19 +41,16 @@ Int_t AliITSFindClustersV2() {
       return 3;
    }
 
-   gAlice->MakeTree("R");
-   ITS->MakeBranch("R",0);
-   gAlice->TreeR()->Fill();
-
-   //////////////// Taken from ITSHitsToFastPoints.C ///////////////////////
-   AliITSsimulationFastPoints *sim = new AliITSsimulationFastPoints();
-   for (Int_t i=0;i<3;i++) { ITS->SetSimulationModel(i,sim); }
-
+   gAlice->MakeTree("R"); ITS->MakeBranch("R",0);
+//////////////// Taken from ITSHitsToFastPoints.C ///////////////////////
+   ITS->SetSimulationModel(0,new AliITSsimulationFastPoints());
+   ITS->SetSimulationModel(1,new AliITSsimulationFastPoints());
+   ITS->SetSimulationModel(2,new AliITSsimulationFastPoints());
    Int_t nsignal=25;
    Int_t size=-1;
    Int_t bgr_ev=Int_t(ev/nsignal);
    ITS->HitsToFastRecPoints(ev,bgr_ev,size," ","All"," ");
-   //////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////
 
    delete gAlice; gAlice=0;
    in->Close();
@@ -83,11 +82,11 @@ Int_t AliITSFindClustersV2() {
    geom->Write();
 
    TClonesArray *clusters=new TClonesArray("AliITSclusterV2",10000);
-   TTree *cTree=new TTree("cTree","ITS clusters");
+   TTree *cTree=new TTree("TreeC_ITS_0","ITS clusters");
    cTree->Branch("Clusters",&clusters);
 
    TTree *pTree=gAlice->TreeR();
-   if (!pTree) { 
+   if (!pTree) {
       cerr<<"Can't get TreeR !\n";
       return 7;
    }
@@ -105,24 +104,27 @@ Int_t AliITSFindClustersV2() {
 
    cerr<<"Number of entries: "<<nentr<<endl;
 
+   Float_t lp[5]; Int_t lab[6]; //Why can't it be inside a loop ?
+
    for (Int_t i=0; i<nentr; i++) {
-       if (!pTree->GetEvent(i)) {cTree->Fill(); continue;}
-       Int_t lay,lad,det; geom->GetModuleId(i-1,lay,lad,det);
+       points->Clear();
+       pTree->GetEvent(i);
+       Int_t ncl=points->GetEntriesFast(); if (ncl==0){cTree->Fill();continue;}
+       Int_t lay,lad,det; geom->GetModuleId(i,lay,lad,det);
        Float_t x,y,zshift; geom->GetTrans(lay,lad,det,x,y,zshift); 
        Double_t rot[9];    geom->GetRotMatrix(lay,lad,det,rot);
        Double_t yshift = x*rot[0] + y*rot[1];
        Int_t ndet=(lad-1)*geom->GetNdetectors(lay) + (det-1);
-       Int_t ncl=points->GetEntriesFast();
        nclusters+=ncl;
        for (Int_t j=0; j<ncl; j++) {
           AliITSRecPoint *p=(AliITSRecPoint*)points->UncheckedAt(j);
-          Float_t lp[5];
+          //Float_t lp[5];
           lp[0]=-p->GetX()-yshift; if (lay==1) lp[0]=-lp[0];
           lp[1]=p->GetZ()+zshift;
           lp[2]=p->GetSigmaX2();
           lp[3]=p->GetSigmaZ2();
           lp[4]=p->GetQ();
-          Int_t lab[6]; 
+          //Int_t lab[6]; 
           lab[0]=p->GetLabel(0);lab[1]=p->GetLabel(1);lab[2]=p->GetLabel(2);
           lab[3]=ndet;
 
@@ -142,7 +144,6 @@ Int_t AliITSFindClustersV2() {
           new(cl[j]) AliITSclusterV2(lab,lp);
        }
        cTree->Fill(); clusters->Delete();
-       points->Delete();
    }
    cTree->Write();
 
@@ -151,10 +152,12 @@ Int_t AliITSFindClustersV2() {
    delete cTree; delete clusters; delete points;
 
    delete gAlice; gAlice=0;
+
    in->Close();
    out->Close();
 
    return 0;
+
 }