X-Git-Url: http://git.uio.no/git/?p=u%2Fmrichter%2FAliRoot.git;a=blobdiff_plain;f=PWG0%2FAliPWG0Helper.cxx;h=66ff63255ed5fa4e639a7392432bfc93e2a09e49;hp=d88376edba23c21b78a45fe2290e3b7fc88e6640;hb=610f8b680f3d878b3ade1ee0607e1845bff0a53b;hpb=a67484a65d9ee1dd49e541d4764f739190186014 diff --git a/PWG0/AliPWG0Helper.cxx b/PWG0/AliPWG0Helper.cxx index d88376edba2..66ff63255ed 100644 --- a/PWG0/AliPWG0Helper.cxx +++ b/PWG0/AliPWG0Helper.cxx @@ -14,17 +14,19 @@ #include #include -#include #include #include #include #include +#include +#include #include #include #include #include +#include //____________________________________________________________________ ClassImp(AliPWG0Helper) @@ -32,86 +34,32 @@ ClassImp(AliPWG0Helper) Int_t AliPWG0Helper::fgLastProcessType = -1; //____________________________________________________________________ -Bool_t AliPWG0Helper::IsEventTriggered(const AliESD* aEsd, Trigger trigger) +Bool_t AliPWG0Helper::TestVertex(const AliESDVertex* vertex, AnalysisMode analysisMode, Bool_t debug) { - // see function with ULong64_t argument - - ULong64_t triggerMask = aEsd->GetTriggerMask(); - return IsEventTriggered(triggerMask, trigger); -} - -//____________________________________________________________________ -Bool_t AliPWG0Helper::IsEventTriggered(ULong64_t triggerMask, Trigger trigger) -{ - // check if the event was triggered - // - // this function needs the branch fTriggerMask - - - // definitions from p-p.cfg - ULong64_t spdFO = (1 << 14); - ULong64_t v0left = (1 << 11); - ULong64_t v0right = (1 << 12); + // Checks if a vertex meets the needed quality criteria - switch (trigger) + Float_t requiredZResolution = -1; + if (analysisMode & kSPD || analysisMode & kTPCITS) { - case kMB1: - { - if (triggerMask & spdFO || ((triggerMask & v0left) || (triggerMask & v0right))) - return kTRUE; - break; - } - case kMB2: - { - if (triggerMask & spdFO && ((triggerMask & v0left) || (triggerMask & v0right))) - return kTRUE; - break; - } + requiredZResolution = 0.1; } + else if (analysisMode & kTPC) + requiredZResolution = 10.; - return kFALSE; -} - -//____________________________________________________________________ -Bool_t AliPWG0Helper::IsVertexReconstructed(const AliESD* aEsd) -{ - // 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; - - // the vertex should be reconstructed - if (strcmp(vtxESD->GetName(), "default")==0) - return kFALSE; - - // check Ncontributors - if (vtxESD->GetNContributors() <= 0) - return kFALSE; - - 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 // @@ -119,18 +67,30 @@ const AliESDVertex* AliPWG0Helper::GetVertex(const AliESDEvent* aEsd, AnalysisMo // also the quality criteria that are applied) const AliESDVertex* vertex = 0; - Float_t requiredZResolution = -1; - if (analysisMode == kSPD || analysisMode == kTPCITS) + 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){ + if (debug) + Printf("AliPWG0Helper::GetVertex: Redoing vertex"); + Double_t kBz = aEsd->GetMagneticField(); + AliVertexerTracks vertexer(kBz); + vertexer.SetTPCMode(); + AliESDVertex *vTPC = vertexer.FindPrimaryVertex(aEsd); + aEsd->SetPrimaryVertexTPC(vTPC); + for (Int_t i=0; iGetNumberOfTracks(); 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"); } @@ -145,22 +105,26 @@ const AliESDVertex* AliPWG0Helper::GetVertex(const AliESDEvent* aEsd, AnalysisMo // 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; } @@ -186,6 +150,7 @@ Bool_t AliPWG0Helper::IsPrimaryCharged(TParticle* aParticle, Int_t aTotalPrimari } Int_t pdgCode = TMath::Abs(aParticle->GetPdgCode()); + // skip quarks and gluon if (pdgCode <= 10 || pdgCode == 21) @@ -195,10 +160,17 @@ Bool_t AliPWG0Helper::IsPrimaryCharged(TParticle* aParticle, Int_t aTotalPrimari 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; } @@ -206,8 +178,7 @@ Bool_t AliPWG0Helper::IsPrimaryCharged(TParticle* aParticle, Int_t aTotalPrimari 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; } @@ -332,7 +303,7 @@ const char* AliPWG0Helper::GetAxisTitle(TH3* hist, const char axis) } -Int_t AliPWG0Helper::GetPythiaEventProcessType(AliGenEventHeader* aHeader, Bool_t adebug) { +AliPWG0Helper::MCProcessType AliPWG0Helper::GetPythiaEventProcessType(AliGenEventHeader* aHeader, Bool_t adebug) { AliGenPythiaEventHeader* pythiaGenHeader = dynamic_cast(aHeader); @@ -366,7 +337,7 @@ Int_t AliPWG0Helper::GetPythiaEventProcessType(AliGenEventHeader* aHeader, Bool_ } -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. // @@ -402,7 +373,7 @@ Int_t AliPWG0Helper::GetDPMjetEventProcessType(AliGenEventHeader* aHeader, Bool_ } -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. // @@ -502,45 +473,6 @@ Int_t AliPWG0Helper::FindPrimaryMotherLabel(AliStack* stack, Int_t label) 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;iUncheckedAt(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) { @@ -572,31 +504,33 @@ void AliPWG0Helper::NormalizeToBinWidth(TH2* hist) } //____________________________________________________________________ -void AliPWG0Helper::PrintConf(AnalysisMode analysisMode, Trigger trigger) +void AliPWG0Helper::PrintConf(AnalysisMode analysisMode, AliTriggerAnalysis::Trigger trigger) { // // Prints the given configuration // - TString str(">>>> Running with "); - - switch (analysisMode) - { - case kInvalid: str += "invalid setting"; break; - case kSPD : str += "SPD-only"; break; - case kTPC : str += "TPC-only"; break; - case kTPCITS : str += "Global tracking"; break; - } + TString str(">>>> Running with >"); - str += " and trigger "; + if (analysisMode & kSPD) + str += "SPD-only"; + + if (analysisMode & kTPC) + str += "TPC-only"; + + if (analysisMode & kTPCITS) + str += "Global tracking"; - switch (trigger) + if (analysisMode & kFieldOn) { - case kMB1 : str += "MB1"; break; - case kMB2 : str += "MB2"; break; + str += " (with field)"; } - - str += " <<<<"; + else + str += " (WITHOUT field)"; + + str += "< and trigger >"; + str += AliTriggerAnalysis::GetTriggerName(trigger); + str += "< <<<<"; Printf("%s", str.Data()); }