updates for PbPb running and high p_T QA
authorkleinb <kleinb@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 17 Mar 2011 15:01:49 +0000 (15:01 +0000)
committerkleinb <kleinb@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 17 Mar 2011 15:01:49 +0000 (15:01 +0000)
PWG4/JetTasks/AliPWG4HighPtSpectra.cxx
PWG4/JetTasks/AliPWG4HighPtSpectra.h
PWG4/JetTasks/AliPWG4HighPtTrackQA.cxx
PWG4/JetTasks/AliPWG4HighPtTrackQA.h

index daac60f0f496e8f2d8f2a4555dab6e36aa1b542a..66a6c1bd91af66acb659c393978a7e0d8b70f011 100644 (file)
@@ -14,9 +14,7 @@
  **************************************************************************/
 
 //-----------------------------------------------------------------------
-// Example of task (running locally, on AliEn and CAF),
-// which provides standard way of calculating acceptance and efficiency
-// between different steps of the procedure.
+// Efficiency between different steps of the procedure.
 // The ouptut of the task is a AliCFContainer from which the efficiencies
 // can be calculated
 //-----------------------------------------------------------------------
@@ -46,6 +44,7 @@
 #include "AliESDtrack.h"
 #include "AliESDtrackCuts.h"
 #include "AliExternalTrackParam.h"
+#include "AliCentrality.h"
 
 #include "AliLog.h"
 
@@ -72,14 +71,17 @@ AliPWG4HighPtSpectra::AliPWG4HighPtSpectra() : AliAnalysisTask("AliPWG4HighPtSpe
   fMC(0x0),
   fStack(0x0),
   fVtx(0x0),
+  fIsPbPb(0),
+  fCentClass(10),
   fTrackType(0),
   fTrackCuts(0x0),
-  fTrackCutsTPConly(0x0),
+  fSigmaConstrainedMax(5.),
   fAvgTrials(1),
   fHistList(0),
   fNEventAll(0),
   fNEventSel(0),
   fNEventReject(0),
+  fh1Centrality(0x0),
   fh1Xsec(0),
   fh1Trials(0),
   fh1PtHard(0),
@@ -99,14 +101,17 @@ AliPWG4HighPtSpectra::AliPWG4HighPtSpectra(const Char_t* name) :
   fMC(0x0),
   fStack(0x0),
   fVtx(0x0),
+  fIsPbPb(0),
+  fCentClass(10),
   fTrackType(0),
   fTrackCuts(0x0),
-  fTrackCutsTPConly(0x0),
+  fSigmaConstrainedMax(5.),
   fAvgTrials(1),
   fHistList(0),
   fNEventAll(0),
   fNEventSel(0),
   fNEventReject(0),
+  fh1Centrality(0x0),
   fh1Xsec(0),
   fh1Trials(0),
   fh1PtHard(0),
@@ -135,7 +140,6 @@ void AliPWG4HighPtSpectra::LocalInit()
   // Only called once at beginning
   //
   PostData(3,fTrackCuts);
-  PostData(4,fTrackCutsTPConly);
 }
 
 //________________________________________________________________________
@@ -239,10 +243,51 @@ Bool_t AliPWG4HighPtSpectra::SelectEvent() {
     return selectEvent;
   }
 
+  //Centrality selection should only be done in case of PbPb
+  if(IsPbPb()) {
+    Float_t cent = 0.;
+    if(fCentClass!=CalculateCentrality(fESD) && fCentClass!=10) {
+      fNEventReject->Fill("cent",1);
+      selectEvent = kFALSE;
+      return selectEvent;
+    }
+    else {
+      if(dynamic_cast<AliESDEvent*>(fESD)->GetCentrality()) {
+       cent = dynamic_cast<AliESDEvent*>(fESD)->GetCentrality()->GetCentralityPercentile("V0M");
+      }
+      if(cent>90.) {
+       fNEventReject->Fill("cent>90",1);
+       selectEvent = kFALSE;
+       return selectEvent;     
+      }
+      fh1Centrality->Fill(cent);
+    }
+  }
+
   return selectEvent;
 
 }
 
