1 /**************************************************************************
\r
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
\r
4 * Author: The ALICE Off-line Project. *
\r
5 * Contributors are mentioned in the code where appropriate. *
\r
7 * Permission to use, copy, modify and distribute this software and its *
\r
8 * documentation strictly for non-commercial purposes is hereby granted *
\r
9 * without fee, provided that the above copyright notice appears in all *
\r
10 * copies and that both the copyright notice and this permission notice *
\r
11 * appear in the supporting documentation. The authors make no claims *
\r
12 * about the suitability of this software for any purpose. It is *
\r
13 * provided "as is" without express or implied warranty. *
\r
14 **************************************************************************/
\r
18 #include <TPDGCode.h>
\r
19 #include <TDatabasePDG.h>
\r
22 #include "TTreeStream.h"
\r
25 #include "TCanvas.h"
\r
27 #include "TObjArray.h"
\r
29 #include "TMatrixD.h"
\r
30 #include "TRandom3.h"
\r
32 #include "AliHeader.h"
\r
33 #include "AliGenEventHeader.h"
\r
34 #include "AliInputEventHandler.h"
\r
35 #include "AliStack.h"
\r
36 #include "AliTrackReference.h"
\r
38 #include "AliPhysicsSelection.h"
\r
39 #include "AliAnalysisTask.h"
\r
40 #include "AliAnalysisManager.h"
\r
41 #include "AliESDEvent.h"
\r
42 #include "AliESDfriend.h"
\r
43 #include "AliMCEvent.h"
\r
44 #include "AliESDInputHandler.h"
\r
45 #include "AliESDVertex.h"
\r
46 #include "AliTracker.h"
\r
47 #include "AliGeomManager.h"
\r
49 #include "AliCentrality.h"
\r
50 #include "AliESDVZERO.h"
\r
51 #include "AliMultiplicity.h"
\r
53 #include "AliESDtrackCuts.h"
\r
54 #include "AliMCEventHandler.h"
\r
55 #include "AlidNdPt.h"
\r
56 #include "AlidNdPtEventCuts.h"
\r
57 #include "AlidNdPtAcceptanceCuts.h"
\r
59 #include "AlidNdPtTrackDumpTask.h"
\r
60 #include "AliKFParticle.h"
\r
61 #include "AliESDv0.h"
\r
63 using namespace std;
\r
65 ClassImp(AlidNdPtTrackDumpTask)
\r
67 //_____________________________________________________________________________
\r
68 AlidNdPtTrackDumpTask::AlidNdPtTrackDumpTask(const char *name)
\r
69 : AliAnalysisTaskSE(name)
\r
75 , fUseMCInfo(kFALSE)
\r
76 , fUseESDfriends(kFALSE)
\r
77 , fdNdPtEventCuts(0)
\r
78 , fdNdPtAcceptanceCuts(0)
\r
79 , fdNdPtRecAcceptanceCuts(0)
\r
81 , fTrigger(AliTriggerAnalysis::kMB1)
\r
82 , fAnalysisMode(AlidNdPtHelper::kTPC)
\r
83 , fTreeSRedirector(0)
\r
84 , fCentralityEstimator(0)
\r
85 , fLowPtTrackDownscaligF(0)
\r
86 , fLowPtV0DownscaligF(0)
\r
87 , fProcessAll(kFALSE)
\r
88 , fProcessCosmics(kFALSE)
\r
92 // Define input and output slots here
\r
93 DefineOutput(1, TList::Class());
\r
97 //_____________________________________________________________________________
\r
98 AlidNdPtTrackDumpTask::~AlidNdPtTrackDumpTask()
\r
100 if(fOutput) delete fOutput; fOutput =0;
\r
101 if(fTreeSRedirector) delete fTreeSRedirector; fTreeSRedirector =0;
\r
103 if(fdNdPtEventCuts) delete fdNdPtEventCuts; fdNdPtEventCuts=NULL;
\r
104 if(fdNdPtAcceptanceCuts) delete fdNdPtAcceptanceCuts; fdNdPtAcceptanceCuts=NULL;
\r
105 if(fdNdPtRecAcceptanceCuts) delete fdNdPtRecAcceptanceCuts; fdNdPtRecAcceptanceCuts=NULL;
\r
106 if(fEsdTrackCuts) delete fEsdTrackCuts; fEsdTrackCuts=NULL;
\r
109 //____________________________________________________________________________
\r
110 Bool_t AlidNdPtTrackDumpTask::Notify()
\r
112 static Int_t count = 0;
\r
114 TTree *chain = (TChain*)GetInputData(0);
\r
117 Printf("Processing %d. file: %s", count, chain->GetCurrentFile()->GetName());
\r
123 //_____________________________________________________________________________
\r
124 void AlidNdPtTrackDumpTask::UserCreateOutputObjects()
\r
126 // Create histograms
\r
128 fOutput = new TList;
\r
129 fOutput->SetOwner();
\r
132 // create temporary file for output tree
\r
133 fTreeSRedirector = new TTreeSRedirector("jotwinow_Temp_Trees.root");
\r
135 PostData(1, fOutput);
\r
138 //_____________________________________________________________________________
\r
139 void AlidNdPtTrackDumpTask::UserExec(Option_t *)
\r
142 // Called for each event
\r
146 fESD = (AliESDEvent*) (InputEvent());
\r
148 Printf("ERROR: ESD event not available");
\r
156 Printf("ERROR: MC event not available");
\r
161 if(fUseESDfriends) {
\r
162 fESDfriend = static_cast<AliESDfriend*>(fESD->FindListObject("AliESDfriend"));
\r
164 Printf("ERROR: ESD friends not available");
\r
170 ProcessAll(fESD,fMC,fESDfriend); // all track stages and MC
\r
173 Process(fESD,fMC,fESDfriend); // only global and TPC tracks
\r
177 ProcessV0(fESD,fMC,fESDfriend);
\r
178 ProcessLaser(fESD,fMC,fESDfriend);
\r
179 ProcessdEdx(fESD,fMC,fESDfriend);
\r
181 if (fProcessCosmics) { ProcessCosmics(fESD); }
\r
182 if(IsUseMCInfo()) { ProcessMCEff(fESD,fMC,fESDfriend); }
\r
184 // Post output data.
\r
185 PostData(1, fOutput);
\r
188 //_____________________________________________________________________________
\r
189 void AlidNdPtTrackDumpTask::ProcessCosmics(AliESDEvent *const event)
\r
192 // Select real events with high-pT tracks
\r
195 AliDebug(AliLog::kError, "event not available");
\r
200 AliInputEventHandler* inputHandler = (AliInputEventHandler*) AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler();
\r
203 Printf("ERROR: Could not receive input handler");
\r
208 TTree *chain = (TChain*)GetInputData(0);
\r
210 Printf("ERROR: Could not receive input chain");
\r
213 TObjString fileName(chain->GetCurrentFile()->GetName());
\r
216 // check for cosmic pairs
\r
218 // find cosmic pairs trigger by random trigger
\r
221 AliESDVertex *vertexSPD = (AliESDVertex *)event->GetPrimaryVertexSPD();
\r
222 AliESDVertex *vertexTPC = (AliESDVertex *)event->GetPrimaryVertexTPC();
\r
223 const Double_t kMinPt=0.8;
\r
224 const Double_t kMinPtMax=0.8;
\r
225 const Double_t kMinNcl=50;
\r
226 const Double_t kMaxDelta[5]={2,600,0.02,0.02,0.1};
\r
227 Int_t ntracks=event->GetNumberOfTracks();
\r
228 // Float_t dcaTPC[2]={0,0};
\r
229 // Float_t covTPC[3]={0,0,0};
\r
231 UInt_t specie = event->GetEventSpecie(); // skip laser events
\r
232 if (specie==AliRecoParam::kCalib) return;
\r
236 for (Int_t itrack0=0;itrack0<ntracks;itrack0++) {
\r
237 AliESDtrack *track0 = event->GetTrack(itrack0);
\r
238 if (!track0) continue;
\r
239 if (!track0->IsOn(AliESDtrack::kTPCrefit)) continue;
\r
241 if (TMath::Abs(AliTracker::GetBz())>1 && track0->Pt() < kMinPt) continue;
\r
242 if (track0->Pt() < kMinPt) continue;
\r
243 if (track0->GetTPCncls() < kMinNcl) continue;
\r
244 if (TMath::Abs(track0->GetY())<kMaxDelta[0]) continue;
\r
245 if (track0->GetKinkIndex(0)>0) continue;
\r
246 const Double_t * par0=track0->GetParameter(); //track param at rhe DCA
\r
249 //track0->GetImpactParametersTPC(dcaTPC,covTPC);
\r
250 //if (TMath::Abs(dcaTPC[0])<kMaxDelta[0]) continue;
\r
251 //if (TMath::Abs(dcaTPC[1])<kMaxDelta[0]*2) continue;
\r
252 // const AliExternalTrackParam * trackIn0 = track0->GetInnerParam();
\r
253 for (Int_t itrack1=itrack0+1;itrack1<ntracks;itrack1++) {
\r
254 AliESDtrack *track1 = event->GetTrack(itrack1);
\r
255 if (!track1) continue;
\r
256 if (!track1->IsOn(AliESDtrack::kTPCrefit)) continue;
\r
257 if (track1->GetKinkIndex(0)>0) continue;
\r
258 if ((TMath::Abs(AliTracker::GetBz())>1) && (track1->Pt() < kMinPt)) continue;
\r
259 if (track1->Pt() < kMinPt) continue;
\r
260 if (track1->GetTPCncls()<kMinNcl) continue;
\r
261 if (TMath::Abs(AliTracker::GetBz())>1 && TMath::Max(track1->Pt(), track0->Pt())<kMinPtMax) continue;
\r
262 if (TMath::Abs(track1->GetY())<kMaxDelta[0]) continue;
\r
263 //track1->GetImpactParametersTPC(dcaTPC,covTPC);
\r
264 // if (TMath::Abs(dcaTPC[0])<kMaxDelta[0]) continue;
\r
265 //if (TMath::Abs(dcaTPC[1])<kMaxDelta[0]*2) continue;
\r
267 const Double_t* par1=track1->GetParameter(); //track param at rhe DCA
\r
269 Bool_t isPair=kTRUE;
\r
270 for (Int_t ipar=0; ipar<5; ipar++){
\r
271 if (ipar==4&&TMath::Abs(AliTracker::GetBz())<1) continue; // 1/pt not defined for B field off
\r
272 if (TMath::Abs(TMath::Abs(par0[ipar])-TMath::Abs(par1[ipar]))>kMaxDelta[ipar]) isPair=kFALSE;
\r
274 if (!isPair) continue;
\r
275 if (TMath::Abs(TMath::Abs(track0->GetAlpha()-track1->GetAlpha())-TMath::Pi())>kMaxDelta[2]) isPair=kFALSE;
\r
276 //delta with correct sign
\r
278 TCut cut0="abs(t1.fP[0]+t0.fP[0])<2"
\r
279 TCut cut3="abs(t1.fP[3]+t0.fP[3])<0.02"
\r
280 TCut cut4="abs(t1.fP[4]+t0.fP[4])<0.2"
\r
282 if (TMath::Abs(par0[0]+par1[0])>kMaxDelta[0]) isPair=kFALSE; //delta y opposite sign
\r
283 if (TMath::Abs(par0[3]+par1[3])>kMaxDelta[3]) isPair=kFALSE; //delta tgl opposite sign
\r
284 if (TMath::Abs(AliTracker::GetBz())>1 && TMath::Abs(par0[4]+par1[4])>kMaxDelta[4]) isPair=kFALSE; //delta 1/pt opposite sign
\r
285 if (!isPair) continue;
\r
286 TString filename(AliAnalysisManager::GetAnalysisManager()->GetTree()->GetCurrentFile()->GetName());
\r
287 Int_t eventNumber = event->GetEventNumberInFile();
\r
288 //Bool_t hasFriend = kFALSE;
\r
289 //Bool_t hasITS=(track0->GetNcls(0)+track1->GetNcls(0)>4);
\r
290 //printf("DUMPHPTCosmic:%s|%f|%d|%d|%d\n",filename.Data(),(TMath::Min(track0->Pt(),track1->Pt())), eventNumber,hasFriend,hasITS);
\r
291 // const AliExternalTrackParam * trackIn1 = track1->GetInnerParam();
\r
294 Int_t ntracksSPD = vertexSPD->GetNContributors();
\r
295 Int_t ntracksTPC = vertexTPC->GetNContributors();
\r
296 Int_t runNumber = event->GetRunNumber();
\r
297 Int_t timeStamp = event->GetTimeStamp();
\r
298 ULong64_t triggerMask = event->GetTriggerMask();
\r
299 Float_t magField = event->GetMagneticField();
\r
300 TObjString triggerClass = event->GetFiredTriggerClasses().Data();
\r
303 // Dump to the tree
\r
307 if(!fTreeSRedirector) return;
\r
308 (*fTreeSRedirector)<<"CosmicPairs"<<
\r
309 "fileName.="<<&fileName<< // file name
\r
310 "runNumber="<<runNumber<< // run number
\r
311 "evtTimeStamp="<<timeStamp<< // time stamp of event
\r
312 "evtNumberInFile="<<eventNumber<< // event number
\r
313 "trigger="<<triggerMask<< // trigger
\r
314 "triggerClass="<<&triggerClass<< // trigger
\r
315 "Bz="<<magField<< // magnetic field
\r
317 "multSPD="<<ntracksSPD<<
\r
318 "multTPC="<<ntracksTPC<<
\r
319 "vertSPD.="<<vertexSPD<< //primary vertex -SPD
\r
320 "vertTPC.="<<vertexTPC<< //primary vertex -TPC
\r
321 "t0.="<<track0<< //track0
\r
322 "t1.="<<track1<< //track1
\r
327 PostData(1, fOutput);
\r
331 //_____________________________________________________________________________
\r
332 void AlidNdPtTrackDumpTask::Process(AliESDEvent *const esdEvent, AliMCEvent * const mcEvent, AliESDfriend *const /*esdFriend*/)
\r
335 // Select real events with high-pT tracks
\r
338 AliDebug(AliLog::kError, "esdEvent not available");
\r
342 // get selection cuts
\r
343 AlidNdPtEventCuts *evtCuts = GetEventCuts();
\r
344 AlidNdPtAcceptanceCuts *accCuts = GetAcceptanceCuts();
\r
345 AliESDtrackCuts *esdTrackCuts = GetTrackCuts();
\r
347 if(!evtCuts || !accCuts || !esdTrackCuts) {
\r
348 Printf("ERROR cuts not available");
\r
352 // trigger selection
\r
353 Bool_t isEventTriggered = kTRUE;
\r
354 AliPhysicsSelection *physicsSelection = NULL;
\r
355 AliTriggerAnalysis* triggerAnalysis = NULL;
\r
358 AliInputEventHandler* inputHandler = (AliInputEventHandler*) AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler();
\r
361 Printf("ERROR: Could not receive input handler");
\r
366 TTree *chain = (TChain*)GetInputData(0);
\r
368 Printf("ERROR: Could not receive input chain");
\r
371 TObjString fileName(chain->GetCurrentFile()->GetName());
\r
374 if(evtCuts->IsTriggerRequired())
\r
377 isEventTriggered = inputHandler->IsEventSelected() & AliVEvent::kMB;
\r
379 physicsSelection = static_cast<AliPhysicsSelection*> (inputHandler->GetEventSelection());
\r
380 if(!physicsSelection) return;
\r
381 //SetPhysicsTriggerSelection(physicsSelection);
\r
383 if (isEventTriggered && (GetTrigger() == AliTriggerAnalysis::kV0AND)) {
\r
384 // set trigger (V0AND)
\r
385 triggerAnalysis = physicsSelection->GetTriggerAnalysis();
\r
386 if(!triggerAnalysis) return;
\r
387 isEventTriggered = triggerAnalysis->IsOfflineTriggerFired(esdEvent, GetTrigger());
\r
391 // centrality determination
\r
392 Float_t centralityF = -1;
\r
393 AliCentrality *esdCentrality = esdEvent->GetCentrality();
\r
394 centralityF = esdCentrality->GetCentralityPercentile(fCentralityEstimator.Data());
\r
396 // use MC information
\r
397 AliHeader* header = 0;
\r
398 AliGenEventHeader* genHeader = 0;
\r
399 AliStack* stack = 0;
\r
402 Int_t multMCTrueTracks = 0;
\r
407 AliDebug(AliLog::kError, "mcEvent not available");
\r
410 // get MC event header
\r
411 header = mcEvent->Header();
\r
413 AliDebug(AliLog::kError, "Header not available");
\r
416 // MC particle stack
\r
417 stack = mcEvent->Stack();
\r
419 AliDebug(AliLog::kError, "Stack not available");
\r
424 genHeader = header->GenEventHeader();
\r
426 AliDebug(AliLog::kError, "Could not retrieve genHeader from Header");
\r
429 genHeader->PrimaryVertex(vtxMC);
\r
431 // multipliticy of all MC primary tracks
\r
432 // in Zv, pt and eta ranges)
\r
433 multMCTrueTracks = AlidNdPtHelper::GetMCTrueTrackMult(mcEvent,evtCuts,accCuts);
\r
437 // get reconstructed vertex
\r
438 //const AliESDVertex* vtxESD = 0;
\r
439 AliESDVertex* vtxESD = 0;
\r
440 if(GetAnalysisMode() == AlidNdPtHelper::kTPC) {
\r
441 vtxESD = (AliESDVertex*)esdEvent->GetPrimaryVertexTPC();
\r
443 else if(GetAnalysisMode() == AlidNdPtHelper::kTPCITS) {
\r
444 vtxESD = (AliESDVertex*)esdEvent->GetPrimaryVertexTracks();
\r
450 if(!vtxESD) return;
\r
452 Bool_t isEventOK = evtCuts->AcceptEvent(esdEvent,mcEvent,vtxESD);
\r
453 //printf("isEventOK %d, isEventTriggered %d, status %d, vz %f \n",isEventOK, isEventTriggered, vtxESD->GetStatus(), vtxESD->GetZv());
\r
454 //printf("GetAnalysisMode() %d \n",GetAnalysisMode());
\r
457 // check event cuts
\r
458 if(isEventOK && isEventTriggered)
\r
462 // get IR information
\r
464 AliESDHeader *esdHeader = 0;
\r
465 esdHeader = esdEvent->GetHeader();
\r
466 if(!esdHeader) return;
\r
467 //Int_t ir1 = esdHeader->GetTriggerIREntries(); //all ir-s
\r
468 //Int_t ir2 = esdHeader->GetTriggerIREntries(-1,1); // int2 set, 180 ms time interval
\r
470 // Use when Peter commit the changes in the header
\r
475 Double_t vert[3] = {0};
\r
476 vert[0] = vtxESD->GetXv();
\r
477 vert[1] = vtxESD->GetYv();
\r
478 vert[2] = vtxESD->GetZv();
\r
479 Int_t mult = vtxESD->GetNContributors();
\r
480 Double_t bz = esdEvent->GetMagneticField();
\r
481 Double_t runNumber = esdEvent->GetRunNumber();
\r
482 Double_t evtTimeStamp = esdEvent->GetTimeStamp();
\r
483 Int_t evtNumberInFile = esdEvent->GetEventNumberInFile();
\r
486 for (Int_t iTrack = 0; iTrack < esdEvent->GetNumberOfTracks(); iTrack++)
\r
488 AliESDtrack *track = esdEvent->GetTrack(iTrack);
\r
489 if(!track) continue;
\r
490 if(track->Charge()==0) continue;
\r
491 if(!esdTrackCuts->AcceptTrack(track)) continue;
\r
492 if(!accCuts->AcceptTrack(track)) continue;
\r
494 // downscale low-pT tracks
\r
495 Double_t scalempt= TMath::Min(track->Pt(),10.);
\r
496 Double_t downscaleF = gRandom->Rndm();
\r
497 downscaleF *= fLowPtTrackDownscaligF;
\r
498 if(TMath::Exp(2*scalempt)<downscaleF) continue;
\r
499 //printf("TMath::Exp(2*scalempt) %e, downscaleF %e \n",TMath::Exp(2*scalempt), downscaleF);
\r
501 AliExternalTrackParam * tpcInner = (AliExternalTrackParam *)(track->GetTPCInnerParam());
\r
502 if (!tpcInner) continue;
\r
503 // transform to the track reference frame
\r
504 Bool_t isOK = kFALSE;
\r
505 isOK = tpcInner->Rotate(track->GetAlpha());
\r
506 isOK = tpcInner->PropagateTo(track->GetX(),esdEvent->GetMagneticField());
\r
507 if(!isOK) continue;
\r
509 // Dump to the tree
\r
513 if(!fTreeSRedirector) return;
\r
514 (*fTreeSRedirector)<<"dNdPtTree"<<
\r
515 "fileName.="<<&fileName<<
\r
516 "runNumber="<<runNumber<<
\r
517 "evtTimeStamp="<<evtTimeStamp<<
\r
518 "evtNumberInFile="<<evtNumberInFile<<
\r
520 "vtxESD.="<<vtxESD<<
\r
524 "esdTrack.="<<track<<
\r
525 "centralityF="<<centralityF<<
\r
530 PostData(1, fOutput);
\r
534 //_____________________________________________________________________________
\r
535 void AlidNdPtTrackDumpTask::ProcessLaser(AliESDEvent *const esdEvent, AliMCEvent * const /*mcEvent*/, AliESDfriend *const /*esdFriend*/)
\r
538 // Process laser events
\r
541 AliDebug(AliLog::kError, "esdEvent not available");
\r
546 TTree *chain = (TChain*)GetInputData(0);
\r
548 Printf("ERROR: Could not receive input chain");
\r
551 TObjString fileName(chain->GetCurrentFile()->GetName());
\r
554 const AliESDHeader* esdHeader = esdEvent->GetHeader();
\r
555 if(esdHeader && esdHeader->GetEventSpecie()==AliRecoParam::kCalib)
\r
557 Int_t countLaserTracks = 0;
\r
558 for (Int_t iTrack = 0; iTrack < esdEvent->GetNumberOfTracks(); iTrack++)
\r
560 AliESDtrack *track = esdEvent->GetTrack(iTrack);
\r
561 if(!track) continue;
\r
563 if(track->GetTPCInnerParam()) countLaserTracks++;
\r
566 if(countLaserTracks > 100)
\r
568 Double_t runNumber = esdEvent->GetRunNumber();
\r
569 Double_t evtTimeStamp = esdEvent->GetTimeStamp();
\r
570 Int_t evtNumberInFile = esdEvent->GetEventNumberInFile();
\r
571 Double_t bz = esdEvent->GetMagneticField();
\r
573 if(!fTreeSRedirector) return;
\r
574 (*fTreeSRedirector)<<"Laser"<<
\r
575 "fileName.="<<&fileName<<
\r
576 "runNumber="<<runNumber<<
\r
577 "evtTimeStamp="<<evtTimeStamp<<
\r
578 "evtNumberInFile="<<evtNumberInFile<<
\r
580 "multTPCtracks="<<countLaserTracks<<
\r
586 //_____________________________________________________________________________
\r
587 void AlidNdPtTrackDumpTask::ProcessAll(AliESDEvent *const esdEvent, AliMCEvent * const mcEvent, AliESDfriend *const esdFriend)
\r
590 // Select real events with high-pT tracks
\r
591 // Calculate and stor in the output tree:
\r
592 // TPC constrained tracks
\r
593 // InnerParams constrained tracks
\r
595 // ITSout-InnerParams tracks
\r
596 // chi2 distance between TPC constrained and TPC-ITS tracks
\r
597 // chi2 distance between TPC refitted constrained and TPC-ITS tracks
\r
598 // chi2 distance between ITSout and InnerParams tracks
\r
599 // MC information:
\r
600 // track references at ITSin, TPCin; InnerParam at first TPC track reference,
\r
601 // particle ID, mother ID, production mechanism ...
\r
605 AliDebug(AliLog::kError, "esdEvent not available");
\r
609 // get selection cuts
\r
610 AlidNdPtEventCuts *evtCuts = GetEventCuts();
\r
611 AlidNdPtAcceptanceCuts *accCuts = GetAcceptanceCuts();
\r
612 AliESDtrackCuts *esdTrackCuts = GetTrackCuts();
\r
614 if(!evtCuts || !accCuts || !esdTrackCuts) {
\r
615 AliDebug(AliLog::kError, "cuts not available");
\r
619 // trigger selection
\r
620 Bool_t isEventTriggered = kTRUE;
\r
621 AliPhysicsSelection *physicsSelection = NULL;
\r
622 AliTriggerAnalysis* triggerAnalysis = NULL;
\r
625 AliInputEventHandler* inputHandler = (AliInputEventHandler*) AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler();
\r
628 Printf("ERROR: Could not receive input handler");
\r
633 TTree *chain = (TChain*)GetInputData(0);
\r
635 Printf("ERROR: Could not receive input chain");
\r
638 TObjString fileName(chain->GetCurrentFile()->GetName());
\r
641 if(evtCuts->IsTriggerRequired())
\r
644 isEventTriggered = inputHandler->IsEventSelected() & AliVEvent::kMB;
\r
646 physicsSelection = static_cast<AliPhysicsSelection*> (inputHandler->GetEventSelection());
\r
647 if(!physicsSelection) return;
\r
648 //SetPhysicsTriggerSelection(physicsSelection);
\r
650 if (isEventTriggered && (GetTrigger() == AliTriggerAnalysis::kV0AND)) {
\r
651 // set trigger (V0AND)
\r
652 triggerAnalysis = physicsSelection->GetTriggerAnalysis();
\r
653 if(!triggerAnalysis) return;
\r
654 isEventTriggered = triggerAnalysis->IsOfflineTriggerFired(esdEvent, GetTrigger());
\r
658 // centrality determination
\r
659 Float_t centralityF = -1;
\r
660 AliCentrality *esdCentrality = esdEvent->GetCentrality();
\r
661 centralityF = esdCentrality->GetCentralityPercentile(fCentralityEstimator.Data());
\r
663 // use MC information
\r
664 AliHeader* header = 0;
\r
665 AliGenEventHeader* genHeader = 0;
\r
666 AliStack* stack = 0;
\r
669 Int_t multMCTrueTracks = 0;
\r
674 AliDebug(AliLog::kError, "mcEvent not available");
\r
677 // get MC event header
\r
678 header = mcEvent->Header();
\r
680 AliDebug(AliLog::kError, "Header not available");
\r
683 // MC particle stack
\r
684 stack = mcEvent->Stack();
\r
686 AliDebug(AliLog::kError, "Stack not available");
\r
691 genHeader = header->GenEventHeader();
\r
693 AliDebug(AliLog::kError, "Could not retrieve genHeader from Header");
\r
696 genHeader->PrimaryVertex(vtxMC);
\r
698 // multipliticy of all MC primary tracks
\r
699 // in Zv, pt and eta ranges)
\r
700 multMCTrueTracks = AlidNdPtHelper::GetMCTrueTrackMult(mcEvent,evtCuts,accCuts);
\r
704 // get reconstructed vertex
\r
705 //const AliESDVertex* vtxESD = 0;
\r
706 AliESDVertex* vtxESD = 0;
\r
707 if(GetAnalysisMode() == AlidNdPtHelper::kTPC) {
\r
708 vtxESD = (AliESDVertex*)esdEvent->GetPrimaryVertexTPC();
\r
710 else if(GetAnalysisMode() == AlidNdPtHelper::kTPCITS) {
\r
711 vtxESD = (AliESDVertex*)esdEvent->GetPrimaryVertexTracks();
\r
717 if(!vtxESD) return;
\r
719 Bool_t isEventOK = evtCuts->AcceptEvent(esdEvent,mcEvent,vtxESD);
\r
720 //printf("isEventOK %d, isEventTriggered %d \n",isEventOK, isEventTriggered);
\r
721 //printf("GetAnalysisMode() %d \n",GetAnalysisMode());
\r
724 // check event cuts
\r
725 if(isEventOK && isEventTriggered)
\r
728 // get IR information
\r
730 AliESDHeader *esdHeader = 0;
\r
731 esdHeader = esdEvent->GetHeader();
\r
732 if(!esdHeader) return;
\r
733 //Int_t ir1 = esdHeader->GetTriggerIREntries(); //all ir-s
\r
734 //Int_t ir2 = esdHeader->GetTriggerIREntries(-1,1); // int2 set, 180 ms time interval
\r
740 Double_t vert[3] = {0};
\r
741 vert[0] = vtxESD->GetXv();
\r
742 vert[1] = vtxESD->GetYv();
\r
743 vert[2] = vtxESD->GetZv();
\r
744 Int_t mult = vtxESD->GetNContributors();
\r
745 Double_t bz = esdEvent->GetMagneticField();
\r
746 Double_t runNumber = esdEvent->GetRunNumber();
\r
747 Double_t evtTimeStamp = esdEvent->GetTimeStamp();
\r
748 Int_t evtNumberInFile = esdEvent->GetEventNumberInFile();
\r
751 for (Int_t iTrack = 0; iTrack < esdEvent->GetNumberOfTracks(); iTrack++)
\r
753 AliESDtrack *track = esdEvent->GetTrack(iTrack);
\r
754 if(!track) continue;
\r
755 if(track->Charge()==0) continue;
\r
756 if(!esdTrackCuts->AcceptTrack(track)) continue;
\r
757 if(!accCuts->AcceptTrack(track)) continue;
\r
759 // downscale low-pT tracks
\r
760 Double_t scalempt= TMath::Min(track->Pt(),10.);
\r
761 Double_t downscaleF = gRandom->Rndm();
\r
762 downscaleF *= fLowPtTrackDownscaligF;
\r
763 if(TMath::Exp(2*scalempt)<downscaleF) continue;
\r
764 //printf("TMath::Exp(2*scalempt) %e, downscaleF %e \n",TMath::Exp(2*scalempt), downscaleF);
\r
766 // Dump to the tree
\r
768 // TPC constrained tracks
\r
769 // InnerParams constrained tracks
\r
771 // ITSout-InnerParams tracks
\r
772 // chi2 distance between TPC constrained and TPC-ITS tracks
\r
773 // chi2 distance between TPC refitted constrained and TPC-ITS tracks
\r
774 // chi2 distance between ITSout and InnerParams tracks
\r
777 Double_t x[3]; track->GetXYZ(x);
\r
778 Double_t b[3]; AliTracker::GetBxByBz(x,b);
\r
781 // Transform TPC inner params to track reference frame
\r
783 Bool_t isOKtpcInner = kFALSE;
\r
784 AliExternalTrackParam * tpcInner = (AliExternalTrackParam *)(track->GetTPCInnerParam());
\r
786 // transform to the track reference frame
\r
787 isOKtpcInner = tpcInner->Rotate(track->GetAlpha());
\r
788 isOKtpcInner = tpcInner->PropagateTo(track->GetX(),esdEvent->GetMagneticField());
\r
792 // Constrain TPC inner to vertex
\r
793 // clone TPCinner has to be deleted
\r
795 Bool_t isOKtpcInnerC = kFALSE;
\r
796 AliExternalTrackParam * tpcInnerC = new AliExternalTrackParam(*(track->GetTPCInnerParam()));
\r
798 isOKtpcInnerC = ConstrainTPCInner(tpcInnerC,vtxESD,b);
\r
799 isOKtpcInnerC = tpcInnerC->Rotate(track->GetAlpha());
\r
800 isOKtpcInnerC = tpcInnerC->PropagateTo(track->GetX(),esdEvent->GetMagneticField());
\r
804 // Constrain TPC refitted tracks at inner TPC wall (InnerParams) to vertex
\r
805 // Clone track InnerParams has to be deleted
\r
807 Bool_t isOKtrackInnerC = kFALSE;
\r
808 AliExternalTrackParam * trackInnerC = new AliExternalTrackParam(*(track->GetInnerParam()));
\r
810 isOKtrackInnerC = ConstrainTrackInner(trackInnerC,vtxESD,track->GetMass(),b);
\r
811 isOKtrackInnerC = trackInnerC->Rotate(track->GetAlpha());
\r
812 isOKtrackInnerC = trackInnerC->PropagateTo(track->GetX(),esdEvent->GetMagneticField());
\r
816 // calculate chi2 between vi and vj vectors
\r
817 // with covi and covj covariance matrices
\r
818 // chi2ij = (vi-vj)^(T)*(covi+covj)^(-1)*(vi-vj)
\r
820 TMatrixD deltaT(5,1), deltaTtrackC(5,1);
\r
821 TMatrixD delta(1,5), deltatrackC(1,5);
\r
822 TMatrixD covarM(5,5), covarMtrackC(5,5);
\r
823 TMatrixD chi2(1,1);
\r
824 TMatrixD chi2trackC(1,1);
\r
826 if(isOKtpcInnerC && isOKtrackInnerC)
\r
828 for (Int_t ipar=0; ipar<5; ipar++) {
\r
829 deltaT(ipar,0)=tpcInnerC->GetParameter()[ipar]-track->GetParameter()[ipar];
\r
830 delta(0,ipar)=tpcInnerC->GetParameter()[ipar]-track->GetParameter()[ipar];
\r
832 deltaTtrackC(ipar,0)=trackInnerC->GetParameter()[ipar]-track->GetParameter()[ipar];
\r
833 deltatrackC(0,ipar)=trackInnerC->GetParameter()[ipar]-track->GetParameter()[ipar];
\r
835 for (Int_t jpar=0; jpar<5; jpar++) {
\r
836 Int_t index=track->GetIndex(ipar,jpar);
\r
837 covarM(ipar,jpar)=track->GetCovariance()[index]+tpcInnerC->GetCovariance()[index];
\r
838 covarMtrackC(ipar,jpar)=track->GetCovariance()[index]+trackInnerC->GetCovariance()[index];
\r
842 // chi2 distance TPC constrained and TPC+ITS
\r
843 TMatrixD covarMInv = covarM.Invert();
\r
844 TMatrixD mat2 = covarMInv*deltaT;
\r
845 chi2 = delta*mat2;
\r
848 // chi2 distance TPC refitted constrained and TPC+ITS
\r
849 TMatrixD covarMInvtrackC = covarMtrackC.Invert();
\r
850 TMatrixD mat2trackC = covarMInvtrackC*deltaTtrackC;
\r
851 chi2trackC = deltatrackC*mat2trackC;
\r
852 //chi2trackC.Print();
\r
857 // Propagate ITSout to TPC inner wall
\r
858 // and calculate chi2 distance to track (InnerParams)
\r
860 const Double_t kTPCRadius=85;
\r
861 const Double_t kStep=3;
\r
863 // clone track InnerParams has to be deleted
\r
864 Bool_t isOKtrackInnerC2 = kFALSE;
\r
865 AliExternalTrackParam *trackInnerC2 = new AliExternalTrackParam(*(track->GetInnerParam()));
\r
866 if (trackInnerC2) {
\r
867 isOKtrackInnerC2 = AliTracker::PropagateTrackToBxByBz(trackInnerC2,kTPCRadius,track->GetMass(),kStep,kFALSE);
\r
870 Bool_t isOKouterITSc = kFALSE;
\r
871 AliExternalTrackParam *outerITSc = NULL;
\r
872 TMatrixD chi2OuterITS(1,1);
\r
874 if(esdFriend && esdFriend->TestSkipBit()==kFALSE)
\r
876 // propagate ITSout to TPC inner wall
\r
877 AliESDfriendTrack *friendTrack = esdFriend->GetTrack(iTrack);
\r
881 outerITSc = new AliExternalTrackParam(*friendTrack->GetITSOut());
\r
884 isOKouterITSc = AliTracker::PropagateTrackToBxByBz(outerITSc,kTPCRadius,track->GetMass(),kStep,kFALSE);
\r
885 isOKouterITSc = outerITSc->Rotate(trackInnerC2->GetAlpha());
\r
886 isOKouterITSc = outerITSc->PropagateTo(trackInnerC2->GetX(),esdEvent->GetMagneticField());
\r
889 // calculate chi2 between outerITS and innerParams
\r
890 // cov without z-coordinate at the moment
\r
892 TMatrixD deltaTouterITS(4,1);
\r
893 TMatrixD deltaouterITS(1,4);
\r
894 TMatrixD covarMouterITS(4,4);
\r
896 if(isOKtrackInnerC2 && isOKouterITSc) {
\r
899 for (Int_t ipar=0; ipar<5; ipar++) {
\r
901 deltaTouterITS(kipar,0)=outerITSc->GetParameter()[ipar]-trackInnerC2->GetParameter()[ipar];
\r
902 deltaouterITS(0,kipar)=outerITSc->GetParameter()[ipar]-trackInnerC2->GetParameter()[ipar];
\r
906 for (Int_t jpar=0; jpar<5; jpar++) {
\r
907 Int_t index=outerITSc->GetIndex(ipar,jpar);
\r
908 if(ipar !=1 || jpar!=1) {
\r
909 covarMouterITS(kipar,kjpar)=outerITSc->GetCovariance()[index]+trackInnerC2->GetCovariance()[index];
\r
911 if(jpar!=1) kjpar++;
\r
913 if(ipar!=1) kipar++;
\r
916 // chi2 distance ITSout and InnerParams
\r
917 TMatrixD covarMInvouterITS = covarMouterITS.Invert();
\r
918 TMatrixD mat2outerITS = covarMInvouterITS*deltaTouterITS;
\r
919 chi2OuterITS = deltaouterITS*mat2outerITS;
\r
920 //chi2OuterITS.Print();
\r
929 TParticle *particle=NULL, *particleTPC=NULL, *particleITS=NULL;
\r
930 TParticle *particleMother=NULL, *particleMotherTPC=NULL, *particleMotherITS=NULL;
\r
931 Int_t mech=-1, mechTPC=-1, mechITS=-1;
\r
932 Bool_t isPrim=kFALSE, isPrimTPC=kFALSE, isPrimITS=kFALSE;
\r
933 Bool_t isFromStrangess=kFALSE, isFromStrangessTPC=kFALSE, isFromStrangessITS=kFALSE;
\r
934 Bool_t isFromConversion=kFALSE, isFromConversionTPC=kFALSE, isFromConversionITS=kFALSE;
\r
935 Bool_t isFromMaterial=kFALSE, isFromMaterialTPC=kFALSE, isFromMaterialITS=kFALSE;
\r
937 AliTrackReference *refTPCIn = NULL;
\r
938 AliTrackReference *refITS = NULL;
\r
940 Bool_t isOKtrackInnerC3 = kFALSE;
\r
941 AliExternalTrackParam *trackInnerC3 = new AliExternalTrackParam(*(track->GetInnerParam()));
\r
950 Int_t label = TMath::Abs(track->GetLabel());
\r
951 particle = stack->Particle(label);
\r
952 if(particle && particle->GetPDG() && particle->GetPDG()->Charge()!=0.)
\r
954 particleMother = GetMother(particle,stack);
\r
955 mech = particle->GetUniqueID();
\r
956 isPrim = stack->IsPhysicalPrimary(label);
\r
957 isFromStrangess = IsFromStrangeness(label,stack);
\r
958 isFromConversion = IsFromConversion(label,stack);
\r
959 isFromMaterial = IsFromMaterial(label,stack);
\r
965 Int_t labelTPC = TMath::Abs(track->GetTPCLabel());
\r
966 particleTPC = stack->Particle(labelTPC);
\r
967 if(particleTPC && particleTPC->GetPDG() && particleTPC->GetPDG()->Charge()!=0.)
\r
969 particleMotherTPC = GetMother(particleTPC,stack);
\r
970 mechTPC = particleTPC->GetUniqueID();
\r
971 isPrimTPC = stack->IsPhysicalPrimary(labelTPC);
\r
972 isFromStrangessTPC = IsFromStrangeness(labelTPC,stack);
\r
973 isFromConversionTPC = IsFromConversion(labelTPC,stack);
\r
974 isFromMaterialTPC = IsFromMaterial(labelTPC,stack);
\r
978 // store first track reference
\r
982 TClonesArray *trefs=0;
\r
983 Int_t status = mcEvent->GetParticleAndTR(track->GetTPCLabel(), part, trefs);
\r
985 if(status>0 && part && trefs && part->GetPDG() && part->GetPDG()->Charge()!=0.)
\r
987 Int_t nTrackRef = trefs->GetEntries();
\r
988 //printf("nTrackRef %d \n",nTrackRef);
\r
990 Int_t countITS = 0;
\r
991 for (Int_t iref = 0; iref < nTrackRef; iref++)
\r
993 AliTrackReference *ref = (AliTrackReference *)trefs->At(iref);
\r
995 // Ref. in the middle ITS
\r
996 if(ref && ref->DetectorId()==AliTrackReference::kITS)
\r
998 if(!refITS && countITS==2) {
\r
1000 //printf("refITS %p \n",refITS);
\r
1006 if(ref && ref->DetectorId()==AliTrackReference::kTPC)
\r
1010 //printf("refTPCIn %p \n",refTPCIn);
\r
1016 // transform inner params to TrackRef
\r
1017 // reference frame
\r
1018 if(refTPCIn && trackInnerC3)
\r
1020 Double_t kRefPhi = TMath::ATan2(refTPCIn->Y(),refTPCIn->X());
\r
1021 isOKtrackInnerC3 = trackInnerC3->Rotate(kRefPhi);
\r
1022 isOKtrackInnerC3 = AliTracker::PropagateTrackToBxByBz(trackInnerC3,refTPCIn->R(),track->GetMass(),kStep,kFALSE);
\r
1029 Int_t labelITS = TMath::Abs(track->GetITSLabel());
\r
1030 particleITS = stack->Particle(labelITS);
\r
1031 if(particleITS && particleITS->GetPDG() && particleITS->GetPDG()->Charge()!=0.)
\r
1033 particleMotherITS = GetMother(particleITS,stack);
\r
1034 mechITS = particleITS->GetUniqueID();
\r
1035 isPrimITS = stack->IsPhysicalPrimary(labelITS);
\r
1036 isFromStrangessITS = IsFromStrangeness(labelITS,stack);
\r
1037 isFromConversionITS = IsFromConversion(labelITS,stack);
\r
1038 isFromMaterialITS = IsFromMaterial(labelITS,stack);
\r
1043 Bool_t dumpToTree=kFALSE;
\r
1045 if(isOKtpcInnerC && isOKtrackInnerC) dumpToTree = kTRUE;
\r
1046 if(fUseESDfriends && isOKtrackInnerC2 && isOKouterITSc) dumpToTree = kTRUE;
\r
1047 if(fUseMCInfo && isOKtrackInnerC3) dumpToTree = kTRUE;
\r
1050 if(fTreeSRedirector && dumpToTree)
\r
1052 (*fTreeSRedirector)<<"dNdPtTree"<<
\r
1053 "fileName.="<<&fileName<<
\r
1054 "runNumber="<<runNumber<<
\r
1055 "evtTimeStamp="<<evtTimeStamp<<
\r
1056 "evtNumberInFile="<<evtNumberInFile<<
\r
1058 "vtxESD.="<<vtxESD<<
\r
1062 "esdTrack.="<<track<<
\r
1063 "extTPCInnerC.="<<tpcInnerC<<
\r
1064 "extInnerParamC.="<<trackInnerC<<
\r
1065 "extInnerParam.="<<trackInnerC2<<
\r
1066 "extOuterITS.="<<outerITSc<<
\r
1067 "extInnerParamRef.="<<trackInnerC3<<
\r
1068 "refTPCIn.="<<refTPCIn<<
\r
1069 "refITS.="<<refITS<<
\r
1070 "chi2TPCInnerC="<<chi2(0,0)<<
\r
1071 "chi2InnerC="<<chi2trackC(0,0)<<
\r
1072 "chi2OuterITS="<<chi2OuterITS(0,0)<<
\r
1073 "centralityF="<<centralityF<<
\r
1074 "particle.="<<particle<<
\r
1075 "particleMother.="<<particleMother<<
\r
1077 "isPrim="<<isPrim<<
\r
1078 "isFromStrangess="<<isFromStrangess<<
\r
1079 "isFromConversion="<<isFromConversion<<
\r
1080 "isFromMaterial="<<isFromMaterial<<
\r
1081 "particleTPC.="<<particleTPC<<
\r
1082 "particleMotherTPC.="<<particleMotherTPC<<
\r
1083 "mechTPC="<<mechTPC<<
\r
1084 "isPrimTPC="<<isPrimTPC<<
\r
1085 "isFromStrangessTPC="<<isFromStrangessTPC<<
\r
1086 "isFromConversionTPC="<<isFromConversionTPC<<
\r
1087 "isFromMaterialTPC="<<isFromMaterialTPC<<
\r
1088 "particleITS.="<<particleITS<<
\r
1089 "particleMotherITS.="<<particleMotherITS<<
\r
1090 "mechITS="<<mechITS<<
\r
1091 "isPrimITS="<<isPrimITS<<
\r
1092 "isFromStrangessITS="<<isFromStrangessITS<<
\r
1093 "isFromConversionITS="<<isFromConversionITS<<
\r
1094 "isFromMaterialITS="<<isFromMaterialITS<<
\r
1098 if(tpcInnerC) delete tpcInnerC;
\r
1099 if(trackInnerC) delete trackInnerC;
\r
1100 if(trackInnerC2) delete trackInnerC2;
\r
1101 if(outerITSc) delete outerITSc;
\r
1102 if(trackInnerC3) delete trackInnerC3;
\r
1106 PostData(1, fOutput);
\r
1110 //_____________________________________________________________________________
\r
1111 void AlidNdPtTrackDumpTask::ProcessMCEff(AliESDEvent *const esdEvent, AliMCEvent * const mcEvent, AliESDfriend *const /*esdFriend*/)
\r
1114 // Fill tree for efficiency studies MC only
\r
1117 AliDebug(AliLog::kError, "esdEvent not available");
\r
1122 AliDebug(AliLog::kError, "mcEvent not available");
\r
1126 // get selection cuts
\r
1127 AlidNdPtEventCuts *evtCuts = GetEventCuts();
\r
1128 AlidNdPtAcceptanceCuts *accCuts = GetAcceptanceCuts();
\r
1129 AliESDtrackCuts *esdTrackCuts = GetTrackCuts();
\r
1131 if(!evtCuts || !accCuts || !esdTrackCuts) {
\r
1132 AliDebug(AliLog::kError, "cuts not available");
\r
1136 // trigger selection
\r
1137 Bool_t isEventTriggered = kTRUE;
\r
1138 AliPhysicsSelection *physicsSelection = NULL;
\r
1139 AliTriggerAnalysis* triggerAnalysis = NULL;
\r
1142 AliInputEventHandler* inputHandler = (AliInputEventHandler*) AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler();
\r
1143 if (!inputHandler)
\r
1145 Printf("ERROR: Could not receive input handler");
\r
1150 TTree *chain = (TChain*)GetInputData(0);
\r
1152 Printf("ERROR: Could not receive input chain");
\r
1155 TObjString fileName(chain->GetCurrentFile()->GetName());
\r
1158 if(evtCuts->IsTriggerRequired())
\r
1161 isEventTriggered = inputHandler->IsEventSelected() & AliVEvent::kMB;
\r
1163 physicsSelection = static_cast<AliPhysicsSelection*> (inputHandler->GetEventSelection());
\r
1164 if(!physicsSelection) return;
\r
1166 if (isEventTriggered && (GetTrigger() == AliTriggerAnalysis::kV0AND)) {
\r
1167 // set trigger (V0AND)
\r
1168 triggerAnalysis = physicsSelection->GetTriggerAnalysis();
\r
1169 if(!triggerAnalysis) return;
\r
1170 isEventTriggered = triggerAnalysis->IsOfflineTriggerFired(esdEvent, GetTrigger());
\r
1174 // centrality determination
\r
1175 Float_t centralityF = -1;
\r
1176 AliCentrality *esdCentrality = esdEvent->GetCentrality();
\r
1177 centralityF = esdCentrality->GetCentralityPercentile(fCentralityEstimator.Data());
\r
1179 // use MC information
\r
1180 AliHeader* header = 0;
\r
1181 AliGenEventHeader* genHeader = 0;
\r
1182 AliStack* stack = 0;
\r
1185 Int_t multMCTrueTracks = 0;
\r
1190 AliDebug(AliLog::kError, "mcEvent not available");
\r
1193 // get MC event header
\r
1194 header = mcEvent->Header();
\r
1196 AliDebug(AliLog::kError, "Header not available");
\r
1199 // MC particle stack
\r
1200 stack = mcEvent->Stack();
\r
1202 AliDebug(AliLog::kError, "Stack not available");
\r
1207 genHeader = header->GenEventHeader();
\r
1209 AliDebug(AliLog::kError, "Could not retrieve genHeader from Header");
\r
1212 genHeader->PrimaryVertex(vtxMC);
\r
1214 // multipliticy of all MC primary tracks
\r
1215 // in Zv, pt and eta ranges)
\r
1216 multMCTrueTracks = AlidNdPtHelper::GetMCTrueTrackMult(mcEvent,evtCuts,accCuts);
\r
1220 // get reconstructed vertex
\r
1221 //const AliESDVertex* vtxESD = 0;
\r
1222 AliESDVertex* vtxESD = 0;
\r
1223 if(GetAnalysisMode() == AlidNdPtHelper::kTPC) {
\r
1224 vtxESD = (AliESDVertex*)esdEvent->GetPrimaryVertexTPC();
\r
1226 else if(GetAnalysisMode() == AlidNdPtHelper::kTPCITS) {
\r
1227 vtxESD = (AliESDVertex*)esdEvent->GetPrimaryVertexTracks();
\r
1233 if(!vtxESD) return;
\r
1235 Bool_t isEventOK = evtCuts->AcceptEvent(esdEvent,mcEvent,vtxESD);
\r
1236 //printf("isEventOK %d, isEventTriggered %d \n",isEventOK, isEventTriggered);
\r
1237 //printf("GetAnalysisMode() %d \n",GetAnalysisMode());
\r
1239 // check event cuts
\r
1240 if(isEventOK && isEventTriggered)
\r
1242 if(IsUseMCInfo())
\r
1244 if(!stack) return;
\r
1249 TParticle *particle=NULL;
\r
1250 TParticle *particleMother=NULL;
\r
1253 // reco event info
\r
1254 Double_t vert[3] = {0};
\r
1255 vert[0] = vtxESD->GetXv();
\r
1256 vert[1] = vtxESD->GetYv();
\r
1257 vert[2] = vtxESD->GetZv();
\r
1258 Int_t mult = vtxESD->GetNContributors();
\r
1259 Double_t bz = esdEvent->GetMagneticField();
\r
1260 Double_t runNumber = esdEvent->GetRunNumber();
\r
1261 Double_t evtTimeStamp = esdEvent->GetTimeStamp();
\r
1262 Int_t evtNumberInFile = esdEvent->GetEventNumberInFile();
\r
1264 // loop over MC stack
\r
1265 for (Int_t iMc = 0; iMc < stack->GetNtrack(); ++iMc)
\r
1267 particle = stack->Particle(iMc);
\r
1271 // only charged particles
\r
1272 if(!particle->GetPDG()) continue;
\r
1273 Double_t charge = particle->GetPDG()->Charge()/3.;
\r
1274 if (TMath::Abs(charge) < 0.001)
\r
1277 // only primary particles
\r
1278 Bool_t prim = stack->IsPhysicalPrimary(iMc);
\r
1279 if(!prim) continue;
\r
1281 // downscale low-pT particles
\r
1282 Double_t scalempt= TMath::Min(particle->Pt(),10.);
\r
1283 Double_t downscaleF = gRandom->Rndm();
\r
1284 downscaleF *= fLowPtTrackDownscaligF;
\r
1285 if(TMath::Exp(2*scalempt)<downscaleF) continue;
\r
1287 // is particle in acceptance
\r
1288 if(!accCuts->AcceptTrack(particle)) continue;
\r
1290 // check if particle reconstructed
\r
1291 Bool_t isRec = kFALSE;
\r
1292 Int_t trackIndex = -1;
\r
1293 for (Int_t iTrack = 0; iTrack < esdEvent->GetNumberOfTracks(); iTrack++)
\r
1296 AliESDtrack *track = esdEvent->GetTrack(iTrack);
\r
1297 if(!track) continue;
\r
1298 if(track->Charge()==0) continue;
\r
1299 if(esdTrackCuts->AcceptTrack(track) && accCuts->AcceptTrack(track))
\r
1301 Int_t label = TMath::Abs(track->GetLabel());
\r
1302 if(label == iMc) {
\r
1304 trackIndex = iTrack;
\r
1310 // Store information in the output tree
\r
1311 AliESDtrack *recTrack = NULL;
\r
1312 if(trackIndex>-1) {
\r
1313 recTrack = esdEvent->GetTrack(trackIndex);
\r
1315 recTrack = new AliESDtrack();
\r
1318 particleMother = GetMother(particle,stack);
\r
1319 mech = particle->GetUniqueID();
\r
1321 //MC particle track length
\r
1322 Double_t tpcTrackLength = 0.;
\r
1323 AliMCParticle *mcParticle = (AliMCParticle*) mcEvent->GetTrack(iMc);
\r
1326 tpcTrackLength = mcParticle->GetTPCTrackLength(bz,0.05,counter,3.0);
\r
1331 if(fTreeSRedirector) {
\r
1332 (*fTreeSRedirector)<<"MCEffTree"<<
\r
1333 "fileName.="<<&fileName<<
\r
1334 "runNumber="<<runNumber<<
\r
1335 "evtTimeStamp="<<evtTimeStamp<<
\r
1336 "evtNumberInFile="<<evtNumberInFile<<
\r
1338 "vtxESD.="<<vtxESD<<
\r
1340 "esdTrack.="<<recTrack<<
\r
1342 "tpcTrackLength="<<tpcTrackLength<<
\r
1343 "particle.="<<particle<<
\r
1344 "particleMother.="<<particleMother<<
\r
1349 if(trackIndex <0 && recTrack) delete recTrack; recTrack=0;
\r
1354 PostData(1, fOutput);
\r
1357 //_____________________________________________________________________________
\r
1358 Bool_t AlidNdPtTrackDumpTask::IsHighDeDxParticle(AliESDtrack * track) {
\r
1360 // check if particle is Z > 1
\r
1362 if (track->GetTPCNcls() < 60) return kFALSE;
\r
1363 Double_t mom = track->GetInnerParam()->GetP();
\r
1364 if (mom < 0.2) return kFALSE; // protection against unexpected behavior of Aleph parameterization
\r
1365 Float_t dca[2], bCov[3];
\r
1366 track->GetImpactParameters(dca,bCov);
\r
1369 Double_t triggerDeDx = 4*AliExternalTrackParam::BetheBlochAleph((mom*2)/(0.938*3),1.0288,31.9806,5.04114e-11,2.13096,2.38541);
\r
1371 if (track->GetTPCsignal() > triggerDeDx && track->GetTPCsignal()<1000 && TMath::Abs(dca[0])<3.) return kTRUE;
\r
1376 //_____________________________________________________________________________
\r
1377 void AlidNdPtTrackDumpTask::ProcessV0(AliESDEvent *const esdEvent, AliMCEvent * const mcEvent, AliESDfriend *const /*esdFriend*/)
\r
1380 // Select real events with V0 (K0s and Lambda) high-pT candidates
\r
1383 AliDebug(AliLog::kError, "esdEvent not available");
\r
1387 // get selection cuts
\r
1388 AlidNdPtEventCuts *evtCuts = GetEventCuts();
\r
1389 AlidNdPtAcceptanceCuts *accCuts = GetAcceptanceCuts();
\r
1390 AliESDtrackCuts *esdTrackCuts = GetTrackCuts();
\r
1392 if(!evtCuts || !accCuts || !esdTrackCuts) {
\r
1393 AliDebug(AliLog::kError, "cuts not available");
\r
1397 // trigger selection
\r
1398 Bool_t isEventTriggered = kTRUE;
\r
1399 AliPhysicsSelection *physicsSelection = NULL;
\r
1400 AliTriggerAnalysis* triggerAnalysis = NULL;
\r
1403 AliInputEventHandler* inputHandler = (AliInputEventHandler*) AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler();
\r
1404 if (!inputHandler)
\r
1406 Printf("ERROR: Could not receive input handler");
\r
1411 TTree *chain = (TChain*)GetInputData(0);
\r
1413 Printf("ERROR: Could not receive input chain");
\r
1416 TObjString fileName(chain->GetCurrentFile()->GetName());
\r
1419 if(evtCuts->IsTriggerRequired())
\r
1422 isEventTriggered = inputHandler->IsEventSelected() & AliVEvent::kMB;
\r
1424 physicsSelection = static_cast<AliPhysicsSelection*> (inputHandler->GetEventSelection());
\r
1425 if(!physicsSelection) return;
\r
1426 //SetPhysicsTriggerSelection(physicsSelection);
\r
1428 if (isEventTriggered && (GetTrigger() == AliTriggerAnalysis::kV0AND)) {
\r
1429 // set trigger (V0AND)
\r
1430 triggerAnalysis = physicsSelection->GetTriggerAnalysis();
\r
1431 if(!triggerAnalysis) return;
\r
1432 isEventTriggered = triggerAnalysis->IsOfflineTriggerFired(esdEvent, GetTrigger());
\r
1436 // centrality determination
\r
1437 Float_t centralityF = -1;
\r
1438 AliCentrality *esdCentrality = esdEvent->GetCentrality();
\r
1439 centralityF = esdCentrality->GetCentralityPercentile(fCentralityEstimator.Data());
\r
1442 // get reconstructed vertex
\r
1443 //const AliESDVertex* vtxESD = 0;
\r
1444 AliESDVertex* vtxESD = 0;
\r
1445 if(GetAnalysisMode() == AlidNdPtHelper::kTPC) {
\r
1446 vtxESD = (AliESDVertex*)esdEvent->GetPrimaryVertexTPC();
\r
1448 else if(GetAnalysisMode() == AlidNdPtHelper::kTPCITS) {
\r
1449 vtxESD = (AliESDVertex*)esdEvent->GetPrimaryVertexTracks();
\r
1455 if(!vtxESD) return;
\r
1457 Bool_t isEventOK = evtCuts->AcceptEvent(esdEvent,mcEvent,vtxESD);
\r
1458 //printf("isEventOK %d, isEventTriggered %d \n",isEventOK, isEventTriggered);
\r
1459 //printf("GetAnalysisMode() %d \n",GetAnalysisMode());
\r
1461 // check event cuts
\r
1462 if(isEventOK && isEventTriggered) {
\r
1464 // Dump the pt downscaled V0 into the tree
\r
1466 Int_t ntracks = esdEvent->GetNumberOfTracks();
\r
1467 Int_t nV0s = esdEvent->GetNumberOfV0s();
\r
1468 Int_t run = esdEvent->GetRunNumber();
\r
1469 Int_t time= esdEvent->GetTimeStamp();
\r
1470 Int_t evNr=esdEvent->GetEventNumberInFile();
\r
1471 Double_t bz = esdEvent->GetMagneticField();
\r
1474 for (Int_t iv0=0; iv0<nV0s; iv0++){
\r
1475 AliESDv0 * v0 = esdEvent->GetV0(iv0);
\r
1476 if (!v0) continue;
\r
1477 AliESDtrack * track0 = esdEvent->GetTrack(v0->GetIndex(0));
\r
1478 AliESDtrack * track1 = esdEvent->GetTrack(v0->GetIndex(1));
\r
1479 if (!track0) continue;
\r
1480 if (!track1) continue;
\r
1481 if (track0->GetSign()<0) {
\r
1482 track1 = esdEvent->GetTrack(v0->GetIndex(0));
\r
1483 track0 = esdEvent->GetTrack(v0->GetIndex(1));
\r
1486 Bool_t isDownscaled = IsV0Downscaled(v0);
\r
1487 if (isDownscaled) continue;
\r
1488 AliKFParticle kfparticle; //
\r
1489 Int_t type=GetKFParticle(v0,esdEvent,kfparticle);
\r
1490 if (type==0) continue;
\r
1492 if(!fTreeSRedirector) return;
\r
1493 (*fTreeSRedirector)<<"V0s"<<
\r
1494 "isDownscaled="<<isDownscaled<<
\r
1496 "fileName.="<<&fileName<<
\r
1497 "runNumber="<<run<<
\r
1498 "evtTimeStamp="<<time<<
\r
1499 "evtNumberInFile="<<evNr<<
\r
1501 "ntracks="<<ntracks<<
\r
1503 "kf.="<<&kfparticle<<
\r
1504 "track0.="<<track0<<
\r
1505 "track1.="<<track1<<
\r
1506 "centralityF="<<centralityF<<
\r
1510 PostData(1, fOutput);
\r
1513 //_____________________________________________________________________________
\r
1514 void AlidNdPtTrackDumpTask::ProcessdEdx(AliESDEvent *const esdEvent, AliMCEvent * const mcEvent, AliESDfriend *const /*esdFriend*/)
\r
1517 // Select real events with large TPC dEdx signal
\r
1520 AliDebug(AliLog::kError, "esdEvent not available");
\r
1524 // get selection cuts
\r
1525 AlidNdPtEventCuts *evtCuts = GetEventCuts();
\r
1526 AlidNdPtAcceptanceCuts *accCuts = GetAcceptanceCuts();
\r
1527 AliESDtrackCuts *esdTrackCuts = GetTrackCuts();
\r
1529 if(!evtCuts || !accCuts || !esdTrackCuts) {
\r
1530 AliDebug(AliLog::kError, "cuts not available");
\r
1535 TTree *chain = (TChain*)GetInputData(0);
\r
1537 Printf("ERROR: Could not receive input chain");
\r
1540 TObjString fileName(chain->GetCurrentFile()->GetName());
\r
1543 Bool_t isEventTriggered = kTRUE;
\r
1544 AliPhysicsSelection *physicsSelection = NULL;
\r
1545 AliTriggerAnalysis* triggerAnalysis = NULL;
\r
1548 AliInputEventHandler* inputHandler = (AliInputEventHandler*) AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler();
\r
1549 if (!inputHandler)
\r
1551 Printf("ERROR: Could not receive input handler");
\r
1555 if(evtCuts->IsTriggerRequired())
\r
1558 isEventTriggered = inputHandler->IsEventSelected() & AliVEvent::kMB;
\r
1560 physicsSelection = static_cast<AliPhysicsSelection*> (inputHandler->GetEventSelection());
\r
1561 if(!physicsSelection) return;
\r
1563 if (isEventTriggered && (GetTrigger() == AliTriggerAnalysis::kV0AND)) {
\r
1564 // set trigger (V0AND)
\r
1565 triggerAnalysis = physicsSelection->GetTriggerAnalysis();
\r
1566 if(!triggerAnalysis) return;
\r
1567 isEventTriggered = triggerAnalysis->IsOfflineTriggerFired(esdEvent, GetTrigger());
\r
1571 // get reconstructed vertex
\r
1572 AliESDVertex* vtxESD = 0;
\r
1573 if(GetAnalysisMode() == AlidNdPtHelper::kTPC) {
\r
1574 vtxESD = (AliESDVertex*)esdEvent->GetPrimaryVertexTPC();
\r
1576 else if(GetAnalysisMode() == AlidNdPtHelper::kTPCITS) {
\r
1577 vtxESD = (AliESDVertex*)esdEvent->GetPrimaryVertexTracks();
\r
1582 if(!vtxESD) return;
\r
1584 Bool_t isEventOK = evtCuts->AcceptEvent(esdEvent,mcEvent,vtxESD);
\r
1585 //printf("isEventOK %d, isEventTriggered %d \n",isEventOK, isEventTriggered);
\r
1586 //printf("GetAnalysisMode() %d \n",GetAnalysisMode());
\r
1589 // check event cuts
\r
1590 if(isEventOK && isEventTriggered)
\r
1592 Double_t vert[3] = {0};
\r
1593 vert[0] = vtxESD->GetXv();
\r
1594 vert[1] = vtxESD->GetYv();
\r
1595 vert[2] = vtxESD->GetZv();
\r
1596 Int_t mult = vtxESD->GetNContributors();
\r
1597 Double_t bz = esdEvent->GetMagneticField();
\r
1598 Double_t runNumber = esdEvent->GetRunNumber();
\r
1599 Double_t evtTimeStamp = esdEvent->GetTimeStamp();
\r
1600 Int_t evtNumberInFile = esdEvent->GetEventNumberInFile();
\r
1603 for (Int_t iTrack = 0; iTrack < esdEvent->GetNumberOfTracks(); iTrack++)
\r
1605 AliESDtrack *track = esdEvent->GetTrack(iTrack);
\r
1606 if(!track) continue;
\r
1607 if(track->Charge()==0) continue;
\r
1608 if(!esdTrackCuts->AcceptTrack(track)) continue;
\r
1609 if(!accCuts->AcceptTrack(track)) continue;
\r
1611 if(!IsHighDeDxParticle(track)) continue;
\r
1613 if(!fTreeSRedirector) return;
\r
1614 (*fTreeSRedirector)<<"dEdx"<<
\r
1615 "fileName.="<<&fileName<<
\r
1616 "runNumber="<<runNumber<<
\r
1617 "evtTimeStamp="<<evtTimeStamp<<
\r
1618 "evtNumberInFile="<<evtNumberInFile<<
\r
1620 "vtxESD.="<<vtxESD<<
\r
1622 "esdTrack.="<<track<<
\r
1628 //_____________________________________________________________________________
\r
1629 Int_t AlidNdPtTrackDumpTask::GetKFParticle(AliESDv0 *const v0, AliESDEvent * const event, AliKFParticle & kfparticle)
\r
1632 // Create KF particle in case the V0 fullfill selection criteria
\r
1634 // Selection criteria
\r
1635 // 0. algorithm cut
\r
1638 // 4. rough mass cut
\r
1639 // 5. Normalized pointing angle cut
\r
1641 const Double_t cutMass=0.2;
\r
1642 const Double_t kSigmaDCACut=3;
\r
1644 // 0.) algo cut - accept only on the fly
\r
1646 if (v0->GetOnFlyStatus() ==kFALSE) return 0;
\r
1650 AliESDtrack * track0 = event->GetTrack(v0->GetIndex(0));
\r
1651 AliESDtrack * track1 = event->GetTrack(v0->GetIndex(1));
\r
1653 TCut cutD="abs(track0.fD/sqrt(track0.fCdd))>2&&abs(track1.fD/sqrt(track1.fCdd))>2";
\r
1654 TCut cutTheta="abs(track0.fP[3])<1&&abs(track1.fP[3])<1";
\r
1655 TCut cutNcl="track0.GetTPCClusterInfo(2,1)>100&&track1.GetTPCClusterInfo(2,1)>100";
\r
1657 if (TMath::Abs(track0->GetTgl())>1) return 0;
\r
1658 if (TMath::Abs(track1->GetTgl())>1) return 0;
\r
1659 if ((track0->GetTPCClusterInfo(2,1))<100) return 0;
\r
1660 if ((track1->GetTPCClusterInfo(2,1))<100) return 0;
\r
1661 //if ((track0->GetITSclusters(0))<2) return 0;
\r
1662 //if ((track1->GetITSclusters(0))<2) return 0;
\r
1663 Float_t pos0[2]={0}, cov0[3]={0};
\r
1664 Float_t pos1[2]={0}, cov1[3]={0};
\r
1665 track0->GetImpactParameters(pos0,cov0);
\r
1666 track0->GetImpactParameters(pos1,cov1);
\r
1668 if (TMath::Abs(pos0[0])<kSigmaDCACut*TMath::Sqrt(cov0[0])) return 0;
\r
1669 if (TMath::Abs(pos1[0])<kSigmaDCACut*TMath::Sqrt(cov1[0])) return 0;
\r
1674 Double_t chi2KF = v0->GetKFInfo(2,2,2);
\r
1675 if (chi2KF>25) return 0;
\r
1677 // 4.) Rough mass cut - 0.200 GeV
\r
1679 static Double_t masses[2]={-1};
\r
1681 masses[0] = TDatabasePDG::Instance()->GetParticle("K_S0")->Mass();
\r
1682 masses[1] = TDatabasePDG::Instance()->GetParticle("Lambda0")->Mass();
\r
1684 Double_t mass00= v0->GetEffMass(0,0);
\r
1685 Double_t mass22= v0->GetEffMass(2,2);
\r
1686 Double_t mass42= v0->GetEffMass(4,2);
\r
1687 Double_t mass24= v0->GetEffMass(2,4);
\r
1688 Bool_t massOK=kFALSE;
\r
1693 if (TMath::Abs(mass00-0)<cutMass) {
\r
1694 massOK=kTRUE; type+=1;
\r
1695 if (TMath::Abs(mass00-0)<dmass) {
\r
1697 dmass=TMath::Abs(mass00-0);
\r
1701 if (TMath::Abs(mass24-masses[1])<cutMass) {
\r
1702 massOK=kTRUE; type+=2;
\r
1703 if (TMath::Abs(mass24-masses[1])<dmass){
\r
1704 dmass = TMath::Abs(mass24-masses[1]);
\r
1709 if (TMath::Abs(mass42-masses[1])<cutMass) {
\r
1710 massOK=kTRUE; type+=4;
\r
1711 if (TMath::Abs(mass42-masses[1])<dmass){
\r
1712 dmass = TMath::Abs(mass42-masses[1]);
\r
1717 if (TMath::Abs(mass22-masses[0])<cutMass) {
\r
1718 massOK=kTRUE; type+=8;
\r
1719 if (TMath::Abs(mass22-masses[0])<dmass){
\r
1720 dmass = TMath::Abs(mass22-masses[0]);
\r
1725 if (type==0) return 0;
\r
1727 const Int_t spdg[5]={kPositron,kMuonPlus,kPiPlus, kKPlus, kProton};
\r
1728 const AliExternalTrackParam *paramP = v0->GetParamP();
\r
1729 const AliExternalTrackParam *paramN = v0->GetParamN();
\r
1730 if (paramP->GetSign()<0){
\r
1731 paramP=v0->GetParamP();
\r
1732 paramN=v0->GetParamN();
\r
1734 //Double_t *pparam1 = (Double_t*)paramP->GetParameter();
\r
1735 //Double_t *pparam2 = (Double_t*)paramN->GetParameter();
\r
1737 AliKFParticle kfp1( *paramP, spdg[p1] );
\r
1738 AliKFParticle kfp2( *paramN, -1 *spdg[p2] );
\r
1739 AliKFParticle V0KF;
\r
1746 Double_t errPhi = V0KF.GetErrPhi();
\r
1747 Double_t pointAngle= TMath::ACos(v0->GetV0CosineOfPointingAngle());
\r
1748 if (pointAngle/errPhi>10) return 0;
\r
1753 //_____________________________________________________________________________
\r
1754 Bool_t AlidNdPtTrackDumpTask::IsV0Downscaled(AliESDv0 *const v0)
\r
1757 // Downscale randomly low pt V0
\r
1760 Double_t maxPt= TMath::Max(v0->GetParamP()->Pt(), v0->GetParamN()->Pt());
\r
1761 Double_t scalempt= TMath::Min(maxPt,10.);
\r
1762 Double_t downscaleF = gRandom->Rndm();
\r
1763 downscaleF *= fLowPtV0DownscaligF;
\r
1765 //printf("V0 TMath::Exp(2*scalempt) %e, downscaleF %e \n",TMath::Exp(2*scalempt), downscaleF);
\r
1766 if (TMath::Exp(2*scalempt)<downscaleF) return kTRUE;
\r
1770 TH1F his1("his1","his1",100,0,10);
\r
1771 TH1F his2("his2","his2",100,0,10);
\r
1772 {for (Int_t i=0; i<10000; i++){
\r
1773 Double_t rnd=gRandom->Exp(1);
\r
1774 Bool_t isDownscaled =TMath::Exp(rnd)<100*gRandom->Rndm();
\r
1776 if (!isDownscaled) his2->Fill(rnd);
\r
1785 //_____________________________________________________________________________
\r
1786 Bool_t AlidNdPtTrackDumpTask::ConstrainTPCInner(AliExternalTrackParam *const tpcInnerC, const AliESDVertex* vtx, Double_t b[3])
\r
1788 // Constrain TPC inner params constrained
\r
1790 if(!tpcInnerC) return kFALSE;
\r
1791 if(!vtx) return kFALSE;
\r
1793 Double_t dz[2],cov[3];
\r
1794 //AliESDVertex *vtx= (AliESDVertex *)esdEvent->GetPrimaryVertex();
\r
1795 //if(!tpcInnerC->PropagateToDCA(vtx, esdEvent->GetMagneticField(), 3, dz, cov)) return kFALSE;
\r
1796 //if(!tpcInnerC->PropagateToDCA(vtx, Bz, 3, dz, cov)) return kFALSE;
\r
1797 if(!tpcInnerC->PropagateToDCABxByBz(vtx, b, 3, dz, cov)) return kFALSE;
\r
1800 Double_t covar[6]; vtx->GetCovMatrix(covar);
\r
1801 Double_t p[2]={tpcInnerC->GetParameter()[0]-dz[0],tpcInnerC->GetParameter()[1]-dz[1]};
\r
1802 Double_t c[3]={covar[2],0.,covar[5]};
\r
1803 Double_t chi2C=tpcInnerC->GetPredictedChi2(p,c);
\r
1804 if (chi2C>kVeryBig) return kFALSE;
\r
1806 if(!tpcInnerC->Update(p,c)) return kFALSE;
\r
1811 //_____________________________________________________________________________
\r
1812 Bool_t AlidNdPtTrackDumpTask::ConstrainTrackInner(AliExternalTrackParam *const trackInnerC, const AliESDVertex* vtx, Double_t mass, Double_t b[3])
\r
1814 // Constrain TPC inner params constrained
\r
1816 if(!trackInnerC) return kFALSE;
\r
1817 if(!vtx) return kFALSE;
\r
1819 const Double_t kRadius = 2.8;
\r
1820 const Double_t kMaxStep = 1.0;
\r
1822 Double_t dz[2],cov[3];
\r
1824 //AliESDVertex *vtx= (AliESDVertex *)esdEvent->GetPrimaryVertex();
\r
1825 //if(!trackInnerC->PropagateToDCA(vtx, esdEvent->GetMagneticField(), 3, dz, cov)) return kFALSE;
\r
1826 //if(!trackInnerC->PropagateToDCA(vtx, Bz, 3, dz, cov)) return kFALSE;
\r
1828 if(!AliTracker::PropagateTrackToBxByBz(trackInnerC,kRadius,mass,kMaxStep,kFALSE)) return kFALSE;
\r
1829 if(!trackInnerC->PropagateToDCABxByBz(vtx, b, 3, dz, cov)) return kFALSE;
\r
1832 Double_t covar[6]; vtx->GetCovMatrix(covar);
\r
1833 Double_t p[2]={trackInnerC->GetParameter()[0]-dz[0],trackInnerC->GetParameter()[1]-dz[1]};
\r
1834 Double_t c[3]={covar[2],0.,covar[5]};
\r
1835 Double_t chi2C=trackInnerC->GetPredictedChi2(p,c);
\r
1836 if (chi2C>kVeryBig) return kFALSE;
\r
1838 if(!trackInnerC->Update(p,c)) return kFALSE;
\r
1844 //_____________________________________________________________________________
\r
1845 TParticle *AlidNdPtTrackDumpTask::GetMother(TParticle *const particle, AliStack *const stack)
\r
1847 if(!particle) return NULL;
\r
1848 if(!stack) return NULL;
\r
1850 Int_t motherLabel = TMath::Abs(particle->GetMother(0));
\r
1851 TParticle* mother = NULL;
\r
1852 mother = stack->Particle(motherLabel);
\r
1857 //_____________________________________________________________________________
\r
1858 Bool_t AlidNdPtTrackDumpTask::IsFromConversion(const Int_t label, AliStack *const stack)
\r
1860 Bool_t isFromConversion = kFALSE;
\r
1863 TParticle* particle = stack->Particle(label);
\r
1865 if(particle && particle->GetPDG() && particle->GetPDG()->Charge()!=0)
\r
1867 Int_t mech = particle->GetUniqueID(); // production mechanism
\r
1868 Bool_t isPrim = stack->IsPhysicalPrimary(label);
\r
1870 Int_t motherLabel = TMath::Abs(particle->GetMother(0));
\r
1871 TParticle* mother = stack->Particle(motherLabel);
\r
1873 Int_t motherPdg = mother->GetPdgCode();
\r
1875 if(!isPrim && mech==5 && motherPdg==kGamma) {
\r
1876 isFromConversion=kTRUE;
\r
1882 return isFromConversion;
\r
1885 //_____________________________________________________________________________
\r
1886 Bool_t AlidNdPtTrackDumpTask::IsFromMaterial(const Int_t label, AliStack *const stack)
\r
1888 Bool_t isFromMaterial = kFALSE;
\r
1891 TParticle* particle = stack->Particle(label);
\r
1893 if(particle && particle->GetPDG() && particle->GetPDG()->Charge()!=0)
\r
1895 Int_t mech = particle->GetUniqueID(); // production mechanism
\r
1896 Bool_t isPrim = stack->IsPhysicalPrimary(label);
\r
1898 Int_t motherLabel = TMath::Abs(particle->GetMother(0));
\r
1899 TParticle* mother = stack->Particle(motherLabel);
\r
1901 if(!isPrim && mech==13) {
\r
1902 isFromMaterial=kTRUE;
\r
1908 return isFromMaterial;
\r
1911 //_____________________________________________________________________________
\r
1912 Bool_t AlidNdPtTrackDumpTask::IsFromStrangeness(const Int_t label, AliStack *const stack)
\r
1914 Bool_t isFromStrangeness = kFALSE;
\r
1917 TParticle* particle = stack->Particle(label);
\r
1919 if(particle && particle->GetPDG() && particle->GetPDG()->Charge()!=0)
\r
1921 Int_t mech = particle->GetUniqueID(); // production mechanism
\r
1922 Bool_t isPrim = stack->IsPhysicalPrimary(label);
\r
1924 Int_t motherLabel = TMath::Abs(particle->GetMother(0));
\r
1925 TParticle* mother = stack->Particle(motherLabel);
\r
1927 Int_t motherPdg = mother->GetPdgCode();
\r
1929 // K+-, lambda, antilambda, K0s decays
\r
1930 if(!isPrim && mech==4 &&
\r
1931 (TMath::Abs(motherPdg)==kKPlus || TMath::Abs(motherPdg)==kLambda0 || motherPdg==kK0Short))
\r
1933 isFromStrangeness = kTRUE;
\r
1939 return isFromStrangeness;
\r
1943 //_____________________________________________________________________________
\r
1944 void AlidNdPtTrackDumpTask::FinishTaskOutput()
\r
1947 // Called one at the end
\r
1948 // locally on working node
\r
1951 // must be deleted to store trees
\r
1952 if(fTreeSRedirector) delete fTreeSRedirector; fTreeSRedirector=0;
\r
1954 // open temporary file and copy trees to the ouptut container
\r
1956 TChain* chain = 0;
\r
1964 chain = new TChain("dNdPtTree");
\r
1966 chain->Add("jotwinow_Temp_Trees.root");
\r
1967 tree1 = chain->CopyTree("1");
\r
1968 delete chain; chain=0;
\r
1970 if(tree1) tree1->Print();
\r
1973 chain = new TChain("V0s");
\r
1975 chain->Add("jotwinow_Temp_Trees.root");
\r
1976 tree2 = chain->CopyTree("1");
\r
1977 delete chain; chain=0;
\r
1979 if(tree2) tree2->Print();
\r
1982 chain = new TChain("dEdx");
\r
1984 chain->Add("jotwinow_Temp_Trees.root");
\r
1985 tree3 = chain->CopyTree("1");
\r
1986 delete chain; chain=0;
\r
1988 if(tree3) tree3->Print();
\r
1991 chain = new TChain("Laser");
\r
1993 chain->Add("jotwinow_Temp_Trees.root");
\r
1994 tree4 = chain->CopyTree("1");
\r
1995 delete chain; chain=0;
\r
1997 if(tree4) tree4->Print();
\r
2000 chain = new TChain("MCEffTree");
\r
2002 chain->Add("jotwinow_Temp_Trees.root");
\r
2003 tree5 = chain->CopyTree("1");
\r
2004 delete chain; chain=0;
\r
2006 if(tree5) tree5->Print();
\r
2009 chain = new TChain("CosmicPairs");
\r
2011 chain->Add("jotwinow_Temp_Trees.root");
\r
2012 tree6 = chain->CopyTree("1");
\r
2013 delete chain; chain=0;
\r
2015 if(tree6) tree6->Print();
\r
2020 if(tree1) fOutput->Add(tree1);
\r
2021 if(tree2) fOutput->Add(tree2);
\r
2022 if(tree3) fOutput->Add(tree3);
\r
2023 if(tree4) fOutput->Add(tree4);
\r
2024 if(tree5) fOutput->Add(tree5);
\r
2025 if(tree6) fOutput->Add(tree6);
\r
2027 // Post output data.
\r
2028 PostData(1, fOutput);
\r
2031 //_____________________________________________________________________________
\r
2032 void AlidNdPtTrackDumpTask::Terminate(Option_t *)
\r
2034 // Called one at the end
\r
2036 fOutputSummary = dynamic_cast<TTree*> (GetOutputData(1));
\r
2037 if(fOutputSummary) delete fOutputSummary; fOutputSummary=0;
\r
2038 TChain* chain = new TChain("dNdPtTree");
\r
2039 if(!chain) return;
\r
2040 chain->Add("jotwinow_HighPt_TrackAndV0_Trees.root");
\r
2041 TTree *tree = chain->CopyTree("1");
\r
2042 if (chain) { delete chain; chain=0; }
\r
2045 fOutputSummary = tree;
\r
2047 if (!fOutputSummary) {
\r
2048 Printf("ERROR: AlidNdPtTrackDumpTask::Terminate(): Output data not avaiable %p \n", GetOutputData(1));
\r
2053 PostData(1, fOutput);
\r