]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/MUONCheck.C
Implementation of ITS tracking for HLT. The tracking is based on the off-line AliITSt...
[u/mrichter/AliRoot.git] / MUON / MUONCheck.C
index b889cbc878348ba0afc5352f18f1dbced8f7e09d..cabb5b7093358efa33f302f2f960a177e7ba7f86 100644 (file)
@@ -1,8 +1,25 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/* $Id$ */
+
 //
 // Macro for checking aliroot output and associated files contents
 // Gines Martinez, Subatech June 2003
 //
-
+#if !defined(__CINT__) || defined(__MAKECINT__)
 // ROOT includes
 #include "TBranch.h"
 #include "TClonesArray.h"
 #include "AliMUONRawCluster.h"
 #include "AliMUONGlobalTrigger.h"
 #include "AliMUONLocalTrigger.h"
+#include "AliMUONTrack.h"
+#endif
 
-void MUONkine(char * filename="galice.root")
+
+void MUONkine(char * filename="galice.root",Int_t event2Check=0)
 {
-  TClonesArray * ListOfParticles = new TClonesArray("TParticle",1000);
+  //  TClonesArray * ListOfParticles = new TClonesArray("TParticle",1000);
   TParticle * particle = new TParticle();
   // Creating Run Loader and openning file containing Hits
   AliRunLoader * RunLoader = AliRunLoader::Open(filename,"MUONFolder","READ");
@@ -43,22 +63,24 @@ void MUONkine(char * filename="galice.root")
   nevents = RunLoader->GetNumberOfEvents();
 
   for(ievent=0; ievent<nevents; ievent++) {  // Event loop
+    if (event2Check!=0) ievent=event2Check;
     Int_t iparticle, nparticles;
     // Getting event ievent
     RunLoader->GetEvent(ievent); 
     RunLoader->TreeK()->GetBranch("Particles")->SetAddress(&particle);
-    nparticles = RunLoader->TreeK()->GetEntries();
+    nparticles = (Int_t)RunLoader->TreeK()->GetEntries();
     printf(">>> Event %d, Number of particles is %d \n",ievent, nparticles);
     for(iparticle=0; iparticle<nparticles; iparticle++) {
       RunLoader->TreeK()->GetEvent(iparticle);
-      particle->Print("");
+      particle->Print("");  
     }
+    if (event2Check!=0) ievent=nevents;
   }
   RunLoader->UnloadKinematics();
 }
 
 
-void MUONhits(char * filename="galice.root")
+void MUONhits(char * filename="galice.root", Int_t event2Check=0)
 {
   // Creating Run Loader and openning file containing Hits
   AliRunLoader * RunLoader = AliRunLoader::Open(filename,"MUONFolder","READ");
@@ -74,6 +96,7 @@ void MUONhits(char * filename="galice.root")
   nevents = RunLoader->GetNumberOfEvents();
 
   for(ievent=0; ievent<nevents; ievent++) {  // Event loop
+    if (event2Check!=0) ievent=event2Check;
     printf(">>> Event %d \n",ievent);
     // Getting event ievent
     RunLoader->GetEvent(ievent); 
@@ -106,12 +129,13 @@ void MUONhits(char * filename="galice.root")
       }
       muondata.ResetHits();
     } // end track loop
+    if (event2Check!=0) ievent=nevents;
   }  // end event loop
   MUONLoader->UnloadHits();
 }
 
 
-void MUONdigits(char * filename="galice.root")
+void MUONdigits(char * filename="galice.root", Int_t event2Check=0)
 {
   // Creating Run Loader and openning file containing Hits
   AliRunLoader * RunLoader = AliRunLoader::Open(filename,"MUONFolder","READ");
@@ -130,6 +154,7 @@ void MUONdigits(char * filename="galice.root")
   AliMUONDigit * mDigit;
   
   for(ievent=0; ievent<nevents; ievent++) {
+    if (event2Check!=0) ievent=event2Check;
     printf(">>> Event %d \n",ievent);
     RunLoader->GetEvent(ievent);
   
@@ -137,7 +162,7 @@ void MUONdigits(char * filename="galice.root")
     Int_t ichamber, nchambers;
     nchambers = AliMUONConstants::NCh(); ;
     muondata.SetTreeAddress("D"); 
-    char branchname[30];    
+    //    char branchname[30];    
  
     Int_t icathode, ncathodes;
     ncathodes=2;
@@ -157,22 +182,28 @@ void MUONdigits(char * filename="galice.root")
          Int_t PadX   = mDigit->PadX();     // Pad X number
          Int_t PadY   = mDigit->PadY();     // Pad Y number
          Int_t Signal = mDigit->Signal();   // Physics Signal
+         Int_t Physics= mDigit->Physics();  // Physics contribution to signal
          Int_t Hit    = mDigit->Hit();      // iHit
          Int_t Cathode= mDigit->Cathode();  // Cathode
          Int_t Track0 = mDigit->Track(0);
          Int_t Track1 = mDigit->Track(1); 
          Int_t Track2 = mDigit->Track(2);
+         Int_t TCharges0 = mDigit->TrackCharge(0);  //charge per track making this digit (up to 10)
+         Int_t TCharges1 = mDigit->TrackCharge(1);
+         Int_t TCharges2 = mDigit->TrackCharge(2);
          
-         printf(">>> Digit %4d cathode %1d hit %4d PadX %3d PadY %3d Signal %4d Track0 %4d Track1 %'d Track2 %4d \n",idigit, Cathode,Hit, PadX, PadY, Signal, Track0, Track1, Track2);
+         printf(">>> Digit %4d cathode %1d hit %4d PadX %3d PadY %3d Signal %4d Physics %4d Track0 %4d TrackCharge0 %4d Track1 %'d TrackCharge1 %4d Track2 %4d TrackCharge2 %4d \n",idigit, Cathode,Hit, PadX, PadY, Signal, Physics, 
+         Track0, TCharges0, Track1, TCharges1, Track2, TCharges2);
        } // end digit loop
       } // end chamber loop
       muondata.ResetDigits();
     } // end cathode loop
