]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TRD/fastClusterAna.C
Cleanup of data arrays
[u/mrichter/AliRoot.git] / TRD / fastClusterAna.C
index 097e4af83515f45729f812d263886488424513f3..541c17a8806bc807e4bc80ca818b53d358cf42da 100644 (file)
@@ -1,4 +1,4 @@
-{
+void fastClusterAna() {
 
 /////////////////////////////////////////////////////////////////////////
 //
   }
 
   // Input file name
-  Char_t *alifile = "galice_c_v0.root"; 
+  Char_t *alifile = "galice_r_v0.root"; 
 
   // Event number
   Int_t   nEvent  = 0;
 
-  // Define the objects
-  AliTRDv1      *TRD;
-  TClonesArray  *TRDCluster;
-  AliTRDcluster *OneTRDcluster;
-
-  TH1F *hZ = new TH1F("hZ","Cluster z-position",700,-350.0,350.0);
+  TH2F *HLocal  = new TH2F("HLocal" ,"rec. points local row/col-position"
+                                    ,21,-0.5,20.5,81,-0.5,80.5);
+  TH2F *HGlobal = new TH2F("HGlobal","rec. points global x/y-position"   
+                                    ,800,-400,400,800,-400,400);
 
   // Connect the AliRoot file containing Geometry, Kine, Hits, and Digits
   TFile *gafl = (TFile*) gROOT->GetListOfFiles()->FindObject(alifile);
   }
 
   // Get AliRun object from file or create it if not on file
-  if (!gAlice) {
-    gAlice = (AliRun*) gafl->Get("gAlice");
-    if (gAlice)  
-      cout << "AliRun object found on file" << endl;
-    else
-      gAlice = new AliRun("gAlice","Alice test program");
-  }
+  gAlice = (AliRun*) gafl->Get("gAlice");
+  if (gAlice)  
+    cout << "AliRun object found on file" << endl;
+  else
+    gAlice = new AliRun("gAlice","Alice test program");
 
   // Import the Trees for the event nEvent in the file
   Int_t nparticles = gAlice->GetEvent(nEvent);
   if (nparticles <= 0) break;
   
   // Get the pointer to the tree
-  TTree *ClusterTree = gAlice->TreeD();
-
+  TTree          *RecTree       = gAlice->TreeR();
+  RecTree->Print();
   // Get the pointer to the detector classes
-  TRD = (AliTRDv1 *) gAlice->GetDetector("TRD");
+  AliTRDv0       *TRD           = (AliTRDv0*) gAlice->GetDetector("TRD");
+  // Get the geometry
+  AliTRDgeometry *TRDgeometry   = TRD->GetGeometry();
   // Get the pointer to the hit container
-  if (TRD) TRDCluster = TRD->Cluster();
-
-  // Reconstruct the address
-  ClusterTree->GetBranch("TRDcluster")->SetAddress(&TRDCluster);
+  TObjArray      *RecPointArray = TRD->RecPoints();
+  // Set the branch address
+  RecTree->GetBranch("TRDrecPoints")->SetAddress(&RecPointArray);
 
-  Int_t nEntries = ClusterTree->GetEntries();
-  cout << "Number of entries in cluster tree = " << nEntries << endl; 
+  Int_t nEntries = RecTree->GetEntries();
+  cout << "Number of entries in reconstruction tree = " << nEntries << endl; 
 
   // Loop through all entries in the tree
   Int_t nbytes;
     cout << "iEntry = " << iEntry << endl;
 
     // Import the tree
-    gAlice->ResetDigits();
-    nbytes += ClusterTree->GetEvent(iEntry);
+    nbytes += RecTree->GetEvent(iEntry);
 
-    // Get the number of digits in the detector 
-    Int_t nTRDCluster = TRDCluster->GetEntriesFast();
-    cout << " nTRDCluster = " << nTRDCluster << endl;    
+    // Get the number of points in the detector 
+    Int_t nRecPoint = RecPointArray->GetEntriesFast();
+    cout << " nRecPoint = " << nRecPoint << endl;    
 
     // Loop through all TRD digits
-    for (Int_t iTRDCluster = 0; iTRDCluster < nTRDCluster; iTRDCluster++) {
+    for (Int_t iRecPoint = 0; iRecPoint < nRecPoint; iRecPoint++) {
 
       // Get the information for this digit
-      OneTRDcluster = (AliTRDcluster*) TRDCluster->UncheckedAt(iTRDCluster);
-      hZ->Fill(OneTRDcluster->fZ);
+      AliTRDrecPoint *RecPoint = (AliTRDrecPoint *) RecPointArray->UncheckedAt(iRecPoint);
+      Int_t    detector = RecPoint->GetDetector();      
+      Float_t  row      = RecPoint->GetLocalRow();
+      Float_t  col      = RecPoint->GetLocalCol();
+
+      Int_t    sector   = TRDgeometry->GetSector(detector);
+      Int_t    plane    = TRDgeometry->GetPlane(detector);
+      Int_t    chamber  = TRDgeometry->GetChamber(detector);
+
+      TVector3 Pos;
+      TMatrix  Cov;
+      RecPoint->GetGlobalPosition(Pos,Cov);
+      HGlobal->Fill(Pos.X(),Pos.Y());
+      if ((sector == 17) && (plane == 0) && (chamber == 2)) {
+        HLocal->Fill(row,col);
+      }
 
     }
 
   }
 
-  hZ->Draw();
+  TCanvas *C = new TCanvas("C","recPoints",10,10,400,600);
+  C->Divide(1,2);
+  C->cd(1);
+  HLocal->Draw("BOX");
+  C->cd(2);
+  HGlobal->Draw("BOX");
 
 }