+//________________________________________________________________________
+Int_t AliPWG4HighPtSpectra::CalculateCentrality(AliESDEvent *esd){
+
+
+  Float_t cent = 999;
+
+  if(esd){
+    if(esd->GetCentrality()){
+      cent = esd->GetCentrality()->GetCentralityPercentile("V0M");
+    }
+  }
+
+  if(cent>80)return 4;
+  if(cent>50)return 3;
+  if(cent>30)return 2;
+  if(cent>10)return 1;
+  return 0;
+
+}
+
 //_________________________________________________
 void AliPWG4HighPtSpectra::Exec(Option_t *)
 {
@@ -305,44 +350,46 @@ void AliPWG4HighPtSpectra::Exec(Option_t *)
   
   
   Double_t containerInputRec[3]       = {0.,0.,0.};
-  Double_t containerInputTPConly[3]   = {0.,0.,0.};
   Double_t containerInputMC[3]        = {0.,0.,0.};
-  Double_t containerInputRecMC[3]     = {0.,0.,0.};
-  Double_t containerInputTPConlyMC[3] = {0.,0.,0.};
+  Double_t containerInputRecMC[3]     = {0.,0.,0.}; //reconstructed yield as function of MC variable
 
   //Now go to rec level
   for (Int_t iTrack = 0; iTrack<nTracks; iTrack++) 
     {   
-      if(!fESD->GetTrack(iTrack) ) continue;
-      AliESDtrack* track = fESD->GetTrack(iTrack);
-      if(!track)continue;
-      AliESDtrack* trackTPCESD = 0;
-      if(fTrackType==0)
-       trackTPCESD = AliESDtrackCuts::GetTPCOnlyTrack(fESD,track->GetID());
-      else if(fTrackType==1) {
-       trackTPCESD = AliESDtrackCuts::GetTPCOnlyTrack(fESD,track->GetID());
-       if(!trackTPCESD) {
+      //Get track for analysis
+      AliESDtrack *track = 0x0;
+      AliESDtrack *esdtrack = fESD->GetTrack(iTrack);
+      if(!esdtrack) continue;
+
+      if(fTrackType==1)
+       track = AliESDtrackCuts::GetTPCOnlyTrack(fESD,esdtrack->GetID());
+      else if(fTrackType==2) {
+       track = AliESDtrackCuts::GetTPCOnlyTrack(fESD,esdtrack->GetID());
+       if(!track) continue;
+
+       AliExternalTrackParam exParam;
+       Bool_t relate = track->RelateToVertexTPC(fVtx,fESD->GetMagneticField(),kVeryBig,&exParam);
+       if( !relate ) {
+         delete track;
          continue;
        }
-      AliExternalTrackParam exParam;
-      Bool_t relate = trackTPCESD->RelateToVertexTPC(fVtx,fESD->GetMagneticField(),kVeryBig,&exParam);
-      if( !relate ) {
-       delete trackTPCESD;
-       continue;
-      }
-      trackTPCESD->Set(exParam.GetX(),exParam.GetAlpha(),exParam.GetParameter(),exParam.GetCovariance());
+       track->Set(exParam.GetX(),exParam.GetAlpha(),exParam.GetParameter(),exParam.GetCovariance());
       }
       else
-       trackTPCESD = track;
+       track = esdtrack;
     
-      if(!trackTPCESD) {
-       delete trackTPCESD;
-       continue;
-      }
       if(!track) {
-       delete trackTPCESD;
+       if(fTrackType==1 || fTrackType==2) delete track;
        continue;
       }
+      if(fTrackType==2) {
+       //Cut on chi2 of constrained fit
+       if(track->GetConstrainedChi2TPC() > fSigmaConstrainedMax*fSigmaConstrainedMax) {
+         delete track;
+         continue;
+       }
+      }
 
 
       //fill the container
@@ -350,43 +397,6 @@ void AliPWG4HighPtSpectra::Exec(Option_t *)
       containerInputRec[1] = track->Phi();
       containerInputRec[2] = track->Eta();
     
-      //Store TPC Inner Params for TPConly tracks
-      containerInputTPConly[0] = trackTPCESD->Pt();
-      containerInputTPConly[1] = trackTPCESD->Phi();
-      containerInputTPConly[2] = trackTPCESD->Eta();
-
-      if(trackTPCESD) {
-       if (fTrackCutsTPConly->AcceptTrack(trackTPCESD)) {
-         if(trackTPCESD->GetSign()>0.) fCFManagerPos->GetParticleContainer()->Fill(containerInputTPConly,kStepReconstructedTPCOnly);
-         if(trackTPCESD->GetSign()<0.) fCFManagerNeg->GetParticleContainer()->Fill(containerInputTPConly,kStepReconstructedTPCOnly);
-
-         //Only fill the MC containers if MC information is available
-         if(fMC) {
-           Int_t label = TMath::Abs(track->GetLabel());
-           TParticle *particle = fStack->Particle(label) ;
-           if(!particle) {
-             delete trackTPCESD;
-             continue;
-           }
-           
-           containerInputTPConlyMC[0] = particle->Pt();      
-           containerInputTPConlyMC[1] = particle->Phi();      
-           containerInputTPConlyMC[2] = particle->Eta();  
-           
-           //Container with primaries
-           if(fStack->IsPhysicalPrimary(label)) {
-             if(particle->GetPDG()->Charge()>0.) {
-               fCFManagerPos->GetParticleContainer()->Fill(containerInputTPConlyMC,kStepReconstructedTPCOnlyMC);
-             }
-             if(particle->GetPDG()->Charge()<0.) {
-               fCFManagerNeg->GetParticleContainer()->Fill(containerInputTPConlyMC,kStepReconstructedTPCOnlyMC);
-             }
-           }
-         }
-         
-       }
-      }
-
       if (fTrackCuts->AcceptTrack(track)) {
        if(track->GetSign()>0.) fCFManagerPos->GetParticleContainer()->Fill(containerInputRec,kStepReconstructed);
        if(track->GetSign()<0.) fCFManagerNeg->GetParticleContainer()->Fill(containerInputRec,kStepReconstructed);
@@ -397,7 +407,8 @@ void AliPWG4HighPtSpectra::Exec(Option_t *)
          Int_t label = TMath::Abs(track->GetLabel());
          TParticle *particle = fStack->Particle(label) ;
          if(!particle) {
-           delete trackTPCESD;
+           if(fTrackType==1 || fTrackType==2)
+             delete track;
            continue;
          }
          containerInputRecMC[0] = particle->Pt();      
@@ -425,9 +436,10 @@ void AliPWG4HighPtSpectra::Exec(Option_t *)
          }
        }
        
-      }//trackCuts
+      }//trackCuts global tracks
 
-      delete trackTPCESD;
+      if(fTrackType==1 || fTrackType==2)
+       delete track;
     }//track loop
   
 
