]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - RICH/RICHpadtest.C
SetCaller() calls added to identify the routine that calls stpping. (E. Futo)
[u/mrichter/AliRoot.git] / RICH / RICHpadtest.C
index 33ed1c3581e539a78b4635feb09d59c7e216b8a8..165498785c6fb31723187a488d60f95d9108e369 100644 (file)
@@ -49,9 +49,16 @@ void RICHpadtest (Int_t diaglevel,Int_t evNumber1=0,Int_t evNumber2=0)
       if (!gAlice) gAlice = new AliRun("gAlice","Alice test program");
     }
 
+    AliRICH *RICH  = (AliRICH*)gAlice->GetDetector("RICH");
+    
+    RICH->DiagnosticsSE(diaglevel,evNumber1,evNumber2);
+
+    file->Write();
+
+
 //  Create some histograms
 
-   AliRICH *RICH  = (AliRICH*)gAlice->GetDetector("RICH");
+/*   AliRICH *RICH  = (AliRICH*)gAlice->GetDetector("RICH");
    AliRICHSegmentationV0*  segmentation;
    AliRICHChamber*       chamber;
    
@@ -62,11 +69,11 @@ void RICHpadtest (Int_t diaglevel,Int_t evNumber1=0,Int_t evNumber2=0)
    Int_t NpadY = segmentation->Npy();                 // number of pads on Y
     
    Int_t Pad[144][160];
-   /*for (Int_t i=0;i<NpadX;i++) {
-     for (Int_t j=0;j<NpadY;j++) {
-       Pad[i][j]=0;
-     }
-   } */
+   //for (Int_t i=0;i<NpadX;i++) {
+   //for (Int_t j=0;j<NpadY;j++) {
+   //Pad[i][j]=0;
+   //}
+   //} 
 
 
    Int_t xmin= -NpadX/2;  
@@ -166,25 +173,31 @@ void RICHpadtest (Int_t diaglevel,Int_t evNumber1=0,Int_t evNumber2=0)
        
 // Get pointers to RICH detector and Hits containers
        
-       Int_t nent=(Int_t)gAlice->TreeR()->GetEntries();
-       gAlice->TreeR()->GetEvent(nent-1);
-       TClonesArray *Rawclusters = RICH->RawClustAddress(2);    //  Raw clusters branch
-       //printf ("Rawclusters:%p",Rawclusters);
-       Int_t nrawclusters = Rawclusters->GetEntriesFast();
-       //printf (" nrawclusters:%d\n",nrawclusters);
-       gAlice->TreeR()->GetEvent(nent-1);
-       TClonesArray *RecHits1D = RICH->RecHitsAddress1D(2);
-       Int_t nrechits1D = RecHits1D->GetEntriesFast();
-       //printf (" nrechits:%d\n",nrechits);
-       TClonesArray *RecHits3D = RICH->RecHitsAddress3D(2);
-       Int_t nrechits3D = RecHits3D->GetEntriesFast();
-       //printf (" nrechits:%d\n",nrechits);
+
+       if(gAlice->TreeR())
+        {
+          Int_t nent=(Int_t)gAlice->TreeR()->GetEntries();
+          gAlice->TreeR()->GetEvent(nent-1);
+          TClonesArray *Rawclusters = RICH->RawClustAddress(2);    //  Raw clusters branch
+          //printf ("Rawclusters:%p",Rawclusters);
+          Int_t nrawclusters = Rawclusters->GetEntriesFast();
+          //printf (" nrawclusters:%d\n",nrawclusters);
+          gAlice->TreeR()->GetEvent(nent-1);
+          TClonesArray *RecHits1D = RICH->RecHitsAddress1D(2);
+          Int_t nrechits1D = RecHits1D->GetEntriesFast();
+          //printf (" nrechits:%d\n",nrechits);
+          TClonesArray *RecHits3D = RICH->RecHitsAddress3D(2);
+          Int_t nrechits3D = RecHits3D->GetEntriesFast();
+          //printf (" nrechits:%d\n",nrechits);
+        }
+       else
+        printf("No TreeR found on file.\n");
        TTree *TH = gAlice->TreeH(); 
        Int_t ntracks = TH->GetEntries();
-
+       
        gAlice->ResetDigits();
        Int_t nent=(Int_t)gAlice->TreeD()->GetEntries();
-       gAlice->TreeD()->GetEvent(1);
+       gAlice->TreeD()->GetEvent(0);
 
 
 
@@ -196,7 +209,7 @@ void RICHpadtest (Int_t diaglevel,Int_t evNumber1=0,Int_t evNumber2=0)
           Int_t nbytes += TH->GetEvent(track);
           if (RICH)  {
               //RICH->ResetRawClusters();
-              TClonesArray *PadHits = RICH->PadHits();      // Cluster branch
+              TClonesArray *SDigits = RICH->SDigits();      // Cluster branch
               TClonesArray *Hits = RICH->Hits();            // Hits branch
               TClonesArray *Cerenkovs = RICH->Cerenkovs();  // Cerenkovs branch
           }
@@ -286,9 +299,9 @@ void RICHpadtest (Int_t diaglevel,Int_t evNumber1=0,Int_t evNumber2=0)
                   Float_t cy  =      cHit->Z();                // y-position
                   Int_t cmother =  cHit->fCMother;      // Index of mother particle
                   Int_t closs =    cHit->fLoss;           // How did the particle get lost? 
