1 void CreatePulserRunHisto(Int_t iLDC=0){
3 // macro to create histogram as if from pulser data
5 AliTOFGeometry * geom = new AliTOFGeometry();
6 AliTOFDecoder * decoder = new AliTOFDecoder();
13 // simulating data from LDC reading DDL # iLDC*6+{0,1,2,3,4,5}
15 for (Int_t j=0;j<6;j++){
18 decoder->GetArrayDDL(array0,iDDL[0]);
19 cout << " DDL " << iDDL[0] << " done " << endl;
20 decoder->GetArrayDDL(array1,iDDL[1]);
21 cout << " DDL " << iDDL[1] << " done " << endl;
22 decoder->GetArrayDDL(array2,iDDL[2]);
23 cout << " DDL " << iDDL[2] << " done " << endl;
24 decoder->GetArrayDDL(array3,iDDL[3]);
25 cout << " DDL " << iDDL[3] << " done " << endl;
26 decoder->GetArrayDDL(array4,iDDL[4]);
27 cout << " DDL " << iDDL[4] << " done " << endl;
28 decoder->GetArrayDDL(array5,iDDL[5]);
29 cout << " DDL " << iDDL[5] << " done " << endl;
31 // debugging printings
32 for (Int_t i=0;i<2160;i++){
33 cout << " array0[" << i << "] = " << array0[i] << endl;
34 cout << " array2[" << i << "] = " << array2[i] << endl;
35 cout << " array4[" << i << "] = " << array4[i] << endl;
37 for (Int_t i=0;i<2208;i++){
38 cout << " array1[" << i << "] = " << array1[i] << endl;
39 cout << " array3[" << i << "] = " << array3[i] << endl;
40 cout << " array5[" << i << "] = " << array5[i] << endl;
43 static const Int_t size = AliTOFGeometry::NPadXSector()*AliTOFGeometry::NSectors();
44 cout << " size = " << size << endl;
45 TH1F::AddDirectory(0);
46 TH1S * htofPulser = new TH1S("hTOFpulser","histo with signals on TOF during pulser", size,-0.5,size-0.5);
47 for (Int_t ibin=1;ibin<=size;ibin++){
48 htofPulser->SetBinContent(ibin,-1);
51 for (Int_t i=0;i<2160;i++){
52 if (htofPulser->GetBinContent(array0[i]+1)<0) htofPulser->SetBinContent(array0[i]+1,10000);
53 if (htofPulser->GetBinContent(array2[i]+1)<0) htofPulser->SetBinContent(array2[i]+1,10000);
54 if (htofPulser->GetBinContent(array4[i]+1)<0) htofPulser->SetBinContent(array4[i]+1,10000);
57 for (Int_t i=0;i<2208;i++){
58 if (htofPulser->GetBinContent(array1[i]+1)<0) htofPulser->SetBinContent(array1[i]+1,10000);
59 if (htofPulser->GetBinContent(array3[i]+1)<0) htofPulser->SetBinContent(array3[i]+1,10000);
60 if (htofPulser->GetBinContent(array5[i]+1)<0) htofPulser->SetBinContent(array5[i]+1,10000);
64 Int_t idead[18]; // indexes of dead channels
65 Float_t ifloatdead[ndead]; // indexes of dead channels
66 TRandom *rnd = new TRandom(4357);
68 //cout << " time = " << ciccio.Get() << endl;
69 rnd->SetSeed(ciccio.Get());
70 rnd->RndmArray(ndead,ifloatdead);
72 for (Int_t i=0;i<ndead;i++){
73 Int_t index = Int_t(ifloatdead[i]*2160);
74 idead[i*3] = array0[index];
75 idead[i*3+1] = array2[index];
76 idead[i*3+2] = array4[index];
77 cout << " channels " << idead[i*3] << ", " << idead[i*3+1] << ", " << idead[i*3+2] << ", " << " will be skipped " << endl;
80 for (Int_t i=0;i<ndead;i++){
81 Int_t index = Int_t(ifloatdead[i]*2208);
82 idead[i*3+9] = array1[index];
83 idead[i*3+9+1] = array3[index];
84 idead[i*3+9+2] = array5[index];
85 cout << " channels " << idead[i*3+9] << ", " << idead[i*3+9+1] << ", " << idead[i*3+9+2] << ", " << " will be skipped " << endl;
88 for (Int_t i=0;i<ndead*6;i++){
89 cout << " idead[" << i << "] = " << idead[i] << endl;
92 Bool_t tobeskipped=kFALSE;
93 for (Int_t i=0;i<size;i++){
95 for (Int_t j=0;j<ndead*6;j++){
98 cout << " skipping channel " << i << " with idead = " << idead[j] << endl;
102 if (tobeskipped && (htofPulser->GetBinContent(i+1)!=-1)) htofPulser->SetBinContent(i+1,0);
104 // cout << " filling channel " << i << endl;
105 // htofPulser->Fill(i,10000);
108 TCanvas *c = new TCanvas("c","c",-2,30,500,500);
111 sprintf(filename,"$ALICE_ROOT/TOF/ShuttleInput/TOFoutPulserLDC_%02i.root",iLDC);
112 TFile *fileout = new TFile(filename,"RECREATE");
113 htofPulser->Write("hTOFpulser");