correct calibration of short runs
[u/mrichter/AliRoot.git] / T0 / AliT0CalibLaserData.cxx
index 2e8c6b7..002aa0d 100644 (file)
@@ -51,6 +51,7 @@ AliT0CalibLaserData::AliT0CalibLaserData() : TObject(),
   
 {
 //
+for ( int i=0; i<30; i++ ) { fEntries[i] = NULL; fHistLimits[i] = 0.0;}
 }
 /*
 //________________________________________________________________
@@ -229,14 +230,12 @@ void AliT0CalibLaserData::ReadData()
   Int_t allData[110][50];
   Int_t numberOfHits[105];
   
-  Char_t  buf1[20], buf2[20], buf3[20], buf4[20], buf7[20];
-  
   Int_t channels[106];
   
   TString names[106], type;
-  AliT0LookUpKey* lookkey= new AliT0LookUpKey();
-  AliT0LookUpValue*  lookvalue= new AliT0LookUpValue();
-  AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
+  AliT0LookUpKey* lookkey;//= new AliT0LookUpKey();
+  AliT0LookUpValue*  lookvalue;//= new AliT0LookUpValue();
+  AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
   AliCDBManager::Instance()->SetRun(0);
   AliT0Parameters *fParam = AliT0Parameters::Instance();
   fParam->Init();
@@ -270,19 +269,14 @@ void AliT0CalibLaserData::ReadData()
     } 
   for(Int_t ic=0; ic<24; ic++) {
     {
-      sprintf(buf1,"QTC%i",ic+1);
-      sprintf(buf2,"CFDvsQTC%i",ic+1);
-      sprintf(buf3,"CFDvsLED%i",ic+1);
-      sprintf(buf4,"LEDminCFD%i",ic+1);
-      sprintf(buf7,"mpd%i",ic+1);
-      
-      hQTC[ic] = new TH1I(buf1,"QTC",(Int_t)fHistLimits[2],fHistLimits[0],fHistLimits[1]);
-      h1CFDminLED[ic] = new TH1I(buf4,"LED - CFD",(Int_t)fHistLimits[5],fHistLimits[3],fHistLimits[4]);
+     
+      hQTC[ic] = new TH1I(Form("QTC%i",ic+1),"QTC",(Int_t)fHistLimits[2],fHistLimits[0],fHistLimits[1]);
+      h1CFDminLED[ic] = new TH1I(Form("LEDminCFD%i",ic+1),"LED - CFD",(Int_t)fHistLimits[5],fHistLimits[3],fHistLimits[4]);
       
-      hCFDvsQTC[ic] = new TH2F(buf2,"CFD vs    QTC",
+      hCFDvsQTC[ic] = new TH2F(Form("CFDvsQTC%i",ic+1),"CFD vs QTC",
                               (Int_t)fHistLimits[8],fHistLimits[6],fHistLimits[7],
                               (Int_t)fHistLimits[11],fHistLimits[9],fHistLimits[10]);
-      hCFDvsLED[ic] = new TH2F(buf3,"CFD vs LED-CFD",
+      hCFDvsLED[ic] = new TH2F(Form("CFDvsLED%i",ic+1),"CFD vs LED-CFD",
                               (Int_t)fHistLimits[14],fHistLimits[12],fHistLimits[13],
                               (Int_t)fHistLimits[17],fHistLimits[15],fHistLimits[16]);
 
@@ -308,7 +302,7 @@ void AliT0CalibLaserData::ReadData()
   //  start->SetNumberOfTRM(1);
   for (Int_t i0=0; i0<105; i0++)
     {
-      for (Int_t j0=0; j0<50; j0++) allData[i0][j0]=0;         
+      for (Int_t j0=0; j0<5; j0++) allData[i0][j0]=0;  
       numberOfHits[i0]=0;
     }
   Int_t event=0;
@@ -316,7 +310,7 @@ void AliT0CalibLaserData::ReadData()
   while (reader->NextEvent()) {
     start->Next();
     for (Int_t i=0; i<105; i++) {
-      for (Int_t iHit=0; iHit<50; iHit++) 
+      for (Int_t iHit=0; iHit<5; iHit++) 
        {
          allData[i][iHit]= start->GetData(i,iHit);
          //      if( allData[i][iHit]>0)         cout<<i<<" "<<iHit<<" "<<allData[i][iHit]<<endl;
@@ -431,22 +425,22 @@ void AliT0CalibLaserData::ReadData()
        }
     }        
   
-
-  Char_t filehist[50]; 
+  
+  TString filehist = Form("t0tree%s",fFileName);; 
   // sprintf(filehist,"t0treeDA%s",fFileName);
-   sprintf(filehist,"t0tree%s",fFileName);
-  printf("\n Wrote data in %s !!\n",filehist);
-     TFile *hist = new TFile(filehist,"RECREATE");
-     hist->cd();
-     //  digitsTree->Write("",TObject::kOverwrite);
+  //  sprintf(filehist,"t0tree%s",fFileName);
+  printf("\n Wrote data in %s !!\n",filehist.Data());
+  TFile *hist = new TFile(filehist.Data(),"RECREATE");
+  hist->cd();
+  //  digitsTree->Write("",TObject::kOverwrite);
      
-     hEffCFD->Write();
-     hEffLED->Write();
-     hEffQT0->Write();
-      hEffQT1->Write();
-      
-      for(Int_t ik=0; ik<105; ik++)    hChannel[ik] ->Write();
-      
+  hEffCFD->Write();
+  hEffLED->Write();
+  hEffQT0->Write();
+  hEffQT1->Write();
+  
+  for(Int_t ik=0; ik<105; ik++)        hChannel[ik] ->Write();
+  
       for (Int_t i=0; i<24; i++)
        {
          hQTC[i]->Write();