-                 //printf ("Cerenkov hit, X:%d, Y:%d\n",cx,cy); 
+                  //printf ("Cerenkov hit number %d/%d, X:%d, Y:%d\n",hit,ncerenkovs,cx,cy); 
 
-                  //printf("Particle:%9d\n",index);
+                  //printf("Particle:%9d\n",current->GetPdgCode());
                                 
                   TParticle *current = (TParticle*)gAlice->Particle(index);
                   Float_t energyckov = current->Energy();
@@ -313,7 +326,8 @@ void RICHpadtest (Int_t diaglevel,Int_t evNumber1=0,Int_t evNumber2=0)
                         {
                           cerenkov->Fill(cx,cy,(float) 1); 
                           
-                                        
+                          printf ("Cerenkov hit number %d/%d, X:%d, Y:%d\n",hit,ncerenkovs,cx,cy); 
+                          
                         TParticle *MIP = (TParticle*)gAlice->Particle(cmother);
                         mipHit = (AliRICHHit*) Hits->UncheckedAt(0);
                         mom[0] = current->Px();
@@ -614,9 +628,12 @@ void RICHpadtest (Int_t diaglevel,Int_t evNumber1=0,Int_t evNumber2=0)
         c3_1->SetLogy();
         Clcharge->SetFillColor(5);
         Clcharge->SetXTitle("ADC counts");
-        Clcharge->Fit("expo");
-        expo->SetLineColor(2);
-        expo->SetLineWidth(3);
+        if (evNumber2>10)
+          {
+            Clcharge->Fit("expo");
+            expo->SetLineColor(2);
+            expo->SetLineWidth(3);
+          }
         Clcharge->Draw();
         
         c3->cd(2);
@@ -627,9 +644,12 @@ void RICHpadtest (Int_t diaglevel,Int_t evNumber1=0,Int_t evNumber2=0)
         c3->cd(3);
         clusev->SetFillColor(5);
         clusev->SetXTitle("(counts)");
-        clusev->Fit("gaus");
-        gaus->SetLineColor(2);
-        gaus->SetLineWidth(3);
+        if (evNumber2>10)
+          {
+            clusev->Fit("gaus");
+            gaus->SetLineColor(2);
+            gaus->SetLineWidth(3);
+          }
         clusev->Draw();
 
         c3->cd(4);
@@ -653,33 +673,45 @@ void RICHpadtest (Int_t diaglevel,Int_t evNumber1=0,Int_t evNumber2=0)
        c7->cd(1);
        totalphotonsevent->SetFillColor(5);
        totalphotonsevent->SetXTitle("Photons (counts)");
-       totalphotonsevent->Fit("gaus");
-       gaus->SetLineColor(2);
-       gaus->SetLineWidth(3);
+       if (evNumber2>10)
+          {
+            totalphotonsevent->Fit("gaus");
+            gaus->SetLineColor(2);
+            gaus->SetLineWidth(3);
+          }
        totalphotonsevent->Draw();
        
        c7->cd(2);
        photev->SetFillColor(5);
        photev->SetXTitle("(counts)");
-       photev->Fit("gaus");
-       gaus->SetLineColor(2);
-       gaus->SetLineWidth(3);
+       if (evNumber2>10)
+        {
+          photev->Fit("gaus");
+          gaus->SetLineColor(2);
+          gaus->SetLineWidth(3);
+        }
        photev->Draw();
        
        c7->cd(3);
        feedev->SetFillColor(5);
        feedev->SetXTitle("(counts)");
-       feedev->Fit("gaus");
-       gaus->SetLineColor(2);
-       gaus->SetLineWidth(3);
+       if (evNumber2>10)
+        {
+          feedev->Fit("gaus");
+          gaus->SetLineColor(2);
+          gaus->SetLineWidth(3);
+        }
        feedev->Draw();
 
        c7->cd(4);
        padsev->SetFillColor(5);
        padsev->SetXTitle("(counts)");
-       padsev->Fit("gaus");
-       gaus->SetLineColor(2);
-       gaus->SetLineWidth(3);
+       if (evNumber2>10)
+        {
+          padsev->Fit("gaus");
+          gaus->SetLineColor(2);
+          gaus->SetLineWidth(3);
+        }
        padsev->Draw();
 
        break;
@@ -829,16 +861,16 @@ void RICHpadtest (Int_t diaglevel,Int_t evNumber1=0,Int_t evNumber2=0)
 
 
    Int_t Np=0;
-   /*for (Int_t i=0;i< NpadX;i++) {
-       for (Int_t j=0;j< NpadY;j++) {
-          if (Pad[i][j]>=6){
-              Np+=1;
-          }
-       }
-   }*/
+   //for (Int_t i=0;i< NpadX;i++) {
+       //for (Int_t j=0;j< NpadY;j++) {
+          //if (Pad[i][j]>=6){
+              //Np+=1;
+          //}
+       //}
+   //}
    //printf("The total number of pads which give a signal: %d %d\n",Nh,Nh1);
    printf("\nEnd of macro\n");
-   printf("**********************************\n");
+   printf("**********************************\n");*/
 }