for new CPass0 bug #84135
authoralla <alla@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 5 Sep 2011 10:49:13 +0000 (10:49 +0000)
committeralla <alla@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 5 Sep 2011 10:49:13 +0000 (10:49 +0000)
T0/AliT0CalibOffsetChannelsTask.cxx
T0/AliT0CalibOffsetChannelsTask.h
T0/AliT0CalibSeasonTimeShift.cxx
T0/AliT0CalibTimeEq.cxx
T0/AliT0PreprocessorOffline.cxx
T0/AliT0QADataMakerRec.cxx

index 99eefd2..f1d8412 100644 (file)
@@ -34,6 +34,9 @@ AliT0CalibOffsetChannelsTask::AliT0CalibOffsetChannelsTask()
   for( int ip=0; ip < 24; ip++){\r
     fTimeDiff[ip] = 0;\r
     fCFD[ip]      = 0;\r
+    fCDBdelays[ip]= 0;\r
+    fCDBcfds[ip]= 0;\r
+    fCDBT0s[ip]= 0;\r
   }\r
 \r
   // Define input and output slots here\r
@@ -47,13 +50,17 @@ AliT0CalibOffsetChannelsTask::AliT0CalibOffsetChannelsTask()
 AliT0CalibOffsetChannelsTask::AliT0CalibOffsetChannelsTask(const char *name) \r
   : AliAnalysisTaskSE(name), fESD(0), fTzeroObject(0),\r
   fTzeroORA(0x0), fTzeroORC(0x0), fResolution(0x0), fTzeroORAplusORC(0x0),\r
