interalighment with TOF implemented
authoralla <alla@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 12 Mar 2012 09:47:30 +0000 (09:47 +0000)
committeralla <alla@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 12 Mar 2012 09:47:30 +0000 (09:47 +0000)
PWGPP/T0/AliT0AnalysisTaskQA.cxx
PWGPP/T0/AliT0AnalysisTaskQA.h

index fd81c69..5e4e669 100644 (file)
@@ -13,6 +13,7 @@
 #include "AliESDInputHandler.h"
 
 #include "AliT0AnalysisTaskQA.h"
+#include "AliESDpid.h"
 
 //#include "AliCDBMetaData.h"
 //#include "AliCDBId.h"
 //#include "AliCDBStorage.h"
 
 // Task should calculate channels offset 
-// Authors: Alla 
+// Authors: Alla
+//last change 23 Feb 2012 FK
 
 ClassImp(AliT0AnalysisTaskQA)
 //________________________________________________________________________
 AliT0AnalysisTaskQA::AliT0AnalysisTaskQA() 
   : AliAnalysisTaskSE(),  fESD(0x0), fTzeroObject(0x0),
-  fTzeroORA(0x0), fTzeroORC(0x0), fResolution(0x0), fTzeroORAplusORC(0x0),
+  fTzeroORA(0x0), fTzeroORC(0x0), fResolution(0x0), fTzeroORAplusORC(0x0), fTzeroTof(0x0),
     fRunNumber(0),fTimeVSAmplitude(0x0),fCFDVSPmtId(0x0),fSPDVertexVST0Vertex(0x0),
