1 /**************************************************************************
2 * Copyright(c) 2007-2009, 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 **************************************************************************/
16 // *************************************************************
17 // Checks the quality assurance
18 // by comparing with reference data
20 // -------------------------------------------------------------
21 // W. Ferrarese + P. Cerello Feb 2008
24 // --- ROOT system ---
29 // --- Standard library ---
31 // --- AliRoot header files ---
32 #include "AliITSQASSDDataMakerRec.h"
35 #include "AliQAChecker.h"
36 #include "AliRawReader.h"
37 #include "AliITSRawStreamSSD.h"
38 #include "AliITSgeomTGeo.h"
41 ClassImp(AliITSQASSDDataMakerRec)
43 //____________________________________________________________________________
44 AliITSQASSDDataMakerRec::AliITSQASSDDataMakerRec(AliITSQADataMakerRec *aliITSQADataMakerRec, Bool_t kMode, Int_t ldc) :
46 fAliITSQADataMakerRec(aliITSQADataMakerRec),
54 //ctor used to discriminate OnLine-Offline analysis
55 //initilize the raw signal vs strip number histograms
56 Int_t fLayer = 0,fLadder = 0, fModule = 0;
57 TString fTitle; Int_t fHistCounter = 0;
58 for(Int_t i = 500; i < fgkSSDMODULES + 500; i++) {
59 AliITSgeomTGeo::GetModuleId(i,fLayer,fLadder,fModule);
60 fTitle = "SSD_RawSignal_Layer"; fTitle += fLayer;
61 fTitle += "_Ladder"; fTitle += fLadder;
62 fTitle += "_Module"; fTitle += fModule;
63 fHistSSDRawSignalModule[fHistCounter] = new TH1D(fTitle.Data(),fTitle.Data(),1540,0,1540);
68 //____________________________________________________________________________
69 AliITSQASSDDataMakerRec::AliITSQASSDDataMakerRec(const AliITSQASSDDataMakerRec& qadm) :
71 fAliITSQADataMakerRec(qadm.fAliITSQADataMakerRec),
72 fkOnline(qadm.fkOnline),
74 fSSDhRaws(qadm.fSSDhRaws),
75 fSSDhRecs(qadm.fSSDhRecs),
76 fRawsOffset(qadm.fRawsOffset),
77 fRecsOffset(qadm.fRecsOffset)
80 fAliITSQADataMakerRec->SetName((const char*)qadm.fAliITSQADataMakerRec->GetName()) ;
81 fAliITSQADataMakerRec->SetTitle((const char*)qadm.fAliITSQADataMakerRec->GetTitle());
84 //__________________________________________________________________
85 AliITSQASSDDataMakerRec& AliITSQASSDDataMakerRec::operator = (const AliITSQASSDDataMakerRec& qac )
88 this->~AliITSQASSDDataMakerRec();
89 new(this) AliITSQASSDDataMakerRec(qac);
93 //____________________________________________________________________________
94 void AliITSQASSDDataMakerRec::StartOfDetectorCycle()
96 //Detector specific actions at start of cycle
97 AliDebug(1,"AliITSQADM::Start of SSD Cycle\n");
100 //____________________________________________________________________________
101 void AliITSQASSDDataMakerRec::EndOfDetectorCycle(AliQA::TASKINDEX /*task*/, TObjArray* /*list*/)
103 // launch the QA checking
104 AliDebug(1,"AliITSDM instantiates checker with Run(AliQA::kITS, task, list)\n");
106 //SSD occupancy plots
108 Int_t fLayer = 0, fLadder = 0, fModule = 0;
109 Int_t fOccPosition = 0;
110 for(Int_t i = 0; i < fgkSSDMODULES; i++) {
111 AliITSgeomTGeo::GetModuleId(i+500,fLayer,fLadder,fModule);
112 fOccPosition = (fLayer == 5) ? fLadder : fLadder + 34;
113 Double_t occupancy = GetSSDOccupancyRaws(fHistSSDRawSignalModule[i]);
114 //if(occupancy > 0) {
115 //AliInfo(Form("========================================="));
116 //AliInfo(Form("%s Position: %d - Initial histos: %d - Occupancy: %lf\n",fHistSSDRawSignalModule[i]->GetName(),fOccPosition,fInitialHistograms,occupancy));
118 fAliITSQADataMakerRec->GetRawsData(fRawsOffset + fOccPosition - 1)->Fill(fModule,occupancy);
120 }//online flag for SSD
121 //AliQAChecker::Instance()->Run( AliQA::kITS , task, list);
124 //____________________________________________________________________________
125 void AliITSQASSDDataMakerRec::InitRaws() {
127 // Initialization for RAW data - SSD -
128 fRawsOffset = (fAliITSQADataMakerRec->fRawsQAList)->GetEntries();
130 const Int_t fSSDLADDERS = 72;
132 AliInfo("Book Online Histograms for SSD\n");
135 AliInfo("Book Offline Histograms for SSD\n ");
137 AliInfo(Form("Number of histograms (SPD+SDD): %d\n",fRawsOffset));
139 //Int_t fLayer = 0,fLadder = 0, fModule = 0;
140 //book online QA histos
142 TH1D *hOccupancyLadder[fSSDLADDERS];
143 for(Int_t iLayer = 5; iLayer < 7; iLayer++) {
144 for(Int_t iLadder = 1; iLadder < AliITSgeomTGeo::GetNLadders(iLayer) + 1; iLadder++) {
145 fTitle = "SSD_Occupancy_Layer"; fTitle += iLayer;
146 fTitle += "_Ladder"; fTitle += iLadder;
147 hOccupancyLadder[fSSDhRaws] = new TH1D(fTitle.Data(),fTitle.Data(),AliITSgeomTGeo::GetNDetectors(iLayer),0,AliITSgeomTGeo::GetNDetectors(iLayer));
148 hOccupancyLadder[fSSDhRaws]->GetXaxis()->SetTitleColor(1);
149 hOccupancyLadder[fSSDhRaws]->GetXaxis()->SetTitle("Module number");
150 hOccupancyLadder[fSSDhRaws]->GetYaxis()->SetTitle("Occupancy [%]");
151 hOccupancyLadder[fSSDhRaws]->SetMarkerStyle(kFullCircle);
152 fAliITSQADataMakerRec->Add2RawsList(hOccupancyLadder[fSSDhRaws], fRawsOffset + fSSDhRaws);
157 AliDebug(1,Form("%d SSD Raws histograms booked\n",fSSDhRaws));
158 AliInfo(Form("Number of histograms (SPD+SDD+SSD): %d\n",fRawsOffset+fSSDhRaws));
163 //____________________________________________________________________________
164 void AliITSQASSDDataMakerRec::MakeRaws(AliRawReader* rawReader) {
165 // Fill QA for RAW - SSD -
168 Int_t fLayer = 0,fLadder = 0, fModule = 0;
170 rawReader->Select("ITSSSD",-1,-1);
172 AliITSRawStreamSSD fSSDStream(rawReader);
173 while (fSSDStream.Next()) {
174 if(fSSDStream.GetModuleID() < 0) continue;
175 AliITSgeomTGeo::GetModuleId(fSSDStream.GetModuleID(),fLayer,fLadder,fModule);
176 fStripNumber = (fSSDStream.GetSideFlag() == 0) ? fSSDStream.GetStrip() : fSSDStream.GetStrip() + 768;
177 fHistPosition = (fLayer == 5) ? ((fLadder - 1)*22 + fModule - 1) : ((fLadder - 1)*25 + fModule + 748 - 1);
178 //AliInfo(Form("ModulePosition: %d - Layer: %d - Ladder: %d - Module: %d\n",fHistPosition,fLayer,fLadder,fModule));
179 fHistSSDRawSignalModule[fHistPosition]->Fill(fStripNumber,fSSDStream.GetSignal());
183 //____________________________________________________________________________
184 Double_t AliITSQASSDDataMakerRec::GetSSDOccupancyRaws(TH1 *lHisto) {
185 // bo: TDC >0 or # of sigmas wrt noise ?
186 Int_t lNumFiredBins = 0;
187 for(Int_t iBin = 1; iBin < lHisto->GetNbinsX(); iBin++){
188 if (lHisto->GetBinContent(iBin))
191 Double_t lOccupancy = (100.*lNumFiredBins)/lHisto->GetNbinsX(); // percentage
193 //AliInfo(Form("Fired strips: %d - Total strips: %d - Occupancy :%lf\n",lNumFiredBins,lHisto->GetNbinsX(),lOccupancy));
199 //____________________________________________________________________________
200 void AliITSQASSDDataMakerRec::InitRecPoints()
202 // Initialization for RECPOINTS - SSD -
203 fRecsOffset = (fAliITSQADataMakerRec->fRecPointsQAList)->GetEntries();
206 //fSSDhRecs must be incremented by one unit every time a histogram is ADDED to the QA List
208 AliDebug(1,Form("%d SSD Recs histograms booked\n",fSSDhRecs));
211 //____________________________________________________________________________
212 void AliITSQASSDDataMakerRec::MakeRecPoints(TTree * /*clustersTree*/)
214 // Fill QA for recpoints - SSD -