]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/macrosSDD/TrendQAtrainSDD.C
coverity fix + missing comma in previous commit
[u/mrichter/AliRoot.git] / ITS / macrosSDD / TrendQAtrainSDD.C
CommitLineData
341adf04 1#if !defined(__CINT__) || defined(__MAKECINT__)
2#include <TH1F.h>
3#include <TH2F.h>
4#include <TF1.h>
5#include <TPad.h>
6#include <TGraphErrors.h>
7#include <TROOT.h>
8#include <TFile.h>
9#include <TTree.h>
10#include <TGrid.h>
11#include <TGridResult.h>
12#include <TMath.h>
13#include <TSystem.h>
14#include <TNtuple.h>
15#include <TCanvas.h>
16#include <TStyle.h>
17#include <TLatex.h>
18#include <TLegend.h>
19#include <TLegendEntry.h>
20#include "AliITSgeomTGeo.h"
21#endif
22
23Double_t LangausFun(Double_t *x, Double_t *par);
24void MakePlots(TString ntupleFileName);
25
26
27void TrendQAtrainSDD(TString period,
28 TString recoPass,
193da5be 29 TString qaTrain="QA",
a4a8fc78 30 Bool_t useOnlyMerged=kFALSE,
31 TString runListFile="",
341adf04 32 Int_t firstRun=0,
33 Int_t lastRun=999999999,
34 TString fileName="QAresults.root"){
35
36 gStyle->SetOptStat(0);
37
38
39 TGrid::Connect("alien:");
40 Int_t year=0;
41 if(period.Contains("LHC09")) year=2009;
42 else if(period.Contains("LHC10")) year=2010;
4d8feb56 43 else if(period.Contains("LHC11")) year=2011;
341adf04 44
a4a8fc78 45 Bool_t useExternalList=kFALSE;
46 Int_t runList[10000];
47 Int_t totRuns=0;
48 if(runListFile.Length()>0){
49 if(!gSystem->Exec(Form("ls -l %s > /dev/null 2>&1",runListFile.Data()))){
50 printf("Use Run List from %s --- runs to be analyzed:\n",runListFile.Data());
51 useExternalList=kTRUE;
52 FILE* rfil=fopen(runListFile.Data(),"r");
53 Int_t nrun;
54 while(!feof(rfil)){
55 fscanf(rfil,"%d, ",&nrun);
56 if(feof(rfil)) break;
57 runList[totRuns++]=nrun;
58 }
59 for(Int_t ir=0; ir<totRuns; ir++){
60 printf("%d\n",runList[ir]);
61 }
62 }else{
63 printf("File with run list does not exist\n");
64 }
65 }
66
193da5be 67 TString outFilNam=Form("TrendingSDD_%s_%s_%s.root",period.Data(),recoPass.Data(),qaTrain.Data());
341adf04 68
69
a4a8fc78 70
fe916a11 71 const Int_t nVariables=35;
72 TNtuple* ntsdd=new TNtuple("ntsdd","SDD trending","nrun:fracTrackWithClu1:errfracTrackWithClu1:fracTrackWithClu2:errfracTrackWithClu2:fracTrackWithClu3:errfracTrackWithClu3:fracTrackWithClu4:errfracTrackWithClu4:fracTrackWithClu5:errfracTrackWithClu5:fracTrackWithClu6:errfracTrackWithClu6:meanTrPts3:errmeanTrPts3:meanTrPts4:errmeanTrPts4:minDrTime:errminDrTime:meanDrTime:errmeanDrTime:fracExtra:errfracExtra:meandEdxLay3:errmeandEdxLay3:meandEdxLay4:errmeandEdxLay4:meandEdxTB0:errmeandEdxTB0:meandEdxTB5:errmeandEdxTB5:nMod95:nMod80:nMod60:nModEmpty");
341adf04 73 Float_t xnt[nVariables];
74
75 TBits* readRun=new TBits(999999);
76 readRun->ResetAllBits();
a4a8fc78 77 if(!useExternalList){
78 if(!gSystem->Exec(Form("ls -l %s > /dev/null 2>&1",outFilNam.Data()))){
79 TFile* oldfil=new TFile(outFilNam.Data());
80 TNtuple* ntmp=(TNtuple*)oldfil->Get("ntsdd");
81 Bool_t isOK=kFALSE;
82 if(ntmp){
83 if(ntmp->GetNvar()==ntsdd->GetNvar()){
84 isOK=kTRUE;
85 TObjArray* arr1=(TObjArray*)ntsdd->GetListOfBranches();
86 TObjArray* arr2=(TObjArray*)ntmp->GetListOfBranches();
87 for(Int_t iV=0; iV<ntmp->GetNvar(); iV++){
88 TString vnam1=arr1->At(iV)->GetName();
89 TString vnam2=arr2->At(iV)->GetName();
90 if(vnam1!=vnam2) isOK=kFALSE;
91 ntmp->SetBranchAddress(vnam2.Data(),&xnt[iV]);
92 }
93 if(isOK){
94 for(Int_t nE=0; nE<ntmp->GetEntries(); nE++){
95 ntmp->GetEvent(nE);
96 Int_t theRun=(Int_t)(xnt[0]+0.0001);
97 readRun->SetBitNumber(theRun);
98 ntsdd->Fill(xnt);
99 }
341adf04 100 }
101 }
102 }
a4a8fc78 103 if(!isOK){
104 printf("Ntuple in local file not OK -> will be recreated\n");
105 }
106 oldfil->Close();
107 delete oldfil;
341adf04 108 }
341adf04 109 }
110
111 if(!gGrid||!gGrid->IsConnected()) {
112 printf("gGrid not found! exit macro\n");
113 return;
114 }
115
193da5be 116 TString path=Form("/alice/data/%d/%s/",year,period.Data());
341adf04 117 TGridResult *gr = gGrid->Query(path,fileName);
118 Int_t nFiles = gr->GetEntries();
119 printf("================>%d files found\n", nFiles);
120 if (nFiles < 1) return;
121
a4a8fc78 122 Int_t nAnalyzedFiles=0;
341adf04 123 if (nFiles > 1){
124 for (Int_t iFil = 0; iFil <nFiles ; iFil++) {
125 TString fileNameLong=Form("%s",gr->GetKey(iFil,"turl"));
126 if(!fileNameLong.Contains(recoPass.Data())) continue;
193da5be 127 if(!fileNameLong.Contains(qaTrain.Data())) continue;
341adf04 128 TString runNumber=fileNameLong;
129 runNumber.ReplaceAll(Form("alien:///alice/data/%d/%s/",year,period.Data()),"");
130 runNumber.Remove(9,runNumber.Sizeof());
131
132 Int_t iRun=atoi(runNumber.Data());
a4a8fc78 133 if(useExternalList){
134 Bool_t keepRun=kFALSE;
135 for(Int_t ir=0; ir<totRuns; ir++){
136 if(iRun==runList[ir]){
137 keepRun=kTRUE;
138 break;
139 }
140 }
141 if(!keepRun) continue;
142 }
341adf04 143 if(readRun->TestBitNumber(iRun)){
144 printf("Run %d aleady in local ntuple -> skipping it\n",iRun);
145 continue;
146 }
147 if(iRun<firstRun) continue;
a4a8fc78 148 if(iRun>lastRun) continue;
341adf04 149
a4a8fc78 150 if(useOnlyMerged){
151 TString isMerged=fileNameLong;
152 isMerged.Remove(isMerged.Sizeof()-16);
153 isMerged.Remove(0,isMerged.Sizeof()-5);
154 if(!isMerged.Contains("QA")) continue;
155 }
193da5be 156 printf("Open File %s Run %d\n",fileNameLong.Data(),iRun);
a4a8fc78 157
193da5be 158
159
341adf04 160 TFile* f=TFile::Open(fileNameLong.Data());
161
162 TDirectoryFile* df=(TDirectoryFile*)f->Get("SDD_Performance");
163 if(!df){
164 printf("Run %d SDD_Performance MISSING -> Exit\n",iRun);
165 continue;
166 }
167 TList* l=(TList*)df->Get("coutputRP");
168 if(!df){
169 printf("Run %d coutputRP TList MISSING -> Exit\n",iRun);
170 continue;
e1a5dc0a 171 }
a4a8fc78 172
173 nAnalyzedFiles++;
174 if(!useOnlyMerged) readRun->SetBitNumber(iRun);
175
e1a5dc0a 176 TH1F* hcllay=(TH1F*)l->FindObject("hCluInLay");
177 Float_t fracT[6]={0.,0.,0.,0.,0.,0.};
178 Float_t efracT[6]={0.,0.,0.,0.,0.,0.};
179 if(hcllay->GetBinContent(1)>0){
180 for(Int_t iLay=0; iLay<6; iLay++){
181 fracT[iLay]=hcllay->GetBinContent(iLay+2)/hcllay->GetBinContent(1);
182 efracT[iLay]=TMath::Sqrt(fracT[iLay]*(1-fracT[iLay])/hcllay->GetBinContent(1));
183 }
341adf04 184 }
185 TH1F* hmodT=(TH1F*)l->FindObject("hTPMod");
186 TH1F* hgamod=(TH1F*)l->FindObject("hGAMod");
187 Int_t bestMod=0;
188 for(Int_t iMod=0; iMod<260;iMod++){
189 Int_t gda=(Int_t)hgamod->GetBinContent(iMod+1);
190 if(gda>bestMod) bestMod=gda;
191 }
192 Int_t nChunks=1;
193 if(bestMod>512){
194 nChunks=(Int_t)(bestMod/512.+0.5);
195 }
196 hgamod->Scale(1./nChunks);
197
198 TH1F* hev=(TH1F*)l->FindObject("hNEvents");
199 Int_t nTotEvents=hev->GetBinContent(2);
200 Int_t nTrigEvents=hev->GetBinContent(3);
201 Int_t nEvents=nTotEvents;
202 printf("Run %d Number of Events = %d Triggered=%d\n",iRun,nTotEvents,nTrigEvents);
203 if(nTrigEvents>0){
204 nEvents=nTrigEvents;
205 }
193da5be 206 if(nTotEvents==0) continue;
341adf04 207 Int_t nModGood3=0;
208 Int_t nModGood4=0;
209 Int_t nModBadAn=0;
210 Float_t sumtp3=0;
211 Float_t sumtp4=0;
212 Float_t sumEtp3=0;
213 Float_t sumEtp4=0;
214 for(Int_t iMod=0; iMod<260; iMod++){
215 Float_t tps=hmodT->GetBinContent(iMod+1);
216 Float_t ga=hgamod->GetBinContent(iMod+1);
217 if(ga<500) nModBadAn++;
218 Float_t tpsN=0.;
219 Float_t etpsN=0.;
220 if(ga>0){
221 tpsN=tps/ga/(Float_t)nEvents;
222 etpsN=TMath::Sqrt(tps)/ga/(Float_t)nEvents;
223 if(iMod<84){
224 sumtp3+=tpsN;
225 sumEtp3+=(etpsN*etpsN);
226 nModGood3++;
227 }
228 else{
229 sumtp4+=tpsN;
230 sumEtp4+=(etpsN*etpsN);
231 nModGood4++;
232 }
233 }
234 }
235
193da5be 236 TH1F* hapmod=(TH1F*)l->FindObject("hAllPmod");
237 TH1F* hgpmod=(TH1F*)l->FindObject("hGoodPmod");
238 // TH1F* hmpmod=(TH1F*)l->FindObject("hMissPmod");
239 TH1F* hbrmod=(TH1F*)l->FindObject("hBadRegmod");
240 TH1F* hskmod=(TH1F*)l->FindObject("hSkippedmod");
241 TH1F* hoamod=(TH1F*)l->FindObject("hOutAccmod");
242 TH1F* hnrmod=(TH1F*)l->FindObject("hNoRefitmod");
243 Int_t nBelow95=0;
244 Int_t nBelow80=0;
245 Int_t nBelow60=0;
246 Int_t nZeroP=0;
247 for(Int_t imod=0; imod<260;imod++){
248 Float_t numer=hgpmod->GetBinContent(imod+1)+hbrmod->GetBinContent(imod+1)+hoamod->GetBinContent(imod+1)+hnrmod->GetBinContent(imod+1)+hskmod->GetBinContent(imod+1);
249 Float_t denom=hapmod->GetBinContent(imod+1);
250 if(denom>0){
251 Float_t eff=numer/denom;
252 if(eff<0.95) nBelow95++;
253 if(eff<0.80) nBelow80++;
254 if(eff<0.60) nBelow60++;
255 }
256 if(hmodT->GetBinContent(imod+1)<1.){
257 nZeroP++;
258 }
259 }
260
341adf04 261 TH1F* htimT=(TH1F*)l->FindObject("hDrTimTPAll");
262 TH1F* htimTe=(TH1F*)l->FindObject("hDrTimTPExtra");
263
264 Double_t fracExtra=0.;
265 Double_t errFracExtra=0.;
266 if(htimT->GetEntries()>0){
267 fracExtra=htimTe->GetEntries()/htimT->GetEntries();
268 errFracExtra=TMath::Sqrt(htimTe->GetEntries())/htimT->GetEntries();
269 }
270 Double_t averPoints=0.;
271 Double_t cntBins=0.;
272 for(Int_t iBin=1; iBin<=htimT->GetNbinsX(); iBin++){
273 Float_t tim=htimT->GetBinCenter(iBin);
274 if(tim>2000. && tim<4000.){
275 averPoints+=htimT->GetBinContent(iBin);
276 cntBins+=1;
277 }
278 }
279 Double_t minTime=-999.;
280 Double_t errMinTime=0.;
281 if(cntBins>0){
282 averPoints/=cntBins;
283 for(Int_t iBin=1; iBin<=htimT->GetNbinsX(); iBin++){
284 if(htimT->GetBinContent(iBin)>0.5*averPoints){
285 minTime=htimT->GetBinCenter(iBin);
286 errMinTime=0.5*htimT->GetBinWidth(iBin);
287 break;
288 }
289 }
290 }
fe916a11 291 TH2F* hdedxmod=(TH2F*)l->FindObject("hdEdxVsMod");
292 TH1D* hdedxLay3=hdedxmod->ProjectionY("hdedxLay3",1,84);
293 TH1D* hdedxLay4=hdedxmod->ProjectionY("hdedxLay4",85,260);
294
341adf04 295 TH1F* hSigTim0=(TH1F*)l->FindObject("hSigTimeInt0");
296 TH1F* hSigTim5=(TH1F*)l->FindObject("hSigTimeInt5");
297
e1a5dc0a 298 Int_t index=0;
299 xnt[index++]=(Float_t)iRun;
300 xnt[index++]=fracT[0];
301 xnt[index++]=efracT[0];
302 xnt[index++]=fracT[1];
303 xnt[index++]=efracT[1];
304 xnt[index++]=fracT[2];
305 xnt[index++]=efracT[2];
306 xnt[index++]=fracT[3];
307 xnt[index++]=efracT[3];
308 xnt[index++]=fracT[4];
309 xnt[index++]=efracT[4];
310 xnt[index++]=fracT[5];
311 xnt[index++]=efracT[5];
312 xnt[index++]=sumtp3/nModGood3;
313 xnt[index++]=TMath::Sqrt(sumEtp3)/nModGood3;
314 xnt[index++]=sumtp4/nModGood4;
315 xnt[index++]=TMath::Sqrt(sumEtp4)/nModGood4;
316 xnt[index++]=minTime;
317 xnt[index++]=errMinTime;
318 xnt[index++]=htimT->GetMean();
319 xnt[index++]=htimT->GetMeanError();
320 xnt[index++]=fracExtra;
321 xnt[index++]=errFracExtra;
fe916a11 322 xnt[index++]=hdedxLay3->GetMean();
323 xnt[index++]=hdedxLay3->GetMeanError();
324 xnt[index++]=hdedxLay4->GetMean();
325 xnt[index++]=hdedxLay4->GetMeanError();
e1a5dc0a 326 xnt[index++]=hSigTim0->GetMean();
327 xnt[index++]=hSigTim0->GetMeanError();
328 xnt[index++]=hSigTim5->GetMean();
329 xnt[index++]=hSigTim5->GetMeanError();
193da5be 330 xnt[index++]=(Float_t)nBelow95;
331 xnt[index++]=(Float_t)nBelow80;
332 xnt[index++]=(Float_t)nBelow60;
333 xnt[index++]=(Float_t)nZeroP;
341adf04 334 ntsdd->Fill(xnt);
335 }
336 }
a4a8fc78 337 printf("Number of analyzed files = %d\n",nAnalyzedFiles);
338
339 if(nAnalyzedFiles>0){
340 TFile* outfil=new TFile(outFilNam.Data(),"recreate");
341 outfil->cd();
342 ntsdd->Write();
343 outfil->Close();
344
345 MakePlots(outFilNam);
346 }
341adf04 347}
348
349void MakePlots(TString ntupleFileName){
350 TFile* fil=new TFile(ntupleFileName.Data(),"read");
351 if(!fil){
352 printf("File with ntuple does not exist\n");
353 return;
354 }
355 TNtuple* ntsdd=(TNtuple*)fil->Get("ntsdd");
356
357 Float_t nrun;
358 Float_t meanTrPts3,errmeanTrPts3,meanTrPts4,errmeanTrPts4;
359 Float_t minDrTime,errminDrTime,meanDrTime,errmeanDrTime;
e1a5dc0a 360 Float_t fracTrackWithClu1,fracTrackWithClu2,errfracTrackWithClu1,errfracTrackWithClu2;
361 Float_t fracTrackWithClu3,fracTrackWithClu4,errfracTrackWithClu3,errfracTrackWithClu4;
362 Float_t fracTrackWithClu5,fracTrackWithClu6,errfracTrackWithClu5,errfracTrackWithClu6;
341adf04 363 Float_t fracExtra,errfracExtra;
fe916a11 364 Float_t meandEdxLay3,errmeandEdxLay3,meandEdxLay4,errmeandEdxLay4;
341adf04 365 Float_t meandEdxTB0,errmeandEdxTB0,meandEdxTB5,errmeandEdxTB5;
193da5be 366 Float_t nMod95,nMod80,nMod60,nModEmpty;
367
341adf04 368 ntsdd->SetBranchAddress("nrun",&nrun);
e1a5dc0a 369 ntsdd->SetBranchAddress("fracTrackWithClu1",&fracTrackWithClu1);
370 ntsdd->SetBranchAddress("errfracTrackWithClu1",&errfracTrackWithClu1);
371 ntsdd->SetBranchAddress("fracTrackWithClu2",&fracTrackWithClu2);
372 ntsdd->SetBranchAddress("errfracTrackWithClu2",&errfracTrackWithClu2);
373 ntsdd->SetBranchAddress("fracTrackWithClu3",&fracTrackWithClu3);
374 ntsdd->SetBranchAddress("errfracTrackWithClu3",&errfracTrackWithClu3);
375 ntsdd->SetBranchAddress("fracTrackWithClu4",&fracTrackWithClu4);
376 ntsdd->SetBranchAddress("errfracTrackWithClu4",&errfracTrackWithClu4);
377 ntsdd->SetBranchAddress("fracTrackWithClu5",&fracTrackWithClu5);
378 ntsdd->SetBranchAddress("errfracTrackWithClu5",&errfracTrackWithClu5);
379 ntsdd->SetBranchAddress("fracTrackWithClu6",&fracTrackWithClu6);
380 ntsdd->SetBranchAddress("errfracTrackWithClu6",&errfracTrackWithClu6);
193da5be 381 ntsdd->SetBranchAddress("nMod95",&nMod95);
382 ntsdd->SetBranchAddress("nMod80",&nMod80);
383 ntsdd->SetBranchAddress("nMod60",&nMod60);
384 ntsdd->SetBranchAddress("nModEmpty",&nModEmpty);
e1a5dc0a 385
341adf04 386 ntsdd->SetBranchAddress("meanTrPts3",&meanTrPts3);
387 ntsdd->SetBranchAddress("errmeanTrPts3",&errmeanTrPts3);
388 ntsdd->SetBranchAddress("meanTrPts4",&meanTrPts4);
389 ntsdd->SetBranchAddress("errmeanTrPts4",&errmeanTrPts4);
390 ntsdd->SetBranchAddress("minDrTime",&minDrTime);
391 ntsdd->SetBranchAddress("errminDrTime",&errminDrTime);
392 ntsdd->SetBranchAddress("meanDrTime",&meanDrTime);
393 ntsdd->SetBranchAddress("errmeanDrTime",&errmeanDrTime);
394 ntsdd->SetBranchAddress("fracExtra",&fracExtra);
395 ntsdd->SetBranchAddress("errfracExtra",&errfracExtra);
396 ntsdd->SetBranchAddress("meandEdxTB0",&meandEdxTB0);
397 ntsdd->SetBranchAddress("errmeandEdxTB0",&errmeandEdxTB0);
398 ntsdd->SetBranchAddress("meandEdxTB5",&meandEdxTB5);
399 ntsdd->SetBranchAddress("errmeandEdxTB5",&errmeandEdxTB5);
fe916a11 400 ntsdd->SetBranchAddress("meandEdxLay3",&meandEdxLay3);
401 ntsdd->SetBranchAddress("errmeandEdxLay3",&errmeandEdxLay3);
402 ntsdd->SetBranchAddress("meandEdxLay4",&meandEdxLay4);
403 ntsdd->SetBranchAddress("errmeandEdxLay4",&errmeandEdxLay4);
341adf04 404
405 TH1F* histotrp3=new TH1F("histotrp3","",(Int_t)ntsdd->GetEntries(),0.,ntsdd->GetEntries());
406 TH1F* histotrp4=new TH1F("histotrp4","",(Int_t)ntsdd->GetEntries(),0.,ntsdd->GetEntries());
407 TH1F* histominTime=new TH1F("histominTime","",(Int_t)ntsdd->GetEntries(),0.,ntsdd->GetEntries());
408 TH1F* histomeanTime=new TH1F("histomeanTime","",(Int_t)ntsdd->GetEntries(),0.,ntsdd->GetEntries());
409 TH1F* histofracExtra=new TH1F("histofracExtra","",(Int_t)ntsdd->GetEntries(),0.,ntsdd->GetEntries());
410 TH1F* histodEdxTB0=new TH1F("histodEdxTB0","",(Int_t)ntsdd->GetEntries(),0.,ntsdd->GetEntries());
411 TH1F* histodEdxTB5=new TH1F("histodEdxTB5","",(Int_t)ntsdd->GetEntries(),0.,ntsdd->GetEntries());
fe916a11 412 TH1F* histodEdxLay3=new TH1F("histodEdxLay3","",(Int_t)ntsdd->GetEntries(),0.,ntsdd->GetEntries());
413 TH1F* histodEdxLay4=new TH1F("histodEdxLay4","",(Int_t)ntsdd->GetEntries(),0.,ntsdd->GetEntries());
e1a5dc0a 414 TH1F* histoTrackClu1=new TH1F("histoTrackClu1","",(Int_t)ntsdd->GetEntries(),0.,ntsdd->GetEntries());
415 TH1F* histoTrackClu2=new TH1F("histoTrackClu2","",(Int_t)ntsdd->GetEntries(),0.,ntsdd->GetEntries());
416 TH1F* histoTrackClu3=new TH1F("histoTrackClu3","",(Int_t)ntsdd->GetEntries(),0.,ntsdd->GetEntries());
417 TH1F* histoTrackClu4=new TH1F("histoTrackClu4","",(Int_t)ntsdd->GetEntries(),0.,ntsdd->GetEntries());
418 TH1F* histoTrackClu5=new TH1F("histoTrackClu5","",(Int_t)ntsdd->GetEntries(),0.,ntsdd->GetEntries());
419 TH1F* histoTrackClu6=new TH1F("histoTrackClu6","",(Int_t)ntsdd->GetEntries(),0.,ntsdd->GetEntries());
420
193da5be 421 TH1F* histoNmodEffBelow95=new TH1F("histoNmodEffBelow95","",(Int_t)ntsdd->GetEntries(),0.,ntsdd->GetEntries());
422 TH1F* histoNmodEffBelow80=new TH1F("histoNmodEffBelow80","",(Int_t)ntsdd->GetEntries(),0.,ntsdd->GetEntries());
423 TH1F* histoNmodEffBelow60=new TH1F("histoNmodEffBelow60","",(Int_t)ntsdd->GetEntries(),0.,ntsdd->GetEntries());
424 TH1F* histoNmodEmpty=new TH1F("histoNmodEmpty","",(Int_t)ntsdd->GetEntries(),0.,ntsdd->GetEntries());
341adf04 425
426 for(Int_t i=0; i<ntsdd->GetEntries();i++){
427 ntsdd->GetEvent(i);
e1a5dc0a 428 histoTrackClu1->SetBinContent(i+1,fracTrackWithClu1);
429 histoTrackClu1->SetBinError(i+1,errfracTrackWithClu1);
430 histoTrackClu1->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrun));
431 histoTrackClu2->SetBinContent(i+1,fracTrackWithClu2);
432 histoTrackClu2->SetBinError(i+1,errfracTrackWithClu2);
433 histoTrackClu2->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrun));
434 histoTrackClu3->SetBinContent(i+1,fracTrackWithClu3);
435 histoTrackClu3->SetBinError(i+1,errfracTrackWithClu3);
436 histoTrackClu3->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrun));
437 histoTrackClu4->SetBinContent(i+1,fracTrackWithClu4);
438 histoTrackClu4->SetBinError(i+1,errfracTrackWithClu4);
439 histoTrackClu4->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrun));
440 histoTrackClu5->SetBinContent(i+1,fracTrackWithClu5);
441 histoTrackClu5->SetBinError(i+1,errfracTrackWithClu5);
442 histoTrackClu5->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrun));
443 histoTrackClu6->SetBinContent(i+1,fracTrackWithClu6);
444 histoTrackClu6->SetBinError(i+1,errfracTrackWithClu6);
445 histoTrackClu6->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrun));
341adf04 446 histominTime->SetBinContent(i+1,minDrTime);
447 histominTime->SetBinError(i+1,errminDrTime);
448 histominTime->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrun));
449 histomeanTime->SetBinContent(i+1,meanDrTime);
450 histomeanTime->SetBinError(i+1,errmeanDrTime);
451 histomeanTime->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrun));
452 histotrp3->SetBinContent(i+1,meanTrPts3);
453 histotrp3->SetBinError(i+1,errmeanTrPts3);
454 histotrp3->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrun));
455 histotrp4->SetBinContent(i+1,meanTrPts4);
456 histotrp4->SetBinError(i+1,errmeanTrPts3);
457 histotrp4->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrun));
458 histofracExtra->SetBinContent(i+1,fracExtra);
459 histofracExtra->SetBinError(i+1,errfracExtra);
460 histofracExtra->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrun));
461 histodEdxTB0->SetBinContent(i+1,meandEdxTB0);
462 histodEdxTB0->SetBinError(i+1,errmeandEdxTB0);
463 histodEdxTB0->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrun));
464 histodEdxTB5->SetBinContent(i+1,meandEdxTB5);
465 histodEdxTB5->SetBinError(i+1,errmeandEdxTB5);
466 histodEdxTB5->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrun));
fe916a11 467 histodEdxLay3->SetBinContent(i+1,meandEdxLay3);
468 histodEdxLay3->SetBinError(i+1,errmeandEdxLay3);
469 histodEdxLay3->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrun));
470 histodEdxLay4->SetBinContent(i+1,meandEdxLay4);
471 histodEdxLay4->SetBinError(i+1,errmeandEdxLay4);
472 histodEdxLay4->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrun));
193da5be 473
474 histoNmodEffBelow95->SetBinContent(i+1,nMod95);
a4a8fc78 475 histoNmodEffBelow95->SetBinError(i+1,0.0000001);
193da5be 476 histoNmodEffBelow95->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrun));
477 histoNmodEffBelow80->SetBinContent(i+1,nMod80);
a4a8fc78 478 histoNmodEffBelow80->SetBinError(i+1,0.0000001);
193da5be 479 histoNmodEffBelow80->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrun));
480 histoNmodEffBelow60->SetBinContent(i+1,nMod60);
a4a8fc78 481 histoNmodEffBelow60->SetBinError(i+1,0.0000001);
193da5be 482 histoNmodEffBelow60->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrun));
483 histoNmodEmpty->SetBinContent(i+1,nModEmpty);
a4a8fc78 484 histoNmodEmpty->SetBinError(i+1,0.000001);
193da5be 485 histoNmodEmpty->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrun));
341adf04 486 }
487
488 gStyle->SetOptStat(0);
489
490
491 TCanvas* c1=new TCanvas("c1","Occupancy");
492 histotrp3->SetLineColor(1);
493 histotrp3->SetMarkerStyle(20);
494 histotrp3->Draw();
495 histotrp3->SetMinimum(0.);
496 histotrp4->SetLineColor(2);
497 histotrp4->SetMarkerColor(2);
498 histotrp4->SetMarkerStyle(22);
499 histotrp4->Draw("same");
500 histotrp3->GetYaxis()->SetTitle("Track Point Occupancy");
501 TLegend* leg=new TLegend(0.7,0.15,0.88,0.35);
502 TLegendEntry* ent=leg->AddEntry(histotrp3,"Layer3","PL");
503 ent=leg->AddEntry(histotrp4,"Layer4","PL");
504 ent->SetTextColor(histotrp4->GetMarkerColor());
505 leg->SetFillStyle(0);
506 leg->Draw();
507 c1->Update();
508
509 TCanvas* c2=new TCanvas("c2","DriftTime",600,900);
510 c2->Divide(1,2);
511 c2->cd(1);
512 histominTime->Draw();
513 histominTime->SetMinimum(250);
514 histominTime->SetMaximum(1000);
515 histominTime->GetYaxis()->SetTitle("Minimum Drift Time (ns)");
516 c2->cd(2);
517 histomeanTime->Draw();
518 histomeanTime->GetYaxis()->SetTitle("Average Drift Time (ns)");
519 c2->Update();
520
521 TCanvas* c3=new TCanvas("c3","ExtraClusters");
522 histofracExtra->Draw();
523 histofracExtra->GetYaxis()->SetTitle("Fraction of Extra Clusters");
524 c3->Update();
525
526
527 TCanvas* c4=new TCanvas("c4","Charge");
528 histodEdxTB0->SetLineColor(1);
529 histodEdxTB0->SetMarkerStyle(20);
530 histodEdxTB0->Draw();
531 histodEdxTB0->SetMinimum(0.);
532 histodEdxTB5->SetLineColor(4);
533 histodEdxTB5->SetMarkerColor(4);
534 histodEdxTB5->SetMarkerStyle(23);
535 histodEdxTB5->Draw("same");
e1a5dc0a 536 histodEdxTB0->GetYaxis()->SetTitle("<dE/dx> (keV/300 #mum)");
341adf04 537 TLegend* leg2=new TLegend(0.6,0.15,0.88,0.35);
538 ent=leg2->AddEntry(histodEdxTB0,"Small drift time","PL");
539 ent=leg2->AddEntry(histodEdxTB5,"Large drift time","PL");
540 ent->SetTextColor(histodEdxTB5->GetMarkerColor());
541 leg2->SetFillStyle(0);
542 leg2->Draw();
543 c4->Update();
544
fe916a11 545 TCanvas* c4b=new TCanvas("c4b","Charge per Layer");
546 histodEdxLay3->SetLineColor(1);
547 histodEdxLay3->SetMarkerStyle(20);
548 histodEdxLay3->Draw();
549 histodEdxLay3->SetMinimum(0.);
550 histodEdxLay4->SetLineColor(4);
551 histodEdxLay4->SetMarkerColor(4);
552 histodEdxLay4->SetMarkerStyle(23);
553 histodEdxLay4->Draw("same");
554 histodEdxLay3->GetYaxis()->SetTitle("<dE/dx> (keV/300 #mum)");
555 TLegend* leg2b=new TLegend(0.6,0.15,0.88,0.35);
556 ent=leg2b->AddEntry(histodEdxLay3,"Layer 3","PL");
557 ent=leg2b->AddEntry(histodEdxLay4,"Layer 4","PL");
558 ent->SetTextColor(histodEdxLay4->GetMarkerColor());
559 leg2b->SetFillStyle(0);
560 leg2b->Draw();
561 c4b->Update();
562
e1a5dc0a 563 TCanvas* c5=new TCanvas("c5","TrackWithSDD");
564 histoTrackClu3->Draw();
565 histoTrackClu3->SetLineColor(1);
566 histoTrackClu3->SetMarkerStyle(20);
567 histoTrackClu3->Draw();
568 histoTrackClu3->SetMinimum(0.);
569 histoTrackClu4->SetLineColor(2);
570 histoTrackClu4->SetMarkerColor(2);
571 histoTrackClu4->SetMarkerStyle(22);
572 histoTrackClu4->Draw("same");
573 histoTrackClu1->SetLineColor(kGray+1);
574 histoTrackClu1->SetMarkerColor(kGray+1);
575 histoTrackClu1->SetMarkerStyle(24);
576 histoTrackClu1->Draw("same");
577 histoTrackClu2->SetLineColor(kGray+2);
578 histoTrackClu2->SetMarkerColor(kGray+2);
579 histoTrackClu2->SetMarkerStyle(26);
580 histoTrackClu2->Draw("same");
581 histoTrackClu5->SetLineColor(4);
582 histoTrackClu5->SetMarkerColor(4);
583 histoTrackClu5->SetMarkerStyle(29);
584 histoTrackClu5->Draw("same");
585 histoTrackClu6->SetLineColor(kBlue+1);
586 histoTrackClu6->SetMarkerColor(kBlue+1);
587 histoTrackClu6->SetMarkerStyle(30);
588 histoTrackClu6->Draw("same");
589 histoTrackClu3->GetYaxis()->SetTitle("Fraction of Tracks with Point in SDD Layers");
590 TLegend* leg3=new TLegend(0.7,0.15,0.88,0.35);
591 ent=leg3->AddEntry(histoTrackClu1,"Layer1","PL");
592 ent->SetTextColor(histoTrackClu1->GetMarkerColor());
593 ent=leg3->AddEntry(histoTrackClu2,"Layer2","PL");
594 ent->SetTextColor(histoTrackClu2->GetMarkerColor());
595 ent=leg3->AddEntry(histoTrackClu3,"Layer3","PL");
596 ent->SetTextColor(histoTrackClu3->GetMarkerColor());
597 ent=leg3->AddEntry(histoTrackClu4,"Layer4","PL");
598 ent->SetTextColor(histoTrackClu4->GetMarkerColor());
599 ent=leg3->AddEntry(histoTrackClu5,"Layer5","PL");
600 ent->SetTextColor(histoTrackClu5->GetMarkerColor());
601 ent=leg3->AddEntry(histoTrackClu6,"Layer6","PL");
602 ent->SetTextColor(histoTrackClu6->GetMarkerColor());
603
604 leg3->SetFillStyle(0);
605 leg3->Draw();
606 c5->Update();
341adf04 607
193da5be 608 TCanvas* c6=new TCanvas("c6","Modules with low eff",800,1000);
609 c6->Divide(1,4);
610 c6->cd(1);
a4a8fc78 611 histoNmodEffBelow95->SetMinimum(histoNmodEffBelow95->GetMinimum()-2);
612 histoNmodEffBelow95->SetMaximum(histoNmodEffBelow95->GetMaximum()+2);
193da5be 613 histoNmodEffBelow95->Draw("E");
a4a8fc78 614 histoNmodEffBelow95->GetYaxis()->SetTitle("N. modules with eff<0.95");
615 histoNmodEffBelow95->GetYaxis()->SetTitleSize(0.075);
616 histoNmodEffBelow95->GetYaxis()->SetTitleOffset(0.5);
193da5be 617 c6->cd(2);
a4a8fc78 618 histoNmodEffBelow80->SetMinimum(histoNmodEffBelow80->GetMinimum()-2);
619 histoNmodEffBelow80->SetMaximum(histoNmodEffBelow80->GetMaximum()+2);
193da5be 620 histoNmodEffBelow80->Draw("E");
a4a8fc78 621 histoNmodEffBelow80->GetYaxis()->SetTitle("N. modules with eff<0.80");
622 histoNmodEffBelow80->GetYaxis()->SetTitleSize(0.075);
623 histoNmodEffBelow80->GetYaxis()->SetTitleOffset(0.5);
193da5be 624 c6->cd(3);
a4a8fc78 625 histoNmodEffBelow60->SetMinimum(histoNmodEffBelow60->GetMinimum()-2);
626 histoNmodEffBelow60->SetMaximum(histoNmodEffBelow60->GetMaximum()+2);
193da5be 627 histoNmodEffBelow60->Draw("E");
a4a8fc78 628 histoNmodEffBelow60->GetYaxis()->SetTitle("N. modules with eff<0.60");
629 histoNmodEffBelow60->GetYaxis()->SetTitleSize(0.075);
630 histoNmodEffBelow60->GetYaxis()->SetTitleOffset(0.5);
193da5be 631 c6->cd(4);
a4a8fc78 632 histoNmodEmpty->SetMinimum(histoNmodEmpty->GetMinimum()-2);
633 histoNmodEmpty->SetMaximum(histoNmodEmpty->GetMaximum()+2);
193da5be 634 histoNmodEmpty->Draw("E");
a4a8fc78 635 histoNmodEmpty->GetYaxis()->SetTitle("N. modules with no points");
636 histoNmodEmpty->GetYaxis()->SetTitleSize(0.075);
637 histoNmodEmpty->GetYaxis()->SetTitleOffset(0.5);
638
193da5be 639
341adf04 640}
641
642Double_t LangausFun(Double_t *x, Double_t *par) {
643
644 //Fit parameters:
645 //par[0]=Width (scale) parameter of Landau density
646 //par[1]=Most Probable (MP, location) parameter of Landau density
647 //par[2]=Total area (integral -inf to inf, normalization constant)
648 //par[3]=Width (sigma) of convoluted Gaussian function
649 //
650 //In the Landau distribution (represented by the CERNLIB approximation),
651 //the maximum is located at x=-0.22278298 with the location parameter=0.
652 //This shift is corrected within this function, so that the actual
653 //maximum is identical to the MP parameter.
654
655 // Numeric constants
656 Double_t invsq2pi = 0.3989422804014; // (2 pi)^(-1/2)
657 Double_t mpshift = -0.22278298; // Landau maximum location
658
659 // Control constants
660 Double_t np = 100.0; // number of convolution steps
661 Double_t sc = 5.0; // convolution extends to +-sc Gaussian sigmas
662
663 // Variables
664 Double_t xx;
665 Double_t mpc;
666 Double_t fland;
667 Double_t sum = 0.0;
668 Double_t xlow,xupp;
669 Double_t step;
670 Double_t i;
671
672
673 // MP shift correction
674 mpc = par[1] - mpshift * par[0];
675
676 // Range of convolution integral
677 xlow = x[0] - sc * par[3];
678 xupp = x[0] + sc * par[3];
679
680 step = (xupp-xlow) / np;
681
682 // Convolution integral of Landau and Gaussian by sum
683 for(i=1.0; i<=np/2; i++) {
684 xx = xlow + (i-.5) * step;
685 fland = TMath::Landau(xx,mpc,par[0]) / par[0];
686 sum += fland * TMath::Gaus(x[0],xx,par[3]);
687
688 xx = xupp - (i-.5) * step;
689 fland = TMath::Landau(xx,mpc,par[0]) / par[0];
690 sum += fland * TMath::Gaus(x[0],xx,par[3]);
691 }
692
693 return (par[2] * step * sum * invsq2pi / par[3]);
694}