#include <AliESD.h>
#include <AliESDEvent.h>
#include <AliESDVertex.h>
+#include <AliVertexerTracks.h>
#include <AliGenEventHeader.h>
#include <AliGenPythiaEventHeader.h>
//
// this function needs the branch fTriggerMask
-
// definitions from p-p.cfg
ULong64_t spdFO = (1 << 14);
ULong64_t v0left = (1 << 11);
return kTRUE;
break;
}
+ case kSPDFASTOR:
+ {
+ if (triggerMask & spdFO)
+ return kTRUE;
+ break;
+ }
}
return kFALSE;
}
//____________________________________________________________________
-Bool_t AliPWG0Helper::IsVertexReconstructed(const AliESD* aEsd)
+Bool_t AliPWG0Helper::TestVertex(const AliESDVertex* vertex, AnalysisMode analysisMode, Bool_t debug)
{
- // see function with AliESDVertex argument
-
- const AliESDVertex* vtxESD = aEsd->GetVertex();
- return IsVertexReconstructed(vtxESD);
-}
-
-//____________________________________________________________________
-Bool_t AliPWG0Helper::IsVertexReconstructed(const AliESDVertex* vtxESD)
-{
- // checks if the vertex is reasonable
- //
- // this function needs the branches fSPDVertex*
-
- if (!vtxESD)
- return kFALSE;
+ // Checks if a vertex meets the needed quality criteria
- // the vertex should be reconstructed
- if (strcmp(vtxESD->GetName(), "default")==0)
- return kFALSE;
-
- // check Ncontributors
- if (vtxESD->GetNContributors() <= 0)
- return kFALSE;
+ Float_t requiredZResolution = -1;
+ if (analysisMode == kSPD || analysisMode == kTPCITS)
+ {
+ requiredZResolution = 0.1;
+ }
+ else if (analysisMode == kTPC)
+ requiredZResolution = 10.;
- Double_t vtx_res[3];
- vtx_res[0] = vtxESD->GetXRes();
- vtx_res[1] = vtxESD->GetYRes();
- vtx_res[2] = vtxESD->GetZRes();
+ // check resolution
+ Double_t zRes = vertex->GetZRes();
- if (vtx_res[2]==0 || vtx_res[2]>0.1)
+ if (zRes > requiredZResolution) {
+ if (debug)
+ Printf("AliPWG0Helper::TestVertex: Resolution too poor %f (required: %f", zRes, requiredZResolution);
return kFALSE;
+ }
return kTRUE;
}
//____________________________________________________________________
-const AliESDVertex* AliPWG0Helper::GetVertex(const AliESDEvent* aEsd, AnalysisMode analysisMode, Bool_t debug)
+const AliESDVertex* AliPWG0Helper::GetVertex(AliESDEvent* aEsd, AnalysisMode analysisMode, Bool_t debug,Bool_t bRedoTPC)
{
// Get the vertex from the ESD and returns it if the vertex is valid
//
// also the quality criteria that are applied)
const AliESDVertex* vertex = 0;
- Float_t requiredZResolution = -1;
if (analysisMode == kSPD || analysisMode == kTPCITS)
{
vertex = aEsd->GetPrimaryVertexSPD();
- requiredZResolution = 0.1;
if (debug)
Printf("AliPWG0Helper::GetVertex: Returning SPD vertex");
}
- else if (analysisMode == kTPC)
+ else if (analysisMode == kTPC)
{
+ if(bRedoTPC){
+ Double_t kBz = aEsd->GetMagneticField();
+ AliVertexerTracks vertexer(kBz);
+ vertexer.SetTPCMode();
+ AliESDVertex *vTPC = vertexer.FindPrimaryVertex(aEsd);
+ aEsd->SetPrimaryVertexTPC(vTPC);
+ for (Int_t i=0; i<aEsd->GetNumberOfTracks(); i++) {
+ AliESDtrack *t = aEsd->GetTrack(i);
+ t->RelateToVertexTPC(vTPC, kBz, kVeryBig);
+ }
+ delete vTPC;
+ }
+
vertex = aEsd->GetPrimaryVertexTPC();
- requiredZResolution = 0.6;
if (debug)
Printf("AliPWG0Helper::GetVertex: Returning vertex from tracks");
}
// check Ncontributors
if (vertex->GetNContributors() <= 0) {
- if (debug)
- Printf("AliPWG0Helper::GetVertex: NContributors() <= 0");
+ if (debug){
+ Printf("AliPWG0Helper::GetVertex: NContributors() <= 0: %d",vertex->GetNContributors());
+ Printf("AliPWG0Helper::GetVertex: NIndices(): %d",vertex->GetNIndices());
+ vertex->Print();
+ }
return 0;
}
// check resolution
Double_t zRes = vertex->GetZRes();
-
- if (zRes == 0 || zRes > requiredZResolution) {
- if (debug)
- Printf("AliPWG0Helper::GetVertex: Resolution too poor %f (required: %f", zRes, requiredZResolution);
+ if (zRes == 0) {
+ Printf("AliPWG0Helper::GetVertex: UNEXPECTED: resolution is 0.");
return 0;
}
if (debug)
- Printf("AliPWG0Helper::GetVertex: Returning valid vertex");
+ {
+ Printf("AliPWG0Helper::GetVertex: Returning valid vertex: %s", vertex->GetTitle());
+ vertex->Print();
+ }
return vertex;
}
}
Int_t pdgCode = TMath::Abs(aParticle->GetPdgCode());
+
// skip quarks and gluon
if (pdgCode <= 10 || pdgCode == 21)
return kFALSE;
}
+ Int_t status = aParticle->GetStatusCode();
+ // skip non final state particles..
+ if(status!=1){
+ if (adebug)
+ printf("Dropping particle because it is not a final state particle.\n");
+ return kFALSE;
+ }
+
if (strcmp(aParticle->GetName(),"XXX") == 0)
{
- if (adebug)
- printf("WARNING: There is a particle named XXX.\n");
+ Printf("WARNING: There is a particle named XXX (pdg code %d).", pdgCode);
return kFALSE;
}
if (strcmp(pdgPart->ParticleClass(),"Unknown") == 0)
{
- if (adebug)
- printf("WARNING: There is a particle with an unknown particle class (pdg code %d).\n", pdgCode);
+ Printf("WARNING: There is a particle with an unknown particle class (pdg code %d).", pdgCode);
return kFALSE;
}
}
-Int_t AliPWG0Helper::GetPythiaEventProcessType(AliGenEventHeader* aHeader, Bool_t adebug) {
+AliPWG0Helper::MCProcessType AliPWG0Helper::GetPythiaEventProcessType(AliGenEventHeader* aHeader, Bool_t adebug) {
AliGenPythiaEventHeader* pythiaGenHeader = dynamic_cast<AliGenPythiaEventHeader*>(aHeader);
}
-Int_t AliPWG0Helper::GetDPMjetEventProcessType(AliGenEventHeader* aHeader, Bool_t adebug) {
+AliPWG0Helper::MCProcessType AliPWG0Helper::GetDPMjetEventProcessType(AliGenEventHeader* aHeader, Bool_t adebug) {
//
// get the process type of the event.
//
}
-Int_t AliPWG0Helper::GetEventProcessType(AliHeader* aHeader, Bool_t adebug) {
+AliPWG0Helper::MCProcessType AliPWG0Helper::GetEventProcessType(AliHeader* aHeader, Bool_t adebug) {
//
// get the process type of the event.
//
return label;
}
-void AliPWG0Helper::SetBranchStatusRecursive(TTree* tree, char *bname, Bool_t status, Bool_t debug)
-{
- // Function to switch on/off all data members of a top level branch
- // this is needed for branches without a trailing dot ".", for those
- // the root functionality with regular expressions does not work.
- // Usage e.g.
- // chain->SetBranchStatus("*", 0);
- // SetBranchStatusRecursive(chain,"SPDVertex",1);
- // You need to give the full name of the top level branch zou want to access
- //==========================================================================
- // Author Christian.Klein-Boesing@cern.ch
-
- if (!tree)
- return;
-
- TBranch *br = tree->GetBranch(bname);
- if(!br) {
- Printf("AliPWG0Helper::SetBranchStatusRecursive: Branch %s not found", bname);
- }
-
- TObjArray *leaves = tree->GetListOfLeaves();
- Int_t nleaves = leaves->GetEntries();
- TLeaf *leaf = 0;
- TBranch *branch = 0;
- TBranch *mother = 0;
- for (Int_t i=0;i<nleaves;i++) {
- // the matched entry e.g. SPDVertex is its own Mother
- leaf = (TLeaf*)leaves->UncheckedAt(i);
- branch = (TBranch*)leaf->GetBranch();
- mother = branch->GetMother();
- if (mother==br){
- if (debug)
- Printf(">>>> AliPWG0Helper::SetBranchStatusRecursive: Setting status %s %s to %d", mother->GetName(), leaf->GetName(), status);
- if (status) branch->ResetBit(kDoNotProcess);
- else branch->SetBit(kDoNotProcess);
- }
- }
-}
-
//____________________________________________________________________
void AliPWG0Helper::NormalizeToBinWidth(TH1* hist)
{
{
case kMB1 : str += "MB1"; break;
case kMB2 : str += "MB2"; break;
+ case kSPDFASTOR : str += "SPD FASTOR"; break;
}
str += " <<<<";