Updated DA for STANDALONE PEDESTAL runs
authorcoppedis <coppedis@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 29 Oct 2007 14:10:19 +0000 (14:10 +0000)
committercoppedis <coppedis@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 29 Oct 2007 14:10:19 +0000 (14:10 +0000)
ZDC/ShuttleInput/ZDCPedestal.dat
ZDC/ZDCPEDESTALda.cxx

index fe681c1..3e60027 100644 (file)
-       45.132812       5.766189
-       45.135452       5.662169
-       44.913033       5.849515
-       44.905277       5.786622
-       45.071224       5.543484
-       45.386356       5.520172
-       44.929104       5.817072
-       44.698971       5.678022
-       44.759506       5.980745
-       44.849907       6.018976
-       44.994316       5.875839
-       44.827244       5.969393
-       45.333221       5.604369
-       45.134087       5.648774
-       45.280083       5.666244
-       44.704197       6.021643
-       45.132019       6.030529
-       44.803539       5.825709
-       45.365986       5.655310
-       44.851715       5.894962
-       44.811962       5.818978
-       45.381470       5.695756
-       45.094231       5.676695
-       45.147823       6.003564
-       45.078827       5.800217
-       44.960789       5.775755
-       45.212994       5.362228
-       45.102711       5.820637
-       44.781628       5.592899
-       44.955612       5.873568
-       44.887062       5.943244
-       44.897476       5.761615
-       45.121723       5.817735
-       44.938171       5.831093
-       45.115410       5.788922
-       44.933704       5.748758
-       45.079521       5.358689
-       44.848301       5.800110
-       45.196354       5.759348
-       44.923550       5.809791
-       44.613476       5.877631
-       45.002983       5.790298
-       45.451435       5.910458
-       44.973522       5.211273
-       44.973522       5.211273
-       44.972755       5.888991
-       44.890083       6.013584
-       45.057091       5.728656
-       45.046303       5.609530
-       45.426323       5.709914
-       45.274021       5.764467
-       44.793682       5.493269
-       44.761047       5.530224
-       44.731770       5.828598
-       44.937840       5.739856
-       44.743492       5.657593
-       45.034756       5.774047
-       44.893845       5.935648
-       44.735733       5.994502
-       45.092125       5.844385
-       45.011360       5.779874
-       44.795834       5.672181
-       44.829510       5.522740
-       45.381618       5.773271
-       44.806137       5.661977
-       44.888168       5.843299
-       45.183029       5.983595
-       44.895020       5.765083
-       44.795506       5.713246
-       44.759258       5.530138
-       45.260319       5.758560
-       44.479137       5.478314
-       45.131092       5.592466
-       44.817116       5.747859
-       45.286587       5.829423
-       45.152931       5.728951
-       44.886364       5.584428
-       44.850517       5.613142
-       45.052460       5.589007
-       45.044796       5.803877
-       45.196220       5.865307
-       44.779930       5.662357
-       45.270725       5.729533
-       45.206097       5.707493
-       44.782413       5.583951
-       45.119411       5.975426
-       44.697517       5.912110
-       45.078972       5.983951
-       43.131374       0.023930
-       48.181328       -0.072210
-       48.348923       -0.061683
-       49.900921       -0.153357
-       42.964039       0.028748
-       43.240929       0.005515
-       42.300369       0.051524
-       46.179123       -0.056040
-       40.568909       0.110408
-       44.618927       0.012597
-       47.622765       -0.064223
-       47.693287       -0.064620
-       44.266483       0.001369
-       45.662281       -0.030670
-       46.062584       -0.022018
-       46.555058       -0.018181
-       38.610371       0.152333
-       38.932877       0.174136
-       44.961842       -0.009635
-       44.398602       0.008783
-       45.344875       -0.046912
-       47.573334       -0.054860
-       46.921375       -0.037012
-       39.852158       0.115747
-       46.140938       -0.033655
-       47.947979       -0.080883
-       53.939507       -0.177331
-       39.133629       0.142796
-       42.549995       0.041462
-       44.396317       0.015988
-       43.081383       0.026034
-       42.886997       0.026943
-       44.382881       0.017208
-       50.080097       -0.140029
-       43.704170       0.006351
-       46.981400       -0.054966
-       46.784271       -0.023670
-       44.283859       0.014435
-       47.397114       -0.078884
-       50.480583       -0.102977
-       45.543476       -0.008535
-       53.897869       -0.217158
-       41.160458       0.104061
-       109.321701      -64.413795
+       40.550945       2.901434
+       39.891003       2.537993
+       39.751377       2.590283
+       39.988964       2.621609
+       40.282436       2.619541
+       40.069134       2.653781
+       40.612656       2.766482
+       40.675274       3.221864
+       39.793232       2.577159
+       39.257137       3.093107
+       39.315228       2.778001
+       39.862682       2.794434
+       40.651279       2.945156
+       40.740047       2.951243
+       40.229401       2.576813
+       39.386337       2.805111
+       39.733128       2.601006
+       39.375443       3.006186
+       40.237926       2.576364
+       39.590702       2.632404
+       39.661022       2.618819
+       40.606823       2.938134
+       39.446434       2.720595
+       79.771469       3.951678
+       301.234344      30.624418
+       301.601074      27.211487
+       296.174194      35.368362
+       299.005768      27.694468
+       299.859619      26.104109
+       298.344757      25.668682
+       299.600067      33.364052
+       295.188843      30.994894
+       298.847046      25.869129
+       295.250427      27.212908
+       301.370697      28.656481
+       292.940521      28.422306
+       299.139984      26.322121
+       296.195526      27.380938
+       297.728210      27.702896
+       304.284302      29.724758
+       294.599579      29.424742
+       302.633118      33.632877
+       295.073425      30.216162
+       301.941895      29.797222
+       298.087463      25.903305
+       300.370880      32.866039
+       302.177216      31.052881
+       594.716675      42.957455
+       39.684650       4.150524
+       40.540417       3.022402
+       40.588856       2.759610
+       39.545654       2.982510
+       39.925163       2.571623
+       39.837997       2.549130
+       39.540390       2.901340
+       40.019302       2.480110
+       39.756596       2.578610
+       39.190510       3.003844
+       39.968163       2.678469
+       39.320484       3.158799
+       39.142452       2.839463
+       40.105373       2.470473
+       39.882866       2.554159
+       39.871582       2.559134
+       39.908005       2.554049
+       40.029427       2.618083
+       39.791603       2.545952
+       39.837494       2.643876
+       40.173382       2.705172
+       39.756706       2.535908
+       39.367496       2.956728
+       39.930103       2.493768
+       296.486176      28.552122
+       303.580383      28.086733
+       300.557892      28.773666
+       304.002716      26.581343
+       309.253174      30.384371
+       304.004517      27.039925
+       296.190338      26.599680
+       297.648956      28.538689
+       301.523804      28.893337
+       296.127838      29.147268
+       297.746429      26.284748
+       295.750977      26.599203
+       299.548248      30.442446
+       298.428223      29.670956
+       301.747375      29.860592
+       301.917389      28.243170
+       301.119202      29.805994
+       303.136169      30.566771
+       300.767914      27.029955
+       298.182861      30.320328
+       292.730560      28.865227
+       299.628052      30.374519
+       299.947723      29.632187
+       296.270538      30.832371
+       38.552925       0.036002
+       43.554165       -0.082561
+       38.446987       0.038476
+       37.304852       0.073850
+       30.668173       0.224890
+       44.931698       -0.116905
+       44.123894       -0.107573
+       39.766937       0.006092
+       39.249950       0.020086
+       40.450638       -0.010148
+       41.599365       -0.034845
+       33.674480       0.169782
+       39.813023       0.007119
+       41.320705       -0.029668
+       40.251461       -0.005968
+       47.973866       -0.187629
+       48.491081       -0.204604
+       36.714249       0.092550
+       31.912153       0.191564
+       34.117847       0.133050
+       39.166897       0.059446
+       42.519287       -0.059423
+       39.734341       0.009816
+       82.305695       -0.063331
+       306.899994      -0.023274
+       159.562653      0.417141
+       315.558014      -0.051218
+       304.025940      -0.010210
+       288.502991      0.035542
+       301.216095      -0.006481
+       322.395203      -0.073487
+       274.465118      0.083188
+       332.478546      -0.100717
+       303.793518      -0.015496
+       177.432922      0.386619
+       291.270630      0.022881
+       262.867310      0.125863
+       252.772919      0.165171
+       294.245361      0.021660
+       189.254227      0.342072
+       299.085815      -0.001005
+       332.177002      -0.098660
+       286.551941      0.044139
+       298.027435      0.010646
+       299.249939      0.002517
+       309.944855      -0.038470
+       261.456146      0.136299
+       564.773376      -0.002411
index 61e0ae5..c851879 100644 (file)
@@ -11,8 +11,15 @@ or End of Run event.
 
 Messages on stdout are exported to DAQ log system.
 
