1 /////////////////////////////////////////
2 // Class for SDD digits preprocessing //
5 ////////////////////////////////////////
9 #include "AliITSPreprocessorSDD.h"
10 #include "AliITSCalibrationSDD.h"
11 #include "AliShuttleInterface.h"
12 #include "AliCDBMetaData.h"
13 #include "TObjArray.h"
15 #include <TObjString.h>
19 const Int_t AliITSPreprocessorSDD::fgkNumberOfSDD = 260;
20 const Int_t AliITSPreprocessorSDD::fgkNumberOfChannels = 512;
21 const Int_t AliITSPreprocessorSDD::fgkNumberOfChannelsPerChip = 64;
22 const TString AliITSPreprocessorSDD::fgkNameHistoPedestals = "hpedestal";
23 const TString AliITSPreprocessorSDD::fgkNameHistoNoise = "hnoise";
24 ClassImp(AliITSPreprocessorSDD)
27 UInt_t AliITSPreprocessorSDD::Process(TMap*/* dcsAliasMap*/){
31 TObjArray respSDD(fgkNumberOfSDD);
32 respSDD.SetOwner(kFALSE);
33 Float_t baseline,rawnoise,cmn,gain;
34 Int_t isgoodan,i,im,is,isgoodmod;
35 Int_t numOfBadChannels[fgkNumberOfSDD];
36 //TString pwd = gSystem->pwd();
37 // const Char_t* tempDir=AliShuttleInterface::GetShuttleTempDir();
39 TList* sourceList = GetFileSources(kDAQ, "SDD_Calib");
41 Log("Error: no sources found for SDD_Calib");
46 while (sourceList->At(ind)!=NULL) {
47 TObjString* tarId = (TObjString*) sourceList->At(ind);
48 TString tarName = GetFile(kDAQ, "SDD_Calib", tarId->GetString().Data());
49 // gSystem->cd(tempDir);
51 sprintf(command,"tar -xf %s",tarName.Data());
52 gSystem->Exec(command);
58 for(Int_t imod=0;imod<fgkNumberOfSDD;imod++){
59 AliITSCalibrationSDD *cal = new AliITSCalibrationSDD("simulated");
60 numOfBadChannels[imod]=0;
61 Int_t badch[fgkNumberOfChannels];
62 for(Int_t isid=0;isid<=1;isid++){
63 Char_t basFileName[100];
64 // sprintf(basFileName,"%s/SDDbase_mod%03d_sid%d.data",tempDir,imod,isid);
65 sprintf(basFileName,"./SDDbase_mod%03d_sid%d.data",imod,isid);
66 FILE* basFil = fopen(basFileName,"read");
68 Log(Form("File %s not found.",basFileName));
71 fscanf(basFil,"%d %d %d\n",&im,&is,&isgoodmod);
72 if(!isgoodmod) cal->SetDead();
73 for(Int_t ian=0;ian<(fgkNumberOfChannels/2);ian++){
74 fscanf(basFil,"%d %d %f %f %f %f\n",&i,&isgoodan,&baseline,&rawnoise,&cmn,&gain);
78 Int_t ibad=numOfBadChannels[imod];
79 numOfBadChannels[imod]++;
82 cal->SetBaseline(ich,baseline);
83 cal->SetNoiseAfterElectronics(ich,rawnoise);
84 Int_t iChip=ian/fgkNumberOfChannelsPerChip;
85 Int_t iChInChip=ian%fgkNumberOfChannelsPerChip;
86 cal->SetGain(gain,isid,iChip,iChInChip);
88 cal->SetDeadChannels(numOfBadChannels[imod]);
89 for(Int_t ibad=0;ibad<numOfBadChannels[imod];ibad++){
90 cal->SetBadChannel(ibad,badch[ibad]);
97 AliCDBMetaData *md1= new AliCDBMetaData(); // metaData describing the object
98 md1->SetObjectClassName("AliITSCalibration");
99 md1->SetResponsible("Elisabetta Crescio, Francesco Prino");
100 md1->SetBeamPeriod(0);
101 md1->SetAliRootVersion("head 5 April 2007"); //root version
102 md1->SetComment("This is a test");
104 Bool_t retcode = Store("Calib","CalibSDD",&respSDD,md1, 0, kTRUE);
106 if(retcode) return 0;