Fix for coverity + improved beta version
authorfbellini <fbellini@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 2 Dec 2013 11:49:15 +0000 (11:49 +0000)
committerfbellini <fbellini@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 2 Dec 2013 11:49:15 +0000 (11:49 +0000)
PWGPP/TOF/AddTaskTOFqaID.C
PWGPP/TOF/AliAnalysisTaskTOFqa.cxx
PWGPP/TOF/AliAnalysisTaskTOFqaID.cxx
PWGPP/TOF/AliAnalysisTaskTOFqaID.h

index 63935b3..7642604 100644 (file)
@@ -34,8 +34,7 @@ AliAnalysisTaskSE * AddTaskTOFqaID(UInt_t triggerMask = kTriggerMask, Bool_t fla
   task->EnableAdvancedCheck(flagEnableAdvancedCheck);
   task->SetSelectMCspecies(isMC, absPdgCode);
   task->SelectCollisionCandidates(triggerMask);
-
-  //AliLog::SetClassDebugLevel("AliAnalysisTaskTOFqa",1);
+  //AliLog::SetClassDebugLevel("AliAnalysisTaskTOFqaID",4);
   mgr->AddTask(task);
 
   /* cuts used for QA in 2010 p-p */
@@ -67,6 +66,11 @@ AliAnalysisTaskSE * AddTaskTOFqaID(UInt_t triggerMask = kTriggerMask, Bool_t fla
   esdTrackCutsStd2010->SetDCAToVertex2D(kFALSE);
   esdTrackCutsStd2010->SetRequireSigmaToVertex(kFALSE);
 
+  /*
+    AliESDtrackCuts* esdTrackCutsStd2011 = new AliESDtrackCuts("AliESDtrackCuts", "Standard2011");
+    esdTrackCutsStd2011->GetStandardITSTPCTrackCuts2011(kTRUE,0);
+  */
+  
   AliAnalysisFilter* trackFilter = new AliAnalysisFilter("trackFilter");
   trackFilter->AddCuts(esdTrackCutsStd2010);
   task->SetTrackFilter(trackFilter);
index e0f0762..f2c9198 100644 (file)
@@ -224,6 +224,7 @@ void AliAnalysisTaskTOFqa::UserCreateOutputObjects()
 {
   // 
   AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager();
+  if (!man)  AliFatal("Analysis manager needed");
   AliInputEventHandler *inputHandler=dynamic_cast<AliInputEventHandler*>(man->GetInputEventHandler());
   if (!inputHandler) AliFatal("Input handler needed");
 
@@ -1842,7 +1843,7 @@ Bool_t AliAnalysisTaskTOFqa::ComputeTimeZeroByTOF1GeV()
   fMyTimeZeroTOFsigma = 1000. * fTOFT0v1->GetResult(1);
   fMyTimeZeroTOFtracks = fTOFT0v1->GetResult(3);
   Bool_t hasTimeZeroTOF = kFALSE;
-  if (fTOFT0v1) delete fTOFT0v1;
+  //if (fTOFT0v1) delete fTOFT0v1;//removed for coverity
   /* check T0-TOF sigma */
   if (fMyTimeZeroTOFsigma < 250.)
     hasTimeZeroTOF = kTRUE;  
index a64e2a9..b31958b 100644 (file)
@@ -21,6 +21,7 @@
 #include "AliESDInputHandler.h"
 #include "AliMCEventHandler.h"
 #include "AliESDpid.h"
+#include "AliTOFPIDParams.h"
 #include "AliCDBManager.h"
 #include "AliTOFcalib.h"
 #include "AliTOFT0maker.h"
@@ -42,7 +43,6 @@ AliAnalysisTaskTOFqaID::AliAnalysisTaskTOFqaID() :
   fTrackFilter(0x0), 
   fVertex(0x0),
   fESDpid(new AliESDpid()),
-  fTOFT0v1(new AliTOFT0v1(fESDpid)),
   fTOFHeader(0x0),
   fEnableAdvancedCheck(kFALSE),
   fExpTimeBinWidth(24.4),
@@ -92,7 +92,6 @@ AliAnalysisTaskTOFqaID::AliAnalysisTaskTOFqaID(const char *name) :
   fTrackFilter(0x0),
   fVertex(0x0),
   fESDpid(new AliESDpid()),
-  fTOFT0v1(new AliTOFT0v1(fESDpid)),
   fTOFHeader(0x0),
   fEnableAdvancedCheck(kFALSE),
   fExpTimeBinWidth(24.4),
@@ -156,7 +155,6 @@ AliAnalysisTaskTOFqaID::AliAnalysisTaskTOFqaID(const AliAnalysisTaskTOFqaID& cop
   fTrackFilter(copy.fTrackFilter), 
   fVertex(copy.fVertex),
   fESDpid(copy.fESDpid),
-  fTOFT0v1(copy.fTOFT0v1),
   fTOFHeader(copy.fTOFHeader),
   fEnableAdvancedCheck(copy.fEnableAdvancedCheck),
   fExpTimeBinWidth(copy.fExpTimeBinWidth),
@@ -213,7 +211,6 @@ AliAnalysisTaskTOFqaID& AliAnalysisTaskTOFqaID::operator=(const AliAnalysisTaskT
     fTrackFilter=copy.fTrackFilter;
     fVertex=copy.fVertex;
     fESDpid=copy.fESDpid;
-    fTOFT0v1=copy.fTOFT0v1;
     fTOFHeader=copy.fTOFHeader;
     fEnableAdvancedCheck=copy.fEnableAdvancedCheck;
     fExpTimeBinWidth=copy.fExpTimeBinWidth;
@@ -263,7 +260,6 @@ AliAnalysisTaskTOFqaID::~AliAnalysisTaskTOFqaID() {
   Info("~AliAnalysisTaskTOFqaID","Calling Destructor");
   if (fESDpid) delete fESDpid;
   if (fTOFHeader) delete fTOFHeader;
-  if (fTOFT0v1) delete fTOFT0v1;
   if (fVertex) delete fVertex;
   if (fTrackFilter) delete fTrackFilter;
   if (AliAnalysisManager::GetAnalysisManager()->IsProofMode()) return;  
@@ -293,7 +289,20 @@ AliAnalysisTaskTOFqaID::~AliAnalysisTaskTOFqaID() {
 //________________________________________________________________________
 void AliAnalysisTaskTOFqaID::UserCreateOutputObjects()
 {
-  //Defines output objects and histograms
+  //
+  //Define output objects and histograms
+  //
+
+  //retrieve PID response object 
+  AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager();
+  if (!man)  AliFatal("Analysis manager needed");
+  AliInputEventHandler *inputHandler=dynamic_cast<AliInputEventHandler*>(man->GetInputEventHandler());
+  if (!inputHandler) AliFatal("Input handler needed");
+  //pid response object
+  fESDpid=(AliESDpid*)inputHandler->GetPIDResponse();
+  if (!fESDpid) AliError("PIDResponse object was not created");
+  //  fESDpid->SetOADBPath("$ALICE_ROOT/OADB");
+
   Info("CreateOutputObjects","CreateOutputObjects (TList) of task %s", GetName());
   OpenFile(1);
 
@@ -332,7 +341,7 @@ void AliAnalysisTaskTOFqaID::UserCreateOutputObjects()
   //add plots for start time QA
   AddStartTimeHisto(fHlistTimeZero,"");
   
-  //add plots for base TOF quantities
+  //add plots for base TO quantities
   AddTofBaseHisto(fHlist,  1, "");
   AddTofBaseHisto(fHlist, -1, "");
   
@@ -361,7 +370,7 @@ void AliAnalysisTaskTOFqaID::UserExec(Option_t *)
   /* Main - executed for each event.
     It extracts event information and track information after selecting 
     primary tracks via standard cuts. */
-  
+  /*
   AliESDInputHandler *esdH = dynamic_cast<AliESDInputHandler*> (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
   if (!esdH) {
     AliError("ERROR: Could not get ESDInputHandler");
@@ -370,11 +379,23 @@ void AliAnalysisTaskTOFqaID::UserExec(Option_t *)
     fESD = (AliESDEvent*) esdH->GetEvent();
   } 
   
+  */
+
+  fESD=(AliESDEvent*)InputEvent();
+  if ((!fESD)||(!fESDpid)) return;
+  
   if (!fESD) {
     AliError("ERROR: fESD not available");
     return;
   }
-
+  //retrieve default start time type from PIDresponse
+  AliPIDResponse::EStartTimeType_t startTimeMethodDefault = AliPIDResponse::kBest_T0;  
+  if (fESDpid->GetTOFPIDParams()) {  // during reconstruction OADB not yet available
+    startTimeMethodDefault = ((AliTOFPIDParams *)fESDpid->GetTOFPIDParams())->GetStartTimeMethod();
+    //debug
+    Printf("::::: startTimeMethodDefault = %i", startTimeMethodDefault);
+  }
+  
   //access MC event handler for MC truth information
   if (fIsMC) {
     AliMCEventHandler *mcH = dynamic_cast<AliMCEventHandler*> (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
@@ -393,9 +414,13 @@ void AliAnalysisTaskTOFqaID::UserExec(Option_t *)
   // get run number
   Int_t runNb = fESD->GetRunNumber();
   if (runNb>0) fRunNumber = runNb;
+  //Debug
+  Printf("::::: run number = %i", fRunNumber);
+  
+
   //reset matched track counters
   for (Int_t j=0;j<3;j++){fNTOFtracks[j]=0;}  
-  
+
   //Get vertex info and apply vertex cut
   if (!IsEventSelected(fESD)) return;
   
@@ -469,6 +494,9 @@ void AliAnalysisTaskTOFqaID::UserExec(Option_t *)
     FillTofTrgHisto("");
   }
   
+  //restore value set by AliPIDResponseTask for subsequent wagons
+  fESDpid->SetTOFResponse(fESD,startTimeMethodDefault);
+  
   PostData(1, fHlist);
   PostData(2, fHlistTimeZero);
   PostData(3, fHlistPID);
@@ -648,8 +676,8 @@ Bool_t AliAnalysisTaskTOFqaID::ComputeTimeZeroByTOF1GeV()
 {
   /* compute T0-TOF for tracks within momentum range [0.95, 1.05] */
   /* init T0-TOF */
+  AliTOFT0v1 *fTOFT0v1 = new AliTOFT0v1(fESDpid); // TOF-T0 v1
   fTOFT0v1->Init(fESD);
-  //AliTOFT0v1 *fTOFT0v1 = new AliTOFT0v1(fESDpid);
   fTOFT0v1->DefineT0("all", 0.95, 1.05);
   fMyTimeZeroTOF = -1000. * fTOFT0v1->GetResult(0);
   fMyTimeZeroTOFsigma = 1000. * fTOFT0v1->GetResult(1);
@@ -1268,68 +1296,100 @@ void AliAnalysisTaskTOFqaID::FillPidHisto(AliESDtrack * track, Int_t charge, TSt
   Int_t channel=track->GetTOFCalChannel(); 
   Int_t volId[5]; //(sector, plate,strip,padZ,padX)
   AliTOFGeometry::GetVolumeIndices(channel,volId);
+  Char_t partName[3][3] = {"Pi","Ka","P"}; 
   
-if (suffix.Contains("Trd")) {
-  if (isValidBeta[AliPID::kPion]){
-    ((TH2F*)fHlistTRD->FindObject(Form("hExpTimePiVsStrip%s_%s",suffix.Data(),cLabel.Data())))->Fill((Int_t)GetStripIndex(volId),tofps-fTrkExpTimes[AliPID::kPion]);//ps
-    ((TH1F*)fHlistTRD->FindObject(Form("hExpTimePi%s_%s",suffix.Data(),cLabel.Data())))->Fill(tofps-fTrkExpTimes[AliPID::kPion]);//ps
-    ((TH2F*)fHlistTRD->FindObject(Form("hExpTimePiVsP%s_%s",suffix.Data(),cLabel.Data())))->Fill(fP, tofps-fTrkExpTimes[AliPID::kPion]);
-    ((TH2F*)fHlistTRD->FindObject(Form("hTOFpidSigmaPi%s_%s",suffix.Data(),cLabel.Data())))->Fill(fPt, (tofps-fTrkExpTimes[AliPID::kPion])/fSigmaSpecie[AliPID::kPion]);
-    ((TH2F*)fHlistTRD->FindObject(Form("hExpTimePiT0SubVsP%s_%s",suffix.Data(),cLabel.Data())))->Fill(fP,tofps-fTrkExpTimes[AliPID::kPion]-timeZeroTOF);  
-    ((TH2F*)fHlistTRD->FindObject(Form("hExpTimePiVsOutPhi%s_%s",suffix.Data(),cLabel.Data())))->Fill(fTPCOuterPhi,tofps-fTrkExpTimes[AliPID::kPion]-timeZeroTOF);
+  if (suffix.Contains("Trd")) {
+    for (Int_t specie = AliPID::kPion; specie <= AliPID::kProton; specie++){
+      if (isValidBeta[specie]){
+       ((TH2F*)fHlistTRD->FindObject(Form("hExpTime%sVsP%s_%s",partName[specie], suffix.Data(),cLabel.Data())))->Fill(fP, tofps-fTrkExpTimes[specie]);
+       ((TH2F*)fHlistTRD->FindObject(Form("hTOFpidSigma%s%s_%s",partName[specie], suffix.Data(),cLabel.Data())))->Fill(fPt, (tofps-fTrkExpTimes[specie])/fSigmaSpecie[specie]);
+       ((TH2F*)fHlistTRD->FindObject(Form("hExpTime%sT0SubVsP%s_%s",partName[specie], suffix.Data(),cLabel.Data())))->Fill(fP,tofps-fTrkExpTimes[specie]-timeZeroTOF);  
+       ((TH2F*)fHlistTRD->FindObject(Form("hExpTime%sVsOutPhi%s_%s",partName[specie], suffix.Data(),cLabel.Data())))->Fill(fTPCOuterPhi,tofps-fTrkExpTimes[specie]-timeZeroTOF);
+       
+       //fill histos for pion only
+       if (specie == AliPID::kPion){
+         ((TH2F*)fHlistTRD->FindObject(Form("hExpTimePiVsStrip%s_%s",suffix.Data(),cLabel.Data())))->Fill((Int_t)GetStripIndex(volId),tofps-fTrkExpTimes[specie]);//ps
+         ((TH1F*)fHlistTRD->FindObject(Form("hExpTimePi%s_%s",suffix.Data(),cLabel.Data())))->Fill(tofps-fTrkExpTimes[specie]);//ps
+         
+         if (ComputeTimeZeroByTOF1GeV()){
+           if ((fPt>0.95)&&(fPt<1.05)){
+             ((TH2F*)fHlistTRD->FindObject(Form("hExpTimePiT0Sub1GeV%s_%s",suffix.Data(),cLabel.Data())))->Fill(fMyTimeZeroTOFtracks,tofps-fMyTimeZeroTOF-fTrkExpTimes[specie]);
+           }
+         } 
+       }//end pion     
+      }// end check on beta
+    }
+    // if (isValidBeta[AliPID::kKaon]){
+    //   ((TH2F*)fHlistTRD->FindObject(Form("hExpTimeKaVsP%s_%s",suffix.Data(),cLabel.Data())))->Fill(fP, tofps-fTrkExpTimes[AliPID::kKaon]);
+    //   ((TH2F*)fHlistTRD->FindObject(Form("hTOFpidSigmaKa%s_%s",suffix.Data(),cLabel.Data())))->Fill(fPt, (tofps-fTrkExpTimes[AliPID::kKaon])/fSigmaSpecie[AliPID::kKaon]);
+    //   ((TH2F*)fHlistTRD->FindObject(Form("hExpTimeKaT0SubVsP%s_%s",suffix.Data(),cLabel.Data())))->Fill(fP,tofps-fTrkExpTimes[AliPID::kKaon]-timeZeroTOF);  
+    //   ((TH2F*)fHlistTRD->FindObject(Form("hExpTimeKaVsOutPhi%s_%s",suffix.Data(),cLabel.Data())))->Fill(fTPCOuterPhi,tofps-fTrkExpTimes[AliPID::kKaon]-timeZeroTOF);    
+    // }//end kaon  
     
-    if (ComputeTimeZeroByTOF1GeV()){
-      if ((fPt>0.95)&&(fPt<1.05)){
-       ((TH2F*)fHlistTRD->FindObject(Form("hExpTimePiT0Sub1GeV%s_%s",suffix.Data(),cLabel.Data())))->Fill(fMyTimeZeroTOFtracks,tofps-fMyTimeZeroTOF-fTrkExpTimes[AliPID::kPion]);
-      }
-    } 
-  }//end pion
-  
-  if (isValidBeta[AliPID::kKaon]){
-    ((TH2F*)fHlistTRD->FindObject(Form("hExpTimeKaVsP%s_%s",suffix.Data(),cLabel.Data())))->Fill(fP, tofps-fTrkExpTimes[AliPID::kKaon]);
-    ((TH2F*)fHlistTRD->FindObject(Form("hTOFpidSigmaKa%s_%s",suffix.Data(),cLabel.Data())))->Fill(fPt, (tofps-fTrkExpTimes[AliPID::kKaon])/fSigmaSpecie[AliPID::kKaon]);
-    ((TH2F*)fHlistTRD->FindObject(Form("hExpTimeKaT0SubVsP%s_%s",suffix.Data(),cLabel.Data())))->Fill(fP,tofps-fTrkExpTimes[AliPID::kKaon]-timeZeroTOF);  
-    ((TH2F*)fHlistTRD->FindObject(Form("hExpTimeKaVsOutPhi%s_%s",suffix.Data(),cLabel.Data())))->Fill(fTPCOuterPhi,tofps-fTrkExpTimes[AliPID::kKaon]-timeZeroTOF);    
-  }//end kaon  
-  
-  if (isValidBeta[AliPID::kProton]){
-    ((TH2F*)fHlistTRD->FindObject(Form("hExpTimeProVsP%s_%s",suffix.Data(),cLabel.Data())))->Fill(fP, tofps-fTrkExpTimes[AliPID::kProton]);
-    ((TH2F*)fHlistTRD->FindObject(Form("hTOFpidSigmaPro%s_%s",suffix.Data(),cLabel.Data())))->Fill(fPt, (tofps-fTrkExpTimes[AliPID::kProton])/fSigmaSpecie[AliPID::kProton]);
-    ((TH2F*)fHlistTRD->FindObject(Form("hExpTimeProT0SubVsP%s_%s",suffix.Data(),cLabel.Data())))->Fill(fP,tofps-fTrkExpTimes[AliPID::kProton]-timeZeroTOF);  
-    ((TH2F*)fHlistTRD->FindObject(Form("hExpTimeProVsOutPhi%s_%s",suffix.Data(),cLabel.Data())))->Fill(fTPCOuterPhi,tofps-fTrkExpTimes[AliPID::kProton]-timeZeroTOF);
-  }//end proton  
-
- } else { 
-
-  if (isValidBeta[AliPID::kPion]){
-    ((TH2F*)fHlist->FindObject(Form("hExpTimePiVsStrip%s_%s",suffix.Data(),cLabel.Data())))->Fill((Int_t)GetStripIndex(volId),tofps-fTrkExpTimes[AliPID::kPion]);//ps
-    ((TH1F*)fHlist->FindObject(Form("hExpTimePi%s_%s",suffix.Data(),cLabel.Data())))->Fill(tofps-fTrkExpTimes[AliPID::kPion]);//ps
-    ((TH2F*)fHlist->FindObject(Form("hExpTimePiVsP%s_%s",suffix.Data(),cLabel.Data())))->Fill(fP, tofps-fTrkExpTimes[AliPID::kPion]);
-    ((TH2F*)fHlist->FindObject(Form("hTOFpidSigmaPi%s_%s",suffix.Data(),cLabel.Data())))->Fill(fPt, (tofps-fTrkExpTimes[AliPID::kPion])/fSigmaSpecie[AliPID::kPion]);
-    ((TH2F*)fHlist->FindObject(Form("hExpTimePiT0SubVsP%s_%s",suffix.Data(),cLabel.Data())))->Fill(fP,tofps-fTrkExpTimes[AliPID::kPion]-timeZeroTOF);  
-    ((TH2F*)fHlist->FindObject(Form("hExpTimePiVsOutPhi%s_%s",suffix.Data(),cLabel.Data())))->Fill(fTPCOuterPhi,tofps-fTrkExpTimes[AliPID::kPion]-timeZeroTOF);
+    // if (isValidBeta[AliPID::kProton]){
+  //   ((TH2F*)fHlistTRD->FindObject(Form("hExpTimeProVsP%s_%s",suffix.Data(),cLabel.Data())))->Fill(fP, tofps-fTrkExpTimes[AliPID::kProton]);
+  //   ((TH2F*)fHlistTRD->FindObject(Form("hTOFpidSigmaPro%s_%s",suffix.Data(),cLabel.Data())))->Fill(fPt, (tofps-fTrkExpTimes[AliPID::kProton])/fSigmaSpecie[AliPID::kProton]);
+  //   ((TH2F*)fHlistTRD->FindObject(Form("hExpTimeProT0SubVsP%s_%s",suffix.Data(),cLabel.Data())))->Fill(fP,tofps-fTrkExpTimes[AliPID::kProton]-timeZeroTOF);  
+  //   ((TH2F*)fHlistTRD->FindObject(Form("hExpTimeProVsOutPhi%s_%s",suffix.Data(),cLabel.Data())))->Fill(fTPCOuterPhi,tofps-fTrkExpTimes[AliPID::kProton]-timeZeroTOF);
+  // }//end proton  
     
-    if (ComputeTimeZeroByTOF1GeV()){
-      if ((fPt>0.95)&&(fPt<1.05)){
-       ((TH2F*)fHlist->FindObject(Form("hExpTimePiT0Sub1GeV%s_%s",suffix.Data(),cLabel.Data())))->Fill(fMyTimeZeroTOFtracks,tofps-fMyTimeZeroTOF-fTrkExpTimes[AliPID::kPion]);
-      }
-    } 
-  }//end pion
-  
-  if (isValidBeta[AliPID::kKaon]){
-    ((TH2F*)fHlist->FindObject(Form("hExpTimeKaVsP%s_%s",suffix.Data(),cLabel.Data())))->Fill(fP, tofps-fTrkExpTimes[AliPID::kKaon]);
-    ((TH2F*)fHlist->FindObject(Form("hTOFpidSigmaKa%s_%s",suffix.Data(),cLabel.Data())))->Fill(fPt, (tofps-fTrkExpTimes[AliPID::kKaon])/fSigmaSpecie[AliPID::kKaon]);
-    ((TH2F*)fHlist->FindObject(Form("hExpTimeKaT0SubVsP%s_%s",suffix.Data(),cLabel.Data())))->Fill(fP,tofps-fTrkExpTimes[AliPID::kKaon]-timeZeroTOF);  
-    ((TH2F*)fHlist->FindObject(Form("hExpTimeKaVsOutPhi%s_%s",suffix.Data(),cLabel.Data())))->Fill(fTPCOuterPhi,tofps-fTrkExpTimes[AliPID::kKaon]-timeZeroTOF);    
-  }//end kaon  
-  
-  if (isValidBeta[AliPID::kProton]){
-    ((TH2F*)fHlist->FindObject(Form("hExpTimeProVsP%s_%s",suffix.Data(),cLabel.Data())))->Fill(fP, tofps-fTrkExpTimes[AliPID::kProton]);
-    ((TH2F*)fHlist->FindObject(Form("hTOFpidSigmaPro%s_%s",suffix.Data(),cLabel.Data())))->Fill(fPt, (tofps-fTrkExpTimes[AliPID::kProton])/fSigmaSpecie[AliPID::kProton]);
-    ((TH2F*)fHlist->FindObject(Form("hExpTimeProT0SubVsP%s_%s",suffix.Data(),cLabel.Data())))->Fill(fP,tofps-fTrkExpTimes[AliPID::kProton]-timeZeroTOF);  
-    ((TH2F*)fHlist->FindObject(Form("hExpTimeProVsOutPhi%s_%s",suffix.Data(),cLabel.Data())))->Fill(fTPCOuterPhi,tofps-fTrkExpTimes[AliPID::kProton]-timeZeroTOF);
-  }//end proton  
- }
+  } else { 
+    for (Int_t specie = AliPID::kPion; specie <= AliPID::kProton; specie++){
+      if (isValidBeta[specie]){
+       ((TH2F*)fHlist->FindObject(Form("hExpTime%sVsP%s_%s",partName[specie], suffix.Data(),cLabel.Data())))->Fill(fP, tofps-fTrkExpTimes[specie]);
+       ((TH2F*)fHlist->FindObject(Form("hTOFpidSigma%s%s_%s",partName[specie], suffix.Data(),cLabel.Data())))->Fill(fPt, (tofps-fTrkExpTimes[specie])/fSigmaSpecie[specie]);
+       ((TH2F*)fHlist->FindObject(Form("hExpTime%sT0SubVsP%s_%s",partName[specie], suffix.Data(),cLabel.Data())))->Fill(fP,tofps-fTrkExpTimes[specie]-timeZeroTOF);  
+       ((TH2F*)fHlist->FindObject(Form("hExpTime%sVsOutPhi%s_%s",partName[specie], suffix.Data(),cLabel.Data())))->Fill(fTPCOuterPhi,tofps-fTrkExpTimes[specie]-timeZeroTOF);
+       
+       //fill histos for pion only
+       if (specie == AliPID::kPion){
+         ((TH2F*)fHlist->FindObject(Form("hExpTimePiVsStrip%s_%s",suffix.Data(),cLabel.Data())))->Fill((Int_t)GetStripIndex(volId),tofps-fTrkExpTimes[specie]);//ps
+         ((TH1F*)fHlist->FindObject(Form("hExpTimePi%s_%s",suffix.Data(),cLabel.Data())))->Fill(tofps-fTrkExpTimes[specie]);//ps
+         
+         if (ComputeTimeZeroByTOF1GeV()){
+           if ((fPt>0.95)&&(fPt<1.05)){
+             ((TH2F*)fHlist->FindObject(Form("hExpTimePiT0Sub1GeV%s_%s",suffix.Data(),cLabel.Data())))->Fill(fMyTimeZeroTOFtracks,tofps-fMyTimeZeroTOF-fTrkExpTimes[specie]);
+           }
+         } 
+       }//end pion     
+      }// end check on beta
+    }
+    
+    // if (isValidBeta[AliPID::kPion]){
+  //   ((TH2F*)fHlist->FindObject(Form("hExpTimePiVsStrip%s_%s",suffix.Data(),cLabel.Data())))->Fill((Int_t)GetStripIndex(volId),tofps-fTrkExpTimes[AliPID::kPion]);//ps
+  //   ((TH1F*)fHlist->FindObject(Form("hExpTimePi%s_%s",suffix.Data(),cLabel.Data())))->Fill(tofps-fTrkExpTimes[AliPID::kPion]);//ps
+  //   ((TH2F*)fHlist->FindObject(Form("hExpTimePiVsP%s_%s",suffix.Data(),cLabel.Data())))->Fill(fP, tofps-fTrkExpTimes[AliPID::kPion]);
+  //   ((TH2F*)fHlist->FindObject(Form("hTOFpidSigmaPi%s_%s",suffix.Data(),cLabel.Data())))->Fill(fPt, (tofps-fTrkExpTimes[AliPID::kPion])/fSigmaSpecie[AliPID::kPion]);
+  //   ((TH2F*)fHlist->FindObject(Form("hExpTimePiT0SubVsP%s_%s",suffix.Data(),cLabel.Data())))->Fill(fP,tofps-fTrkExpTimes[AliPID::kPion]-timeZeroTOF);  
+  //   ((TH2F*)fHlist->FindObject(Form("hExpTimePiVsOutPhi%s_%s",suffix.Data(),cLabel.Data())))->Fill(fTPCOuterPhi,tofps-fTrkExpTimes[AliPID::kPion]-timeZeroTOF);
+    
+  //   if (ComputeTimeZeroByTOF1GeV()){
+  //     if ((fPt>0.95)&&(fPt<1.05)){
+  //   ((TH2F*)fHlist->FindObject(Form("hExpTimePiT0Sub1GeV%s_%s",suffix.Data(),cLabel.Data())))->Fill(fMyTimeZeroTOFtracks,tofps-fMyTimeZeroTOF-fTrkExpTimes[AliPID::kPion]);
+  //     }
+  //   } 
+  // }//end pion
+  
+  // if (isValidBeta[AliPID::kKaon]){
+  //   ((TH2F*)fHlist->FindObject(Form("hExpTimeKaVsP%s_%s",suffix.Data(),cLabel.Data())))->Fill(fP, tofps-fTrkExpTimes[AliPID::kKaon]);
+  //   ((TH2F*)fHlist->FindObject(Form("hTOFpidSigmaKa%s_%s",suffix.Data(),cLabel.Data())))->Fill(fPt, (tofps-fTrkExpTimes[AliPID::kKaon])/fSigmaSpecie[AliPID::kKaon]);
+  //   ((TH2F*)fHlist->FindObject(Form("hExpTimeKaT0SubVsP%s_%s",suffix.Data(),cLabel.Data())))->Fill(fP,tofps-fTrkExpTimes[AliPID::kKaon]-timeZeroTOF);  
+  //   ((TH2F*)fHlist->FindObject(Form("hExpTimeKaVsOutPhi%s_%s",suffix.Data(),cLabel.Data())))->Fill(fTPCOuterPhi,tofps-fTrkExpTimes[AliPID::kKaon]-timeZeroTOF);    
+  // }//end kaon  
+  
+  // if (isValidBeta[AliPID::kProton]){
+  //   ((TH2F*)fHlist->FindObject(Form("hExpTimeProVsP%s_%s",suffix.Data(),cLabel.Data())))->Fill(fP, tofps-fTrkExpTimes[AliPID::kProton]);
+  //   ((TH2F*)fHlist->FindObject(Form("hTOFpidSigmaPro%s_%s",suffix.Data(),cLabel.Data())))->Fill(fPt, (tofps-fTrkExpTimes[AliPID::kProton])/fSigmaSpecie[AliPID::kProton]);
+  //   ((TH2F*)fHlist->FindObject(Form("hExpTimeProT0SubVsP%s_%s",suffix.Data(),cLabel.Data())))->Fill(fP,tofps-fTrkExpTimes[AliPID::kProton]-timeZeroTOF);  
+  //   ((TH2F*)fHlist->FindObject(Form("hExpTimeProVsOutPhi%s_%s",suffix.Data(),cLabel.Data())))->Fill(fTPCOuterPhi,tofps-fTrkExpTimes[AliPID::kProton]-timeZeroTOF);
+  // }//end proton  
+  }
+  
+  //re-set response kFILL_T0 to check post-alignment wih OADB
+  fESDpid->SetTOFResponse(fESD,AliESDpid::kFILL_T0);//(fill_t0, tof_t0, t0_t0, best_t0)
+  Float_t startTimeFill=fESDpid->GetTOFResponse().GetStartTime(fP); //timeZero for bin pT>10GeV/c
+  ((TH1F*)fHlistPID->FindObject("hExpTimePiFillSub"))->Fill(tofps-fTrkExpTimes[AliPID::kPion]-startTimeFill);//ps
+  
   
   // if (fEnableAdvancedCheck && (fPt<1.)) {
   //   Double_t pos[3]={0.,0.,0.};
@@ -1398,7 +1458,7 @@ void AliAnalysisTaskTOFqaID::FillStartTimeHisto(TString suffix)
     ((TH1D*)(fHlistTimeZero->FindObject(timeZeroHistoRes[j].Data())))->Fill(timeZeroRes[j]);
   }
   ((TH2F*)fHlistTimeZero->FindObject("hT0TOFvsNtrk"))->Fill(fNTOFtracks[0],timeZero[AliESDpid::kTOF_T0]);
-
+   
   //response set to best_t0 by previous loop
   FillStartTimeMaskHisto(suffix.Data());
 
@@ -1417,7 +1477,8 @@ void AliAnalysisTaskTOFqaID::FillTrdHisto(AliESDtrack * track, Int_t charge)
     FillPrimaryTrkHisto(charge,"_Trd");
     if (IsTPCTOFMatched(track)) {      
       FillMatchedTrkHisto(charge,"_Trd");
-      FillPidHisto(track,charge, "_Trd");
+      FillPidHisto
+(track,charge, "_Trd");
     }
   } else {
     FillPrimaryTrkHisto(charge,"_noTrd");    
@@ -1441,11 +1502,11 @@ void AliAnalysisTaskTOFqaID::FillTofTrgHisto(TString suffix)
     return;    
   }
   
-  Int_t nPad = fTOFHeader->GetNumberOfTOFclusters(); // tutti i pad di readout che hanno sparato
-  Int_t nTrgPad = fTOFHeader->GetNumberOfTOFtrgPads();//i pad di readout che hanno sparato nella finesta di trigger
-  Int_t nMaxiPad = fTOFHeader->GetNumberOfTOFmaxipad(); // numero di maxipad che hanno sparato
+  Int_t nPad = fTOFHeader->GetNumberOfTOFclusters(); //all fired readout pads
+  Int_t nTrgPad = fTOFHeader->GetNumberOfTOFtrgPads();// fired readout pads in the trigger window
+  Int_t nMaxiPad = fTOFHeader->GetNumberOfTOFmaxipad(); //fired maxipads
   
-  // aggiornare un histo con le mappe di maxipad che hanno sparato
+  // update histo with fired macropads
   AliTOFTriggerMask *trgMask = fTOFHeader->GetTriggerMask();
   for(Int_t j=0;j<72;j++){
     for(Int_t i=22;i>=0;i--){
index 00bfb5c..45b5918 100644 (file)
@@ -66,7 +66,7 @@ class AliAnalysisTaskTOFqaID : public AliAnalysisTaskSE {
   AliAnalysisFilter * fTrackFilter; //track filter object
   AliESDVertex *      fVertex; //pointer to the vertex object
   AliESDpid *         fESDpid; //pointer to the PID object
-  AliTOFT0v1 *        fTOFT0v1; // TOF-T0 v1
+  //AliTOFT0v1 *        fTOFT0v1; // TOF-T0 v1
   AliTOFHeader *      fTOFHeader; // TOF header needed for trigger info
   Int_t               fNTOFtracks[3]; //number of tracks matching with TOF
   //Int_t fNPrimaryTracks; //number of primary tracks