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);
109 ClonePerTrigClass(AliQAv1::kHITS); // this should be the last line
112 //____________________________________________________________________________
113 void AliACORDEQADataMaker::InitDigits()
115 // create Digits histograms in Digits subdir
117 TH1F * fhDigitsModule;
119 modulename = "hDigitsModule";
120 fhDigitsModule = new TH1F(modulename.Data(),"hDigitsModuleSingle",60,0,60);
121 Add2DigitsList( fhDigitsModule,0);
123 ClonePerTrigClass(AliQAv1::kDIGITS); // this should be the last line
126 //____________________________________________________________________________
127 void AliACORDEQADataMaker::InitRaws()
129 // create Raw histograms in Raw subdir
130 TH1F *fhACORDEBitPattern[4];
131 fhACORDEBitPattern[0] = new TH1F("ACORDERawDataSM","ACORDE-SingleMuon",60,1,60);//AcordeSingleMuon BitPattern
132 fhACORDEBitPattern[1] = new TH1F("ACORDERawDataMM","ACORDE-MultiMuon",60,1,60);//AcordeMultiMuon BitPattern
133 fhACORDEBitPattern[2] = new TH1F("ACORDERawDataSMM","ACORDE-SingleMuonMultiplicity",60,1,60);//AcordeSingleMuon Multiplicity
134 fhACORDEBitPattern[3] = new TH1F("ACORDERawDataMMM","ACORDE-MultiMuonMultiplicity",60,1,60);//AcordeMultiMuon Multiplicity
135 for(Int_t i=0;i<4;i++) {
136 Add2RawsList(fhACORDEBitPattern[i],i);
139 ClonePerTrigClass(AliQAv1::kRAWS); // this should be the last line
142 //____________________________________________________________________________
144 void AliACORDEQADataMaker::InitRecPoints()
146 // create cluster histograms in RecPoint subdir
147 // Not needed for ACORDE by now !!
149 ClonePerTrigClass(AliQAv1::kRECPOINTS); // this should be the last line
152 //____________________________________________________________________________
153 void AliACORDEQADataMaker::InitESDs()
155 //create ESDs histograms in ESDs subdir
162 name = "hESDsSingle";
163 fhESDsSingle = new TH1F(name.Data(),"hESDsSingle",60,0,60);
164 Add2ESDsList( fhESDsSingle,0);
167 fhESDsMulti = new TH1F(name.Data(),"hESDsMulti",60,0,60);
168 Add2ESDsList( fhESDsMulti,1);
170 ClonePerTrigClass(AliQAv1::kESDS); // this should be the last line
173 //____________________________________________________________________________
175 void AliACORDEQADataMaker::MakeHits(TTree *hitTree)
178 // Here we fill the QA histos for Hits declared above
179 IncEvCountCycleHits();
180 IncEvCountTotalHits();
182 printf("Estamos en make Hits");
183 TClonesArray * hits = new TClonesArray("AliACORDEhit",1000);
184 TBranch * branch = hitTree->GetBranch("ACORDE");
187 AliWarning("ACORDE branch in Hit Tree not found");
192 branch->SetAddress(&hits);
195 AliError("Branch ACORDE hit not found");
198 Int_t ntracks = (Int_t)hitTree->GetEntries();
199 if (ntracks<=0) return;
200 for(Int_t track=0;track<ntracks;track++)
202 branch->GetEntry(track);
203 Int_t nhits = hits->GetEntriesFast();
204 for(Int_t ihit=0;ihit<nhits;ihit++)
206 AliACORDEhit *AcoHit = (AliACORDEhit*) hits->UncheckedAt(ihit);
209 AliError("The unchecked hit doesn't exist");
212 FillHitsData(0,AcoHit->Eloss());
213 FillHitsData(1,AcoHit->PolarAngle());
214 FillHitsData(2,AcoHit->AzimuthAngle());
215 FillHitsData(3,AcoHit->Px());
216 FillHitsData(4,AcoHit->Py());
217 FillHitsData(5,AcoHit->Pz());
218 FillHitsData(6,TMath::Sqrt( (AcoHit->Px())*(AcoHit->Px())+
219 (AcoHit->Py())*(AcoHit->Py())));
220 if((AcoHit->Py()) != 0.0 ) FillHitsData(7,TMath::ATan(AcoHit->Px()/AcoHit->Py()));
221 FillHitsData(8, (Float_t)(AcoHit->X()),(Float_t)(AcoHit->Y()) );
222 FillHitsData(9, (Float_t)(AcoHit->X()),(Float_t)(AcoHit->Z()) );
223 FillHitsData(10, (Float_t)(AcoHit->Y()),(Float_t)(AcoHit->Z()) );
224 FillHitsData(11, (Float_t)(AcoHit->AzimuthAngle()),
225 (Float_t)(AcoHit->PolarAngle()));
234 //____________________________________________________________________________
235 void AliACORDEQADataMaker::MakeDigits( TTree *digitsTree)
237 //fills QA histos for Digits
238 IncEvCountCycleDigits();
239 IncEvCountTotalDigits();
242 TClonesArray * digits = new TClonesArray("AliACORDEdigit",1000);
243 TBranch * branch = digitsTree->GetBranch("ACORDEdigit");
246 AliWarning("ACORDE branch in Digits Tree not found");
251 branch->SetAddress(&digits);
254 AliError("Branch ACORDE digit not found");
257 Int_t ntracks = (Int_t)digitsTree->GetEntries();
258 if (ntracks<=0) return;
259 printf("Entries in DigitsTree:%d\n",ntracks);
260 for(Int_t track=0;track<ntracks;track++)
262 branch->GetEntry(track);
263 Int_t ndigits = digits->GetEntriesFast();
264 for(Int_t idigit=0;idigit<ndigits;idigit++)
266 AliACORDEdigit *AcoDigit = (AliACORDEdigit*) digits->UncheckedAt(idigit);
269 AliError("The unchecked digit doesn't exist");
272 FillDigitsData(0,AcoDigit->GetModule()-1);
283 //____________________________________________________________________________
284 void AliACORDEQADataMaker::MakeRaws( AliRawReader* rawReader)
287 //fills QA histos for RAW
288 IncEvCountCycleRaws();
289 IncEvCountTotalRaws();
292 AliACORDERawStream rawStream(rawReader);
297 bool kroSingle[60],kroMulti[60];
300 for(Int_t m=0;m<60;m++) {kroSingle[m]=0;kroMulti[m]=0;}
304 rawReader->NextEvent();
306 dy[0]=rawStream.GetWord(0);
307 dy[1]=rawStream.GetWord(1);
308 dy[2]=rawStream.GetWord(2);
309 dy[3]=rawStream.GetWord(3);
311 for(Int_t r=0;r<30;++r)
313 kroSingle[r] = tmpDy & 1;
317 for(Int_t r=30;r<60;++r)
319 kroSingle[r] = tmpDy & 1;
323 for(Int_t r=0;r<30;++r)
325 kroMulti[r] = tmpDy & 1;
329 for(Int_t r=30;r<60;++r)
331 kroMulti[r] = tmpDy & 1;
336 for(Int_t r=0;r<60;++r)
341 contSingle=contSingle+1;
349 } FillRawsData(2,contSingle); FillRawsData(3,contMulti);
355 //____________________________________________________________________________
356 void AliACORDEQADataMaker::MakeRecPoints(TTree * clustersTree)
358 //fills QA histos for clusters
359 IncEvCountCycleRecPoints();
360 IncEvCountTotalRecPoints();
362 // Not needed for ACORDE by now!!!
365 //____________________________________________________________________________
366 void AliACORDEQADataMaker::MakeESDs(AliESDEvent * esd)
368 //fills QA histos for ESD
369 IncEvCountCycleESDs();
370 IncEvCountTotalESDs();
373 AliESDACORDE * fESDACORDE= esd->GetACORDEData();
374 Int_t *fACORDEMultiMuon =fESDACORDE->GetACORDEMultiMuon();
375 Int_t *fACORDESingleMuon=fESDACORDE->GetACORDESingleMuon();
377 for(int i=0;i<60;i++){
378 if(fACORDESingleMuon[i]==1)
380 if(fACORDEMultiMuon[i]==1)