1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
19 // Produces the data needed to calculate the quality assurance.
20 // ACORDE QA for Hits, Digits, RAW and ESD's
24 // Luciano Diaz Gonzalez <luciano.diaz@nucleares.unam.mx> (ICN-UNAM)
25 // Mario Rodriguez Cahuantzi <mrodrigu@mail.cern.ch> (FCFM-BUAP)
26 // Arturo Fernandez Tellez <afernan@mail.cern.ch (FCFM-BUAP)
28 // Created: June 13th 2008
31 // --- ROOT system ---
32 #include <TClonesArray.h>
36 #include <TDirectory.h>
38 // --- Standard library ---
40 // --- AliRoot header files ---
41 #include "AliESDEvent.h"
43 #include "AliACORDEdigit.h"
44 #include "AliACORDEhit.h"
45 #include "AliACORDERecPoint.h"
46 #include "AliACORDEQADataMaker.h"
47 #include "AliQAChecker.h"
48 #include "AliACORDERawReader.h"
49 #include "AliACORDERawStream.h"
51 ClassImp(AliACORDEQADataMaker)
53 //____________________________________________________________________________
54 AliACORDEQADataMaker::AliACORDEQADataMaker():AliQADataMaker(AliQAv1::GetDetName(AliQAv1::kACORDE), "ACORDE Quality Assurance Data Maker")
56 // Acorde QA Data Maker
59 //____________________________________________________________________________
60 AliACORDEQADataMaker::AliACORDEQADataMaker(const AliACORDEQADataMaker& qadm):AliQADataMaker()
62 SetName((const char*)qadm.GetName()) ;
63 SetTitle((const char*)qadm.GetTitle());
65 //__________________________________________________________________
66 AliACORDEQADataMaker& AliACORDEQADataMaker::operator = (const AliACORDEQADataMaker& qadm )
69 this->~AliACORDEQADataMaker();
70 new(this) AliACORDEQADataMaker(qadm);
73 //____________________________________________________________________________
74 void AliACORDEQADataMaker::StartOfDetectorCycle()
76 //Detector specific actions at start of cycle
80 //____________________________________________________________________________
81 void AliACORDEQADataMaker::InitHits()
84 // create Hits histograms in Hits subdir
85 TH1F *fAHitsACORDE[8];
87 fAHitsACORDE[0] = new TH1F("hACORDEloss" ,"Energy Loss ",1000,0.,1500.);
88 fAHitsACORDE[1] = new TH1F("hACORDEPolar" ," Polar Angle ",90,0.,90.);
89 fAHitsACORDE[2] = new TH1F("hACORDEAzimuth" ,"Azimuth Angle ",360,-180.,180.);
90 fAHitsACORDE[3] = new TH1F("hACORDEPx" ,"Px Distribution ",60,-30.,30.);
91 fAHitsACORDE[4] = new TH1F("hACORDEPy" ,"Py Distribution ",60,-30.,30.);
92 fAHitsACORDE[5] = new TH1F("hACORDEPz" ,"Pz Distribution ",60,-30.,30.);
93 fAHitsACORDE[6] = new TH1F("hACORDEPt" ,"Pt Distribution ",60,0.,50.);
94 fAHitsACORDE[7] = new TH1F("hACORDEpxpz" ,"Pt Distribution ",100,-50.,50.);
96 TH2F *hACORDExy = new TH2F("hACORDExy" ,"Dist. xy",2800,-2400.,1400.,200,-4805.,4825.);
97 TH2F *hACORDExz = new TH2F("hACORDExz" ,"Dist.xz ",900,-1500.,2850.,1200,-1000.,4000.);
98 TH2F *hACORDEyz = new TH2F("hACORDEyz" ,"Dist.yz ",5,817.,819.,1200,-600.,600.);
99 TH2F *hACORDEAzimPol = new TH2F("hACORDEAzimPol" ,"Azimuth vs Polar ",360,-180.,180.,180,0.,180.);
101 for(Int_t i=0; i<8; i++)
102 Add2HitsList(fAHitsACORDE[i],i);
104 Add2HitsList(hACORDExy,8);
105 Add2HitsList(hACORDExz,9);
106 Add2HitsList(hACORDEyz,10);
107 Add2HitsList(hACORDEAzimPol,11);
110 //____________________________________________________________________________
111 void AliACORDEQADataMaker::InitDigits()
113 // create Digits histograms in Digits subdir
115 TH1F * fhDigitsModule;
117 modulename = "hDigitsModule";
118 fhDigitsModule = new TH1F(modulename.Data(),"hDigitsModuleSingle",60,0,60);
119 Add2DigitsList( fhDigitsModule,0);
124 //____________________________________________________________________________
125 void AliACORDEQADataMaker::InitRaws()
127 // create Raw histograms in Raw subdir
128 TH1D *fhACORDEBitPattern[4];
129 fhACORDEBitPattern[0] = new TH1D("ACORDERawDataSM","ACORDE-SingleMuon",60,1,60);//AcordeSingleMuon BitPattern
130 fhACORDEBitPattern[1] = new TH1D("ACORDERawDataMM","ACORDE-MultiMuon",60,1,60);//AcordeMultiMuon BitPattern
131 fhACORDEBitPattern[2] = new TH1D("ACORDERawDataSMM","ACORDE-SingleMuonMultiplicity",60,1,60);//AcordeSingleMuon Multiplicity
132 fhACORDEBitPattern[3] = new TH1D("ACORDERawDataMMM","ACORDE-MultiMuonMultiplicity",60,1,60);//AcordeMultiMuon Multiplicity
133 for(Int_t i=0;i<4;i++)
135 Add2RawsList(fhACORDEBitPattern[i],i);
139 //____________________________________________________________________________
141 void AliACORDEQADataMaker::InitRecPoints()
143 // create cluster histograms in RecPoint subdir
144 // Not needed for ACORDE by now !!!
146 //____________________________________________________________________________
147 void AliACORDEQADataMaker::InitESDs()
149 //create ESDs histograms in ESDs subdir
156 name = "hESDsSingle";
157 fhESDsSingle = new TH1F(name.Data(),"hESDsSingle",60,0,60);
158 Add2ESDsList( fhESDsSingle,0);
161 fhESDsMulti = new TH1F(name.Data(),"hESDsMulti",60,0,60);
162 Add2ESDsList( fhESDsMulti,1);
167 //____________________________________________________________________________
169 void AliACORDEQADataMaker::MakeHits(TTree *hitTree)
172 // Here we fill the QA histos for Hits declared above
174 printf("Estamos en make Hits");
175 TClonesArray * hits = new TClonesArray("AliACORDEhit",1000);
176 TBranch * branch = hitTree->GetBranch("ACORDE");
179 AliWarning("ACORDE branch in Hit Tree not found");
184 branch->SetAddress(&hits);
187 AliError("Branch ACORDE hit not found");
190 Int_t ntracks = (Int_t)hitTree->GetEntries();
191 if (ntracks<=0) return;
192 for(Int_t track=0;track<ntracks;track++)
194 branch->GetEntry(track);
195 Int_t nhits = hits->GetEntriesFast();
196 for(Int_t ihit=0;ihit<nhits;ihit++)
198 AliACORDEhit *AcoHit = (AliACORDEhit*) hits->UncheckedAt(ihit);
201 AliError("The unchecked hit doesn't exist");
204 GetHitsData(0)->Fill(AcoHit->Eloss());
205 GetHitsData(1)->Fill(AcoHit->PolarAngle());
206 GetHitsData(2)->Fill(AcoHit->AzimuthAngle());
207 GetHitsData(3)->Fill(AcoHit->Px());
208 GetHitsData(4)->Fill(AcoHit->Py());
209 GetHitsData(5)->Fill(AcoHit->Pz());
210 GetHitsData(6)->Fill(TMath::Sqrt( (AcoHit->Px())*(AcoHit->Px())+
211 (AcoHit->Py())*(AcoHit->Py())));
212 if((AcoHit->Py()) != 0.0 ) GetHitsData(7)->Fill(TMath::ATan(AcoHit->Px()/AcoHit->Py()));
213 GetHitsData(8)->Fill( (Float_t)(AcoHit->X()),(Float_t)(AcoHit->Y()) );
214 GetHitsData(9)->Fill( (Float_t)(AcoHit->X()),(Float_t)(AcoHit->Z()) );
215 GetHitsData(10)->Fill( (Float_t)(AcoHit->Y()),(Float_t)(AcoHit->Z()) );
216 GetHitsData(11)->Fill( (Float_t)(AcoHit->AzimuthAngle()),
217 (Float_t)(AcoHit->PolarAngle()));
226 //____________________________________________________________________________
227 void AliACORDEQADataMaker::MakeDigits( TTree *digitsTree)
229 //fills QA histos for Digits
232 TClonesArray * digits = new TClonesArray("AliACORDEdigit",1000);
233 TBranch * branch = digitsTree->GetBranch("ACORDEdigit");
236 AliWarning("ACORDE branch in Digits Tree not found");
241 branch->SetAddress(&digits);
244 AliError("Branch ACORDE digit not found");
247 Int_t ntracks = (Int_t)digitsTree->GetEntries();
248 if (ntracks<=0) return;
249 printf("Entries in DigitsTree:%d\n",ntracks);
250 for(Int_t track=0;track<ntracks;track++)
252 branch->GetEntry(track);
253 Int_t ndigits = digits->GetEntriesFast();
254 for(Int_t idigit=0;idigit<ndigits;idigit++)
256 AliACORDEdigit *AcoDigit = (AliACORDEdigit*) digits->UncheckedAt(idigit);
259 AliError("The unchecked digit doesn't exist");
262 GetDigitsData(0)->Fill(AcoDigit->GetModule()-1);
273 //____________________________________________________________________________
274 void AliACORDEQADataMaker::MakeRaws( AliRawReader* rawReader)
277 //fills QA histos for RAW
279 AliACORDERawStream rawStream(rawReader);
284 bool kroSingle[60],kroMulti[60];
287 for(Int_t m=0;m<60;m++) {kroSingle[m]=0;kroMulti[m]=0;}
291 rawReader->NextEvent();
293 dy[0]=rawStream.GetWord(0);
294 dy[1]=rawStream.GetWord(1);
295 dy[2]=rawStream.GetWord(2);
296 dy[3]=rawStream.GetWord(3);
298 for(Int_t r=0;r<30;++r)
300 kroSingle[r] = tmpDy & 1;
304 for(Int_t r=30;r<60;++r)
306 kroSingle[r] = tmpDy & 1;
310 for(Int_t r=0;r<30;++r)
312 kroMulti[r] = tmpDy & 1;
316 for(Int_t r=30;r<60;++r)
318 kroMulti[r] = tmpDy & 1;
323 for(Int_t r=0;r<60;++r)
327 GetRawsData(0)->Fill(r+1);
328 contSingle=contSingle+1;
332 GetRawsData(1)->Fill(r+1);
336 }GetRawsData(2)->Fill(contSingle);GetRawsData(3)->Fill(contMulti);
342 //____________________________________________________________________________
343 void AliACORDEQADataMaker::MakeRecPoints(TTree * clustersTree)
345 //fills QA histos for clusters
346 // Not needed for ACORDE by now!!!
349 //____________________________________________________________________________
350 void AliACORDEQADataMaker::MakeESDs(AliESDEvent * esd)
352 //fills QA histos for ESD
354 AliESDACORDE * fESDACORDE= esd->GetACORDEData();
355 Int_t *fACORDEMultiMuon =fESDACORDE->GetACORDEMultiMuon();
356 Int_t *fACORDESingleMuon=fESDACORDE->GetACORDESingleMuon();
358 for(int i=0;i<60;i++){
359 if(fACORDESingleMuon[i]==1)
360 GetESDsData(0) -> Fill(i);
361 if(fACORDEMultiMuon[i]==1)
362 GetESDsData(1) -> Fill(i);