-DA for ZDC standalon pedestal runs
-contact: Chiara.Oppedisano@cern.ch
+DA for ZDC standalone pedestal runs
+Contact: Chiara.Oppedisano@to.infn.it
+Link: /afs/cern.ch/user/c/chiarao/public/RawPed.date
+Run Type: STANDALONE_PEDESTAL_RUN
+DA Type: MON
+Number of events needed: no constraint (tipically ~10^3)
+Input Files: 
+Output Files: ZDCPedestal.dat
+Trigger Types Used: Standalone Trigger
 
 */
 
@@ -45,41 +52,79 @@ int main(int argc, char **argv) {
 
   TH1F::AddDirectory(0);
   // --- Histograms for ADC pedestals 
-  //     [22 signal channels x 2 gain chains + 2 reference PTMs]
+  //     [22 signal channels + 2 reference PTMs]  x 2 gain chains
   //
-  TH1F *hPed[44], *hPedOutOfTime[44];
-  TH2F *hPedCorr[44];
+  int const kNChannels = 24;
+  TH1F *hPedhg[kNChannels], *hPedOutOfTimehg[kNChannels];
+  TH2F *hPedCorrhg[kNChannels];
+  TH1F *hPedlg[kNChannels], *hPedOutOfTimelg[kNChannels];
+  TH2F *hPedCorrlg[kNChannels];
   //
-  char namhist1[50], namhist2[50], namhist3[50];
-  for(Int_t j=0; j<44; j++){
-     if(j<10){
-       sprintf(namhist1,"PedZN1_%d",j);
-       sprintf(namhist2,"PedZN1OutOfTime_%d",j);
-       sprintf(namhist3,"PedCorrZN1_%d",j);
+  char namhist1hg[50], namhist2hg[50], namhist3hg[50];
+  char namhist1lg[50], namhist2lg[50], namhist3lg[50];
+  for(Int_t j=0; j<kNChannels; j++){
+     if(j<5){ // ZN1
+       sprintf(namhist1hg,"PedZN1hg_%d",j);
+       sprintf(namhist2hg,"PedZN1hgOutOfTime_%d",j);
+       sprintf(namhist3hg,"PedCorrZN1hg_%d",j);
+       //
+       sprintf(namhist1lg,"PedZN1lg_%d",j);
+       sprintf(namhist2lg,"PedZN1lgOutOfTime_%d",j);
+       sprintf(namhist3lg,"PedCorrZN1lg_%d",j);
+     }
+     else if(j>=5 && j<10){ // ZP1
+       sprintf(namhist1hg,"PedZP1hg_%d",j-5);
+       sprintf(namhist2hg,"PedZP1hgOutOfTime_%d",j-5);
+       sprintf(namhist3hg,"PedCorrZP1hg_%d",j-5);
+       //
+       sprintf(namhist1lg,"PedZP1lg_%d",j-5);
+       sprintf(namhist2lg,"PedZP1lgOutOfTime_%d",j-5);
+       sprintf(namhist3lg,"PedCorrZP1lg_%d",j-5);       
      }
-     else if(j>=10 && j<20){
-       sprintf(namhist1,"PedZP1_%d",j-10);
-       sprintf(namhist2,"PedZP1OutOfTime_%d",j-10);
-       sprintf(namhist3,"PedCorrZP1_%d",j-10);
+     else if(j>=10 && j<12){ // ZEM
+       sprintf(namhist1hg,"PedZEMhg_%d",j-10);
+       sprintf(namhist2hg,"PedZEMhgOutOfTime_%d",j-10);
+       sprintf(namhist3hg,"PedCorrZEMhg_%d",j-10);
+       //
+       sprintf(namhist1lg,"PedZEMlg_%d",j-10);
+       sprintf(namhist2lg,"PedZEMlgOutOfTime_%d",j-10);
+       sprintf(namhist3lg,"PedCorrZEMlg_%d",j-10);
      }
-     else if(j>=20 && j<24){
-       sprintf(namhist1,"PedZEM_%d",j-20);
-       sprintf(namhist2,"PedZEMOutOfTime_%d",j-20);
-       sprintf(namhist3,"PedCorrZEM_%d",j-20);
+     else if(j>=12 && j<17){ // ZN2
+       sprintf(namhist1hg,"PedZN2hg_%d",j-12);
+       sprintf(namhist2hg,"PedZN2hgOutOfTime_%d",j-12);
+       sprintf(namhist3hg,"PedCorrZN2hg_%d",j-12);
+       //
+       sprintf(namhist1lg,"PedZN2lg_%d",j-12);
+       sprintf(namhist2lg,"PedZN2lgOutOfTime_%d",j-12);
+       sprintf(namhist3lg,"PedCorrZN2lg_%d",j-12);
      }
-     else if(j>=24 && j<33){
-       sprintf(namhist1,"PedZN2_%d",j-24);
-       sprintf(namhist2,"PedZN2OutOfTime_%d",j-24);
-       sprintf(namhist3,"PedCorrZN2_%d",j-24);
+     else if(j>=17 && j<22){ // ZP2
+       sprintf(namhist1hg,"PedZP2hg_%d",j-17);
+       sprintf(namhist2hg,"PedZP2hgOutOfTime_%d",j-17);
+       sprintf(namhist3hg,"PedCorrZP2hg_%d",j-17);
+       //
+       sprintf(namhist1lg,"PedZP2lg_%d",j-17);
+       sprintf(namhist2lg,"PedZP2lgOutOfTime_%d",j-17);
+       sprintf(namhist3lg,"PedCorrZP2lg_%d",j-17);
      }
-     else if(j>=33 && j<43){
-       sprintf(namhist1,"PedZP2_%d",j-33);
-       sprintf(namhist2,"PedZP2OutOfTime_%d",j-33);
-       sprintf(namhist3,"PedCorrZP2_%d",j-33);
+     else if(j>=22 && j<24){ //Reference PMs
+       sprintf(namhist1hg,"PedRefhg_%d",j-22);
+       sprintf(namhist2hg,"PedRefhgOutOfTime_%d",j-22);
+       sprintf(namhist3hg,"PedCorrRefhg_%d",j-22);
+       //
+       sprintf(namhist1lg,"PedReflg_%d",j-22);
+       sprintf(namhist2lg,"PedReflgOutOfTime_%d",j-22);
+       sprintf(namhist3lg,"PedCorrReflg_%d",j-22);
      }
-     hPed[j] = new TH1F(namhist1, namhist1, 100,0., 200.);
-     hPedOutOfTime[j] = new TH1F(namhist2, namhist2, 100,0., 200.);
-     hPedCorr[j] = new TH2F(namhist3,namhist3,100,0.,200.,100,0.,200.);
+     // --- High gain chain histos
+     hPedhg[j] = new TH1F(namhist1hg, namhist1hg, 100,0., 200.);
+     hPedOutOfTimehg[j] = new TH1F(namhist2hg, namhist2hg, 100,0., 200.);
+     hPedCorrhg[j] = new TH2F(namhist3hg,namhist3hg,100,0.,200.,100,0.,200.);
+     // --- Low gain chain histos
+     hPedlg[j] = new TH1F(namhist1lg, namhist1lg, 100,0., 600.);
+     hPedOutOfTimelg[j] = new TH1F(namhist2lg, namhist2lg, 100,0., 600.);
+     hPedCorrlg[j] = new TH2F(namhist3lg,namhist3lg,100,0.,600.,100,0.,600.);
   }
 
   int status;
@@ -173,58 +218,78 @@ int main(int argc, char **argv) {
       AliRawReader *reader = new AliRawReaderDate((void*)event);
       const AliRawDataHeader* header = reader->GetDataHeader();
       if(header) {
-         UChar_t message = header->GetL1TriggerMessage();
-        if(message & 0x40000){ // DEDICATED PEDESTAL RUN
-           printf("\t L1 message -> PEDESTAL raw data\n");
+         UChar_t message = header->GetAttributes();
+        if(message & 0x2000000){ // DEDICATED PEDESTAL RUN
+           printf("\t STANDALONE_PEDESTAL_RUN raw data found\n");
            continue;
         }
         else{
-           printf("\t L1 message -> NO PEDESTAL raw data found\n");
+           printf("\t NO STANDALONE_PEDESTAL_RUN raw data found\n");
            return -1;
         }
       }
-      //Commented until we won't have Raw Data Header...
-      /*else{
+      //Commented until we won't have true Raw Data Header...
+      //else{
          //printf("\t ERROR! No Raw Data Header found!!!\n");
         //return -1;
-      }*/
       //
-    
+      //
       AliZDCRawStream *rawStreamZDC = new AliZDCRawStream(reader);
       //
       if (!rawStreamZDC->Next()) printf(" \t No raw data found!! \n");
       Int_t counter=0;
-      Int_t RawADC[44], RawADCoot[44];
-      for(Int_t j=0; j<44; j++){
-         RawADC[j]=0;
-         RawADCoot[j]=0;
+      Int_t RawADChg[kNChannels], RawADCoothg[kNChannels];
+      Int_t RawADClg[kNChannels], RawADCootlg[kNChannels];
+      for(Int_t j=0; j<kNChannels; j++){
+         RawADChg[j]=0; RawADCoothg[j]=0;
+         RawADClg[j]=0; RawADCootlg[j]=0;
       }
       while(rawStreamZDC->Next()){
         Int_t index=-1;
         if(rawStreamZDC->IsADCDataWord()){
-         if(rawStreamZDC->GetSector(0)==1 || rawStreamZDC->GetSector(0)==2){ // *** ZN1, ZP1
-           index = 10*(rawStreamZDC->GetSector(0)-1)+rawStreamZDC->GetSector(1)+5*rawStreamZDC->GetADCGain();
-         }
-         else if(rawStreamZDC->GetSector(0)==3){ // *** ZEM 
-           index = 10*(rawStreamZDC->GetSector(0)-1)+(rawStreamZDC->GetSector(1)-1)+2*rawStreamZDC->GetADCGain();
+         if(rawStreamZDC->GetSector(1)!=5){ // Physics signals
+           if(rawStreamZDC->GetSector(0)==1) index = rawStreamZDC->GetSector(1); // *** ZN1
+           else if(rawStreamZDC->GetSector(0)==2) index = rawStreamZDC->GetSector(1)+5; // *** ZP1
+           else if(rawStreamZDC->GetSector(0)==3) index = rawStreamZDC->GetSector(1)+9; // *** ZEM
+           else if(rawStreamZDC->GetSector(0)==4) index = rawStreamZDC->GetSector(1)+12; // *** ZN2
+           else if(rawStreamZDC->GetSector(0)==5) index = rawStreamZDC->GetSector(1)+17; // *** ZP2
          }
-         else if(rawStreamZDC->GetSector(0)==4 || rawStreamZDC->GetSector(0)==5){ // *** ZN2, ZP2
-           index = 10*(rawStreamZDC->GetSector(0)-2)+rawStreamZDC->GetSector(1)+5*rawStreamZDC->GetADCGain()+4;
+         else{ // Reference PMs
+           index = (rawStreamZDC->GetSector(0)-1)/3+22;
          }
-         if(counter<44){
-           hPed[index]->Fill(rawStreamZDC->GetADCValue()); 
-           RawADC[counter] = rawStreamZDC->GetADCValue();
+         //
+         /*printf("\t counter %d index %d det %d quad %d res %d ADC %d\n", counter, index,
+               rawStreamZDC->GetSector(0), rawStreamZDC->GetSector(1), 
+               rawStreamZDC->GetADCGain(), rawStreamZDC->GetADCValue());
+         */
+         //
+         if(counter<2*kNChannels){ // --- In-time pedestals (1st 48 raw data)
+           if(rawStreamZDC->GetADCGain()==0){ 
+             hPedhg[index]->Fill(rawStreamZDC->GetADCValue()); 
+             RawADChg[index] = rawStreamZDC->GetADCValue();
+           }
+           else{
+             hPedlg[index]->Fill(rawStreamZDC->GetADCValue()); 
+             RawADClg[index] = rawStreamZDC->GetADCValue();
+           }
          }
-         else{ 
-           hPedOutOfTime[index]->Fill(rawStreamZDC->GetADCValue());
-           RawADCoot[counter-44] = rawStreamZDC->GetADCValue();
+         else{  // --- Out-of-time pedestals
+           if(rawStreamZDC->GetADCGain()==0){
+             hPedOutOfTimehg[index]->Fill(rawStreamZDC->GetADCValue());
+             RawADCoothg[index] = rawStreamZDC->GetADCValue();
+           }
+           else{
+             hPedOutOfTimelg[index]->Fill(rawStreamZDC->GetADCValue());
+             RawADCootlg[index] = rawStreamZDC->GetADCValue();
+           }
          }
          counter++;
          }//IsADCDataWord()
         //
-        if(counter == 88){ // Last ADC channel
-           for(Int_t k=0; k<44; k++){
-              hPedCorr[k]->Fill(RawADCoot[k], RawADC[k]);
+        if(counter == 4*kNChannels){ // Last ADC channel -> Filling correlation histos
+           for(Int_t k=0; k<kNChannels; k++){
+           hPedCorrhg[k]->Fill(RawADCoothg[k], RawADChg[k]);
+           hPedCorrlg[k]->Fill(RawADCootlg[k], RawADClg[k]);
            }
         }
        }
@@ -251,47 +316,78 @@ int main(int argc, char **argv) {
   FILE *fileShuttle;
   fileShuttle = fopen("ZDCPedestal.dat","w");
   //
-  Float_t MeanPed[44], MeanPedWidth[44], 
-       MeanPedOOT[44], MeanPedWidthOOT[44],
-       CorrCoeff0[44], CorrCoeff1[44];
-  // --- Out-of-time pedestals
-  TF1 *ADCfunc[44];
-  for(Int_t i=0; i<44; i++){
-     hPed[i]->Fit("gaus","Q");
-     ADCfunc[i] = hPed[i]->GetFunction("gaus");
-     MeanPed[i] = ADCfunc[i]->GetParameter(1);
-     MeanPedWidth[i] = ADCfunc[i]->GetParameter(2);
+  Float_t MeanPed[2*kNChannels], MeanPedWidth[2*kNChannels], 
+       MeanPedOOT[2*kNChannels], MeanPedWidthOOT[2*kNChannels],
+       CorrCoeff0[2*kNChannels], CorrCoeff1[2*kNChannels];
+  // --- In-time pedestals
+  TF1 *ADCfunchg[kNChannels];
+  for(Int_t i=0; i<kNChannels; i++){
+     hPedhg[i]->Fit("gaus","Q");
+     ADCfunchg[i] = hPedhg[i]->GetFunction("gaus");
+     MeanPed[i] = ADCfunchg[i]->GetParameter(1);
+     MeanPedWidth[i] = ADCfunchg[i]->GetParameter(2);
      fprintf(fileShuttle,"\t%f\t%f\n",MeanPed[i],MeanPedWidth[i]);
-     //printf("\t MeanPed[%d] = %f\n",i, MeanPed[i]);
+     printf("\t MeanPed[%d] = %f\n",i, MeanPed[i]);
+  }
+  TF1 *ADCfunclg[kNChannels];
+  for(Int_t i=0; i<kNChannels; i++){
+     hPedlg[i]->Fit("gaus","Q");
+     ADCfunclg[i] = hPedlg[i]->GetFunction("gaus");
+     MeanPed[i+kNChannels] = ADCfunclg[i]->GetParameter(1);
+     MeanPedWidth[i+kNChannels] = ADCfunclg[i]->GetParameter(2);
+     fprintf(fileShuttle,"\t%f\t%f\n",MeanPed[i+kNChannels],MeanPedWidth[i+kNChannels]);
+     printf("\t MeanPed[%d] = %f\n",i+kNChannels, MeanPed[i+kNChannels]);
   }
   // --- Out-of-time pedestals
-  TF1 *ADCootfunc[44];
-  for(Int_t i=0; i<44; i++){
-     hPedOutOfTime[i]->Fit("gaus","Q");
-     ADCootfunc[i] = hPedOutOfTime[i]->GetFunction("gaus");
-     MeanPedOOT[i] = ADCootfunc[i]->GetParameter(1);
-     MeanPedWidthOOT[i] = ADCootfunc[i]->GetParameter(2);
+  TF1 *ADCootfunchg[kNChannels];
+  for(Int_t i=0; i<kNChannels; i++){
+     hPedOutOfTimehg[i]->Fit("gaus","Q");
+     ADCootfunchg[i] = hPedOutOfTimehg[i]->GetFunction("gaus");
+     MeanPedOOT[i] = ADCootfunchg[i]->GetParameter(1);
+     MeanPedWidthOOT[i] = ADCootfunchg[i]->GetParameter(2);
      fprintf(fileShuttle,"\t%f\t%f\n",MeanPedOOT[i],MeanPedWidthOOT[i]);
-     //printf("\t MeanPedOOT[%d] = %f\n",i, MeanPedOOT[i]);
+     printf("\t MeanPedOOT[%d] = %f\n",i, MeanPedOOT[i]);
+  }
+  TF1 *ADCootfunclg[kNChannels];
+  for(Int_t i=0; i<kNChannels; i++){
+     hPedOutOfTimelg[i]->Fit("gaus","Q");
+     ADCootfunclg[i] = hPedOutOfTimelg[i]->GetFunction("gaus");
+     MeanPedOOT[i+kNChannels] = ADCootfunclg[i]->GetParameter(1);
+     MeanPedWidthOOT[i+kNChannels] = ADCootfunclg[i]->GetParameter(2);
+     fprintf(fileShuttle,"\t%f\t%f\n",MeanPedOOT[i+kNChannels],MeanPedWidthOOT[i+kNChannels]);
+     printf("\t MeanPedOOT[%d] = %f\n",i+kNChannels, MeanPedOOT[i+kNChannels]);
   }
   //
-  // --- Fit of correlations
-  TProfile* hPedCorrProf[44];
-  TF1 *ffunc[44];
+  // --- Correlations
+  TProfile *hPedCorrProfhg[kNChannels], *hPedCorrProflg[kNChannels];
+  TF1 *ffunchg[kNChannels], *ffunclg[kNChannels];
   char namhist4[50];
-  for(int i=0;i<44;i++) {
-     sprintf(namhist4,"ADCvsOOT%d_Prof",i);
-     hPedCorrProf[i] = hPedCorr[i]->ProfileX(namhist4,-1,-1,"S");
-     hPedCorrProf[i]->SetName(namhist4);
-     hPedCorrProf[i]->Fit("pol1","Q");
-     ffunc[i] = hPedCorrProf[i]->GetFunction("pol1");
-     CorrCoeff0[i] = ffunc[i]->GetParameter(0);
-     CorrCoeff1[i] = ffunc[i]->GetParameter(1);
+  for(int i=0;i<kNChannels;i++) {
+     sprintf(namhist4,"ADCHRvsOOT%d_Prof",i);
+     hPedCorrProfhg[i] = hPedCorrhg[i]->ProfileX(namhist4,-1,-1,"S");
+     hPedCorrProfhg[i]->SetName(namhist4);
+     hPedCorrProfhg[i]->Fit("pol1","Q");
+     ffunchg[i] = hPedCorrProfhg[i]->GetFunction("pol1");
+     CorrCoeff0[i] = ffunchg[i]->GetParameter(0);
+     CorrCoeff1[i] = ffunchg[i]->GetParameter(1);
      fprintf(fileShuttle,"\t%f\t%f\n",CorrCoeff0[i],CorrCoeff1[i]);
-     //printf("\t CorrCoeff0[%d] = %f, CorrCoeff1[%d] = %f\n",i, CorrCoeff0[i], i, CorrCoeff1[i]);
+     printf("\t CorrCoeff0[%d] = %f, CorrCoeff1[%d] = %f\n",i, CorrCoeff0[i], i, CorrCoeff1[i]);
+  }    
+  for(int i=0;i<kNChannels;i++) {
+     sprintf(namhist4,"ADCLRvsOOT%d_Prof",i);
+     hPedCorrProflg[i] = hPedCorrlg[i]->ProfileX(namhist4,-1,-1,"S");
+     hPedCorrProflg[i]->SetName(namhist4);
+     hPedCorrProflg[i]->Fit("pol1","Q");
+     ffunclg[i] = hPedCorrProflg[i]->GetFunction("pol1");
+     CorrCoeff0[i+kNChannels] = ffunclg[i]->GetParameter(0);
+     CorrCoeff1[i+kNChannels] = ffunclg[i]->GetParameter(1);
+     fprintf(fileShuttle,"\t%f\t%f\n",CorrCoeff0[i+kNChannels],CorrCoeff1[i+kNChannels]);
+     printf("\t CorrCoeff0[%d] = %f, CorrCoeff1[%d] = %f\n",
+               i+kNChannels, CorrCoeff0[i+kNChannels], i+kNChannels, CorrCoeff1[i+kNChannels]);
   }    
   //                                                  
   fclose(fileShuttle);
+  //
   
 
   /* write report */