-  fRunNumber(0)\r
+    fRunNumber(0)\r
 {\r
   // Constructor\r
  \r
   for( int ip=0; ip < 24; ip++){\r
     fTimeDiff[ip] = 0;\r
     fCFD[ip]      = 0;\r
+    fCDBdelays[ip]= 0;\r
+    fCDBcfds[ip]= 0;\r
+    fCDBT0s[ip]= 0;\r
+\r
   }\r
  \r
   // Define input and output slots here\r
@@ -107,15 +114,15 @@ void AliT0CalibOffsetChannelsTask::UserCreateOutputObjects()
 {\r
   // Create histograms\r
   for (Int_t i=0; i<24; i++) {\r
-    fTimeDiff[i]   = new TH1F (Form("CFD1minCFD%d",i+1),"fTimeDiff",300, -300, 300);\r
-    fCFD[i]        = new TH1F(Form("CFD%d",i+1),"CFD",500, 2000, 3000);//6000, 7000);\r
-    // fCFD[i]        = new TH1F(Form("CFD%d",i+1),"CFD",500, -1000, 1000);//6000, 7000);\r
+    fTimeDiff[i]   = new TH1F (Form("CFD1minCFD%d",i+1),"fTimeDiff",150, -300, 300);\r
+    fCFD[i]        = new TH1F(Form("CFD%d",i+1),"CFD",250, 2000, 3000);//6000, 7000);\r
+    //    fCFD[i]        = new TH1F(Form("CFD%d",i+1),"CFD",250, -1000, 1000);//6000, 7000);\r
   }\r
 \r
-  fTzeroORAplusORC = new TH1F("fTzeroORAplusORC","ORA+ORC /2",400,-2000,2000);   //or A plus or C \r
-  fResolution      = new TH1F("fResolution","fResolution",400,-2000,2000);// or A minus or C spectrum\r
-  fTzeroORA        = new TH1F("fTzeroORA","fTzeroORA",400,-2000,2000);// or A spectrum\r
-  fTzeroORC        = new TH1F("fTzeroORC","fTzeroORC",400,-2000,2000);// or C spectrum\r
+  fTzeroORAplusORC = new TH1F("fTzeroORAplusORC","ORA+ORC /2",200,-2500,2500);   //or A plus or C \r
+  fResolution      = new TH1F("fResolution","fResolution",400,-2500,2500);// or A minus or C spectrum\r
+  fTzeroORA        = new TH1F("fTzeroORA","fTzeroORA",200,-2500,2500);// or A spectrum\r
+  fTzeroORC        = new TH1F("fTzeroORC","fTzeroORC",200,-2500,2500);// or C spectrum\r
 \r
   \r
   fTzeroObject     = new TObjArray(0);\r
@@ -152,29 +159,38 @@ void AliT0CalibOffsetChannelsTask::UserExec(Option_t *)
   fRunNumber =  fESD->GetRunNumber() ; \r
 \r
   const Double32_t* time = fESD->GetT0time();\r
+  const Double32_t* amp = fESD->GetT0amplitude();\r
+  Double32_t diff;\r
   for (Int_t i=0; i<12; i++) {\r
-    if( time[i] != 0 ){\r
-      fCFD[i]->Fill( time[i]);\r
-      if(  time[0] != 0 ) \r
-       fTimeDiff[i]->Fill( time[i]-time[0]);\r
+    if( time[i] !=0  && amp[i]>0.1 ){\r
+      fCFD[i]->Fill( time[i] );\r
+      //  printf(" time %f ocdb %f \n", time[i],fCDBcfds[i]); \r
+      \r
+      if(  time[0] != 0 ) {\r
+       diff =  time[i]-time[0] + fCDBdelays[i];\r
+       fTimeDiff[i]->Fill( diff);\r
+      }\r
     }\r
   }\r
   for (Int_t i=12; i<24; i++) {\r
-    if( time[i] != 0) {\r
+    if( time[i] != 0 && amp[i]>0.1) {\r
       fCFD[i]->Fill( time[i]);\r
-      if( time[12] != 0 ) \r
-       fTimeDiff[i]->Fill( time[i]-time[12]);\r
+      //  printf(" time %f ocdb %f \n", time[i],fCDBcfds[i]); \r
+       if( time[12] != 0 ) {\r
+       diff =  time[i]-time[12] + fCDBdelays[i];\r
+       fTimeDiff[i]->Fill( diff);\r
+      }\r
     }\r
   }\r
   const Double32_t* mean = fESD->GetT0TOF();\r
-  Double32_t meanTOF = mean[0] ;\r
-  Double32_t orA = mean[1] ;\r
-  Double32_t orC = mean[2];\r
+  Double32_t meanTOF = mean[0] +  fCDBT0s[0];\r
+  Double32_t orA = mean[1]  +  fCDBT0s[1];\r
+  Double32_t orC = mean[2] +  fCDBT0s[2];\r
  \r
-  if(orA<99999) fTzeroORA->Fill(orA);\r
-  if(orC<99999) fTzeroORC->Fill(orC);\r
-  if(orA<99999 && orC<99999) fResolution->Fill((orA-orC)/2.);\r
-  if(orA<99999 && orC<99999) fTzeroORAplusORC->Fill(meanTOF); \r
+  if(orA<9999) fTzeroORA->Fill(orA);\r
+  if(orC<9999) fTzeroORC->Fill(orC);\r
+  if(orA<9999 && orC<9999) fResolution->Fill((orA-orC)/2.);\r
+  if(orA<9999 && orC<9999) fTzeroORAplusORC->Fill(meanTOF); \r
 \r
   //  printf("%f   %f  %f\n",orA,orC,meanTOF);\r
   PostData(1, fTzeroObject);\r
index cbd045b..c419790 100644 (file)
@@ -20,8 +20,17 @@ class AliT0CalibOffsetChannelsTask : public AliAnalysisTaskSE {
   virtual void   UserExec(Option_t *option);\r
   virtual void   Terminate(Option_t *);\r
   TObjArray* GetOffsetHistos() {return fTzeroObject;}\r
-  \r
- private:\r
+\r
+  Float_t  GetCFDvalue(Int_t channel)  const {return fCDBcfds[channel];}\r
+  Float_t* GetCFDvalue()          const {return (float*)fCDBcfds;}\r
+  Float_t  GetTimeEq(Int_t channel)        const {return fCDBdelays[channel];}\r
+  Float_t* GetTimeEq()          const {return (float*)fCDBdelays;}\r
+  void SetCFDvalue(Int_t channel, Float_t val) {fCDBcfds[channel]=val;}\r
+  void SetTimeEq(Int_t channel, Float_t val) {fCDBdelays[channel]=val;}\r
+  Float_t *GetT0Means() { return fCDBT0s;}\r
+  void SetT0Means(Int_t ihist, Float_t mean ) {fCDBT0s[ihist]=mean;};\r
+\r
+private:\r
   AliESDEvent *fESD;          //! ESD object\r
   TObjArray   *fTzeroObject;  // array with CFDi-CFD1 and  CFDi\r
   TH1F        *fTimeDiff[24]; //! CFDi-CFD1 vs Npmt   \r
@@ -31,12 +40,16 @@ class AliT0CalibOffsetChannelsTask : public AliAnalysisTaskSE {
   TH1F        *fResolution;   //! or A minus or C spectrum    \r
   TH1F        *fTzeroORAplusORC; //! ORA+ORC /2 \r
   int         fRunNumber;\r
+  Float_t fCDBdelays[24];  //time delays from OCDB\r
+  Float_t fCDBcfds[24];    // mean CFD from OCDB\r
+  Float_t fCDBT0s[4];      //position T0AC, T0A, T0A, resolution\r
+\r
   \r
  \r
   AliT0CalibOffsetChannelsTask(const AliT0CalibOffsetChannelsTask&); // not implemented\r
   AliT0CalibOffsetChannelsTask& operator=(const AliT0CalibOffsetChannelsTask&); // not implemented\r
   \r
-  ClassDef(AliT0CalibOffsetChannelsTask, 1); // example of analysis\r
+  ClassDef(AliT0CalibOffsetChannelsTask, 2); // example of analysis\r
 };\r
 \r
 #endif\r
index d43b41c..5b04ac0 100644 (file)
@@ -132,10 +132,10 @@ Bool_t AliT0CalibSeasonTimeShift::SetT0Par(const char* filePhys, Float_t *cdbtim
 
        if(!cfd) {
          AliWarning(Form("no histograms collected for %s", histname[i].Data()));
-         //      ok=false;
-         fMeanPar[i] = cdbtime[i];
-         fSigmaPar[i] = 0;
-         //      return ok;
+         ok=false;
+         //  fMeanPar[i] = cdbtime[i];
+         //fSigmaPar[i] = 0;
+         return ok;
        }
        if(cfd) {
            GetMeanAndSigma(cfd, mean, sigma);
@@ -146,7 +146,7 @@ Bool_t AliT0CalibSeasonTimeShift::SetT0Par(const char* filePhys, Float_t *cdbtim
            }
            if ( sigma > 0 && sigma < 500 && cfd->GetEntries()>500)
              { 
-               fMeanPar[i] = cdbtime[i] +  mean;
+               fMeanPar[i] =   mean;
                fSigmaPar[i] = sigma;
                ok=true;
              }
@@ -171,7 +171,7 @@ void AliT0CalibSeasonTimeShift::GetMeanAndSigma(TH1F* hist,  Float_t &mean, Floa
   sigmaEstimate = hist->GetRMS();
   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","R"," ");
 
   mean  = (Float_t) fit->GetParameter(1);
   sigma = (Float_t) fit->GetParameter(2);
index d27f251..0e8b4c5 100644 (file)
@@ -240,7 +240,7 @@ Bool_t AliT0CalibTimeEq::ComputeOnlineParams(const char* filePhys)
            }
            if(cfddiff) {
              nent = Int_t(cfddiff->GetEntries());
-             if(nent>100 )  { //!!!!!
+             if(nent>500 )  { //!!!!!
                if(cfddiff->GetRMS()>1.5 )
                  GetMeanAndSigma(cfddiff, meandiff, sigmadiff);
                if(cfddiff->GetRMS()<=1.5) 
@@ -268,7 +268,7 @@ Bool_t AliT0CalibTimeEq::ComputeOnlineParams(const char* filePhys)
            }
            if(cfdtime) {
              nent = Int_t(cfdtime->GetEntries());
-             if(nent>100 )  { //!!!!!
+             if(nent>500 )  { //!!!!!
                if(cfdtime->GetRMS()>1.5 )
                  GetMeanAndSigma(cfdtime,meancfdtime, sigmacfdtime);
                if(cfdtime->GetRMS()<=1.5) 
@@ -288,7 +288,7 @@ Bool_t AliT0CalibTimeEq::ComputeOnlineParams(const char* filePhys)
              }
          }
          
-         SetTimeEq(i,timecdb[i] + meandiff);
+         SetTimeEq(i,meandiff);
          SetTimeEqRms(i,sigmadiff);
          SetCFDvalue(i,0, meancfdtime );
          if (cfddiff) cfddiff->Reset();
index 94a614c..4a8bef1 100644 (file)
@@ -75,29 +75,13 @@ void AliT0PreprocessorOffline::CalibOffsetChannels(TString filePhysName, Int_t u
   Float_t zero_timecdb[24]={0};
   Float_t *timecdb = zero_timecdb;
   Float_t *cfdvalue = zero_timecdb;
-  Int_t badpmt=0;
+  Int_t badpmt=-1;
   //Processing data from DAQ Physics run
   AliInfo("Processing Time Offset between channels");
   if (pocdbStorage.Length()>0) ocdbStorage=pocdbStorage;
   else
     ocdbStorage="local://"+gSystem->GetFromPipe("pwd")+"/OCDB";
  
-  AliCDBEntry *entryCalib = AliCDBManager::Instance()->Get("T0/Calib/TimeDelay");
-  if(!entryCalib) {
-    AliWarning(Form("Cannot find any AliCDBEntry for [Calib, TimeDelay]!"));
-  }
-  else
-    {
-      AliT0CalibTimeEq *clb = (AliT0CalibTimeEq*)entryCalib->GetObject();
-       timecdb = clb->GetTimeEq();
-       cfdvalue = clb->GetCFDvalue();
-    }
-  //AliCDBEntry *entryCalibreco = AliCDBManager::Instance()->Get("T0/Calib/RecoParam");
-  //  if(entryCalibreco) {
-  //  AliT0RecoParam *rpr = (AliT0RecoParam*) entryCalibreco->GetObject();
-    //    badpmt = rpr->GetRefPoint();
-  badpmt = -1;
-  // }
   AliT0CalibTimeEq *offline = new AliT0CalibTimeEq();
   Bool_t writeok = offline->ComputeOfflineParams(filePhysName.Data(), timecdb, cfdvalue, badpmt);
   AliCDBMetaData metaData;
@@ -127,15 +111,6 @@ void AliT0PreprocessorOffline::CalibT0sPosition(TString filePhysName, Int_t usta
   if (pocdbStorage.Length()>0) ocdbStorage=pocdbStorage;
   else
     ocdbStorage="local://"+gSystem->GetFromPipe("pwd")+"/OCDB";
-  AliCDBEntry *entryCalib = AliCDBManager::Instance()->Get("T0/Calib/TimeAdjust");
-  if(!entryCalib) {
-    AliWarning(Form("Cannot find any AliCDBEntry for [Calib, TimeAdjust]!"));
-  }
-  else
-    {
-      AliT0CalibSeasonTimeShift *clb = (AliT0CalibSeasonTimeShift*)entryCalib->GetObject();
-      timecdb = clb->GetT0Means();
-    }
   
   AliT0CalibSeasonTimeShift *offline = new AliT0CalibSeasonTimeShift();
   Bool_t writeok = offline->SetT0Par(filePhysName.Data(), timecdb);
index 1209a54..a845e7e 100644 (file)
@@ -281,10 +281,10 @@ void AliT0QADataMakerRec::InitRaws()
   fhQTC->SetOption("COLZ");
   Add2RawsList( fhQTC,212, expert, image, !saveCorr);
   
-  TH1F* fhNumPMTA= new TH1F("hNumPMTA","number of PMT hitted per event",13, 0 ,13);
+  TH1F* fhNumPMTA= new TH1F("hNumPMTA","number of PMT hitted per event A side",13, 0 ,13);
   Add2RawsList(fhNumPMTA ,213, expert, image, !saveCorr);
   
-  TH1F* fhNumPMTC= new TH1F("hNumPMTC","number of PMT hitted per event",13, 0 ,13);
+  TH1F* fhNumPMTC= new TH1F("hNumPMTC","number of PMT hitted per event C side",13, 0 ,13);
   Add2RawsList(fhNumPMTC ,214, expert, image, !saveCorr);
   
   TH1F* fhHitsOrA= new TH1F("fhHitsOrA","T0_OR A hit multiplicitie",20, 0 ,20);
@@ -322,7 +322,15 @@ void AliT0QADataMakerRec::InitRaws()
    Add2RawsList( fhBeamTVDCoff,222, expert, image, !saveCorr);
    TH1F* fhMean = new TH1F("fhMean", " (T0A+T0C)/2, ps ", 200, -2000, 2000);
    Add2RawsList( fhMean,223, !expert, image, !saveCorr);
-   //
+   //vertex 1st 
+   TH1F* fhVertex1st = new TH1F("fhVertex1st", " (T0A-T0C)/2, ps 1st particle", 200, -2000, 2000);
+   Add2RawsList( fhVertex1st ,225, !expert, image, !saveCorr);
+   TH1F* fhVertexBest = new TH1F("fhVertexBest", " (T0A-T0C)/2, ps , best particle", 200, -2000, 2000);
+   Add2RawsList( fhVertexBest ,226, !expert, image, !saveCorr);
+   TH1F* fhMean1st = new TH1F("fhMean1st", " (T0A + T0C)/2, ps , 1st particle", 200, -2000, 2000);
+   Add2RawsList( fhMean1st ,227, expert, image, !saveCorr);
+
+   // 
    TH2F* fhBCID = new TH2F("fhBCID", "header BCID vs TRM BC ID ", 500, 0, 5000, 500, 0, 5000);
    fhBCID->SetOption("COLZ");
    fhBCID->GetXaxis()->SetTitle("TRM BC ID");
@@ -515,8 +523,8 @@ void AliT0QADataMakerRec::MakeRaws( AliRawReader* rawReader)
     }
       
     FillRawsData(ik+176,nhitsPMT);
-    FillRawsData(213,numPmtC);
-    FillRawsData(214,numPmtA);
+    FillRawsData(213,numPmtA);
+    FillRawsData(214,numPmtC);
   }   
   
   Int_t trChannel[6] = {49,50,51,52,55,56};  
@@ -605,15 +613,22 @@ void AliT0QADataMakerRec::MakeRaws( AliRawReader* rawReader)
     TH2 *h221 = (TH2*)GetRawsData(221,itrID);
     TH2 *h222 = (TH2*)GetRawsData(222,itrID);
     TH1 *h223 = (TH1*)GetRawsData(223,itrID);
-    if( nEvent>1000 && (h220 || h221 || h222 || h223) ) {
+    TH1 *h225 = (TH1*)GetRawsData(225,itrID);
+    TH1 *h226 = (TH1*)GetRawsData(226,itrID);
+    TH1 *h227 = (TH1*)GetRawsData(227,itrID);
+    if( nEvent>1000 && (h220 || h221 || h222 || h223 || h225 || h226|| h227) ) 
+      {
       Int_t besttimeA=9999999;
       Int_t besttimeC=9999999;
+      Int_t time1stA=9999999;
+      Int_t time1stC=9999999;
       for (Int_t ipmt=0; ipmt<12; ipmt++){
        if(allData[ipmt+1][0] > 1 ) {
          //          time[ipmt] = allData[ipmt+1][0] - Int_t(GetRawsData(1)->GetMean());
          time[ipmt] = allData[ipmt+1][0] - fMeans[ipmt];
          if(TMath::Abs(time[ipmt]) < TMath::Abs(besttimeC))
            besttimeC=time[ipmt]; //timeC
+         if(time[ipmt] < time1stC)  time1stC=time[ipmt]; //timeC
        }
       }
       for ( Int_t ipmt=12; ipmt<24; ipmt++){
@@ -621,15 +636,23 @@ void AliT0QADataMakerRec::MakeRaws( AliRawReader* rawReader)
          time[ipmt] = allData[ipmt+45][0] - fMeans[ipmt] ;
          if(TMath::Abs(time[ipmt]) < TMath::Abs(besttimeA) )
            besttimeA=time[ipmt]; //timeA
+         if(time[ipmt] < time1stA)  time1stA=time[ipmt]; //timeC
        }
       }
       if(besttimeA<99999 &&besttimeC< 99999) {
        Float_t t0 =  24.4 * (Float_t( besttimeA+besttimeC)/2. );
-       Float_t ver = 24.4 * Float_t( besttimeA-besttimeC)/2.;
+       Float_t ver = 24.4 * Float_t( besttimeC-besttimeA)/2.;
        if (h220) h220->Fill(0.001*ver, 0.001*(t0));
        if(allData[50][0] > 0)  if (h221) h221->Fill(0.001*ver, 0.001*(t0));
        if(allData[50][0] <= 0) if (h222) h222->Fill(0.001*ver, 0.001*(t0));
        if (h223) h223->Fill(t0);
+       if (h226) h226->Fill(ver);
+      }          
+      if(time1stA<99999 &&time1stC< 99999) {
+       Float_t t01st =  24.4 * (Float_t( time1stA + time1stC)/2. );
+       Float_t ver1st = 24.4 * Float_t( time1stC - time1stA)/2.;
+       if (h225) h225->Fill(ver1st);
+       if (h227) h227->Fill(t01st);
       }          
     } //event >100
       //   } //type 7