+    if (event2Check!=0) ievent=nevents;
   }  // end event loop
   MUONLoader->UnloadDigits();
 }
 
-void MUONrecpoints(char * filename="galice.root") {
+void MUONrecpoints(char * filename="galice.root", Int_t event2Check=0) {
 
   // Creating Run Loader and openning file containing Hits
   AliRunLoader * RunLoader = AliRunLoader::Open(filename,"MUONFolder","READ");
@@ -188,9 +219,10 @@ void MUONrecpoints(char * filename="galice.root") {
 
   Int_t ievent, nevents;
   nevents = RunLoader->GetNumberOfEvents();
-  AliMUONRawCluster * mRecPoint;
+  AliMUONRawCluster * mRecPoint = 0;
   
   for(ievent=0; ievent<nevents; ievent++) {
+    if (event2Check!=0) ievent=event2Check;
     printf(">>> Event %d \n",ievent);
     RunLoader->GetEvent(ievent);
     // Addressing
@@ -230,30 +262,31 @@ void MUONrecpoints(char * filename="galice.root") {
 //                                    //   charge chi2 compatibility
 //                                    // 2 none give satisfactory chi2
 
-       Int_t Track0 = mRecPoint->fTracks[0];
-       Int_t Track1 = mRecPoint->fTracks[1]
-       Int_t Track2 = mRecPoint->fTracks[2];
-       Int_t Q0 = mRecPoint->fQ[0];
-       Int_t Q1 = mRecPoint->fQ[1];
-       Float_t x0 = mRecPoint->fX[0];
-       Float_t x1 = mRecPoint->fX[1];
-       Float_t y0 = mRecPoint->fY[0];
-       Float_t y1 = mRecPoint->fY[1];
-       Float_t z0 = mRecPoint->fZ[0];
-       Float_t z1 = mRecPoint->fZ[1];
-       Float_t chi2_0 =  mRecPoint->fChi2[0];
-       Float_t chi2_1 =  mRecPoint->fChi2[1];
+       Int_t Track0 = mRecPoint->GetTrack(0);
+       Int_t Track1 = mRecPoint->GetTrack(1)
+       Int_t Track2 = mRecPoint->GetTrack(2);
+       Int_t Q0 = mRecPoint->GetCharge(0);
+       Int_t Q1 = mRecPoint->GetCharge(1);
+       Float_t x0 = mRecPoint->GetX(0);
+       Float_t x1 = mRecPoint->GetX(1);
+       Float_t y0 = mRecPoint->GetY(0);
+       Float_t y1 = mRecPoint->GetY(1);
+       Float_t z0 = mRecPoint->GetZ(0);
+       Float_t z1 = mRecPoint->GetZ(1);
+       Float_t chi2_0 =  mRecPoint->GetChi2(0);
+       Float_t chi2_1 =  mRecPoint->GetChi2(1);
 
        printf(">>> RecPoint %4d x %6.3f %6.3f y %6.3f %6.3f z %6.3f %6.3f Q0 %4d  Q1 %4d Hit %4d Track1 %4d Track2 %4d Chi2 %6.3f %6.3f \n",
 irecpoint, x0, x1, y0, y1, z0, z1, Q0, Q1, Track0, Track1, Track2, chi2_0, chi2_1);
       } // end recpoint loop
     } // end chamber loop
     muondata.ResetRawClusters();
+    if (event2Check!=0) ievent=nevents;
   }  // end event loop
   MUONLoader->UnloadRecPoints();
 }
 
-void MUONTestTrigger (char * filename="galice.root"){
+void MUONTestTrigger (char * filename="galice.root", Int_t event2Check=0){
 // reads and dumps trigger objects from MUON.RecPoints.root
   TClonesArray * globalTrigger;
   TClonesArray * localTrigger;
@@ -261,8 +294,8 @@ void MUONTestTrigger (char * filename="galice.root"){
   // Creating Run Loader and openning file containing Hits
   AliRunLoader * RunLoader = AliRunLoader::Open(filename,"MUONFolder","READ");
   if (RunLoader ==0x0) {
-      printf(">>> Error : Error Opening %s file \n",filename);
-      return;
+    printf(">>> Error : Error Opening %s file \n",filename);
+    return;
   }
   
   AliLoader * MUONLoader = RunLoader->GetLoader("MUONLoader");
@@ -270,7 +303,7 @@ void MUONTestTrigger (char * filename="galice.root"){
   // Creating MUON data container
   AliMUONData muondata(MUONLoader,"MUON","MUON");
   
-
+  
   Int_t ievent, nevents;
   nevents = RunLoader->GetNumberOfEvents();
   
@@ -278,69 +311,119 @@ void MUONTestTrigger (char * filename="galice.root"){
   AliMUONLocalTrigger *locTrg;
   
   for (ievent=0; ievent<nevents; ievent++) {
-      RunLoader->GetEvent(ievent);
+    if (event2Check!=0) ievent=event2Check;
+    RunLoader->GetEvent(ievent);
+    
+    muondata.SetTreeAddress("GLT"); 
+    muondata.GetTrigger();
+    
+    globalTrigger = muondata.GlobalTrigger();
+    localTrigger = muondata.LocalTrigger();
+    
+    Int_t nglobals = (Int_t) globalTrigger->GetEntriesFast(); // should be 1
+    Int_t nlocals  = (Int_t) localTrigger->GetEntriesFast(); // up to 234
+    printf("###################################################\n");
+    cout << " event " << ievent 
+        << " nglobals nlocals: " << nglobals << " " << nlocals << "\n"; 
+    
+    for (Int_t iglobal=0; iglobal<nglobals; iglobal++) { // Global Trigger
+      gloTrg = static_cast<AliMUONGlobalTrigger*>(globalTrigger->At(iglobal));
       
-      muondata.SetTreeAddress("GLT"); 
-      muondata.GetTrigger();
+      printf("===================================================\n");
+      printf(" Global Trigger output       Low pt  High pt   All\n");
+      printf(" number of Single Plus      :\t");
+      printf("%i\t%i\t%i\t",gloTrg->SinglePlusLpt(),
+            gloTrg->SinglePlusHpt(),gloTrg->SinglePlusApt());
+      printf("\n");
+      printf(" number of Single Minus     :\t");
+      printf("%i\t%i\t%i\t",gloTrg->SingleMinusLpt(),
+            gloTrg->SingleMinusHpt(),gloTrg->SingleMinusApt());
+      printf("\n");
+      printf(" number of Single Undefined :\t"); 
+      printf("%i\t%i\t%i\t",gloTrg->SingleUndefLpt(),
+            gloTrg->SingleUndefHpt(),gloTrg->SingleUndefApt());
+      printf("\n");
+      printf(" number of UnlikeSign pair  :\t"); 
+      printf("%i\t%i\t%i\t",gloTrg->PairUnlikeLpt(),
+            gloTrg->PairUnlikeHpt(),gloTrg->PairUnlikeApt());
+      printf("\n");
+      printf(" number of LikeSign pair    :\t");  
+      printf("%i\t%i\t%i\t",gloTrg->PairLikeLpt(),
+            gloTrg->PairLikeHpt(),gloTrg->PairLikeApt());
+      printf("\n");
+      printf("===================================================\n");
       
-      globalTrigger = muondata.GlobalTrigger();
-      localTrigger = muondata.LocalTrigger();
+    } // end of loop on Global Trigger
+    
+    for (Int_t ilocal=0; ilocal<nlocals; ilocal++) { // Local Trigger
+      cout << " >>> Output for Local Trigger " << ilocal << "\n";
       
-      Int_t nglobals = (Int_t) globalTrigger->GetEntriesFast(); // should be 1
-      Int_t nlocals  = (Int_t) localTrigger->GetEntriesFast(); // up to 234
-      printf("###################################################\n");
-      cout << " event " << ievent 
-          << " nglobals nlocals: " << nglobals << " " << nlocals << "\n"; 
+      locTrg = static_cast<AliMUONLocalTrigger*>(localTrigger->At(ilocal));
       
-      for (Int_t iglobal=0; iglobal<nglobals; iglobal++) { // Global Trigger
-         gloTrg = static_cast<AliMUONGlobalTrigger*>(globalTrigger->At(iglobal));
-         
-         printf("===================================================\n");
-         printf(" Global Trigger output       Low pt  High pt   All\n");
-         printf(" number of Single Plus      :\t");
-         printf("%i\t%i\t%i\t",gloTrg->SinglePlusLpt(),
-                gloTrg->SinglePlusHpt(),gloTrg->SinglePlusApt());
-         printf("\n");
-         printf(" number of Single Minus     :\t");
-         printf("%i\t%i\t%i\t",gloTrg->SingleMinusLpt(),
-                gloTrg->SingleMinusHpt(),gloTrg->SingleMinusApt());
-         printf("\n");
-         printf(" number of Single Undefined :\t"); 
-         printf("%i\t%i\t%i\t",gloTrg->SingleUndefLpt(),
-                gloTrg->SingleUndefHpt(),gloTrg->SingleUndefApt());
-         printf("\n");
-         printf(" number of UnlikeSign pair  :\t"); 
-         printf("%i\t%i\t%i\t",gloTrg->PairUnlikeLpt(),
-                gloTrg->PairUnlikeHpt(),gloTrg->PairUnlikeApt());
-         printf("\n");
-         printf(" number of LikeSign pair    :\t");  
-         printf("%i\t%i\t%i\t",gloTrg->PairLikeLpt(),
-                gloTrg->PairLikeHpt(),gloTrg->PairLikeApt());
-         printf("\n");
-         printf("===================================================\n");
-         
-      } // end of loop on Global Trigger
+      cout << "Circuit StripX Dev StripY: " 
+          << locTrg->LoCircuit() << " " 
+          << locTrg->LoStripX() << " " 
+          << locTrg->LoDev() << " " 
+          << locTrg->LoStripY() 
+          << "\n";
+      cout << "Lpt Hpt Apt: "     
+          << locTrg->LoLpt() << " "   
+          << locTrg->LoHpt() << " "  
+          << locTrg->LoApt() << "\n";
       
-      for (Int_t ilocal=0; ilocal<nlocals; ilocal++) { // Local Trigger
-         cout << " >>> Output for Local Trigger " << ilocal << "\n";
-         
-         locTrg = static_cast<AliMUONLocalTrigger*>(localTrigger->At(ilocal));
-         
-         cout << "Circuit StripX Dev StripY: " 
-              << locTrg->LoCircuit() << " " 
-              << locTrg->LoStripX() << " " 
-              << locTrg->LoDev() << " " 
-              << locTrg->LoStripY() 
-              << "\n";
-         cout << "Lpt Hpt Apt: "     
-              << locTrg->LoLpt() << " "   
-              << locTrg->LoHpt() << " "  
-              << locTrg->LoApt() << "\n";
-         
-      } // end of loop on Local Trigger
-      muondata.ResetTrigger();
+    } // end of loop on Local Trigger
+    muondata.ResetTrigger();
+    if (event2Check!=0) ievent=nevents;
+  } // end loop on event  
+  MUONLoader->UnloadRecPoints();
+}
+
+
+
+void MUONRecTracks (char * filename="galice.root", Int_t event2Check=0 ){
+// reads and dumps trigger objects from MUON.RecPoints.root
+  TClonesArray * RecTracks;
+  
+  // Creating Run Loader and openning file containing Hits
+  AliRunLoader * RunLoader = AliRunLoader::Open(filename,"MUONFolder","READ");
+  if (RunLoader ==0x0) {
+    printf(">>> Error : Error Opening %s file \n",filename);
+    return;
+  }
+  
+  AliLoader * MUONLoader = RunLoader->GetLoader("MUONLoader");
+  MUONLoader->LoadTracks("READ");
+  // Creating MUON data container
+  AliMUONData muondata(MUONLoader,"MUON","MUON");
+  
+    Int_t ievent, nevents;
+  nevents = RunLoader->GetNumberOfEvents();
+  
+  //  AliMUONTrack * rectrack;
+  
+  for (ievent=0; ievent<nevents; ievent++) {
+    if (event2Check!=0) ievent=event2Check;
+    RunLoader->GetEvent(ievent);
+    
+    muondata.SetTreeAddress("RT");
+    muondata.GetRecTracks();
+    RecTracks = muondata.RecTracks();
+    
+    
+    Int_t nrectracks = (Int_t) RecTracks->GetEntriesFast(); //
+
+    printf(">>> Event %d Number of Recconstructed tracks %d \n",ievent, nrectracks);
+   
+    muondata.ResetRecTracks();
+    if (event2Check!=0) ievent=nevents;
   } // end loop on event  
-} 
+  MUONLoader->UnloadTracks();
+}
+
+
+
+
+