@@ -611,8 +623,21 @@ void AliPWG4HighPtSpectra::CreateOutputObjects() {
   fHistList->Add(fNEventSel);
 
   fNEventReject = new TH1F("fNEventReject","Reason events are rejectected for analysis",20,0,20);
+  //Set labels
+  fNEventReject->Fill("noESD",0);
+  fNEventReject->Fill("Trigger",0);
+  fNEventReject->Fill("NTracks<2",0);
+  fNEventReject->Fill("noVTX",0);
+  fNEventReject->Fill("VtxStatus",0);
+  fNEventReject->Fill("NCont<2",0);
+  fNEventReject->Fill("ZVTX>10",0);
+  fNEventReject->Fill("cent",0);
+  fNEventReject->Fill("cent>90",0);
   fHistList->Add(fNEventReject);
 
+  fh1Centrality = new TH1F("fh1Centrality","fh1Centrality; Centrality %",100,0,100);
+  fHistList->Add(fh1Centrality);
+
   fh1Xsec = new TProfile("fh1Xsec","xsec from pyxsec.root",1,0,1);
   fh1Xsec->GetXaxis()->SetBinLabel(1,"<#sigma>");
   fHistList->Add(fh1Xsec);
index 6e492833408a924d3377d129a8ead1794e08b039..b56cfebe845b282dce6410f528a18dfcc97627f3 100644 (file)
@@ -43,11 +43,9 @@ class AliPWG4HighPtSpectra : public AliAnalysisTask {
 
   enum {
     kStepReconstructed          = 0,
-    kStepReconstructedTPCOnly   = 1,
-    kStepSecondaries            = 2,
-    kStepReconstructedMC        = 3,
-    kStepMCAcceptance           = 4,
-    kStepReconstructedTPCOnlyMC = 5
+    kStepSecondaries            = 1,
+    kStepReconstructedMC        = 2,
+    kStepMCAcceptance           = 3
   };
 
   AliPWG4HighPtSpectra();
@@ -64,20 +62,28 @@ class AliPWG4HighPtSpectra : public AliAnalysisTask {
   virtual void   Terminate(Option_t *);
   virtual Bool_t Notify(); //Copied from AliAnalysisTaskJetSpectrum2
 
+  Bool_t IsPbPb() {return fIsPbPb;}  //is PbPb data?
   Bool_t SelectEvent();    //decides if event is used for analysis
+  Int_t CalculateCentrality(AliESDEvent *esd);
 
+  //Setters
+  void SetIsPbPb(Bool_t cs)                {fIsPbPb = cs;}
+  void SetCentralityClass(int cent)        {fCentClass=cent;}
   // CORRECTION FRAMEWORK RELATED FUNCTIONS
   void     SetCFManagerPos(const AliCFManager* io1) {fCFManagerPos = io1;}   // global correction manager 
   const AliCFManager * GetCFManagerPos() const {return fCFManagerPos;}           // get corr manager 
   void     SetCFManagerNeg(const AliCFManager* io2) {fCFManagerNeg = io2;}   // global correction manager 
   const AliCFManager * GetCFManagerNeg() const {return fCFManagerNeg;}            // get corr manager
-  
-  //if fTrackType=0 (GlobalStandard and TPConly)
-  //if fTrackType=0 (GlobalITSrefit and TPConly constrained)
+
+  //if fTrackType=0 (Global)
+  //if fTrackType=1 (TPConly)
+  //if fTrackType=2 (TPConly constrained)
   void SetTrackType(Int_t trackType) {fTrackType = trackType;}
   //AliESDtrackCuts setters
   void SetCuts(AliESDtrackCuts* trackCuts) {fTrackCuts = trackCuts;}
-  void SetCutsTPConly(AliESDtrackCuts* trackCuts) {fTrackCutsTPConly = trackCuts;}
+
+  void SetSigmaConstrainedMax(Double_t sigma) {fSigmaConstrainedMax=sigma;}
 
   // Data types
   Bool_t IsReadAODData()   const {return fReadAODData;}
@@ -97,11 +103,14 @@ class AliPWG4HighPtSpectra : public AliAnalysisTask {
 
   const AliESDVertex   *fVtx;     //! vertex object
 
+  Bool_t   fIsPbPb;               //  kTRUE if PbPb
+  Int_t fCentClass;               // Select only events from predefined centrality class
 
   Int_t   fTrackType;     // Type of track to be used in analysis
   //AliESDtrackCuts options. Must be setted in AddTaskPWG4HighPTSpectra.C. They correspond with different steps in container.
   AliESDtrackCuts *fTrackCuts;           // trackCuts applied to global tracks
-  AliESDtrackCuts *fTrackCutsTPConly;    // trackCuts applied to TPConly tracks
+
+  Double_t fSigmaConstrainedMax;  // max sigma on constrained fit
 
  private:
   AliPWG4HighPtSpectra(const AliPWG4HighPtSpectra&);
@@ -114,14 +123,16 @@ class AliPWG4HighPtSpectra : public AliAnalysisTask {
   TList *fHistList;             //! List of output histograms
   TH1F  *fNEventAll;            //! Event counter
   TH1F  *fNEventSel;            //! Event counter: Selected events for analysis
-  TH1F *fNEventReject;          //! Book keeping of reason of rejecting events
+  TH1F  *fNEventReject;         //! Book keeping of reason of rejecting events
+
+  TH1F *fh1Centrality;                         //! Centrality
 
   TProfile*     fh1Xsec;                       //! pythia cross section and trials
   TH1F*         fh1Trials;                     //! trials which are added
   TH1F*         fh1PtHard;                     //! pt hard of the event
   TH1F*         fh1PtHardTrials;               //! pt hard of the event
 
-  ClassDef(AliPWG4HighPtSpectra,2);
+  ClassDef(AliPWG4HighPtSpectra,3);
 };
 
 #endif
index cfedea758a3e28d8c578b2409eea98ea952127cc..4bbd5997a4e63d6bd11271a70beb2f697e9f1867 100644 (file)
@@ -67,10 +67,11 @@ AliPWG4HighPtTrackQA::AliPWG4HighPtTrackQA()
   fTrackCuts(0), 
   fTrackType(0),
   fFilterMask(0),
+  fSigmaConstrainedMax(5.),
   fPtMax(100.),
   fIsPbPb(0),
   fCentClass(10),
-  fNVariables(13),
+  fNVariables(18),
   fVariables(0x0),
   fAvgTrials(1),
   fNEventAll(0),
@@ -95,13 +96,19 @@ AliPWG4HighPtTrackQA::AliPWG4HighPtTrackQA()
   fPtChi2C(0x0),
   fPtNSigmaToVertex(0x0),
   fPtRelUncertainty1Pt(0x0),
+  fPtUncertainty1Pt(0x0),
   fPtChi2PerClusterTPC(0x0),
   fPtNCrossedRows(0x0),
   fPtNCrossedRowsNClusF(0x0),
   fPtNCrRNCrRNClusF(0x0),
+  fPtSigmaY2(0x0),
+  fPtSigmaZ2(0x0),
+  fPtSigmaSnp2(0x0),
+  fPtSigmaTgl2(0x0),
+  fPtSigma1Pt2(0x0),
   fHistList(0)
 {
-  SetNVariables(13);
+  SetNVariables(18);
 }
 //________________________________________________________________________
 AliPWG4HighPtTrackQA::AliPWG4HighPtTrackQA(const char *name): 
@@ -113,10 +120,11 @@ AliPWG4HighPtTrackQA::AliPWG4HighPtTrackQA(const char *name):
   fTrackCuts(),
   fTrackType(0),
   fFilterMask(0),
+  fSigmaConstrainedMax(5.),
   fPtMax(100.),
   fIsPbPb(0),
   fCentClass(10),
-  fNVariables(13),
+  fNVariables(18),
   fVariables(0x0),
   fAvgTrials(1),
   fNEventAll(0),
@@ -141,10 +149,16 @@ AliPWG4HighPtTrackQA::AliPWG4HighPtTrackQA(const char *name):
   fPtChi2C(0x0),
   fPtNSigmaToVertex(0x0),
   fPtRelUncertainty1Pt(0x0),
+  fPtUncertainty1Pt(0x0),
   fPtChi2PerClusterTPC(0x0),
   fPtNCrossedRows(0x0),
   fPtNCrossedRowsNClusF(0x0),
   fPtNCrRNCrRNClusF(0x0),
+  fPtSigmaY2(0x0),
+  fPtSigmaZ2(0x0),
+  fPtSigmaSnp2(0x0),
+  fPtSigmaTgl2(0x0),
+  fPtSigma1Pt2(0x0),
   fHistList(0)
 {
   //
@@ -152,7 +166,7 @@ AliPWG4HighPtTrackQA::AliPWG4HighPtTrackQA(const char *name):
   //
   AliDebug(2,Form("AliPWG4HighPtTrackQA Calling Constructor"));
 
-  SetNVariables(13);
+  SetNVariables(18);
 
   // Input slot #0 works with a TChain ESD
   DefineInput(0, TChain::Class());
@@ -228,12 +242,20 @@ void AliPWG4HighPtTrackQA::UserCreateOutputObjects() {
   Int_t fgkNDCA2DBins=80;
   Float_t fgkDCA2DMin = -0.2;
   Float_t fgkDCA2DMax = 0.2;
+  if(fTrackType==1 || fTrackType==2) {
+    fgkDCA2DMin = -2.;
+    fgkDCA2DMax = 2.;
+  }
   Double_t *binsDCA2D=new Double_t[fgkNDCA2DBins+1];
   for(Int_t i=0; i<=fgkNDCA2DBins; i++) binsDCA2D[i]=(Double_t)fgkDCA2DMin + (fgkDCA2DMax-fgkDCA2DMin)/fgkNDCA2DBins*(Double_t)i ;
 
   Int_t fgkNDCAZBins=80;
   Float_t fgkDCAZMin = -2.;
   Float_t fgkDCAZMax = 2.;
+  if(fTrackType==1 || fTrackType==2) {
+    fgkDCAZMin = -5.;
+    fgkDCAZMax = 5.;
+  }
   Double_t *binsDCAZ=new Double_t[fgkNDCAZBins+1];
   for(Int_t i=0; i<=fgkNDCAZBins; i++) binsDCAZ[i]=(Double_t)fgkDCAZMin + (fgkDCAZMax-fgkDCAZMin)/fgkNDCAZBins*(Double_t)i ;
 
@@ -251,16 +273,24 @@ void AliPWG4HighPtTrackQA::UserCreateOutputObjects() {
 
   Int_t fgkNChi2CBins=20;
   Float_t fgkChi2CMin = 0.;
-  Float_t fgkChi2CMax = 10.;
+  Float_t fgkChi2CMax = 100.;
   Double_t *binsChi2C=new Double_t[fgkNChi2CBins+1];
   for(Int_t i=0; i<=fgkNChi2CBins; i++) binsChi2C[i]=(Double_t)fgkChi2CMin + (fgkChi2CMax-fgkChi2CMin)/fgkNChi2CBins*(Double_t)i ;
 
   Int_t fgkNRel1PtUncertaintyBins=30;
   Float_t fgkRel1PtUncertaintyMin = 0.;
   Float_t fgkRel1PtUncertaintyMax = 0.3;
+  if(fTrackType==1 || fTrackType==2) fgkRel1PtUncertaintyMax = 0.5; 
   Double_t *binsRel1PtUncertainty=new Double_t[fgkNRel1PtUncertaintyBins+1];
   for(Int_t i=0; i<=fgkNRel1PtUncertaintyBins; i++) binsRel1PtUncertainty[i]=(Double_t)fgkRel1PtUncertaintyMin + (fgkRel1PtUncertaintyMax-fgkRel1PtUncertaintyMin)/fgkNRel1PtUncertaintyBins*(Double_t)i ;
 
+  Int_t fgkNUncertainty1PtBins = 30;
+  Float_t fgkUncertainty1PtMin = 0.;
+  Float_t fgkUncertainty1PtMax = 0.1;
+  if(fTrackType==1 || fTrackType==2) fgkUncertainty1PtMax = 0.2; 
+  Double_t *binsUncertainty1Pt=new Double_t[fgkNUncertainty1PtBins+1];
+  for(Int_t i=0; i<=fgkNUncertainty1PtBins; i++) binsUncertainty1Pt[i]=(Double_t)fgkUncertainty1PtMin + (fgkUncertainty1PtMax-fgkUncertainty1PtMin)/fgkNUncertainty1PtBins*(Double_t)i ;
+
   Float_t fgkChi2PerClusMin = 0.;
   Float_t fgkChi2PerClusMax = 4.;
   Int_t fgkNChi2PerClusBins = (int)(fgkChi2PerClusMax*10.);
@@ -273,6 +303,43 @@ void AliPWG4HighPtTrackQA::UserCreateOutputObjects() {
   Double_t *binsNCrossedRowsNClusF=new Double_t[fgkNCrossedRowsNClusFBins+1];
   for(Int_t i=0; i<=fgkNCrossedRowsNClusFBins; i++) binsNCrossedRowsNClusF[i]=(Double_t)fgkNCrossedRowsNClusFMin + (fgkNCrossedRowsNClusFMax-fgkNCrossedRowsNClusFMin)/fgkNCrossedRowsNClusFBins*(Double_t)i ;
 
+  Int_t fgkN1PtBins = 50;
+  Float_t fgk1PtMin = 0.;
+  Float_t fgk1PtMax = 6.;
+  Double_t *bins1Pt=new Double_t[fgkN1PtBins+1];
+  for(Int_t i=0; i<=fgkN1PtBins; i++) bins1Pt[i]=(Double_t)fgk1PtMin + (fgk1PtMax-fgk1PtMin)/fgkN1PtBins*(Double_t)i ;
+
+  Int_t fgkNSigmaY2Bins = 50;
+  Float_t fgkSigmaY2Min = 0.;
+  Float_t fgkSigmaY2Max = 2.;
+  Double_t *binsSigmaY2=new Double_t[fgkNSigmaY2Bins+1];
+  for(Int_t i=0; i<=fgkNSigmaY2Bins; i++) binsSigmaY2[i]=(Double_t)fgkSigmaY2Min + (fgkSigmaY2Max-fgkSigmaY2Min)/fgkNSigmaY2Bins*(Double_t)i ;
+
+  Int_t fgkNSigmaZ2Bins = 50;
+  Float_t fgkSigmaZ2Min = 0.;
+  Float_t fgkSigmaZ2Max = 2.;
+  Double_t *binsSigmaZ2=new Double_t[fgkNSigmaZ2Bins+1];
+  for(Int_t i=0; i<=fgkNSigmaZ2Bins; i++) binsSigmaZ2[i]=(Double_t)fgkSigmaZ2Min + (fgkSigmaZ2Max-fgkSigmaZ2Min)/fgkNSigmaZ2Bins*(Double_t)i ;
+
+  Int_t fgkNSigmaSnp2Bins = 50;
+  Float_t fgkSigmaSnp2Min = 0.;
+  Float_t fgkSigmaSnp2Max = 2.;
+  Double_t *binsSigmaSnp2=new Double_t[fgkNSigmaSnp2Bins+1];
+  for(Int_t i=0; i<=fgkNSigmaSnp2Bins; i++) binsSigmaSnp2[i]=(Double_t)fgkSigmaSnp2Min + (fgkSigmaSnp2Max-fgkSigmaSnp2Min)/fgkNSigmaSnp2Bins*(Double_t)i ;
+
+  Int_t fgkNSigmaTgl2Bins = 50;
+  Float_t fgkSigmaTgl2Min = 0.;
+  Float_t fgkSigmaTgl2Max = 2.;
+  Double_t *binsSigmaTgl2=new Double_t[fgkNSigmaTgl2Bins+1];
+  for(Int_t i=0; i<=fgkNSigmaTgl2Bins; i++) binsSigmaTgl2[i]=(Double_t)fgkSigmaTgl2Min + (fgkSigmaTgl2Max-fgkSigmaTgl2Min)/fgkNSigmaTgl2Bins*(Double_t)i ;
+
+  Int_t fgkNSigma1Pt2Bins = 50;
+  Float_t fgkSigma1Pt2Min = 0.;
+  Float_t fgkSigma1Pt2Max = 2.;
+  Double_t *binsSigma1Pt2=new Double_t[fgkNSigma1Pt2Bins+1];
+  for(Int_t i=0; i<=fgkNSigma1Pt2Bins; i++) binsSigma1Pt2[i]=(Double_t)fgkSigma1Pt2Min + (fgkSigma1Pt2Max-fgkSigma1Pt2Min)/fgkNSigma1Pt2Bins*(Double_t)i ;
+
+
   fNEventAll = new TH1F("fNEventAll","NEventAll",1,-0.5,0.5);
   fHistList->Add(fNEventAll);
   fNEventSel = new TH1F("fNEventSel","NEvent Selected for analysis",1,-0.5,0.5);
@@ -317,6 +384,7 @@ void AliPWG4HighPtTrackQA::UserCreateOutputObjects() {
   fh1NTracksReject->Fill("relate",0);
   fh1NTracksReject->Fill("trackCuts",0);
   fh1NTracksReject->Fill("laser",0);
+  fh1NTracksReject->Fill("chi2",0);
   fHistList->Add(fh1NTracksReject);
 
   fh1NTracksSel = new TH1F("fh1NTracksSel","fh1NTracksSel",1,-0.5,0.5);
@@ -354,6 +422,9 @@ void AliPWG4HighPtTrackQA::UserCreateOutputObjects() {
 
   fPtRelUncertainty1Pt = new TH2F("fPtRelUncertainty1Pt","fPtRelUncertainty1Pt",fgkNPtBins,binsPt,fgkNRel1PtUncertaintyBins,binsRel1PtUncertainty);
   fHistList->Add(fPtRelUncertainty1Pt);
+
+  fPtUncertainty1Pt = new TH2F("fPtUncertainty1Pt","fPtUncertainty1Pt",fgkNPtBins,binsPt,fgkNUncertainty1PtBins,binsUncertainty1Pt);
+  fHistList->Add(fPtUncertainty1Pt);
  
   fPtChi2PerClusterTPC = new TH2F("fPtChi2PerClusterTPC","fPtChi2PerClusterTPC",fgkNPtBins,binsPt,fgkNChi2PerClusBins,binsChi2PerClus);
   fHistList->Add(fPtChi2PerClusterTPC);
@@ -366,7 +437,22 @@ void AliPWG4HighPtTrackQA::UserCreateOutputObjects() {
  
   fPtNCrRNCrRNClusF = new TH3F("fPtNCrRNCrRNClusF","fPtNCrRNCrRNClusF",fgkNPtBins,binsPt,fgkNNClustersTPCBins,binsNClustersTPC,fgkNCrossedRowsNClusFBins,binsNCrossedRowsNClusF);
   fHistList->Add(fPtNCrRNCrRNClusF);
+
+  fPtSigmaY2 = new TH2F("fPtSigmaY2","fPtSigmaY2",fgkN1PtBins,bins1Pt,fgkNSigmaZ2Bins,binsSigmaY2);
+  fHistList->Add(fPtSigmaY2);
+
+  fPtSigmaZ2 = new TH2F("fPtSigmaZ2","fPtSigmaZ2",fgkN1PtBins,bins1Pt,fgkNSigmaZ2Bins,binsSigmaZ2);
+  fHistList->Add(fPtSigmaZ2);
+
+  fPtSigmaSnp2 = new TH2F("fPtSigmaSnp2","fPtSigmaSnp2",fgkN1PtBins,bins1Pt,fgkNSigmaZ2Bins,binsSigmaSnp2);
+  fHistList->Add(fPtSigmaSnp2);
+
+  fPtSigmaTgl2 = new TH2F("fPtSigmaTgl2","fPtSigmaTgl2",fgkN1PtBins,bins1Pt,fgkNSigmaZ2Bins,binsSigmaTgl2);
+  fHistList->Add(fPtSigmaTgl2);
+
+  fPtSigma1Pt2 = new TH2F("fPtSigma1Pt2","fPtSigma1Pt2",fgkN1PtBins,bins1Pt,fgkNSigmaZ2Bins,binsSigma1Pt2);
+  fHistList->Add(fPtSigma1Pt2);
+
   TH1::AddDirectory(oldStatus); 
 
   PostData(1, fHistList);
@@ -381,8 +467,15 @@ void AliPWG4HighPtTrackQA::UserCreateOutputObjects() {
   if(binsChi2C)             delete [] binsChi2C;
   if(binsEta)               delete [] binsEta;
   if(binsRel1PtUncertainty) delete [] binsRel1PtUncertainty;
+  if(binsUncertainty1Pt)    delete [] binsUncertainty1Pt;
   if(binsChi2PerClus)       delete [] binsChi2PerClus;
   if(binsChi2PerClus)       delete [] binsNCrossedRowsNClusF;
+  if(bins1Pt)               delete [] bins1Pt;
+  if(binsSigmaY2)           delete [] binsSigmaY2;
+  if(binsSigmaZ2)           delete [] binsSigmaZ2;
+  if(binsSigmaSnp2)         delete [] binsSigmaSnp2;
+  if(binsSigmaTgl2)         delete [] binsSigmaTgl2;
+  if(binsSigma1Pt2)         delete [] binsSigma1Pt2;
 }
 
 //________________________________________________________________________
@@ -633,13 +726,18 @@ void AliPWG4HighPtTrackQA::DoAnalysisESD() {
     10: chi2PerClusterTPC
     11: #crossed rows
     12: (#crossed rows)/(#findable clusters)
+    13: SigmaY2
+    14: SigmaZ2
+    15: SigmaSnp2
+    16: SigmaTgl2
+    17: Sigma1Pt2
   */
 
   for (Int_t iTrack = 0; iTrack < nTracks; iTrack++) {
     fh1NTracksAll->Fill(0.);
 
     //Get track for analysis
-    AliESDtrack *track;
+    AliESDtrack *track = 0x0;
     AliESDtrack *esdtrack = fESD->GetTrack(iTrack);
     if(!esdtrack) {
       fh1NTracksReject->Fill("noESDtrack",1);
@@ -671,6 +769,15 @@ void AliPWG4HighPtTrackQA::DoAnalysisESD() {
       continue;
     }
 
+    if(fTrackType==2) {
+      //Cut on chi2 of constrained fit
+      if(track->GetConstrainedChi2TPC() > fSigmaConstrainedMax*fSigmaConstrainedMax) {
+       fh1NTracksReject->Fill("chi2",1);
+       delete track;
+       continue;
+      }
+    }
+
     fPtAll->Fill(track->Pt());
 
     if (!(fTrackCuts->AcceptTrack(track))) {
@@ -688,9 +795,9 @@ void AliPWG4HighPtTrackQA::DoAnalysisESD() {
 
     fVariables->Reset(0.);
       
-    fVariables->SetAt(track->Pt(),0);
-    fVariables->SetAt(track->Phi(),1);
-    fVariables->SetAt(track->Eta(),2);
+    fVariables->SetAt(track->Pt(),0); 
+    fVariables->SetAt(track->Phi(),1); 
+    fVariables->SetAt(track->Eta(),2); 
 
     Float_t dca2D = 0.;
     Float_t dcaz  = 0.;
@@ -701,7 +808,7 @@ void AliPWG4HighPtTrackQA::DoAnalysisESD() {
       track->GetImpactParametersTPC(dca2D,dcaz);
     }
     fVariables->SetAt(dca2D,3);
-    fVariables->SetAt(dcaz,5);
+    fVariables->SetAt(dcaz,4);
 
     fVariables->SetAt((float)track->GetTPCNcls(),5);
 
@@ -712,7 +819,10 @@ void AliPWG4HighPtTrackQA::DoAnalysisESD() {
        nPointITS ++;
     }
     fVariables->SetAt((float)nPointITS,6);
-    fVariables->SetAt(track->GetConstrainedChi2(),7);
+    Float_t chi2C = (float)track->GetConstrainedChi2();
+    if(fTrackType==1 || fTrackType==2)
+      chi2C = (float)track->GetConstrainedChi2TPC();
+    fVariables->SetAt(chi2C,7);
     fVariables->SetAt(fTrackCuts->GetSigmaToVertex(track),8);// Calculates the number of sigma to the vertex for a track.
   
     fVariables->SetAt(TMath::Sqrt(track->GetSigma1Pt2())*fVariables->At(0),9);
@@ -725,6 +835,11 @@ void AliPWG4HighPtTrackQA::DoAnalysisESD() {
     Float_t crossedRowsTPCNClsF = track->GetTPCClusterInfo(2,0);
     //if(track->GetTPCNclsF()>0.) crossedRowsTPCNClsF = fVariables->At(11)/track->GetTPCNclsF();
     fVariables->SetAt(crossedRowsTPCNClsF,12);//(#crossed rows)/(#findable clusters)
+    fVariables->SetAt(track->GetSigmaY2(),13);
+    fVariables->SetAt(track->GetSigmaZ2(),14);
+    fVariables->SetAt(track->GetSigmaSnp2(),15);
+    fVariables->SetAt(track->GetSigmaTgl2(),16);
+    fVariables->SetAt(track->GetSigma1Pt2(),17);
     
     FillHistograms();
   
@@ -792,6 +907,12 @@ void AliPWG4HighPtTrackQA::FillHistograms() {
     fPtChi2C->Fill(fVariables->At(0),fVariables->At(7));
     fPtNSigmaToVertex->Fill(fVariables->At(0),fVariables->At(8));
     fPtRelUncertainty1Pt->Fill(fVariables->At(0),fVariables->At(9));
+    fPtUncertainty1Pt->Fill(fVariables->At(0),fVariables->At(0)/fVariables->At(9));
+    fPtSigmaY2->Fill(1./fVariables->At(0),TMath::Sqrt(fVariables->At(13)));
+    fPtSigmaZ2->Fill(1./fVariables->At(0),TMath::Sqrt(fVariables->At(14)));
+    fPtSigmaSnp2->Fill(1./fVariables->At(0),TMath::Sqrt(fVariables->At(15)));
+    fPtSigmaTgl2->Fill(1./fVariables->At(0),TMath::Sqrt(fVariables->At(16)));
+    fPtSigma1Pt2->Fill(1./fVariables->At(0),TMath::Sqrt(fVariables->At(17)));
   }
   fPtChi2PerClusterTPC->Fill(fVariables->At(0),fVariables->At(10));
   fPtNCrossedRows->Fill(fVariables->At(0),fVariables->At(11));
index 83c266f1700c1b4e72b8b210c5c582fb7cd5a9e6..17f7e6525f30f9d16edc8cfe6cc92994638d0004 100644 (file)
@@ -14,7 +14,8 @@
  **************************************************************************/
 
 //-----------------------------------------------------------------------
-// This class compares the global reconstruction with the MC information
+// This class stores QA variables as function of pT for different type
+// of tracks and track selection criteria
 // Author : Marta Verweij - UU
 //-----------------------------------------------------------------------
 
@@ -73,6 +74,7 @@ class AliPWG4HighPtTrackQA: public AliAnalysisTaskSE {
   void SetTrackType(Int_t trackType) {fTrackType = trackType;}
   void SetFilterMask(UInt_t filterMask)    {fFilterMask = filterMask;}
 
+  void SetSigmaConstrainedMax(Double_t sigma) {fSigmaConstrainedMax=sigma;}
   void SetPtMax(Float_t ptmax) {fPtMax = ptmax;}
   void SetNVariables(Int_t nv) {fNVariables = nv;}
 
@@ -98,6 +100,7 @@ class AliPWG4HighPtTrackQA: public AliAnalysisTaskSE {
   Int_t   fTrackType;             // 0: global track; 1:TPConly track 2: TPConly constrained track 3: global ITSrefit
   UInt_t fFilterMask;             //! Select tracks from specific track cuts belonging to certain filter mask for AOD analysis
 
+  Double_t fSigmaConstrainedMax;  // max sigma on constrained fit
   Float_t fPtMax;                 // Maximum pT for histograms
 
   Bool_t   fIsPbPb;               //  kTRUE if PbPb
@@ -149,11 +152,18 @@ class AliPWG4HighPtTrackQA: public AliAnalysisTaskSE {
   TH2F *fPtChi2C;                              //! Pt vs Chi2C
   TH2F *fPtNSigmaToVertex;                     //! Pt vs nSigmaToVertex
   TH2F *fPtRelUncertainty1Pt;                  //! Pt vs relUncertainty1Pt
+  TH2F *fPtUncertainty1Pt;                   //! Pt vs Uncertainty1Pt
   TH2F *fPtChi2PerClusterTPC;                  //! Pt vs Chi2PerClusterTPC
   TH2F *fPtNCrossedRows;                       //! Pt vs NCrossedRows
   TH2F *fPtNCrossedRowsNClusF;                 //! Pt vs NCrossedRows/NClusF
   TH3F *fPtNCrRNCrRNClusF;                     //! Pt vs NCrossedRows vs NCrossedRows/NClusF 
 
+  //histos for covariance matrix elements
+  TH2F *fPtSigmaY2;                            //! Pt vs sigma(y)^2 extCov[0]
+  TH2F *fPtSigmaZ2;                            //! Pt vs sigma(z)^2 extCov[2]
+  TH2F *fPtSigmaSnp2;                          //! Pt vs sigma(Snp)^2 extCov[5]
+  TH2F *fPtSigmaTgl2;                          //! Pt vs sigma(Tgl)^2 extCov[9]
+  TH2F *fPtSigma1Pt2;                          //! Pt vs sigma(1/pT)^2 extCov[14]
 
   TList *fHistList; //! List of Histograms