]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - T0/AliT0CalibTimeEq.cxx
Incremented ClassDef
[u/mrichter/AliRoot.git] / T0 / AliT0CalibTimeEq.cxx
index 6ea38be691f41d9d9a29cc1aa10f8dea9056a34d..472c8c3fd7ae9deede70dde211467119eeb7f81b 100644 (file)
@@ -193,7 +193,7 @@ Bool_t AliT0CalibTimeEq::ComputeOnlineParams(const char* filePhys)
          
          if(cfdtime) {
            nent = Int_t(cfdtime->GetEntries());
-           if( nent<=50 ) {
+           if( nent<=50  ) {
              oktime++;
              if(oktime<4) {
                meancfdtime = 0;
@@ -246,21 +246,17 @@ Int_t AliT0CalibTimeEq::ComputeOfflineParams(const char* filePhys, Float_t *time
   //ok means
   // 1000  - can not open file 
   // for timediff
-  // 1-24  no histograms with time diff for more than okdiff channenls
-  // 100 >3 histos are empty
-  // - 1 if less 3 channels are empty ;for these channels OCDB value will be written back WARNING
-  // -2  low statistics in few channels; for these channels OCDB value will be written back WARNING
+  // 20 >3 histos are empty
+  // -11  low statistics oe empty histos in few channels; for these channels OCDB value will be written back WARNING
   // for cfd
-  // 200 >3 histos are empty 
-  // -11 if less 3 channels are empty ;for these channels OCDB value will be written back WARNING
-  // -22  low statistics in few channels; for these channels OCDB value will be written back WARNING
+  // 20 >2 histos are empty or with low statistic 
+  // -11 if less 3 channels are empty or low statistics in few channels ;for these channels OCDB value will be written back WARNING
    //
   // compute offline equalized time
   Float_t meandiff, sigmadiff, meanver, meancfdtime, sigmacfdtime;
   meandiff = sigmadiff =  meanver = meancfdtime = sigmacfdtime =0;
   Int_t nent=0;
   Int_t ok = 0;
-  Int_t okdiff=0;
   Int_t okcfd=0;
   TH1F *cfddiff = NULL; 
   TH1F *cfdtime = NULL;
@@ -291,35 +287,23 @@ Int_t AliT0CalibTimeEq::ComputeOfflineParams(const char* filePhys, Float_t *time
                
              }
            if(!cfddiff ) {
-             AliWarning(Form("no  histograms collected by pass0 for diff channel %i", i));    
-             okdiff++;
-             if(okdiff<4) {
+             AliWarning(Form("no  histograms collected by pass0 for diff channel %i\n", i));    
                meandiff = timecdb[i];
                sigmadiff = 0;
-               ok = -1;
              }
-             else
-               return 100+okdiff; 
-           }
            if(cfddiff) {
              nent = Int_t(cfddiff->GetEntries());
-             if ( nent == 0) {
-               okdiff++;
-               if(okdiff<4) {
-                 meandiff = timecdb[i];
-                 sigmadiff = 0;
-                 ok = - 1;
-               }
-               else
-                 return 100; 
-             }       
-             if(nent<100 && nent>0) { //!!!!!
-               AliWarning(Form(" Not  enouph data in PMT %i- PMT1:  %i ", i, nent));
-               ok=-2;
+             if ( nent == 0  ) {
+               AliWarning(Form("no  entries in histogram for diff channel %i\n", i));
+               meandiff = timecdb[i];
+               sigmadiff = 0;
+             }
+             if(nent<=100 && nent>0) { //!!!!!
+               AliWarning(Form(" Not  enouph data in PMT %i- PMT1:  %i \n", i, nent));
                meandiff = timecdb[i];
                sigmadiff = 0; 
              }
-             if(nent>100 )  { //!!!!!
+             if(nent>=100 )  { //!!!!!
                {
                  if(cfddiff->GetRMS()>1.5 )
                    GetMeanAndSigma(cfddiff, meandiff, sigmadiff);
@@ -338,13 +322,13 @@ Int_t AliT0CalibTimeEq::ComputeOfflineParams(const char* filePhys, Float_t *time
              AliWarning(Form("no  histograms collected by pass0 for time channel %i", i));
              meancfdtime = cfdvalue[i];
              okcfd++;
-             if(okcfd<4) {
+             if(okcfd<2) {
                meancfdtime = cfdvalue[i];
-               ok = -11;
+               //      ok = -11;
              }
              else {
                AliError(Form("no  histograms collected by pass0 for time %i channels ", okcfd));
-               return 200
+               return 20; 
              }
            }
            if(cfdtime) {
@@ -353,42 +337,34 @@ Int_t AliT0CalibTimeEq::ComputeOfflineParams(const char* filePhys, Float_t *time
                  (cfdtime->GetRMS() == 0 || cfdtime->GetMean() ==0 ) ) 
                {
                  okcfd++;
-                 if(okcfd<4) {
+                 if(okcfd<2) {
                    meancfdtime = cfdvalue[i];
-                   ok = -11;
+                   //   ok = -11;
                    printf("!!!!bad data:: pmt %i nent%i RMS %f mean %f cdbtime %f \n",
-                          i, nent, cfdtime->GetRMS(), cfdtime->GetMean(),  fCFDvalue[i][0]);
+                          i, nent, cfdtime->GetRMS(), cfdtime->GetMean(), cfdvalue[i] );
                  }
                  else
                    {
                    printf("!!!!fatal data:: pmt %i nent%i RMS %f mean %f cdbtime %f \n",
-                          i, nent, cfdtime->GetRMS(), cfdtime->GetMean(),  fCFDvalue[i][0]);
+                          i, nent, cfdtime->GetRMS(), cfdtime->GetMean(), cfdvalue[i]);
                      AliError(Form(" histograms collected by pass0 for time %i channels are empty", okcfd));
-                     return 200
+                     return 20; 
                    }
                }
              
                  
-             if(nent<100 && nent>0 ) 
+             if(nent<=100 && nent>0 ) 
                {
+                 okcfd++;
                AliWarning(Form(" Not  enouph data in PMT in CFD peak %i - %i ", i, nent));
-               if(okcfd<4) {
                  meancfdtime = cfdvalue[i];
-                 ok = -22;
+                 ok = -11;
                  printf("!!!!low statstics:: pmt %i nent%i RMS %f mean %f cdbtime %f \n",
-                        i, nent, cfdtime->GetRMS(), cfdtime->GetMean(),  fCFDvalue[i][0]);
-               }
-               else {
-                 printf("!!!!low fatal statstics:: pmt %i nent%i RMS %f mean %f cdbtime %f \n",
-                        i, nent, cfdtime->GetRMS(), cfdtime->GetMean(),  fCFDvalue[i][0]);
-
-                 AliError(Form(" Not  enouph data in PMT in CFD peak %i in channels ", okcfd));
-                 return 200; 
+                        i, nent, cfdtime->GetRMS(), cfdtime->GetMean(),  cfdvalue[i]);
+                 if (okcfd>3) return ok;
                }
-
-             }
-
-             if( nent>100 && cfdtime->GetRMS() != 0 )    { //!!!!!
+                     
+             if( nent>100 )    { //!!!!!
                if(cfdtime->GetRMS()>1.5 )
                  GetMeanAndSigma(cfdtime,meancfdtime, sigmacfdtime);
                if(cfdtime->GetRMS()<=1.5) 
@@ -405,7 +381,6 @@ Int_t AliT0CalibTimeEq::ComputeOfflineParams(const char* filePhys, Float_t *time
          SetTimeEq(i,meandiff);
          SetTimeEqRms(i,sigmadiff);
          SetCFDvalue(i,0, meancfdtime );
-         printf(" pmt %i diff %f sigma %f meancfdtime %f cdbtime %f \n",i, meandiff, sigmadiff, meancfdtime, fCFDvalue[i][0]);
          if (cfddiff) cfddiff->Reset();
          if (cfdtime) cfdtime->Reset();
          } //bad pmt
@@ -419,17 +394,16 @@ Int_t AliT0CalibTimeEq::ComputeOfflineParams(const char* filePhys, Float_t *time
 //________________________________________________________________________
 void AliT0CalibTimeEq::GetMeanAndSigma(TH1F* hist,  Float_t &mean, Float_t &sigma) {
   
-  const double window = 2.;  //fit window 
-  
+  const double window = 5.;  //fit window 
   double meanEstimate, sigmaEstimate; 
   int maxBin;
   maxBin        =  hist->GetMaximumBin(); //position of maximum
   meanEstimate  =  hist->GetBinCenter( maxBin); // mean of gaussian sitting in maximum
-  // sigmaEstimate = hist->GetRMS();
-  sigmaEstimate = 10;
+  sigmaEstimate = hist->GetRMS();
+  // sigmaEstimate = 10;
   TF1* fit= new TF1("fit","gaus", meanEstimate - window*sigmaEstimate, meanEstimate + window*sigmaEstimate);
   fit->SetParameters(hist->GetBinContent(maxBin), meanEstimate, sigmaEstimate);
-  hist->Fit("fit","RQ","Q");
+  hist->Fit("fit","QR","");
 
   mean  = (Float_t) fit->GetParameter(1);
   sigma = (Float_t) fit->GetParameter(2);