]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PHOS/PHOSHistos.cxx
WARNINGs are put on cout instead of cerr
[u/mrichter/AliRoot.git] / PHOS / PHOSHistos.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15 //_________________________________________________________________________
16 // Cheking PHOSHistos procedure of PHOS
17 //*-- Author : Gines MARTINEZ  SUBATECH january 2000
18 //////////////////////////////////////////////////////////////////////////////
19
20 // --- ROOT system ---
21 #include "TCanvas.h"
22 #include "TFile.h"
23 #include "TH1.h"
24 #include "TPad.h"
25 #include "TTree.h"
26
27 // --- Standard library ---
28
29 #include <iostream>
30 #include <cstdio>
31
32
33 // --- AliRoot header files ---
34 #include "AliRun.h"
35 #include "TFile.h"
36 #include "AliPHOSGeometry.h"
37 #include "AliPHOSv0.h"
38 #include "AliPHOSDigit.h"
39 #include "AliPHOSRecPoint.h"
40 #include "AliPHOSEmcRecPoint.h"
41 #include "AliPHOSPpsdRecPoint.h"
42 #include "AliPHOSClusterizerv1.h"
43 #include "AliPHOSReconstructioner.h"
44 #include "AliPHOSTrackSegment.h"
45 #include "AliPHOSTrackSegmentMakerv1.h"
46 #include "AliPHOSPIDv1.h"
47 #include "PHOSHistos.h"
48
49
50 void PHOSHistos (Text_t* infile, Int_t nevent, Int_t Module)  
51 {
52 //========== Opening galice.root file  
53   TFile * file   = new TFile(infile); 
54 //========== Get AliRun object from file 
55   gAlice = (AliRun*) file->Get("gAlice");//=========== Gets the PHOS object and associated geometry from the file 
56
57   AliPHOSv0 * PHOS  = (AliPHOSv0 *)gAlice->GetDetector("PHOS");
58   AliPHOSGeometry * Geom = AliPHOSGeometry::GetInstance(PHOS->GetGeometry()->GetName(),PHOS->GetGeometry()->GetTitle());
59 //========== Creates the track segment maker
60   AliPHOSTrackSegmentMakerv1 * tracksegmentmaker = new AliPHOSTrackSegmentMakerv1() ;
61   //========== Creates the particle identifier
62   AliPHOSPIDv1 * particleidentifier = new AliPHOSPIDv1 ;
63   cout <<  "AnalyzeOneEvent > using particle identifier " << particleidentifier->GetName() << endl ; 
64     
65   TH1F * hEmcDigit       = new TH1F("hEmcDigit","hEmcDigit",1000,0.,5.);
66   TH1F * hVetoDigit      = new TH1F("hVetoDigit","hVetoDigit",1000,0.,3.e-5);
67   TH1F * hConvertorDigit = new TH1F("hConvertorDigit","hConvertorDigit",1000,0.,3.e-5);
68   TH1F * hEmcCluster       = new TH1F("hEmcCluster","hEmcCluster",1000,-5.,5.);
69   TH1F * hVetoCluster      = new TH1F("hVetoCluster","hVetoCluster",1000,0.,3.e-5);
70   TH1F * hConvertorCluster = new TH1F("hConvertorCluster","hConvertorCluster",1000,0.,3.e-5);
71   TH2F * hConvertorEmc = new TH2F("hConvertorEmc","hConvertorEmc",100,2.,3., 100, 0., 1.e-5);
72
73   AliPHOSDigit * digit ;
74
75 //========== Loop on events
76   Int_t ievent;
77   for(ievent=0;ievent<nevent; ievent++)
78   { 
79 //========== Creates the Clusterizer
80     AliPHOSClusterizerv1 * clusterizer = new AliPHOSClusterizerv1() ; 
81     clusterizer->SetEmcEnergyThreshold(0.01) ; 
82     clusterizer->SetEmcClusteringThreshold(0.1) ; 
83     clusterizer->SetPpsdEnergyThreshold(0.00000005) ; 
84     clusterizer->SetPpsdClusteringThreshold(0.00000005) ; 
85     clusterizer->SetLocalMaxCut(0.03) ;
86     clusterizer->SetCalibrationParameters(0., 0.00000001) ;
87
88   //========== Creates the Reconstructioner  
89     AliPHOSReconstructioner * Reconstructioner = new AliPHOSReconstructioner(clusterizer, tracksegmentmaker, particleidentifier) ;
90      
91     cout << "Event " << ievent <<endl;
92
93     Int_t RelId[4] ;
94     //=========== Connects the various Tree's for evt
95     gAlice->GetEvent(ievent);
96     //=========== Gets the Digit TTree
97     gAlice->TreeD()->GetEvent(0) ;     
98     //=========== Gets the number of entries in the Digits array
99     //    Int_t nId = PHOS->Digits()->GetEntries();      
100     TIter next(PHOS->Digits()) ;
101     Float_t Etot=0 ;
102     Int_t nVeto=0 ;
103     Int_t nConvertor=0 ;
104
105     while( ( digit = (AliPHOSDigit *)next() ) )
106     {
107        Etot+=clusterizer->Calibrate(digit->GetAmp()) ;
108        Geom->AbsToRelNumbering(digit->GetId(), RelId) ;        
109
110        if (clusterizer->IsInEmc(digit))
111        {   hEmcDigit->Fill(clusterizer->Calibrate(digit->GetAmp())) ; }
112        else    
113        {  
114          if (RelId[1]==9) {nVeto++; hVetoDigit->Fill(clusterizer->Calibrate(digit->GetAmp()));} 
115          if (RelId[1]==25) {nConvertor++; hConvertorDigit->Fill(clusterizer->Calibrate(digit->GetAmp()));}
116        }
117     }
118    
119      PHOS->Reconstruction(Reconstructioner); 
120  
121 //=========== Cluster in Module
122      TClonesArray * EmcRP = PHOS->EmcClusters() ;
123      TIter nextemc(EmcRP) ;
124      AliPHOSEmcRecPoint * emc ;
125      Float_t Energy;
126      while((emc = (AliPHOSEmcRecPoint *)nextemc())) 
127      {
128        if ( emc->GetPHOSMod() == Module )
129        {  
130          Energy = emc->GetEnergy() ;
131          hEmcCluster->Fill(Energy); 
132          printf("Energy of the EMC cluster is %f \n",Energy);
133          TClonesArray * PpsdRP = PHOS->PpsdClusters() ;
134          TIter nextPpsd(PpsdRP) ;
135          AliPHOSPpsdRecPoint * Ppsd ;
136          Float_t Energy2;
137          while((Ppsd = (AliPHOSPpsdRecPoint *)nextPpsd())) 
138            {
139              if ( Ppsd->GetPHOSMod() == Module )
140                { 
141                  Energy2 = Ppsd->GetEnergy() ;
142                  
143                  if (!Ppsd->GetUp()) hConvertorEmc->Fill(Energy,Energy2) ;
144                }
145            }
146     
147        }
148      }
149  
150     //=========== Cluster in Module PPSD Down
151      TClonesArray * PpsdRP = PHOS->PpsdClusters() ;
152      TIter nextPpsd(PpsdRP) ;
153      AliPHOSPpsdRecPoint * Ppsd ;
154      while((Ppsd = (AliPHOSPpsdRecPoint *)nextPpsd())) 
155      {
156        if ( Ppsd->GetPHOSMod() == Module )
157        { 
158          Energy = Ppsd->GetEnergy() ;
159
160          if (!Ppsd->GetUp()) hConvertorCluster->Fill(Energy) ;
161          if (Ppsd->GetUp()) hVetoCluster->Fill(Energy) ;
162    
163        }
164      }
165   } 
166
167   TCanvas * cVetoDigit = new TCanvas("VetoDigit","VetoDigit");  
168   hVetoDigit->Draw();
169   TCanvas * cConvertorDigit = new TCanvas("ConvertorDigit","ConvertorDigit");  
170   hConvertorDigit->Draw();
171   TCanvas * cEmcDigit = new TCanvas("EmcDigit","EmcDigit");  
172   hEmcDigit->Draw();
173   TCanvas * cVetoCluster = new TCanvas("VetoCluster","VetoCluster");  
174   hVetoCluster->Draw();
175   TCanvas * cConvertorCluster = new TCanvas("ConvertorCluster","ConvertorCluster");  
176   hConvertorCluster->Draw();
177   TCanvas * cEmcCluster = new TCanvas("EmcCluster","EmcCluster");  
178   hEmcCluster->Draw();
179   TCanvas * cConvertorEmc = new TCanvas("ConvertorEmc","ConvertorEmc");  
180   hConvertorEmc->Draw("col1");
181
182
183 }
184
185