Adding the AliAnalysisGUI class which is the main class that controls the GUI.
[u/mrichter/AliRoot.git] / ITS / AliITSPreprocessorSDD.cxx
CommitLineData
e56160b8 1/////////////////////////////////////////
2// Class for SDD digits preprocessing //
7537d03c 3// //
4// //
e56160b8 5////////////////////////////////////////
6
7#include "AliITSPreprocessorSDD.h"
8#include "AliITSCalibrationSDD.h"
9#include "AliShuttleInterface.h"
10#include "AliCDBMetaData.h"
11#include "TObjArray.h"
12#include "TH1F.h"
13#include "AliLog.h"
14#include "TFile.h"
15
16const Int_t AliITSPreprocessorSDD::fgkNumberOfSDD = 260;
17const Int_t AliITSPreprocessorSDD::fgkNumberOfChannels = 512;
7537d03c 18const TString AliITSPreprocessorSDD::fgkNameHistoPedestals = "hpedestal";
19const TString AliITSPreprocessorSDD::fgkNameHistoNoise = "hnoise";
e56160b8 20ClassImp(AliITSPreprocessorSDD)
21
22
23UInt_t AliITSPreprocessorSDD::Process(TMap*/* dcsAliasMap*/){
24
25 //preprocessing.
26
27 UInt_t result = 0;
28 const char* filename = GetFile(kDAQ,"PEDESTALS","GDC");
29 const char* filenamen= GetFile(kDAQ,"NOISE","GDC");
30 const char* filenamed= GetFile(kDAQ,"DEADCHANNELS","GDC");
31 TFile* f1 = TFile::Open(filename,"r");
32 TFile* f2 = TFile::Open(filenamen,"r");
33 Char_t namehisto[20];
34 Char_t namehisto2[20];
35
36 FILE* filed = fopen(filenamed,"read");
37 Int_t numOfBadChannels[fgkNumberOfSDD];
38 Int_t** badCh = new Int_t*[fgkNumberOfSDD];
39
40 Char_t row[50];
41 Int_t nSDD=0;
42 Char_t str[20];
43 char dims[1];
44 Int_t dim;
45 sprintf(str,"MODULE=%d",0);
46 while(!feof(filed)){
47 fscanf(filed,"%s\n",row);
48 if(strcmp(row,str)==0){
49 fscanf(filed,"%s %d\n",dims,&dim);
50 badCh[nSDD] = new Int_t[dim];
51 numOfBadChannels[nSDD]=dim;
52 for(Int_t ibad=0;ibad<dim;ibad++){
53 fscanf(filed,"%d\n",&badCh[nSDD][ibad]);
54 }
55 }
56 nSDD++;
57 sprintf(str,"MODULE=%d",nSDD);
58 }
59
60
61
62 AliCDBMetaData *md1= new AliCDBMetaData(); // metaData describing the object
63 md1->SetObjectClassName("AliITSCalibration");
64 md1->SetResponsible("Elisabetta Crescio");
65 md1->SetBeamPeriod(0);
66 md1->SetAliRootVersion("head September 2005"); //root version
67 md1->SetComment("This is a test");
68
69 TObjArray respSDD(260);
70 respSDD.SetOwner(kFALSE);
71
72 for(Int_t imod=0;imod<fgkNumberOfSDD;imod++){
73 AliITSCalibrationSDD *cal = new AliITSCalibrationSDD("simulated");
74 cal->SetDeadChannels(numOfBadChannels[imod]);
75 for(Int_t ich=0;ich<numOfBadChannels[imod];ich++){
76 cal->SetBadChannel(ich,badCh[imod][ich]);
77 }
7537d03c 78 sprintf(namehisto,"%s_%d",fgkNameHistoPedestals.Data(),imod);
79 sprintf(namehisto2,"%s_%d",fgkNameHistoNoise.Data(),imod);
e56160b8 80 TH1F* hbas = (TH1F*)f1->Get(namehisto);
81 TH1F* hnoi = (TH1F*)f2->Get(namehisto2);
82 for(Int_t ien=0;ien<fgkNumberOfChannels;ien++){
83 cal->SetBaseline(ien,hbas->GetBinContent(ien+1));
84 cal->SetNoiseAfterElectronics(ien,hnoi->GetBinContent(ien+1));
85 }
86 respSDD.Add(cal);
87 }
88
89 result = Store("Calib","Data",&respSDD,md1);
90
91 for(Int_t i=0;i<fgkNumberOfSDD;i++){
92 delete badCh[i];
93 }
94 delete [] badCh;
95 f1->Close();
96 f2->Close();
97 fclose(filed);
98 return result;
99
100}