]> git.uio.no Git - u/mrichter/AliRoot.git/blob - VZERO/AliVZEROQADataMakerRec.cxx
5b4067f1285d6227a54f2308ae026d01ccb24ccf
[u/mrichter/AliRoot.git] / VZERO / AliVZEROQADataMakerRec.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
17 /*
18   Produces the data needed to calculate the quality assurance. 
19   All data must be mergeable objects.
20 */
21
22 // --- ROOT system ---
23 #include <TClonesArray.h>
24 #include <TFile.h> 
25 #include <TH1F.h> 
26 #include <TH1I.h> 
27 #include <TH2I.h> 
28
29 // --- Standard library ---
30
31 // --- AliRoot header files ---
32 #include "AliESDEvent.h"
33 #include "AliLog.h"
34 #include "AliVZEROQADataMakerRec.h"
35 #include "AliQAChecker.h"
36 #include "AliRawReader.h"
37 #include "AliVZERORawStream.h"
38 #include "AliVZEROReconstructor.h"
39
40
41 ClassImp(AliVZEROQADataMakerRec)
42            
43 //____________________________________________________________________________ 
44   AliVZEROQADataMakerRec::AliVZEROQADataMakerRec() : 
45   AliQADataMakerRec(AliQA::GetDetName(AliQA::kVZERO), "VZERO Quality Assurance Data Maker")
46 {
47   // constructor
48 }
49
50 //____________________________________________________________________________ 
51 AliVZEROQADataMakerRec::AliVZEROQADataMakerRec(const AliVZEROQADataMakerRec& qadm) :
52   AliQADataMakerRec()
53 {
54   //copy constructor 
55   SetName((const char*)qadm.GetName()) ; 
56   SetTitle((const char*)qadm.GetTitle()); 
57 }
58
59 //__________________________________________________________________
60 AliVZEROQADataMakerRec& AliVZEROQADataMakerRec::operator = (const AliVZEROQADataMakerRec& qadm )
61 {
62   // Equal operator
63   this->~AliVZEROQADataMakerRec();
64   new(this) AliVZEROQADataMakerRec(qadm);
65   return *this;
66 }
67  
68 //____________________________________________________________________________ 
69 void AliVZEROQADataMakerRec::EndOfDetectorCycle(AliQA::TASKINDEX_t task, TObjArray * list)
70 {
71   //Detector specific actions at end of cycle
72   // do the QA checking
73   AliQAChecker::Instance()->Run(AliQA::kVZERO, task, list) ;  
74 }
75
76 //____________________________________________________________________________ 
77 void AliVZEROQADataMakerRec::InitESDs()
78 {
79   //Create histograms to controll ESD
80  
81   TH1I * h1 = new TH1I("hVZERONbPMA", "Number of PMs fired in V0A", 80, 0, 79); 
82   h1->Sumw2() ;
83   Add2ESDsList(h1, 0)  ;  
84                                                                                                         
85   TH1I * h2 = new TH1I("hVZERONbPMC", "Number of PMs fired in V0C", 80, 0, 79); 
86   h2->Sumw2() ;
87   Add2ESDsList(h2, 1) ;
88  
89   TH1I * h3 = new TH1I("hVZEROMultA", "Multiplicity in V0A", 50, 0, 49) ; 
90   h3->Sumw2() ;
91   Add2ESDsList(h3, 2) ;
92  
93   TH1I * h4 = new TH1I("hVZEROMultC", "Multiplicity in V0C", 50, 0, 49) ; 
94   h4->Sumw2() ;
95   Add2ESDsList(h4, 3) ;
96         
97 }
98
99
100 //____________________________________________________________________________ 
101  void AliVZEROQADataMakerRec::InitRaws()
102  {
103    // create Raws histograms in Raws subdir
104
105   char ADCname[12]; 
106   char texte[40]; 
107   TH1I *fhRawADC0[64]; 
108   TH1I *fhRawADC1[64]; 
109   
110   TH2I * h0 = new TH2I("hCellADCMap0","ADC vs Cell for EVEN Integrator", 70, 0, 69, 512, 0, 1023);
111   h0->Sumw2(); 
112   Add2RawsList(h0,0) ;
113   TH2I * h1 = new TH2I("hCellADCMap1","ADC vs Cell for ODD Integrator", 70, 0, 69, 512, 0, 1023);
114   h1->Sumw2();
115   Add2RawsList(h1,1) ;
116                            
117   for (Int_t i=0; i<64; i++)
118     {
119        sprintf(ADCname,"hRaw0ADC%d",i);
120        sprintf(texte,"Raw ADC in cell %d for even integrator",i);
121        fhRawADC0[i]= new TH1I(ADCname,texte,1024,0,1023);       
122        Add2RawsList(fhRawADC0[i],i+2);
123        
124        sprintf(ADCname,"hRaw1ADC%d",i);
125        sprintf(texte,"Raw ADC in cell %d for odd integrator",i);
126        fhRawADC1[i]= new TH1I(ADCname,texte,1024,0,1023);       
127        Add2RawsList(fhRawADC1[i],i+2+64);       
128      }  
129  }
130
131 //____________________________________________________________________________
132 void AliVZEROQADataMakerRec::MakeESDs(AliESDEvent * esd)
133 {
134   // make QA data from ESDs
135
136   AliESDVZERO *esdVZERO=esd->GetVZEROData();
137    
138   if (esdVZERO) { 
139       GetESDsData(0)->Fill(esdVZERO->GetNbPMV0A());
140       GetESDsData(1)->Fill(esdVZERO->GetNbPMV0C());  
141       GetESDsData(2)->Fill(esdVZERO->GetMTotV0A());
142       GetESDsData(3)->Fill(esdVZERO->GetMTotV0C());  
143   }
144
145 }
146
147 //____________________________________________________________________________
148  void AliVZEROQADataMakerRec::MakeRaws(AliRawReader* rawReader)
149  {
150    //Fill histograms with Raws
151        
152   AliVZERORawStream* rawStream  = new AliVZERORawStream(rawReader); 
153   rawStream->Next();
154     
155   for(Int_t i=0; i<64; i++) 
156      {
157        if(!rawStream->GetIntegratorFlag(i,10)) 
158          { 
159            // even integrator - fills index 2 to 65   
160            GetRawsData(0)->Fill(i,rawStream->GetADC(i)) ; 
161            GetRawsData(i+2)->Fill(rawStream->GetADC(i)) ; }
162        else 
163          { 
164            // odd integrator  - fills index 66 to 129   
165            GetRawsData(1)->Fill(i,rawStream->GetADC(i)) ; 
166            GetRawsData(i+2+64)->Fill(rawStream->GetADC(i)) ; }          
167       }          
168   delete rawStream;
169  }
170
171 //____________________________________________________________________________ 
172 void AliVZEROQADataMakerRec::StartOfDetectorCycle()
173 {
174   // Detector specific actions at start of cycle
175   
176 }