AliPhysics  vAN-20150822 (d56cf94)
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros
AliAnalysisTaskSELc2V0bachelor.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. *
3  * *
4  * Author: The ALICE Off-line Project. *
5  * Contributors are mentioned in the code where appropriate. *
6  * *
7  * Permission to use, copy, modify and distribute this software and its *
8  * documentation strictly for non-commercial purposes is hereby granted *
9  * without fee, provided that the above copyright notice appears in all *
10  * copies and that both the copyright notice and this permission notice *
11  * appeuear in the supporting documentation. The authors make no claims *
12  * about the suitability of this software for any purpose. It is *
13  * provided "as is" without express or implied warranty. *
14  **************************************************************************/
15 
16 /* $Id$ */
17 
18 //
19 //
20 // Base class for Lc2V0 Analysis
21 //
22 //
23 // The Lc spectra study is done 2D histograms:
24 // cascade_invariantMass VS cascade_pT
25 //
26 // Cuts have been centralized in AliRDHFCutsLctoV0 class
27 //
28 //-------------------------------------------------------------------------
29 //
30 // Authors: A.De Caro(a,b), P. Pagano(b)
31 // (a) Centro 'E.Fermi' - Roma
32 // (b) INFN and University of Salerno
33 //
34 // Contatcs: decaro@sa.infn.it
35 // paola.pagano@sa.infn.it
36 //-------------------------------------------------------------------------
37 
38 #include <TSystem.h>
39 #include <TParticle.h>
40 #include <TParticlePDG.h>
41 #include <TH1F.h>
42 #include <TH2F.h>
43 #include <TH3F.h>
44 #include <THnSparse.h>
45 #include <TTree.h>
46 #include "TROOT.h"
47 #include <TDatabasePDG.h>
48 #include <AliAnalysisDataSlot.h>
49 #include <AliAnalysisDataContainer.h>
50 #include "AliStack.h"
51 #include "AliMCEvent.h"
52 #include "AliAnalysisManager.h"
53 #include "AliAODMCHeader.h"
54 #include "AliAODHandler.h"
55 #include "AliLog.h"
56 #include "AliExternalTrackParam.h"
57 #include "AliAODVertex.h"
58 #include "AliAODRecoDecay.h"
59 #include "AliAODRecoDecayHF.h"
60 #include "AliAODRecoCascadeHF.h"
61 #include "AliAnalysisVertexingHF.h"
62 #include "AliESDtrack.h"
63 #include "AliAODTrack.h"
64 #include "AliAODv0.h"
65 #include "AliAODMCParticle.h"
66 #include "AliAnalysisTaskSE.h"
69 #include "AliAODPidHF.h"
70 #include "AliInputEventHandler.h"
71 #include "AliESDtrackCuts.h"
72 #include "AliNeutralTrackParam.h"
73 
74 using std::cout;
75 using std::endl;
76 
80 
81 //__________________________________________________________________________
83  fUseMCInfo(kFALSE),
84  fOutput(0),
85  fOutputAll(0),
86  fOutputPIDBach(0),
87  fCEvents(0),
88  fCounter(0),
89  fAnalCuts(0),
90  fUseOnTheFlyV0(kFALSE),
91  fIsEventSelected(kFALSE),
92  fWriteVariableTree(kFALSE),
93  fVariablesTree(0),
94  fCandidateVariables(),
95  fVtx1(0),
96  fBzkG(0),
97  fAdditionalChecks(kFALSE),
98  fTrackRotation(kFALSE),
99  fOutputPIDBachTR(0),
100  fMinAngleForRot(5*TMath::Pi()/6),
101  fMaxAngleForRot(7*TMath::Pi()/6),
102  fMinMass(0),
103  fMaxMass(0),
104  fNRotations(9),
105  fPtMinToFillTheTree(0.),
106  fPtMaxToFillTheTree(999.),
107  fUseTPCPIDtoFillTree(kFALSE),
108  fSign(2)
109 {
110  //
112  //
113 
114  Double_t mLcPDG = TDatabasePDG::Instance()->GetParticle(4122)->Mass();
115  fMinMass=mLcPDG-0.250;
116  fMaxMass=mLcPDG+0.250;
117 
118 }
119 //___________________________________________________________________________
121  AliRDHFCutsLctoV0* analCuts, Bool_t useOnTheFly,
122  Bool_t writeVariableTree, Bool_t additionalChecks, Bool_t trackRotation, Bool_t useTPCpid, Char_t sign) :
123  AliAnalysisTaskSE(name),
124  fUseMCInfo(kFALSE),
125  fOutput(0),
126  fOutputAll(0),
127  fOutputPIDBach(0),
128  fCEvents(0),
129  fCounter(0),
130  fAnalCuts(analCuts),
131  fUseOnTheFlyV0(useOnTheFly),
132  fIsEventSelected(kFALSE),
133  fWriteVariableTree(writeVariableTree),
134  fVariablesTree(0),
135  fCandidateVariables(),
136  fVtx1(0),
137  fBzkG(0),
138  fAdditionalChecks(additionalChecks),
139  fTrackRotation(trackRotation),
140  fOutputPIDBachTR(0),
141  fMinAngleForRot(5*TMath::Pi()/6),
142  fMaxAngleForRot(7*TMath::Pi()/6),
143  fMinMass(0),
144  fMaxMass(0),
145  fNRotations(9),
146  fPtMinToFillTheTree(0.),
147  fPtMaxToFillTheTree(999.),
148  fUseTPCPIDtoFillTree(useTPCpid),
149  fSign(sign)
150 {
151  //
153  //
154  Info("AliAnalysisTaskSELc2V0bachelor","Calling Constructor");
155 
157  AliInfo(Form("You cannot initialize fWriteVariableTree=%d and fTrackRotation=%d => fTrackRotation=0",fWriteVariableTree,fTrackRotation));
158  fTrackRotation=kFALSE;
159  }
160 
161  Double_t mLcPDG = TDatabasePDG::Instance()->GetParticle(4122)->Mass();
162  fMinMass=mLcPDG-0.250;
163  fMaxMass=mLcPDG+0.250;
164 
165  DefineOutput(1,TList::Class()); //conters
166  DefineOutput(2,AliNormalizationCounter::Class());
167  DefineOutput(3,AliRDHFCutsLctoV0::Class());
168  if (!writeVariableTree) {
169  DefineOutput(4,TList::Class()); //All Entries output
170  DefineOutput(5,TList::Class()); //3sigma PID output
171  if (trackRotation) {
172  DefineOutput(6,TList::Class()); //All Entries output
173  }
174  } else {
175  // Output slot #4 keeps a tree of the candidate variables after track selection
176  DefineOutput(4,TTree::Class()); //My private output
177  }
178 
179  if (fWriteVariableTree) fSign=2;
180 
181 }
182 
183 //___________________________________________________________________________
185  //
187  //
188  Info("~AliAnalysisTaskSELc2V0bachelor","Calling Destructor");
189 
190  if (fOutput) {
191  delete fOutput;
192  fOutput = 0;
193  }
194 
195  if (fOutputAll) {
196  delete fOutputAll;
197  fOutputAll = 0;
198  }
199 
200  if (fOutputPIDBach) {
201  delete fOutputPIDBach;
202  fOutputPIDBach = 0;
203  }
204 
205  if (fCounter) {
206  delete fCounter;
207  fCounter = 0;
208  }
209 
210  if (fAnalCuts) {
211  delete fAnalCuts;
212  fAnalCuts = 0;
213  }
214 
215  if (fVariablesTree) {
216  delete fVariablesTree;
217  fVariablesTree = 0;
218  }
219 
220  if (fOutputPIDBachTR) {
221  delete fOutputPIDBachTR;
222  fOutputPIDBachTR = 0;
223  }
224 
225 }
226 //_________________________________________________
228  //
230  //
231 
232  fIsEventSelected=kFALSE;
233 
234  if (fDebug > 1) AliInfo("Init");
235 
236  PostData(3,fAnalCuts);
237 
238  return;
239 }
240 
241 //_________________________________________________
243 {
245  if (!fInputEvent) {
246  AliError("NO EVENT FOUND!");
247  return;
248  }
249 
250  AliAODEvent* aodEvent = dynamic_cast<AliAODEvent*>(fInputEvent);
251  TClonesArray *arrayLctopKos=0;
252 
253  if (!aodEvent && AODEvent() && IsStandardAOD()) {
254  // In case there is an AOD handler writing a standard AOD, use the AOD
255  // event in memory rather than the input (ESD) event.
256  aodEvent = dynamic_cast<AliAODEvent*> (AODEvent());
257  // in this case the braches in the deltaAOD (AliAOD.VertexingHF.root)
258  // have to taken from the AOD event hold by the AliAODExtension
259  AliAODHandler* aodHandler = (AliAODHandler*)
260  ((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler());
261 
262  if (aodHandler->GetExtensions()) {
263  AliAODExtension *ext = (AliAODExtension*)aodHandler->GetExtensions()->FindObject("AliAOD.VertexingHF.root");
264  AliAODEvent *aodFromExt = ext->GetAOD();
265  arrayLctopKos=(TClonesArray*)aodFromExt->GetList()->FindObject("CascadesHF");
266  }
267  } else {
268  arrayLctopKos=(TClonesArray*)aodEvent->GetList()->FindObject("CascadesHF");
269  }
270 
271  fCEvents->Fill(1);
272 
273  if (fUseMCInfo)
275 
276  // AOD primary vertex
277  fVtx1 = (AliAODVertex*)aodEvent->GetPrimaryVertex();
278  if (!fVtx1) return;
279 
280  fIsEventSelected = fAnalCuts->IsEventSelected(aodEvent); // better to initialize before CheckEventSelection call
281 
282  CheckEventSelection(aodEvent);
283 
284 
285  // fix for temporary bug in ESDfilter
286  fBzkG = (Double_t)aodEvent->GetMagneticField();
287  if (TMath::Abs(fBzkG)<0.001) return;
288  fCEvents->Fill(2);
289 
290  if (!arrayLctopKos) {
291  AliInfo("Could not find array of HF cascades, skipping the event");
292  return;
293  } else {
294  if (arrayLctopKos->GetEntriesFast()) {
295  AliInfo(Form("Found %d cascades",arrayLctopKos->GetEntriesFast()));
296  }
297  }
298  fCEvents->Fill(3);
299 
300  // mc analysis
301  TClonesArray *mcArray = 0;
302  AliAODMCHeader *mcHeader=0;
303 
304  if (fUseMCInfo) {
305  // MC array need for maching
306  mcArray = dynamic_cast<TClonesArray*>(aodEvent->FindListObject(AliAODMCParticle::StdBranchName()));
307  if (!mcArray) {
308  AliError("Could not find Monte-Carlo in AOD");
309  return;
310  }
311  fCEvents->Fill(4); // in case of MC events
312 
313  // load MC header
314  mcHeader = (AliAODMCHeader*)aodEvent->GetList()->FindObject(AliAODMCHeader::StdBranchName());
315  if (!mcHeader) {
316  AliError("AliAnalysisTaskSELc2V0bachelor::UserExec: MC header branch not found!\n");
317  return;
318  }
319  fCEvents->Fill(5); // in case of MC events
320 
321  Double_t zMCVertex = mcHeader->GetVtxZ();
322  if (TMath::Abs(zMCVertex) > fAnalCuts->GetMaxVtxZ()) {
323  AliDebug(2,Form("Event rejected: abs(zVtxMC)=%f > fAnalCuts->GetMaxVtxZ()=%f",zMCVertex,fAnalCuts->GetMaxVtxZ()));
324  return;
325  } else {
326  fCEvents->Fill(17); // in case of MC events
327  }
328  }
329 
330  Int_t runnumber = aodEvent->GetRunNumber();
331  if (aodEvent->GetTriggerMask() == 0 && (runnumber >= 195344 && runnumber <= 195677)){
332  AliDebug(3,"Event rejected because of null trigger mask");
333  return;
334  }
335 
336  fCounter->StoreEvent(aodEvent,fAnalCuts,fUseMCInfo); // it is very important that it stays BEFORE any other event selection
337 
338  if (fVtx1->GetNContributors()>0) // this check is done in IsEventSelected
339  fCEvents->Fill(6);
340 
341  if ( !fIsEventSelected ) return; // don't take into account not selected events
342  fCEvents->Fill(7);
343 
344  Int_t nSelectedAnal = 0;
345  MakeAnalysisForLc2prK0S(arrayLctopKos,mcArray, nSelectedAnal, fAnalCuts);
346 
347  if (nSelectedAnal)
349 
350  fCounter->StoreCandidates(aodEvent,nSelectedAnal,kTRUE);
351  fCounter->StoreCandidates(aodEvent,nSelectedAnal,kFALSE);
352 
353  PostData(1,fOutput);
354  PostData(2,fCounter);
355  if (!fWriteVariableTree) {
356  PostData(4,fOutputAll);
357  PostData(5,fOutputPIDBach);
358  if (fTrackRotation)
359  PostData(6,fOutputPIDBachTR);
360  } else {
361  PostData(4,fVariablesTree);
362  }
363 
364  fIsEventSelected=kFALSE;
365 
366  return;
367 }
368 
369 //________________________________________ terminate ___________________________
371 {
372  // The Terminate() function is the last function to be called during
373  // a query. It always runs on the client, it can be used to present
374  // the results graphically or save the results to file.
375 
376  //AliInfo("Terminate","");
377  AliAnalysisTaskSE::Terminate();
378 
379  fOutput = dynamic_cast<TList*> (GetOutputData(1));
380  if (!fOutput) {
381  AliError("fOutput not available");
382  return;
383  }
384 
385  //fCEvents = dynamic_cast<TH1F*>(fOutput->FindObject("fCEvents"));
386  if (!fWriteVariableTree) {
387  fOutputAll = dynamic_cast<TList*> (GetOutputData(4));
388  if (!fOutputAll) {
389  AliError("fOutputAll not available");
390  return;
391  }
392 
393  fOutputPIDBach = dynamic_cast<TList*> (GetOutputData(5));
394  if (!fOutputPIDBach) {
395  AliError("fOutputPIDBach not available");
396  return;
397  }
398 
399  if (fTrackRotation) {
400  fOutputPIDBachTR = dynamic_cast<TList*> (GetOutputData(6));
401  if (!fOutputPIDBachTR) {
402  AliError("fOutputPIDBachTR not available");
403  return;
404  }
405  }
406 
407  } else {
408  fVariablesTree = dynamic_cast<TTree*> (GetOutputData(4));
409  if (!fVariablesTree) {
410  AliError("fVariablesTree not available");
411  return;
412  }
413  }
414 
415  return;
416 }
417 //___________________________________________________________________________
420  AliInfo(Form("CreateOutputObjects of task %s\n", GetName()));
421 
422  fOutput = new TList();
423  fOutput->SetOwner();
424  fOutput->SetName("chist0");
425  DefineGeneralHistograms(); // define general histograms
426  PostData(1,fOutput);
427 
428  fCounter = new AliNormalizationCounter("NormalizationCounter");
429  fCounter->Init();
430  PostData(2,fCounter);
431 
432  if (!fWriteVariableTree) {
433 
434  fOutputAll = new TList();
435  fOutputAll->SetOwner();
436  fOutputAll->SetName("listAll");
437 
438  fOutputPIDBach = new TList();
439  fOutputPIDBach->SetOwner();
440  fOutputPIDBach->SetName("listPIDBach");
441 
442  if (fTrackRotation) {
443  fOutputPIDBachTR = new TList();
444  fOutputPIDBachTR->SetOwner();
445  fOutputPIDBachTR->SetName("listPIDBachTR");
446  }
447 
448  DefineK0SHistos(); // define analysis histograms
449 
450  PostData(4,fOutputAll);
451  PostData(5,fOutputPIDBach);
452 
453  if (fTrackRotation)
454  PostData(6,fOutputPIDBachTR);
455 
456  }
457  else {
459  PostData(4,fVariablesTree);
460  }
461 
462  return;
463 }
464 
465 //-------------------------------------------------------------------------------
467  TClonesArray *mcArray,
468  Int_t &nSelectedAnal,
469  AliRDHFCutsLctoV0 *cutsAnal)
470 {
471 
473 
474  Int_t pdgCand = 4122;
475  Int_t pdgDgLctoV0bachelor[2]={2212,310}; // always 1st bachelor, 2nd V0
476  Int_t pdgDgV0toDaughters[2]={211,211};
477 
478  // loop over cascades to search for candidates Lc->p+K0S
479  Int_t nCascades= arrayLctopKos->GetEntriesFast();
480  if (nCascades==0) {
481  AliInfo("Could not find cascades, skipping the event");
482  return;
483  }
484 
485  for (Int_t iLctopK0S = 0; iLctopK0S<nCascades; iLctopK0S++) {
486 
487  ((TH1F*)(fOutput->FindObject("hCandidateSelection")))->Fill(0);
488 
489  // Lc candidates and K0S from Lc
490  AliAODRecoCascadeHF* lcK0Spr = dynamic_cast<AliAODRecoCascadeHF*>(arrayLctopKos->At(iLctopK0S));
491  if (!lcK0Spr) {
492  AliDebug(2,Form("Cascade %d doens't exist, skipping",iLctopK0S));
493  continue;
494  }
495 
496  Bool_t unsetvtx=kFALSE;
497  if (!lcK0Spr->GetOwnPrimaryVtx()) {
498  lcK0Spr->SetOwnPrimaryVtx(fVtx1);
499  unsetvtx=kTRUE;
500  }
501 
502  if (!lcK0Spr->GetSecondaryVtx()) {
503  AliInfo("No secondary vertex"); // it will be done in AliRDHFCutsLctoV0::IsSelected
504  continue;
505  }
506 
507  if (lcK0Spr->GetNDaughters()!=2) {
508  AliDebug(2,Form("Cascade %d has not 2 daughters (nDaughters=%d)",iLctopK0S,lcK0Spr->GetNDaughters())); // it will be done in AliRDHFCutsLctoV0::IsSelected
509  continue;
510  }
511 
512  if ( (fSign == 0 && lcK0Spr->Charge()<0) ||
513  (fSign == 1 && lcK0Spr->Charge()>0) ) {
514  AliDebug(2,Form("Charge of the cascade %d is different with respect to the required one",iLctopK0S)); //
515  continue;
516  }
517 
518  AliAODv0 * v0part = dynamic_cast<AliAODv0*>(lcK0Spr->Getv0());
519  AliAODTrack * bachPart = dynamic_cast<AliAODTrack*>(lcK0Spr->GetBachelor());
520  if (!v0part || !bachPart) {
521  AliDebug(2,Form("Cascade %d has no V0 or no bachelor object",iLctopK0S)); // it will be done in AliRDHFCutsLctoV0::IsSelected
522  continue;
523  }
524 
525  if (!v0part->GetSecondaryVtx()) {
526  AliDebug(2,Form("No secondary vertex for V0 by cascade %d",iLctopK0S)); // it will be done in AliRDHFCutsLctoV0::IsSelected
527  continue;
528  }
529 
530  if (v0part->GetNDaughters()!=2) {
531  AliDebug(2,Form("current V0 has not 2 daughters (onTheFly=%d, nDaughters=%d)",v0part->GetOnFlyStatus(),v0part->GetNDaughters())); // it will be done in AliRDHFCutsLctoV0::IsSelected
532  continue;
533  }
534 
535  AliAODTrack * v0Pos = dynamic_cast<AliAODTrack*>(lcK0Spr->Getv0PositiveTrack());
536  AliAODTrack * v0Neg = dynamic_cast<AliAODTrack*>(lcK0Spr->Getv0NegativeTrack());
537  if (!v0Neg || !v0Pos) {
538  AliDebug(2,Form("V0 by cascade %d has no V0positive of V0negative object",iLctopK0S)); // it will be done in AliRDHFCutsLctoV0::IsSelected
539  continue;
540  }
541 
542  ((TH1F*)(fOutput->FindObject("hCandidateSelection")))->Fill(1);
543 
544  if (v0Pos->Charge() == v0Neg->Charge()) continue;
545 
546  ((TH1F*)(fOutput->FindObject("hCandidateSelection")))->Fill(2);
547 
548  Int_t isLc = 0;
549 
550  if (fUseMCInfo) {
551 
552  Int_t pdgCode=-2;
553 
554  // find associated MC particle for Lc -> p+K0 and K0S->pi+pi
555  Int_t mcLabel = lcK0Spr->MatchToMC(pdgCand,pdgDgLctoV0bachelor[1],pdgDgLctoV0bachelor,pdgDgV0toDaughters,mcArray,kTRUE);
556  if (mcLabel!=-1) {
557  AliDebug(2,Form(" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~cascade number %d (total cascade number = %d)", iLctopK0S,nCascades));
558 
559  AliAODMCParticle *partLc = dynamic_cast<AliAODMCParticle*>(mcArray->At(mcLabel));
560  if (partLc) {
561  pdgCode = partLc->GetPdgCode();
562  if (pdgCode<0) AliDebug(2,Form(" ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ MClabel=%d ~~~~~~~~~~ pdgCode=%d", mcLabel, pdgCode));
563  pdgCode = TMath::Abs(pdgCode);
564  isLc = 1;
565  }
566  } else {
567  AliDebug(2,Form("No MC candidate (cascade number %d -total cascade number = %d -)", iLctopK0S,nCascades));
568  pdgCode=-1;
569  }
570  }
571 
572  FillLc2pK0Sspectrum(lcK0Spr, isLc,
573  nSelectedAnal, cutsAnal,
574  mcArray);
575 
576  if (unsetvtx) lcK0Spr->UnsetOwnPrimaryVtx();
577 
578  }
579 
580  AliDebug(2, Form("Found %d Reco particles that are Lc!!", nSelectedAnal));
581 
582  return;
583 }
584 
585 //________________________________________________________________________
587  Int_t isLc,
588  Int_t &nSelectedAnal,
589  AliRDHFCutsLctoV0 *cutsAnal,
590  TClonesArray *mcArray)
591 {
592  //
594  //
595 
596  TString fillthis="";
597 
598  AliAODTrack *bachelor = (AliAODTrack*)part->GetBachelor();
599  Double_t momBach = bachelor->P();
600 
601  AliAODv0 * v0part = (AliAODv0*)part->Getv0();
602  Bool_t onFlyV0 = v0part->GetOnFlyStatus(); // on-the-flight V0s
603 
604  Bool_t areCutsUsingPID = cutsAnal->GetIsUsePID();
605  cutsAnal->SetUsePID(kFALSE);
606  Bool_t isInCascadeWindow = (((cutsAnal->IsSelectedSingleCut(part,AliRDHFCuts::kCandidate,0))&(AliRDHFCutsLctoV0::kLcToK0Spr))==(AliRDHFCutsLctoV0::kLcToK0Spr)); // cut on Lc->p+K0S invMass
607  cutsAnal->SetUsePID(areCutsUsingPID);
608 
609  if ( onFlyV0 && !fUseOnTheFlyV0 ) return;
610 
612 
613  // track rotation
614  if (fTrackRotation) {
615  if (onFlyV0) {
616  TrackRotation(cutsAnal,part,"");
617  }
618  else {
619  TrackRotation(cutsAnal,part,"Offline");
620  }
621  if (fUseMCInfo) {
622  if (isLc==1) {
623  if (onFlyV0) {
624  TrackRotation(cutsAnal,part,"Sgn");
625  }
626  else {
627  TrackRotation(cutsAnal,part,"OfflineSgn");
628  }
629  }// sgn
630  else { // bkg
631  if (onFlyV0) {
632  TrackRotation(cutsAnal,part,"Bkg");
633  }
634  else {
635  TrackRotation(cutsAnal,part,"OfflineBkg");
636  }
637  }
638  } // if fUseMCInfo
639  } // if fTrackRotation
640 
641 
642 
643 
644  if ( !(cutsAnal->IsInFiducialAcceptance(part->Pt(),part->Y(4122))) ) return;
645 
647 
648  if ( ( ( (cutsAnal->IsSelected(part,AliRDHFCuts::kAll))&(AliRDHFCutsLctoV0::kLcToK0Spr)) == (AliRDHFCutsLctoV0::kLcToK0Spr) ) ) nSelectedAnal++;
649 
650  // Fill candidate variable Tree (track selection, V0 invMass selection)
651  if ( fWriteVariableTree ) {
652  Double_t invmassK0S = v0part->MassK0Short();
653  Double_t mk0sPDG = TDatabasePDG::Instance()->GetParticle(310)->Mass();
654  Double_t nSigmaTPCpr=-999.;
655  cutsAnal->GetPidHF()->GetnSigmaTPC(bachelor,4,nSigmaTPCpr);
656  if ( !onFlyV0 && isInCascadeWindow &&
657  part->CosV0PointingAngle()>0.99 && TMath::Abs(invmassK0S-mk0sPDG)<=0.05 &&
658  part->Pt()>=fPtMinToFillTheTree && part->Pt()<fPtMaxToFillTheTree &&
659  (!fUseTPCPIDtoFillTree || (fUseTPCPIDtoFillTree && TMath::Abs(nSigmaTPCpr)<3.)))
660  FillTheTree(part,cutsAnal,mcArray,isLc);
661  return;
662  }
663 
664  cutsAnal->SetUsePID(kFALSE);
665  Bool_t isCandidateSelectedCuts = (((cutsAnal->IsSelected(part,AliRDHFCuts::kCandidate))&(AliRDHFCutsLctoV0::kLcToK0Spr))==(AliRDHFCutsLctoV0::kLcToK0Spr)); // kinematic/topological cuts
666  cutsAnal->SetUsePID(areCutsUsingPID);
667  Bool_t isBachelorID = (((cutsAnal->IsSelected(part,AliRDHFCuts::kPID))&(AliRDHFCutsLctoV0::kLcToK0Spr))==(AliRDHFCutsLctoV0::kLcToK0Spr)); // ID x bachelor
668 
669  //if (((cutsAnal->IsSelected(part,AliRDHFCuts::kCandidate))&AliRDHFCutsLctoV0::kLcToK0Spr)==AliRDHFCutsLctoV0::kLcToK0Spr) {
671  if (fUseMCInfo && isLc && !fWriteVariableTree) {
672  Int_t pdgCand1 = 4122;
673  Int_t pdgDgLctoV0bachelor1[2]={2212,310};
674  Int_t pdgDgV0toDaughters1[2]={211,211};
675  Int_t mcLabel1=part->MatchToMC(pdgCand1,pdgDgLctoV0bachelor1[1],pdgDgLctoV0bachelor1,pdgDgV0toDaughters1,mcArray,kTRUE);
676  AliDebug(2,Form(" Found true MC candidate: Lc->pK0S(%d) - onTheFly=%1d",mcLabel1,onFlyV0));
677  }
678  }
679 
680  Double_t nSigmaTPCpr=-999.;
681  cutsAnal->GetPidHF()->GetnSigmaTPC(bachelor,4,nSigmaTPCpr);
682  Double_t nSigmaTOFpr=-999.;
683  cutsAnal->GetPidHF()->GetnSigmaTOF(bachelor,4,nSigmaTOFpr);
684 
685  Double_t nSigmaTPCpi=-999.;
686  cutsAnal->GetPidHF()->GetnSigmaTPC(bachelor,2,nSigmaTPCpi);
687  Double_t nSigmaTOFpi=-999.;
688  cutsAnal->GetPidHF()->GetnSigmaTOF(bachelor,2,nSigmaTOFpi);
689 
690  Double_t nSigmaTPCka=-999.;
691  cutsAnal->GetPidHF()->GetnSigmaTPC(bachelor,3,nSigmaTPCka);
692  Double_t nSigmaTOFka=-999.;
693  cutsAnal->GetPidHF()->GetnSigmaTOF(bachelor,3,nSigmaTOFka);
694 
695  if (onFlyV0) {
696 
697  fillthis="histArmPodK0S";
698  FillArmPodDistribution(v0part,fillthis,isCandidateSelectedCuts,isBachelorID);
699 
700  fillthis="histArmPodLc";
701  FillArmPodDistribution(part,fillthis,isCandidateSelectedCuts,isBachelorID);
702 
703  //if (isCandidateSelectedCuts) {
704  FillAnalysisHistograms(part,cutsAnal,"");
705  //}
706  }
707  else {
708 
709  fillthis="histArmPodK0SOffline";
710  FillArmPodDistribution(v0part,fillthis,isCandidateSelectedCuts,isBachelorID);
711 
712  fillthis="histArmPodLcOffline";
713  FillArmPodDistribution(part,fillthis,isCandidateSelectedCuts,isBachelorID);
714 
715  FillAnalysisHistograms(part,cutsAnal,"Offline");
716  if (isCandidateSelectedCuts) {
717  fillthis="histoprotonBachSigmaVspTOF";
718  ((TH2F*)(fOutput->FindObject(fillthis)))->Fill(momBach,nSigmaTOFpr);
719  fillthis="histoprotonBachSigmaVspTPC";
720  ((TH2F*)(fOutput->FindObject(fillthis)))->Fill(momBach,nSigmaTPCpr);
721  //FillAnalysisHistograms(part,cutsAnal,"Offline");
722  }
723  }
724  if (fUseMCInfo) {
725  if (isLc==1) {
726  if (onFlyV0) {
727 
728  fillthis="histArmPodK0SSgn";
729  FillArmPodDistribution(v0part,fillthis,isCandidateSelectedCuts,isBachelorID);
730 
731  fillthis="histArmPodLcSgn";
732  FillArmPodDistribution(part,fillthis,isCandidateSelectedCuts,isBachelorID);
733 
734  //if (isCandidateSelectedCuts) {
735  FillAnalysisHistograms(part,cutsAnal,"Sgn");
736  //}
737  }
738  else {
739 
740  fillthis="histArmPodK0SOfflineSgn";
741  FillArmPodDistribution(v0part,fillthis,isCandidateSelectedCuts,isBachelorID);
742 
743  fillthis="histArmPodLcOfflineSgn";
744  FillArmPodDistribution(part,fillthis,isCandidateSelectedCuts,isBachelorID);
745 
746  FillAnalysisHistograms(part,cutsAnal,"OfflineSgn");
747  if (isCandidateSelectedCuts) {
748  fillthis="histoprotonBachSigmaVspTOFsgn";
749  ((TH2F*)(fOutput->FindObject(fillthis)))->Fill(momBach,nSigmaTOFpr);
750  fillthis="histoprotonBachSigmaVspTPCsgn";
751  ((TH2F*)(fOutput->FindObject(fillthis)))->Fill(momBach,nSigmaTPCpr);
752  //FillAnalysisHistograms(part,cutsAnal,"OfflineSgn");
753  }
754  }
755  }// sgn
756  else { // bkg
757  if (onFlyV0) {
758 
759  fillthis="histArmPodK0SBkg";
760  FillArmPodDistribution(v0part,fillthis,isCandidateSelectedCuts,isBachelorID);
761 
762  fillthis="histArmPodLcBkg";
763  FillArmPodDistribution(part,fillthis,isCandidateSelectedCuts,isBachelorID);
764 
765  //if (isCandidateSelectedCuts) {
766  FillAnalysisHistograms(part,cutsAnal,"Bkg");
767  //}
768  }
769  else {
770 
771  fillthis="histArmPodK0SOfflineBkg";
772  FillArmPodDistribution(v0part,fillthis,isCandidateSelectedCuts,isBachelorID);
773 
774  fillthis="histArmPodLcOfflineBkg";
775  FillArmPodDistribution(part,fillthis,isCandidateSelectedCuts,isBachelorID);
776 
777  FillAnalysisHistograms(part,cutsAnal,"OfflineBkg");
778  if (isCandidateSelectedCuts) {
779  fillthis="histoprotonBachSigmaVspTOFbkg";
780  ((TH2F*)(fOutput->FindObject(fillthis)))->Fill(momBach,nSigmaTOFpr);
781  fillthis="histoprotonBachSigmaVspTPCbkg";
782  ((TH2F*)(fOutput->FindObject(fillthis)))->Fill(momBach,nSigmaTPCpr);
783  //FillAnalysisHistograms(part,cutsAnal,"OfflineBkg");
784  }
785  }
786  }
787  } // if fUseMCInfo
788 
789  return;
790 }
791 
792 //----------------------------------------------------
794 {
795 
796  Double_t mLcPDG = TDatabasePDG::Instance()->GetParticle(4122)->Mass();
797  Double_t mK0SPDG = TDatabasePDG::Instance()->GetParticle(310)->Mass();
798  Double_t mMinLambdaPDG = TDatabasePDG::Instance()->GetParticle(2212)->Mass()+
799  TDatabasePDG::Instance()->GetParticle(211)->Mass();
800 
801  TString nameHisto=" ", nameHistoSgn=" ", nameHistoBkg=" ";
802  TString titleHisto=" ", titleHistoSgn=" ", titleHistoBkg=" ";
803 
804  // pt(Lc)
805  Double_t *binLimpTLc=new Double_t[11+1]; // 11 pT(Lc) bins
806  binLimpTLc[ 0]= 0.;
807  binLimpTLc[ 1]= 1.;
808  binLimpTLc[ 2]= 2.;
809  binLimpTLc[ 3]= 3.;
810  binLimpTLc[ 4]= 4.;
811  binLimpTLc[ 5]= 5.;
812  binLimpTLc[ 6]= 6.;
813  binLimpTLc[ 7]= 8.;
814  binLimpTLc[ 8]=12.;
815  binLimpTLc[ 9]=17.;
816  binLimpTLc[10]=25.;
817  binLimpTLc[11]=35.;
818 
819  // pt(prong)
820  Double_t *binLimpTprong=new Double_t[41+1]; // 41 pT(prong) bins
821  binLimpTprong[ 0]= 0.0;
822  binLimpTprong[ 1]= 0.1;
823  binLimpTprong[ 2]= 0.2;
824  binLimpTprong[ 3]= 0.3;
825  binLimpTprong[ 4]= 0.4;
826  binLimpTprong[ 5]= 0.5;
827  binLimpTprong[ 6]= 0.6;
828  binLimpTprong[ 7]= 0.7;
829  binLimpTprong[ 8]= 0.8;
830  binLimpTprong[ 9]= 0.9;
831  binLimpTprong[10]= 1.0;
832  binLimpTprong[11]= 1.2;
833  binLimpTprong[12]= 1.4;
834  binLimpTprong[13]= 1.6;
835  binLimpTprong[14]= 1.8;
836  binLimpTprong[15]= 2.0;
837  binLimpTprong[16]= 2.2;
838  binLimpTprong[17]= 2.4;
839  binLimpTprong[18]= 2.6;
840  binLimpTprong[19]= 2.8;
841  binLimpTprong[20]= 3.0;
842  binLimpTprong[21]= 3.5;
843  binLimpTprong[22]= 4.0;
844  binLimpTprong[23]= 4.5;
845  binLimpTprong[24]= 5.0;
846  binLimpTprong[25]= 5.5;
847  binLimpTprong[26]= 6.0;
848  binLimpTprong[27]= 6.5;
849  binLimpTprong[28]= 7.0;
850  binLimpTprong[29]= 7.5;
851  binLimpTprong[30]= 8.0;
852  binLimpTprong[31]= 9.0;
853  binLimpTprong[32]=10.0;
854  binLimpTprong[33]=11.0;
855  binLimpTprong[34]=12.0;
856  binLimpTprong[35]=13.0;
857  binLimpTprong[36]=14.0;
858  binLimpTprong[37]=15.0;
859  binLimpTprong[38]=20.0;
860  binLimpTprong[39]=25.0;
861  binLimpTprong[40]=30.0;
862  binLimpTprong[41]=35.0;
863 
864  if (fUseOnTheFlyV0) {
865 
866  // V0 invariant masses (on-the-fly)
867  nameHisto="histK0SMass";
868  titleHisto="K^{0}_{S} invariant mass VS p_{T}; p_{T}(#Lambda_{c}) [GeV/c]; m_{inv}(#pi^{+},#pi^{-}) [GeV/c^{2}]; Entries";
869  TH2F* spectrumK0SMass = new TH2F(nameHisto.Data(),titleHisto.Data(),11,binLimpTLc,1000,mK0SPDG-0.050,mK0SPDG+0.050);
870 
871  // Lc invariant masses (x K0S on-the-fly)
872  nameHisto="histLcMassByK0S";
873  titleHisto="#Lambda_{c} invariant mass (by K^{0}_{S}) vs p_{T}; m_{inv}(p,K^{0}_{S}) [GeV/c^{2}]; p_{T}(#Lambda_{c}) [GeV/c]";
874  TH2F* spectrumLcMassByK0S = new TH2F(nameHisto.Data(),titleHisto.Data(),1000,mLcPDG-0.250,mLcPDG+0.250,11,binLimpTLc);
875 
876  nameHisto="histpK0Svsp";
877  titleHisto="p(K^{0}_{S}) vs p(p); p(p) [GeV/c]; p(K^{0}_{S}) [GeV/c]";
878  TH2F* momentumDistributionK0Svsp = new TH2F(nameHisto.Data(),titleHisto.Data(),41,binLimpTprong,41,binLimpTprong);
879 
880  nameHisto="histArmPodK0S";
881  titleHisto="V0-candidate Armenteros-Podolanski distribution; #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]";
882  TH2F* armenterosPodK0S = new TH2F(nameHisto.Data(),titleHisto.Data(),200,-1.,1.,300,0.,0.3);
883 
884  nameHisto="histArmPodLc";
885  titleHisto="#Lambda_{c}-candidate Armenteros-Podolanski distribution; #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]";
886  TH2F* armenterosPodLc = new TH2F(nameHisto.Data(),titleHisto.Data(),200,-4.,4.,800,0.,1.6);
887 
888  TH2F* allspectrumK0SMass = (TH2F*)spectrumK0SMass->Clone();
889  TH2F* allspectrumLcMassByK0S = (TH2F*)spectrumLcMassByK0S->Clone();
890  TH2F* allmomentumDistributionK0Svsp = (TH2F*)momentumDistributionK0Svsp->Clone();
891  TH2F* allArmenterosPodK0S = (TH2F*)armenterosPodK0S->Clone();
892  TH2F* allArmenterosPodLc = (TH2F*)armenterosPodLc->Clone();
893 
894  TH2F* pidBachspectrumK0SMass = (TH2F*)spectrumK0SMass->Clone();
895  TH2F* pidBachspectrumLcMassByK0S = (TH2F*)spectrumLcMassByK0S->Clone();
896  TH2F* pidBachmomentumDistributionK0Svsp = (TH2F*)momentumDistributionK0Svsp->Clone();
897  TH2F* pidBachArmenterosPodK0S = (TH2F*)armenterosPodK0S->Clone();
898  TH2F* pidBachArmenterosPodLc = (TH2F*)armenterosPodLc->Clone();
899 
900  fOutputAll->Add(allspectrumK0SMass);
901  fOutputAll->Add(allspectrumLcMassByK0S);
902  fOutputAll->Add(allmomentumDistributionK0Svsp);
903  fOutputAll->Add(allArmenterosPodK0S);
904  fOutputAll->Add(allArmenterosPodLc);
905 
906  fOutputPIDBach->Add(pidBachspectrumK0SMass);
907  fOutputPIDBach->Add(pidBachspectrumLcMassByK0S);
908  fOutputPIDBach->Add(pidBachmomentumDistributionK0Svsp);
909  fOutputPIDBach->Add(pidBachArmenterosPodK0S);
910  fOutputPIDBach->Add(pidBachArmenterosPodLc);
911 
912  nameHisto="histArmPodK0S0";
913  titleHisto="V0-candidate Armenteros-Podolanski distribution; #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]";
914  TH2F* armenterosPodK0S0 = new TH2F(nameHisto.Data(),titleHisto.Data(),200,-1.,1.,300,0.,0.3);
915  nameHisto="histArmPodLc0";
916  titleHisto="#Lambda_{c}-candidate Armenteros-Podolanski distribution; #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]";
917  TH2F* armenterosPodLc0 = new TH2F(nameHisto.Data(),titleHisto.Data(),200,-4.,4.,800,0.,1.6);
918  fOutputAll->Add(armenterosPodK0S0);
919  fOutputAll->Add(armenterosPodLc0);
920 
921 
922  if (fTrackRotation) {
923  TH2F* pidBachTRspectrumLcMassByK0S = (TH2F*)spectrumLcMassByK0S->Clone();
924  fOutputPIDBachTR->Add(pidBachTRspectrumLcMassByK0S);
925  }
926 
927 
928 
929  nameHisto="histptK0S";
930  titleHisto="p_{T}(K^{0}_{S}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(K^{0}_{S}) [GeV/c]; Entries";
931  TH2F* ptK0S = new TH2F(nameHisto.Data(),titleHisto.Data(),11,binLimpTLc,41,binLimpTprong);
932 
933  nameHisto="histptP";
934  titleHisto="p_{T}(p) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(p) [GeV/c]; Entries";
935  TH2F* ptP = new TH2F(nameHisto.Data(),titleHisto.Data(),11,binLimpTLc,41,binLimpTprong);
936 
937  nameHisto="histptPip";
938  titleHisto="p_{T}(#pi^{+}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(#pi^{+}) [GeV/c]; Entries";
939  TH2F* ptPiP = new TH2F(nameHisto.Data(),titleHisto.Data(),11,binLimpTLc,41,binLimpTprong);
940 
941  nameHisto="histptPim";
942  titleHisto="p_{T}(#pi^{-}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(#pi^{-}) [GeV/c]; Entries";
943  TH2F* ptPiM = new TH2F(nameHisto.Data(),titleHisto.Data(),11,binLimpTLc,41,binLimpTprong);
944 
945  nameHisto="histLambdaMass";
946  titleHisto="m_{inv}(p,#pi^{-}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; m_{inv}(p,#pi^{-}) [GeV/c^{2}]; Entries";
947  TH2F* massLambda = new TH2F(nameHisto.Data(),titleHisto.Data(),11,binLimpTLc,1000,mMinLambdaPDG,mMinLambdaPDG+0.5);
948 
949  nameHisto="histLambdaBarMass";
950  titleHisto="m_{inv}(#bar{p},#pi^{+}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; m_{inv}(#bar{p},#pi^{+}) [GeV/c^{2}]; Entries";
951  TH2F* massLambdaBar = new TH2F(nameHisto.Data(),titleHisto.Data(),11,binLimpTLc,1000,mMinLambdaPDG,mMinLambdaPDG+0.5);
952 
953  nameHisto="histGammaMass";
954  titleHisto="m_{inv}(e^{+},e^{-}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; m_{inv}(e^{+},e^{-}) [GeV/c^{2}]; Entries";
955  TH2F* massGamma = new TH2F(nameHisto.Data(),titleHisto.Data(),11,binLimpTLc,100,0.,1.);
956 
957  nameHisto="histD0K0S";
958  titleHisto="d_{0}(K^{0}_{S}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; d_{0}(K^{0}_{S}) [#sigmas]; Entries";
959  TH2F* d0K0S = new TH2F(nameHisto.Data(),titleHisto.Data(),11,binLimpTLc,1000,-1.,1.);
960 
961  nameHisto="histD0P";
962  titleHisto="d_{0}(p) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; d_{0}(p) [cm]; Entries";
963  TH2F* d0P = new TH2F(nameHisto.Data(),titleHisto.Data(),11,binLimpTLc,1000,-1.,1.);
964 
965  nameHisto="histCosPAK0S";
966  titleHisto="K^{0}_{S} cosine of pointing angle wrt primary vertex vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; cosine; Entries";
967  TH2F *cosPAK0S = new TH2F(nameHisto.Data(),titleHisto.Data(),41,binLimpTprong,100,0.99,1.);
968 
969  TH2F* allptK0S = (TH2F*)ptK0S->Clone();
970  TH2F* allptP = (TH2F*)ptP->Clone();
971  TH2F* allptPiP = (TH2F*)ptPiP->Clone();
972  TH2F* allptPiM = (TH2F*)ptPiM->Clone();
973  TH2F* allmassLambda = (TH2F*)massLambda->Clone();
974  TH2F* allmassLambdaBar = (TH2F*)massLambdaBar->Clone();
975  TH2F* allmassGamma = (TH2F*)massGamma->Clone();
976  TH2F* alld0K0S = (TH2F*)d0K0S->Clone();
977  TH2F* alld0P = (TH2F*)d0P->Clone();
978  TH2F* allcosPAK0S = (TH2F*)cosPAK0S->Clone();
979 
980  TH2F* pidptK0S = (TH2F*)ptK0S->Clone();
981  TH2F* pidptP = (TH2F*)ptP->Clone();
982  TH2F* pidptPiP = (TH2F*)ptPiP->Clone();
983  TH2F* pidptPiM = (TH2F*)ptPiM->Clone();
984  TH2F* pidmassLambda = (TH2F*)massLambda->Clone();
985  TH2F* pidmassLambdaBar = (TH2F*)massLambdaBar->Clone();
986  TH2F* pidmassGamma = (TH2F*)massGamma->Clone();
987  TH2F* pidd0K0S = (TH2F*)d0K0S->Clone();
988  TH2F* pidd0P = (TH2F*)d0P->Clone();
989  TH2F* pidcosPAK0S = (TH2F*)cosPAK0S->Clone();
990 
991  fOutputAll->Add(allptK0S);
992  fOutputAll->Add(allptP);
993  fOutputAll->Add(allptPiP);
994  fOutputAll->Add(allptPiM);
995  fOutputAll->Add(allmassLambda);
996  fOutputAll->Add(allmassLambdaBar);
997  fOutputAll->Add(allmassGamma);
998  fOutputAll->Add(alld0K0S);
999  fOutputAll->Add(alld0P);
1000  fOutputAll->Add(allcosPAK0S);
1001 
1002  fOutputPIDBach->Add(pidptK0S);
1003  fOutputPIDBach->Add(pidptP);
1004  fOutputPIDBach->Add(pidptPiP);
1005  fOutputPIDBach->Add(pidptPiM);
1006  fOutputPIDBach->Add(pidmassLambda);
1007  fOutputPIDBach->Add(pidmassLambdaBar);
1008  fOutputPIDBach->Add(pidmassGamma);
1009  fOutputPIDBach->Add(pidd0K0S);
1010  fOutputPIDBach->Add(pidd0P);
1011  fOutputPIDBach->Add(pidcosPAK0S);
1012 
1013  if (fTrackRotation) {
1014 
1015  TH2F* pidTRptK0S = (TH2F*)ptK0S->Clone();
1016  TH2F* pidTRptP = (TH2F*)ptP->Clone();
1017  TH2F* pidTRptPiP = (TH2F*)ptPiP->Clone();
1018  TH2F* pidTRptPiM = (TH2F*)ptPiM->Clone();
1019  TH2F* pidTRmassLambda = (TH2F*)massLambda->Clone();
1020  TH2F* pidTRmassLambdaBar = (TH2F*)massLambdaBar->Clone();
1021  TH2F* pidTRmassGamma = (TH2F*)massGamma->Clone();
1022  TH2F* pidTRcosPAK0S = (TH2F*)cosPAK0S->Clone();
1023  fOutputPIDBachTR->Add(pidTRptK0S);
1024  fOutputPIDBachTR->Add(pidTRptP);
1025  fOutputPIDBachTR->Add(pidTRptPiP);
1026  fOutputPIDBachTR->Add(pidTRptPiM);
1027  fOutputPIDBachTR->Add(pidTRmassLambda);
1028  fOutputPIDBachTR->Add(pidTRmassLambdaBar);
1029  fOutputPIDBachTR->Add(pidTRmassGamma);
1030  fOutputPIDBachTR->Add(pidTRcosPAK0S);
1031 
1032  }
1033 
1034  }
1035 
1036  // V0 invariant masses (offline)
1037  nameHisto="histK0SMassOffline";
1038  titleHisto="K^{0}_{S} invariant mass VS p_{T}; p_{T}(#Lambda_{c}) [GeV/c]; m_{inv}(#pi^{+},#pi^{-}) [GeV/c^{2}]; Entries";
1039  TH2F* spectrumK0SMassOffline = new TH2F(nameHisto.Data(),titleHisto.Data(),11,binLimpTLc,1000,mK0SPDG-0.050,mK0SPDG+0.050);
1040 
1041  // Lc invariant masses (x K0S offline)
1042  nameHisto="histLcMassByK0SOffline";
1043  titleHisto="#Lambda_{c} invariant mass (by K^{0}_{S}) vs p_{T}; m_{inv}(p,K^{0}_{S}) [GeV/c^{2}]; p_{T}(#Lambda_{c}) [GeV/c]";
1044  TH2F* spectrumLcMassOfflineByK0S = new TH2F(nameHisto.Data(),titleHisto.Data(),1000,mLcPDG-0.250,mLcPDG+0.250,11,binLimpTLc);
1045 
1046  nameHisto="histpK0SvspOffline";
1047  titleHisto="p(K^{0}_{S}) vs p(p); p(p) [GeV/c]; p(K^{0}_{S}) [GeV/c]";
1048  TH2F* momentumDistributionK0SvspOffline = new TH2F(nameHisto.Data(),titleHisto.Data(),41,binLimpTprong,41,binLimpTprong);
1049 
1050  nameHisto="histArmPodK0SOffline";
1051  titleHisto="V0-candidate Armenteros-Podolanski distribution; #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]";
1052  TH2F* armenterosPodK0SOffline = new TH2F(nameHisto.Data(),titleHisto.Data(),200,-1.,1.,300,0.,0.3);
1053 
1054  nameHisto="histArmPodLcOffline";
1055  titleHisto="#Lambda_{c}-candidate Armenteros-Podolanski distribution; #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]";
1056  TH2F* armenterosPodLcOffline = new TH2F(nameHisto.Data(),titleHisto.Data(),200,-4.,4.,800,0.,1.6);
1057 
1058  TH2F* allspectrumK0SMassOffline = (TH2F*)spectrumK0SMassOffline->Clone();
1059  TH2F* allspectrumLcMassOfflineByK0S = (TH2F*)spectrumLcMassOfflineByK0S->Clone();
1060  TH2F* allmomentumDistributionK0SvspOffline = (TH2F*)momentumDistributionK0SvspOffline->Clone();
1061  TH2F* allArmenterosPodK0SOffline = (TH2F*)armenterosPodK0SOffline->Clone();
1062  TH2F* allArmenterosPodLcOffline = (TH2F*)armenterosPodLcOffline->Clone();
1063 
1064  TH2F* pidBachspectrumK0SMassOffline = (TH2F*)spectrumK0SMassOffline->Clone();
1065  TH2F* pidBachspectrumLcMassOfflineByK0S = (TH2F*)spectrumLcMassOfflineByK0S->Clone();
1066  TH2F* pidBachmomentumDistributionK0SvspOffline = (TH2F*)momentumDistributionK0SvspOffline->Clone();
1067  TH2F* pidBachArmenterosPodK0SOffline = (TH2F*)armenterosPodK0SOffline->Clone();
1068  TH2F* pidBachArmenterosPodLcOffline = (TH2F*)armenterosPodLcOffline->Clone();
1069 
1070  fOutputAll->Add(allspectrumK0SMassOffline);
1071  fOutputAll->Add(allspectrumLcMassOfflineByK0S);
1072  fOutputAll->Add(allmomentumDistributionK0SvspOffline);
1073  fOutputAll->Add(allArmenterosPodK0SOffline);
1074  fOutputAll->Add(allArmenterosPodLcOffline);
1075 
1076  fOutputPIDBach->Add(pidBachspectrumK0SMassOffline);
1077  fOutputPIDBach->Add(pidBachspectrumLcMassOfflineByK0S);
1078  fOutputPIDBach->Add(pidBachmomentumDistributionK0SvspOffline);
1079  fOutputPIDBach->Add(pidBachArmenterosPodK0SOffline);
1080  fOutputPIDBach->Add(pidBachArmenterosPodLcOffline);
1081 
1082  nameHisto="histArmPodK0SOffline0";
1083  titleHisto="V0-candidate Armenteros-Podolanski distribution; #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]";
1084  TH2F* armenterosPodK0SOffline0 = new TH2F(nameHisto.Data(),titleHisto.Data(),200,-1.,1.,300,0.,0.3);
1085  nameHisto="histArmPodLcOffline0";
1086  titleHisto="#Lambda_{c}-candidate Armenteros-Podolanski distribution; #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]";
1087  TH2F* armenterosPodLcOffline0 = new TH2F(nameHisto.Data(),titleHisto.Data(),200,-4.,4.,800,0.,1.6);
1088  fOutputAll->Add(armenterosPodK0SOffline0);
1089  fOutputAll->Add(armenterosPodLcOffline0);
1090 
1091  if (fTrackRotation) {
1092  TH2F* pidBachTRspectrumLcMassOfflineByK0S = (TH2F*)spectrumLcMassOfflineByK0S->Clone();
1093  fOutputPIDBachTR->Add(pidBachTRspectrumLcMassOfflineByK0S);
1094  }
1095 
1096 
1097 
1098 
1099  nameHisto="histptK0SOffline";
1100  titleHisto="p_{T}(K^{0}_{S}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(K^{0}_{S}) [GeV/c]; Entries";
1101  TH2F* ptK0SOffline = new TH2F(nameHisto.Data(),titleHisto.Data(),11,binLimpTLc,41,binLimpTprong);
1102 
1103  nameHisto="histptPOffline";
1104  titleHisto="p_{T}(p) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(p) [GeV/c]; Entries";
1105  TH2F* ptPOffline = new TH2F(nameHisto.Data(),titleHisto.Data(),11,binLimpTLc,41,binLimpTprong);
1106 
1107  nameHisto="histptPipOffline";
1108  titleHisto="p_{T}(#pi^{+}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(#pi^{+}) [GeV/c]; Entries";
1109  TH2F* ptPiPOffline = new TH2F(nameHisto.Data(),titleHisto.Data(),11,binLimpTLc,41,binLimpTprong);
1110 
1111  nameHisto="histptPimOffline";
1112  titleHisto="p_{T}(#pi^{-}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(#pi^{-}) [GeV/c]; Entries";
1113  TH2F* ptPiMOffline = new TH2F(nameHisto.Data(),titleHisto.Data(),11,binLimpTLc,41,binLimpTprong);
1114 
1115  nameHisto="histLambdaMassOffline";
1116  titleHisto="m_{inv}(p,#pi^{-}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; m_{inv}(p,#pi^{-}) [GeV/c^{2}]; Entries";
1117  TH2F* massLambdaOffline = new TH2F(nameHisto.Data(),titleHisto.Data(),11,binLimpTLc,1000,mMinLambdaPDG,mMinLambdaPDG+0.5);
1118 
1119  nameHisto="histLambdaBarMassOffline";
1120  titleHisto="m_{inv}(#bar{p},#pi^{+}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; m_{inv}(#bar{p},#pi^{+}) [GeV/c^{2}]; Entries";
1121  TH2F* massLambdaBarOffline = new TH2F(nameHisto.Data(),titleHisto.Data(),11,binLimpTLc,1000,mMinLambdaPDG,mMinLambdaPDG+0.5);
1122 
1123  nameHisto="histGammaMassOffline";
1124  titleHisto="m_{inv}(e^{+},e^{-}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; m_{inv}(e^{+},e^{-}) [GeV/c^{2}]; Entries";
1125  TH2F* massGammaOffline = new TH2F(nameHisto.Data(),titleHisto.Data(),11,binLimpTLc,100,0.,1.);
1126 
1127  nameHisto="histD0K0SOffline";
1128  titleHisto="d_{0}(K^{0}_{S}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; d_{0}(K^{0}_{S}) [#sigmas]; Entries";
1129  TH2F* d0K0SOffline = new TH2F(nameHisto.Data(),titleHisto.Data(),11,binLimpTLc,1000,-1.,1.);
1130 
1131  nameHisto="histD0POffline";
1132  titleHisto="d_{0}(p) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; d_{0}(p) [cm]; Entries";
1133  TH2F* d0POffline = new TH2F(nameHisto.Data(),titleHisto.Data(),11,binLimpTLc,1000,-1.,1.);
1134 
1135  nameHisto="histCosPAK0SOffline";
1136  titleHisto="K^{0}_{S} cosine of pointing angle wrt primary vertex vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; cosine; Entries";
1137  TH2F *cosPAK0SOffline = new TH2F(nameHisto.Data(),titleHisto.Data(),41,binLimpTprong,100,0.99,1.);
1138 
1139  TH2F* allptK0SOffline = (TH2F*)ptK0SOffline->Clone();
1140  TH2F* allptPOffline = (TH2F*)ptPOffline->Clone();
1141  TH2F* allptPiPOffline = (TH2F*)ptPiPOffline->Clone();
1142  TH2F* allptPiMOffline = (TH2F*)ptPiMOffline->Clone();
1143  TH2F* allmassLambdaOffline = (TH2F*)massLambdaOffline->Clone();
1144  TH2F* allmassLambdaBarOffline = (TH2F*)massLambdaBarOffline->Clone();
1145  TH2F* allmassGammaOffline = (TH2F*)massGammaOffline->Clone();
1146  TH2F* alld0K0SOffline = (TH2F*)d0K0SOffline->Clone();
1147  TH2F* alld0POffline = (TH2F*)d0POffline->Clone();
1148  TH2F* allcosPAK0SOffline = (TH2F*)cosPAK0SOffline->Clone();
1149 
1150  TH2F* pidptK0SOffline = (TH2F*)ptK0SOffline->Clone();
1151  TH2F* pidptPOffline = (TH2F*)ptPOffline->Clone();
1152  TH2F* pidptPiPOffline = (TH2F*)ptPiPOffline->Clone();
1153  TH2F* pidptPiMOffline = (TH2F*)ptPiMOffline->Clone();
1154  TH2F* pidmassLambdaOffline = (TH2F*)massLambdaOffline->Clone();
1155  TH2F* pidmassLambdaBarOffline = (TH2F*)massLambdaBarOffline->Clone();
1156  TH2F* pidmassGammaOffline = (TH2F*)massGammaOffline->Clone();
1157  TH2F* pidd0K0SOffline = (TH2F*)d0K0SOffline->Clone();
1158  TH2F* pidd0POffline = (TH2F*)d0POffline->Clone();
1159  TH2F* pidcosPAK0SOffline = (TH2F*)cosPAK0SOffline->Clone();
1160 
1161  fOutputAll->Add(allptK0SOffline);
1162  fOutputAll->Add(allptPOffline);
1163  fOutputAll->Add(allptPiPOffline);
1164  fOutputAll->Add(allptPiMOffline);
1165  fOutputAll->Add(allmassLambdaOffline);
1166  fOutputAll->Add(allmassLambdaBarOffline);
1167  fOutputAll->Add(allmassGammaOffline);
1168  fOutputAll->Add(alld0K0SOffline);
1169  fOutputAll->Add(alld0POffline);
1170  fOutputAll->Add(allcosPAK0SOffline);
1171 
1172  fOutputPIDBach->Add(pidptK0SOffline);
1173  fOutputPIDBach->Add(pidptPOffline);
1174  fOutputPIDBach->Add(pidptPiPOffline);
1175  fOutputPIDBach->Add(pidptPiMOffline);
1176  fOutputPIDBach->Add(pidmassLambdaOffline);
1177  fOutputPIDBach->Add(pidmassLambdaBarOffline);
1178  fOutputPIDBach->Add(pidmassGammaOffline);
1179  fOutputPIDBach->Add(pidd0K0SOffline);
1180  fOutputPIDBach->Add(pidd0POffline);
1181  fOutputPIDBach->Add(pidcosPAK0SOffline);
1182 
1183  if (fTrackRotation) {
1184 
1185  TH2F* pidTRptK0SOffline = (TH2F*)ptK0SOffline->Clone();
1186  TH2F* pidTRptPOffline = (TH2F*)ptPOffline->Clone();
1187  TH2F* pidTRptPiPOffline = (TH2F*)ptPiPOffline->Clone();
1188  TH2F* pidTRptPiMOffline = (TH2F*)ptPiMOffline->Clone();
1189  TH2F* pidTRmassLambdaOffline = (TH2F*)massLambdaOffline->Clone();
1190  TH2F* pidTRmassLambdaBarOffline = (TH2F*)massLambdaBarOffline->Clone();
1191  TH2F* pidTRmassGammaOffline = (TH2F*)massGammaOffline->Clone();
1192  TH2F* pidTRcosPAK0SOffline = (TH2F*)cosPAK0SOffline->Clone();
1193  fOutputPIDBachTR->Add(pidTRptK0SOffline);
1194  fOutputPIDBachTR->Add(pidTRptPOffline);
1195  fOutputPIDBachTR->Add(pidTRptPiPOffline);
1196  fOutputPIDBachTR->Add(pidTRptPiMOffline);
1197  fOutputPIDBachTR->Add(pidTRmassLambdaOffline);
1198  fOutputPIDBachTR->Add(pidTRmassLambdaBarOffline);
1199  fOutputPIDBachTR->Add(pidTRmassGammaOffline);
1200  fOutputPIDBachTR->Add(pidTRcosPAK0SOffline);
1201 
1202  }
1203 
1204 
1205 
1206 
1207 
1208  if (fUseMCInfo) {
1209 
1210  if (fUseOnTheFlyV0) {
1211 
1212  nameHistoSgn="histK0SMassSgn";
1213  nameHistoBkg="histK0SMassBkg";
1214  titleHistoSgn="K^{0}_{S} - sgn: invariant mass VS p_{T} - MC; p_{T}(#Lambda_{c}) [GeV/c]; m_{inv}(#pi^{+},#pi^{-}) [GeV/c^{2}]; Entries";
1215  titleHistoBkg="K^{0}_{S} - bkg: invariant mass VS p_{T} - MC; p_{T}(#Lambda_{c}) [GeV/c]; m_{inv}(#pi^{+},#pi^{-}) [GeV/c^{2}]; Entries";
1216  TH2F* spectrumK0SMassSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),11,binLimpTLc,1000,mK0SPDG-0.050,mK0SPDG+0.050);
1217  TH2F* spectrumK0SMassBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),11,binLimpTLc,1000,mK0SPDG-0.050,mK0SPDG+0.050);
1218 
1219  nameHistoSgn="histLcMassByK0SSgn";
1220  nameHistoBkg="histLcMassByK0SBkg";
1221  titleHistoSgn="#Lambda_{c} - sgn: invariant mass (by K^{0}_{S}) vs p_{T} - MC; m_{inv}(p,K^{0}_{S}) [GeV/c^{2}]; p_{T}(#Lambda_{c}) [GeV/c]";
1222  titleHistoBkg="#Lambda_{c} - bkg: invariant mass (by K^{0}_{S}) vs p_{T} - MC; m_{inv}(p,K^{0}_{S}) [GeV/c^{2}]; p_{T}(#Lambda_{c}) [GeV/c]";
1223  TH2F* spectrumLcMassByK0SSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),1000,mLcPDG-0.250,mLcPDG+0.250,11,binLimpTLc);
1224  TH2F* spectrumLcMassByK0SBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),1000,mLcPDG-0.250,mLcPDG+0.250,11,binLimpTLc);
1225 
1226  nameHistoSgn="histpK0SvspSgn";
1227  nameHistoBkg="histpK0SvspBkg";
1228  titleHistoSgn="#Lambda_{c} - sgn: K^{0}_{S} vs p Total Momentum Distribution - MC; p(p) [GeV/c]; p(K^{0}_{S}) [GeV/c]";
1229  titleHistoBkg="#Lambda_{c} - bkg: K^{0}_{S} vs p Total Momentum Distribution - MC; p(p) [GeV/c]; p(K^{0}_{S}) [GeV/c]";
1230  TH2F* momentumDistributionK0SvspSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),41,binLimpTprong,41,binLimpTprong);
1231  TH2F* momentumDistributionK0SvspBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),41,binLimpTprong,41,binLimpTprong);
1232 
1233  // armenteros-podolanski plots K0S
1234  nameHistoSgn="histArmPodK0SSgn";
1235  nameHistoBkg="histArmPodK0SBkg";
1236  titleHistoSgn="V0-candidate Armenteros-Podolanski distribution (sgn); #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]";
1237  titleHistoBkg="V0-candidate Armenteros-Podolanski distribution (bkg); #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]";
1238  TH2F* armenterosPodK0SSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),200,-1.,1.,300,0.,0.3);
1239  TH2F* armenterosPodK0SBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),200,-1.,1.,300,0.,0.3);
1240 
1241  nameHistoSgn="histArmPodLcSgn";
1242  nameHistoBkg="histArmPodLcBkg";
1243  titleHistoSgn="#Lambda_{c}-candidate Armenteros-Podolanski distribution (sgn); #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]";
1244  titleHistoBkg="#Lambda_{c}-candidate Armenteros-Podolanski distribution (bkg); #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]";
1245  TH2F* armenterosPodLcSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),200,-4.,4.,800,0.,1.6);
1246  TH2F* armenterosPodLcBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),200,-4.,4.,800,0.,1.6);
1247 
1248  TH2F* allspectrumK0SMassSgn = (TH2F*)spectrumK0SMassSgn->Clone();
1249  TH2F* allspectrumK0SMassBkg = (TH2F*)spectrumK0SMassBkg->Clone();
1250  TH2F* allspectrumLcMassByK0SSgn = (TH2F*)spectrumLcMassByK0SSgn->Clone();
1251  TH2F* allspectrumLcMassByK0SBkg = (TH2F*)spectrumLcMassByK0SBkg->Clone();
1252  TH2F* allmomentumDistributionK0SvspSgn = (TH2F*)momentumDistributionK0SvspSgn->Clone();
1253  TH2F* allmomentumDistributionK0SvspBkg = (TH2F*)momentumDistributionK0SvspBkg->Clone();
1254  TH2F* allArmenterosPodK0SSgn = (TH2F*)armenterosPodK0SSgn->Clone();
1255  TH2F* allArmenterosPodK0SBkg = (TH2F*)armenterosPodK0SBkg->Clone();
1256  TH2F* allArmenterosPodLcSgn = (TH2F*)armenterosPodLcSgn->Clone();
1257  TH2F* allArmenterosPodLcBkg = (TH2F*)armenterosPodLcBkg->Clone();
1258 
1259  TH2F* pidBachspectrumK0SMassSgn = (TH2F*)spectrumK0SMassSgn->Clone();
1260  TH2F* pidBachspectrumK0SMassBkg = (TH2F*)spectrumK0SMassBkg->Clone();
1261  TH2F* pidBachspectrumLcMassByK0SSgn = (TH2F*)spectrumLcMassByK0SSgn->Clone();
1262  TH2F* pidBachspectrumLcMassByK0SBkg = (TH2F*)spectrumLcMassByK0SBkg->Clone();
1263  TH2F* pidBachmomentumDistributionK0SvspSgn = (TH2F*)momentumDistributionK0SvspSgn->Clone();
1264  TH2F* pidBachmomentumDistributionK0SvspBkg = (TH2F*)momentumDistributionK0SvspBkg->Clone();
1265  TH2F* pidBachArmenterosPodK0SSgn = (TH2F*)armenterosPodK0SSgn->Clone();
1266  TH2F* pidBachArmenterosPodK0SBkg = (TH2F*)armenterosPodK0SBkg->Clone();
1267  TH2F* pidBachArmenterosPodLcSgn = (TH2F*)armenterosPodLcSgn->Clone();
1268  TH2F* pidBachArmenterosPodLcBkg = (TH2F*)armenterosPodLcBkg->Clone();
1269 
1270  fOutputAll->Add(allspectrumK0SMassSgn);
1271  fOutputAll->Add(allspectrumK0SMassBkg);
1272  fOutputAll->Add(allspectrumLcMassByK0SSgn);
1273  fOutputAll->Add(allspectrumLcMassByK0SBkg);
1274  fOutputAll->Add(allmomentumDistributionK0SvspSgn);
1275  fOutputAll->Add(allmomentumDistributionK0SvspBkg);
1276  fOutputAll->Add(allArmenterosPodK0SSgn);
1277  fOutputAll->Add(allArmenterosPodK0SBkg);
1278  fOutputAll->Add(allArmenterosPodLcSgn);
1279  fOutputAll->Add(allArmenterosPodLcBkg);
1280 
1281  fOutputPIDBach->Add(pidBachspectrumK0SMassSgn);
1282  fOutputPIDBach->Add(pidBachspectrumK0SMassBkg);
1283  fOutputPIDBach->Add(pidBachspectrumLcMassByK0SSgn);
1284  fOutputPIDBach->Add(pidBachspectrumLcMassByK0SBkg);
1285  fOutputPIDBach->Add(pidBachmomentumDistributionK0SvspSgn);
1286  fOutputPIDBach->Add(pidBachmomentumDistributionK0SvspBkg);
1287  fOutputPIDBach->Add(pidBachArmenterosPodK0SSgn);
1288  fOutputPIDBach->Add(pidBachArmenterosPodK0SBkg);
1289  fOutputPIDBach->Add(pidBachArmenterosPodLcSgn);
1290  fOutputPIDBach->Add(pidBachArmenterosPodLcBkg);
1291 
1292  nameHistoSgn="histArmPodK0SSgn0";
1293  nameHistoBkg="histArmPodK0SBkg0";
1294  titleHistoSgn="V0-candidate Armenteros-Podolanski distribution (sgn); #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]";
1295  titleHistoBkg="V0-candidate Armenteros-Podolanski distribution (bkg); #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]";
1296  TH2F* armenterosPodK0SSgn0 = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),200,-1.,1.,300,0.,0.3);
1297  TH2F* armenterosPodK0SBkg0 = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),200,-1.,1.,300,0.,0.3);
1298  fOutputAll->Add(armenterosPodK0SSgn0);
1299  fOutputAll->Add(armenterosPodK0SBkg0);
1300  nameHistoSgn="histArmPodLcSgn0";
1301  nameHistoBkg="histArmPodLcBkg0";
1302  titleHistoSgn="#Lambda_{c}-candidate Armenteros-Podolanski distribution (sgn); #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]";
1303  titleHistoBkg="#Lambda_{c}-candidate Armenteros-Podolanski distribution (bkg); #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]";
1304  TH2F* armenterosPodLcSgn0 = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),200,-4.,4.,800,0.,1.6);
1305  TH2F* armenterosPodLcBkg0 = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),200,-4.,4.,800,0.,1.6);
1306  fOutputAll->Add(armenterosPodLcSgn0);
1307  fOutputAll->Add(armenterosPodLcBkg0);
1308 
1309  if (fTrackRotation) {
1310  TH2F* pidBachTRspectrumLcMassByK0SSgn = (TH2F*)spectrumLcMassByK0SSgn->Clone();
1311  TH2F* pidBachTRspectrumLcMassByK0SBkg = (TH2F*)spectrumLcMassByK0SBkg->Clone();
1312  fOutputPIDBachTR->Add(pidBachTRspectrumLcMassByK0SSgn);
1313  fOutputPIDBachTR->Add(pidBachTRspectrumLcMassByK0SBkg);
1314  }
1315 
1316 
1317 
1318  nameHistoSgn="histptK0SSgn";
1319  nameHistoBkg="histptK0SBkg";
1320  titleHistoSgn="p_{T}(K^{0}_{S}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(K^{0}_{S}) [GeV/c]; Entries";
1321  titleHistoBkg="p_{T}(K^{0}_{S}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(K^{0}_{S}) [GeV/c]; Entries";
1322  TH2F* ptK0SSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),11,binLimpTLc,41,binLimpTprong);
1323  TH2F* ptK0SBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),11,binLimpTLc,41,binLimpTprong);
1324 
1325  nameHistoSgn="histptPSgn";
1326  nameHistoBkg="histptPBkg";
1327  titleHistoSgn="p_{T}(p) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(p) [GeV/c]; Entries";
1328  titleHistoBkg="p_{T}(p) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(p) [GeV/c]; Entries";
1329  TH2F* ptPSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),11,binLimpTLc,41,binLimpTprong);
1330  TH2F* ptPBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),11,binLimpTLc,41,binLimpTprong);
1331 
1332  nameHistoSgn="histptPipSgn";
1333  nameHistoBkg="histptPipBkg";
1334  titleHistoSgn="p_{T}(#pi^{+}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(#pi^{+}) [GeV/c]; Entries";
1335  titleHistoBkg="p_{T}(#pi^{+}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(#pi^{+}) [GeV/c]; Entries";
1336  TH2F* ptPiPSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),11,binLimpTLc,41,binLimpTprong);
1337  TH2F* ptPiPBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),11,binLimpTLc,41,binLimpTprong);
1338 
1339  nameHistoSgn="histptPimSgn";
1340  nameHistoBkg="histptPimBkg";
1341  titleHistoSgn="p_{T}(#pi^{-}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(#pi^{-}) [GeV/c]; Entries";
1342  titleHistoBkg="p_{T}(#pi^{-}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(#pi^{-}) [GeV/c]; Entries";
1343  TH2F* ptPiMSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),11,binLimpTLc,41,binLimpTprong);
1344  TH2F* ptPiMBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),11,binLimpTLc,41,binLimpTprong);
1345 
1346  nameHistoSgn="histLambdaMassSgn";
1347  nameHistoBkg="histLambdaMassBkg";
1348  titleHistoSgn="m_{inv}(p,#pi^{-}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; m_{inv}(p,#pi^{-}) [GeV/c^{2}]; Entries";
1349  titleHistoBkg="m_{inv}(p,#pi^{-}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; m_{inv}(p,#pi^{-}) [GeV/c^{2}]; Entries";
1350  TH2F* massLambdaSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),11,binLimpTLc,1000,mMinLambdaPDG,mMinLambdaPDG+0.5);
1351  TH2F* massLambdaBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),11,binLimpTLc,1000,mMinLambdaPDG,mMinLambdaPDG+0.5);
1352 
1353  nameHistoSgn="histLambdaBarMassSgn";
1354  nameHistoBkg="histLambdaBarMassBkg";
1355  titleHistoSgn="m_{inv}(#bar{p},#pi^{+}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; m_{inv}(#bar{p},#pi^{+}) [GeV/c^{2}]; Entries";
1356  titleHistoBkg="m_{inv}(#bar{p},#pi^{+}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; m_{inv}(#bar{p},#pi^{+}) [GeV/c^{2}]; Entries";
1357  TH2F* massLambdaBarSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),11,binLimpTLc,1000,mMinLambdaPDG,mMinLambdaPDG+0.5);
1358  TH2F* massLambdaBarBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),11,binLimpTLc,1000,mMinLambdaPDG,mMinLambdaPDG+0.5);
1359 
1360  nameHistoSgn="histGammaMassSgn";
1361  nameHistoBkg="histGammaMassBkg";
1362  titleHistoSgn="m_{inv}(e^{+},e^{-}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; m_{inv}(e^{+},e^{-}) [GeV/c^{2}]; Entries";
1363  titleHistoBkg="m_{inv}(e^{+},e^{-}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; m_{inv}(e^{+},e^{-}) [GeV/c^{2}]; Entries";
1364  TH2F* massGammaSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),11,binLimpTLc,100,0.,1.);
1365  TH2F* massGammaBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),11,binLimpTLc,100,0.,1.);
1366 
1367  nameHistoSgn="histD0K0SSgn";
1368  nameHistoBkg="histD0K0SBkg";
1369  titleHistoSgn="d_{0}(K^{0}_{S}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; d_{0}(K^{0}_{S}) [#sigmas]; Entries";
1370  titleHistoBkg="d_{0}(K^{0}_{S}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; d_{0}(K^{0}_{S}) [#sigmas]; Entries";
1371  TH2F* d0K0SSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),11,binLimpTLc,1000,-1.,1.);
1372  TH2F* d0K0SBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),11,binLimpTLc,1000,-1.,1.);
1373 
1374  nameHistoSgn="histD0PSgn";
1375  nameHistoBkg="histD0PBkg";
1376  titleHistoSgn="d_{0}(p) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; d_{0}(p) [cm]; Entries";
1377  titleHistoBkg="d_{0}(p) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; d_{0}(p) [cm]; Entries";
1378  TH2F* d0PSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),11,binLimpTLc,1000,-1.,1.);
1379  TH2F* d0PBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),11,binLimpTLc,1000,-1.,1.);
1380 
1381  nameHistoSgn="histCosPAK0SSgn";
1382  nameHistoBkg="histCosPAK0SBkg";
1383  titleHistoSgn="K^{0}_{S} cosine of pointing angle wrt primary vertex vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; cosine; Entries";
1384  titleHistoBkg="K^{0}_{S} cosine of pointing angle wrt primary vertex vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; cosine; Entries";
1385  TH2F *cosPAK0SSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),41,binLimpTprong,100,0.99,1.);
1386  TH2F *cosPAK0SBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),41,binLimpTprong,100,0.99,1.);
1387 
1388  TH2F* allptK0SSgn = (TH2F*)ptK0SSgn->Clone();
1389  TH2F* allptK0SBkg = (TH2F*)ptK0SBkg->Clone();
1390  TH2F* allptPSgn = (TH2F*)ptPSgn->Clone();
1391  TH2F* allptPBkg = (TH2F*)ptPBkg->Clone();
1392  TH2F* allptPiPSgn = (TH2F*)ptPiPSgn->Clone();
1393  TH2F* allptPiPBkg = (TH2F*)ptPiPBkg->Clone();
1394  TH2F* allptPiMSgn = (TH2F*)ptPiMSgn->Clone();
1395  TH2F* allptPiMBkg = (TH2F*)ptPiMBkg->Clone();
1396  TH2F* allmassLambdaSgn = (TH2F*)massLambdaSgn->Clone();
1397  TH2F* allmassLambdaBkg = (TH2F*)massLambdaBkg->Clone();
1398  TH2F* allmassLambdaBarSgn = (TH2F*)massLambdaBarSgn->Clone();
1399  TH2F* allmassLambdaBarBkg = (TH2F*)massLambdaBarBkg->Clone();
1400  TH2F* allmassGammaSgn = (TH2F*)massGammaSgn->Clone();
1401  TH2F* allmassGammaBkg = (TH2F*)massGammaBkg->Clone();
1402  TH2F* alld0K0SSgn = (TH2F*)d0K0SSgn->Clone();
1403  TH2F* alld0K0SBkg = (TH2F*)d0K0SBkg->Clone();
1404  TH2F* alld0PSgn = (TH2F*)d0PSgn->Clone();
1405  TH2F* alld0PBkg = (TH2F*)d0PBkg->Clone();
1406  TH2F* allcosPAK0SSgn = (TH2F*)cosPAK0SSgn->Clone();
1407  TH2F* allcosPAK0SBkg = (TH2F*)cosPAK0SBkg->Clone();
1408 
1409  TH2F* pidptK0SSgn = (TH2F*)ptK0SSgn->Clone();
1410  TH2F* pidptK0SBkg = (TH2F*)ptK0SBkg->Clone();
1411  TH2F* pidptPSgn = (TH2F*)ptPSgn->Clone();
1412  TH2F* pidptPBkg = (TH2F*)ptPBkg->Clone();
1413  TH2F* pidptPiPSgn = (TH2F*)ptPiPSgn->Clone();
1414  TH2F* pidptPiPBkg = (TH2F*)ptPiPBkg->Clone();
1415  TH2F* pidptPiMSgn = (TH2F*)ptPiMSgn->Clone();
1416  TH2F* pidptPiMBkg = (TH2F*)ptPiMBkg->Clone();
1417  TH2F* pidmassLambdaSgn = (TH2F*)massLambdaSgn->Clone();
1418  TH2F* pidmassLambdaBkg = (TH2F*)massLambdaBkg->Clone();
1419  TH2F* pidmassLambdaBarSgn = (TH2F*)massLambdaBarSgn->Clone();
1420  TH2F* pidmassLambdaBarBkg = (TH2F*)massLambdaBarBkg->Clone();
1421  TH2F* pidmassGammaSgn = (TH2F*)massGammaSgn->Clone();
1422  TH2F* pidmassGammaBkg = (TH2F*)massGammaBkg->Clone();
1423  TH2F* pidd0K0SSgn = (TH2F*)d0K0SSgn->Clone();
1424  TH2F* pidd0K0SBkg = (TH2F*)d0K0SBkg->Clone();
1425  TH2F* pidd0PSgn = (TH2F*)d0PSgn->Clone();
1426  TH2F* pidd0PBkg = (TH2F*)d0PBkg->Clone();
1427  TH2F* pidcosPAK0SSgn = (TH2F*)cosPAK0SSgn->Clone();
1428  TH2F* pidcosPAK0SBkg = (TH2F*)cosPAK0SBkg->Clone();
1429 
1430  fOutputAll->Add(allptK0SSgn);
1431  fOutputAll->Add(allptK0SBkg);
1432  fOutputAll->Add(allptPSgn);
1433  fOutputAll->Add(allptPBkg);
1434  fOutputAll->Add(allptPiPSgn);
1435  fOutputAll->Add(allptPiPBkg);
1436  fOutputAll->Add(allptPiMSgn);
1437  fOutputAll->Add(allptPiMBkg);
1438  fOutputAll->Add(allmassLambdaSgn);
1439  fOutputAll->Add(allmassLambdaBkg);
1440  fOutputAll->Add(allmassLambdaBarSgn);
1441  fOutputAll->Add(allmassLambdaBarBkg);
1442  fOutputAll->Add(allmassGammaSgn);
1443  fOutputAll->Add(allmassGammaBkg);
1444  fOutputAll->Add(alld0K0SSgn);
1445  fOutputAll->Add(alld0K0SBkg);
1446  fOutputAll->Add(alld0PSgn);
1447  fOutputAll->Add(alld0PBkg);
1448  fOutputAll->Add(allcosPAK0SSgn);
1449  fOutputAll->Add(allcosPAK0SBkg);
1450 
1451  fOutputPIDBach->Add(pidptK0SSgn);
1452  fOutputPIDBach->Add(pidptK0SBkg);
1453  fOutputPIDBach->Add(pidptPSgn);
1454  fOutputPIDBach->Add(pidptPBkg);
1455  fOutputPIDBach->Add(pidptPiPSgn);
1456  fOutputPIDBach->Add(pidptPiPBkg);
1457  fOutputPIDBach->Add(pidptPiMSgn);
1458  fOutputPIDBach->Add(pidptPiMBkg);
1459  fOutputPIDBach->Add(pidmassLambdaSgn);
1460  fOutputPIDBach->Add(pidmassLambdaBkg);
1461  fOutputPIDBach->Add(pidmassLambdaBarSgn);
1462  fOutputPIDBach->Add(pidmassLambdaBarBkg);
1463  fOutputPIDBach->Add(pidmassGammaSgn);
1464  fOutputPIDBach->Add(pidmassGammaBkg);
1465  fOutputPIDBach->Add(pidd0K0SSgn);
1466  fOutputPIDBach->Add(pidd0K0SBkg);
1467  fOutputPIDBach->Add(pidd0PSgn);
1468  fOutputPIDBach->Add(pidd0PBkg);
1469  fOutputPIDBach->Add(pidcosPAK0SSgn);
1470  fOutputPIDBach->Add(pidcosPAK0SBkg);
1471 
1472  if (fTrackRotation) {
1473 
1474  TH2F* pidTRptK0SSgn = (TH2F*)ptK0SSgn->Clone();
1475  TH2F* pidTRptK0SBkg = (TH2F*)ptK0SBkg->Clone();
1476  TH2F* pidTRptPSgn = (TH2F*)ptPSgn->Clone();
1477  TH2F* pidTRptPBkg = (TH2F*)ptPBkg->Clone();
1478  TH2F* pidTRptPiPSgn = (TH2F*)ptPiPSgn->Clone();
1479  TH2F* pidTRptPiPBkg = (TH2F*)ptPiPBkg->Clone();
1480  TH2F* pidTRptPiMSgn = (TH2F*)ptPiMSgn->Clone();
1481  TH2F* pidTRptPiMBkg = (TH2F*)ptPiMBkg->Clone();
1482  TH2F* pidTRmassLambdaSgn = (TH2F*)massLambdaSgn->Clone();
1483  TH2F* pidTRmassLambdaBkg = (TH2F*)massLambdaBkg->Clone();
1484  TH2F* pidTRmassLambdaBarSgn = (TH2F*)massLambdaBarSgn->Clone();
1485  TH2F* pidTRmassLambdaBarBkg = (TH2F*)massLambdaBarBkg->Clone();
1486  TH2F* pidTRmassGammaSgn = (TH2F*)massGammaSgn->Clone();
1487  TH2F* pidTRmassGammaBkg = (TH2F*)massGammaBkg->Clone();
1488  TH2F* pidTRcosPAK0SSgn = (TH2F*)cosPAK0SSgn->Clone();
1489  TH2F* pidTRcosPAK0SBkg = (TH2F*)cosPAK0SBkg->Clone();
1490  fOutputPIDBachTR->Add(pidTRptK0SSgn);
1491  fOutputPIDBachTR->Add(pidTRptK0SBkg);
1492  fOutputPIDBachTR->Add(pidTRptPSgn);
1493  fOutputPIDBachTR->Add(pidTRptPBkg);
1494  fOutputPIDBachTR->Add(pidTRptPiPSgn);
1495  fOutputPIDBachTR->Add(pidTRptPiPBkg);
1496  fOutputPIDBachTR->Add(pidTRptPiMSgn);
1497  fOutputPIDBachTR->Add(pidTRptPiMBkg);
1498  fOutputPIDBachTR->Add(pidTRmassLambdaSgn);
1499  fOutputPIDBachTR->Add(pidTRmassLambdaBkg);
1500  fOutputPIDBachTR->Add(pidTRmassLambdaBarSgn);
1501  fOutputPIDBachTR->Add(pidTRmassLambdaBarBkg);
1502  fOutputPIDBachTR->Add(pidTRmassGammaSgn);
1503  fOutputPIDBachTR->Add(pidTRmassGammaBkg);
1504  fOutputPIDBachTR->Add(pidTRcosPAK0SSgn);
1505  fOutputPIDBachTR->Add(pidTRcosPAK0SBkg);
1506 
1507  }
1508 
1509 
1510  } // useOnTheFly
1511 
1512 
1513  nameHistoSgn="histK0SMassOfflineSgn";
1514  nameHistoBkg="histK0SMassOfflineBkg";
1515  titleHistoSgn="K^{0}_{S} - sgn: invariant mass VS p_{T} - MC; p_{T}(#Lambda_{c}) [GeV/c]; m_{inv}(#pi^{+},#pi^{-}) [GeV/c^{2}]; Entries";
1516  titleHistoBkg="K^{0}_{S} - bkg: invariant mass VS p_{T} - MC; p_{T}(#Lambda_{c}) [GeV/c]; m_{inv}(#pi^{+},#pi^{-}) [GeV/c^{2}]; Entries";
1517  TH2F* spectrumK0SMassOfflineSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),11,binLimpTLc,1000,mK0SPDG-0.050,mK0SPDG+0.050);
1518  TH2F* spectrumK0SMassOfflineBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),11,binLimpTLc,1000,mK0SPDG-0.050,mK0SPDG+0.050);
1519 
1520  nameHistoSgn="histLcMassByK0SOfflineSgn";
1521  nameHistoBkg="histLcMassByK0SOfflineBkg";
1522  titleHistoSgn="#Lambda_{c} - sgn: invariant mass (by K^{0}_{S}) vs p_{T} - MC; m_{inv}(p,K^{0}_{S}) [GeV/c^{2}]; p_{T}(#Lambda_{c}) [GeV/c]";
1523  titleHistoBkg="#Lambda_{c} - bkg: invariant mass (by K^{0}_{S}) vs p_{T} - MC; m_{inv}(p,K^{0}_{S}) [GeV/c^{2}]; p_{T}(#Lambda_{c}) [GeV/c]";
1524  TH2F* spectrumLcMassOfflineByK0SSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),1000,mLcPDG-0.250,mLcPDG+0.250,11,binLimpTLc);
1525  TH2F* spectrumLcMassOfflineByK0SBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),1000,mLcPDG-0.250,mLcPDG+0.250,11,binLimpTLc);
1526 
1527  nameHistoSgn="histpK0SvspOfflineSgn";
1528  nameHistoBkg="histpK0SvspOfflineBkg";
1529  titleHistoSgn="#Lambda_{c} - sgn: K^{0}_{S} vs p Total Momentum Distribution - Offline - MC; p(p) [GeV/c]; p(K^{0}_{S}) [GeV/c]";
1530  titleHistoBkg="#Lambda_{c} - bkg: K^{0}_{S} vs p Total Momentum Distribution - Offline - MC; p(p) [GeV/c]; p(K^{0}_{S}) [GeV/c]";
1531  TH2F* momentumDistributionK0SvspOfflineSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),41,binLimpTprong,41,binLimpTprong);
1532  TH2F* momentumDistributionK0SvspOfflineBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),41,binLimpTprong,41,binLimpTprong);
1533 
1534  // armenteros-podolanski plots K0S (offline)
1535  nameHistoSgn="histArmPodK0SOfflineSgn";
1536  nameHistoBkg="histArmPodK0SOfflineBkg";
1537  titleHistoSgn="V0-candidate Armenteros-Podolanski distribution (sgn) -offline-; #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]";
1538  titleHistoBkg="V0-candidate Armenteros-Podolanski distribution (bkg) -offline-; #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]";
1539  TH2F* armenterosPodK0SOfflineSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),200,-1.,1.,300,0.,0.3);
1540  TH2F* armenterosPodK0SOfflineBkg = new TH2F(nameHistoBkg.Data(),titleHistoSgn.Data(),200,-1.,1.,300,0.,0.3);
1541 
1542  nameHistoSgn="histArmPodLcOfflineSgn";
1543  nameHistoBkg="histArmPodLcOfflineBkg";
1544  titleHistoSgn="#Lambda_{c}-candidate Armenteros-Podolanski distribution (sgn) -offline-; #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]";
1545  titleHistoBkg="#Lambda_{c}-candidate Armenteros-Podolanski distribution (bkg) -offline-; #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]";
1546  TH2F* armenterosPodLcOfflineSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),200,-4.,4.,800,0.,1.6);
1547  TH2F* armenterosPodLcOfflineBkg = new TH2F(nameHistoBkg.Data(),titleHistoSgn.Data(),200,-4.,4.,800,0.,1.6);
1548 
1549 
1550  TH2F* allspectrumK0SMassOfflineSgn = (TH2F*)spectrumK0SMassOfflineSgn->Clone();
1551  TH2F* allspectrumK0SMassOfflineBkg = (TH2F*) spectrumK0SMassOfflineBkg->Clone();
1552  TH2F* allspectrumLcMassOfflineByK0SSgn = (TH2F*)spectrumLcMassOfflineByK0SSgn->Clone();
1553  TH2F* allspectrumLcMassOfflineByK0SBkg = (TH2F*) spectrumLcMassOfflineByK0SBkg->Clone();
1554  TH2F* allmomentumDistributionK0SvspOfflineSgn = (TH2F*)momentumDistributionK0SvspOfflineSgn->Clone();
1555  TH2F* allmomentumDistributionK0SvspOfflineBkg = (TH2F*)momentumDistributionK0SvspOfflineBkg->Clone();
1556  TH2F* allArmenterosPodK0SOfflineSgn = (TH2F*)armenterosPodK0SOfflineSgn->Clone();
1557  TH2F* allArmenterosPodK0SOfflineBkg = (TH2F*)armenterosPodK0SOfflineBkg->Clone();
1558  TH2F* allArmenterosPodLcOfflineSgn = (TH2F*)armenterosPodLcOfflineSgn->Clone();
1559  TH2F* allArmenterosPodLcOfflineBkg = (TH2F*)armenterosPodLcOfflineBkg->Clone();
1560 
1561  TH2F* pidBachspectrumLcMassOfflineByK0SSgn = (TH2F*)spectrumLcMassOfflineByK0SSgn->Clone();
1562  TH2F* pidBachspectrumLcMassOfflineByK0SBkg = (TH2F*) spectrumLcMassOfflineByK0SBkg->Clone();
1563  TH2F* pidBachspectrumK0SMassOfflineSgn = (TH2F*)spectrumK0SMassOfflineSgn->Clone();
1564  TH2F* pidBachspectrumK0SMassOfflineBkg = (TH2F*) spectrumK0SMassOfflineBkg->Clone();
1565  TH2F* pidBachmomentumDistributionK0SvspOfflineSgn = (TH2F*)momentumDistributionK0SvspOfflineSgn->Clone();
1566  TH2F* pidBachmomentumDistributionK0SvspOfflineBkg = (TH2F*)momentumDistributionK0SvspOfflineBkg->Clone();
1567  TH2F* pidBachArmenterosPodK0SOfflineSgn = (TH2F*)armenterosPodK0SOfflineSgn->Clone();
1568  TH2F* pidBachArmenterosPodK0SOfflineBkg = (TH2F*)armenterosPodK0SOfflineBkg->Clone();
1569  TH2F* pidBachArmenterosPodLcOfflineSgn = (TH2F*)armenterosPodLcOfflineSgn->Clone();
1570  TH2F* pidBachArmenterosPodLcOfflineBkg = (TH2F*)armenterosPodLcOfflineBkg->Clone();
1571 
1572  fOutputAll->Add(allspectrumK0SMassOfflineSgn);
1573  fOutputAll->Add(allspectrumK0SMassOfflineBkg);
1574  fOutputAll->Add(allspectrumLcMassOfflineByK0SSgn);
1575  fOutputAll->Add(allspectrumLcMassOfflineByK0SBkg);
1576  fOutputAll->Add(allmomentumDistributionK0SvspOfflineSgn);
1577  fOutputAll->Add(allmomentumDistributionK0SvspOfflineBkg);
1578  fOutputAll->Add(allArmenterosPodK0SOfflineSgn);
1579  fOutputAll->Add(allArmenterosPodK0SOfflineBkg);
1580  fOutputAll->Add(allArmenterosPodLcOfflineSgn);
1581  fOutputAll->Add(allArmenterosPodLcOfflineBkg);
1582 
1583  fOutputPIDBach->Add(pidBachspectrumK0SMassOfflineSgn);
1584  fOutputPIDBach->Add(pidBachspectrumK0SMassOfflineBkg);
1585  fOutputPIDBach->Add(pidBachspectrumLcMassOfflineByK0SSgn);
1586  fOutputPIDBach->Add(pidBachspectrumLcMassOfflineByK0SBkg);
1587  fOutputPIDBach->Add(pidBachmomentumDistributionK0SvspOfflineSgn);
1588  fOutputPIDBach->Add(pidBachmomentumDistributionK0SvspOfflineBkg);
1589  fOutputPIDBach->Add(pidBachArmenterosPodK0SOfflineSgn);
1590  fOutputPIDBach->Add(pidBachArmenterosPodK0SOfflineBkg);
1591  fOutputPIDBach->Add(pidBachArmenterosPodLcOfflineSgn);
1592  fOutputPIDBach->Add(pidBachArmenterosPodLcOfflineBkg);
1593 
1594  nameHistoSgn="histArmPodK0SOfflineSgn0";
1595  nameHistoBkg="histArmPodK0SOfflineBkg0";
1596  titleHistoSgn="V0-candidate Armenteros-Podolanski distribution (sgn) -offline-; #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]";
1597  titleHistoBkg="V0-candidate Armenteros-Podolanski distribution (bkg) -offline-; #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]";
1598  TH2F* armenterosPodK0SOfflineSgn0 = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),200,-1.,1.,300,0.,0.3);
1599  TH2F* armenterosPodK0SOfflineBkg0 = new TH2F(nameHistoBkg.Data(),titleHistoSgn.Data(),200,-1.,1.,300,0.,0.3);
1600  nameHistoSgn="histArmPodLcOfflineSgn0";
1601  nameHistoBkg="histArmPodLcOfflineBkg0";
1602  titleHistoSgn="#Lambda_{c}-candidate Armenteros-Podolanski distribution (sgn) -offline-; #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]";
1603  titleHistoBkg="#Lambda_{c}-candidate Armenteros-Podolanski distribution (bkg) -offline-; #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]";
1604  TH2F* armenterosPodLcOfflineSgn0 = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),200,-4.,4.,800,0.,1.6);
1605  TH2F* armenterosPodLcOfflineBkg0 = new TH2F(nameHistoBkg.Data(),titleHistoSgn.Data(),200,-4.,4.,800,0.,1.6);
1606  fOutputAll->Add(armenterosPodK0SOfflineSgn0);
1607  fOutputAll->Add(armenterosPodK0SOfflineBkg0);
1608  fOutputAll->Add(armenterosPodLcOfflineSgn0);
1609  fOutputAll->Add(armenterosPodLcOfflineBkg0);
1610 
1611  if (fTrackRotation) {
1612  TH2F* pidBachTRspectrumLcMassOfflineByK0SSgn = (TH2F*)spectrumLcMassOfflineByK0SSgn->Clone();
1613  TH2F* pidBachTRspectrumLcMassOfflineByK0SBkg = (TH2F*) spectrumLcMassOfflineByK0SBkg->Clone();
1614  fOutputPIDBachTR->Add(pidBachTRspectrumLcMassOfflineByK0SSgn);
1615  fOutputPIDBachTR->Add(pidBachTRspectrumLcMassOfflineByK0SBkg);
1616  }
1617 
1618 
1619 
1620 
1621  nameHistoSgn="histptK0SOfflineSgn";
1622  nameHistoBkg="histptK0SOfflineBkg";
1623  titleHistoSgn="p_{T}(K^{0}_{S}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(K^{0}_{S}) [GeV/c]; Entries";
1624  titleHistoBkg="p_{T}(K^{0}_{S}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(K^{0}_{S}) [GeV/c]; Entries";
1625  TH2F* ptK0SOfflineSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),11,binLimpTLc,41,binLimpTprong);
1626  TH2F* ptK0SOfflineBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),11,binLimpTLc,41,binLimpTprong);
1627 
1628  nameHistoSgn="histptPOfflineSgn";
1629  nameHistoBkg="histptPOfflineBkg";
1630  titleHistoSgn="p_{T}(p) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(p) [GeV/c]; Entries";
1631  titleHistoBkg="p_{T}(p) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(p) [GeV/c]; Entries";
1632  TH2F* ptPOfflineSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),11,binLimpTLc,41,binLimpTprong);
1633  TH2F* ptPOfflineBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),11,binLimpTLc,41,binLimpTprong);
1634 
1635  nameHistoSgn="histptPipOfflineSgn";
1636  nameHistoBkg="histptPipOfflineBkg";
1637  titleHistoSgn="p_{T}(#pi^{+}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(#pi^{+}) [GeV/c]; Entries";
1638  titleHistoBkg="p_{T}(#pi^{+}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(#pi^{+}) [GeV/c]; Entries";
1639  TH2F* ptPiPOfflineSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),11,binLimpTLc,41,binLimpTprong);
1640  TH2F* ptPiPOfflineBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),11,binLimpTLc,41,binLimpTprong);
1641 
1642  nameHistoSgn="histptPimOfflineSgn";
1643  nameHistoBkg="histptPimOfflineBkg";
1644  titleHistoSgn="p_{T}(#pi^{-}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(#pi^{-}) [GeV/c]; Entries";
1645  titleHistoBkg="p_{T}(#pi^{-}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(#pi^{-}) [GeV/c]; Entries";
1646  TH2F* ptPiMOfflineSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),11,binLimpTLc,41,binLimpTprong);
1647  TH2F* ptPiMOfflineBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),11,binLimpTLc,41,binLimpTprong);
1648 
1649  nameHistoSgn="histLambdaMassOfflineSgn";
1650  nameHistoBkg="histLambdaMassOfflineBkg";
1651  titleHistoSgn="m_{inv}(p,#pi^{-}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; m_{inv}(p,#pi^{-}) [GeV/c^{2}]; Entries";
1652  titleHistoBkg="m_{inv}(p,#pi^{-}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; m_{inv}(p,#pi^{-}) [GeV/c^{2}]; Entries";
1653  TH2F* massLambdaOfflineSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),11,binLimpTLc,1000,mMinLambdaPDG,mMinLambdaPDG+0.5);
1654  TH2F* massLambdaOfflineBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),11,binLimpTLc,1000,mMinLambdaPDG,mMinLambdaPDG+0.5);
1655 
1656  nameHistoSgn="histLambdaBarMassOfflineSgn";
1657  nameHistoBkg="histLambdaBarMassOfflineBkg";
1658  titleHistoSgn="m_{inv}(#bar{p},#pi^{+}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; m_{inv}(#bar{p},#pi^{+}) [GeV/c^{2}]; Entries";
1659  titleHistoBkg="m_{inv}(#bar{p},#pi^{+}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; m_{inv}(#bar{p},#pi^{+}) [GeV/c^{2}]; Entries";
1660  TH2F* massLambdaBarOfflineSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),11,binLimpTLc,1000,mMinLambdaPDG,mMinLambdaPDG+0.5);
1661  TH2F* massLambdaBarOfflineBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),11,binLimpTLc,1000,mMinLambdaPDG,mMinLambdaPDG+0.5);
1662 
1663  nameHistoSgn="histGammaMassOfflineSgn";
1664  nameHistoBkg="histGammaMassOfflineBkg";
1665  titleHistoSgn="m_{inv}(e^{+},e^{-}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; m_{inv}(e^{+},e^{-}) [GeV/c^{2}]; Entries";
1666  titleHistoBkg="m_{inv}(e^{+},e^{-}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; m_{inv}(e^{+},e^{-}) [GeV/c^{2}]; Entries";
1667  TH2F* massGammaOfflineSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),11,binLimpTLc,100,0.,1.);
1668  TH2F* massGammaOfflineBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),11,binLimpTLc,100,0.,1.);
1669 
1670  nameHistoSgn="histD0K0SOfflineSgn";
1671  nameHistoBkg="histD0K0SOfflineBkg";
1672  titleHistoSgn="d_{0}(K^{0}_{S}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; d_{0}(K^{0}_{S}) [#sigmas]; Entries";
1673  titleHistoBkg="d_{0}(K^{0}_{S}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; d_{0}(K^{0}_{S}) [#sigmas]; Entries";
1674  TH2F* d0K0SOfflineSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),11,binLimpTLc,1000,-1.,1.);
1675  TH2F* d0K0SOfflineBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),11,binLimpTLc,1000,-1.,1.);
1676 
1677  nameHistoSgn="histD0POfflineSgn";
1678  nameHistoBkg="histD0POfflineBkg";
1679  titleHistoSgn="d_{0}(p) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; d_{0}(p) [cm]; Entries";
1680  titleHistoBkg="d_{0}(p) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; d_{0}(p) [cm]; Entries";
1681  TH2F* d0POfflineSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),11,binLimpTLc,1000,-1.,1.);
1682  TH2F* d0POfflineBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),11,binLimpTLc,1000,-1.,1.);
1683 
1684  nameHistoSgn="histCosPAK0SOfflineSgn";
1685  nameHistoBkg="histCosPAK0SOfflineBkg";
1686  titleHistoSgn="K^{0}_{S} cosine of pointing angle wrt primary vertex vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; cosine; Entries";
1687  titleHistoBkg="K^{0}_{S} cosine of pointing angle wrt primary vertex vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; cosine; Entries";
1688  TH2F *cosPAK0SOfflineSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),41,binLimpTprong,100,0.99,1.);
1689  TH2F *cosPAK0SOfflineBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),41,binLimpTprong,100,0.99,1.);
1690 
1691  TH2F* allptK0SOfflineSgn = (TH2F*)ptK0SOfflineSgn->Clone();
1692  TH2F* allptK0SOfflineBkg = (TH2F*)ptK0SOfflineBkg->Clone();
1693  TH2F* allptPOfflineSgn = (TH2F*)ptPOfflineSgn->Clone();
1694  TH2F* allptPOfflineBkg = (TH2F*)ptPOfflineBkg->Clone();
1695  TH2F* allptPiPOfflineSgn = (TH2F*)ptPiPOfflineSgn->Clone();
1696  TH2F* allptPiPOfflineBkg = (TH2F*)ptPiPOfflineBkg->Clone();
1697  TH2F* allptPiMOfflineSgn = (TH2F*)ptPiMOfflineSgn->Clone();
1698  TH2F* allptPiMOfflineBkg = (TH2F*)ptPiMOfflineBkg->Clone();
1699  TH2F* allmassLambdaOfflineSgn = (TH2F*)massLambdaOfflineSgn->Clone();
1700  TH2F* allmassLambdaOfflineBkg = (TH2F*)massLambdaOfflineBkg->Clone();
1701  TH2F* allmassLambdaBarOfflineSgn = (TH2F*)massLambdaBarOfflineSgn->Clone();
1702  TH2F* allmassLambdaBarOfflineBkg = (TH2F*)massLambdaBarOfflineBkg->Clone();
1703  TH2F* allmassGammaOfflineSgn = (TH2F*)massGammaOfflineSgn->Clone();
1704  TH2F* allmassGammaOfflineBkg = (TH2F*)massGammaOfflineBkg->Clone();
1705  TH2F* alld0K0SOfflineSgn = (TH2F*)d0K0SOfflineSgn->Clone();
1706  TH2F* alld0K0SOfflineBkg = (TH2F*)d0K0SOfflineBkg->Clone();
1707  TH2F* alld0POfflineSgn = (TH2F*)d0POfflineSgn->Clone();
1708  TH2F* alld0POfflineBkg = (TH2F*)d0POfflineBkg->Clone();
1709  TH2F* allcosPAK0SOfflineSgn = (TH2F*)cosPAK0SOfflineSgn->Clone();
1710  TH2F* allcosPAK0SOfflineBkg = (TH2F*)cosPAK0SOfflineBkg->Clone();
1711 
1712  TH2F* pidptK0SOfflineSgn = (TH2F*)ptK0SOfflineSgn->Clone();
1713  TH2F* pidptK0SOfflineBkg = (TH2F*)ptK0SOfflineBkg->Clone();
1714  TH2F* pidptPOfflineSgn = (TH2F*)ptPOfflineSgn->Clone();
1715  TH2F* pidptPOfflineBkg = (TH2F*)ptPOfflineBkg->Clone();
1716  TH2F* pidptPiPOfflineSgn = (TH2F*)ptPiPOfflineSgn->Clone();
1717  TH2F* pidptPiPOfflineBkg = (TH2F*)ptPiPOfflineBkg->Clone();
1718  TH2F* pidptPiMOfflineSgn = (TH2F*)ptPiMOfflineSgn->Clone();
1719  TH2F* pidptPiMOfflineBkg = (TH2F*)ptPiMOfflineBkg->Clone();
1720  TH2F* pidmassLambdaOfflineSgn = (TH2F*)massLambdaOfflineSgn->Clone();
1721  TH2F* pidmassLambdaOfflineBkg = (TH2F*)massLambdaOfflineBkg->Clone();
1722  TH2F* pidmassLambdaBarOfflineSgn = (TH2F*)massLambdaBarOfflineSgn->Clone();
1723  TH2F* pidmassLambdaBarOfflineBkg = (TH2F*)massLambdaBarOfflineBkg->Clone();
1724  TH2F* pidmassGammaOfflineSgn = (TH2F*)massGammaOfflineSgn->Clone();
1725  TH2F* pidmassGammaOfflineBkg = (TH2F*)massGammaOfflineBkg->Clone();
1726  TH2F* pidd0K0SOfflineSgn = (TH2F*)d0K0SOfflineSgn->Clone();
1727  TH2F* pidd0K0SOfflineBkg = (TH2F*)d0K0SOfflineBkg->Clone();
1728  TH2F* pidd0POfflineSgn = (TH2F*)d0POfflineSgn->Clone();
1729  TH2F* pidd0POfflineBkg = (TH2F*)d0POfflineBkg->Clone();
1730  TH2F* pidcosPAK0SOfflineSgn = (TH2F*)cosPAK0SOfflineSgn->Clone();
1731  TH2F* pidcosPAK0SOfflineBkg = (TH2F*)cosPAK0SOfflineBkg->Clone();
1732 
1733  fOutputAll->Add(allptK0SOfflineSgn);
1734  fOutputAll->Add(allptK0SOfflineBkg);
1735  fOutputAll->Add(allptPOfflineSgn);
1736  fOutputAll->Add(allptPOfflineBkg);
1737  fOutputAll->Add(allptPiPOfflineSgn);
1738  fOutputAll->Add(allptPiPOfflineBkg);
1739  fOutputAll->Add(allptPiMOfflineSgn);
1740  fOutputAll->Add(allptPiMOfflineBkg);
1741  fOutputAll->Add(allmassLambdaOfflineSgn);
1742  fOutputAll->Add(allmassLambdaOfflineBkg);
1743  fOutputAll->Add(allmassLambdaBarOfflineSgn);
1744  fOutputAll->Add(allmassLambdaBarOfflineBkg);
1745  fOutputAll->Add(allmassGammaOfflineSgn);
1746  fOutputAll->Add(allmassGammaOfflineBkg);
1747  fOutputAll->Add(alld0K0SOfflineSgn);
1748  fOutputAll->Add(alld0K0SOfflineBkg);
1749  fOutputAll->Add(alld0POfflineSgn);
1750  fOutputAll->Add(alld0POfflineBkg);
1751  fOutputAll->Add(allcosPAK0SOfflineSgn);
1752  fOutputAll->Add(allcosPAK0SOfflineBkg);
1753 
1754  fOutputPIDBach->Add(pidptK0SOfflineSgn);
1755  fOutputPIDBach->Add(pidptK0SOfflineBkg);
1756  fOutputPIDBach->Add(pidptPOfflineSgn);
1757  fOutputPIDBach->Add(pidptPOfflineBkg);
1758  fOutputPIDBach->Add(pidptPiPOfflineSgn);
1759  fOutputPIDBach->Add(pidptPiPOfflineBkg);
1760  fOutputPIDBach->Add(pidptPiMOfflineSgn);
1761  fOutputPIDBach->Add(pidptPiMOfflineBkg);
1762  fOutputPIDBach->Add(pidmassLambdaOfflineSgn);
1763  fOutputPIDBach->Add(pidmassLambdaOfflineBkg);
1764  fOutputPIDBach->Add(pidmassLambdaBarOfflineSgn);
1765  fOutputPIDBach->Add(pidmassLambdaBarOfflineBkg);
1766  fOutputPIDBach->Add(pidmassGammaOfflineSgn);
1767  fOutputPIDBach->Add(pidmassGammaOfflineBkg);
1768  fOutputPIDBach->Add(pidd0K0SOfflineSgn);
1769  fOutputPIDBach->Add(pidd0K0SOfflineBkg);
1770  fOutputPIDBach->Add(pidd0POfflineSgn);
1771  fOutputPIDBach->Add(pidd0POfflineBkg);
1772  fOutputPIDBach->Add(pidcosPAK0SOfflineSgn);
1773  fOutputPIDBach->Add(pidcosPAK0SOfflineBkg);
1774 
1775  if (fTrackRotation) {
1776 
1777  TH2F* pidTRptK0SOfflineSgn = (TH2F*)ptK0SOfflineSgn->Clone();
1778  TH2F* pidTRptK0SOfflineBkg = (TH2F*)ptK0SOfflineBkg->Clone();
1779  TH2F* pidTRptPOfflineSgn = (TH2F*)ptPOfflineSgn->Clone();
1780  TH2F* pidTRptPOfflineBkg = (TH2F*)ptPOfflineBkg->Clone();
1781  TH2F* pidTRptPiPOfflineSgn = (TH2F*)ptPiPOfflineSgn->Clone();
1782  TH2F* pidTRptPiPOfflineBkg = (TH2F*)ptPiPOfflineBkg->Clone();
1783  TH2F* pidTRptPiMOfflineSgn = (TH2F*)ptPiMOfflineSgn->Clone();
1784  TH2F* pidTRptPiMOfflineBkg = (TH2F*)ptPiMOfflineBkg->Clone();
1785  TH2F* pidTRmassLambdaOfflineSgn = (TH2F*)massLambdaOfflineSgn->Clone();
1786  TH2F* pidTRmassLambdaOfflineBkg = (TH2F*)massLambdaOfflineBkg->Clone();
1787  TH2F* pidTRmassLambdaBarOfflineSgn = (TH2F*)massLambdaBarOfflineSgn->Clone();
1788  TH2F* pidTRmassLambdaBarOfflineBkg = (TH2F*)massLambdaBarOfflineBkg->Clone();
1789  TH2F* pidTRmassGammaOfflineSgn = (TH2F*)massGammaOfflineSgn->Clone();
1790  TH2F* pidTRmassGammaOfflineBkg = (TH2F*)massGammaOfflineBkg->Clone();
1791  TH2F* pidTRcosPAK0SOfflineSgn = (TH2F*)cosPAK0SOfflineSgn->Clone();
1792  TH2F* pidTRcosPAK0SOfflineBkg = (TH2F*)cosPAK0SOfflineBkg->Clone();
1793  fOutputPIDBachTR->Add(pidTRptK0SOfflineSgn);
1794  fOutputPIDBachTR->Add(pidTRptK0SOfflineBkg);
1795  fOutputPIDBachTR->Add(pidTRptPOfflineSgn);
1796  fOutputPIDBachTR->Add(pidTRptPOfflineBkg);
1797  fOutputPIDBachTR->Add(pidTRptPiPOfflineSgn);
1798  fOutputPIDBachTR->Add(pidTRptPiPOfflineBkg);
1799  fOutputPIDBachTR->Add(pidTRptPiMOfflineSgn);
1800  fOutputPIDBachTR->Add(pidTRptPiMOfflineBkg);
1801  fOutputPIDBachTR->Add(pidTRmassLambdaOfflineSgn);
1802  fOutputPIDBachTR->Add(pidTRmassLambdaOfflineBkg);
1803  fOutputPIDBachTR->Add(pidTRmassLambdaBarOfflineSgn);
1804  fOutputPIDBachTR->Add(pidTRmassLambdaBarOfflineBkg);
1805  fOutputPIDBachTR->Add(pidTRmassGammaOfflineSgn);
1806  fOutputPIDBachTR->Add(pidTRmassGammaOfflineBkg);
1807  fOutputPIDBachTR->Add(pidTRcosPAK0SOfflineSgn);
1808  fOutputPIDBachTR->Add(pidTRcosPAK0SOfflineBkg);
1809 
1810  }
1811 
1812  } // useMCinfo
1813 
1814 
1815  if (fTrackRotation) {
1816 
1817  TH3F *phiVSthetaVSpt = new TH3F("phiVSthetaVSpt","",35,0.,35.,360,0.,2.*TMath::Pi(),100,40.*TMath::DegToRad(),140.*TMath::DegToRad());
1818  TH3F *phiVSthetaVSptRot = new TH3F("phiVSthetaVSptRot","",35,0.,35.,360,0.,2.*TMath::Pi(),100,40.*TMath::DegToRad(),140.*TMath::DegToRad());
1819  TH3F *phiVSthetaVSptOffline = new TH3F("phiVSthetaVSptOffline","",35,0.,35.,360,0.,2.*TMath::Pi(),100,40.*TMath::DegToRad(),140.*TMath::DegToRad());
1820  TH3F *phiVSthetaVSptRotOffline = new TH3F("phiVSthetaVSptRotOffline","",35,0.,35.,360,0.,2.*TMath::Pi(),100,40.*TMath::DegToRad(),140.*TMath::DegToRad());
1821  fOutputPIDBachTR->Add(phiVSthetaVSpt);
1822  fOutputPIDBachTR->Add(phiVSthetaVSptRot);
1823  fOutputPIDBachTR->Add(phiVSthetaVSptOffline);
1824  fOutputPIDBachTR->Add(phiVSthetaVSptRotOffline);
1825 
1826  TH1F *hNormRotated=new TH1F("hNormRotated","",fNRotations+1,-0.5,fNRotations+0.5);
1827  TH1F *hNormRotatedOffline=new TH1F("hNormRotatedOffline","",fNRotations+1,-0.5,fNRotations+0.5);
1828  /*
1829  hNormRotated->Sumw2();
1830  hNormRotatedOffline->Sumw2();
1831 
1832  hNormRotated->SetMinimum(0);
1833  hNormRotatedOffline->SetMinimum(0);
1834  */
1835 
1836  fOutputPIDBachTR->Add(hNormRotated);
1837  fOutputPIDBachTR->Add(hNormRotatedOffline);
1838 
1839  if (fUseMCInfo) {
1840 
1841  TH3F *phiVSthetaVSptSgn = new TH3F("phiVSthetaVSptSgn","",35,0.,35.,360,0.,2.*TMath::Pi(),100,40.*TMath::DegToRad(),140.*TMath::DegToRad());
1842  TH3F *phiVSthetaVSptRotSgn = new TH3F("phiVSthetaVSptRotSgn","",35,0.,35.,360,0.,2.*TMath::Pi(),100,40.*TMath::DegToRad(),140.*TMath::DegToRad());
1843  TH3F *phiVSthetaVSptOfflineSgn = new TH3F("phiVSthetaVSptOfflineSgn","",35,0.,35.,360,0.,2.*TMath::Pi(),100,40.*TMath::DegToRad(),140.*TMath::DegToRad());
1844  TH3F *phiVSthetaVSptRotOfflineSgn = new TH3F("phiVSthetaVSptRotOfflineSgn","",35,0.,35.,360,0.,2.*TMath::Pi(),100,40.*TMath::DegToRad(),140.*TMath::DegToRad());
1845  fOutputPIDBachTR->Add(phiVSthetaVSptSgn);
1846  fOutputPIDBachTR->Add(phiVSthetaVSptRotSgn);
1847  fOutputPIDBachTR->Add(phiVSthetaVSptOfflineSgn);
1848  fOutputPIDBachTR->Add(phiVSthetaVSptRotOfflineSgn);
1849 
1850  TH3F *phiVSthetaVSptBkg = new TH3F("phiVSthetaVSptBkg","",35,0.,35.,360,0.,2.*TMath::Pi(),100,40.*TMath::DegToRad(),140.*TMath::DegToRad());
1851  TH3F *phiVSthetaVSptRotBkg = new TH3F("phiVSthetaVSptRotBkg","",35,0.,35.,360,0.,2.*TMath::Pi(),100,40.*TMath::DegToRad(),140.*TMath::DegToRad());
1852  TH3F *phiVSthetaVSptOfflineBkg = new TH3F("phiVSthetaVSptOfflineBkg","",35,0.,35.,360,0.,2.*TMath::Pi(),100,40.*TMath::DegToRad(),140.*TMath::DegToRad());
1853  TH3F *phiVSthetaVSptRotOfflineBkg = new TH3F("phiVSthetaVSptRotOfflineBkg","",35,0.,35.,360,0.,2.*TMath::Pi(),100,40.*TMath::DegToRad(),140.*TMath::DegToRad());
1854  fOutputPIDBachTR->Add(phiVSthetaVSptBkg);
1855  fOutputPIDBachTR->Add(phiVSthetaVSptRotBkg);
1856  fOutputPIDBachTR->Add(phiVSthetaVSptOfflineBkg);
1857  fOutputPIDBachTR->Add(phiVSthetaVSptRotOfflineBkg);
1858 
1859  TH1F *hNormRotatedSgn=new TH1F("hNormRotatedSgn","",fNRotations+1,-0.5,fNRotations+0.5);
1860  TH1F *hNormRotatedOfflineSgn=new TH1F("hNormRotatedOfflineSgn","",fNRotations+1,-0.5,fNRotations+0.5);
1861  TH1F *hNormRotatedBkg=new TH1F("hNormRotatedBkg","",fNRotations+1,-0.5,fNRotations+0.5);
1862  TH1F *hNormRotatedOfflineBkg=new TH1F("hNormRotatedOfflineBkg","",fNRotations+1,-0.5,fNRotations+0.5);
1863  /*
1864  hNormRotatedSgn->Sumw2();
1865  hNormRotatedOfflineSgn->Sumw2();
1866  hNormRotatedBkg->Sumw2();
1867  hNormRotatedOfflineBkg->Sumw2();
1868 
1869  hNormRotatedSgn->SetMinimum(0);
1870  hNormRotatedOfflineSgn->SetMinimum(0);
1871  hNormRotatedBkg->SetMinimum(0);
1872  hNormRotatedOfflineBkg->SetMinimum(0);
1873  */
1874 
1875  fOutputPIDBachTR->Add(hNormRotatedSgn);
1876  fOutputPIDBachTR->Add(hNormRotatedOfflineSgn);
1877  fOutputPIDBachTR->Add(hNormRotatedBkg);
1878  fOutputPIDBachTR->Add(hNormRotatedOfflineBkg);
1879 
1880  }
1881 
1882  Int_t nMassBins=(Int_t)(fMaxMass*1000.-fMinMass*1000.);
1883  Double_t maxm=fMinMass+nMassBins*0.001;
1884  TH3F *hMassVsPtVsY=new TH3F("hMassVsPtVsY","",nMassBins,fMinMass,maxm,15,0.,15.,20,-1.,1.);
1885  TH3F *hMassVsPtVsYOffline=new TH3F("hMassVsPtVsYOffline","",nMassBins,fMinMass,maxm,15,0.,15.,20,-1.,1.);
1886  /*
1887  hMassVsPtVsY->Sumw2();
1888  hMassVsPtVsYOffline->Sumw2();
1889 
1890  hMassVsPtVsY->SetMinimum(0);
1891  hMassVsPtVsYOffline->SetMinimum(0);
1892  */
1893 
1894  fOutputPIDBachTR->Add(hMassVsPtVsY);
1895  fOutputPIDBachTR->Add(hMassVsPtVsYOffline);
1896 
1897  if (fUseMCInfo) {
1898 
1899  TH3F *hMassVsPtVsYSgn=new TH3F("hMassVsPtVsYSgn","",nMassBins,fMinMass,maxm,15,0.,15.,20,-1.,1.);
1900  TH3F *hMassVsPtVsYOfflineSgn=new TH3F("hMassVsPtVsYOfflineSgn","",nMassBins,fMinMass,maxm,15,0.,15.,20,-1.,1.);
1901  TH3F *hMassVsPtVsYBkg=new TH3F("hMassVsPtVsYBkg","",nMassBins,fMinMass,maxm,15,0.,15.,20,-1.,1.);
1902  TH3F *hMassVsPtVsYOfflineBkg=new TH3F("hMassVsPtVsYOfflineBkg","",nMassBins,fMinMass,maxm,15,0.,15.,20,-1.,1.);
1903 
1904  /*
1905  hMassVsPtVsYSgn->Sumw2();
1906  hMassVsPtVsYOfflineSgn->Sumw2();
1907  hMassVsPtVsYBkg->Sumw2();
1908  hMassVsPtVsYOfflineBkg->Sumw2();
1909 
1910  hMassVsPtVsYSgn->SetMinimum(0);
1911  hMassVsPtVsYOfflineSgn->SetMinimum(0);
1912  hMassVsPtVsYBkg->SetMinimum(0);
1913  hMassVsPtVsYOfflineBkg->SetMinimum(0);
1914  */
1915 
1916  fOutputPIDBachTR->Add(hMassVsPtVsYSgn);
1917  fOutputPIDBachTR->Add(hMassVsPtVsYOfflineSgn);
1918  fOutputPIDBachTR->Add(hMassVsPtVsYBkg);
1919  fOutputPIDBachTR->Add(hMassVsPtVsYOfflineBkg);
1920 
1921  }
1922 
1923  TH3F *hMassVsPtVsYRot=new TH3F("hMassVsPtVsYRot","",nMassBins,fMinMass,maxm,15,0.,15.,20,-1.,1.);
1924  TH3F *hMassVsPtVsYRotOffline=new TH3F("hMassVsPtVsYRotOffline","",nMassBins,fMinMass,maxm,15,0.,15.,20,-1.,1.);
1925  /*
1926  hMassVsPtVsYRot->Sumw2();
1927  hMassVsPtVsYRotOffline->Sumw2();
1928 
1929  hMassVsPtVsYRot->SetMinimum(0);
1930  hMassVsPtVsYRotOffline->SetMinimum(0);
1931  */
1932 
1933  fOutputPIDBachTR->Add(hMassVsPtVsYRot);
1934  fOutputPIDBachTR->Add(hMassVsPtVsYRotOffline);
1935 
1936  if (fUseMCInfo) {
1937 
1938  TH3F *hMassVsPtVsYRotSgn=new TH3F("hMassVsPtVsYRotSgn","",nMassBins,fMinMass,maxm,15,0.,15.,20,-1.,1.);
1939  TH3F *hMassVsPtVsYRotOfflineSgn=new TH3F("hMassVsPtVsYRotOfflineSgn","",nMassBins,fMinMass,maxm,15,0.,15.,20,-1.,1.);
1940  TH3F *hMassVsPtVsYRotBkg=new TH3F("hMassVsPtVsYRotBkg","",nMassBins,fMinMass,maxm,15,0.,15.,20,-1.,1.);
1941  TH3F *hMassVsPtVsYRotOfflineBkg=new TH3F("hMassVsPtVsYRotOfflineBkg","",nMassBins,fMinMass,maxm,15,0.,15.,20,-1.,1.);
1942  /*
1943  hMassVsPtVsYRotSgn->Sumw2();
1944  hMassVsPtVsYRotOfflineSgn->Sumw2();
1945  hMassVsPtVsYRotBkg->Sumw2();
1946  hMassVsPtVsYRotOfflineBkg->Sumw2();
1947 
1948  hMassVsPtVsYRotSgn->SetMinimum(0);
1949  hMassVsPtVsYRotOfflineSgn->SetMinimum(0);
1950  hMassVsPtVsYRotBkg->SetMinimum(0);
1951  hMassVsPtVsYRotOfflineBkg->SetMinimum(0);
1952  */
1953 
1954  fOutputPIDBachTR->Add(hMassVsPtVsYRotSgn);
1955  fOutputPIDBachTR->Add(hMassVsPtVsYRotOfflineSgn);
1956  fOutputPIDBachTR->Add(hMassVsPtVsYRotBkg);
1957  fOutputPIDBachTR->Add(hMassVsPtVsYRotOfflineBkg);
1958 
1959  }
1960 
1961  TH1F *hDeltaMass=new TH1F("hDeltaMass","",100,-0.4,0.4);
1962  TH1F *hDeltaMassOffline=new TH1F("hDeltaMassOffline","",100,-0.4,0.4);
1963  /*
1964  hDeltaMass->Sumw2();
1965  hDeltaMassOffline->Sumw2();
1966 
1967  hDeltaMass->SetMinimum(0);
1968  hDeltaMassOffline->SetMinimum(0);
1969  */
1970 
1971  fOutputPIDBachTR->Add(hDeltaMass);
1972  fOutputPIDBachTR->Add(hDeltaMassOffline);
1973 
1974  if (fUseMCInfo) {
1975 
1976  TH1F *hDeltaMassSgn=new TH1F("hDeltaMassSgn","",100,-0.4,0.4);
1977  TH1F *hDeltaMassOfflineSgn=new TH1F("hDeltaMassOfflineSgn","",100,-0.4,0.4);
1978  TH1F *hDeltaMassBkg=new TH1F("hDeltaMassBkg","",100,-0.4,0.4);
1979  TH1F *hDeltaMassOfflineBkg=new TH1F("hDeltaMassOfflineBkg","",100,-0.4,0.4);
1980  /*
1981  hDeltaMassSgn->Sumw2();
1982  hDeltaMassOfflineSgn->Sumw2();
1983  hDeltaMassBkg->Sumw2();
1984  hDeltaMassOfflineBkg->Sumw2();
1985 
1986  hDeltaMassSgn->SetMinimum(0);
1987  hDeltaMassOfflineSgn->SetMinimum(0);
1988  hDeltaMassBkg->SetMinimum(0);
1989  hDeltaMassOfflineBkg->SetMinimum(0);
1990  */
1991 
1992  fOutputPIDBachTR->Add(hDeltaMassSgn);
1993  fOutputPIDBachTR->Add(hDeltaMassOfflineSgn);
1994  fOutputPIDBachTR->Add(hDeltaMassBkg);
1995  fOutputPIDBachTR->Add(hDeltaMassOfflineBkg);
1996 
1997  }
1998 
1999  /*
2000  Int_t binSparseDMassRot[5]={nMassBins,100,24,40,20};
2001  Double_t edgeLowSparseDMassRot[5]={fMinMass,-0.4,0.,-4.,0};
2002  Double_t edgeHighSparseDMassRot[5]={maxm,0.4,12.,4.,3.14};
2003  THnSparse *hDeltaMassFullAnalysis=new THnSparseF("hDeltaMassFullAnalysis","hDeltaMassFullAnalysis;inv mass (GeV/c);#Delta inv mass (GeV/c); p_{T}^{#Lambda_{c}} (GeV/c); #Delta p_{T} (GeV/c); daughter angle (2prongs) (rad);",5,binSparseDMassRot,edgeLowSparseDMassRot,edgeHighSparseDMassRot);
2004  THnSparse *hDeltaMassFullAnalysisOffline=new THnSparseF("fDeltaMassFullAnalysisOffline","hDeltaMassFullAnalysisOffline;inv mass (GeV/c);#Delta inv mass (GeV/c); p_{T}^{#Lambda_{c}} (GeV/c); #Delta p_{T} (GeV/c); daughter angle (2prongs) (rad);",5,binSparseDMassRot,edgeLowSparseDMassRot,edgeHighSparseDMassRot);
2005 
2006  fOutputPIDBachTR->Add(hDeltaMassFullAnalysis);
2007  fOutputPIDBachTR->Add(hDeltaMassFullAnalysisOffline);
2008 
2009  if (fUseMCInfo) {
2010 
2011  THnSparse *hDeltaMassFullAnalysisSgn=new THnSparseF("hDeltaMassFullAnalysisSgn","hDeltaMassFullAnalysisSgn;inv mass (GeV/c);#Delta inv mass (GeV/c); p_{T}^{#Lambda_{c}} (GeV/c); #Delta p_{T} (GeV/c); daughter angle (2prongs) (rad);",5,binSparseDMassRot,edgeLowSparseDMassRot,edgeHighSparseDMassRot);
2012  THnSparse *hDeltaMassFullAnalysisOfflineSgn=new THnSparseF("fDeltaMassFullAnalysisOfflineSgn","hDeltaMassFullAnalysisOfflineSgn;inv mass (GeV/c);#Delta inv mass (GeV/c); p_{T}^{#Lambda_{c}} (GeV/c); #Delta p_{T} (GeV/c); daughter angle (2prongs) (rad);",5,binSparseDMassRot,edgeLowSparseDMassRot,edgeHighSparseDMassRot);
2013 
2014  THnSparse *hDeltaMassFullAnalysisBkg=new THnSparseF("hDeltaMassFullAnalysisBkg","hDeltaMassFullAnalysisBkg;inv mass (GeV/c);#Delta inv mass (GeV/c); p_{T}^{#Lambda_{c}} (GeV/c); #Delta p_{T} (GeV/c); daughter angle (2prongs) (rad);",5,binSparseDMassRot,edgeLowSparseDMassRot,edgeHighSparseDMassRot);
2015  THnSparse *hDeltaMassFullAnalysisOfflineBkg=new THnSparseF("fDeltaMassFullAnalysisOfflineBkg","hDeltaMassFullAnalysisOfflineBkg;inv mass (GeV/c);#Delta inv mass (GeV/c); p_{T}^{#Lambda_{c}} (GeV/c); #Delta p_{T} (GeV/c); daughter angle (2prongs) (rad);",5,binSparseDMassRot,edgeLowSparseDMassRot,edgeHighSparseDMassRot);
2016 
2017  fOutputPIDBachTR->Add(hDeltaMassFullAnalysisSgn);
2018  fOutputPIDBachTR->Add(hDeltaMassFullAnalysisOfflineSgn);
2019  fOutputPIDBachTR->Add(hDeltaMassFullAnalysisBkg);
2020  fOutputPIDBachTR->Add(hDeltaMassFullAnalysisOfflineBkg);
2021 
2022  }
2023  */
2024 
2025  }
2026 
2027  /*
2028  fOutputAll->Print();
2029  fOutputPIDBach->Print();
2030  if (fTrackRotation) fOutputPIDBachTR->Print();
2031  */
2032  return;
2033 }
2034 
2035 //---------------------------
2037  //
2039  //
2040 
2041  TClonesArray *arrayLctopKos=0;
2042  if (!aodEvent){
2043  if(AODEvent() && IsStandardAOD()) {
2044  // In case there is an AOD handler writing a standard AOD, use the AOD
2045  // event in memory rather than the input (ESD) event.
2046  aodEvent = dynamic_cast<AliAODEvent*> (AODEvent());
2047  // in this case the braches in the deltaAOD (AliAOD.VertexingHF.root)
2048  // have to taken from the AOD event hold by the AliAODExtension
2049  AliAODHandler* aodHandler = (AliAODHandler*)
2050  ((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler());
2051 
2052  if (aodHandler->GetExtensions()) {
2053  AliAODExtension *ext = (AliAODExtension*)aodHandler->GetExtensions()->FindObject("AliAOD.VertexingHF.root");
2054  AliAODEvent *aodFromExt = ext->GetAOD();
2055  arrayLctopKos=(TClonesArray*)aodFromExt->GetList()->FindObject("CascadesHF");
2056  }
2057  }
2058  } else {
2059  arrayLctopKos=(TClonesArray*)aodEvent->GetList()->FindObject("CascadesHF");
2060  }
2061 
2062  Float_t zVertex = fVtx1->GetZ();
2063  TString titleVtx=fVtx1->GetTitle();
2064 
2065  if (TMath::Abs(fBzkG)>=0.001) {
2066 
2067  if (fAdditionalChecks) ((TH1F*)(fOutput->FindObject("hZ2")))->Fill(zVertex);
2068 
2069  if (arrayLctopKos) {
2070 
2071  if (fAdditionalChecks) ((TH1F*)(fOutput->FindObject("hZ3")))->Fill(zVertex);
2072 
2073  // mc analysis
2074  TClonesArray *mcArray = 0;
2075  AliAODMCHeader *mcHeader=0;
2076 
2077  if (fUseMCInfo) {
2078  // MC array need for maching
2079  mcArray = dynamic_cast<TClonesArray*>(aodEvent->FindListObject(AliAODMCParticle::StdBranchName()));
2080 
2081  if (mcArray) {
2082  // load MC header
2083  if (fAdditionalChecks) ((TH1F*)(fOutput->FindObject("hZ4")))->Fill(zVertex);
2084  mcHeader = (AliAODMCHeader*)aodEvent->GetList()->FindObject(AliAODMCHeader::StdBranchName());
2085 
2086  if (mcHeader && fAdditionalChecks) ((TH1F*)(fOutput->FindObject("hZ5")))->Fill(zVertex);
2087 
2088  // check on MC Lc Daughter
2089  if (fAdditionalChecks) {
2090  for (Int_t iii=0; iii<mcArray->GetEntries(); iii++)
2091  SearchLcDaughter(mcArray,iii);
2092  }
2093 
2094  }
2095 
2096  }
2097 
2098  if (fVtx1->GetNContributors()>0) {
2099  if (fAdditionalChecks) ((TH1F*)(fOutput->FindObject("hZ6")))->Fill(zVertex);
2100 
2101  TString firedTriggerClasses = aodEvent->GetFiredTriggerClasses(); // trigger class
2102  ULong64_t fTriggerMask=AliVEvent::kAnyINT;
2103  Bool_t check1 = kFALSE;
2104  if ( !fUseMCInfo && // don't do for MC...
2105  (aodEvent->GetRunNumber()<136851 || aodEvent->GetRunNumber()>139517) ) { // ...and for PbPb 2010 data
2106  if ( !(firedTriggerClasses.Contains("CINT1")) ) {
2107  AliInfo(Form(" ======================== firedTriggerClasses.Data() = %s",firedTriggerClasses.Data()));
2108  fCEvents->Fill(8);
2109  if (fAdditionalChecks) ((TH1F*)(fOutput->FindObject("hZ8")))->Fill(zVertex);
2110  check1 = kTRUE;
2111  }
2112  }
2113 
2114  Bool_t isSelectedAAA = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & fTriggerMask);
2115  if (!isSelectedAAA) {
2116  fCEvents->Fill(9);
2117  if (fAdditionalChecks) ((TH1F*)(fOutput->FindObject("hZ9")))->Fill(zVertex);
2118  }
2119 
2120  if (!isSelectedAAA || check1) {
2121  fCEvents->Fill(16);
2122  if (fAdditionalChecks) ((TH1F*)(fOutput->FindObject("hZ16")))->Fill(zVertex);
2123  }
2124 
2125  fTriggerMask=AliVEvent::kAny;
2126  Bool_t isSelectedBBB = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & fTriggerMask);
2127  if (!isSelectedBBB) {
2128  fCEvents->Fill(10);
2129  if (fAdditionalChecks) ((TH1F*)(fOutput->FindObject("hZ10")))->Fill(zVertex);
2130  }
2131 
2132  if (titleVtx.Contains("Z")) {
2133  fCEvents->Fill(11);
2134  if (fAdditionalChecks) ((TH1F*)(fOutput->FindObject("hZ11")))->Fill(zVertex);
2135  }
2136  else if (titleVtx.Contains("3D")) {
2137  fCEvents->Fill(12);
2138  if (fAdditionalChecks) ((TH1F*)(fOutput->FindObject("hZ12")))->Fill(zVertex);
2139  } else {
2140  fCEvents->Fill(13);
2141  if (fAdditionalChecks) ((TH1F*)(fOutput->FindObject("hZ13")))->Fill(zVertex);
2142  }
2143 
2144  if (TMath::Abs(zVertex)<=fAnalCuts->GetMaxVtxZ()) {
2145  fCEvents->Fill(14);
2146  if (fAdditionalChecks) ((TH1F*)(fOutput->FindObject("hZ14")))->Fill(zVertex);
2147  }
2148 
2149  if ( fIsEventSelected ) {
2150  if (fAdditionalChecks) ((TH1F*)(fOutput->FindObject("hZ7")))->Fill(zVertex);
2151  } else {
2152  fCEvents->Fill(15);
2153  if (fAdditionalChecks) ((TH1F*)(fOutput->FindObject("hZ15")))->Fill(zVertex);
2154  }
2155 
2156  } // nContributors>=1
2157  } // analysisArray exists
2158  } // magnetic field exists
2159 
2160  return;
2161 }
2162 
2163 //-----------------
2168 
2169  Float_t zVertex = fVtx1->GetZ();
2170  TString titleVtx=fVtx1->GetTitle();
2171  TString firedTriggerClasses = aodEvent->GetFiredTriggerClasses(); // trigger class
2172  ULong64_t fTriggerMask=AliVEvent::kAnyINT;
2173 
2174  ((TH1F*)(fOutput->FindObject("hEventsWithCandidates")))->Fill(6);
2175  if (fAdditionalChecks) ((TH1F*)(fOutput->FindObject("hZ6a")))->Fill(zVertex);
2176 
2177  Bool_t check1a = kFALSE;
2178  if ( !fUseMCInfo && // don't do for MC...
2179  (aodEvent->GetRunNumber()<136851 || aodEvent->GetRunNumber()>139517) ) { // ...and for PbPb 2010 data
2180  if ( !(firedTriggerClasses.Contains("CINT1")) ) {
2181  AliInfo(Form(" ======================== firedTriggerClasses.Data() = %s",firedTriggerClasses.Data()));
2182  ((TH1F*)(fOutput->FindObject("hEventsWithCandidates")))->Fill(8);
2183  if (fAdditionalChecks) ((TH1F*)(fOutput->FindObject("hZ8a")))->Fill(zVertex);
2184  check1a = kTRUE;
2185  }
2186  }
2187 
2188  Bool_t isSelectedAAAa = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & fTriggerMask);
2189  if (!isSelectedAAAa) {
2190  ((TH1F*)(fOutput->FindObject("hEventsWithCandidates")))->Fill(9);
2191  if (fAdditionalChecks) ((TH1F*)(fOutput->FindObject("hZ9a")))->Fill(zVertex);
2192  }
2193 
2194  if (!isSelectedAAAa || check1a) {
2195  ((TH1F*)(fOutput->FindObject("hEventsWithCandidates")))->Fill(16);
2196  if (fAdditionalChecks) ((TH1F*)(fOutput->FindObject("hZ16a")))->Fill(zVertex);
2197  }
2198 
2199  fTriggerMask=AliVEvent::kAny;
2200  Bool_t isSelectedBBBa = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & fTriggerMask);
2201  if (!isSelectedBBBa) {
2202  ((TH1F*)(fOutput->FindObject("hEventsWithCandidates")))->Fill(10);
2203  if (fAdditionalChecks) ((TH1F*)(fOutput->FindObject("hZ10a")))->Fill(zVertex);
2204  }
2205 
2206  if (titleVtx.Contains("Z")) {
2207  ((TH1F*)(fOutput->FindObject("hEventsWithCandidates")))->Fill(11);
2208  if (fAdditionalChecks) ((TH1F*)(fOutput->FindObject("hZ11a")))->Fill(zVertex);
2209  }
2210  else if (titleVtx.Contains("3D")) {
2211  ((TH1F*)(fOutput->FindObject("hEventsWithCandidates")))->Fill(12);
2212  if (fAdditionalChecks) ((TH1F*)(fOutput->FindObject("hZ12a")))->Fill(zVertex);
2213  } else {
2214  ((TH1F*)(fOutput->FindObject("hEventsWithCandidates")))->Fill(13);
2215  if (fAdditionalChecks) ((TH1F*)(fOutput->FindObject("hZ13a")))->Fill(zVertex);
2216  }
2217 
2218  if (TMath::Abs(zVertex)<=fAnalCuts->GetMaxVtxZ()) {
2219  ((TH1F*)(fOutput->FindObject("hEventsWithCandidates")))->Fill(14);
2220  if (fAdditionalChecks) ((TH1F*)(fOutput->FindObject("hZ14a")))->Fill(zVertex);
2221  }
2222 
2223  if ( fIsEventSelected ) {
2224  ((TH1F*)(fOutput->FindObject("hEventsWithCandidates")))->Fill(7);
2225  if (fAdditionalChecks) ((TH1F*)(fOutput->FindObject("hZ7a")))->Fill(zVertex);
2226  } else {
2227  ((TH1F*)(fOutput->FindObject("hEventsWithCandidates")))->Fill(15);
2228  if (fAdditionalChecks) ((TH1F*)(fOutput->FindObject("hZ15a")))->Fill(zVertex);
2229  }
2230 
2231  return;
2232 }
2233 
2234 //-----------------------------
2236  Int_t *pdgDgLc2bacV0, Int_t *pdgDgV0,
2237  TClonesArray *mcArray) {
2238  //
2240  //
2241 
2242  // bachelor
2243  AliAODTrack *bachelor = (AliAODTrack*)lc2bacV0->GetBachelor();
2244  if (!bachelor) return -1;
2245  Int_t labBachelor = TMath::Abs(bachelor->GetLabel());
2246  if (labBachelor<0) return -1;
2247  AliAODMCParticle *partBachelor = (AliAODMCParticle*)mcArray->At(labBachelor);
2248  if (!partBachelor) return -1;
2249  if (TMath::Abs(partBachelor->GetPdgCode())!=pdgDgLc2bacV0[0]) return -1;
2250 
2251  Int_t labBacMother = partBachelor->GetMother();
2252  if (labBacMother<0) return -1;
2253  AliAODMCParticle *partBacMother = (AliAODMCParticle*)mcArray->At(labBacMother);
2254  if (!partBacMother) return -1;
2255  if (TMath::Abs(partBacMother->GetPdgCode())!=4122) return -1;
2256 
2257  // V0
2258  AliAODTrack *posV0Daugh = (AliAODTrack*)lc2bacV0->Getv0PositiveTrack();
2259  AliAODTrack *negV0Daugh = (AliAODTrack*)lc2bacV0->Getv0NegativeTrack();
2260  if (!posV0Daugh || !negV0Daugh) return -1;
2261 
2262  Int_t labV0pos = TMath::Abs(posV0Daugh->GetLabel());
2263  Int_t labV0neg = TMath::Abs(negV0Daugh->GetLabel());
2264  if (labV0pos<0 || labV0neg<0) return -1;
2265 
2266  AliAODMCParticle *partV0pos = (AliAODMCParticle*)mcArray->At(labV0neg);
2267  AliAODMCParticle *partV0neg = (AliAODMCParticle*)mcArray->At(labV0pos);
2268  if (!partV0pos || !partV0neg) return -1;
2269 
2270  if ( ! ( (TMath::Abs(partV0pos->GetPdgCode())==pdgDgV0[0] &&
2271  TMath::Abs(partV0neg->GetPdgCode())==pdgDgV0[1]) ||
2272  (TMath::Abs(partV0pos->GetPdgCode())==pdgDgV0[1] &&
2273  TMath::Abs(partV0neg->GetPdgCode())==pdgDgV0[0]) ) ) return -1;
2274  Int_t labV0posMother = partV0pos->GetMother();
2275  Int_t labV0negMother = partV0neg->GetMother();
2276 
2277  if (labV0posMother<0 || labV0negMother<0) return -1;
2278  if (labV0posMother!=labV0negMother) return -1;
2279 
2280  AliAODMCParticle *motherV0 = (AliAODMCParticle*)mcArray->At(labV0posMother);
2281  if (!motherV0) return-1;
2282 
2283  if (TMath::Abs(motherV0->GetPdgCode())!=pdgDgLc2bacV0[1]) return -1;
2284  Int_t labV0mother = motherV0->GetMother();
2285  if (labV0mother<0) return -1;
2286  AliAODMCParticle *gMotherV0 = (AliAODMCParticle*)mcArray->At(labV0mother);
2287  if (!gMotherV0) return-1;
2288 
2289  if ( !(pdgDgLc2bacV0[1]==310 && TMath::Abs(gMotherV0->GetPdgCode())==311) &&
2290  !(pdgDgLc2bacV0[1]==3122 && TMath::Abs(motherV0->GetPdgCode())==3122) ) return -1;
2291 
2292  if ( (pdgDgLc2bacV0[1]==310 && TMath::Abs(gMotherV0->GetPdgCode())==311) ) {
2293  Int_t labV0GMother = gMotherV0->GetMother();
2294  if (labV0GMother<0) return -1;
2295  AliAODMCParticle *ggMotherV0 = (AliAODMCParticle*)mcArray->At(labV0GMother);
2296  if (!ggMotherV0) return-1;
2297 
2298  if (TMath::Abs(ggMotherV0->GetPdgCode())!=4122) return -1;
2299  gMotherV0 = (AliAODMCParticle*)ggMotherV0;
2300  labV0mother=labV0GMother;
2301  }
2302  else if (pdgDgLc2bacV0[1]==3122 && TMath::Abs(motherV0->GetPdgCode())==3122) {
2303  if (TMath::Abs(gMotherV0->GetPdgCode())!=4122) return -1;
2304  }
2305 
2306  if (labBacMother!=labV0mother) {
2307  return -1;
2308  }
2309 
2310  return labBacMother;
2311 
2312 }
2313 
2314 //________________________________________________________________
2315 Int_t AliAnalysisTaskSELc2V0bachelor::SearchLcDaughter(TClonesArray *arrayMC, Int_t iii) {
2316  //
2318  //
2319 
2320  Int_t indexToBeReturned=-999;
2321 
2322  Int_t pdgLc=4122;
2323  Int_t pdgLambda=3122;
2324  Int_t pdgV0=310;
2325  Int_t pdgK0=311;
2326  Int_t pdgBachelor=2212;
2327  Int_t pdgBachelorPi=211;
2328 
2329  TString fillthis="";
2330  fillthis="histMcStatLc";
2331 
2332  AliAODMCParticle *searchLc = dynamic_cast<AliAODMCParticle*>(arrayMC->At(iii));
2333  if(!searchLc) return -999;
2334  if (TMath::Abs(searchLc->GetPdgCode()) != pdgLc) return -999;
2335 
2336  ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(0);
2337  indexToBeReturned = 0;
2338 
2339  ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(TMath::Nint(searchLc->Charge()/3.)*1);
2340  indexToBeReturned = TMath::Nint(searchLc->Charge()/3.)*1;
2341 
2342  Int_t nDaughLc = searchLc->GetNDaughters();
2343  if (nDaughLc!=2) {
2344  ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(TMath::Nint(searchLc->Charge()/3.)*10);
2345  indexToBeReturned = TMath::Nint(searchLc->Charge()/3.)*10;
2346  return indexToBeReturned;
2347  }
2348 
2349  Int_t index1=searchLc->GetDaughter(0);
2350  Int_t index2=searchLc->GetDaughter(1);
2351  if (index1<=0 || index2<=0) {
2352  return -999;
2353  }
2354 
2355  AliAODMCParticle *daugh1 = dynamic_cast<AliAODMCParticle*>(arrayMC->At(index1));
2356  AliAODMCParticle *daugh2 = dynamic_cast<AliAODMCParticle*>(arrayMC->At(index2));
2357  if (!daugh1 || !daugh2) return -999;
2358 
2359  Int_t daughPdg1 = TMath::Abs(daugh1->GetPdgCode());
2360  Int_t daughPdg2 = TMath::Abs(daugh2->GetPdgCode());
2361  if ( !( (daughPdg1==pdgBachelor && daughPdg2==pdgK0) ||
2362  (daughPdg2==pdgBachelor && daughPdg1==pdgK0) ||
2363  (daughPdg1==pdgLambda && daughPdg2==pdgBachelorPi) ||
2364  (daughPdg2==pdgLambda && daughPdg1==pdgBachelorPi) ) ) {
2365  ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(TMath::Nint(searchLc->Charge()/3.)*10);
2366  indexToBeReturned = TMath::Nint(searchLc->Charge()/3.)*10;
2367  return indexToBeReturned;
2368  }
2369 
2370  if (daughPdg1==pdgK0 || daughPdg1==pdgLambda) {
2371  index1=searchLc->GetDaughter(1);
2372  index2=searchLc->GetDaughter(0);
2373  }
2374  daugh1 = dynamic_cast<AliAODMCParticle*>(arrayMC->At(index1));
2375  daugh2 = dynamic_cast<AliAODMCParticle*>(arrayMC->At(index2));
2376  if (!daugh1 || !daugh2) return -999;
2377 
2378  daughPdg1=TMath::Abs(daugh1->GetPdgCode());
2379  daughPdg2=TMath::Abs(daugh2->GetPdgCode());
2380 
2381  if ( daughPdg1==pdgBachelor && daughPdg2==pdgK0 ) { // Lc+ -> p K0bar
2382 
2383  ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(TMath::Nint(searchLc->Charge()/3.)*2);
2384  indexToBeReturned = TMath::Nint(searchLc->Charge()/3.)*2;
2385 
2386  Int_t nDaughK0 = daugh2->GetNDaughters();
2387  if (nDaughK0!=1) return -999;
2388 
2389  Int_t indexK0daugh=daugh2->GetDaughter(0);
2390  if (indexK0daugh<=0) return -999;
2391 
2392  AliAODMCParticle *daughK0 = dynamic_cast<AliAODMCParticle*>(arrayMC->At(indexK0daugh));
2393  if (!daughK0) return -999;
2394 
2395  Int_t daughK0Pdg=TMath::Abs(daughK0->GetPdgCode());
2396  if (daughK0Pdg!=pdgV0) {
2397  ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(TMath::Nint(searchLc->Charge()/3.)*4); // K0L
2398  indexToBeReturned = TMath::Nint(searchLc->Charge()/3.)*4;
2399  return indexToBeReturned;
2400  }
2401  ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(TMath::Nint(searchLc->Charge()/3.)*3); // K0S
2402  indexToBeReturned = TMath::Nint(searchLc->Charge()/3.)*3;
2403 
2404  Int_t nDaughK0S = daughK0->GetNDaughters();
2405  if (nDaughK0S!=2) {
2406  ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(TMath::Nint(searchLc->Charge()/3.)*5); // other decays for K0S
2407  indexToBeReturned = TMath::Nint(searchLc->Charge()/3.)*5;
2408  return indexToBeReturned;
2409  }
2410 
2411  index1=daughK0->GetDaughter(0);
2412  index2=daughK0->GetDaughter(1);
2413  if(index1<=0 || index2<=0) {
2414  return -999;
2415  }
2416 
2417  AliAODMCParticle *daughK0S1 = dynamic_cast<AliAODMCParticle*>(arrayMC->At(index1));
2418  AliAODMCParticle *daughK0S2 = dynamic_cast<AliAODMCParticle*>(arrayMC->At(index2));
2419  if (!daughK0S1 || !daughK0S2) return -999;
2420 
2421  Int_t daughK0S1pdg=TMath::Abs(daughK0S1->GetPdgCode());
2422  Int_t daughK0S2pdg=TMath::Abs(daughK0S2->GetPdgCode());
2423 
2424  if ( daughK0S1pdg==211 && daughK0S2pdg==211 ) {
2425  ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(TMath::Nint(searchLc->Charge()/3.)*6); // K0S -> pi+ pi-
2426  indexToBeReturned = TMath::Nint(searchLc->Charge()/3.)*6;
2427  } else {
2428  ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(TMath::Nint(searchLc->Charge()/3.)*5); // other decays for K0S
2429  indexToBeReturned = TMath::Nint(searchLc->Charge()/3.)*5;
2430  }
2431 
2432  } //if (daughPdg1==pdgBachelor && daughPdg2==pdgK0)
2433  else if ( daughPdg1==pdgBachelorPi && daughPdg2==pdgLambda ) { // Lc+ -> pi+ Lambda
2434 
2435  ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(TMath::Nint(searchLc->Charge()/3.)*7);
2436  indexToBeReturned = TMath::Nint(searchLc->Charge()/3.)*7;
2437 
2438  Int_t nDaughL = daugh2->GetNDaughters();
2439  if (nDaughL!=2) {
2440  ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(TMath::Nint(searchLc->Charge()/3.)*8);
2441  indexToBeReturned = TMath::Nint(searchLc->Charge()/3.)*8;
2442  return indexToBeReturned;
2443  }
2444 
2445  index1=daugh2->GetDaughter(0);
2446  index2=daugh2->GetDaughter(1);
2447  if(index1<=0 || index2<=0) {
2448  return -999;
2449  }
2450 
2451  AliAODMCParticle *daughL1 = dynamic_cast<AliAODMCParticle*>(arrayMC->At(index1));
2452  AliAODMCParticle *daughL2 = dynamic_cast<AliAODMCParticle*>(arrayMC->At(index2));
2453  if (!daughL1 || !daughL2) return -999;
2454 
2455  Int_t daughL1pdg=TMath::Abs(daughL1->GetPdgCode());
2456  Int_t daughL2pdg=TMath::Abs(daughL2->GetPdgCode());
2457  if ( (daughL1pdg==211 && daughL2pdg==2212) ||
2458  (daughL2pdg==211 && daughL1pdg==2212) ) {
2459  ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(TMath::Nint(searchLc->Charge()/3.)*9);
2460  indexToBeReturned = TMath::Nint(searchLc->Charge()/3.)*9;
2461  } else {
2462  ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(TMath::Nint(searchLc->Charge()/3.)*8);
2463  indexToBeReturned = TMath::Nint(searchLc->Charge()/3.)*8;
2464  }
2465 
2466  } //else if (daughPdg1==pdgBachelorPi && daughPdg2==pdgLambda)
2467 
2468  return indexToBeReturned;
2469 }
2470 
2471 //________________________________________________________________
2473  TString histoTitle,
2474  Bool_t isCandidateSelectedCuts,
2475  Bool_t isBachelorID) {
2476  //
2478  //
2479 
2480  Double_t alpha = vZero->Alpha();//AlphaV0();
2481  Double_t qT = vZero->QtProng();//PtArmV0();
2482 
2483  ((TH2F*)(fOutputAll->FindObject(histoTitle+"0")))->Fill(alpha,qT);
2484  if (isCandidateSelectedCuts) {
2485  ((TH2F*)(fOutputAll->FindObject(histoTitle)))->Fill(alpha,qT);
2486  if (isBachelorID)
2487  ((TH2F*)(fOutputPIDBach->FindObject(histoTitle)))->Fill(alpha,qT);
2488  }
2489 
2490 }
2491 
2492 //-------------------------------------------------------------------------------
2494  //
2496  //
2497 
2498  Bool_t areCutsUsingPID = cutsAnal->GetIsUsePID();
2499 
2500  AliAODv0 * v0part = (AliAODv0*)part->Getv0();
2501  Bool_t onFlyV0 = v0part->GetOnFlyStatus(); // on-the-flight V0s
2502 
2503  AliAODTrack *bachelor = (AliAODTrack*)part->GetBachelor();
2504 
2505  if ( !onFlyV0 )
2506  ((TH1F*)(fOutput->FindObject("hCandidateSelection")))->Fill(3); // it counts number of candidates coming from offline V0s
2507 
2508  if ( cutsAnal->IsInFiducialAcceptance(part->Pt(),part->Y(4122)) )
2509  ((TH1F*)(fOutput->FindObject("hCandidateSelection")))->Fill(4);
2511  ((TH1F*)(fOutput->FindObject("hCandidateSelection")))->Fill(5);
2512  cutsAnal->SetUsePID(kFALSE);
2514  ((TH1F*)(fOutput->FindObject("hCandidateSelection")))->Fill(6);
2515  cutsAnal->SetUsePID(areCutsUsingPID);
2517  ((TH1F*)(fOutput->FindObject("hCandidateSelection")))->Fill(7);
2519  ((TH1F*)(fOutput->FindObject("hCandidateSelection")))->Fill(8);
2521  ((TH1F*)(fOutput->FindObject("hCandidateSelection")))->Fill(9);
2522 
2523  if ( cutsAnal->IsInFiducialAcceptance(part->Pt(),part->Y(4122)) ) {
2524 
2526 
2527  Int_t aaa = cutsAnal->IsSelected(part,AliRDHFCuts::kTracks);
2528  if ( (aaa&AliRDHFCutsLctoV0::kLcToK0Spr)==AliRDHFCutsLctoV0::kLcToK0Spr ) {
2529  if ( ( (aaa&AliRDHFCutsLctoV0::kLcToLpi)==AliRDHFCutsLctoV0::kLcToLpi && bachelor->Charge()<0) ||
2530  ( (aaa&AliRDHFCutsLctoV0::kLcToLBarpi)==AliRDHFCutsLctoV0::kLcToLBarpi && bachelor->Charge()>0) )
2531  ((TH1F*)(fOutput->FindObject("hSwitchOnCandidates1")))->Fill( -aaa );
2532  else
2533  ((TH1F*)(fOutput->FindObject("hSwitchOnCandidates1")))->Fill( aaa );
2534  }
2535 
2536  cutsAnal->SetUsePID(kFALSE);
2537  aaa = cutsAnal->IsSelected(part,AliRDHFCuts::kCandidate);
2538  if ((aaa&AliRDHFCutsLctoV0::kLcToK0Spr)==AliRDHFCutsLctoV0::kLcToK0Spr) {
2539  if ( ( (aaa&AliRDHFCutsLctoV0::kLcToLpi)==AliRDHFCutsLctoV0::kLcToLpi && bachelor->Charge()<0) ||
2540  ( (aaa&AliRDHFCutsLctoV0::kLcToLBarpi)==AliRDHFCutsLctoV0::kLcToLBarpi && bachelor->Charge()>0) )
2541  ((TH1F*)(fOutput->FindObject("hSwitchOnCandidates2")))->Fill( -aaa );
2542  else
2543  ((TH1F*)(fOutput->FindObject("hSwitchOnCandidates2")))->Fill( aaa );
2544  }
2545  cutsAnal->SetUsePID(areCutsUsingPID);
2546 
2547  aaa = cutsAnal->IsSelected(part,AliRDHFCuts::kPID);
2548  if ((aaa&AliRDHFCutsLctoV0::kLcToK0Spr)==AliRDHFCutsLctoV0::kLcToK0Spr) {
2549  if ( ( (aaa&AliRDHFCutsLctoV0::kLcToLpi)==AliRDHFCutsLctoV0::kLcToLpi && bachelor->Charge()<0) ||
2550  ( (aaa&AliRDHFCutsLctoV0::kLcToLBarpi)==AliRDHFCutsLctoV0::kLcToLBarpi && bachelor->Charge()>0) )
2551  ((TH1F*)(fOutput->FindObject("hSwitchOnCandidates3")))->Fill( -aaa );
2552  else
2553  ((TH1F*)(fOutput->FindObject("hSwitchOnCandidates3")))->Fill( aaa );
2554  }
2555 
2556  aaa = cutsAnal->IsSelected(part,AliRDHFCuts::kAll);
2557  if ((aaa&AliRDHFCutsLctoV0::kLcToK0Spr)==AliRDHFCutsLctoV0::kLcToK0Spr) {
2558  if ( ( (aaa&AliRDHFCutsLctoV0::kLcToLpi)==AliRDHFCutsLctoV0::kLcToLpi && bachelor->Charge()<0) ||
2559  ( (aaa&AliRDHFCutsLctoV0::kLcToLBarpi)==AliRDHFCutsLctoV0::kLcToLBarpi && bachelor->Charge()>0) )
2560  ((TH1F*)(fOutput->FindObject("hSwitchOnCandidates4")))->Fill( -aaa );
2561  else
2562  ((TH1F*)(fOutput->FindObject("hSwitchOnCandidates4")))->Fill( aaa );
2563  }
2564 
2565  }
2566  }
2567 
2568  return;
2569 }
2570 
2571 //-------------------------------------------------------------------------------
2572 void AliAnalysisTaskSELc2V0bachelor::FillTheTree(AliAODRecoCascadeHF *part, AliRDHFCutsLctoV0 *cutsAnal, TClonesArray *mcArray, Int_t isLc) {
2573  //
2575  //
2576 
2577  Double_t mk0sPDG = TDatabasePDG::Instance()->GetParticle(310)->Mass();
2578  Double_t mLPDG = TDatabasePDG::Instance()->GetParticle(3122)->Mass();
2579 
2580  Double_t invmassLc = part->InvMassLctoK0sP();
2581  Double_t invmassLc2Lpi = part->InvMassLctoLambdaPi();
2582 
2583  AliAODTrack *bachelor = (AliAODTrack*)part->GetBachelor();
2584 
2585  AliAODv0 * v0part = (AliAODv0*)part->Getv0();
2586  Double_t dcaV0ptp = v0part->GetDCA();
2587  Double_t invmassK0S = v0part->MassK0Short();
2588  Double_t invmassLambda = v0part->MassLambda();
2589  Double_t invmassLambdaBar = v0part->MassAntiLambda();
2590 
2591  Int_t isLc2LBarpi=0, isLc2Lpi=0;
2592  Int_t mcLabel = -1;
2593  Int_t isDp2K0Spi=0, isDs2K0SK=0;
2594  Int_t mcLabel2 = -1;
2595  Int_t mcLabel3 = -1;
2596  Int_t isKstar12K0Spi=0, isKstar22K0Spi=0;
2597  Int_t mcLabel4 = -1;
2598  Int_t mcLabel5 = -1;
2599  Double_t ptCandByMC = 0.;//fmcPartCandidate->Pt();
2600  Double_t yCandByMC = 0.;//fmcPartCandidate->Y();
2601  if (fUseMCInfo) {
2602  if (isLc) {
2603  Int_t pdgCand0 = 4122;
2604  Int_t pdgDgLctoV0bachelor0[2]={2212,310};
2605  Int_t pdgDgV0toDaughters0[2]={211,211};
2606  Int_t mcLabelLc2pK0S = part->MatchToMC(pdgCand0,pdgDgLctoV0bachelor0[1],pdgDgLctoV0bachelor0,pdgDgV0toDaughters0,mcArray,kTRUE);
2607  AliAODMCParticle *lambdaCpartMC = (AliAODMCParticle*)mcArray->At(mcLabelLc2pK0S);
2608  if (lambdaCpartMC) {
2609  ptCandByMC = lambdaCpartMC->Pt();
2610  yCandByMC = lambdaCpartMC->Y();
2611  }
2612  }
2613 
2614  Int_t pdgCand = 4122;
2615  Int_t pdgDgLctoV0bachelor[2]={211,3122};
2616  Int_t pdgDgV0toDaughters[2]={2212,211};
2617  mcLabel = part->MatchToMC(pdgCand,pdgDgLctoV0bachelor[1],pdgDgLctoV0bachelor,pdgDgV0toDaughters,mcArray,kTRUE);
2618  if (mcLabel!=-1) {
2619  if (bachelor->Charge()<0) isLc2LBarpi=1;
2620  if (bachelor->Charge()>0) isLc2Lpi=1;
2621  AliAODMCParticle *lambdaCpartMC = (AliAODMCParticle*)mcArray->At(mcLabel);
2622  if (lambdaCpartMC) {
2623  ptCandByMC = lambdaCpartMC->Pt();
2624  yCandByMC = lambdaCpartMC->Y();
2625  }
2626  }
2627 
2628  Int_t pdgCand2 = 411; // D+ -> pi+ K0S
2629  Int_t pdgCand3 = 431; // Ds+ -> K+ K0S
2630  Int_t pdgDgCand2[2]={211,310};
2631  Int_t pdgDgCand3[2]={321,310};
2632  pdgDgV0toDaughters[0]=211;
2633  pdgDgV0toDaughters[1]=211;
2634  mcLabel2 = part->MatchToMC(pdgCand2,pdgDgCand2[1],pdgDgCand2,pdgDgV0toDaughters,mcArray,kTRUE);
2635  mcLabel3 = part->MatchToMC(pdgCand3,pdgDgCand3[1],pdgDgCand3,pdgDgV0toDaughters,mcArray,kTRUE);
2636  if (mcLabel2!=-1) {
2637  isDp2K0Spi=1;
2638  AliAODMCParticle *lambdaCpartMC = (AliAODMCParticle*)mcArray->At(mcLabel2);
2639  if (lambdaCpartMC) {
2640  ptCandByMC = lambdaCpartMC->Pt();
2641  yCandByMC = lambdaCpartMC->Y();
2642  }
2643  }
2644  if (mcLabel3!=-1) {
2645  isDs2K0SK=1;
2646  AliAODMCParticle *lambdaCpartMC = (AliAODMCParticle*)mcArray->At(mcLabel3);
2647  if (lambdaCpartMC) {
2648  ptCandByMC = lambdaCpartMC->Pt();
2649  yCandByMC = lambdaCpartMC->Y();
2650  }
2651  }
2652 
2653  Int_t pdgCand4 = 313; // K*(892)+ -> pi+ K0S
2654  Int_t pdgCand5 = 325; // K*(1430)+ -> pi+ K0S
2655  Int_t pdgDgCand4[2]={211,310};
2656  Int_t pdgDgCand5[2]={211,310};
2657  pdgDgV0toDaughters[0]=211;
2658  pdgDgV0toDaughters[1]=211;
2659  mcLabel4 = part->MatchToMC(pdgCand4,pdgDgCand4[1],pdgDgCand4,pdgDgV0toDaughters,mcArray,kTRUE);
2660  mcLabel5 = part->MatchToMC(pdgCand5,pdgDgCand5[1],pdgDgCand5,pdgDgV0toDaughters,mcArray,kTRUE);
2661  if (mcLabel4!=-1) {
2662  isKstar12K0Spi=1;
2663  AliAODMCParticle *lambdaCpartMC = (AliAODMCParticle*)mcArray->At(mcLabel4);
2664  if (lambdaCpartMC) {
2665  ptCandByMC = lambdaCpartMC->Pt();
2666  yCandByMC = lambdaCpartMC->Y();
2667  }
2668  }
2669  if (mcLabel5!=-1) {
2670  isKstar22K0Spi=1;
2671  AliAODMCParticle *lambdaCpartMC = (AliAODMCParticle*)mcArray->At(mcLabel5);
2672  if (lambdaCpartMC) {
2673  ptCandByMC = lambdaCpartMC->Pt();
2674  yCandByMC = lambdaCpartMC->Y();
2675  }
2676  }
2677  }
2678 
2679  Int_t isLcByMC = isLc+isLc2LBarpi*2+isLc2Lpi*4+isDp2K0Spi*8+isDs2K0SK*16+isKstar12K0Spi*32+isKstar22K0Spi*64;
2680 
2681  Bool_t isMCparticleInFiducialAcceptance = kTRUE;
2682  if (isLc || isLc2LBarpi || isLc2Lpi || isDp2K0Spi || isDs2K0SK || isKstar12K0Spi || isKstar22K0Spi) {
2683  isMCparticleInFiducialAcceptance = cutsAnal->IsInFiducialAcceptance(ptCandByMC,yCandByMC);
2684  }
2685 
2686  Int_t isK0S = 0;
2687  Int_t isLambda = 0;
2688  Int_t isLambdaBar = 0;
2689  Int_t isGamma = 0;
2690  if (fUseMCInfo) {
2691  Int_t pdgDg2prong[2] = {211, 211};
2692  Int_t labelK0S = v0part->MatchToMC(310,mcArray,2,pdgDg2prong);
2693  if (labelK0S>=0) isK0S = 1;
2694 
2695  pdgDg2prong[0] = 211;
2696  pdgDg2prong[1] = 2212;
2697  Int_t lambdaLabel = v0part->MatchToMC(3122,mcArray,2,pdgDg2prong);
2698  if (lambdaLabel>=0) {
2699  AliAODMCParticle *lambdaTrack = (AliAODMCParticle*)mcArray->At(lambdaLabel);
2700  if (lambdaTrack->GetPdgCode()==3122) isLambda = 1;
2701  else if (lambdaTrack->GetPdgCode()==-3122) isLambdaBar = 1;
2702  }
2703 
2704  pdgDg2prong[0] = 11;
2705  pdgDg2prong[1] = 11;
2706  Int_t gammaLabel = v0part->MatchToMC(22,mcArray,2,pdgDg2prong);
2707  if (gammaLabel>=0) {
2708  AliAODMCParticle *gammaTrack = (AliAODMCParticle*)mcArray->At(gammaLabel);
2709  if (gammaTrack->GetPdgCode()==22) isGamma = 1;
2710  }
2711  }
2712 
2713  Int_t isV0ByMC = isK0S+isLambdaBar*2+isLambda*4+isGamma*8;
2714 
2715  Int_t isBachelorSelected = (bachelor->TestFilterMask(BIT(4)))*1 + (!(bachelor->TestFilterMask(BIT(4))))*2;
2716  isBachelorSelected += (bachelor->GetLabel()<0)*4 + (bachelor->GetLabel()>=0)*8;
2717  if ( ( !(bachelor->HasPointOnITSLayer(0)) && !(bachelor->HasPointOnITSLayer(1)) ) )
2718  isBachelorSelected += 16;
2719  else {
2720  if ( bachelor->HasPointOnITSLayer(0) && !(bachelor->HasPointOnITSLayer(1)) )
2721  isBachelorSelected += 32;
2722  else if ( !(bachelor->HasPointOnITSLayer(0)) && bachelor->HasPointOnITSLayer(1) )
2723  isBachelorSelected += 64;
2724  else
2725  isBachelorSelected += 128;
2726  }
2727 
2728  AliAODTrack *v0pos = (AliAODTrack*)part->Getv0PositiveTrack();
2729  AliAODTrack *v0neg = (AliAODTrack*)part->Getv0NegativeTrack();
2730 
2731  Int_t areV0daughtersSelected = (v0pos->TestFilterMask(BIT(4)))*1 + (!(v0pos->TestFilterMask(BIT(4))))*2;
2732  areV0daughtersSelected += (v0pos->GetLabel()<0)*4 + (v0pos->GetLabel()>=0)*8;
2733  areV0daughtersSelected += (v0neg->TestFilterMask(BIT(4)))*16 + (!(v0neg->TestFilterMask(BIT(4))))*32;
2734  areV0daughtersSelected += (v0neg->GetLabel()<0)*64 + (v0neg->GetLabel()>=0)*128;
2735 
2736  Double_t nSigmaITSpr=-999.;
2737  cutsAnal->GetPidHF()->GetnSigmaITS(bachelor,4,nSigmaITSpr);
2738  Double_t nSigmaTPCpr=-999.;
2739  cutsAnal->GetPidHF()->GetnSigmaTPC(bachelor,4,nSigmaTPCpr);
2740  Double_t nSigmaTOFpr=-999.;
2741  cutsAnal->GetPidHF()->GetnSigmaTOF(bachelor,4,nSigmaTOFpr);
2742 
2743  Double_t nSigmaITSpi=-999.;
2744  cutsAnal->GetPidHF()->GetnSigmaITS(bachelor,2,nSigmaITSpi);
2745  Double_t nSigmaTPCpi=-999.;
2746  cutsAnal->GetPidHF()->GetnSigmaTPC(bachelor,2,nSigmaTPCpi);
2747  Double_t nSigmaTOFpi=-999.;
2748  cutsAnal->GetPidHF()->GetnSigmaTOF(bachelor,2,nSigmaTOFpi);
2749 
2750  Double_t nSigmaITSka=-999.;
2751  cutsAnal->GetPidHF()->GetnSigmaITS(bachelor,3,nSigmaITSka);
2752  Double_t nSigmaTPCka=-999.;
2753  cutsAnal->GetPidHF()->GetnSigmaTPC(bachelor,3,nSigmaTPCka);
2754  Double_t nSigmaTOFka=-999.;
2755  cutsAnal->GetPidHF()->GetnSigmaTOF(bachelor,3,nSigmaTOFka);
2756 
2757 
2758  Int_t flagToCheckCandidate = 1*(TMath::Abs(invmassK0S-mk0sPDG)<=0.050);
2759  flagToCheckCandidate+=2*((TMath::Abs(invmassLambdaBar-mLPDG)<=0.050) && (bachelor->Charge()<0));
2760  flagToCheckCandidate+=4*((TMath::Abs(invmassLambda-mLPDG)<=0.050) && (bachelor->Charge()>0));
2761  flagToCheckCandidate+=8*((TMath::Abs(invmassLambdaBar-mLPDG)<=0.050) && (bachelor->Charge()>0));
2762  flagToCheckCandidate+=16*((TMath::Abs(invmassLambda-mLPDG)<=0.050) && (bachelor->Charge()<0));
2763 
2764  fCandidateVariables[ 0] = fUseMCInfo+isLcByMC; // 0: real data; 1: bkg; 2: Lc->K0S+p; 3: Lc->LambdaBar+pbar; 5: Lc->Lambda+p; 9: D+->K0S+pi; 17: Ds+->K0S+K; 33: K*+->K0S+pi; 65: K*+->K0S+K
2765  fCandidateVariables[ 1] = fUseMCInfo+isV0ByMC; // 0: real data; 1: bkg; 2: K0S->pi+pi; 3: LambdaBar->pbar+pi+; 5: Lambda->p+pi-
2766  fCandidateVariables[ 2] = isBachelorSelected;
2767  fCandidateVariables[ 3] = areV0daughtersSelected;
2768  fCandidateVariables[ 4] = flagToCheckCandidate;
2769  fCandidateVariables[ 5] = invmassLc;
2770  fCandidateVariables[ 6] = invmassLc2Lpi;
2771  fCandidateVariables[ 7] = part->InvMass2Prongs(0,1,211,310); // D+ -> pi+ K0S
2772  fCandidateVariables[ 8] = part->InvMass2Prongs(0,1,321,310); // D+S -> K+ K0S
2773  fCandidateVariables[ 9] = invmassK0S;
2774  fCandidateVariables[10] = invmassLambda;
2775  fCandidateVariables[11] = invmassLambdaBar;
2776  fCandidateVariables[12] = v0part->InvMass2Prongs(0,1,11,11);
2777  fCandidateVariables[13] = part->GetDCA();
2778  fCandidateVariables[14] = dcaV0ptp;
2779  fCandidateVariables[15] = part->Getd0Prong(0);
2780  fCandidateVariables[16] = part->Getd0Prong(1);
2781  fCandidateVariables[17] = v0part->Getd0Prong(0);
2782  fCandidateVariables[18] = v0part->Getd0Prong(1);
2783  fCandidateVariables[19] = part->CosPointingAngle();
2785  fCandidateVariables[21] = v0part->RadiusSecVtx();
2786  fCandidateVariables[22] = nSigmaITSpr;
2787  fCandidateVariables[23] = nSigmaITSpi;
2788  fCandidateVariables[24] = nSigmaITSka;
2789  fCandidateVariables[25] = nSigmaTPCpr;
2790  fCandidateVariables[26] = nSigmaTPCpi;
2791  fCandidateVariables[27] = nSigmaTPCka;
2792  fCandidateVariables[28] = nSigmaTOFpr;
2793  fCandidateVariables[29] = nSigmaTOFpi;
2794  fCandidateVariables[30] = nSigmaTOFka;
2795  fCandidateVariables[31] = part->Y(4122);
2796  fCandidateVariables[32] = bachelor->Eta();
2797  fCandidateVariables[33] = v0pos->Eta();
2798  fCandidateVariables[34] = v0neg->Eta();
2799  fCandidateVariables[35] = part->P();
2800  fCandidateVariables[36] = part->Pt();
2801  fCandidateVariables[37] = v0part->P();
2802  fCandidateVariables[38] = v0part->Pt();
2803  fCandidateVariables[39] = bachelor->P();
2804  fCandidateVariables[40] = bachelor->Pt();
2805  fCandidateVariables[41] = v0pos->P();
2806  fCandidateVariables[42] = v0pos->Pt();
2807  fCandidateVariables[43] = v0neg->P();
2808  fCandidateVariables[44] = v0neg->Pt();
2809  fCandidateVariables[45] = part->DecayLength();
2810  fCandidateVariables[46] = part->DecayLengthV0();
2813  fCandidateVariables[49] = part->DecayLengthXY();
2814  fCandidateVariables[50] = part->DecayLengthXYV0();
2819  Double_t xVtxLc=0, yVtxLc=0, zVtxLc=0;
2820  Double_t xLcMC=0,yLcMC=0,zLcMC=0;
2821  Double_t pxVtxBachelor=0, pyVtxBachelor=0, pzVtxBachelor=0;
2822  Double_t dcaForLc = PropagateToDCA(v0part,bachelor,fBzkG, xVtxLc, yVtxLc, zVtxLc, pxVtxBachelor, pyVtxBachelor, pzVtxBachelor);
2823  if (isLc) {
2824  Int_t pdgCand0 = 4122;
2825  Int_t pdgDgLctoV0bachelor0[2]={2212,310};
2826  Int_t pdgDgV0toDaughters0[2]={211,211};
2827  Int_t mcLabel0 = part->MatchToMC(pdgCand0,pdgDgLctoV0bachelor0[1],pdgDgLctoV0bachelor0,pdgDgV0toDaughters0,mcArray,kTRUE);
2828  AliAODMCParticle *partLc = dynamic_cast<AliAODMCParticle*>(mcArray->At(mcLabel0));
2829  if(partLc){
2830  AliAODMCParticle *partLcDaug0 = dynamic_cast<AliAODMCParticle*>(mcArray->At(partLc->GetDaughter(0)));
2831  if(partLcDaug0){
2832  xLcMC=partLcDaug0->Xv(), yLcMC=partLcDaug0->Yv(), zLcMC=partLcDaug0->Zv();
2833  }
2834  }
2835  } else if (isLc2LBarpi || isLc2Lpi) {
2836  AliAODMCParticle *partLc = dynamic_cast<AliAODMCParticle*>(mcArray->At(mcLabel));
2837  AliAODMCParticle *partLcDaug0 = dynamic_cast<AliAODMCParticle*>(mcArray->At(partLc->GetDaughter(0)));
2838  xLcMC=partLcDaug0->Xv(), yLcMC=partLcDaug0->Yv(), zLcMC=partLcDaug0->Zv();
2839  } else if (isDp2K0Spi) {
2840  AliAODMCParticle *partLc = dynamic_cast<AliAODMCParticle*>(mcArray->At(mcLabel2));
2841  AliAODMCParticle *partLcDaug0 = dynamic_cast<AliAODMCParticle*>(mcArray->At(partLc->GetDaughter(0)));
2842  xLcMC=partLcDaug0->Xv(), yLcMC=partLcDaug0->Yv(), zLcMC=partLcDaug0->Zv();
2843  } else if (isDs2K0SK) {
2844  AliAODMCParticle *partLc = dynamic_cast<AliAODMCParticle*>(mcArray->At(mcLabel3));
2845  AliAODMCParticle *partLcDaug0 = dynamic_cast<AliAODMCParticle*>(mcArray->At(partLc->GetDaughter(0)));
2846  xLcMC=partLcDaug0->Xv(), yLcMC=partLcDaug0->Yv(), zLcMC=partLcDaug0->Zv();
2847  } else if (isKstar12K0Spi) {
2848  AliAODMCParticle *partLc = dynamic_cast<AliAODMCParticle*>(mcArray->At(mcLabel4));
2849  AliAODMCParticle *partLcDaug0 = dynamic_cast<AliAODMCParticle*>(mcArray->At(partLc->GetDaughter(0)));
2850  xLcMC=partLcDaug0->Xv(), yLcMC=partLcDaug0->Yv(), zLcMC=partLcDaug0->Zv();
2851  } else if (isKstar22K0Spi) {
2852  AliAODMCParticle *partLc = dynamic_cast<AliAODMCParticle*>(mcArray->At(mcLabel5));
2853  AliAODMCParticle *partLcDaug0 = dynamic_cast<AliAODMCParticle*>(mcArray->At(partLc->GetDaughter(0)));
2854  xLcMC=partLcDaug0->Xv(), yLcMC=partLcDaug0->Yv(), zLcMC=partLcDaug0->Zv();
2855  }
2856  fCandidateVariables[55]=dcaForLc;
2857  fCandidateVariables[56]=part->GetSecVtxX();
2858  fCandidateVariables[57]=part->GetSecVtxY();
2859  fCandidateVariables[58]=part->GetSecVtxZ();
2860  fCandidateVariables[59]=xVtxLc;
2861  fCandidateVariables[60]=yVtxLc;
2862  fCandidateVariables[61]=zVtxLc;
2863  fCandidateVariables[62]=xLcMC;
2864  fCandidateVariables[63]=yLcMC;
2865  fCandidateVariables[64]=zLcMC;
2866  fCandidateVariables[65]=bachelor->Px();
2867  fCandidateVariables[66]=bachelor->Py();
2868  fCandidateVariables[67]=pxVtxBachelor;
2869  fCandidateVariables[68]=pyVtxBachelor;
2870  fCandidateVariables[69]=v0part->Px();
2871  fCandidateVariables[70]=v0part->Py();
2872  fCandidateVariables[71]=fVtx1->GetX();
2873  fCandidateVariables[72]=fVtx1->GetY();
2874  fCandidateVariables[73]=fVtx1->GetZ();
2875  fCandidateVariables[74]=part->CosThetaStar(0,4122,2212,310);
2876  fCandidateVariables[75]=part->CosThetaStar(1,4122,2212,310);
2877  fCandidateVariables[76]=v0part->Eta();
2878  fCandidateVariables[77]=v0part->Y(310);
2879  fCandidateVariables[78]=pzVtxBachelor;
2880  fCandidateVariables[79]=v0part->Pz();
2881  fCandidateVariables[80]=bachelor->Charge();
2882  fCandidateVariables[81]=isMCparticleInFiducialAcceptance;
2883  fCandidateVariables[82] = part->InvMass2Prongs(0,1,211,310); // Kstar( 892)+ -> pi+K0S
2884  fCandidateVariables[83] = part->InvMass2Prongs(0,1,321,310); // Kstar(1430)+ -> pi+K0S
2885 
2886  fCandidateVariables[84]=-1;
2887  fCandidateVariables[85]=-1;
2888  fCandidateVariables[86]=-1;
2889  fCandidateVariables[87]=-1;
2890  fCandidateVariables[88]=-1;
2891  if (fUseMCInfo) {
2892  if (bachelor->GetLabel()!=-1) {
2893  AliAODMCParticle *partBachelor = dynamic_cast<AliAODMCParticle*>(mcArray->At(TMath::Abs(bachelor->GetLabel())));
2894  if(partBachelor) fCandidateVariables[84]=partBachelor->GetPdgCode();
2895  }
2896  if (bachelor->GetLabel()!=-1 &&
2897  v0pos->GetLabel()!=-1 &&
2898  v0neg->GetLabel()!=-1) {
2899  const Int_t ndg=3;
2900  Int_t dgLabels[ndg]={TMath::Abs(bachelor->GetLabel()),
2901  TMath::Abs(v0pos->GetLabel()),
2902  TMath::Abs(v0neg->GetLabel())};
2903  Int_t ndgCk=0;
2904  Int_t *pdgDg=0;
2905  Int_t absLabelMother=-1;
2906  Int_t nDauCand=-1;
2908  dgLabels,ndg,ndgCk,pdgDg,absLabelMother,nDauCand);
2909  }
2910  if (v0pos->GetLabel()!=-1) {
2911  AliAODMCParticle *part1 = dynamic_cast<AliAODMCParticle*>(mcArray->At(TMath::Abs(v0pos->GetLabel())));
2912  if(part1) fCandidateVariables[86]=part1->GetPdgCode();
2913  }
2914  if (v0neg->GetLabel()!=-1) {
2915  AliAODMCParticle *part2 = dynamic_cast<AliAODMCParticle*>(mcArray->At(TMath::Abs(v0neg->GetLabel())));
2916  if(part2) fCandidateVariables[87]=part2->GetPdgCode();
2917  }
2918  if (v0pos->GetLabel()!=-1 &&
2919  v0neg->GetLabel()!=-1) {
2920  const Int_t ndg=2;
2921  Int_t dgLabels[ndg]={TMath::Abs(v0pos->GetLabel()),
2922  TMath::Abs(v0neg->GetLabel())};
2923  Int_t ndgCk=0;
2924  Int_t *pdgDg=0;
2925  Int_t absLabelMother=-1;
2926  Int_t nDauCand=-1;
2928  dgLabels,ndg,ndgCk,pdgDg,absLabelMother,nDauCand);
2929  }
2930  }
2931 
2932  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
2933  AliInputEventHandler *inputHandler=(AliInputEventHandler*)mgr->GetInputEventHandler();
2934  AliPIDResponse *pidResponse=inputHandler->GetPIDResponse();
2935  fCandidateVariables[89]=pidResponse->GetTOFResponse().GetStartTimeMask(bachelor->P());
2936 
2937  //fCandidateVariables[65] = bachelor->Px();
2938  //fCandidateVariables[66] = bachelor->Py();
2939  //fCandidateVariables[67] = bachelor->Pz();
2940  //fCandidateVariables[68] = v0pos->Px();
2941  //fCandidateVariables[69] = v0pos->Py();
2942  //fCandidateVariables[70] = v0pos->Pz();
2943  //fCandidateVariables[71] = v0neg->Px();
2944  //fCandidateVariables[72] = v0neg->Py();
2945  //fCandidateVariables[73] = v0neg->Pz();
2946  //fCandidateVariables[74] = part->PxProng(0);
2947  //fCandidateVariables[75] = part->PyProng(0);
2948  //fCandidateVariables[76] = part->PzProng(0);
2949  //fCandidateVariables[77] = part->PxProng(1);
2950  //fCandidateVariables[78] = part->PyProng(1);
2951  //fCandidateVariables[79] = part->PzProng(1);
2952  //fCandidateVariables[80] = v0part->PxProng(0);
2953  //fCandidateVariables[81] = v0part->PyProng(0);
2954  //fCandidateVariables[82] = v0part->PzProng(0);
2955  //fCandidateVariables[83] = v0part->PxProng(1);
2956  //fCandidateVariables[84] = v0part->PyProng(1);
2957  //fCandidateVariables[85] = v0part->PzProng(1);
2958  //fCandidateVariables[86] = part->QtProng(0);
2959  //fCandidateVariables[87] = part->Alpha();
2960 
2961  fVariablesTree->Fill();
2962 
2963  return;
2964 }
2965 
2966 //-------------------------------------------------------------------------------
2968  //
2970  //
2971 
2972  const char* nameoutput = GetOutputSlot(4)->GetContainer()->GetName();
2973  fVariablesTree = new TTree(nameoutput,"Candidates variables tree");
2974  Int_t nVar = 90;
2975  fCandidateVariables = new Float_t [nVar];
2976  TString * fCandidateVariableNames = new TString[nVar];
2977  fCandidateVariableNames[ 0]="isLcByMC";
2978  fCandidateVariableNames[ 1]="isV0ByMC";
2979  fCandidateVariableNames[ 2]="flagToCheckBachelor";
2980  fCandidateVariableNames[ 3]="flagToCheckV0daughters";
2981  fCandidateVariableNames[ 4]="flagToCheckCandidate";
2982  fCandidateVariableNames[ 5]="massLc2K0Sp";
2983  fCandidateVariableNames[ 6]="massLc2Lambdapi";
2984  fCandidateVariableNames[ 7]="massD2K0Spi"; // D+ -> pi+ K0S
2985  fCandidateVariableNames[ 8]="massDS2K0SK"; // D+S -> K+ K0S
2986  fCandidateVariableNames[ 9]="massK0S";
2987  fCandidateVariableNames[10]="massLambda";
2988  fCandidateVariableNames[11]="massLambdaBar";
2989  fCandidateVariableNames[12]="massGamma";
2990  fCandidateVariableNames[13]="dcaLcptp"; // DCA Lc prong-to-prong
2991  fCandidateVariableNames[14]="dcaV0ptp";
2992  fCandidateVariableNames[15]="tImpParBach";
2993  fCandidateVariableNames[16]="tImpParV0";
2994  fCandidateVariableNames[17]="dcaV0postoPV";
2995  fCandidateVariableNames[18]="dcaV0negtoPV";
2996  fCandidateVariableNames[19]="cosPALc";
2997  fCandidateVariableNames[20]="cosPAK0S";
2998  fCandidateVariableNames[21]="rhoV0";
2999  fCandidateVariableNames[22]="nSigmaITSpr";
3000  fCandidateVariableNames[23]="nSigmaITSpi";
3001  fCandidateVariableNames[24]="nSigmaITSka";
3002  fCandidateVariableNames[25]="nSigmaTPCpr";
3003  fCandidateVariableNames[26]="nSigmaTPCpi";
3004  fCandidateVariableNames[27]="nSigmaTPCka";
3005  fCandidateVariableNames[28]="nSigmaTOFpr";
3006  fCandidateVariableNames[29]="nSigmaTOFpi";
3007  fCandidateVariableNames[30]="nSigmaTOFka";
3008  fCandidateVariableNames[31]="yLc";
3009  fCandidateVariableNames[32]="etaBach"; // etaBachelor
3010  fCandidateVariableNames[33]="etaV0pos"; // etaV0pos
3011  fCandidateVariableNames[34]="etaV0neg"; // etaV0neg
3012  fCandidateVariableNames[35]="LcP"; // @ DCA
3013  fCandidateVariableNames[36]="LcPt"; // @ DCA
3014  fCandidateVariableNames[37]="v0P"; // @ V0 DCA
3015  fCandidateVariableNames[38]="v0Pt"; // @ V0 DCA
3016  fCandidateVariableNames[39]="bachelorP"; // @ prim vtx
3017  fCandidateVariableNames[40]="bachelorPt"; // @ prim vtx
3018  fCandidateVariableNames[41]="V0positiveP"; // @ prim vtx
3019  fCandidateVariableNames[42]="V0positivePt"; // @ prim vtx
3020  fCandidateVariableNames[43]="V0negativeP"; // @ prim vtx
3021  fCandidateVariableNames[44]="V0negativePt"; // @ prim vtx
3022  fCandidateVariableNames[45]="decayLengthLc";
3023  fCandidateVariableNames[46]="decayLengthV0";
3024  fCandidateVariableNames[47]="cosPALcXY"; // cosPA XY x Lc
3025  fCandidateVariableNames[48]="cosPAV0XY"; // cosPA XY x V0
3026  fCandidateVariableNames[49]="decayLengthLcXY"; // decay length XY x Lc
3027  fCandidateVariableNames[50]="decayLengthV0XY"; // decay length XY x V0
3028  fCandidateVariableNames[51]="normalizedDecayLengthLc"; // normalized decay length x Lc
3029  fCandidateVariableNames[52]="normalizedDecayLengthV0"; // normalized decay length x V0
3030  fCandidateVariableNames[53]="normalizedDecayLengthXYLc"; // normalized decay length XY x Lc
3031  fCandidateVariableNames[54]="normalizedDecayLengthXYV0"; // normalized decay length XY x V0
3032  fCandidateVariableNames[55]="newLcDCA";
3033  fCandidateVariableNames[56]="xVtxLcBad";
3034  fCandidateVariableNames[57]="yVtxLcBad";
3035  fCandidateVariableNames[58]="zVtxLcBad";
3036  fCandidateVariableNames[59]="xVtxLcGood";
3037  fCandidateVariableNames[60]="yVtxLcGood";
3038  fCandidateVariableNames[61]="zVtxLcGood";
3039  fCandidateVariableNames[62]="xVtxLcMC";
3040  fCandidateVariableNames[63]="yVtxLcMC";
3041  fCandidateVariableNames[64]="zVtxLcMC";
3042  fCandidateVariableNames[65]="pxVtxBachelorBad";
3043  fCandidateVariableNames[66]="pyVtxBachelorBad";
3044  fCandidateVariableNames[67]="pxVtxBachelorGood";
3045  fCandidateVariableNames[68]="pyVtxBachelorGood";
3046  fCandidateVariableNames[69]="pxVtxV0";
3047  fCandidateVariableNames[70]="pyVtxV0";
3048  fCandidateVariableNames[71]="xPvtx";
3049  fCandidateVariableNames[72]="yPvtx";
3050  fCandidateVariableNames[73]="zPvtx";
3051  fCandidateVariableNames[74]="cosThetaStarBachelor";
3052  fCandidateVariableNames[75]="cosThetaStarV0";
3053  fCandidateVariableNames[76]="etaV0";
3054  fCandidateVariableNames[77]="yV0";
3055  fCandidateVariableNames[78]="pzVtxBachelorGood";
3056  fCandidateVariableNames[79]="pzVtxV0";
3057  fCandidateVariableNames[80]="bachelorCharge";
3058  fCandidateVariableNames[81]="isMCparticleInFiducialAcceptance";
3059  fCandidateVariableNames[82]="massKstar12K0Spi"; // Kstar( 892)+ -> pi+ K0S
3060  fCandidateVariableNames[83]="massKstar22K0Spi"; // Kstar(1430)+ -> pi+ K0S
3061  fCandidateVariableNames[84]="pdgBachelor"; // pdg MC bachelor
3062  fCandidateVariableNames[85]="pdgCandidate"; // pdg MC candidate recovered via new method
3063  fCandidateVariableNames[86]="pdgV0pos"; // pdg MC V0 positive
3064  fCandidateVariableNames[87]="pdgV0neg"; // pdg MC V0 negative
3065  fCandidateVariableNames[88]="pdgV0Candidate"; // pdg MC V0candidate recovered via new method
3066  fCandidateVariableNames[89]="startTimeMask"; // start time mask
3067 
3068  //fCandidateVariableNames[65]="bachelorPx";
3069  //fCandidateVariableNames[66]="bachelorPy";
3070  //fCandidateVariableNames[67]="bachelorPz";
3071  //fCandidateVariableNames[68]="V0positivePx";
3072  //fCandidateVariableNames[69]="V0positivePy";
3073  //fCandidateVariableNames[70]="V0positivePz";
3074  //fCandidateVariableNames[71]="V0negativePx";
3075  //fCandidateVariableNames[72]="V0negativePy";
3076  //fCandidateVariableNames[73]="V0negativePz";
3077  //fCandidateVariableNames[74]="bachelorPxDCA";
3078  //fCandidateVariableNames[75]="bachelorPyDCA";
3079  //fCandidateVariableNames[76]="bachelorPzDCA";
3080  //fCandidateVariableNames[77]="v0PxDCA";
3081  //fCandidateVariableNames[78]="v0PyDCA";
3082  //fCandidateVariableNames[79]="v0PzDCA";
3083  //fCandidateVariableNames[80]="V0positivePxDCA";
3084  //fCandidateVariableNames[81]="V0positivePyDCA";
3085  //fCandidateVariableNames[82]="V0positivePzDCA";
3086  //fCandidateVariableNames[83]="V0negativePxDCA";
3087  //fCandidateVariableNames[84]="V0negativePyDCA";
3088  //fCandidateVariableNames[85]="V0negativePzDCA";
3089  //fCandidateVariableNames[86]="qtLc";
3090  //fCandidateVariableNames[87]="alphaLc";
3091 
3092  for (Int_t ivar=0; ivar<nVar; ivar++) {
3093  fVariablesTree->Branch(fCandidateVariableNames[ivar].Data(),&fCandidateVariables[ivar],Form("%s/f",fCandidateVariableNames[ivar].Data()));
3094  }
3095 
3096  return;
3097 }
3098 
3099 //__________________________________________________________________________
3101  //
3103  //
3104 
3105  fCEvents = new TH1F("fCEvents","conter",18,0,18);
3106  fCEvents->SetStats(kTRUE);
3107  fCEvents->GetXaxis()->SetBinLabel(1,"X1");
3108  fCEvents->GetXaxis()->SetBinLabel(2,"Analyzed events");
3109  fCEvents->GetXaxis()->SetBinLabel(3,"AliAODVertex exists");
3110  fCEvents->GetXaxis()->SetBinLabel(4,"CascadesHF exists");
3111  fCEvents->GetXaxis()->SetBinLabel(5,"MCarray exists");
3112  fCEvents->GetXaxis()->SetBinLabel(6,"MCheader exists");
3113  fCEvents->GetXaxis()->SetBinLabel(7,"GetNContributors()>0");
3114  fCEvents->GetXaxis()->SetBinLabel(8,"IsEventSelected");
3115  fCEvents->GetXaxis()->SetBinLabel(9,"triggerClass!=CINT1");
3116  fCEvents->GetXaxis()->SetBinLabel(10,"triggerMask!=kAnyINT");
3117  fCEvents->GetXaxis()->SetBinLabel(11,"triggerMask!=kAny");
3118  fCEvents->GetXaxis()->SetBinLabel(12,"vtxTitle.Contains(Z)");
3119  fCEvents->GetXaxis()->SetBinLabel(13,"vtxTitle.Contains(3D)");
3120  fCEvents->GetXaxis()->SetBinLabel(14,"vtxTitle.Doesn'tContain(Z-3D)");
3121  fCEvents->GetXaxis()->SetBinLabel(15,Form("zVtx<=%2.0fcm",fAnalCuts->GetMaxVtxZ()));
3122  fCEvents->GetXaxis()->SetBinLabel(16,"!IsEventSelected");
3123  fCEvents->GetXaxis()->SetBinLabel(17,"triggerMask!=kAnyINT || triggerClass!=CINT1");
3124  fCEvents->GetXaxis()->SetBinLabel(18,Form("zVtxMC<=%2.0fcm",fAnalCuts->GetMaxVtxZ()));
3125  //fCEvents->GetXaxis()->SetTitle("");
3126  fCEvents->GetYaxis()->SetTitle("counts");
3127 
3128  fOutput->Add(fCEvents);
3129  TString fillthis="";
3130 
3131  if (fUseMCInfo && fAdditionalChecks) {
3132  fillthis="histMcStatLc";
3133  TH1F* mcStatisticLc = new TH1F(fillthis.Data(),"#Lambda_{c} generated and their decays",21,-10.5,10.5);
3134  fOutput->Add(mcStatisticLc);
3135  }
3136 
3137  //fillthis="histopionV0SigmaVspTOF";
3138  //TH2F *hpionV0SigmaVspTOF=new TH2F(fillthis.Data(),fillthis.Data(),300,0.,30.,100,-5.,5.);
3139  fillthis="histoprotonBachSigmaVspTOF";
3140  TH2F *hprotonBachSigmaVspTOF=new TH2F(fillthis.Data(),fillthis.Data(),300,0.,30.,100,-5.,5.);
3141 
3142  //fOutput->Add(hpionV0SigmaVspTOF);
3143  fOutput->Add(hprotonBachSigmaVspTOF);
3144 
3145  //fillthis="histopionV0SigmaVspTPC";
3146  //TH2F *hpionV0SigmaVspTPC=new TH2F(fillthis.Data(),fillthis.Data(),300,0.,30.,100,-5.,5.);
3147  fillthis="histoprotonBachSigmaVspTPC";
3148  TH2F *hprotonBachSigmaVspTPC=new TH2F(fillthis.Data(),fillthis.Data(),300,0.,30.,100,-5.,5.);
3149 
3150  //fOutput->Add(hpionV0SigmaVspTPC);
3151  fOutput->Add(hprotonBachSigmaVspTPC);
3152 
3153  if (fUseMCInfo) {
3154 
3155  //fillthis="histopionV0SigmaVspTOFsgn";
3156  //TH2F *hpionV0SigmaVspTOFsgn=new TH2F(fillthis.Data(),fillthis.Data(),300,0.,30.,100,-5.,5.);
3157  fillthis="histoprotonBachSigmaVspTOFsgn";
3158  TH2F *hprotonBachSigmaVspTOFsgn=new TH2F(fillthis.Data(),fillthis.Data(),300,0.,30.,100,-5.,5.);
3159 
3160  //fOutput->Add(hpionV0SigmaVspTOFsgn);
3161  fOutput->Add(hprotonBachSigmaVspTOFsgn);
3162 
3163  //fillthis="histopionV0SigmaVspTPCsgn";
3164  //TH2F *hpionV0SigmaVspTPCsgn=new TH2F(fillthis.Data(),fillthis.Data(),300,0.,30.,100,-5.,5.);
3165  fillthis="histoprotonBachSigmaVspTPCsgn";
3166  TH2F *hprotonBachSigmaVspTPCsgn=new TH2F(fillthis.Data(),fillthis.Data(),300,0.,30.,100,-5.,5.);
3167 
3168  //fOutput->Add(hpionV0SigmaVspTPCsgn);
3169  fOutput->Add(hprotonBachSigmaVspTPCsgn);
3170 
3171 
3172  //fillthis="histopionV0SigmaVspTOFbkg";
3173  //TH2F *hpionV0SigmaVspTOFbkg=new TH2F(fillthis.Data(),fillthis.Data(),300,0.,30.,100,-5.,5.);
3174  fillthis="histoprotonBachSigmaVspTOFbkg";
3175  TH2F *hprotonBachSigmaVspTOFbkg=new TH2F(fillthis.Data(),fillthis.Data(),300,0.,30.,100,-5.,5.);
3176 
3177  //fOutput->Add(hpionV0SigmaVspTOFbkg);
3178  fOutput->Add(hprotonBachSigmaVspTOFbkg);
3179 
3180  //fillthis="histopionV0SigmaVspTPCbkg";
3181  //TH2F *hpionV0SigmaVspTPCbkg=new TH2F(fillthis.Data(),fillthis.Data(),300,0.,30.,100,-5.,5.);
3182  fillthis="histoprotonBachSigmaVspTPCbkg";
3183  TH2F *hprotonBachSigmaVspTPCbkg=new TH2F(fillthis.Data(),fillthis.Data(),300,0.,30.,100,-5.,5.);
3184 
3185  //fOutput->Add(hpionV0SigmaVspTPCbkg);
3186  fOutput->Add(hprotonBachSigmaVspTPCbkg);
3187 
3188  }
3189 
3190  if (fAdditionalChecks) {
3191 
3192  TH1F *hZ2 = new TH1F("hZ2","",100,-50.,50.);
3193  fOutput->Add(hZ2);
3194  TH1F *hZ3 = new TH1F("hZ3","",100,-50.,50.);
3195  fOutput->Add(hZ3);
3196  TH1F *hZ4 = new TH1F("hZ4","",100,-50.,50.);
3197  fOutput->Add(hZ4);
3198  TH1F *hZ5 = new TH1F("hZ5","",100,-50.,50.);
3199  fOutput->Add(hZ5);
3200  TH1F *hZ6 = new TH1F("hZ6","",100,-50.,50.);
3201  fOutput->Add(hZ6);
3202  TH1F *hZ7 = new TH1F("hZ7","",100,-50.,50.);
3203  fOutput->Add(hZ7);
3204  TH1F *hZ8 = new TH1F("hZ8","",100,-50.,50.);
3205  fOutput->Add(hZ8);
3206  TH1F *hZ9 = new TH1F("hZ9","",100,-50.,50.);
3207  fOutput->Add(hZ9);
3208  TH1F *hZ10 = new TH1F("hZ10","",100,-50.,50.);
3209  fOutput->Add(hZ10);
3210  TH1F *hZ11 = new TH1F("hZ11","",100,-50.,50.);
3211  fOutput->Add(hZ11);
3212  TH1F *hZ12 = new TH1F("hZ12","",100,-50.,50.);
3213  fOutput->Add(hZ12);
3214  TH1F *hZ13 = new TH1F("hZ13","",100,-50.,50.);
3215  fOutput->Add(hZ13);
3216  TH1F *hZ14 = new TH1F("hZ14","",100,-50.,50.);
3217  fOutput->Add(hZ14);
3218  TH1F *hZ15 = new TH1F("hZ15","",100,-50.,50.);
3219  fOutput->Add(hZ15);
3220  TH1F *hZ16 = new TH1F("hZ16","",100,-50.,50.);
3221  fOutput->Add(hZ16);
3222  }
3223 
3224  TH1F *hCandidateSelection = new TH1F("hCandidateSelection","",10,-0.5,9.5);
3225  hCandidateSelection->GetXaxis()->SetBinLabel(1,"IsEventSelected");
3226  hCandidateSelection->GetXaxis()->SetBinLabel(2,"IsSecondaryVtx");
3227  hCandidateSelection->GetXaxis()->SetBinLabel(3,"V0toPosNeg");
3228  hCandidateSelection->GetXaxis()->SetBinLabel(4,"offlineV0");
3229  hCandidateSelection->GetXaxis()->SetBinLabel(5,"isInFiducialAcceptance");
3230  hCandidateSelection->GetXaxis()->SetBinLabel(6,"analCuts::kTracks");
3231  hCandidateSelection->GetXaxis()->SetBinLabel(7,"analCuts::kCandidateNoPID");
3232  hCandidateSelection->GetXaxis()->SetBinLabel(8,"analCuts::kPID");
3233  hCandidateSelection->GetXaxis()->SetBinLabel(9,"analCuts::kCandidateWithPID");
3234  hCandidateSelection->GetXaxis()->SetBinLabel(10,"analCuts::kAll");
3235  fOutput->Add(hCandidateSelection);
3236 
3237  TH1F *hEventsWithCandidates = new TH1F("hEventsWithCandidates","conter",11,5.5,16.5);
3238  hEventsWithCandidates->GetXaxis()->SetBinLabel(1,"GetNContributors()>0");
3239  hEventsWithCandidates->GetXaxis()->SetBinLabel(2,"IsEventSelected");
3240  hEventsWithCandidates->GetXaxis()->SetBinLabel(3,"triggerClass!=CINT1");
3241  hEventsWithCandidates->GetXaxis()->SetBinLabel(4,"triggerMask!=kAnyINT");
3242  hEventsWithCandidates->GetXaxis()->SetBinLabel(5,"triggerMask!=kAny");
3243  hEventsWithCandidates->GetXaxis()->SetBinLabel(6,"vtxTitle.Contains(Z)");
3244  hEventsWithCandidates->GetXaxis()->SetBinLabel(7,"vtxTitle.Contains(3D)");
3245  hEventsWithCandidates->GetXaxis()->SetBinLabel(8,"vtxTitle.Doesn'tContain(Z-3D)");
3246  hEventsWithCandidates->GetXaxis()->SetBinLabel(9,Form("zVtx<=%2.0fcm",fAnalCuts->GetMaxVtxZ()));
3247  hEventsWithCandidates->GetXaxis()->SetBinLabel(10,"!IsEventSelected");
3248  hEventsWithCandidates->GetXaxis()->SetBinLabel(11,"triggerMask!=kAnyINT || triggerClass!=CINT1");
3249  fOutput->Add(hEventsWithCandidates);
3250 
3251  if (fAdditionalChecks) {
3252 
3253  TH1F *hZ6a = new TH1F("hZ6a","",100,-50.,50.);
3254  fOutput->Add(hZ6a);
3255  TH1F *hZ7a = new TH1F("hZ7a","",100,-50.,50.);
3256  fOutput->Add(hZ7a);
3257  TH1F *hZ8a = new TH1F("hZ8a","",100,-50.,50.);
3258  fOutput->Add(hZ8a);
3259  TH1F *hZ9a = new TH1F("hZ9a","",100,-50.,50.);
3260  fOutput->Add(hZ9a);
3261  TH1F *hZ10a = new TH1F("hZ10a","",100,-50.,50.);
3262  fOutput->Add(hZ10a);
3263  TH1F *hZ11a = new TH1F("hZ11a","",100,-50.,50.);
3264  fOutput->Add(hZ11a);
3265  TH1F *hZ12a = new TH1F("hZ12a","",100,-50.,50.);
3266  fOutput->Add(hZ12a);
3267  TH1F *hZ13a = new TH1F("hZ13a","",100,-50.,50.);
3268  fOutput->Add(hZ13a);
3269  TH1F *hZ14a = new TH1F("hZ14a","",100,-50.,50.);
3270  fOutput->Add(hZ14a);
3271  TH1F *hZ15a = new TH1F("hZ15a","",100,-50.,50.);
3272  fOutput->Add(hZ15a);
3273  TH1F *hZ16a = new TH1F("hZ16a","",100,-50.,50.);
3274  fOutput->Add(hZ16a);
3275  }
3276 
3277  TH1F *hSwitchOnCandidates1 = new TH1F("hSwitchOnCandidates1","",15,-7.5,7.5);
3278  fOutput->Add(hSwitchOnCandidates1);
3279  TH1F *hSwitchOnCandidates2 = new TH1F("hSwitchOnCandidates2","",15,-7.5,7.5);
3280  fOutput->Add(hSwitchOnCandidates2);
3281  TH1F *hSwitchOnCandidates3 = new TH1F("hSwitchOnCandidates3","",15,-7.5,7.5);
3282  fOutput->Add(hSwitchOnCandidates3);
3283  TH1F *hSwitchOnCandidates4 = new TH1F("hSwitchOnCandidates4","",15,-7.5,7.5);
3284  fOutput->Add(hSwitchOnCandidates4);
3285 
3286  return;
3287 }
3288 
3289 //________________________________________________________________________
3291  //
3292  // This is to fill analysis histograms
3293  //
3294 
3295  TString fillthis="";
3296 
3297  Bool_t isBachelorID = (((cutsAnal->IsSelected(part,AliRDHFCuts::kPID))&(AliRDHFCutsLctoV0::kLcToK0Spr))==(AliRDHFCutsLctoV0::kLcToK0Spr)); // ID x bachelor
3298 
3299  Bool_t areCutsUsingPID = cutsAnal->GetIsUsePID();
3300  cutsAnal->SetUsePID(kFALSE);
3301 
3302  Double_t invmassLc = part->InvMassLctoK0sP();
3303  Double_t lambdacpt = part->Pt();
3304 
3305  AliAODTrack *bachelor = (AliAODTrack*)part->GetBachelor();
3306  Double_t momBach = bachelor->P();
3307  Double_t ptBach = bachelor->Pt();
3308 
3309  AliAODv0 *v0part = (AliAODv0*)part->Getv0();
3310  Double_t momK0S = v0part->P();
3311  Double_t ptK0S = v0part->Pt();
3312  //Double_t dcaV0ptp = v0part->GetDCA();
3313  Double_t invmassK0S = v0part->MassK0Short();
3314 
3315  AliAODTrack *v0pos = (AliAODTrack*)part->Getv0PositiveTrack();
3316  Double_t ptV0pos = v0pos->Pt();
3317  AliAODTrack *v0neg = (AliAODTrack*)part->Getv0NegativeTrack();
3318  Double_t ptV0neg = v0neg->Pt();
3319 
3320  fillthis="histK0SMass"+appendthis;
3321  // cout << fillthis << endl;
3322  cutsAnal->SetExcludedCut(2);
3324  ((TH2F*)(fOutputAll->FindObject(fillthis)))->Fill(lambdacpt,invmassK0S);
3325  if (isBachelorID) ((TH2F*)(fOutputPIDBach->FindObject(fillthis)))->Fill(lambdacpt,invmassK0S);
3326  }
3327  cutsAnal->SetExcludedCut(-1);
3328 
3329  fillthis="histpK0Svsp"+appendthis;
3330  // cout << fillthis << endl;
3332  ((TH2F*)(fOutputAll->FindObject(fillthis)))->Fill(momBach,momK0S);
3333  if (isBachelorID) ((TH2F*)(fOutputPIDBach->FindObject(fillthis)))->Fill(momBach,momK0S);
3334  }
3335 
3336  fillthis="histLcMassByK0S"+appendthis;
3337  // cout << fillthis << endl;
3339  ((TH2F*)(fOutputAll->FindObject(fillthis)))->Fill(invmassLc,lambdacpt);
3340  if (isBachelorID)((TH2F*)(fOutputPIDBach->FindObject(fillthis)))->Fill(invmassLc,lambdacpt);
3341  }
3342 
3343 
3344 
3345 
3346  fillthis="histptK0S"+appendthis;
3347  // cout << fillthis << endl;
3348  cutsAnal->SetExcludedCut(15);
3350  ((TH2F*)(fOutputAll->FindObject(fillthis)))->Fill(lambdacpt,ptK0S);
3351  if (isBachelorID)((TH2F*)(fOutputPIDBach->FindObject(fillthis)))->Fill(lambdacpt,ptK0S);
3352  }
3353 
3354  fillthis="histptP"+appendthis;
3355  // cout << fillthis << endl;
3356  cutsAnal->SetExcludedCut(4);
3358  ((TH2F*)(fOutputAll->FindObject(fillthis)))->Fill(lambdacpt,ptBach);
3359  if (isBachelorID)((TH2F*)(fOutputPIDBach->FindObject(fillthis)))->Fill(lambdacpt,ptBach);
3360  }
3361 
3362  fillthis="histptPip"+appendthis;
3363  // cout << fillthis << endl;
3364  cutsAnal->SetExcludedCut(5);
3366  ((TH2F*)(fOutputAll->FindObject(fillthis)))->Fill(lambdacpt,ptV0pos);
3367  if (isBachelorID)((TH2F*)(fOutputPIDBach->FindObject(fillthis)))->Fill(lambdacpt,ptV0pos);
3368  }
3369 
3370  fillthis="histptPim"+appendthis;
3371  // cout << fillthis << endl;
3372  cutsAnal->SetExcludedCut(6);
3374  ((TH2F*)(fOutputAll->FindObject(fillthis)))->Fill(lambdacpt,ptV0neg);
3375  if (isBachelorID)((TH2F*)(fOutputPIDBach->FindObject(fillthis)))->Fill(lambdacpt,ptV0neg);
3376  }
3377 
3378  fillthis="histLambdaMass"+appendthis;
3379  // cout << fillthis << endl;
3380  cutsAnal->SetExcludedCut(13);
3382  ((TH2F*)(fOutputAll->FindObject(fillthis)))->Fill(lambdacpt,v0part->MassLambda());
3383  if (isBachelorID)((TH2F*)(fOutputPIDBach->FindObject(fillthis)))->Fill(lambdacpt,v0part->MassLambda());
3384  }
3385 
3386  fillthis="histLambdaBarMass"+appendthis;
3387  // cout << fillthis << endl;
3388  cutsAnal->SetExcludedCut(13);
3390  ((TH2F*)(fOutputAll->FindObject(fillthis)))->Fill(lambdacpt,v0part->MassAntiLambda());
3391  if (isBachelorID)((TH2F*)(fOutputPIDBach->FindObject(fillthis)))->Fill(lambdacpt,v0part->MassAntiLambda());
3392  }
3393 
3394  fillthis="histGammaMass"+appendthis;
3395  // cout << fillthis << endl;
3396  cutsAnal->SetExcludedCut(14);
3398  ((TH2F*)(fOutputAll->FindObject(fillthis)))->Fill(lambdacpt,v0part->InvMass2Prongs(0,1,11,11));
3399  if (isBachelorID)((TH2F*)(fOutputPIDBach->FindObject(fillthis)))->Fill(lambdacpt,v0part->InvMass2Prongs(0,1,11,11));
3400  }
3401 
3402  fillthis="histD0K0S"+appendthis;
3403  // cout << fillthis << endl;
3404  cutsAnal->SetExcludedCut(11);
3406  ((TH2F*)(fOutputAll->FindObject(fillthis)))->Fill(lambdacpt,part->Getd0Prong(1));
3407  if (isBachelorID)((TH2F*)(fOutputPIDBach->FindObject(fillthis)))->Fill(lambdacpt,part->Getd0Prong(1));
3408  }
3409 
3410  fillthis="histD0P"+appendthis;
3411  // cout << fillthis << endl;
3412  cutsAnal->SetExcludedCut(10);
3414  ((TH2F*)(fOutputAll->FindObject(fillthis)))->Fill(lambdacpt,part->Getd0Prong(0));
3415  if (isBachelorID)((TH2F*)(fOutputPIDBach->FindObject(fillthis)))->Fill(lambdacpt,part->Getd0Prong(0));
3416  }
3417 
3418  fillthis="histCosPAK0S"+appendthis;
3419  // cout << fillthis << endl;
3420  cutsAnal->SetExcludedCut(9);
3422  ((TH2F*)(fOutputAll->FindObject(fillthis)))->Fill(lambdacpt,part->CosV0PointingAngle());
3423  if (isBachelorID)((TH2F*)(fOutputPIDBach->FindObject(fillthis)))->Fill(lambdacpt,part->CosV0PointingAngle());
3424  }
3425  cutsAnal->SetExcludedCut(-1);
3426 
3427  cutsAnal->SetUsePID(areCutsUsingPID);
3428 
3429  return;
3430 }
3431 //---------------------------
3432 Double_t AliAnalysisTaskSELc2V0bachelor::PropagateToDCA(AliAODv0 *v, AliAODTrack *bachelor, Double_t b,
3433  Double_t &xVtxLc, Double_t &yVtxLc, Double_t &zVtxLc,
3434  Double_t &pxVtxBachelor, Double_t &pyVtxBachelor, Double_t &pzVtxBachelor) {
3435  //--------------------------------------------------------------------
3438  //--------------------------------------------------------------------
3439 
3440  // Get AliExternalTrackParam out of the AliAODTracks
3441  Double_t xyz[3], pxpypz[3], cv[21]; Short_t sign;
3442  bachelor->PxPyPz(pxpypz);
3443  bachelor->XvYvZv(xyz);
3444  bachelor->GetCovarianceXYZPxPyPz(cv);
3445  sign=bachelor->Charge();
3446  AliExternalTrackParam *t = new AliExternalTrackParam(xyz,pxpypz,cv,sign);
3447 
3448  Double_t alpha=t->GetAlpha(), cs1=TMath::Cos(alpha), sn1=TMath::Sin(alpha);
3449  //Double_t alpha = GetAlpha(xyz,pxpypz), cs1=TMath::Cos(alpha), sn1=TMath::Sin(alpha);
3450 
3451  // position and momentum of bachelor
3452  Double_t x1=xyz[0], y1=xyz[1], z1=xyz[2];
3453  Double_t px1=pxpypz[0], py1=pxpypz[1], pz1=pxpypz[2];
3454 
3455  // position and momentum of V0
3456  Double_t x2=v->DecayVertexV0X(),
3457  y2=v->DecayVertexV0Y(),
3458  z2=v->DecayVertexV0Z();
3459  Double_t px2=v->Px(),
3460  py2=v->Py(),
3461  pz2=v->Pz();
3462 
3463  /*
3464  AliAODTrack *trackP = (AliAODTrack*) v->GetDaughter(0);
3465  //Double_t pxpypzP[3]; trackP->PxPyPz(pxpypzP);
3466  //Double_t xyzP[3]; trackP->XvYvZv(xyzP);
3467  Double_t cvP[21]; trackP->GetCovarianceXYZPxPyPz(cvP);
3468  //Short_t signP=trackP->Charge();
3469  //AliExternalTrackParam *tP = new AliExternalTrackParam(xyzP,pxpypzP,cvP,signP);
3470 
3471  // Get AliExternalTrackParam out of the AliAODTrack
3472  AliAODTrack *trackN = (AliAODTrack*) v->GetDaughter(1);
3473  //Double_t pxpypzN[3]; trackN->PxPyPz(pxpypzN);
3474  //Double_t xyzN[3]; trackN->XvYvZv(xyzN);
3475  Double_t cvN[21]; trackN->GetCovarianceXYZPxPyPz(cvN);
3476  //Short_t signN=trackN->Charge();
3477  //AliExternalTrackParam *tN = new AliExternalTrackParam(xyzN,pxpypzN,cvN,signN);
3478 
3479  Double_t xyzV0[3]={x2,y2,z2};
3480  Double_t pxpypzV0[3]={px2,py2,pz2};
3481  Double_t cvV0[21]; for (Int_t ii=0; ii<21; ii++) cvV0[ii]=cvP[ii]+cvN[ii];
3482  AliNeutralTrackParam *trackV0 = new AliNeutralTrackParam(xyzV0,pxpypzV0,cvV0,0);
3483  */
3484 
3485  // calculation dca
3486  Double_t dd= Det(x2-x1,y2-y1,z2-z1,px1,py1,pz1,px2,py2,pz2);
3487  Double_t ax= Det(py1,pz1,py2,pz2);
3488  Double_t ay=-Det(px1,pz1,px2,pz2);
3489  Double_t az= Det(px1,py1,px2,py2);
3490 
3491  Double_t dca=TMath::Abs(dd)/TMath::Sqrt(ax*ax + ay*ay + az*az);
3492 
3493  // bachelor point @ the DCA
3494  Double_t t1 = Det(x2-x1,y2-y1,z2-z1,px2,py2,pz2,ax,ay,az)/
3495  Det(px1,py1,pz1,px2,py2,pz2,ax,ay,az);
3496  x1 += px1*t1; y1 += py1*t1; z1 += pz1*t1;
3497 
3498  //propagate track to the point of DCA
3499  Double_t rho1=x1*cs1 + y1*sn1;
3500  if (!t->PropagateTo(rho1,b)) {
3501  Error("PropagateToDCA","Propagation failed !");
3502  delete t; t=NULL;
3503  return 1.e+33;
3504  }
3505 
3506  Double_t pBachelorDCA[3]; t->GetPxPyPz(pBachelorDCA);
3507  pxVtxBachelor=pBachelorDCA[0], pyVtxBachelor=pBachelorDCA[1], pzVtxBachelor=pBachelorDCA[2];
3508 
3509  delete t; t=NULL;
3510 
3511  // V0 point @ the DCA
3512  Double_t t2 = Det(x1-x2,y1-y2,z1-z2,px1,py1,pz1,ax,ay,az)/
3513  Det(px2,py2,pz2,px1,py1,pz1,ax,ay,az);
3514  x2 += px2*t2; y2 += py2*t2; z2 += pz2*t2;
3515 
3516 
3517  // Lc decay vtx
3518  xVtxLc = 0.5*(x1+x2);
3519  yVtxLc = 0.5*(y1+y2);
3520  zVtxLc = 0.5*(z1+z2);
3521 
3522  return dca;
3523 
3524 }
3525 
3526 //---------------------------
3527 Double_t AliAnalysisTaskSELc2V0bachelor::GetAlpha(Double_t xyz[3],Double_t pxpypz[3])
3528 {
3529  //
3531  //
3532 
3533  Double_t alpha = 0.;
3534 
3535  const double kSafe = 1e-5;
3536  Double_t radPos2 = xyz[0]*xyz[0]+xyz[1]*xyz[1];
3537  Double_t radMax = 45.; // approximately ITS outer radius
3538  if (radPos2 < radMax*radMax) { // inside the ITS
3539  alpha = TMath::ATan2(pxpypz[1],pxpypz[0]);
3540  } else { // outside the ITS
3541  Float_t phiPos = TMath::Pi()+TMath::ATan2(-xyz[1], -xyz[0]);
3542  alpha =
3543  TMath::DegToRad()*(20*((((Int_t)(phiPos*TMath::RadToDeg()))/20))+10);
3544  }
3545 
3546  Double_t cs=TMath::Cos(alpha), sn=TMath::Sin(alpha);
3547  // protection: avoid alpha being too close to 0 or +-pi/2
3548  if (TMath::Abs(sn)<2*kSafe) {
3549  if (alpha>0) alpha += alpha< TMath::Pi()/2. ? 2*kSafe : -2*kSafe;
3550  else alpha += alpha>-TMath::Pi()/2. ? -2*kSafe : 2*kSafe;
3551  cs=TMath::Cos(alpha);
3552  sn=TMath::Sin(alpha);
3553  }
3554  else if (TMath::Abs(cs)<2*kSafe) {
3555  if (alpha>0) alpha += alpha> TMath::Pi()/2. ? 2*kSafe : -2*kSafe;
3556  else alpha += alpha>-TMath::Pi()/2. ? 2*kSafe : -2*kSafe;
3557  cs=TMath::Cos(alpha);
3558  sn=TMath::Sin(alpha);
3559  }
3560 
3561 
3562  return alpha;
3563 }
3564 
3565 //---------------------------
3566 Double_t AliAnalysisTaskSELc2V0bachelor::Det(Double_t a00, Double_t a01,
3567  Double_t a10, Double_t a11) const {
3568  //--------------------------------------------------------------------
3571  //--------------------------------------------------------------------
3572  return a00*a11 - a01*a10;
3573 }
3574 
3575 //---------------------------
3576 Double_t AliAnalysisTaskSELc2V0bachelor::Det(Double_t a00,Double_t a01,Double_t a02,
3577  Double_t a10,Double_t a11,Double_t a12,
3578  Double_t a20,Double_t a21,Double_t a22) const {
3579  //--------------------------------------------------------------------
3582  //--------------------------------------------------------------------
3583  return a00*Det(a11,a12,a21,a22)-a01*Det(a10,a12,a20,a22)+a02*Det(a10,a11,a20,a21);
3584 }
3585 
3586 //----------------------------------------------------------------------------
3588  TClonesArray *mcArray)
3589 {
3590  //
3594  //
3595 
3596  AliAODv0 *theV0 = dynamic_cast<AliAODv0*>(candidate->Getv0()); // the V0
3597  AliVTrack *trk = dynamic_cast<AliVTrack*>(candidate->GetBachelor()); // the bachelor
3598  if (!trk || !theV0) return -1;
3599 
3600  if (trk->GetLabel()==-1) return -1;
3601  Int_t bachLabels = TMath::Abs(trk->GetLabel());
3602  AliAODMCParticle*bachelorMC = dynamic_cast<AliAODMCParticle*>(mcArray->At(bachLabels));
3603  if (!bachelorMC) return -1;
3604  if (TMath::Abs(bachelorMC->GetPdgCode())!=2212) return -1;
3605  Int_t indexMotherBach = bachelorMC->GetMother();
3606  if (indexMotherBach==-1) return -1;
3607 
3608  Int_t pdgDg2prong[2] = {211,211};
3609  Int_t lab2Prong = theV0->MatchToMC(310,mcArray,2,pdgDg2prong); // the V0
3610  if(lab2Prong<0) return -1;
3611  AliAODMCParticle*partK0S = dynamic_cast<AliAODMCParticle*>(mcArray->At(lab2Prong));
3612  if (!partK0S) return -1;
3613  Int_t indexMotherK0S = partK0S->GetMother();
3614  if (indexMotherK0S==-1) return -1;
3615  AliAODMCParticle*partK0 = dynamic_cast<AliAODMCParticle*>(mcArray->At(indexMotherK0S));
3616  if (!partK0) return -1;
3617  Int_t indexMotherK0 = partK0->GetMother();
3618  if (indexMotherK0==-1) return -1;
3619 
3620  if (indexMotherBach!=indexMotherK0) return -1; // p e K0S sono fratelli
3621 
3622  AliAODMCParticle*partLc = dynamic_cast<AliAODMCParticle*>(mcArray->At(indexMotherK0));
3623  if (!partLc) return -1;
3624  Int_t ndg2 = partLc->GetDaughter(1)-partLc->GetDaughter(0)+1;
3625  if (ndg2==2) return -1;
3626 
3627  TString stringaCheck = Form(">>>>>>>> %d -> ",partLc->GetPdgCode());
3628  for(Int_t ii=0; ii<ndg2; ii++) {
3629  AliAODMCParticle* partDau=(AliAODMCParticle*)(mcArray->At(partLc->GetDaughter(0)+ii));
3630  stringaCheck.Append(Form(" %d",partDau->GetPdgCode()));
3631  }
3632  //printf("%s \n",stringaCheck.Data());
3633 
3634  return indexMotherBach;
3635 
3636 }
3637 //--------------------------------------------------------------------------
3639  Int_t dgLabels[10],Int_t ndg,
3640  Int_t &ndgCk, Int_t *pdgDg, Int_t &absLabelMother, Int_t &nDauCand) const
3641 {
3647 
3648  Int_t lab=-1,labMother=-1,pdgMother=0;
3649  AliAODMCParticle *part=0;
3650  AliAODMCParticle *mother=0;
3651 
3652  // loop on daughter labels
3653  TArrayI **labelMother = new TArrayI*[ndg];
3654  for(Int_t i=0; i<ndg; i++) labelMother[i] = new TArrayI(0);
3655  for(Int_t i=0; i<ndg; i++) {
3656  lab = TMath::Abs(dgLabels[i]);
3657  if(lab<0) {
3658  AliDebug(2,Form("daughter with negative label %d",lab));
3659  delete [] labelMother;
3660  return 0;
3661  }
3662  part = (AliAODMCParticle*)mcArray->At(lab);
3663  if(!part) {
3664  AliDebug(2,"no MC particle");
3665  delete [] labelMother;
3666  return 0;
3667  }
3668 
3669  mother = part;
3670  while(mother->GetMother()>=0) {
3671  labMother=mother->GetMother();
3672  mother = (AliAODMCParticle*)mcArray->At(labMother);
3673  if(!mother) {
3674  AliDebug(2,"no MC mother particle");
3675  break;
3676  }
3677  pdgMother = TMath::Abs(mother->GetPdgCode());
3678  if (pdgMother<10 || (pdgMother>18 && pdgMother<111)) {
3679  break;
3680  }
3681  labelMother[i]->Set(labelMother[i]->GetSize()+1);
3682  labelMother[i]->AddAt(labMother,labelMother[i]->GetSize()-1);
3683  }
3684 
3685  } // end loop on daughters
3686 
3687 
3688  TString stringaCheck;
3689  for(Int_t i=0; i<ndg; i++) {
3690  AliAODMCParticle*part0 = (AliAODMCParticle*)mcArray->At(TMath::Abs(dgLabels[i]));
3691  stringaCheck.Append(Form("part[%d]->GetLabel()=%d(%d) | ",i,dgLabels[i],part0->GetPdgCode()));
3692  stringaCheck.Append(Form("labelMother[%d] = ",i));
3693  for (Int_t jj=0;jj<labelMother[i]->GetSize(); jj++)
3694  stringaCheck.Append(Form("%d, ",labelMother[i]->At(jj)));
3695  }
3696  AliDebug(2,Form("%s \n",stringaCheck.Data()));
3697  Int_t pdgToBeReturned=0;
3698 
3699  TString stringaCheck2;
3700  ndgCk=ndg;
3701  pdgDg = new Int_t[ndgCk];
3702  for (Int_t index=1; index<ndg; index++) {
3703  Bool_t found=kFALSE;
3704  for (Int_t jj=0;jj<labelMother[index]->GetSize(); jj++) {
3705  for (Int_t ii=0;ii<labelMother[0]->GetSize(); ii++) {
3706  if (labelMother[0]->At(ii)==labelMother[index]->At(jj) &&
3707  labelMother[0]->At(ii)!=0 && labelMother[0]->At(ii)!=1 && !found) {
3708  mother = (AliAODMCParticle*)mcArray->At(labelMother[0]->At(ii));
3709  pdgToBeReturned=mother->GetPdgCode();
3710  absLabelMother=labelMother[0]->At(ii);
3711  AliDebug(2,Form("FOUND label for the mother of this candidate: %d (PDG=%d)\n",labelMother[0]->At(ii),pdgToBeReturned));
3712  //mother->Print();
3713  nDauCand=mother->GetNDaughters();
3714  found = kTRUE;
3715  AliAODMCParticle *partMC = (AliAODMCParticle*)mcArray->At(dgLabels[0]);
3716  pdgDg[0]=partMC->GetPdgCode();
3717  partMC = (AliAODMCParticle*)mcArray->At(dgLabels[index]);
3718  pdgDg[index]=partMC->GetPdgCode();
3719  if (index==1) stringaCheck2.Append(Form("found daughters -> %d(%d)",dgLabels[0],pdgDg[0]));
3720  stringaCheck2.Append(Form(" %d(%d)",dgLabels[index],pdgDg[index]));
3721  break;
3722  }
3723  }
3724  if (found) break;
3725  }
3726  }
3727  stringaCheck2.Prepend(Form("Ecco quanto trovato: %d(%d) with %d daughters; ",absLabelMother,pdgToBeReturned,nDauCand));
3728  AliDebug(2,Form("%s \n",stringaCheck2.Data()));
3729 
3730  delete [] labelMother;
3731  delete [] pdgDg;
3732 
3733  return pdgToBeReturned;
3734 
3735 }
3736 
3738 {
3739 
3740  AliAODRecoCascadeHF *partCopy = new AliAODRecoCascadeHF(*part);
3741 
3742  Double_t px[2]={partCopy->PxProng(0),partCopy->PxProng(1)};
3743  Double_t py[2]={partCopy->PyProng(0),partCopy->PyProng(1)};
3744  Double_t pz[2]={partCopy->PzProng(0),partCopy->PzProng(1)};
3745 
3746  Double_t pt = partCopy->Pt();
3747  Int_t pdgD=4122;
3748  UInt_t pdgLc2pK0S[2]={2212,310};
3749  Double_t minv2 = partCopy->InvMass2(2,pdgLc2pK0S);
3750  Double_t mass=TMath::Sqrt(minv2);
3751  Double_t rapid = partCopy->Y(pdgD);
3752 
3753  TString fillthis;
3754 
3756  fillthis="hMassVsPtVsY"+appendthis;
3757  //cout << fillthis << endl;
3758  ((TH3F*)(fOutputPIDBachTR->FindObject(fillthis)))->Fill(mass,pt,rapid);
3759 
3760  fillthis="phiVSthetaVSpt"+appendthis;
3761  //cout << fillthis << endl;
3762  ((TH3F*)(fOutputPIDBachTR->FindObject(fillthis)))->Fill(pt,part->Phi(),part->Theta());
3763  }
3764 
3765  Int_t nRotated=0;
3766  Double_t massRot=0;// calculated later only if candidate is acceptable
3767  // Double_t angleProngXY=TMath::ACos((px[0]*px[1]+py[0]*py[1])/TMath::Sqrt((px[0]*px[0]+py[0]*py[0])*(px[1]*px[1]+py[1]*py[1])));
3768  // Double_t ptOrig=pt;
3769  Double_t rotStep=(fMaxAngleForRot-fMinAngleForRot)/(fNRotations-1); // -1 is to ensure that the last rotation is done with angle=fMaxAngleForRot
3770 
3771  for(Int_t irot=0; irot<fNRotations; irot++){
3772  Double_t phirot=fMinAngleForRot+rotStep*irot;
3773  Double_t tmpx=px[0];
3774  Double_t tmpy=py[0];
3775  px[0]=tmpx*TMath::Cos(phirot)-tmpy*TMath::Sin(phirot);
3776  py[0]=tmpx*TMath::Sin(phirot)+tmpy*TMath::Cos(phirot);
3777  partCopy->SetPxPyPzProngs(2,px,py,pz);
3778  pt = partCopy->Pt();
3779  minv2 = partCopy->InvMass2(2,pdgLc2pK0S);
3780  massRot=TMath::Sqrt(minv2);
3781  rapid = partCopy->Y(pdgD);
3782  //if(minv2>fMinMass*fMinMass && minv2<fMaxMass*fMaxMass){
3783  if ( cuts->IsInFiducialAcceptance(pt,partCopy->Y(4122)) ) {
3785 
3786  fillthis="histLcMassByK0S"+appendthis;
3787  //cout << fillthis << endl;
3788  ((TH2F*)(fOutputPIDBachTR->FindObject(fillthis)))->Fill(massRot,pt);
3789 
3790  fillthis="hMassVsPtVsYRot"+appendthis;
3791  //cout << fillthis << endl;
3792  ((TH3F*)(fOutputPIDBachTR->FindObject(fillthis)))->Fill(mass,pt,rapid);
3793 
3794  fillthis="phiVSthetaVSptRot"+appendthis;
3795  //cout << fillthis << endl;
3796  ((TH3F*)(fOutputPIDBachTR->FindObject(fillthis)))->Fill(pt,partCopy->Phi(),partCopy->Theta());
3797 
3798  fillthis="hDeltaMass"+appendthis;
3799  //cout << fillthis << endl;
3800  ((TH1F*)(fOutputPIDBachTR->FindObject(fillthis)))->Fill(massRot-mass);
3801  //if(fFullAnalysis){
3802  //Double_t pointRot[5]={mass,massRot-mass,ptOrig,pt-ptOrig,angleProngXY};
3803  //fillthis="hDeltaMassFullAnalysis"+appendthis;
3805  //((THnSparse*)(fOutputPIDBachTR->FindObject(fillthis)))->Fill(pointRot);
3806  //}
3807  nRotated++;
3808  //}
3809  }
3810 
3811  // fill additional histos for track-rotated candidates
3812  fillthis="histptK0S"+appendthis;
3813  //cout << fillthis << endl;
3814  cuts->SetExcludedCut(15);
3816  ((TH2F*)(fOutputPIDBachTR->FindObject(fillthis)))->Fill(pt,TMath::Sqrt(px[1]*px[1]+py[1]*py[1]));
3817  }
3818 
3819  fillthis="histptP"+appendthis;
3820  //cout << fillthis << endl;
3821  cuts->SetExcludedCut(4);
3823  ((TH2F*)(fOutputPIDBachTR->FindObject(fillthis)))->Fill(pt,TMath::Sqrt(px[0]*px[0]+py[0]*py[0]));
3824  }
3825 
3826  fillthis="histptPip"+appendthis;
3827  //cout << fillthis << endl;
3828  cuts->SetExcludedCut(5);
3830  ((TH2F*)(fOutputPIDBachTR->FindObject(fillthis)))->Fill(pt,(partCopy->Getv0PositiveTrack())->Pt());
3831  }
3832 
3833  fillthis="histptPim"+appendthis;
3834  //cout << fillthis << endl;
3835  cuts->SetExcludedCut(6);
3837  ((TH2F*)(fOutputPIDBachTR->FindObject(fillthis)))->Fill(pt,(partCopy->Getv0NegativeTrack())->Pt());
3838  }
3839 
3840  fillthis="histLambdaMass"+appendthis;
3841  //cout << fillthis << endl;
3842  cuts->SetExcludedCut(13);
3844  ((TH2F*)(fOutputPIDBachTR->FindObject(fillthis)))->Fill(pt,(partCopy->Getv0())->MassLambda());
3845  }
3846 
3847  fillthis="histLambdaBarMass"+appendthis;
3848  //cout << fillthis << endl;
3849  cuts->SetExcludedCut(13);
3851  ((TH2F*)(fOutputPIDBachTR->FindObject(fillthis)))->Fill(pt,(partCopy->Getv0())->MassAntiLambda());
3852  }
3853 
3854  fillthis="histGammaMass"+appendthis;
3855  //cout << fillthis << endl;
3856  cuts->SetExcludedCut(14);
3858  ((TH2F*)(fOutputPIDBachTR->FindObject(fillthis)))->Fill(pt,(partCopy->Getv0())->InvMass2Prongs(0,1,11,11));
3859  }
3860 
3861  fillthis="histCosPAK0S"+appendthis;
3862  //cout << fillthis << endl;
3863  cuts->SetExcludedCut(9);
3865  ((TH2F*)(fOutputPIDBachTR->FindObject(fillthis)))->Fill(pt,partCopy->CosV0PointingAngle());
3866  }
3867  cuts->SetExcludedCut(-1);
3868 
3869  } // isInFiducialAcceptance
3870 
3871  px[0]=tmpx;
3872  py[0]=tmpy;
3873  }
3874  fillthis="hNormRotated"+appendthis;
3875  //cout << fillthis << endl;
3876  ((TH1F*)(fOutputPIDBachTR->FindObject(fillthis)))->Fill(nRotated);
3877 
3878  delete partCopy;
3879 
3880  return;
3881 
3882 }
Int_t IsSelectedSingleCut(TObject *obj, Int_t selectionLevel, Int_t cutIndex)
Double_t NormalizedDecayLengthXY() const
virtual Int_t IsSelected(TObject *obj, Int_t selectionLevel)
Double_t NormalizedDecayLength() const
ClassImp(AliAnalysisTaskTriggerRates) AliAnalysisTaskTriggerRates
Bool_t fIsEventSelected
flag to analyze also on-the-fly V0 candidates
void StoreCandidates(AliVEvent *, Int_t nCand=0, Bool_t flagFilter=kTRUE)
Double_t Det(Double_t a00, Double_t a01, Double_t a10, Double_t a11) const
Int_t GetnSigmaTOF(AliAODTrack *track, Int_t species, Double_t &sigma) const
Bool_t fAdditionalChecks
magnetic field value [kG]
void TrackRotation(AliRDHFCutsLctoV0 *cutsAnal, AliAODRecoCascadeHF *part, TString appendthis)
Double_t NormalizedV0DecayLength() const
Int_t MatchToMC(Int_t pdgabs, Int_t pdgabs2prong, Int_t *pdgDg, Int_t *pdgDg2prong, TClonesArray *mcArray, Bool_t isV0=kFALSE) const
AliAODTrack * Getv0NegativeTrack() const
TTree * fVariablesTree
flag to decide whether to write the candidate variables on a tree variables
Int_t GetnSigmaTPC(AliAODTrack *track, Int_t species, Double_t &sigma) const
Double_t mass
AliAODv0 * Getv0() const
Double_t InvMassLctoLambdaPi() const
Double_t CosV0PointingAngleXY() const
Double_t GetAlpha(Double_t xyz[3], Double_t pxpypz[3])
Double_t NormalizedV0DecayLengthXY() const
Double_t CosPointingAngleXY() const
void FillTheTree(AliAODRecoCascadeHF *part, AliRDHFCutsLctoV0 *cutsAnal, TClonesArray *mcArray, Int_t isLc)
Int_t SearchForCommonMother(TClonesArray *mcArray, Int_t dgLabels[10], Int_t ndg, Int_t &ndgCk, Int_t *pdgDg, Int_t &labelMother, Int_t &nDauCand) const
Bool_t fWriteVariableTree
flag for event selected
Double_t DecayLengthXYV0() const
Double_t GetMaxVtxZ() const
Definition: AliRDHFCuts.h:241
TList * fOutputPIDBachTR
flag to check track rotation
Double_t InvMassLctoK0sP() const
AliAODPidHF * GetPidHF() const
Definition: AliRDHFCuts.h:231
AliNormalizationCounter * fCounter
Histogram to check selected events.
AliAODTrack * Getv0PositiveTrack() const
void MakeAnalysisForLc2prK0S(TClonesArray *arrayLctopK0S, TClonesArray *mcArray, Int_t &nSelectedAnal, AliRDHFCutsLctoV0 *cutsAnal)
void SetExcludedCut(Int_t excludedCut)
Int_t MatchToMC(AliAODRecoCascadeHF *lc2bacV0, Int_t *pdgDgLc2bacV0, Int_t *pdgDgV0, TClonesArray *mcArray)
Bool_t fUseOnTheFlyV0
Cuts - sent to output slot 3.
TList * fOutputAll
User output slot 1 // general histos.
AliAODTrack * GetBachelor() const
AliAODVertex * GetOwnPrimaryVtx() const
TList * fOutputPIDBach
User output slot 4 // histos without pid and cut on V0.
Int_t SearchLcDaughter(TClonesArray *arrayMC, Int_t iii)
Double_t CosV0PointingAngle() const
Bool_t Data(TH1F *h, Double_t *rangefit, Bool_t writefit, Double_t &sgn, Double_t &errsgn, Double_t &bkg, Double_t &errbkg, Double_t &sgnf, Double_t &errsgnf, Double_t &sigmafit, Int_t &status)
TH1F * fCEvents
User output slot 5 // histos with PID on Bachelor.
void SetOwnPrimaryVtx(const AliAODVertex *vtx)
void FillLc2pK0Sspectrum(AliAODRecoCascadeHF *part, Int_t isLc, Int_t &nSelectedAnal, AliRDHFCutsLctoV0 *cutsAnal, TClonesArray *mcArray)
histos
Double_t DecayLengthXY() const
Int_t GetnSigmaITS(AliAODTrack *track, Int_t species, Double_t &sigma) const
Bool_t IsEventSelected(AliVEvent *event)
void SetUsePID(Bool_t flag=kTRUE)
Definition: AliRDHFCuts.h:204
Double_t PropagateToDCA(AliAODv0 *v, AliAODTrack *bachelor, Double_t b, Double_t &xVtxLc, Double_t &yVtxLc, Double_t &zVtxLc, Double_t &pxVtxLc, Double_t &pyVtxLc, Double_t &pzVtxLc)
Int_t MatchToMClabelC(AliAODRecoCascadeHF *candidate, TClonesArray *mcArray)
Bool_t fTrackRotation
flag to fill additional histograms
Float_t * fCandidateVariables
! variables to be written to the tree
AliRDHFCutsLctoV0 * fAnalCuts
AliNormalizationCounter on output slot 2.
void FillArmPodDistribution(AliAODRecoDecay *vZero, TString histoTitle, Bool_t isCandidateSelectedCuts, Bool_t isBachelorID)
void CheckCandidatesAtDifferentLevels(AliAODRecoCascadeHF *part, AliRDHFCutsLctoV0 *cutsAnal)
Bool_t GetIsUsePID() const
Definition: AliRDHFCuts.h:253
Double_t fMinAngleForRot
User output slot 6 // histos with PID on Bachelor and track rotation.
void CheckEventSelectionWithCandidates(AliAODEvent *aodEvent)
void StoreEvent(AliVEvent *, AliRDHFCuts *, Bool_t mc=kFALSE, Int_t multiplicity=-9999)
Double_t CosPointingAngle() const
Double_t DecayLengthV0() const
void SetTriggerClass(TString trclass0, TString trclass1="")
Definition: AliRDHFCuts.h:192
virtual Bool_t IsInFiducialAcceptance(Double_t pt, Double_t y) const
Double_t DecayLength() const
void FillAnalysisHistograms(AliAODRecoCascadeHF *part, AliRDHFCutsLctoV0 *cutsAnal, TString appendthis)
virtual void UserCreateOutputObjects()
Implementation of interface methods.