-  fOrAvsNtracks(0), fOrCvsNtracks(0), fT0vsNtracks(0),
-  fEffAC(0), fEffA(0), fEffC(0), ftracksEffSPD(0)
-  
+    fOrAvsNtracks(0x0), fOrCvsNtracks(0x0), fT0vsNtracks(0x0),fT0TimevsT0Tof(0x0),
+    fESDpid(new AliESDpid())
 {
   // Constructor
 
@@ -47,11 +48,10 @@ AliT0AnalysisTaskQA::AliT0AnalysisTaskQA()
 //________________________________________________________________________
 AliT0AnalysisTaskQA::AliT0AnalysisTaskQA(const char *name) 
   : AliAnalysisTaskSE(name),  fESD(0x0), fTzeroObject(0x0),
-  fTzeroORA(0x0), fTzeroORC(0x0), fResolution(0x0), fTzeroORAplusORC(0x0),
+  fTzeroORA(0x0), fTzeroORC(0x0), fResolution(0x0), fTzeroORAplusORC(0x0), fTzeroTof(0x0),
     fRunNumber(0),fTimeVSAmplitude(0x0),fCFDVSPmtId(0x0),fSPDVertexVST0Vertex(0x0),
-    fOrAvsNtracks(0), fOrCvsNtracks(0), fT0vsNtracks(0),
-   fEffAC(0), fEffA(0), fEffC(0), ftracksEffSPD(0)
-
+    fOrAvsNtracks(0x0), fOrCvsNtracks(0x0), fT0vsNtracks(0x0),fT0TimevsT0Tof(0x0),
+    fESDpid(new AliESDpid())
 {
   // Constructor
   // Define input and output slots here
@@ -67,37 +67,49 @@ AliT0AnalysisTaskQA::~AliT0AnalysisTaskQA()
 {
   // Destructor
   // printf("AliT0CalibOffsetChannels~AliT0CalibOffsetChannels() ");
-  if (!AliAnalysisManager::GetAnalysisManager()->IsProofMode()) delete fTzeroObject; // This deletes everything ...
+  delete fTzeroORA;
+  delete fTzeroORC;
+  delete fResolution;
+  delete fTzeroORAplusORC;
+  delete fTzeroTof;
+  delete [] fTimeVSAmplitude;
+  delete fCFDVSPmtId;
+  delete fSPDVertexVST0Vertex;
+  delete fOrAvsNtracks;
+  delete fOrCvsNtracks;
+  delete fT0vsNtracks;
+  delete fT0TimevsT0Tof;
+
+  delete fESDpid;
+  delete fTzeroObject;
 }
 
 //------------------------------------------------------------------
 void AliT0AnalysisTaskQA::UserCreateOutputObjects()
 {
   // Create histograms
- fTimeVSAmplitude = new TH2F*[NPMT0];
+ fTimeVSAmplitude = new TH2F*[kNPMT0];
 
- for (Int_t i=0; i<NPMT0; i++) {
-    fTimeVSAmplitude[i]= new TH2F (Form("fTimeVSAmplitude%d",i+1),"fTimeVsAmplitude",500, 0, 50,1500,1000,7000);
+ for (Int_t i=0; i<kNPMT0; i++) {
+    fTimeVSAmplitude[i]= new TH2F (Form("fTimeVSAmplitude%d",i+1),"fTimeVsAmplitude",60, -10, 50,500,2000,7000);
   }
 
   fTzeroORAplusORC = new TH1F("fTzeroORAplusORC","ORA+ORC /2",100,-2000,2000);   //or A plus or C 
-  fResolution      = new TH1F("fResolution","fResolution",100,-2000,2000);// or A minus or C spectrum
+  fTzeroTof        = new TH1F("fTzeroTof","t0 from TOF",100,-2000,2000);   //t0 start time from TOF
+  fResolution      = new TH1F("fResolution","fResolution",100,-500,500);// or A minus or C spectrum
   fTzeroORA        = new TH1F("fTzeroORA","fTzeroORA",100,-2000,2000);// or A spectrum
   fTzeroORC        = new TH1F("fTzeroORC","fTzeroORC",100,-2000,2000);// or C spectrum
-  fCFDVSPmtId      = new TH2F("fCFDVSPmtId","fCFDVSPmtId",24,0,24,1500,1000,7000);  // 
+  fCFDVSPmtId      = new TH2F("fCFDVSPmtId","fCFDVSPmtId",24,0,24,500,2000,7000);  // 
   fSPDVertexVST0Vertex = new TH2F("fSPDVertexVST0Vertex","fSPDVertexVST0Vertex",30,-30,30,30,-30,30);
-  fOrAvsNtracks    = new TH2F("fAvstracks", "Avstracks",200, 0, 1000, 500, -1000, 1000);
-  fOrCvsNtracks    = new TH2F("fCvstracks", "Cvstracks",200, 0, 1000, 500, -1000, 1000);
-  fT0vsNtracks     = new TH2F("fT0ACvstrackles", "T0ACvstracks",200, 0, 1000, 500, -1000, 1000); 
-   fEffAC = new TH1F("EffAC","T0Eff ", 200, 0, 1000);
-   fEffA = new TH1F("EffA","T0AEff ", 200, 0, 1000);
-   fEffC = new TH1F("EffC","T0CEff ", 200, 0, 1000);
-   ftracksEffSPD= new TH1F("ftracksEffSPD","SPDeff", 200, 0, 1000);
-
-  fTzeroObject     = new TObjArray();
+  fOrAvsNtracks = new TH2F("fAvstracks", "A vs tracks",200, 0, 1000, 200, -1000, 1000);
+  fOrCvsNtracks = new TH2F("fCvstracks", "C vs tracks",200, 0, 1000, 200, -1000, 1000);
+  fT0vsNtracks  = new TH2F("fT0ACvstrackes", "T0AC vs tracks",200, 0, 1000, 200, -1000, 1000); 
+  fT0TimevsT0Tof = new TH2F("fT0TimevsT0Tof", "fT0TimevsT0Tof",50, -1000,1000, 50, -1000,1000); 
+
+  fTzeroObject     = new TObjArray(0);
   fTzeroObject->SetOwner(kTRUE);
   
-  for (Int_t i=0; i<24; i++)
+  for (Int_t i=0; i<kNPMT0; i++)
     fTzeroObject->AddAtAndExpand(fTimeVSAmplitude[i],i);
 
   fTzeroObject->AddAtAndExpand(fCFDVSPmtId,24);
@@ -109,10 +121,8 @@ void AliT0AnalysisTaskQA::UserCreateOutputObjects()
   fTzeroObject->AddAtAndExpand(fT0vsNtracks, 30);
   fTzeroObject->AddAtAndExpand(fOrAvsNtracks,31);
   fTzeroObject->AddAtAndExpand(fOrCvsNtracks, 32);
-  fTzeroObject->AddAtAndExpand(fEffC, 33);
-  fTzeroObject->AddAtAndExpand(fEffA, 34);
-  fTzeroObject->AddAtAndExpand(fEffAC, 35);
-  fTzeroObject->AddAtAndExpand(ftracksEffSPD, 36);
+  fTzeroObject->AddAtAndExpand(fTzeroTof, 33);
+  fTzeroObject->AddAtAndExpand(fT0TimevsT0Tof, 34);
 
   PostData(1, fTzeroObject);
   // Called once
@@ -137,7 +147,7 @@ void AliT0AnalysisTaskQA::UserExec(Option_t *)
   const Double32_t* amplitude = fESD->GetT0amplitude();
 
  
-  for (Int_t i=0; i<24; i++) {
+  for (Int_t i=0; i<kNPMT0; i++) {
     if(time[i]<9999 &&abs(time[i])>1e-8 && amplitude[i]<9999&&abs(amplitude[i])>1e-8 )
       {
        //      cout<<"time "<<time[i]<<" amplitude "<<amplitude[i]<<endl;
@@ -149,41 +159,59 @@ void AliT0AnalysisTaskQA::UserExec(Option_t *)
   const Double32_t* mean = fESD->GetT0TOF();
   Double32_t orA = mean[1];
   Double32_t orC = mean[2];
-  Int_t ntracks = fESD->GetNumberOfTracks(); 
+  Int_t ntracks = fESD->GetNumberOfTracks();
+
+  Int_t ntracksMatchedToTOF = 0; 
+  for(Int_t itrk=0;itrk<ntracks;itrk++){
+    AliESDtrack* track = fESD->GetTrack(itrk);
+    if (!track) {
+      Printf("ERROR: Could not receive track %d", itrk);
+      continue;
+    }
+    //no track selection just TOF hit
+    if (track->IsOn(AliESDtrack::kTOFout)) ntracksMatchedToTOF++;
+  }
 
-  if(orA<99999){
+  if(orA<9999){
     fTzeroORA->Fill(orA);
-    fOrAvsNtracks->Fill(ntracks, orA);
-    fEffA->Fill(ntracks);
+    fOrAvsNtracks->Fill(ntracksMatchedToTOF, orA);
   }
-  if(orC<99999) {
+  if(orC<9999) {
     fTzeroORC->Fill(orC);
-    fOrCvsNtracks->Fill(ntracks, orC);
-    fEffC->Fill(ntracks);
-   }
-  if(orA<99999 && orC<99999) {
+    fOrCvsNtracks->Fill(ntracksMatchedToTOF, orC);
+  }
+  if(orA<9999 && orC<9999) {
     fResolution->Fill((orA-orC)/2.);
     fTzeroORAplusORC->Fill(mean[0]);
-    fEffAC->Fill(ntracks);
-    fT0vsNtracks->Fill(ntracks, mean[0]);
+    fT0vsNtracks->Fill(ntracksMatchedToTOF, mean[0]);
+  }
+
+  if(fESDpid){ //get T0_TOF 
+    fESDpid->SetTOFResponse(fESD,AliESDpid::kTOF_T0);
+    Float_t t0tofTrack =(Float_t) (fESDpid->GetTOFResponse().GetStartTime(10.0)); //Get start time from all tracks 
+    if (t0tofTrack !=0) fTzeroTof->Fill(t0tofTrack);
+
+    if(orA<9999 && orC<9999 && t0tofTrack !=0){ // T0 time  and  TOF time simultaneously
+      fT0TimevsT0Tof->Fill(t0tofTrack, mean[0]);
+    }
   }
   
   Double32_t t0vertex = fESD->GetT0zVertex();
+  //  cout << "t0 vertex "<<t0vertex<<endl;
   Double32_t esdzvertex;
   const AliESDVertex * esdvertex = fESD->GetPrimaryVertex();
   Int_t nofcontrib=-1;
-  if(esdvertex) {
-    nofcontrib=esdvertex->GetNContributors();
-    if(nofcontrib>0)    ftracksEffSPD->Fill(ntracks);
-    if(esdvertex && t0vertex<999)
-      {
-       if(nofcontrib>0)
-         {
-           esdzvertex=esdvertex->GetZv();
-           fSPDVertexVST0Vertex->Fill(t0vertex,esdzvertex);
-         }
-      }
-  }
+  if(esdvertex && t0vertex<999)
+    {
+      nofcontrib=esdvertex->GetNContributors();
+      if(nofcontrib>1)
+       {
+         esdzvertex=esdvertex->GetZv();
+         //      cout << "esd vertex "<<esdzvertex<<endl;
+         fSPDVertexVST0Vertex->Fill(t0vertex,esdzvertex);
+       }
+    }
+  // printf("%f   %f  %f\n",orA,orC,time);
   PostData(1, fTzeroObject);
 }      
  //________________________________________________________________________
index 5a1c97c..1766fa9 100644 (file)
@@ -2,18 +2,17 @@
 #define AliT0AnalysisTaskQA_cxx
 
 // task determines mean and sigma of T0 signals  ORA, ORC, ORA-ORC, ORA+ORC/2  
-// Authors: FK  
+// Authors: FK  last change 23 Feb 2012 
 
-#define NPMT0 24  //number T0 of photomultipliers
+#define kNPMT0 24  //number T0 of photomultipliers
 
 class TH1F;
 class TObjArray; 
 class AliESDEvent;
 class TH2F;
+class AliESDpid;
 
-#ifndef ALIANALYSISTASKSE_H
 #include "AliAnalysisTaskSE.h"
-#endif
 
 class AliT0AnalysisTaskQA : public AliAnalysisTaskSE {
  public:
@@ -33,23 +32,22 @@ class AliT0AnalysisTaskQA : public AliAnalysisTaskSE {
   TH1F        *fTzeroORC;     //! or C spectrum    
   TH1F        *fResolution;   //! or A minus or C spectrum    
   TH1F        *fTzeroORAplusORC; //! ORA+ORC /2 
+  TH1F        *fTzeroTof;     //! start T0 time from TOF 
   int         fRunNumber;
   TH2F        **fTimeVSAmplitude; //! Time vs. Amplitude
   TH2F        *fCFDVSPmtId;   //! CFDi vs pmt id
   TH2F        *fSPDVertexVST0Vertex; //! SPD vertex vs T0 vertex   
   TH2F        *fOrAvsNtracks; //! T0A vs Ntracks
   TH2F        *fOrCvsNtracks; //! T0C vs Ntracks
-  TH2F        *fT0vsNtracks;  //! T0A vs Ntracks
-  TH1F        *fEffAC;        //T0AC eff
-  TH1F        *fEffA;         //T0A eff
-  TH1F        *fEffC;         //T0C eff
-  TH1F        *ftracksEffSPD;  // ntracks in SPD 
-  
+  TH2F        *fT0vsNtracks; //! T0A vs Ntracks
+  TH2F        *fT0TimevsT0Tof; //! T0 time vs T0 TOF time 
+
+  AliESDpid* fESDpid;  //! esd pid 
  
   AliT0AnalysisTaskQA(const AliT0AnalysisTaskQA&); // not implemented
   AliT0AnalysisTaskQA& operator=(const AliT0AnalysisTaskQA&); // not implemented
   
-  ClassDef(AliT0AnalysisTaskQA, 1); // example of analysis
+  ClassDef(AliT0AnalysisTaskQA, 2); // example of analysis
 };
 
 #endif